aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-01-26 06:40:08 -0500
committerDavid S. Miller <davem@davemloft.net>2010-01-27 00:16:00 -0500
commitc48192a7075fb218d92810fbe76ddd8732f2bbb8 (patch)
tree5f4959f6e1ce0ae904e34281c0f6ff3a36756fed /net
parent5ff7ef7911d100b6568c731b1d078f819da82d03 (diff)
net/atm/lec.c: checkpatch cleanups
Convert #include <asm... to #include <linux... Mostly 80 column wrapped. Spacing cleanups Convert printks to pr_<level> Use print_hex_dump Move embedded assigns out of tests Move trailing statements to new lines Remove unnecessary braces around single line statements switch/case cleanups Removed paren around returns Use %pM Moved leading continuation logical tests to end of previous line Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/atm/lec.c284
1 files changed, 136 insertions, 148 deletions
diff --git a/net/atm/lec.c b/net/atm/lec.c
index 6873813c3c99..aefd278d6af6 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -18,7 +18,7 @@
18#include <linux/skbuff.h> 18#include <linux/skbuff.h>
19#include <linux/ip.h> 19#include <linux/ip.h>
20#include <asm/byteorder.h> 20#include <asm/byteorder.h>
21#include <asm/uaccess.h> 21#include <linux/uaccess.h>
22#include <net/arp.h> 22#include <net/arp.h>
23#include <net/dst.h> 23#include <net/dst.h>
24#include <linux/proc_fs.h> 24#include <linux/proc_fs.h>
@@ -87,17 +87,19 @@ static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv,
87 int is_rdesc, 87 int is_rdesc,
88 struct lec_arp_table **ret_entry); 88 struct lec_arp_table **ret_entry);
89static void lec_arp_update(struct lec_priv *priv, const unsigned char *mac_addr, 89static void lec_arp_update(struct lec_priv *priv, const unsigned char *mac_addr,
90 const unsigned char *atm_addr, unsigned long remoteflag, 90 const unsigned char *atm_addr,
91 unsigned long remoteflag,
91 unsigned int targetless_le_arp); 92 unsigned int targetless_le_arp);
92static void lec_flush_complete(struct lec_priv *priv, unsigned long tran_id); 93static void lec_flush_complete(struct lec_priv *priv, unsigned long tran_id);
93static int lec_mcast_make(struct lec_priv *priv, struct atm_vcc *vcc); 94static int lec_mcast_make(struct lec_priv *priv, struct atm_vcc *vcc);
94static void lec_set_flush_tran_id(struct lec_priv *priv, 95static void lec_set_flush_tran_id(struct lec_priv *priv,
95 const unsigned char *atm_addr, 96 const unsigned char *atm_addr,
96 unsigned long tran_id); 97 unsigned long tran_id);
97static void lec_vcc_added(struct lec_priv *priv, const struct atmlec_ioc *ioc_data, 98static void lec_vcc_added(struct lec_priv *priv,
99 const struct atmlec_ioc *ioc_data,
98 struct atm_vcc *vcc, 100 struct atm_vcc *vcc,
99 void (*old_push) (struct atm_vcc *vcc, 101 void (*old_push)(struct atm_vcc *vcc,
100 struct sk_buff *skb)); 102 struct sk_buff *skb));
101static void lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc); 103static void lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc);
102 104
103/* must be done under lec_arp_lock */ 105/* must be done under lec_arp_lock */
@@ -112,7 +114,6 @@ static inline void lec_arp_put(struct lec_arp_table *entry)
112 kfree(entry); 114 kfree(entry);
113} 115}
114 116
115
116static struct lane2_ops lane2_ops = { 117static struct lane2_ops lane2_ops = {
117 lane2_resolve, /* resolve, spec 3.1.3 */ 118 lane2_resolve, /* resolve, spec 3.1.3 */
118 lane2_associate_req, /* associate_req, spec 3.1.4 */ 119 lane2_associate_req, /* associate_req, spec 3.1.4 */
@@ -150,7 +151,8 @@ static void lec_handle_bridge(struct sk_buff *skb, struct net_device *dev)
150 mesg = (struct atmlec_msg *)skb2->data; 151 mesg = (struct atmlec_msg *)skb2->data;
151 mesg->type = l_topology_change; 152 mesg->type = l_topology_change;
152 buff += 4; 153 buff += 4;
153 mesg->content.normal.flag = *buff & 0x01; /* 0x01 is topology change */ 154 mesg->content.normal.flag = *buff & 0x01;
155 /* 0x01 is topology change */
154 156
155 priv = netdev_priv(dev); 157 priv = netdev_priv(dev);
156 atm_force_charge(priv->lecd, skb2->truesize); 158 atm_force_charge(priv->lecd, skb2->truesize);
@@ -263,14 +265,10 @@ static netdev_tx_t lec_start_xmit(struct sk_buff *skb,
263 unsigned char rdesc[ETH_ALEN]; /* Token Ring route descriptor */ 265 unsigned char rdesc[ETH_ALEN]; /* Token Ring route descriptor */
264#endif 266#endif
265 int is_rdesc; 267 int is_rdesc;
266#if DUMP_PACKETS > 0
267 char buf[300];
268 int i = 0;
269#endif /* DUMP_PACKETS >0 */
270 268
271 pr_debug("called\n"); 269 pr_debug("called\n");
272 if (!priv->lecd) { 270 if (!priv->lecd) {
273 printk("%s:No lecd attached\n", dev->name); 271 pr_info("%s:No lecd attached\n", dev->name);
274 dev->stats.tx_errors++; 272 dev->stats.tx_errors++;
275 netif_stop_queue(dev); 273 netif_stop_queue(dev);
276 kfree_skb(skb); 274 kfree_skb(skb);
@@ -315,23 +313,17 @@ static netdev_tx_t lec_start_xmit(struct sk_buff *skb,
315 } 313 }
316#endif 314#endif
317 315
318#if DUMP_PACKETS > 0
319 printk("%s: send datalen:%ld lecid:%4.4x\n", dev->name,
320 skb->len, priv->lecid);
321#if DUMP_PACKETS >= 2 316#if DUMP_PACKETS >= 2
322 for (i = 0; i < skb->len && i < 99; i++) { 317#define MAX_DUMP_SKB 99
323 sprintf(buf + i * 3, "%2.2x ", 0xff & skb->data[i]);
324 }
325#elif DUMP_PACKETS >= 1 318#elif DUMP_PACKETS >= 1
326 for (i = 0; i < skb->len && i < 30; i++) { 319#define MAX_DUMP_SKB 30
327 sprintf(buf + i * 3, "%2.2x ", 0xff & skb->data[i]); 320#endif
328 } 321#if DUMP_PACKETS >= 1
322 printk(KERN_DEBUG "%s: send datalen:%ld lecid:%4.4x\n",
323 dev->name, skb->len, priv->lecid);
324 print_hex_dump(KERN_DEBUG, "", DUMP_OFFSET, 16, 1,
325 skb->data, min(skb->len, MAX_DUMP_SKB), true);
329#endif /* DUMP_PACKETS >= 1 */ 326#endif /* DUMP_PACKETS >= 1 */
330 if (i == skb->len)
331 printk("%s\n", buf);
332 else
333 printk("%s...\n", buf);
334#endif /* DUMP_PACKETS > 0 */
335 327
336 /* Minimum ethernet-frame size */ 328 /* Minimum ethernet-frame size */
337#ifdef CONFIG_TR 329#ifdef CONFIG_TR
@@ -385,7 +377,8 @@ static netdev_tx_t lec_start_xmit(struct sk_buff *skb,
385 goto out; 377 goto out;
386 } 378 }
387#if DUMP_PACKETS > 0 379#if DUMP_PACKETS > 0
388 printk("%s:sending to vpi:%d vci:%d\n", dev->name, vcc->vpi, vcc->vci); 380 printk(KERN_DEBUG "%s:sending to vpi:%d vci:%d\n",
381 dev->name, vcc->vpi, vcc->vci);
389#endif /* DUMP_PACKETS > 0 */ 382#endif /* DUMP_PACKETS > 0 */
390 383
391 while (entry && (skb2 = skb_dequeue(&entry->tx_wait))) { 384 while (entry && (skb2 = skb_dequeue(&entry->tx_wait))) {
@@ -442,14 +435,12 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
442 pr_debug("%s: msg from zeppelin:%d\n", dev->name, mesg->type); 435 pr_debug("%s: msg from zeppelin:%d\n", dev->name, mesg->type);
443 switch (mesg->type) { 436 switch (mesg->type) {
444 case l_set_mac_addr: 437 case l_set_mac_addr:
445 for (i = 0; i < 6; i++) { 438 for (i = 0; i < 6; i++)
446 dev->dev_addr[i] = mesg->content.normal.mac_addr[i]; 439 dev->dev_addr[i] = mesg->content.normal.mac_addr[i];
447 }
448 break; 440 break;
449 case l_del_mac_addr: 441 case l_del_mac_addr:
450 for (i = 0; i < 6; i++) { 442 for (i = 0; i < 6; i++)
451 dev->dev_addr[i] = 0; 443 dev->dev_addr[i] = 0;
452 }
453 break; 444 break;
454 case l_addr_delete: 445 case l_addr_delete:
455 lec_addr_delete(priv, mesg->content.normal.atm_addr, 446 lec_addr_delete(priv, mesg->content.normal.atm_addr,
@@ -497,13 +488,14 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
497 priv->flush_timeout = (mesg->content.config.flush_timeout * HZ); 488 priv->flush_timeout = (mesg->content.config.flush_timeout * HZ);
498 priv->path_switching_delay = 489 priv->path_switching_delay =
499 (mesg->content.config.path_switching_delay * HZ); 490 (mesg->content.config.path_switching_delay * HZ);
500 priv->lane_version = mesg->content.config.lane_version; /* LANE2 */ 491 priv->lane_version = mesg->content.config.lane_version;
492 /* LANE2 */
501 priv->lane2_ops = NULL; 493 priv->lane2_ops = NULL;
502 if (priv->lane_version > 1) 494 if (priv->lane_version > 1)
503 priv->lane2_ops = &lane2_ops; 495 priv->lane2_ops = &lane2_ops;
504 if (dev_set_mtu(dev, mesg->content.config.mtu)) 496 if (dev_set_mtu(dev, mesg->content.config.mtu))
505 printk("%s: change_mtu to %d failed\n", dev->name, 497 pr_info("%s: change_mtu to %d failed\n",
506 mesg->content.config.mtu); 498 dev->name, mesg->content.config.mtu);
507 priv->is_proxy = mesg->content.config.is_proxy; 499 priv->is_proxy = mesg->content.config.is_proxy;
508 break; 500 break;
509 case l_flush_tran_id: 501 case l_flush_tran_id:
@@ -524,16 +516,15 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
524 break; 516 break;
525 517
526 if (br_fdb_test_addr_hook(dev, 518 if (br_fdb_test_addr_hook(dev,
527 mesg->content.proxy.mac_addr)) { 519 mesg->content.proxy.mac_addr)) {
528 /* hit from bridge table, send LE_ARP_RESPONSE */ 520 /* hit from bridge table, send LE_ARP_RESPONSE */
529 struct sk_buff *skb2; 521 struct sk_buff *skb2;
530 struct sock *sk; 522 struct sock *sk;
531 523
532 pr_debug("%s: entry found, responding to zeppelin\n", 524 pr_debug("%s: entry found, responding to zeppelin\n",
533 dev->name); 525 dev->name);
534 skb2 = 526 skb2 = alloc_skb(sizeof(struct atmlec_msg),
535 alloc_skb(sizeof(struct atmlec_msg), 527 GFP_ATOMIC);
536 GFP_ATOMIC);
537 if (skb2 == NULL) 528 if (skb2 == NULL)
538 break; 529 break;
539 skb2->len = sizeof(struct atmlec_msg); 530 skb2->len = sizeof(struct atmlec_msg);
@@ -548,7 +539,7 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
548#endif /* defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) */ 539#endif /* defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) */
549 break; 540 break;
550 default: 541 default:
551 printk("%s: Unknown message type %d\n", dev->name, mesg->type); 542 pr_info("%s: Unknown message type %d\n", dev->name, mesg->type);
552 dev_kfree_skb(skb); 543 dev_kfree_skb(skb);
553 return -EINVAL; 544 return -EINVAL;
554 } 545 }
@@ -569,14 +560,13 @@ static void lec_atm_close(struct atm_vcc *vcc)
569 lec_arp_destroy(priv); 560 lec_arp_destroy(priv);
570 561
571 if (skb_peek(&sk_atm(vcc)->sk_receive_queue)) 562 if (skb_peek(&sk_atm(vcc)->sk_receive_queue))
572 printk("%s lec_atm_close: closing with messages pending\n", 563 pr_info("%s closing with messages pending\n", dev->name);
573 dev->name);
574 while ((skb = skb_dequeue(&sk_atm(vcc)->sk_receive_queue)) != NULL) { 564 while ((skb = skb_dequeue(&sk_atm(vcc)->sk_receive_queue)) != NULL) {
575 atm_return(vcc, skb->truesize); 565 atm_return(vcc, skb->truesize);
576 dev_kfree_skb(skb); 566 dev_kfree_skb(skb);
577 } 567 }
578 568
579 printk("%s: Shut down!\n", dev->name); 569 pr_info("%s: Shut down!\n", dev->name);
580 module_put(THIS_MODULE); 570 module_put(THIS_MODULE);
581} 571}
582 572
@@ -605,9 +595,8 @@ send_to_lecd(struct lec_priv *priv, atmlec_msg_type type,
605 struct sk_buff *skb; 595 struct sk_buff *skb;
606 struct atmlec_msg *mesg; 596 struct atmlec_msg *mesg;
607 597
608 if (!priv || !priv->lecd) { 598 if (!priv || !priv->lecd)
609 return -1; 599 return -1;
610 }
611 skb = alloc_skb(sizeof(struct atmlec_msg), GFP_ATOMIC); 600 skb = alloc_skb(sizeof(struct atmlec_msg), GFP_ATOMIC);
612 if (!skb) 601 if (!skb)
613 return -1; 602 return -1;
@@ -688,7 +677,7 @@ static void lec_push(struct atm_vcc *vcc, struct sk_buff *skb)
688 struct net_device *dev = (struct net_device *)vcc->proto_data; 677 struct net_device *dev = (struct net_device *)vcc->proto_data;
689 struct lec_priv *priv = netdev_priv(dev); 678 struct lec_priv *priv = netdev_priv(dev);
690 679
691#if DUMP_PACKETS >0 680#if DUMP_PACKETS > 0
692 printk(KERN_DEBUG "%s: vcc vpi:%d vci:%d\n", 681 printk(KERN_DEBUG "%s: vcc vpi:%d vci:%d\n",
693 dev->name, vcc->vpi, vcc->vci); 682 dev->name, vcc->vpi, vcc->vci);
694#endif 683#endif
@@ -767,9 +756,8 @@ static void lec_push(struct atm_vcc *vcc, struct sk_buff *skb)
767 dev_kfree_skb(skb); 756 dev_kfree_skb(skb);
768 return; 757 return;
769 } 758 }
770 if (!hlist_empty(&priv->lec_arp_empty_ones)) { 759 if (!hlist_empty(&priv->lec_arp_empty_ones))
771 lec_arp_check_empties(priv, vcc, skb); 760 lec_arp_check_empties(priv, vcc, skb);
772 }
773 skb_pull(skb, 2); /* skip lec_id */ 761 skb_pull(skb, 2); /* skip lec_id */
774#ifdef CONFIG_TR 762#ifdef CONFIG_TR
775 if (priv->is_trdev) 763 if (priv->is_trdev)
@@ -816,7 +804,8 @@ static int lec_vcc_attach(struct atm_vcc *vcc, void __user *arg)
816 if (ioc_data.dev_num < 0 || ioc_data.dev_num >= MAX_LEC_ITF || 804 if (ioc_data.dev_num < 0 || ioc_data.dev_num >= MAX_LEC_ITF ||
817 !dev_lec[ioc_data.dev_num]) 805 !dev_lec[ioc_data.dev_num])
818 return -EINVAL; 806 return -EINVAL;
819 if (!(vpriv = kmalloc(sizeof(struct lec_vcc_priv), GFP_KERNEL))) 807 vpriv = kmalloc(sizeof(struct lec_vcc_priv), GFP_KERNEL);
808 if (!vpriv)
820 return -ENOMEM; 809 return -ENOMEM;
821 vpriv->xoff = 0; 810 vpriv->xoff = 0;
822 vpriv->old_pop = vcc->pop; 811 vpriv->old_pop = vcc->pop;
@@ -907,9 +896,8 @@ static int lecd_attach(struct atm_vcc *vcc, int arg)
907 priv->flush_timeout = (4 * HZ); 896 priv->flush_timeout = (4 * HZ);
908 priv->path_switching_delay = (6 * HZ); 897 priv->path_switching_delay = (6 * HZ);
909 898
910 if (dev_lec[i]->flags & IFF_UP) { 899 if (dev_lec[i]->flags & IFF_UP)
911 netif_start_queue(dev_lec[i]); 900 netif_start_queue(dev_lec[i]);
912 }
913 __module_get(THIS_MODULE); 901 __module_get(THIS_MODULE);
914 return i; 902 return i;
915} 903}
@@ -1111,7 +1099,9 @@ static int lec_seq_show(struct seq_file *seq, void *v)
1111 else { 1099 else {
1112 struct lec_state *state = seq->private; 1100 struct lec_state *state = seq->private;
1113 struct net_device *dev = state->dev; 1101 struct net_device *dev = state->dev;
1114 struct lec_arp_table *entry = hlist_entry(state->node, struct lec_arp_table, next); 1102 struct lec_arp_table *entry = hlist_entry(state->node,
1103 struct lec_arp_table,
1104 next);
1115 1105
1116 seq_printf(seq, "%s ", dev->name); 1106 seq_printf(seq, "%s ", dev->name);
1117 lec_info(seq, entry); 1107 lec_info(seq, entry);
@@ -1191,7 +1181,7 @@ static int __init lane_module_init(void)
1191#endif 1181#endif
1192 1182
1193 register_atm_ioctl(&lane_ioctl_ops); 1183 register_atm_ioctl(&lane_ioctl_ops);
1194 printk("lec.c: " __DATE__ " " __TIME__ " initialized\n"); 1184 pr_info("lec.c: " __DATE__ " " __TIME__ " initialized\n");
1195 return 0; 1185 return 0;
1196} 1186}
1197 1187
@@ -1280,13 +1270,13 @@ static int lane2_associate_req(struct net_device *dev, const u8 *lan_dst,
1280 struct lec_priv *priv = netdev_priv(dev); 1270 struct lec_priv *priv = netdev_priv(dev);
1281 1271
1282 if (compare_ether_addr(lan_dst, dev->dev_addr)) 1272 if (compare_ether_addr(lan_dst, dev->dev_addr))
1283 return (0); /* not our mac address */ 1273 return 0; /* not our mac address */
1284 1274
1285 kfree(priv->tlvs); /* NULL if there was no previous association */ 1275 kfree(priv->tlvs); /* NULL if there was no previous association */
1286 1276
1287 priv->tlvs = kmemdup(tlvs, sizeoftlvs, GFP_KERNEL); 1277 priv->tlvs = kmemdup(tlvs, sizeoftlvs, GFP_KERNEL);
1288 if (priv->tlvs == NULL) 1278 if (priv->tlvs == NULL)
1289 return (0); 1279 return 0;
1290 priv->sizeoftlvs = sizeoftlvs; 1280 priv->sizeoftlvs = sizeoftlvs;
1291 1281
1292 skb = alloc_skb(sizeoftlvs, GFP_ATOMIC); 1282 skb = alloc_skb(sizeoftlvs, GFP_ATOMIC);
@@ -1296,12 +1286,12 @@ static int lane2_associate_req(struct net_device *dev, const u8 *lan_dst,
1296 skb_copy_to_linear_data(skb, tlvs, sizeoftlvs); 1286 skb_copy_to_linear_data(skb, tlvs, sizeoftlvs);
1297 retval = send_to_lecd(priv, l_associate_req, NULL, NULL, skb); 1287 retval = send_to_lecd(priv, l_associate_req, NULL, NULL, skb);
1298 if (retval != 0) 1288 if (retval != 0)
1299 printk("lec.c: lane2_associate_req() failed\n"); 1289 pr_info("lec.c: lane2_associate_req() failed\n");
1300 /* 1290 /*
1301 * If the previous association has changed we must 1291 * If the previous association has changed we must
1302 * somehow notify other LANE entities about the change 1292 * somehow notify other LANE entities about the change
1303 */ 1293 */
1304 return (1); 1294 return 1;
1305} 1295}
1306 1296
1307/* 1297/*
@@ -1334,12 +1324,12 @@ static void lane2_associate_ind(struct net_device *dev, const u8 *mac_addr,
1334 entry->sizeoftlvs = sizeoftlvs; 1324 entry->sizeoftlvs = sizeoftlvs;
1335#endif 1325#endif
1336#if 0 1326#if 0
1337 printk("lec.c: lane2_associate_ind()\n"); 1327 pr_info("\n");
1338 printk("dump of tlvs, sizeoftlvs=%d\n", sizeoftlvs); 1328 pr_info("dump of tlvs, sizeoftlvs=%d\n", sizeoftlvs);
1339 while (i < sizeoftlvs) 1329 while (i < sizeoftlvs)
1340 printk("%02x ", tlvs[i++]); 1330 pr_cont("%02x ", tlvs[i++]);
1341 1331
1342 printk("\n"); 1332 pr_cont("\n");
1343#endif 1333#endif
1344 1334
1345 /* tell MPOA about the TLVs we saw */ 1335 /* tell MPOA about the TLVs we saw */
@@ -1359,13 +1349,13 @@ static void lane2_associate_ind(struct net_device *dev, const u8 *mac_addr,
1359 1349
1360#include <linux/types.h> 1350#include <linux/types.h>
1361#include <linux/timer.h> 1351#include <linux/timer.h>
1362#include <asm/param.h> 1352#include <linux/param.h>
1363#include <asm/atomic.h> 1353#include <asm/atomic.h>
1364#include <linux/inetdevice.h> 1354#include <linux/inetdevice.h>
1365#include <net/route.h> 1355#include <net/route.h>
1366 1356
1367#if 0 1357#if 0
1368#define pr_debug(format,args...) 1358#define pr_debug(format, args...)
1369/* 1359/*
1370 #define pr_debug printk 1360 #define pr_debug printk
1371*/ 1361*/
@@ -1381,7 +1371,7 @@ static void lec_arp_expire_arp(unsigned long data);
1381 * Arp table funcs 1371 * Arp table funcs
1382 */ 1372 */
1383 1373
1384#define HASH(ch) (ch & (LEC_ARP_TABLE_SIZE -1)) 1374#define HASH(ch) (ch & (LEC_ARP_TABLE_SIZE - 1))
1385 1375
1386/* 1376/*
1387 * Initialization of arp-cache 1377 * Initialization of arp-cache
@@ -1390,9 +1380,8 @@ static void lec_arp_init(struct lec_priv *priv)
1390{ 1380{
1391 unsigned short i; 1381 unsigned short i;
1392 1382
1393 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { 1383 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++)
1394 INIT_HLIST_HEAD(&priv->lec_arp_tables[i]); 1384 INIT_HLIST_HEAD(&priv->lec_arp_tables[i]);
1395 }
1396 INIT_HLIST_HEAD(&priv->lec_arp_empty_ones); 1385 INIT_HLIST_HEAD(&priv->lec_arp_empty_ones);
1397 INIT_HLIST_HEAD(&priv->lec_no_forward); 1386 INIT_HLIST_HEAD(&priv->lec_no_forward);
1398 INIT_HLIST_HEAD(&priv->mcast_fwds); 1387 INIT_HLIST_HEAD(&priv->mcast_fwds);
@@ -1449,20 +1438,23 @@ lec_arp_remove(struct lec_priv *priv, struct lec_arp_table *to_remove)
1449 struct lec_arp_table *entry; 1438 struct lec_arp_table *entry;
1450 int i, remove_vcc = 1; 1439 int i, remove_vcc = 1;
1451 1440
1452 if (!to_remove) { 1441 if (!to_remove)
1453 return -1; 1442 return -1;
1454 }
1455 1443
1456 hlist_del(&to_remove->next); 1444 hlist_del(&to_remove->next);
1457 del_timer(&to_remove->timer); 1445 del_timer(&to_remove->timer);
1458 1446
1459 /* If this is the only MAC connected to this VCC, also tear down the VCC */ 1447 /*
1448 * If this is the only MAC connected to this VCC,
1449 * also tear down the VCC
1450 */
1460 if (to_remove->status >= ESI_FLUSH_PENDING) { 1451 if (to_remove->status >= ESI_FLUSH_PENDING) {
1461 /* 1452 /*
1462 * ESI_FLUSH_PENDING, ESI_FORWARD_DIRECT 1453 * ESI_FLUSH_PENDING, ESI_FORWARD_DIRECT
1463 */ 1454 */
1464 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { 1455 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
1465 hlist_for_each_entry(entry, node, &priv->lec_arp_tables[i], next) { 1456 hlist_for_each_entry(entry, node,
1457 &priv->lec_arp_tables[i], next) {
1466 if (memcmp(to_remove->atm_addr, 1458 if (memcmp(to_remove->atm_addr,
1467 entry->atm_addr, ATM_ESA_LEN) == 0) { 1459 entry->atm_addr, ATM_ESA_LEN) == 0) {
1468 remove_vcc = 0; 1460 remove_vcc = 0;
@@ -1493,9 +1485,8 @@ static const char *get_status_string(unsigned char st)
1493 return "ESI_FLUSH_PENDING"; 1485 return "ESI_FLUSH_PENDING";
1494 case ESI_FORWARD_DIRECT: 1486 case ESI_FORWARD_DIRECT:
1495 return "ESI_FORWARD_DIRECT"; 1487 return "ESI_FORWARD_DIRECT";
1496 default:
1497 return "<UNKNOWN>";
1498 } 1488 }
1489 return "<UNKNOWN>";
1499} 1490}
1500 1491
1501static void dump_arp_table(struct lec_priv *priv) 1492static void dump_arp_table(struct lec_priv *priv)
@@ -1505,18 +1496,15 @@ static void dump_arp_table(struct lec_priv *priv)
1505 char buf[256]; 1496 char buf[256];
1506 int i, j, offset; 1497 int i, j, offset;
1507 1498
1508 printk("Dump %p:\n", priv); 1499 pr_info("Dump %p:\n", priv);
1509 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { 1500 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
1510 hlist_for_each_entry(rulla, node, &priv->lec_arp_tables[i], next) { 1501 hlist_for_each_entry(rulla, node,
1502 &priv->lec_arp_tables[i], next) {
1511 offset = 0; 1503 offset = 0;
1512 offset += sprintf(buf, "%d: %p\n", i, rulla); 1504 offset += sprintf(buf, "%d: %p\n", i, rulla);
1513 offset += sprintf(buf + offset, "Mac:"); 1505 offset += sprintf(buf + offset, "Mac: %pM",
1514 for (j = 0; j < ETH_ALEN; j++) { 1506 rulla->mac_addr);
1515 offset += sprintf(buf + offset, 1507 offset += sprintf(buf + offset, " Atm:");
1516 "%2.2x ",
1517 rulla->mac_addr[j] & 0xff);
1518 }
1519 offset += sprintf(buf + offset, "Atm:");
1520 for (j = 0; j < ATM_ESA_LEN; j++) { 1508 for (j = 0; j < ATM_ESA_LEN; j++) {
1521 offset += sprintf(buf + offset, 1509 offset += sprintf(buf + offset,
1522 "%2.2x ", 1510 "%2.2x ",
@@ -1536,20 +1524,16 @@ static void dump_arp_table(struct lec_priv *priv)
1536 "Flags:%x, Packets_flooded:%x, Status: %s ", 1524 "Flags:%x, Packets_flooded:%x, Status: %s ",
1537 rulla->flags, rulla->packets_flooded, 1525 rulla->flags, rulla->packets_flooded,
1538 get_status_string(rulla->status)); 1526 get_status_string(rulla->status));
1539 printk("%s\n", buf); 1527 pr_info("%s\n", buf);
1540 } 1528 }
1541 } 1529 }
1542 1530
1543 if (!hlist_empty(&priv->lec_no_forward)) 1531 if (!hlist_empty(&priv->lec_no_forward))
1544 printk("No forward\n"); 1532 pr_info("No forward\n");
1545 hlist_for_each_entry(rulla, node, &priv->lec_no_forward, next) { 1533 hlist_for_each_entry(rulla, node, &priv->lec_no_forward, next) {
1546 offset = 0; 1534 offset = 0;
1547 offset += sprintf(buf + offset, "Mac:"); 1535 offset += sprintf(buf + offset, "Mac: %pM", rulla->mac_addr);
1548 for (j = 0; j < ETH_ALEN; j++) { 1536 offset += sprintf(buf + offset, " Atm:");
1549 offset += sprintf(buf + offset, "%2.2x ",
1550 rulla->mac_addr[j] & 0xff);
1551 }
1552 offset += sprintf(buf + offset, "Atm:");
1553 for (j = 0; j < ATM_ESA_LEN; j++) { 1537 for (j = 0; j < ATM_ESA_LEN; j++) {
1554 offset += sprintf(buf + offset, "%2.2x ", 1538 offset += sprintf(buf + offset, "%2.2x ",
1555 rulla->atm_addr[j] & 0xff); 1539 rulla->atm_addr[j] & 0xff);
@@ -1566,19 +1550,15 @@ static void dump_arp_table(struct lec_priv *priv)
1566 "Flags:%x, Packets_flooded:%x, Status: %s ", 1550 "Flags:%x, Packets_flooded:%x, Status: %s ",
1567 rulla->flags, rulla->packets_flooded, 1551 rulla->flags, rulla->packets_flooded,
1568 get_status_string(rulla->status)); 1552 get_status_string(rulla->status));
1569 printk("%s\n", buf); 1553 pr_info("%s\n", buf);
1570 } 1554 }
1571 1555
1572 if (!hlist_empty(&priv->lec_arp_empty_ones)) 1556 if (!hlist_empty(&priv->lec_arp_empty_ones))
1573 printk("Empty ones\n"); 1557 pr_info("Empty ones\n");
1574 hlist_for_each_entry(rulla, node, &priv->lec_arp_empty_ones, next) { 1558 hlist_for_each_entry(rulla, node, &priv->lec_arp_empty_ones, next) {
1575 offset = 0; 1559 offset = 0;
1576 offset += sprintf(buf + offset, "Mac:"); 1560 offset += sprintf(buf + offset, "Mac: %pM", rulla->mac_addr);
1577 for (j = 0; j < ETH_ALEN; j++) { 1561 offset += sprintf(buf + offset, " Atm:");
1578 offset += sprintf(buf + offset, "%2.2x ",
1579 rulla->mac_addr[j] & 0xff);
1580 }
1581 offset += sprintf(buf + offset, "Atm:");
1582 for (j = 0; j < ATM_ESA_LEN; j++) { 1562 for (j = 0; j < ATM_ESA_LEN; j++) {
1583 offset += sprintf(buf + offset, "%2.2x ", 1563 offset += sprintf(buf + offset, "%2.2x ",
1584 rulla->atm_addr[j] & 0xff); 1564 rulla->atm_addr[j] & 0xff);
@@ -1595,19 +1575,15 @@ static void dump_arp_table(struct lec_priv *priv)
1595 "Flags:%x, Packets_flooded:%x, Status: %s ", 1575 "Flags:%x, Packets_flooded:%x, Status: %s ",
1596 rulla->flags, rulla->packets_flooded, 1576 rulla->flags, rulla->packets_flooded,
1597 get_status_string(rulla->status)); 1577 get_status_string(rulla->status));
1598 printk("%s", buf); 1578 pr_info("%s", buf);
1599 } 1579 }
1600 1580
1601 if (!hlist_empty(&priv->mcast_fwds)) 1581 if (!hlist_empty(&priv->mcast_fwds))
1602 printk("Multicast Forward VCCs\n"); 1582 pr_info("Multicast Forward VCCs\n");
1603 hlist_for_each_entry(rulla, node, &priv->mcast_fwds, next) { 1583 hlist_for_each_entry(rulla, node, &priv->mcast_fwds, next) {
1604 offset = 0; 1584 offset = 0;
1605 offset += sprintf(buf + offset, "Mac:"); 1585 offset += sprintf(buf + offset, "Mac: %pM", rulla->mac_addr);
1606 for (j = 0; j < ETH_ALEN; j++) { 1586 offset += sprintf(buf + offset, " Atm:");
1607 offset += sprintf(buf + offset, "%2.2x ",
1608 rulla->mac_addr[j] & 0xff);
1609 }
1610 offset += sprintf(buf + offset, "Atm:");
1611 for (j = 0; j < ATM_ESA_LEN; j++) { 1587 for (j = 0; j < ATM_ESA_LEN; j++) {
1612 offset += sprintf(buf + offset, "%2.2x ", 1588 offset += sprintf(buf + offset, "%2.2x ",
1613 rulla->atm_addr[j] & 0xff); 1589 rulla->atm_addr[j] & 0xff);
@@ -1624,7 +1600,7 @@ static void dump_arp_table(struct lec_priv *priv)
1624 "Flags:%x, Packets_flooded:%x, Status: %s ", 1600 "Flags:%x, Packets_flooded:%x, Status: %s ",
1625 rulla->flags, rulla->packets_flooded, 1601 rulla->flags, rulla->packets_flooded,
1626 get_status_string(rulla->status)); 1602 get_status_string(rulla->status));
1627 printk("%s\n", buf); 1603 pr_info("%s\n", buf);
1628 } 1604 }
1629 1605
1630} 1606}
@@ -1650,14 +1626,16 @@ static void lec_arp_destroy(struct lec_priv *priv)
1650 1626
1651 spin_lock_irqsave(&priv->lec_arp_lock, flags); 1627 spin_lock_irqsave(&priv->lec_arp_lock, flags);
1652 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { 1628 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
1653 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_tables[i], next) { 1629 hlist_for_each_entry_safe(entry, node, next,
1630 &priv->lec_arp_tables[i], next) {
1654 lec_arp_remove(priv, entry); 1631 lec_arp_remove(priv, entry);
1655 lec_arp_put(entry); 1632 lec_arp_put(entry);
1656 } 1633 }
1657 INIT_HLIST_HEAD(&priv->lec_arp_tables[i]); 1634 INIT_HLIST_HEAD(&priv->lec_arp_tables[i]);
1658 } 1635 }
1659 1636
1660 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_empty_ones, next) { 1637 hlist_for_each_entry_safe(entry, node, next,
1638 &priv->lec_arp_empty_ones, next) {
1661 del_timer_sync(&entry->timer); 1639 del_timer_sync(&entry->timer);
1662 lec_arp_clear_vccs(entry); 1640 lec_arp_clear_vccs(entry);
1663 hlist_del(&entry->next); 1641 hlist_del(&entry->next);
@@ -1665,7 +1643,8 @@ static void lec_arp_destroy(struct lec_priv *priv)
1665 } 1643 }
1666 INIT_HLIST_HEAD(&priv->lec_arp_empty_ones); 1644 INIT_HLIST_HEAD(&priv->lec_arp_empty_ones);
1667 1645
1668 hlist_for_each_entry_safe(entry, node, next, &priv->lec_no_forward, next) { 1646 hlist_for_each_entry_safe(entry, node, next,
1647 &priv->lec_no_forward, next) {
1669 del_timer_sync(&entry->timer); 1648 del_timer_sync(&entry->timer);
1670 lec_arp_clear_vccs(entry); 1649 lec_arp_clear_vccs(entry);
1671 hlist_del(&entry->next); 1650 hlist_del(&entry->next);
@@ -1698,9 +1677,8 @@ static struct lec_arp_table *lec_arp_find(struct lec_priv *priv,
1698 1677
1699 head = &priv->lec_arp_tables[HASH(mac_addr[ETH_ALEN - 1])]; 1678 head = &priv->lec_arp_tables[HASH(mac_addr[ETH_ALEN - 1])];
1700 hlist_for_each_entry(entry, node, head, next) { 1679 hlist_for_each_entry(entry, node, head, next) {
1701 if (!compare_ether_addr(mac_addr, entry->mac_addr)) { 1680 if (!compare_ether_addr(mac_addr, entry->mac_addr))
1702 return entry; 1681 return entry;
1703 }
1704 } 1682 }
1705 return NULL; 1683 return NULL;
1706} 1684}
@@ -1712,7 +1690,7 @@ static struct lec_arp_table *make_entry(struct lec_priv *priv,
1712 1690
1713 to_return = kzalloc(sizeof(struct lec_arp_table), GFP_ATOMIC); 1691 to_return = kzalloc(sizeof(struct lec_arp_table), GFP_ATOMIC);
1714 if (!to_return) { 1692 if (!to_return) {
1715 printk("LEC: Arp entry kmalloc failed\n"); 1693 pr_info("LEC: Arp entry kmalloc failed\n");
1716 return NULL; 1694 return NULL;
1717 } 1695 }
1718 memcpy(to_return->mac_addr, mac_addr, ETH_ALEN); 1696 memcpy(to_return->mac_addr, mac_addr, ETH_ALEN);
@@ -1802,7 +1780,8 @@ static void lec_arp_check_expire(struct work_struct *work)
1802restart: 1780restart:
1803 spin_lock_irqsave(&priv->lec_arp_lock, flags); 1781 spin_lock_irqsave(&priv->lec_arp_lock, flags);
1804 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { 1782 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
1805 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_tables[i], next) { 1783 hlist_for_each_entry_safe(entry, node, next,
1784 &priv->lec_arp_tables[i], next) {
1806 if ((entry->flags) & LEC_REMOTE_FLAG && 1785 if ((entry->flags) & LEC_REMOTE_FLAG &&
1807 priv->topology_change) 1786 priv->topology_change)
1808 time_to_check = priv->forward_delay_time; 1787 time_to_check = priv->forward_delay_time;
@@ -1811,9 +1790,9 @@ restart:
1811 1790
1812 pr_debug("About to expire: %lx - %lx > %lx\n", 1791 pr_debug("About to expire: %lx - %lx > %lx\n",
1813 now, entry->last_used, time_to_check); 1792 now, entry->last_used, time_to_check);
1814 if (time_after(now, entry->last_used + time_to_check) 1793 if (time_after(now, entry->last_used + time_to_check) &&
1815 && !(entry->flags & LEC_PERMANENT_FLAG) 1794 !(entry->flags & LEC_PERMANENT_FLAG) &&
1816 && !(entry->mac_addr[0] & 0x01)) { /* LANE2: 7.1.20 */ 1795 !(entry->mac_addr[0] & 0x01)) { /* LANE2: 7.1.20 */
1817 /* Remove entry */ 1796 /* Remove entry */
1818 pr_debug("Entry timed out\n"); 1797 pr_debug("Entry timed out\n");
1819 lec_arp_remove(priv, entry); 1798 lec_arp_remove(priv, entry);
@@ -1821,11 +1800,10 @@ restart:
1821 } else { 1800 } else {
1822 /* Something else */ 1801 /* Something else */
1823 if ((entry->status == ESI_VC_PENDING || 1802 if ((entry->status == ESI_VC_PENDING ||
1824 entry->status == ESI_ARP_PENDING) 1803 entry->status == ESI_ARP_PENDING) &&
1825 && time_after_eq(now, 1804 time_after_eq(now,
1826 entry->timestamp + 1805 entry->timestamp +
1827 priv-> 1806 priv->max_unknown_frame_time)) {
1828 max_unknown_frame_time)) {
1829 entry->timestamp = jiffies; 1807 entry->timestamp = jiffies;
1830 entry->packets_flooded = 0; 1808 entry->packets_flooded = 0;
1831 if (entry->status == ESI_VC_PENDING) 1809 if (entry->status == ESI_VC_PENDING)
@@ -1834,8 +1812,7 @@ restart:
1834 entry->atm_addr, 1812 entry->atm_addr,
1835 NULL); 1813 NULL);
1836 } 1814 }
1837 if (entry->status == ESI_FLUSH_PENDING 1815 if (entry->status == ESI_FLUSH_PENDING &&
1838 &&
1839 time_after_eq(now, entry->timestamp + 1816 time_after_eq(now, entry->timestamp +
1840 priv->path_switching_delay)) { 1817 priv->path_switching_delay)) {
1841 struct sk_buff *skb; 1818 struct sk_buff *skb;
@@ -1863,7 +1840,8 @@ restart:
1863 * 1840 *
1864 */ 1841 */
1865static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv, 1842static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv,
1866 const unsigned char *mac_to_find, int is_rdesc, 1843 const unsigned char *mac_to_find,
1844 int is_rdesc,
1867 struct lec_arp_table **ret_entry) 1845 struct lec_arp_table **ret_entry)
1868{ 1846{
1869 unsigned long flags; 1847 unsigned long flags;
@@ -1899,9 +1877,8 @@ static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv,
1899 * If the LE_ARP cache entry is still pending, reset count to 0 1877 * If the LE_ARP cache entry is still pending, reset count to 0
1900 * so another LE_ARP request can be made for this frame. 1878 * so another LE_ARP request can be made for this frame.
1901 */ 1879 */
1902 if (entry->status == ESI_ARP_PENDING) { 1880 if (entry->status == ESI_ARP_PENDING)
1903 entry->no_tries = 0; 1881 entry->no_tries = 0;
1904 }
1905 /* 1882 /*
1906 * Data direct VC not yet set up, check to see if the unknown 1883 * Data direct VC not yet set up, check to see if the unknown
1907 * frame count is greater than the limit. If the limit has 1884 * frame count is greater than the limit. If the limit has
@@ -1969,10 +1946,11 @@ lec_addr_delete(struct lec_priv *priv, const unsigned char *atm_addr,
1969 pr_debug("\n"); 1946 pr_debug("\n");
1970 spin_lock_irqsave(&priv->lec_arp_lock, flags); 1947 spin_lock_irqsave(&priv->lec_arp_lock, flags);
1971 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { 1948 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
1972 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_tables[i], next) { 1949 hlist_for_each_entry_safe(entry, node, next,
1973 if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN) 1950 &priv->lec_arp_tables[i], next) {
1974 && (permanent || 1951 if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN) &&
1975 !(entry->flags & LEC_PERMANENT_FLAG))) { 1952 (permanent ||
1953 !(entry->flags & LEC_PERMANENT_FLAG))) {
1976 lec_arp_remove(priv, entry); 1954 lec_arp_remove(priv, entry);
1977 lec_arp_put(entry); 1955 lec_arp_put(entry);
1978 } 1956 }
@@ -2008,7 +1986,8 @@ lec_arp_update(struct lec_priv *priv, const unsigned char *mac_addr,
2008 * we have no entry in the cache. 7.1.30 1986 * we have no entry in the cache. 7.1.30
2009 */ 1987 */
2010 if (!hlist_empty(&priv->lec_arp_empty_ones)) { 1988 if (!hlist_empty(&priv->lec_arp_empty_ones)) {
2011 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_empty_ones, next) { 1989 hlist_for_each_entry_safe(entry, node, next,
1990 &priv->lec_arp_empty_ones, next) {
2012 if (memcmp(entry->atm_addr, atm_addr, ATM_ESA_LEN) == 0) { 1991 if (memcmp(entry->atm_addr, atm_addr, ATM_ESA_LEN) == 0) {
2013 hlist_del(&entry->next); 1992 hlist_del(&entry->next);
2014 del_timer(&entry->timer); 1993 del_timer(&entry->timer);
@@ -2052,7 +2031,8 @@ lec_arp_update(struct lec_priv *priv, const unsigned char *mac_addr,
2052 memcpy(entry->atm_addr, atm_addr, ATM_ESA_LEN); 2031 memcpy(entry->atm_addr, atm_addr, ATM_ESA_LEN);
2053 del_timer(&entry->timer); 2032 del_timer(&entry->timer);
2054 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { 2033 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
2055 hlist_for_each_entry(tmp, node, &priv->lec_arp_tables[i], next) { 2034 hlist_for_each_entry(tmp, node,
2035 &priv->lec_arp_tables[i], next) {
2056 if (entry != tmp && 2036 if (entry != tmp &&
2057 !memcmp(tmp->atm_addr, atm_addr, ATM_ESA_LEN)) { 2037 !memcmp(tmp->atm_addr, atm_addr, ATM_ESA_LEN)) {
2058 /* Vcc to this host exists */ 2038 /* Vcc to this host exists */
@@ -2097,14 +2077,13 @@ lec_vcc_added(struct lec_priv *priv, const struct atmlec_ioc *ioc_data,
2097 int i, found_entry = 0; 2077 int i, found_entry = 0;
2098 2078
2099 spin_lock_irqsave(&priv->lec_arp_lock, flags); 2079 spin_lock_irqsave(&priv->lec_arp_lock, flags);
2080 /* Vcc for Multicast Forward. No timer, LANEv2 7.1.20 and 2.3.5.3 */
2100 if (ioc_data->receive == 2) { 2081 if (ioc_data->receive == 2) {
2101 /* Vcc for Multicast Forward. No timer, LANEv2 7.1.20 and 2.3.5.3 */
2102
2103 pr_debug("LEC_ARP: Attaching mcast forward\n"); 2082 pr_debug("LEC_ARP: Attaching mcast forward\n");
2104#if 0 2083#if 0
2105 entry = lec_arp_find(priv, bus_mac); 2084 entry = lec_arp_find(priv, bus_mac);
2106 if (!entry) { 2085 if (!entry) {
2107 printk("LEC_ARP: Multicast entry not found!\n"); 2086 pr_info("LEC_ARP: Multicast entry not found!\n");
2108 goto out; 2087 goto out;
2109 } 2088 }
2110 memcpy(entry->atm_addr, ioc_data->atm_addr, ATM_ESA_LEN); 2089 memcpy(entry->atm_addr, ioc_data->atm_addr, ATM_ESA_LEN);
@@ -2163,7 +2142,8 @@ lec_vcc_added(struct lec_priv *priv, const struct atmlec_ioc *ioc_data,
2163 ioc_data->atm_addr[16], ioc_data->atm_addr[17], 2142 ioc_data->atm_addr[16], ioc_data->atm_addr[17],
2164 ioc_data->atm_addr[18], ioc_data->atm_addr[19]); 2143 ioc_data->atm_addr[18], ioc_data->atm_addr[19]);
2165 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { 2144 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
2166 hlist_for_each_entry(entry, node, &priv->lec_arp_tables[i], next) { 2145 hlist_for_each_entry(entry, node,
2146 &priv->lec_arp_tables[i], next) {
2167 if (memcmp 2147 if (memcmp
2168 (ioc_data->atm_addr, entry->atm_addr, 2148 (ioc_data->atm_addr, entry->atm_addr,
2169 ATM_ESA_LEN) == 0) { 2149 ATM_ESA_LEN) == 0) {
@@ -2247,14 +2227,16 @@ static void lec_flush_complete(struct lec_priv *priv, unsigned long tran_id)
2247restart: 2227restart:
2248 spin_lock_irqsave(&priv->lec_arp_lock, flags); 2228 spin_lock_irqsave(&priv->lec_arp_lock, flags);
2249 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { 2229 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
2250 hlist_for_each_entry(entry, node, &priv->lec_arp_tables[i], next) { 2230 hlist_for_each_entry(entry, node,
2251 if (entry->flush_tran_id == tran_id 2231 &priv->lec_arp_tables[i], next) {
2252 && entry->status == ESI_FLUSH_PENDING) { 2232 if (entry->flush_tran_id == tran_id &&
2233 entry->status == ESI_FLUSH_PENDING) {
2253 struct sk_buff *skb; 2234 struct sk_buff *skb;
2254 struct atm_vcc *vcc = entry->vcc; 2235 struct atm_vcc *vcc = entry->vcc;
2255 2236
2256 lec_arp_hold(entry); 2237 lec_arp_hold(entry);
2257 spin_unlock_irqrestore(&priv->lec_arp_lock, flags); 2238 spin_unlock_irqrestore(&priv->lec_arp_lock,
2239 flags);
2258 while ((skb = skb_dequeue(&entry->tx_wait)) != NULL) 2240 while ((skb = skb_dequeue(&entry->tx_wait)) != NULL)
2259 lec_send(vcc, skb); 2241 lec_send(vcc, skb);
2260 entry->last_used = jiffies; 2242 entry->last_used = jiffies;
@@ -2280,7 +2262,8 @@ lec_set_flush_tran_id(struct lec_priv *priv,
2280 2262
2281 spin_lock_irqsave(&priv->lec_arp_lock, flags); 2263 spin_lock_irqsave(&priv->lec_arp_lock, flags);
2282 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) 2264 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++)
2283 hlist_for_each_entry(entry, node, &priv->lec_arp_tables[i], next) { 2265 hlist_for_each_entry(entry, node,
2266 &priv->lec_arp_tables[i], next) {
2284 if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN)) { 2267 if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN)) {
2285 entry->flush_tran_id = tran_id; 2268 entry->flush_tran_id = tran_id;
2286 pr_debug("Set flush transaction id to %lx for %p\n", 2269 pr_debug("Set flush transaction id to %lx for %p\n",
@@ -2300,7 +2283,8 @@ static int lec_mcast_make(struct lec_priv *priv, struct atm_vcc *vcc)
2300 struct lec_vcc_priv *vpriv; 2283 struct lec_vcc_priv *vpriv;
2301 int err = 0; 2284 int err = 0;
2302 2285
2303 if (!(vpriv = kmalloc(sizeof(struct lec_vcc_priv), GFP_KERNEL))) 2286 vpriv = kmalloc(sizeof(struct lec_vcc_priv), GFP_KERNEL);
2287 if (!vpriv)
2304 return -ENOMEM; 2288 return -ENOMEM;
2305 vpriv->xoff = 0; 2289 vpriv->xoff = 0;
2306 vpriv->old_pop = vcc->pop; 2290 vpriv->old_pop = vcc->pop;
@@ -2340,18 +2324,19 @@ static void lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc)
2340 spin_lock_irqsave(&priv->lec_arp_lock, flags); 2324 spin_lock_irqsave(&priv->lec_arp_lock, flags);
2341 2325
2342 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { 2326 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
2343 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_tables[i], next) { 2327 hlist_for_each_entry_safe(entry, node, next,
2328 &priv->lec_arp_tables[i], next) {
2344 if (vcc == entry->vcc) { 2329 if (vcc == entry->vcc) {
2345 lec_arp_remove(priv, entry); 2330 lec_arp_remove(priv, entry);
2346 lec_arp_put(entry); 2331 lec_arp_put(entry);
2347 if (priv->mcast_vcc == vcc) { 2332 if (priv->mcast_vcc == vcc)
2348 priv->mcast_vcc = NULL; 2333 priv->mcast_vcc = NULL;
2349 }
2350 } 2334 }
2351 } 2335 }
2352 } 2336 }
2353 2337
2354 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_empty_ones, next) { 2338 hlist_for_each_entry_safe(entry, node, next,
2339 &priv->lec_arp_empty_ones, next) {
2355 if (entry->vcc == vcc) { 2340 if (entry->vcc == vcc) {
2356 lec_arp_clear_vccs(entry); 2341 lec_arp_clear_vccs(entry);
2357 del_timer(&entry->timer); 2342 del_timer(&entry->timer);
@@ -2360,7 +2345,8 @@ static void lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc)
2360 } 2345 }
2361 } 2346 }
2362 2347
2363 hlist_for_each_entry_safe(entry, node, next, &priv->lec_no_forward, next) { 2348 hlist_for_each_entry_safe(entry, node, next,
2349 &priv->lec_no_forward, next) {
2364 if (entry->recv_vcc == vcc) { 2350 if (entry->recv_vcc == vcc) {
2365 lec_arp_clear_vccs(entry); 2351 lec_arp_clear_vccs(entry);
2366 del_timer(&entry->timer); 2352 del_timer(&entry->timer);
@@ -2401,14 +2387,16 @@ lec_arp_check_empties(struct lec_priv *priv,
2401 src = hdr->h_source; 2387 src = hdr->h_source;
2402 2388
2403 spin_lock_irqsave(&priv->lec_arp_lock, flags); 2389 spin_lock_irqsave(&priv->lec_arp_lock, flags);
2404 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_empty_ones, next) { 2390 hlist_for_each_entry_safe(entry, node, next,
2391 &priv->lec_arp_empty_ones, next) {
2405 if (vcc == entry->vcc) { 2392 if (vcc == entry->vcc) {
2406 del_timer(&entry->timer); 2393 del_timer(&entry->timer);
2407 memcpy(entry->mac_addr, src, ETH_ALEN); 2394 memcpy(entry->mac_addr, src, ETH_ALEN);
2408 entry->status = ESI_FORWARD_DIRECT; 2395 entry->status = ESI_FORWARD_DIRECT;
2409 entry->last_used = jiffies; 2396 entry->last_used = jiffies;
2410 /* We might have got an entry */ 2397 /* We might have got an entry */
2411 if ((tmp = lec_arp_find(priv, src))) { 2398 tmp = lec_arp_find(priv, src);
2399 if (tmp) {
2412 lec_arp_remove(priv, tmp); 2400 lec_arp_remove(priv, tmp);
2413 lec_arp_put(tmp); 2401 lec_arp_put(tmp);
2414 } 2402 }