Commit c971f08c authored by David Woodhouse's avatar David Woodhouse

atm: add release_cb() callback to vcc

The immediate use case for this is that it will allow us to ensure that a
pppoatm queue is woken after it has to drop a packet due to the sock being
locked.

Note that 'release_cb' is called when the socket is *unlocked*. This is
not to be confused with vcc_release() — which probably ought to be called
vcc_close().
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
Acked-by: default avatarKrzysztof Mazur <krzysiek@podlesie.net>
parent 7ad3eade
...@@ -99,6 +99,7 @@ struct atm_vcc { ...@@ -99,6 +99,7 @@ struct atm_vcc {
struct atm_dev *dev; /* device back pointer */ struct atm_dev *dev; /* device back pointer */
struct atm_qos qos; /* QOS */ struct atm_qos qos; /* QOS */
struct atm_sap sap; /* SAP */ struct atm_sap sap; /* SAP */
void (*release_cb)(struct atm_vcc *vcc); /* release_sock callback */
void (*push)(struct atm_vcc *vcc,struct sk_buff *skb); void (*push)(struct atm_vcc *vcc,struct sk_buff *skb);
void (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */ void (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */
int (*push_oam)(struct atm_vcc *vcc,void *cell); int (*push_oam)(struct atm_vcc *vcc,void *cell);
......
...@@ -126,10 +126,19 @@ static void vcc_write_space(struct sock *sk) ...@@ -126,10 +126,19 @@ static void vcc_write_space(struct sock *sk)
rcu_read_unlock(); rcu_read_unlock();
} }
static void vcc_release_cb(struct sock *sk)
{
struct atm_vcc *vcc = atm_sk(sk);
if (vcc->release_cb)
vcc->release_cb(vcc);
}
static struct proto vcc_proto = { static struct proto vcc_proto = {
.name = "VCC", .name = "VCC",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.obj_size = sizeof(struct atm_vcc), .obj_size = sizeof(struct atm_vcc),
.release_cb = vcc_release_cb,
}; };
int vcc_create(struct net *net, struct socket *sock, int protocol, int family) int vcc_create(struct net *net, struct socket *sock, int protocol, int family)
...@@ -158,6 +167,7 @@ int vcc_create(struct net *net, struct socket *sock, int protocol, int family) ...@@ -158,6 +167,7 @@ int vcc_create(struct net *net, struct socket *sock, int protocol, int family)
vcc->pop = NULL; vcc->pop = NULL;
vcc->owner = NULL; vcc->owner = NULL;
vcc->push_oam = NULL; vcc->push_oam = NULL;
vcc->release_cb = NULL;
vcc->vpi = vcc->vci = 0; /* no VCI/VPI yet */ vcc->vpi = vcc->vci = 0; /* no VCI/VPI yet */
vcc->atm_options = vcc->aal_options = 0; vcc->atm_options = vcc->aal_options = 0;
sk->sk_destruct = vcc_sock_destruct; sk->sk_destruct = vcc_sock_destruct;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment