]> git.pld-linux.org Git - packages/kernel.git/blame - atm-13-atm_vcc-cleanup.patch
- added description of djurban's branch
[packages/kernel.git] / atm-13-atm_vcc-cleanup.patch
CommitLineData
b5a39c4d
JR
1it has been suggested that atm_vcc has redundant members with
2struct sock.
3
4this patch removes family, tx_inuse, rx_inuse, and recvq from
5atm_vcc in favor of sk->family, sk->wmem_alloc, sk->rmem_alloc,
6and sk->receive_queue (respectively). listenq and backlog_quota
7should be removed as well but i need to think about them for a
8bit. also, atm_dev now uses the list manipulation routines (converting
9the vccs lists is a bit more involved since some the atm drivers know
10too much)
11
12
13Index: linux/include/linux/atmdev.h
14===================================================================
15RCS file: /home/chas/CVSROOT/linux/include/linux/atmdev.h,v
16retrieving revision 1.2
17diff -u -r1.2 atmdev.h
18--- linux/include/linux/atmdev.h 20 Feb 2003 20:17:59 -0000 1.2
19+++ linux/include/linux/atmdev.h 5 Mar 2003 00:05:46 -0000
20@@ -277,7 +277,6 @@
21
22 struct atm_vcc {
23 unsigned long flags; /* VCC flags (ATM_VF_*) */
24- unsigned char family; /* address family; 0 if unused */
25 short vpi; /* VPI and VCI (types must be equal */
26 /* with sockaddr) */
27 int vci;
28@@ -286,7 +285,6 @@
29 struct atm_dev *dev; /* device back pointer */
30 struct atm_qos qos; /* QOS */
31 struct atm_sap sap; /* SAP */
32- atomic_t tx_inuse,rx_inuse; /* buffer space in use */
33 void (*push)(struct atm_vcc *vcc,struct sk_buff *skb);
34 void (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */
35 struct sk_buff *(*alloc_tx)(struct atm_vcc *vcc,unsigned int size);
36@@ -297,7 +295,6 @@
37 int (*send)(struct atm_vcc *vcc,struct sk_buff *skb);
38 void *dev_data; /* per-device data */
39 void *proto_data; /* per-protocol data */
40- struct sk_buff_head recvq; /* receive queue */
41 struct k_atm_aal_stats *stats; /* pointer to AAL stats group */
42 wait_queue_head_t sleep; /* if socket is busy */
43 struct sock *sk; /* socket backpointer */
44@@ -346,7 +343,7 @@
45 struct proc_dir_entry *proc_entry; /* proc entry */
46 char *proc_name; /* proc entry name */
47 #endif
48- struct atm_dev *prev,*next; /* linkage */
49+ struct list_head dev_list; /* linkage */
50 };
51
52
53@@ -425,19 +422,19 @@
54
55 static __inline__ void atm_force_charge(struct atm_vcc *vcc,int truesize)
56 {
57- atomic_add(truesize+ATM_PDU_OVHD,&vcc->rx_inuse);
58+ atomic_add(truesize+ATM_PDU_OVHD,&vcc->sk->rmem_alloc);
59 }
60
61
62 static __inline__ void atm_return(struct atm_vcc *vcc,int truesize)
63 {
64- atomic_sub(truesize+ATM_PDU_OVHD,&vcc->rx_inuse);
65+ atomic_sub(truesize+ATM_PDU_OVHD,&vcc->sk->rmem_alloc);
66 }
67
68
69 static __inline__ int atm_may_send(struct atm_vcc *vcc,unsigned int size)
70 {
71- return size+atomic_read(&vcc->tx_inuse)+ATM_PDU_OVHD < vcc->sk->sndbuf;
72+ return size+atomic_read(&vcc->sk->wmem_alloc)+ATM_PDU_OVHD < vcc->sk->sndbuf;
73 }
74
75
76Index: linux/net/atm/atm_misc.c
77===================================================================
78RCS file: /home/chas/CVSROOT/linux/net/atm/atm_misc.c,v
79retrieving revision 1.1.1.1
80diff -u -r1.1.1.1 atm_misc.c
81--- linux/net/atm/atm_misc.c 20 Feb 2003 13:46:30 -0000 1.1.1.1
82+++ linux/net/atm/atm_misc.c 4 Mar 2003 23:29:50 -0000
83@@ -16,7 +16,7 @@
84 int atm_charge(struct atm_vcc *vcc,int truesize)
85 {
86 atm_force_charge(vcc,truesize);
87- if (atomic_read(&vcc->rx_inuse) <= vcc->sk->rcvbuf) return 1;
88+ if (atomic_read(&vcc->sk->rmem_alloc) <= vcc->sk->rcvbuf) return 1;
89 atm_return(vcc,truesize);
90 atomic_inc(&vcc->stats->rx_drop);
91 return 0;
92@@ -29,11 +29,11 @@
93 int guess = atm_guess_pdu2truesize(pdu_size);
94
95 atm_force_charge(vcc,guess);
96- if (atomic_read(&vcc->rx_inuse) <= vcc->sk->rcvbuf) {
97+ if (atomic_read(&vcc->sk->rmem_alloc) <= vcc->sk->rcvbuf) {
98 struct sk_buff *skb = alloc_skb(pdu_size,gfp_flags);
99
100 if (skb) {
101- atomic_add(skb->truesize-guess,&vcc->rx_inuse);
102+ atomic_add(skb->truesize-guess,&vcc->sk->rmem_alloc);
103 return skb;
104 }
105 }
106Index: linux/net/atm/clip.c
107===================================================================
108RCS file: /home/chas/CVSROOT/linux/net/atm/clip.c,v
109retrieving revision 1.3
110diff -u -r1.3 clip.c
111--- linux/net/atm/clip.c 4 Mar 2003 20:48:04 -0000 1.3
112+++ linux/net/atm/clip.c 4 Mar 2003 23:45:45 -0000
113@@ -63,7 +63,7 @@
114 ctrl->itf_num = itf;
115 ctrl->ip = ip;
116 atm_force_charge(atmarpd,skb->truesize);
117- skb_queue_tail(&atmarpd->recvq,skb);
118+ skb_queue_tail(&atmarpd->sk->receive_queue,skb);
119 wake_up(&atmarpd->sleep);
120 return 0;
121 }
122@@ -426,7 +426,7 @@
123 memcpy(here,llc_oui,sizeof(llc_oui));
124 ((u16 *) here)[3] = skb->protocol;
125 }
126- atomic_add(skb->truesize,&vcc->tx_inuse);
127+ atomic_add(skb->truesize,&vcc->sk->wmem_alloc);
128 ATM_SKB(skb)->iovcnt = 0;
129 ATM_SKB(skb)->atm_options = vcc->atm_options;
130 entry->vccs->last_use = jiffies;
131@@ -485,7 +485,7 @@
132 vcc->push = clip_push;
133 vcc->pop = clip_pop;
134 skb_queue_head_init(&copy);
135- skb_migrate(&vcc->recvq,&copy);
136+ skb_migrate(&vcc->sk->receive_queue,&copy);
137 /* re-process everything received between connection setup and MKIP */
138 while ((skb = skb_dequeue(&copy)))
139 if (!clip_devs) {
140@@ -691,10 +691,10 @@
141 barrier();
142 unregister_inetaddr_notifier(&clip_inet_notifier);
143 unregister_netdevice_notifier(&clip_dev_notifier);
144- if (skb_peek(&vcc->recvq))
145+ if (skb_peek(&vcc->sk->receive_queue))
146 printk(KERN_ERR "atmarpd_close: closing with requests "
147 "pending\n");
148- skb_queue_purge(&vcc->recvq);
149+ skb_queue_purge(&vcc->sk->receive_queue);
150 DPRINTK("(done)\n");
151 module_put(THIS_MODULE);
152 }
153Index: linux/net/atm/common.c
154===================================================================
155RCS file: /home/chas/CVSROOT/linux/net/atm/common.c,v
156retrieving revision 1.6
157diff -u -r1.6 common.c
158--- linux/net/atm/common.c 3 Mar 2003 22:23:13 -0000 1.6
159+++ linux/net/atm/common.c 5 Mar 2003 00:15:53 -0000
160@@ -91,14 +91,14 @@
161 {
162 struct sk_buff *skb;
163
164- if (atomic_read(&vcc->tx_inuse) && !atm_may_send(vcc,size)) {
165- DPRINTK("Sorry: tx_inuse = %d, size = %d, sndbuf = %d\n",
166- atomic_read(&vcc->tx_inuse),size,vcc->sk->sndbuf);
167+ if (atomic_read(&vcc->sk->wmem_alloc) && !atm_may_send(vcc,size)) {
168+ DPRINTK("Sorry: wmem_alloc = %d, size = %d, sndbuf = %d\n",
169+ atomic_read(&vcc->sk->wmem_alloc),size,vcc->sk->sndbuf);
170 return NULL;
171 }
172 while (!(skb = alloc_skb(size,GFP_KERNEL))) schedule();
173- DPRINTK("AlTx %d += %d\n",atomic_read(&vcc->tx_inuse),skb->truesize);
174- atomic_add(skb->truesize+ATM_PDU_OVHD,&vcc->tx_inuse);
175+ DPRINTK("AlTx %d += %d\n",atomic_read(&vcc->sk->wmem_alloc),skb->truesize);
176+ atomic_add(skb->truesize+ATM_PDU_OVHD,&vcc->sk->wmem_alloc);
177 return skb;
178 }
179
180@@ -114,21 +114,19 @@
181 vcc = atm_sk(sk);
182 memset(&vcc->flags,0,sizeof(vcc->flags));
183 vcc->dev = NULL;
184- vcc->family = sock->ops->family;
185 vcc->alloc_tx = alloc_tx;
186 vcc->callback = NULL;
187 memset(&vcc->local,0,sizeof(struct sockaddr_atmsvc));
188 memset(&vcc->remote,0,sizeof(struct sockaddr_atmsvc));
189 vcc->qos.txtp.max_sdu = 1 << 16; /* for meta VCs */
190- atomic_set(&vcc->tx_inuse,0);
191- atomic_set(&vcc->rx_inuse,0);
192+ atomic_set(&vcc->sk->wmem_alloc,0);
193+ atomic_set(&vcc->sk->rmem_alloc,0);
194 vcc->push = NULL;
195 vcc->pop = NULL;
196 vcc->push_oam = NULL;
197 vcc->vpi = vcc->vci = 0; /* no VCI/VPI yet */
198 vcc->atm_options = vcc->aal_options = 0;
199 init_waitqueue_head(&vcc->sleep);
200- skb_queue_head_init(&vcc->recvq);
201 skb_queue_head_init(&vcc->listenq);
202 sk->sleep = &vcc->sleep;
203 sock->sk = sk;
204@@ -145,7 +143,7 @@
205 if (vcc->dev) {
206 if (vcc->dev->ops->close) vcc->dev->ops->close(vcc);
207 if (vcc->push) vcc->push(vcc,NULL); /* atmarpd has no push */
208- while ((skb = skb_dequeue(&vcc->recvq))) {
209+ while ((skb = skb_dequeue(&vcc->sk->receive_queue))) {
210 atm_return(vcc,skb->truesize);
211 if (vcc->dev->ops->free_rx_skb)
212 vcc->dev->ops->free_rx_skb(vcc,skb);
213@@ -153,10 +151,10 @@
214 }
215 down(&atm_dev_sem);
216 fops_put (vcc->dev->ops);
217- if (atomic_read(&vcc->rx_inuse))
218+ if (atomic_read(&vcc->sk->rmem_alloc))
219 printk(KERN_WARNING "atm_release_vcc: strange ... "
220- "rx_inuse == %d after closing\n",
221- atomic_read(&vcc->rx_inuse));
222+ "rmem_alloc == %d after closing\n",
223+ atomic_read(&vcc->sk->rmem_alloc));
224 bind_vcc(vcc,NULL);
225 } else
226 down(&atm_dev_sem);
227@@ -311,11 +309,15 @@
228 if (error) return error;
229 }
230 else {
231- struct atm_dev *dev;
232+ struct atm_dev *dev = NULL;
233+ struct list_head *p;
234
235 down(&atm_dev_sem);
236- for (dev = atm_devs; dev; dev = dev->next)
237+ list_for_each(p, &atm_devs) {
238+ dev = list_entry(p, struct atm_dev, dev_list);
239 if (!atm_do_connect_dev(vcc,dev,vpi,vci)) break;
240+ dev = NULL;
241+ }
242 up(&atm_dev_sem);
243 if (!dev) return -ENODEV;
244 }
245@@ -360,7 +362,7 @@
246 add_wait_queue(&vcc->sleep,&wait);
247 set_current_state(TASK_INTERRUPTIBLE);
248 error = 1; /* <= 0 is error */
249- while (!(skb = skb_dequeue(&vcc->recvq))) {
250+ while (!(skb = skb_dequeue(&vcc->sk->receive_queue))) {
251 if (test_bit(ATM_VF_RELEASED,&vcc->flags) ||
252 test_bit(ATM_VF_CLOSE,&vcc->flags)) {
253 error = vcc->reply;
254@@ -391,7 +393,7 @@
255 if (vcc->dev->ops->feedback)
256 vcc->dev->ops->feedback(vcc,skb,(unsigned long) skb->data,
257 (unsigned long) buff,eff_len);
258- DPRINTK("RcvM %d -= %d\n",atomic_read(&vcc->rx_inuse),skb->truesize);
259+ DPRINTK("RcvM %d -= %d\n",atomic_read(&vcc->sk->rmem_alloc),skb->truesize);
260 atm_return(vcc,skb->truesize);
261 if (ATM_SKB(skb)->iovcnt) { /* @@@ hack */
262 /* iovcnt set, use scatter-gather for receive */
263@@ -494,14 +496,14 @@
264 vcc = ATM_SD(sock);
265 poll_wait(file,&vcc->sleep,wait);
266 mask = 0;
267- if (skb_peek(&vcc->recvq) || skb_peek(&vcc->listenq))
268+ if (skb_peek(&vcc->sk->receive_queue) || skb_peek(&vcc->listenq))
269 mask |= POLLIN | POLLRDNORM;
270 if (test_bit(ATM_VF_RELEASED,&vcc->flags) ||
271 test_bit(ATM_VF_CLOSE,&vcc->flags))
272 mask |= POLLHUP;
273 if (sock->state != SS_CONNECTING) {
274 if (vcc->qos.txtp.traffic_class != ATM_NONE &&
275- vcc->qos.txtp.max_sdu+atomic_read(&vcc->tx_inuse)+
276+ vcc->qos.txtp.max_sdu+atomic_read(&vcc->sk->wmem_alloc)+
277 ATM_PDU_OVHD <= vcc->sk->sndbuf)
278 mask |= POLLOUT | POLLWRNORM;
279 }
280@@ -552,6 +554,7 @@
281 int atm_ioctl(struct socket *sock,unsigned int cmd,unsigned long arg)
282 {
283 struct atm_dev *dev;
284+ struct list_head *p;
285 struct atm_vcc *vcc;
286 int *tmp_buf, *tmp_p;
287 void *buf;
288@@ -568,7 +571,7 @@
289 goto done;
290 }
291 ret_val = put_user(vcc->sk->sndbuf-
292- atomic_read(&vcc->tx_inuse)-ATM_PDU_OVHD,
293+ atomic_read(&vcc->sk->wmem_alloc)-ATM_PDU_OVHD,
294 (int *) arg) ? -EFAULT : 0;
295 goto done;
296 case SIOCINQ:
297@@ -579,7 +582,7 @@
298 ret_val = -EINVAL;
299 goto done;
300 }
301- skb = skb_peek(&vcc->recvq);
302+ skb = skb_peek(&vcc->sk->receive_queue);
303 ret_val = put_user(skb ? skb->len : 0,(int *) arg)
304 ? -EFAULT : 0;
305 goto done;
306@@ -596,7 +599,7 @@
307 goto done;
308 }
309 size = 0;
310- for (dev = atm_devs; dev; dev = dev->next)
311+ list_for_each(p, &atm_devs)
312 size += sizeof(int);
313 if (size > len) {
314 ret_val = -E2BIG;
315@@ -608,8 +611,10 @@
316 goto done;
317 }
318 tmp_p = tmp_buf;
319- for (dev = atm_devs; dev; dev = dev->next)
320+ list_for_each(p, &atm_devs) {
321+ dev = list_entry(p, struct atm_dev, dev_list);
322 *tmp_p++ = dev->number;
323+ }
324 ret_val = ((copy_to_user(buf, tmp_buf, size)) ||
325 put_user(size, &((struct atm_iobuf *) arg)->length)
326 ) ? -EFAULT : 0;
327@@ -990,7 +995,7 @@
328 if (!error) error = adjust_tp(&qos->rxtp,qos->aal);
329 if (error) return error;
330 if (!vcc->dev->ops->change_qos) return -EOPNOTSUPP;
331- if (vcc->family == AF_ATMPVC)
332+ if (vcc->sk->family == AF_ATMPVC)
333 return vcc->dev->ops->change_qos(vcc,qos,ATM_MF_SET);
334 return svc_change_qos(vcc,qos);
335 }
336Index: linux/net/atm/lec.c
337===================================================================
338RCS file: /home/chas/CVSROOT/linux/net/atm/lec.c,v
339retrieving revision 1.14
340diff -u -r1.14 lec.c
341--- linux/net/atm/lec.c 4 Mar 2003 20:48:28 -0000 1.14
342+++ linux/net/atm/lec.c 4 Mar 2003 23:42:21 -0000
343@@ -125,7 +125,7 @@
344
345 priv = (struct lec_priv *)dev->priv;
346 atm_force_charge(priv->lecd, skb2->truesize);
347- skb_queue_tail(&priv->lecd->recvq, skb2);
348+ skb_queue_tail(&priv->lecd->sk->receive_queue, skb2);
349 wake_up(&priv->lecd->sleep);
350 }
351
352@@ -202,7 +202,7 @@
353 lec_send(struct atm_vcc *vcc, struct sk_buff *skb, struct lec_priv *priv)
354 {
355 if (atm_may_send(vcc, skb->len)) {
356- atomic_add(skb->truesize, &vcc->tx_inuse);
357+ atomic_add(skb->truesize, &vcc->sk->wmem_alloc);
358 ATM_SKB(skb)->vcc = vcc;
359 ATM_SKB(skb)->iovcnt = 0;
360 ATM_SKB(skb)->atm_options = vcc->atm_options;
361@@ -399,7 +399,7 @@
362 int i;
363 char *tmp; /* FIXME */
364
365- atomic_sub(skb->truesize+ATM_PDU_OVHD, &vcc->tx_inuse);
366+ atomic_sub(skb->truesize+ATM_PDU_OVHD, &vcc->sk->wmem_alloc);
367 mesg = (struct atmlec_msg *)skb->data;
368 tmp = skb->data;
369 tmp += sizeof(struct atmlec_msg);
370@@ -505,7 +505,7 @@
371 skb2->len = sizeof(struct atmlec_msg);
372 memcpy(skb2->data, mesg, sizeof(struct atmlec_msg));
373 atm_force_charge(priv->lecd, skb2->truesize);
374- skb_queue_tail(&priv->lecd->recvq, skb2);
375+ skb_queue_tail(&priv->lecd->sk->receive_queue, skb2);
376 wake_up(&priv->lecd->sleep);
377 }
378 if (f != NULL) br_fdb_put_hook(f);
379@@ -534,10 +534,10 @@
380 netif_stop_queue(dev);
381 lec_arp_destroy(priv);
382
383- if (skb_peek(&vcc->recvq))
384+ if (skb_peek(&vcc->sk->receive_queue))
385 printk("%s lec_atm_close: closing with messages pending\n",
386 dev->name);
387- while ((skb = skb_dequeue(&vcc->recvq))) {
388+ while ((skb = skb_dequeue(&vcc->sk->receive_queue))) {
389 atm_return(vcc, skb->truesize);
390 dev_kfree_skb(skb);
391 }
392@@ -595,13 +595,13 @@
393 memcpy(&mesg->content.normal.atm_addr, atm_addr, ATM_ESA_LEN);
394
395 atm_force_charge(priv->lecd, skb->truesize);
396- skb_queue_tail(&priv->lecd->recvq, skb);
397+ skb_queue_tail(&priv->lecd->sk->receive_queue, skb);
398 wake_up(&priv->lecd->sleep);
399
400 if (data != NULL) {
401 DPRINTK("lec: about to send %d bytes of data\n", data->len);
402 atm_force_charge(priv->lecd, data->truesize);
403- skb_queue_tail(&priv->lecd->recvq, data);
404+ skb_queue_tail(&priv->lecd->sk->receive_queue, data);
405 wake_up(&priv->lecd->sleep);
406 }
407
408@@ -683,7 +683,7 @@
409 #endif /* DUMP_PACKETS > 0 */
410 if (memcmp(skb->data, lec_ctrl_magic, 4) ==0) { /* Control frame, to daemon*/
411 DPRINTK("%s: To daemon\n",dev->name);
412- skb_queue_tail(&vcc->recvq, skb);
413+ skb_queue_tail(&vcc->sk->receive_queue, skb);
414 wake_up(&vcc->sleep);
415 } else { /* Data frame, queue to protocol handlers */
416 unsigned char *dst;
417Index: linux/net/atm/mpc.c
418===================================================================
419RCS file: /home/chas/CVSROOT/linux/net/atm/mpc.c,v
420retrieving revision 1.4
421diff -u -r1.4 mpc.c
422--- linux/net/atm/mpc.c 3 Mar 2003 22:23:13 -0000 1.4
423+++ linux/net/atm/mpc.c 4 Mar 2003 23:42:27 -0000
424@@ -520,7 +520,7 @@
425 memcpy(skb->data, &llc_snap_mpoa_data, sizeof(struct llc_snap_hdr));
426 }
427
428- atomic_add(skb->truesize, &entry->shortcut->tx_inuse);
429+ atomic_add(skb->truesize, &entry->shortcut->sk->wmem_alloc);
430 ATM_SKB(skb)->iovcnt = 0; /* just to be safe ... */
431 ATM_SKB(skb)->atm_options = entry->shortcut->atm_options;
432 entry->shortcut->send(entry->shortcut, skb);
433@@ -665,7 +665,7 @@
434 skb->dev = dev;
435 if (memcmp(skb->data, &llc_snap_mpoa_ctrl, sizeof(struct llc_snap_hdr)) == 0) {
436 dprintk("mpoa: (%s) mpc_push: control packet arrived\n", dev->name);
437- skb_queue_tail(&vcc->recvq, skb); /* Pass control packets to daemon */
438+ skb_queue_tail(&vcc->sk->receive_queue, skb); /* Pass control packets to daemon */
439 wake_up(&vcc->sleep);
440 return;
441 }
442@@ -840,7 +840,7 @@
443 mpc->in_ops->destroy_cache(mpc);
444 mpc->eg_ops->destroy_cache(mpc);
445
446- while ( (skb = skb_dequeue(&vcc->recvq)) ){
447+ while ( (skb = skb_dequeue(&vcc->sk->receive_queue)) ){
448 atm_return(vcc, skb->truesize);
449 kfree_skb(skb);
450 }
451@@ -860,7 +860,7 @@
452
453 struct mpoa_client *mpc = find_mpc_by_vcc(vcc);
454 struct k_message *mesg = (struct k_message*)skb->data;
455- atomic_sub(skb->truesize+ATM_PDU_OVHD, &vcc->tx_inuse);
456+ atomic_sub(skb->truesize+ATM_PDU_OVHD, &vcc->sk->wmem_alloc);
457
458 if (mpc == NULL) {
459 printk("mpoa: msg_from_mpoad: no mpc found\n");
460@@ -937,7 +937,7 @@
461 skb_put(skb, sizeof(struct k_message));
462 memcpy(skb->data, mesg, sizeof(struct k_message));
463 atm_force_charge(mpc->mpoad_vcc, skb->truesize);
464- skb_queue_tail(&mpc->mpoad_vcc->recvq, skb);
465+ skb_queue_tail(&mpc->mpoad_vcc->sk->receive_queue, skb);
466 wake_up(&mpc->mpoad_vcc->sleep);
467
468 return 0;
469@@ -1214,7 +1214,7 @@
470 purge_msg->content.eg_info = entry->ctrl_info;
471
472 atm_force_charge(vcc, skb->truesize);
473- skb_queue_tail(&vcc->recvq, skb);
474+ skb_queue_tail(&vcc->sk->receive_queue, skb);
475 wake_up(&vcc->sleep);
476 dprintk("mpoa: purge_egress_shortcut: exiting:\n");
477
478Index: linux/net/atm/proc.c
479===================================================================
480RCS file: /home/chas/CVSROOT/linux/net/atm/proc.c,v
481retrieving revision 1.3
482diff -u -r1.3 proc.c
483--- linux/net/atm/proc.c 3 Mar 2003 22:23:13 -0000 1.3
484+++ linux/net/atm/proc.c 5 Mar 2003 00:19:32 -0000
485@@ -134,7 +134,7 @@
486 unsigned char *ip;
487 int svc,off,ip_len;
488
489- svc = !clip_vcc || clip_vcc->vcc->family == AF_ATMSVC;
490+ svc = !clip_vcc || clip_vcc->vcc->sk->family == AF_ATMSVC;
491 off = sprintf(buf,"%-6s%-4s%-4s%5ld ",dev->name,svc ? "SVC" : "PVC",
492 !clip_vcc || clip_vcc->encap ? "LLC" : "NULL",
493 (jiffies-(clip_vcc ? clip_vcc->last_use : entry->neigh->used))/
494@@ -209,7 +209,7 @@
495 if (!vcc->dev) here += sprintf(here,"Unassigned ");
496 else here += sprintf(here,"%3d %3d %5d ",vcc->dev->number,vcc->vpi,
497 vcc->vci);
498- switch (vcc->family) {
499+ switch (vcc->sk->family) {
500 case AF_ATMPVC:
501 here += sprintf(here,"PVC");
502 break;
503@@ -217,12 +217,12 @@
504 here += sprintf(here,"SVC");
505 break;
506 default:
507- here += sprintf(here,"%3d",vcc->family);
508+ here += sprintf(here,"%3d",vcc->sk->family);
509 }
510 here += sprintf(here," %04lx %5d %7d/%7d %7d/%7d\n",vcc->flags,
511 vcc->reply,
512- atomic_read(&vcc->tx_inuse),vcc->sk->sndbuf,
513- atomic_read(&vcc->rx_inuse),vcc->sk->rcvbuf);
514+ atomic_read(&vcc->sk->wmem_alloc),vcc->sk->sndbuf,
515+ atomic_read(&vcc->sk->rmem_alloc),vcc->sk->rcvbuf);
516 }
517
518
519@@ -302,6 +302,7 @@
520 static int atm_devices_info(loff_t pos,char *buf)
521 {
522 struct atm_dev *dev;
523+ struct list_head *p;
524 int left;
525
526 if (!pos) {
527@@ -309,10 +310,14 @@
528 "AAL(TX,err,RX,err,drop) ...\n");
529 }
530 left = pos-1;
531- for (dev = atm_devs; dev && left; dev = dev->next) left--;
532- if (!dev) return 0;
533- dev_info(dev,buf);
534- return strlen(buf);
535+ list_for_each(p, &atm_devs) {
536+ dev = list_entry(p, struct atm_dev, dev_list);
537+ if (left-- == 0) {
538+ dev_info(dev,buf);
539+ return strlen(buf);
540+ }
541+ }
542+ return 0;
543 }
544
545 /*
546@@ -323,6 +328,7 @@
547 static int atm_pvc_info(loff_t pos,char *buf)
548 {
549 struct atm_dev *dev;
550+ struct list_head *p;
551 struct atm_vcc *vcc;
552 int left;
553
554@@ -331,13 +337,15 @@
555 "TX(PCR,Class)\n");
556 }
557 left = pos-1;
558- for (dev = atm_devs; dev; dev = dev->next)
559+ list_for_each(p, &atm_devs) {
560+ dev = list_entry(p, struct atm_dev, dev_list);
561 for (vcc = dev->vccs; vcc; vcc = vcc->next)
562- if (vcc->family == PF_ATMPVC &&
563+ if (vcc->sk->family == PF_ATMPVC &&
564 vcc->dev && !left--) {
565 pvc_info(vcc,buf);
566 return strlen(buf);
567 }
568+ }
569 return 0;
570 }
571
572@@ -345,6 +353,7 @@
573 static int atm_vc_info(loff_t pos,char *buf)
574 {
575 struct atm_dev *dev;
576+ struct list_head *p;
577 struct atm_vcc *vcc;
578 int left;
579
580@@ -353,12 +362,14 @@
581 "Address"," Itf VPI VCI Fam Flags Reply Send buffer"
582 " Recv buffer\n");
583 left = pos-1;
584- for (dev = atm_devs; dev; dev = dev->next)
585+ list_for_each(p, &atm_devs) {
586+ dev = list_entry(p, struct atm_dev, dev_list);
587 for (vcc = dev->vccs; vcc; vcc = vcc->next)
588 if (!left--) {
589 vc_info(vcc,buf);
590 return strlen(buf);
591 }
592+ }
593 for (vcc = nodev_vccs; vcc; vcc = vcc->next)
594 if (!left--) {
595 vc_info(vcc,buf);
596@@ -372,20 +383,23 @@
597 static int atm_svc_info(loff_t pos,char *buf)
598 {
599 struct atm_dev *dev;
600+ struct list_head *p;
601 struct atm_vcc *vcc;
602 int left;
603
604 if (!pos)
605 return sprintf(buf,"Itf VPI VCI State Remote\n");
606 left = pos-1;
607- for (dev = atm_devs; dev; dev = dev->next)
608+ list_for_each(p, &atm_devs) {
609+ dev = list_entry(p, struct atm_dev, dev_list);
610 for (vcc = dev->vccs; vcc; vcc = vcc->next)
611- if (vcc->family == PF_ATMSVC && !left--) {
612+ if (vcc->sk->family == PF_ATMSVC && !left--) {
613 svc_info(vcc,buf);
614 return strlen(buf);
615 }
616+ }
617 for (vcc = nodev_vccs; vcc; vcc = vcc->next)
618- if (vcc->family == PF_ATMSVC && !left--) {
619+ if (vcc->sk->family == PF_ATMSVC && !left--) {
620 svc_info(vcc,buf);
621 return strlen(buf);
622 }
623Index: linux/net/atm/raw.c
624===================================================================
625RCS file: /home/chas/CVSROOT/linux/net/atm/raw.c,v
626retrieving revision 1.1.1.1
627diff -u -r1.1.1.1 raw.c
628--- linux/net/atm/raw.c 20 Feb 2003 13:46:30 -0000 1.1.1.1
629+++ linux/net/atm/raw.c 4 Mar 2003 23:42:30 -0000
630@@ -28,7 +28,7 @@
631 void atm_push_raw(struct atm_vcc *vcc,struct sk_buff *skb)
632 {
633 if (skb) {
634- skb_queue_tail(&vcc->recvq,skb);
635+ skb_queue_tail(&vcc->sk->receive_queue,skb);
636 wake_up(&vcc->sleep);
637 }
638 }
639@@ -36,8 +36,8 @@
640
641 static void atm_pop_raw(struct atm_vcc *vcc,struct sk_buff *skb)
642 {
643- DPRINTK("APopR (%d) %d -= %d\n",vcc->vci,vcc->tx_inuse,skb->truesize);
644- atomic_sub(skb->truesize+ATM_PDU_OVHD,&vcc->tx_inuse);
645+ DPRINTK("APopR (%d) %d -= %d\n",vcc->vci,vcc->sk->wmem_alloc,skb->truesize);
646+ atomic_sub(skb->truesize+ATM_PDU_OVHD,&vcc->sk->wmem_alloc);
647 dev_kfree_skb_any(skb);
648 wake_up(&vcc->sleep);
649 }
650Index: linux/net/atm/resources.c
651===================================================================
652RCS file: /home/chas/CVSROOT/linux/net/atm/resources.c,v
653retrieving revision 1.2
654diff -u -r1.2 resources.c
655--- linux/net/atm/resources.c 25 Feb 2003 20:03:53 -0000 1.2
656+++ linux/net/atm/resources.c 5 Mar 2003 00:10:01 -0000
657@@ -26,8 +26,7 @@
658 #endif
659
660
661-struct atm_dev *atm_devs = NULL;
662-static struct atm_dev *last_dev = NULL;
663+LIST_HEAD(atm_devs);
664 struct atm_vcc *nodev_vccs = NULL;
665 extern struct semaphore atm_dev_sem;
666
667@@ -43,15 +42,7 @@
668 dev->type = type;
669 dev->signal = ATM_PHY_SIG_UNKNOWN;
670 dev->link_rate = ATM_OC3_PCR;
671- dev->next = NULL;
672-
673- dev->prev = last_dev;
674-
675- if (atm_devs)
676- last_dev->next = dev;
677- else
678- atm_devs = dev;
679- last_dev = dev;
680+ list_add_tail(&dev->dev_list, &atm_devs);
681
682 return dev;
683 }
684@@ -59,14 +50,7 @@
685 /* Caller must hold atm_dev_sem. */
686 static void __free_atm_dev(struct atm_dev *dev)
687 {
688- if (dev->prev)
689- dev->prev->next = dev->next;
690- else
691- atm_devs = dev->next;
692- if (dev->next)
693- dev->next->prev = dev->prev;
694- else
695- last_dev = dev->prev;
696+ list_del(&dev->dev_list);
697 kfree(dev);
698 }
699
700@@ -74,10 +58,13 @@
701 struct atm_dev *atm_find_dev(int number)
702 {
703 struct atm_dev *dev;
704+ struct list_head *p;
705
706- for (dev = atm_devs; dev; dev = dev->next)
707+ list_for_each(p, &atm_devs) {
708+ dev = list_entry(p, struct atm_dev, dev_list);
709 if (dev->ops && dev->number == number)
710 return dev;
711+ }
712 return NULL;
713 }
714
715Index: linux/net/atm/resources.h
716===================================================================
717RCS file: /home/chas/CVSROOT/linux/net/atm/resources.h,v
718retrieving revision 1.1.1.1
719diff -u -r1.1.1.1 resources.h
720--- linux/net/atm/resources.h 20 Feb 2003 13:46:30 -0000 1.1.1.1
721+++ linux/net/atm/resources.h 5 Mar 2003 00:11:51 -0000
722@@ -10,7 +10,7 @@
723 #include <linux/atmdev.h>
724
725
726-extern struct atm_dev *atm_devs;
727+extern struct list_head atm_devs;
728 extern struct atm_vcc *nodev_vccs; /* VCCs not linked to any device */
729
730
731Index: linux/net/atm/signaling.c
732===================================================================
733RCS file: /home/chas/CVSROOT/linux/net/atm/signaling.c,v
734retrieving revision 1.2
735diff -u -r1.2 signaling.c
736--- linux/net/atm/signaling.c 25 Feb 2003 20:03:53 -0000 1.2
737+++ linux/net/atm/signaling.c 5 Mar 2003 00:21:45 -0000
738@@ -61,7 +61,7 @@
739 }
740 #endif
741 atm_force_charge(sigd,skb->truesize);
742- skb_queue_tail(&sigd->recvq,skb);
743+ skb_queue_tail(&sigd->sk->receive_queue,skb);
744 wake_up(&sigd->sleep);
745 }
746
747@@ -98,7 +98,7 @@
748 struct atm_vcc *session_vcc;
749
750 msg = (struct atmsvc_msg *) skb->data;
751- atomic_sub(skb->truesize+ATM_PDU_OVHD,&vcc->tx_inuse);
752+ atomic_sub(skb->truesize+ATM_PDU_OVHD,&vcc->sk->wmem_alloc);
753 DPRINTK("sigd_send %d (0x%lx)\n",(int) msg->type,
754 (unsigned long) msg->vcc);
755 vcc = *(struct atm_vcc **) &msg->vcc;
756@@ -198,7 +198,7 @@
757 static void purge_vccs(struct atm_vcc *vcc)
758 {
759 while (vcc) {
760- if (vcc->family == PF_ATMSVC &&
761+ if (vcc->sk->family == PF_ATMSVC &&
762 !test_bit(ATM_VF_META,&vcc->flags)) {
763 set_bit(ATM_VF_RELEASED,&vcc->flags);
764 vcc->reply = -EUNATCH;
765@@ -212,16 +212,20 @@
766 static void sigd_close(struct atm_vcc *vcc)
767 {
768 struct atm_dev *dev;
769+ struct list_head *p;
770
771 DPRINTK("sigd_close\n");
772 sigd = NULL;
773- if (skb_peek(&vcc->recvq))
774+ if (skb_peek(&vcc->sk->receive_queue))
775 printk(KERN_ERR "sigd_close: closing with requests pending\n");
776- skb_queue_purge(&vcc->recvq);
777+ skb_queue_purge(&vcc->sk->receive_queue);
778 purge_vccs(nodev_vccs);
779
780 down(&atm_dev_sem);
781- for (dev = atm_devs; dev; dev = dev->next) purge_vccs(dev->vccs);
782+ list_for_each(p, &atm_devs) {
783+ dev = list_entry(p, struct atm_dev, dev_list);
784+ purge_vccs(dev->vccs);
785+ }
786 up(&atm_dev_sem);
787 }
788
789--- linux-2.4.20/drivers/atm/idt77252.c.orig Fri Dec 21 18:41:53 2001
790+++ linux-2.4.20/drivers/atm/idt77252.c Wed Mar 5 20:27:00 2003
791@@ -730,7 +730,7 @@
792 struct atm_vcc *vcc = vc->tx_vcc;
793
794 vc->estimator->cells += (skb->len + 47) / 48;
795- if (atomic_read(&vcc->tx_inuse) > (vcc->sk->sndbuf >> 1)) {
796+ if (atomic_read(&vcc->sk->wmem_alloc) > (vcc->sk->sndbuf >> 1)) {
797 u32 cps = vc->estimator->maxcps;
798
799 vc->estimator->cps = cps;
800@@ -2025,7 +2025,7 @@
801 atomic_inc(&vcc->stats->tx_err);
802 return -ENOMEM;
803 }
804- atomic_add(skb->truesize + ATM_PDU_OVHD, &vcc->tx_inuse);
805+ atomic_add(skb->truesize + ATM_PDU_OVHD, &vcc->sk->wmem_alloc);
806 ATM_SKB(skb)->iovcnt = 0;
807
808 memcpy(skb_put(skb, 52), cell, 52);
809--- linux-2.4.20/net/atm/br2684.c.orig Wed Mar 5 22:11:10 2003
810+++ linux-2.4.20/net/atm/br2684.c Wed Mar 5 22:42:20 2003
811@@ -188,7 +188,7 @@
812 dev_kfree_skb(skb);
813 return 0;
814 }
815- atomic_add(skb->truesize, &atmvcc->tx_inuse);
816+ atomic_add(skb->truesize, &atmvcc->sk->wmem_alloc);
817 ATM_SKB(skb)->iovcnt = 0;
818 ATM_SKB(skb)->atm_options = atmvcc->atm_options;
819 brdev->stats.tx_packets++;
820@@ -553,7 +553,7 @@
821 barrier();
822 atmvcc->push = br2684_push;
823 skb_queue_head_init(&copy);
824- skb_migrate(&atmvcc->recvq, &copy);
825+ skb_migrate(&atmvcc->sk->receive_queue, &copy);
826 while ((skb = skb_dequeue(&copy))) {
827 BRPRIV(skb->dev)->stats.rx_bytes -= skb->len;
828 BRPRIV(skb->dev)->stats.rx_packets--;
829--- linux-2.4.20/net/atm/pppoatm.c~ Sat Aug 3 02:39:46 2002
830+++ linux-2.4.20/net/atm/pppoatm.c Wed Mar 5 22:43:51 2003
831@@ -231,7 +231,7 @@
832 kfree_skb(skb);
833 return 1;
834 }
835- atomic_add(skb->truesize, &ATM_SKB(skb)->vcc->tx_inuse);
836+ atomic_add(skb->truesize, &ATM_SKB(skb)->vcc->sk->wmem_alloc);
837 ATM_SKB(skb)->iovcnt = 0;
838 ATM_SKB(skb)->atm_options = ATM_SKB(skb)->vcc->atm_options;
839 DPRINTK("(unit %d): atm_skb(%p)->vcc(%p)->dev(%p)\n",
6ebfd311
JR
840--- linux-2.4.20/net/sched/sch_atm.c.orig Fri Dec 21 18:42:06 2001
841+++ linux-2.4.20/net/sched/sch_atm.c Thu Mar 6 22:55:53 2003
842@@ -511,7 +511,7 @@
843 ATM_SKB(skb)->vcc = flow->vcc;
844 memcpy(skb_push(skb,flow->hdr_len),flow->hdr,
845 flow->hdr_len);
846- atomic_add(skb->truesize,&flow->vcc->tx_inuse);
847+ atomic_add(skb->truesize,&flow->vcc->sk->wmem_alloc);
848 ATM_SKB(skb)->iovcnt = 0;
849 /* atm.atm_options are already set by atm_tc_enqueue */
850 (void) flow->vcc->send(flow->vcc,skb);
b5a39c4d
JR
851-
852To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
853the body of a message to majordomo@vger.kernel.org
854More majordomo info at http://vger.kernel.org/majordomo-info.html
855Please read the FAQ at http://www.tux.org/lkml/
This page took 1.259748 seconds and 4 git commands to generate.