Skip to content

Commit c971f08

Browse files
David WoodhouseDavid Woodhouse
authored andcommitted
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: David Woodhouse <David.Woodhouse@intel.com> Acked-by: Krzysztof Mazur <krzysiek@podlesie.net>
1 parent 7ad3ead commit c971f08

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

‎include/linux/atmdev.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ struct atm_vcc {
9999
struct atm_dev *dev; /* device back pointer */
100100
struct atm_qos qos; /* QOS */
101101
struct atm_sap sap; /* SAP */
102+
void (*release_cb)(struct atm_vcc *vcc); /* release_sock callback */
102103
void (*push)(struct atm_vcc *vcc,struct sk_buff *skb);
103104
void (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */
104105
int (*push_oam)(struct atm_vcc *vcc,void *cell);

‎net/atm/common.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,19 @@ static void vcc_write_space(struct sock *sk)
126126
rcu_read_unlock();
127127
}
128128

129+
static void vcc_release_cb(struct sock *sk)
130+
{
131+
struct atm_vcc *vcc = atm_sk(sk);
132+
133+
if (vcc->release_cb)
134+
vcc->release_cb(vcc);
135+
}
136+
129137
static struct proto vcc_proto = {
130138
.name = "VCC",
131139
.owner = THIS_MODULE,
132140
.obj_size = sizeof(struct atm_vcc),
141+
.release_cb = vcc_release_cb,
133142
};
134143

135144
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)
158167
vcc->pop = NULL;
159168
vcc->owner = NULL;
160169
vcc->push_oam = NULL;
170+
vcc->release_cb = NULL;
161171
vcc->vpi = vcc->vci = 0; /* no VCI/VPI yet */
162172
vcc->atm_options = vcc->aal_options = 0;
163173
sk->sk_destruct = vcc_sock_destruct;

0 commit comments

Comments
 (0)