aboutsummaryrefslogtreecommitdiffstats
path: root/net/atm/lec.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/atm/lec.c')
-rw-r--r--net/atm/lec.c599
1 files changed, 283 insertions, 316 deletions
diff --git a/net/atm/lec.c b/net/atm/lec.c
index 42749b7b917c..5da5753157f9 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -4,6 +4,8 @@
4 * Marko Kiiskila <mkiiskila@yahoo.com> 4 * Marko Kiiskila <mkiiskila@yahoo.com>
5 */ 5 */
6 6
7#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
8
7#include <linux/kernel.h> 9#include <linux/kernel.h>
8#include <linux/bitops.h> 10#include <linux/bitops.h>
9#include <linux/capability.h> 11#include <linux/capability.h>
@@ -16,7 +18,7 @@
16#include <linux/skbuff.h> 18#include <linux/skbuff.h>
17#include <linux/ip.h> 19#include <linux/ip.h>
18#include <asm/byteorder.h> 20#include <asm/byteorder.h>
19#include <asm/uaccess.h> 21#include <linux/uaccess.h>
20#include <net/arp.h> 22#include <net/arp.h>
21#include <net/dst.h> 23#include <net/dst.h>
22#include <linux/proc_fs.h> 24#include <linux/proc_fs.h>
@@ -85,17 +87,19 @@ static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv,
85 int is_rdesc, 87 int is_rdesc,
86 struct lec_arp_table **ret_entry); 88 struct lec_arp_table **ret_entry);
87static 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,
88 const unsigned char *atm_addr, unsigned long remoteflag, 90 const unsigned char *atm_addr,
91 unsigned long remoteflag,
89 unsigned int targetless_le_arp); 92 unsigned int targetless_le_arp);
90static 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);
91static 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);
92static void lec_set_flush_tran_id(struct lec_priv *priv, 95static void lec_set_flush_tran_id(struct lec_priv *priv,
93 const unsigned char *atm_addr, 96 const unsigned char *atm_addr,
94 unsigned long tran_id); 97 unsigned long tran_id);
95static 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,
96 struct atm_vcc *vcc, 100 struct atm_vcc *vcc,
97 void (*old_push) (struct atm_vcc *vcc, 101 void (*old_push)(struct atm_vcc *vcc,
98 struct sk_buff *skb)); 102 struct sk_buff *skb));
99static 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);
100 104
101/* must be done under lec_arp_lock */ 105/* must be done under lec_arp_lock */
@@ -110,7 +114,6 @@ static inline void lec_arp_put(struct lec_arp_table *entry)
110 kfree(entry); 114 kfree(entry);
111} 115}
112 116
113
114static struct lane2_ops lane2_ops = { 117static struct lane2_ops lane2_ops = {
115 lane2_resolve, /* resolve, spec 3.1.3 */ 118 lane2_resolve, /* resolve, spec 3.1.3 */
116 lane2_associate_req, /* associate_req, spec 3.1.4 */ 119 lane2_associate_req, /* associate_req, spec 3.1.4 */
@@ -148,7 +151,8 @@ static void lec_handle_bridge(struct sk_buff *skb, struct net_device *dev)
148 mesg = (struct atmlec_msg *)skb2->data; 151 mesg = (struct atmlec_msg *)skb2->data;
149 mesg->type = l_topology_change; 152 mesg->type = l_topology_change;
150 buff += 4; 153 buff += 4;
151 mesg->content.normal.flag = *buff & 0x01; /* 0x01 is topology change */ 154 mesg->content.normal.flag = *buff & 0x01;
155 /* 0x01 is topology change */
152 156
153 priv = netdev_priv(dev); 157 priv = netdev_priv(dev);
154 atm_force_charge(priv->lecd, skb2->truesize); 158 atm_force_charge(priv->lecd, skb2->truesize);
@@ -242,7 +246,7 @@ lec_send(struct atm_vcc *vcc, struct sk_buff *skb)
242 246
243static void lec_tx_timeout(struct net_device *dev) 247static void lec_tx_timeout(struct net_device *dev)
244{ 248{
245 printk(KERN_INFO "%s: tx timeout\n", dev->name); 249 pr_info("%s\n", dev->name);
246 dev->trans_start = jiffies; 250 dev->trans_start = jiffies;
247 netif_wake_queue(dev); 251 netif_wake_queue(dev);
248} 252}
@@ -261,14 +265,10 @@ static netdev_tx_t lec_start_xmit(struct sk_buff *skb,
261 unsigned char rdesc[ETH_ALEN]; /* Token Ring route descriptor */ 265 unsigned char rdesc[ETH_ALEN]; /* Token Ring route descriptor */
262#endif 266#endif
263 int is_rdesc; 267 int is_rdesc;
264#if DUMP_PACKETS > 0
265 char buf[300];
266 int i = 0;
267#endif /* DUMP_PACKETS >0 */
268 268
269 pr_debug("lec_start_xmit called\n"); 269 pr_debug("called\n");
270 if (!priv->lecd) { 270 if (!priv->lecd) {
271 printk("%s:No lecd attached\n", dev->name); 271 pr_info("%s:No lecd attached\n", dev->name);
272 dev->stats.tx_errors++; 272 dev->stats.tx_errors++;
273 netif_stop_queue(dev); 273 netif_stop_queue(dev);
274 kfree_skb(skb); 274 kfree_skb(skb);
@@ -276,8 +276,8 @@ static netdev_tx_t lec_start_xmit(struct sk_buff *skb,
276 } 276 }
277 277
278 pr_debug("skbuff head:%lx data:%lx tail:%lx end:%lx\n", 278 pr_debug("skbuff head:%lx data:%lx tail:%lx end:%lx\n",
279 (long)skb->head, (long)skb->data, (long)skb_tail_pointer(skb), 279 (long)skb->head, (long)skb->data, (long)skb_tail_pointer(skb),
280 (long)skb_end_pointer(skb)); 280 (long)skb_end_pointer(skb));
281#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) 281#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
282 if (memcmp(skb->data, bridge_ula_lec, sizeof(bridge_ula_lec)) == 0) 282 if (memcmp(skb->data, bridge_ula_lec, sizeof(bridge_ula_lec)) == 0)
283 lec_handle_bridge(skb, dev); 283 lec_handle_bridge(skb, dev);
@@ -285,8 +285,7 @@ static netdev_tx_t lec_start_xmit(struct sk_buff *skb,
285 285
286 /* Make sure we have room for lec_id */ 286 /* Make sure we have room for lec_id */
287 if (skb_headroom(skb) < 2) { 287 if (skb_headroom(skb) < 2) {
288 288 pr_debug("reallocating skb\n");
289 pr_debug("lec_start_xmit: reallocating skb\n");
290 skb2 = skb_realloc_headroom(skb, LEC_HEADER_LEN); 289 skb2 = skb_realloc_headroom(skb, LEC_HEADER_LEN);
291 kfree_skb(skb); 290 kfree_skb(skb);
292 if (skb2 == NULL) 291 if (skb2 == NULL)
@@ -313,23 +312,17 @@ static netdev_tx_t lec_start_xmit(struct sk_buff *skb,
313 } 312 }
314#endif 313#endif
315 314
316#if DUMP_PACKETS > 0
317 printk("%s: send datalen:%ld lecid:%4.4x\n", dev->name,
318 skb->len, priv->lecid);
319#if DUMP_PACKETS >= 2 315#if DUMP_PACKETS >= 2
320 for (i = 0; i < skb->len && i < 99; i++) { 316#define MAX_DUMP_SKB 99
321 sprintf(buf + i * 3, "%2.2x ", 0xff & skb->data[i]);
322 }
323#elif DUMP_PACKETS >= 1 317#elif DUMP_PACKETS >= 1
324 for (i = 0; i < skb->len && i < 30; i++) { 318#define MAX_DUMP_SKB 30
325 sprintf(buf + i * 3, "%2.2x ", 0xff & skb->data[i]); 319#endif
326 } 320#if DUMP_PACKETS >= 1
321 printk(KERN_DEBUG "%s: send datalen:%ld lecid:%4.4x\n",
322 dev->name, skb->len, priv->lecid);
323 print_hex_dump(KERN_DEBUG, "", DUMP_OFFSET, 16, 1,
324 skb->data, min(skb->len, MAX_DUMP_SKB), true);
327#endif /* DUMP_PACKETS >= 1 */ 325#endif /* DUMP_PACKETS >= 1 */
328 if (i == skb->len)
329 printk("%s\n", buf);
330 else
331 printk("%s...\n", buf);
332#endif /* DUMP_PACKETS > 0 */
333 326
334 /* Minimum ethernet-frame size */ 327 /* Minimum ethernet-frame size */
335#ifdef CONFIG_TR 328#ifdef CONFIG_TR
@@ -367,31 +360,28 @@ static netdev_tx_t lec_start_xmit(struct sk_buff *skb,
367#endif 360#endif
368 entry = NULL; 361 entry = NULL;
369 vcc = lec_arp_resolve(priv, dst, is_rdesc, &entry); 362 vcc = lec_arp_resolve(priv, dst, is_rdesc, &entry);
370 pr_debug("%s:vcc:%p vcc_flags:%lx, entry:%p\n", dev->name, 363 pr_debug("%s:vcc:%p vcc_flags:%lx, entry:%p\n",
371 vcc, vcc ? vcc->flags : 0, entry); 364 dev->name, vcc, vcc ? vcc->flags : 0, entry);
372 if (!vcc || !test_bit(ATM_VF_READY, &vcc->flags)) { 365 if (!vcc || !test_bit(ATM_VF_READY, &vcc->flags)) {
373 if (entry && (entry->tx_wait.qlen < LEC_UNRES_QUE_LEN)) { 366 if (entry && (entry->tx_wait.qlen < LEC_UNRES_QUE_LEN)) {
374 pr_debug("%s:lec_start_xmit: queuing packet, ", 367 pr_debug("%s:queuing packet, MAC address %pM\n",
375 dev->name); 368 dev->name, lec_h->h_dest);
376 pr_debug("MAC address %pM\n", lec_h->h_dest);
377 skb_queue_tail(&entry->tx_wait, skb); 369 skb_queue_tail(&entry->tx_wait, skb);
378 } else { 370 } else {
379 pr_debug 371 pr_debug("%s:tx queue full or no arp entry, dropping, MAC address: %pM\n",
380 ("%s:lec_start_xmit: tx queue full or no arp entry, dropping, ", 372 dev->name, lec_h->h_dest);
381 dev->name);
382 pr_debug("MAC address %pM\n", lec_h->h_dest);
383 dev->stats.tx_dropped++; 373 dev->stats.tx_dropped++;
384 dev_kfree_skb(skb); 374 dev_kfree_skb(skb);
385 } 375 }
386 goto out; 376 goto out;
387 } 377 }
388#if DUMP_PACKETS > 0 378#if DUMP_PACKETS > 0
389 printk("%s:sending to vpi:%d vci:%d\n", dev->name, vcc->vpi, vcc->vci); 379 printk(KERN_DEBUG "%s:sending to vpi:%d vci:%d\n",
380 dev->name, vcc->vpi, vcc->vci);
390#endif /* DUMP_PACKETS > 0 */ 381#endif /* DUMP_PACKETS > 0 */
391 382
392 while (entry && (skb2 = skb_dequeue(&entry->tx_wait))) { 383 while (entry && (skb2 = skb_dequeue(&entry->tx_wait))) {
393 pr_debug("lec.c: emptying tx queue, "); 384 pr_debug("emptying tx queue, MAC address %pM\n", lec_h->h_dest);
394 pr_debug("MAC address %pM\n", lec_h->h_dest);
395 lec_send(vcc, skb2); 385 lec_send(vcc, skb2);
396 } 386 }
397 387
@@ -444,14 +434,12 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
444 pr_debug("%s: msg from zeppelin:%d\n", dev->name, mesg->type); 434 pr_debug("%s: msg from zeppelin:%d\n", dev->name, mesg->type);
445 switch (mesg->type) { 435 switch (mesg->type) {
446 case l_set_mac_addr: 436 case l_set_mac_addr:
447 for (i = 0; i < 6; i++) { 437 for (i = 0; i < 6; i++)
448 dev->dev_addr[i] = mesg->content.normal.mac_addr[i]; 438 dev->dev_addr[i] = mesg->content.normal.mac_addr[i];
449 }
450 break; 439 break;
451 case l_del_mac_addr: 440 case l_del_mac_addr:
452 for (i = 0; i < 6; i++) { 441 for (i = 0; i < 6; i++)
453 dev->dev_addr[i] = 0; 442 dev->dev_addr[i] = 0;
454 }
455 break; 443 break;
456 case l_addr_delete: 444 case l_addr_delete:
457 lec_addr_delete(priv, mesg->content.normal.atm_addr, 445 lec_addr_delete(priv, mesg->content.normal.atm_addr,
@@ -477,10 +465,10 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
477 mesg->content.normal.atm_addr, 465 mesg->content.normal.atm_addr,
478 mesg->content.normal.flag, 466 mesg->content.normal.flag,
479 mesg->content.normal.targetless_le_arp); 467 mesg->content.normal.targetless_le_arp);
480 pr_debug("lec: in l_arp_update\n"); 468 pr_debug("in l_arp_update\n");
481 if (mesg->sizeoftlvs != 0) { /* LANE2 3.1.5 */ 469 if (mesg->sizeoftlvs != 0) { /* LANE2 3.1.5 */
482 pr_debug("lec: LANE2 3.1.5, got tlvs, size %d\n", 470 pr_debug("LANE2 3.1.5, got tlvs, size %d\n",
483 mesg->sizeoftlvs); 471 mesg->sizeoftlvs);
484 lane2_associate_ind(dev, mesg->content.normal.mac_addr, 472 lane2_associate_ind(dev, mesg->content.normal.mac_addr,
485 tmp, mesg->sizeoftlvs); 473 tmp, mesg->sizeoftlvs);
486 } 474 }
@@ -499,13 +487,14 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
499 priv->flush_timeout = (mesg->content.config.flush_timeout * HZ); 487 priv->flush_timeout = (mesg->content.config.flush_timeout * HZ);
500 priv->path_switching_delay = 488 priv->path_switching_delay =
501 (mesg->content.config.path_switching_delay * HZ); 489 (mesg->content.config.path_switching_delay * HZ);
502 priv->lane_version = mesg->content.config.lane_version; /* LANE2 */ 490 priv->lane_version = mesg->content.config.lane_version;
491 /* LANE2 */
503 priv->lane2_ops = NULL; 492 priv->lane2_ops = NULL;
504 if (priv->lane_version > 1) 493 if (priv->lane_version > 1)
505 priv->lane2_ops = &lane2_ops; 494 priv->lane2_ops = &lane2_ops;
506 if (dev_set_mtu(dev, mesg->content.config.mtu)) 495 if (dev_set_mtu(dev, mesg->content.config.mtu))
507 printk("%s: change_mtu to %d failed\n", dev->name, 496 pr_info("%s: change_mtu to %d failed\n",
508 mesg->content.config.mtu); 497 dev->name, mesg->content.config.mtu);
509 priv->is_proxy = mesg->content.config.is_proxy; 498 priv->is_proxy = mesg->content.config.is_proxy;
510 break; 499 break;
511 case l_flush_tran_id: 500 case l_flush_tran_id:
@@ -518,40 +507,35 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
518 break; 507 break;
519 case l_should_bridge: 508 case l_should_bridge:
520#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) 509#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
521 { 510 {
522 pr_debug("%s: bridge zeppelin asks about %pM\n", 511 pr_debug("%s: bridge zeppelin asks about %pM\n",
523 dev->name, mesg->content.proxy.mac_addr); 512 dev->name, mesg->content.proxy.mac_addr);
524 513
525 if (br_fdb_test_addr_hook == NULL) 514 if (br_fdb_test_addr_hook == NULL)
526 break; 515 break;
527 516
528 if (br_fdb_test_addr_hook(dev, 517 if (br_fdb_test_addr_hook(dev, mesg->content.proxy.mac_addr)) {
529 mesg->content.proxy.mac_addr)) { 518 /* hit from bridge table, send LE_ARP_RESPONSE */
530 /* hit from bridge table, send LE_ARP_RESPONSE */ 519 struct sk_buff *skb2;
531 struct sk_buff *skb2; 520 struct sock *sk;
532 struct sock *sk; 521
533 522 pr_debug("%s: entry found, responding to zeppelin\n",
534 pr_debug 523 dev->name);
535 ("%s: entry found, responding to zeppelin\n", 524 skb2 = alloc_skb(sizeof(struct atmlec_msg), GFP_ATOMIC);
536 dev->name); 525 if (skb2 == NULL)
537 skb2 = 526 break;
538 alloc_skb(sizeof(struct atmlec_msg), 527 skb2->len = sizeof(struct atmlec_msg);
539 GFP_ATOMIC); 528 skb_copy_to_linear_data(skb2, mesg, sizeof(*mesg));
540 if (skb2 == NULL) 529 atm_force_charge(priv->lecd, skb2->truesize);
541 break; 530 sk = sk_atm(priv->lecd);
542 skb2->len = sizeof(struct atmlec_msg); 531 skb_queue_tail(&sk->sk_receive_queue, skb2);
543 skb_copy_to_linear_data(skb2, mesg, 532 sk->sk_data_ready(sk, skb2->len);
544 sizeof(*mesg));
545 atm_force_charge(priv->lecd, skb2->truesize);
546 sk = sk_atm(priv->lecd);
547 skb_queue_tail(&sk->sk_receive_queue, skb2);
548 sk->sk_data_ready(sk, skb2->len);
549 }
550 } 533 }
534 }
551#endif /* defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) */ 535#endif /* defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) */
552 break; 536 break;
553 default: 537 default:
554 printk("%s: Unknown message type %d\n", dev->name, mesg->type); 538 pr_info("%s: Unknown message type %d\n", dev->name, mesg->type);
555 dev_kfree_skb(skb); 539 dev_kfree_skb(skb);
556 return -EINVAL; 540 return -EINVAL;
557 } 541 }
@@ -572,14 +556,13 @@ static void lec_atm_close(struct atm_vcc *vcc)
572 lec_arp_destroy(priv); 556 lec_arp_destroy(priv);
573 557
574 if (skb_peek(&sk_atm(vcc)->sk_receive_queue)) 558 if (skb_peek(&sk_atm(vcc)->sk_receive_queue))
575 printk("%s lec_atm_close: closing with messages pending\n", 559 pr_info("%s closing with messages pending\n", dev->name);
576 dev->name); 560 while ((skb = skb_dequeue(&sk_atm(vcc)->sk_receive_queue))) {
577 while ((skb = skb_dequeue(&sk_atm(vcc)->sk_receive_queue)) != NULL) {
578 atm_return(vcc, skb->truesize); 561 atm_return(vcc, skb->truesize);
579 dev_kfree_skb(skb); 562 dev_kfree_skb(skb);
580 } 563 }
581 564
582 printk("%s: Shut down!\n", dev->name); 565 pr_info("%s: Shut down!\n", dev->name);
583 module_put(THIS_MODULE); 566 module_put(THIS_MODULE);
584} 567}
585 568
@@ -608,9 +591,8 @@ send_to_lecd(struct lec_priv *priv, atmlec_msg_type type,
608 struct sk_buff *skb; 591 struct sk_buff *skb;
609 struct atmlec_msg *mesg; 592 struct atmlec_msg *mesg;
610 593
611 if (!priv || !priv->lecd) { 594 if (!priv || !priv->lecd)
612 return -1; 595 return -1;
613 }
614 skb = alloc_skb(sizeof(struct atmlec_msg), GFP_ATOMIC); 596 skb = alloc_skb(sizeof(struct atmlec_msg), GFP_ATOMIC);
615 if (!skb) 597 if (!skb)
616 return -1; 598 return -1;
@@ -633,7 +615,7 @@ send_to_lecd(struct lec_priv *priv, atmlec_msg_type type,
633 sk->sk_data_ready(sk, skb->len); 615 sk->sk_data_ready(sk, skb->len);
634 616
635 if (data != NULL) { 617 if (data != NULL) {
636 pr_debug("lec: about to send %d bytes of data\n", data->len); 618 pr_debug("about to send %d bytes of data\n", data->len);
637 atm_force_charge(priv->lecd, data->truesize); 619 atm_force_charge(priv->lecd, data->truesize);
638 skb_queue_tail(&sk->sk_receive_queue, data); 620 skb_queue_tail(&sk->sk_receive_queue, data);
639 sk->sk_data_ready(sk, skb->len); 621 sk->sk_data_ready(sk, skb->len);
@@ -691,36 +673,28 @@ static void lec_push(struct atm_vcc *vcc, struct sk_buff *skb)
691 struct net_device *dev = (struct net_device *)vcc->proto_data; 673 struct net_device *dev = (struct net_device *)vcc->proto_data;
692 struct lec_priv *priv = netdev_priv(dev); 674 struct lec_priv *priv = netdev_priv(dev);
693 675
694#if DUMP_PACKETS >0 676#if DUMP_PACKETS > 0
695 int i = 0; 677 printk(KERN_DEBUG "%s: vcc vpi:%d vci:%d\n",
696 char buf[300]; 678 dev->name, vcc->vpi, vcc->vci);
697
698 printk("%s: lec_push vcc vpi:%d vci:%d\n", dev->name,
699 vcc->vpi, vcc->vci);
700#endif 679#endif
701 if (!skb) { 680 if (!skb) {
702 pr_debug("%s: null skb\n", dev->name); 681 pr_debug("%s: null skb\n", dev->name);
703 lec_vcc_close(priv, vcc); 682 lec_vcc_close(priv, vcc);
704 return; 683 return;
705 } 684 }
706#if DUMP_PACKETS > 0
707 printk("%s: rcv datalen:%ld lecid:%4.4x\n", dev->name,
708 skb->len, priv->lecid);
709#if DUMP_PACKETS >= 2 685#if DUMP_PACKETS >= 2
710 for (i = 0; i < skb->len && i < 99; i++) { 686#define MAX_SKB_DUMP 99
711 sprintf(buf + i * 3, "%2.2x ", 0xff & skb->data[i]);
712 }
713#elif DUMP_PACKETS >= 1 687#elif DUMP_PACKETS >= 1
714 for (i = 0; i < skb->len && i < 30; i++) { 688#define MAX_SKB_DUMP 30
715 sprintf(buf + i * 3, "%2.2x ", 0xff & skb->data[i]); 689#endif
716 } 690#if DUMP_PACKETS > 0
717#endif /* DUMP_PACKETS >= 1 */ 691 printk(KERN_DEBUG "%s: rcv datalen:%ld lecid:%4.4x\n",
718 if (i == skb->len) 692 dev->name, skb->len, priv->lecid);
719 printk("%s\n", buf); 693 print_hex_dump(KERN_DEBUG, "", DUMP_OFFSET, 16, 1,
720 else 694 skb->data, min(MAX_SKB_DUMP, skb->len), true);
721 printk("%s...\n", buf);
722#endif /* DUMP_PACKETS > 0 */ 695#endif /* DUMP_PACKETS > 0 */
723 if (memcmp(skb->data, lec_ctrl_magic, 4) == 0) { /* Control frame, to daemon */ 696 if (memcmp(skb->data, lec_ctrl_magic, 4) == 0) {
697 /* Control frame, to daemon */
724 struct sock *sk = sk_atm(vcc); 698 struct sock *sk = sk_atm(vcc);
725 699
726 pr_debug("%s: To daemon\n", dev->name); 700 pr_debug("%s: To daemon\n", dev->name);
@@ -778,9 +752,8 @@ static void lec_push(struct atm_vcc *vcc, struct sk_buff *skb)
778 dev_kfree_skb(skb); 752 dev_kfree_skb(skb);
779 return; 753 return;
780 } 754 }
781 if (!hlist_empty(&priv->lec_arp_empty_ones)) { 755 if (!hlist_empty(&priv->lec_arp_empty_ones))
782 lec_arp_check_empties(priv, vcc, skb); 756 lec_arp_check_empties(priv, vcc, skb);
783 }
784 skb_pull(skb, 2); /* skip lec_id */ 757 skb_pull(skb, 2); /* skip lec_id */
785#ifdef CONFIG_TR 758#ifdef CONFIG_TR
786 if (priv->is_trdev) 759 if (priv->is_trdev)
@@ -801,7 +774,7 @@ static void lec_pop(struct atm_vcc *vcc, struct sk_buff *skb)
801 struct net_device *dev = skb->dev; 774 struct net_device *dev = skb->dev;
802 775
803 if (vpriv == NULL) { 776 if (vpriv == NULL) {
804 printk("lec_pop(): vpriv = NULL!?!?!?\n"); 777 pr_info("vpriv = NULL!?!?!?\n");
805 return; 778 return;
806 } 779 }
807 780
@@ -822,15 +795,13 @@ static int lec_vcc_attach(struct atm_vcc *vcc, void __user *arg)
822 795
823 /* Lecd must be up in this case */ 796 /* Lecd must be up in this case */
824 bytes_left = copy_from_user(&ioc_data, arg, sizeof(struct atmlec_ioc)); 797 bytes_left = copy_from_user(&ioc_data, arg, sizeof(struct atmlec_ioc));
825 if (bytes_left != 0) { 798 if (bytes_left != 0)
826 printk 799 pr_info("copy from user failed for %d bytes\n", bytes_left);
827 ("lec: lec_vcc_attach, copy from user failed for %d bytes\n",
828 bytes_left);
829 }
830 if (ioc_data.dev_num < 0 || ioc_data.dev_num >= MAX_LEC_ITF || 800 if (ioc_data.dev_num < 0 || ioc_data.dev_num >= MAX_LEC_ITF ||
831 !dev_lec[ioc_data.dev_num]) 801 !dev_lec[ioc_data.dev_num])
832 return -EINVAL; 802 return -EINVAL;
833 if (!(vpriv = kmalloc(sizeof(struct lec_vcc_priv), GFP_KERNEL))) 803 vpriv = kmalloc(sizeof(struct lec_vcc_priv), GFP_KERNEL);
804 if (!vpriv)
834 return -ENOMEM; 805 return -ENOMEM;
835 vpriv->xoff = 0; 806 vpriv->xoff = 0;
836 vpriv->old_pop = vcc->pop; 807 vpriv->old_pop = vcc->pop;
@@ -921,9 +892,8 @@ static int lecd_attach(struct atm_vcc *vcc, int arg)
921 priv->flush_timeout = (4 * HZ); 892 priv->flush_timeout = (4 * HZ);
922 priv->path_switching_delay = (6 * HZ); 893 priv->path_switching_delay = (6 * HZ);
923 894
924 if (dev_lec[i]->flags & IFF_UP) { 895 if (dev_lec[i]->flags & IFF_UP)
925 netif_start_queue(dev_lec[i]); 896 netif_start_queue(dev_lec[i]);
926 }
927 __module_get(THIS_MODULE); 897 __module_get(THIS_MODULE);
928 return i; 898 return i;
929} 899}
@@ -1125,7 +1095,9 @@ static int lec_seq_show(struct seq_file *seq, void *v)
1125 else { 1095 else {
1126 struct lec_state *state = seq->private; 1096 struct lec_state *state = seq->private;
1127 struct net_device *dev = state->dev; 1097 struct net_device *dev = state->dev;
1128 struct lec_arp_table *entry = hlist_entry(state->node, struct lec_arp_table, next); 1098 struct lec_arp_table *entry = hlist_entry(state->node,
1099 struct lec_arp_table,
1100 next);
1129 1101
1130 seq_printf(seq, "%s ", dev->name); 1102 seq_printf(seq, "%s ", dev->name);
1131 lec_info(seq, entry); 1103 lec_info(seq, entry);
@@ -1199,13 +1171,13 @@ static int __init lane_module_init(void)
1199 1171
1200 p = proc_create("lec", S_IRUGO, atm_proc_root, &lec_seq_fops); 1172 p = proc_create("lec", S_IRUGO, atm_proc_root, &lec_seq_fops);
1201 if (!p) { 1173 if (!p) {
1202 printk(KERN_ERR "Unable to initialize /proc/net/atm/lec\n"); 1174 pr_err("Unable to initialize /proc/net/atm/lec\n");
1203 return -ENOMEM; 1175 return -ENOMEM;
1204 } 1176 }
1205#endif 1177#endif
1206 1178
1207 register_atm_ioctl(&lane_ioctl_ops); 1179 register_atm_ioctl(&lane_ioctl_ops);
1208 printk("lec.c: " __DATE__ " " __TIME__ " initialized\n"); 1180 pr_info("lec.c: " __DATE__ " " __TIME__ " initialized\n");
1209 return 0; 1181 return 0;
1210} 1182}
1211 1183
@@ -1294,13 +1266,13 @@ static int lane2_associate_req(struct net_device *dev, const u8 *lan_dst,
1294 struct lec_priv *priv = netdev_priv(dev); 1266 struct lec_priv *priv = netdev_priv(dev);
1295 1267
1296 if (compare_ether_addr(lan_dst, dev->dev_addr)) 1268 if (compare_ether_addr(lan_dst, dev->dev_addr))
1297 return (0); /* not our mac address */ 1269 return 0; /* not our mac address */
1298 1270
1299 kfree(priv->tlvs); /* NULL if there was no previous association */ 1271 kfree(priv->tlvs); /* NULL if there was no previous association */
1300 1272
1301 priv->tlvs = kmemdup(tlvs, sizeoftlvs, GFP_KERNEL); 1273 priv->tlvs = kmemdup(tlvs, sizeoftlvs, GFP_KERNEL);
1302 if (priv->tlvs == NULL) 1274 if (priv->tlvs == NULL)
1303 return (0); 1275 return 0;
1304 priv->sizeoftlvs = sizeoftlvs; 1276 priv->sizeoftlvs = sizeoftlvs;
1305 1277
1306 skb = alloc_skb(sizeoftlvs, GFP_ATOMIC); 1278 skb = alloc_skb(sizeoftlvs, GFP_ATOMIC);
@@ -1310,12 +1282,12 @@ static int lane2_associate_req(struct net_device *dev, const u8 *lan_dst,
1310 skb_copy_to_linear_data(skb, tlvs, sizeoftlvs); 1282 skb_copy_to_linear_data(skb, tlvs, sizeoftlvs);
1311 retval = send_to_lecd(priv, l_associate_req, NULL, NULL, skb); 1283 retval = send_to_lecd(priv, l_associate_req, NULL, NULL, skb);
1312 if (retval != 0) 1284 if (retval != 0)
1313 printk("lec.c: lane2_associate_req() failed\n"); 1285 pr_info("lec.c: lane2_associate_req() failed\n");
1314 /* 1286 /*
1315 * If the previous association has changed we must 1287 * If the previous association has changed we must
1316 * somehow notify other LANE entities about the change 1288 * somehow notify other LANE entities about the change
1317 */ 1289 */
1318 return (1); 1290 return 1;
1319} 1291}
1320 1292
1321/* 1293/*
@@ -1348,12 +1320,12 @@ static void lane2_associate_ind(struct net_device *dev, const u8 *mac_addr,
1348 entry->sizeoftlvs = sizeoftlvs; 1320 entry->sizeoftlvs = sizeoftlvs;
1349#endif 1321#endif
1350#if 0 1322#if 0
1351 printk("lec.c: lane2_associate_ind()\n"); 1323 pr_info("\n");
1352 printk("dump of tlvs, sizeoftlvs=%d\n", sizeoftlvs); 1324 pr_info("dump of tlvs, sizeoftlvs=%d\n", sizeoftlvs);
1353 while (i < sizeoftlvs) 1325 while (i < sizeoftlvs)
1354 printk("%02x ", tlvs[i++]); 1326 pr_cont("%02x ", tlvs[i++]);
1355 1327
1356 printk("\n"); 1328 pr_cont("\n");
1357#endif 1329#endif
1358 1330
1359 /* tell MPOA about the TLVs we saw */ 1331 /* tell MPOA about the TLVs we saw */
@@ -1373,15 +1345,15 @@ static void lane2_associate_ind(struct net_device *dev, const u8 *mac_addr,
1373 1345
1374#include <linux/types.h> 1346#include <linux/types.h>
1375#include <linux/timer.h> 1347#include <linux/timer.h>
1376#include <asm/param.h> 1348#include <linux/param.h>
1377#include <asm/atomic.h> 1349#include <asm/atomic.h>
1378#include <linux/inetdevice.h> 1350#include <linux/inetdevice.h>
1379#include <net/route.h> 1351#include <net/route.h>
1380 1352
1381#if 0 1353#if 0
1382#define pr_debug(format,args...) 1354#define pr_debug(format, args...)
1383/* 1355/*
1384#define pr_debug printk 1356 #define pr_debug printk
1385*/ 1357*/
1386#endif 1358#endif
1387#define DEBUG_ARP_TABLE 0 1359#define DEBUG_ARP_TABLE 0
@@ -1395,7 +1367,7 @@ static void lec_arp_expire_arp(unsigned long data);
1395 * Arp table funcs 1367 * Arp table funcs
1396 */ 1368 */
1397 1369
1398#define HASH(ch) (ch & (LEC_ARP_TABLE_SIZE -1)) 1370#define HASH(ch) (ch & (LEC_ARP_TABLE_SIZE - 1))
1399 1371
1400/* 1372/*
1401 * Initialization of arp-cache 1373 * Initialization of arp-cache
@@ -1404,9 +1376,8 @@ static void lec_arp_init(struct lec_priv *priv)
1404{ 1376{
1405 unsigned short i; 1377 unsigned short i;
1406 1378
1407 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { 1379 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++)
1408 INIT_HLIST_HEAD(&priv->lec_arp_tables[i]); 1380 INIT_HLIST_HEAD(&priv->lec_arp_tables[i]);
1409 }
1410 INIT_HLIST_HEAD(&priv->lec_arp_empty_ones); 1381 INIT_HLIST_HEAD(&priv->lec_arp_empty_ones);
1411 INIT_HLIST_HEAD(&priv->lec_no_forward); 1382 INIT_HLIST_HEAD(&priv->lec_no_forward);
1412 INIT_HLIST_HEAD(&priv->mcast_fwds); 1383 INIT_HLIST_HEAD(&priv->mcast_fwds);
@@ -1450,10 +1421,7 @@ lec_arp_add(struct lec_priv *priv, struct lec_arp_table *entry)
1450 tmp = &priv->lec_arp_tables[HASH(entry->mac_addr[ETH_ALEN - 1])]; 1421 tmp = &priv->lec_arp_tables[HASH(entry->mac_addr[ETH_ALEN - 1])];
1451 hlist_add_head(&entry->next, tmp); 1422 hlist_add_head(&entry->next, tmp);
1452 1423
1453 pr_debug("LEC_ARP: Added entry:%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n", 1424 pr_debug("Added entry:%pM\n", entry->mac_addr);
1454 0xff & entry->mac_addr[0], 0xff & entry->mac_addr[1],
1455 0xff & entry->mac_addr[2], 0xff & entry->mac_addr[3],
1456 0xff & entry->mac_addr[4], 0xff & entry->mac_addr[5]);
1457} 1425}
1458 1426
1459/* 1427/*
@@ -1466,20 +1434,23 @@ lec_arp_remove(struct lec_priv *priv, struct lec_arp_table *to_remove)
1466 struct lec_arp_table *entry; 1434 struct lec_arp_table *entry;
1467 int i, remove_vcc = 1; 1435 int i, remove_vcc = 1;
1468 1436
1469 if (!to_remove) { 1437 if (!to_remove)
1470 return -1; 1438 return -1;
1471 }
1472 1439
1473 hlist_del(&to_remove->next); 1440 hlist_del(&to_remove->next);
1474 del_timer(&to_remove->timer); 1441 del_timer(&to_remove->timer);
1475 1442
1476 /* If this is the only MAC connected to this VCC, also tear down the VCC */ 1443 /*
1444 * If this is the only MAC connected to this VCC,
1445 * also tear down the VCC
1446 */
1477 if (to_remove->status >= ESI_FLUSH_PENDING) { 1447 if (to_remove->status >= ESI_FLUSH_PENDING) {
1478 /* 1448 /*
1479 * ESI_FLUSH_PENDING, ESI_FORWARD_DIRECT 1449 * ESI_FLUSH_PENDING, ESI_FORWARD_DIRECT
1480 */ 1450 */
1481 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { 1451 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
1482 hlist_for_each_entry(entry, node, &priv->lec_arp_tables[i], next) { 1452 hlist_for_each_entry(entry, node,
1453 &priv->lec_arp_tables[i], next) {
1483 if (memcmp(to_remove->atm_addr, 1454 if (memcmp(to_remove->atm_addr,
1484 entry->atm_addr, ATM_ESA_LEN) == 0) { 1455 entry->atm_addr, ATM_ESA_LEN) == 0) {
1485 remove_vcc = 0; 1456 remove_vcc = 0;
@@ -1492,10 +1463,7 @@ lec_arp_remove(struct lec_priv *priv, struct lec_arp_table *to_remove)
1492 } 1463 }
1493 skb_queue_purge(&to_remove->tx_wait); /* FIXME: good place for this? */ 1464 skb_queue_purge(&to_remove->tx_wait); /* FIXME: good place for this? */
1494 1465
1495 pr_debug("LEC_ARP: Removed entry:%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n", 1466 pr_debug("Removed entry:%pM\n", to_remove->mac_addr);
1496 0xff & to_remove->mac_addr[0], 0xff & to_remove->mac_addr[1],
1497 0xff & to_remove->mac_addr[2], 0xff & to_remove->mac_addr[3],
1498 0xff & to_remove->mac_addr[4], 0xff & to_remove->mac_addr[5]);
1499 return 0; 1467 return 0;
1500} 1468}
1501 1469
@@ -1513,9 +1481,8 @@ static const char *get_status_string(unsigned char st)
1513 return "ESI_FLUSH_PENDING"; 1481 return "ESI_FLUSH_PENDING";
1514 case ESI_FORWARD_DIRECT: 1482 case ESI_FORWARD_DIRECT:
1515 return "ESI_FORWARD_DIRECT"; 1483 return "ESI_FORWARD_DIRECT";
1516 default:
1517 return "<UNKNOWN>";
1518 } 1484 }
1485 return "<UNKNOWN>";
1519} 1486}
1520 1487
1521static void dump_arp_table(struct lec_priv *priv) 1488static void dump_arp_table(struct lec_priv *priv)
@@ -1525,18 +1492,15 @@ static void dump_arp_table(struct lec_priv *priv)
1525 char buf[256]; 1492 char buf[256];
1526 int i, j, offset; 1493 int i, j, offset;
1527 1494
1528 printk("Dump %p:\n", priv); 1495 pr_info("Dump %p:\n", priv);
1529 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { 1496 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
1530 hlist_for_each_entry(rulla, node, &priv->lec_arp_tables[i], next) { 1497 hlist_for_each_entry(rulla, node,
1498 &priv->lec_arp_tables[i], next) {
1531 offset = 0; 1499 offset = 0;
1532 offset += sprintf(buf, "%d: %p\n", i, rulla); 1500 offset += sprintf(buf, "%d: %p\n", i, rulla);
1533 offset += sprintf(buf + offset, "Mac:"); 1501 offset += sprintf(buf + offset, "Mac: %pM",
1534 for (j = 0; j < ETH_ALEN; j++) { 1502 rulla->mac_addr);
1535 offset += sprintf(buf + offset, 1503 offset += sprintf(buf + offset, " Atm:");
1536 "%2.2x ",
1537 rulla->mac_addr[j] & 0xff);
1538 }
1539 offset += sprintf(buf + offset, "Atm:");
1540 for (j = 0; j < ATM_ESA_LEN; j++) { 1504 for (j = 0; j < ATM_ESA_LEN; j++) {
1541 offset += sprintf(buf + offset, 1505 offset += sprintf(buf + offset,
1542 "%2.2x ", 1506 "%2.2x ",
@@ -1556,20 +1520,16 @@ static void dump_arp_table(struct lec_priv *priv)
1556 "Flags:%x, Packets_flooded:%x, Status: %s ", 1520 "Flags:%x, Packets_flooded:%x, Status: %s ",
1557 rulla->flags, rulla->packets_flooded, 1521 rulla->flags, rulla->packets_flooded,
1558 get_status_string(rulla->status)); 1522 get_status_string(rulla->status));
1559 printk("%s\n", buf); 1523 pr_info("%s\n", buf);
1560 } 1524 }
1561 } 1525 }
1562 1526
1563 if (!hlist_empty(&priv->lec_no_forward)) 1527 if (!hlist_empty(&priv->lec_no_forward))
1564 printk("No forward\n"); 1528 pr_info("No forward\n");
1565 hlist_for_each_entry(rulla, node, &priv->lec_no_forward, next) { 1529 hlist_for_each_entry(rulla, node, &priv->lec_no_forward, next) {
1566 offset = 0; 1530 offset = 0;
1567 offset += sprintf(buf + offset, "Mac:"); 1531 offset += sprintf(buf + offset, "Mac: %pM", rulla->mac_addr);
1568 for (j = 0; j < ETH_ALEN; j++) { 1532 offset += sprintf(buf + offset, " Atm:");
1569 offset += sprintf(buf + offset, "%2.2x ",
1570 rulla->mac_addr[j] & 0xff);
1571 }
1572 offset += sprintf(buf + offset, "Atm:");
1573 for (j = 0; j < ATM_ESA_LEN; j++) { 1533 for (j = 0; j < ATM_ESA_LEN; j++) {
1574 offset += sprintf(buf + offset, "%2.2x ", 1534 offset += sprintf(buf + offset, "%2.2x ",
1575 rulla->atm_addr[j] & 0xff); 1535 rulla->atm_addr[j] & 0xff);
@@ -1586,19 +1546,15 @@ static void dump_arp_table(struct lec_priv *priv)
1586 "Flags:%x, Packets_flooded:%x, Status: %s ", 1546 "Flags:%x, Packets_flooded:%x, Status: %s ",
1587 rulla->flags, rulla->packets_flooded, 1547 rulla->flags, rulla->packets_flooded,
1588 get_status_string(rulla->status)); 1548 get_status_string(rulla->status));
1589 printk("%s\n", buf); 1549 pr_info("%s\n", buf);
1590 } 1550 }
1591 1551
1592 if (!hlist_empty(&priv->lec_arp_empty_ones)) 1552 if (!hlist_empty(&priv->lec_arp_empty_ones))
1593 printk("Empty ones\n"); 1553 pr_info("Empty ones\n");
1594 hlist_for_each_entry(rulla, node, &priv->lec_arp_empty_ones, next) { 1554 hlist_for_each_entry(rulla, node, &priv->lec_arp_empty_ones, next) {
1595 offset = 0; 1555 offset = 0;
1596 offset += sprintf(buf + offset, "Mac:"); 1556 offset += sprintf(buf + offset, "Mac: %pM", rulla->mac_addr);
1597 for (j = 0; j < ETH_ALEN; j++) { 1557 offset += sprintf(buf + offset, " Atm:");
1598 offset += sprintf(buf + offset, "%2.2x ",
1599 rulla->mac_addr[j] & 0xff);
1600 }
1601 offset += sprintf(buf + offset, "Atm:");
1602 for (j = 0; j < ATM_ESA_LEN; j++) { 1558 for (j = 0; j < ATM_ESA_LEN; j++) {
1603 offset += sprintf(buf + offset, "%2.2x ", 1559 offset += sprintf(buf + offset, "%2.2x ",
1604 rulla->atm_addr[j] & 0xff); 1560 rulla->atm_addr[j] & 0xff);
@@ -1615,19 +1571,15 @@ static void dump_arp_table(struct lec_priv *priv)
1615 "Flags:%x, Packets_flooded:%x, Status: %s ", 1571 "Flags:%x, Packets_flooded:%x, Status: %s ",
1616 rulla->flags, rulla->packets_flooded, 1572 rulla->flags, rulla->packets_flooded,
1617 get_status_string(rulla->status)); 1573 get_status_string(rulla->status));
1618 printk("%s", buf); 1574 pr_info("%s", buf);
1619 } 1575 }
1620 1576
1621 if (!hlist_empty(&priv->mcast_fwds)) 1577 if (!hlist_empty(&priv->mcast_fwds))
1622 printk("Multicast Forward VCCs\n"); 1578 pr_info("Multicast Forward VCCs\n");
1623 hlist_for_each_entry(rulla, node, &priv->mcast_fwds, next) { 1579 hlist_for_each_entry(rulla, node, &priv->mcast_fwds, next) {
1624 offset = 0; 1580 offset = 0;
1625 offset += sprintf(buf + offset, "Mac:"); 1581 offset += sprintf(buf + offset, "Mac: %pM", rulla->mac_addr);
1626 for (j = 0; j < ETH_ALEN; j++) { 1582 offset += sprintf(buf + offset, " Atm:");
1627 offset += sprintf(buf + offset, "%2.2x ",
1628 rulla->mac_addr[j] & 0xff);
1629 }
1630 offset += sprintf(buf + offset, "Atm:");
1631 for (j = 0; j < ATM_ESA_LEN; j++) { 1583 for (j = 0; j < ATM_ESA_LEN; j++) {
1632 offset += sprintf(buf + offset, "%2.2x ", 1584 offset += sprintf(buf + offset, "%2.2x ",
1633 rulla->atm_addr[j] & 0xff); 1585 rulla->atm_addr[j] & 0xff);
@@ -1644,7 +1596,7 @@ static void dump_arp_table(struct lec_priv *priv)
1644 "Flags:%x, Packets_flooded:%x, Status: %s ", 1596 "Flags:%x, Packets_flooded:%x, Status: %s ",
1645 rulla->flags, rulla->packets_flooded, 1597 rulla->flags, rulla->packets_flooded,
1646 get_status_string(rulla->status)); 1598 get_status_string(rulla->status));
1647 printk("%s\n", buf); 1599 pr_info("%s\n", buf);
1648 } 1600 }
1649 1601
1650} 1602}
@@ -1670,14 +1622,16 @@ static void lec_arp_destroy(struct lec_priv *priv)
1670 1622
1671 spin_lock_irqsave(&priv->lec_arp_lock, flags); 1623 spin_lock_irqsave(&priv->lec_arp_lock, flags);
1672 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { 1624 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
1673 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_tables[i], next) { 1625 hlist_for_each_entry_safe(entry, node, next,
1626 &priv->lec_arp_tables[i], next) {
1674 lec_arp_remove(priv, entry); 1627 lec_arp_remove(priv, entry);
1675 lec_arp_put(entry); 1628 lec_arp_put(entry);
1676 } 1629 }
1677 INIT_HLIST_HEAD(&priv->lec_arp_tables[i]); 1630 INIT_HLIST_HEAD(&priv->lec_arp_tables[i]);
1678 } 1631 }
1679 1632
1680 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_empty_ones, next) { 1633 hlist_for_each_entry_safe(entry, node, next,
1634 &priv->lec_arp_empty_ones, next) {
1681 del_timer_sync(&entry->timer); 1635 del_timer_sync(&entry->timer);
1682 lec_arp_clear_vccs(entry); 1636 lec_arp_clear_vccs(entry);
1683 hlist_del(&entry->next); 1637 hlist_del(&entry->next);
@@ -1685,7 +1639,8 @@ static void lec_arp_destroy(struct lec_priv *priv)
1685 } 1639 }
1686 INIT_HLIST_HEAD(&priv->lec_arp_empty_ones); 1640 INIT_HLIST_HEAD(&priv->lec_arp_empty_ones);
1687 1641
1688 hlist_for_each_entry_safe(entry, node, next, &priv->lec_no_forward, next) { 1642 hlist_for_each_entry_safe(entry, node, next,
1643 &priv->lec_no_forward, next) {
1689 del_timer_sync(&entry->timer); 1644 del_timer_sync(&entry->timer);
1690 lec_arp_clear_vccs(entry); 1645 lec_arp_clear_vccs(entry);
1691 hlist_del(&entry->next); 1646 hlist_del(&entry->next);
@@ -1714,15 +1669,12 @@ static struct lec_arp_table *lec_arp_find(struct lec_priv *priv,
1714 struct hlist_head *head; 1669 struct hlist_head *head;
1715 struct lec_arp_table *entry; 1670 struct lec_arp_table *entry;
1716 1671
1717 pr_debug("LEC_ARP: lec_arp_find :%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n", 1672 pr_debug("%pM\n", mac_addr);
1718 mac_addr[0] & 0xff, mac_addr[1] & 0xff, mac_addr[2] & 0xff,
1719 mac_addr[3] & 0xff, mac_addr[4] & 0xff, mac_addr[5] & 0xff);
1720 1673
1721 head = &priv->lec_arp_tables[HASH(mac_addr[ETH_ALEN - 1])]; 1674 head = &priv->lec_arp_tables[HASH(mac_addr[ETH_ALEN - 1])];
1722 hlist_for_each_entry(entry, node, head, next) { 1675 hlist_for_each_entry(entry, node, head, next) {
1723 if (!compare_ether_addr(mac_addr, entry->mac_addr)) { 1676 if (!compare_ether_addr(mac_addr, entry->mac_addr))
1724 return entry; 1677 return entry;
1725 }
1726 } 1678 }
1727 return NULL; 1679 return NULL;
1728} 1680}
@@ -1734,7 +1686,7 @@ static struct lec_arp_table *make_entry(struct lec_priv *priv,
1734 1686
1735 to_return = kzalloc(sizeof(struct lec_arp_table), GFP_ATOMIC); 1687 to_return = kzalloc(sizeof(struct lec_arp_table), GFP_ATOMIC);
1736 if (!to_return) { 1688 if (!to_return) {
1737 printk("LEC: Arp entry kmalloc failed\n"); 1689 pr_info("LEC: Arp entry kmalloc failed\n");
1738 return NULL; 1690 return NULL;
1739 } 1691 }
1740 memcpy(to_return->mac_addr, mac_addr, ETH_ALEN); 1692 memcpy(to_return->mac_addr, mac_addr, ETH_ALEN);
@@ -1755,7 +1707,7 @@ static void lec_arp_expire_arp(unsigned long data)
1755 1707
1756 entry = (struct lec_arp_table *)data; 1708 entry = (struct lec_arp_table *)data;
1757 1709
1758 pr_debug("lec_arp_expire_arp\n"); 1710 pr_debug("\n");
1759 if (entry->status == ESI_ARP_PENDING) { 1711 if (entry->status == ESI_ARP_PENDING) {
1760 if (entry->no_tries <= entry->priv->max_retry_count) { 1712 if (entry->no_tries <= entry->priv->max_retry_count) {
1761 if (entry->is_rdesc) 1713 if (entry->is_rdesc)
@@ -1779,10 +1731,10 @@ static void lec_arp_expire_vcc(unsigned long data)
1779 1731
1780 del_timer(&to_remove->timer); 1732 del_timer(&to_remove->timer);
1781 1733
1782 pr_debug("LEC_ARP %p %p: lec_arp_expire_vcc vpi:%d vci:%d\n", 1734 pr_debug("%p %p: vpi:%d vci:%d\n",
1783 to_remove, priv, 1735 to_remove, priv,
1784 to_remove->vcc ? to_remove->recv_vcc->vpi : 0, 1736 to_remove->vcc ? to_remove->recv_vcc->vpi : 0,
1785 to_remove->vcc ? to_remove->recv_vcc->vci : 0); 1737 to_remove->vcc ? to_remove->recv_vcc->vci : 0);
1786 1738
1787 spin_lock_irqsave(&priv->lec_arp_lock, flags); 1739 spin_lock_irqsave(&priv->lec_arp_lock, flags);
1788 hlist_del(&to_remove->next); 1740 hlist_del(&to_remove->next);
@@ -1792,6 +1744,50 @@ static void lec_arp_expire_vcc(unsigned long data)
1792 lec_arp_put(to_remove); 1744 lec_arp_put(to_remove);
1793} 1745}
1794 1746
1747static bool __lec_arp_check_expire(struct lec_arp_table *entry,
1748 unsigned long now,
1749 struct lec_priv *priv)
1750{
1751 unsigned long time_to_check;
1752
1753 if ((entry->flags) & LEC_REMOTE_FLAG && priv->topology_change)
1754 time_to_check = priv->forward_delay_time;
1755 else
1756 time_to_check = priv->aging_time;
1757
1758 pr_debug("About to expire: %lx - %lx > %lx\n",
1759 now, entry->last_used, time_to_check);
1760 if (time_after(now, entry->last_used + time_to_check) &&
1761 !(entry->flags & LEC_PERMANENT_FLAG) &&
1762 !(entry->mac_addr[0] & 0x01)) { /* LANE2: 7.1.20 */
1763 /* Remove entry */
1764 pr_debug("Entry timed out\n");
1765 lec_arp_remove(priv, entry);
1766 lec_arp_put(entry);
1767 } else {
1768 /* Something else */
1769 if ((entry->status == ESI_VC_PENDING ||
1770 entry->status == ESI_ARP_PENDING) &&
1771 time_after_eq(now, entry->timestamp +
1772 priv->max_unknown_frame_time)) {
1773 entry->timestamp = jiffies;
1774 entry->packets_flooded = 0;
1775 if (entry->status == ESI_VC_PENDING)
1776 send_to_lecd(priv, l_svc_setup,
1777 entry->mac_addr,
1778 entry->atm_addr,
1779 NULL);
1780 }
1781 if (entry->status == ESI_FLUSH_PENDING &&
1782 time_after_eq(now, entry->timestamp +
1783 priv->path_switching_delay)) {
1784 lec_arp_hold(entry);
1785 return true;
1786 }
1787 }
1788
1789 return false;
1790}
1795/* 1791/*
1796 * Expire entries. 1792 * Expire entries.
1797 * 1. Re-set timer 1793 * 1. Re-set timer
@@ -1816,62 +1812,28 @@ static void lec_arp_check_expire(struct work_struct *work)
1816 struct hlist_node *node, *next; 1812 struct hlist_node *node, *next;
1817 struct lec_arp_table *entry; 1813 struct lec_arp_table *entry;
1818 unsigned long now; 1814 unsigned long now;
1819 unsigned long time_to_check;
1820 int i; 1815 int i;
1821 1816
1822 pr_debug("lec_arp_check_expire %p\n", priv); 1817 pr_debug("%p\n", priv);
1823 now = jiffies; 1818 now = jiffies;
1824restart: 1819restart:
1825 spin_lock_irqsave(&priv->lec_arp_lock, flags); 1820 spin_lock_irqsave(&priv->lec_arp_lock, flags);
1826 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { 1821 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
1827 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_tables[i], next) { 1822 hlist_for_each_entry_safe(entry, node, next,
1828 if ((entry->flags) & LEC_REMOTE_FLAG && 1823 &priv->lec_arp_tables[i], next) {
1829 priv->topology_change) 1824 if (__lec_arp_check_expire(entry, now, priv)) {
1830 time_to_check = priv->forward_delay_time; 1825 struct sk_buff *skb;
1831 else 1826 struct atm_vcc *vcc = entry->vcc;
1832 time_to_check = priv->aging_time; 1827
1833 1828 spin_unlock_irqrestore(&priv->lec_arp_lock,
1834 pr_debug("About to expire: %lx - %lx > %lx\n", 1829 flags);
1835 now, entry->last_used, time_to_check); 1830 while ((skb = skb_dequeue(&entry->tx_wait)))
1836 if (time_after(now, entry->last_used + time_to_check) 1831 lec_send(vcc, skb);
1837 && !(entry->flags & LEC_PERMANENT_FLAG) 1832 entry->last_used = jiffies;
1838 && !(entry->mac_addr[0] & 0x01)) { /* LANE2: 7.1.20 */ 1833 entry->status = ESI_FORWARD_DIRECT;
1839 /* Remove entry */
1840 pr_debug("LEC:Entry timed out\n");
1841 lec_arp_remove(priv, entry);
1842 lec_arp_put(entry); 1834 lec_arp_put(entry);
1843 } else { 1835
1844 /* Something else */ 1836 goto restart;
1845 if ((entry->status == ESI_VC_PENDING ||
1846 entry->status == ESI_ARP_PENDING)
1847 && time_after_eq(now,
1848 entry->timestamp +
1849 priv->
1850 max_unknown_frame_time)) {
1851 entry->timestamp = jiffies;
1852 entry->packets_flooded = 0;
1853 if (entry->status == ESI_VC_PENDING)
1854 send_to_lecd(priv, l_svc_setup,
1855 entry->mac_addr,
1856 entry->atm_addr,
1857 NULL);
1858 }
1859 if (entry->status == ESI_FLUSH_PENDING
1860 &&
1861 time_after_eq(now, entry->timestamp +
1862 priv->path_switching_delay)) {
1863 struct sk_buff *skb;
1864 struct atm_vcc *vcc = entry->vcc;
1865
1866 lec_arp_hold(entry);
1867 spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
1868 while ((skb = skb_dequeue(&entry->tx_wait)) != NULL)
1869 lec_send(vcc, skb);
1870 entry->last_used = jiffies;
1871 entry->status = ESI_FORWARD_DIRECT;
1872 lec_arp_put(entry);
1873 goto restart;
1874 }
1875 } 1837 }
1876 } 1838 }
1877 } 1839 }
@@ -1885,7 +1847,8 @@ restart:
1885 * 1847 *
1886 */ 1848 */
1887static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv, 1849static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv,
1888 const unsigned char *mac_to_find, int is_rdesc, 1850 const unsigned char *mac_to_find,
1851 int is_rdesc,
1889 struct lec_arp_table **ret_entry) 1852 struct lec_arp_table **ret_entry)
1890{ 1853{
1891 unsigned long flags; 1854 unsigned long flags;
@@ -1921,9 +1884,8 @@ static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv,
1921 * If the LE_ARP cache entry is still pending, reset count to 0 1884 * If the LE_ARP cache entry is still pending, reset count to 0
1922 * so another LE_ARP request can be made for this frame. 1885 * so another LE_ARP request can be made for this frame.
1923 */ 1886 */
1924 if (entry->status == ESI_ARP_PENDING) { 1887 if (entry->status == ESI_ARP_PENDING)
1925 entry->no_tries = 0; 1888 entry->no_tries = 0;
1926 }
1927 /* 1889 /*
1928 * Data direct VC not yet set up, check to see if the unknown 1890 * Data direct VC not yet set up, check to see if the unknown
1929 * frame count is greater than the limit. If the limit has 1891 * frame count is greater than the limit. If the limit has
@@ -1934,7 +1896,7 @@ static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv,
1934 entry->packets_flooded < 1896 entry->packets_flooded <
1935 priv->maximum_unknown_frame_count) { 1897 priv->maximum_unknown_frame_count) {
1936 entry->packets_flooded++; 1898 entry->packets_flooded++;
1937 pr_debug("LEC_ARP: Flooding..\n"); 1899 pr_debug("Flooding..\n");
1938 found = priv->mcast_vcc; 1900 found = priv->mcast_vcc;
1939 goto out; 1901 goto out;
1940 } 1902 }
@@ -1945,13 +1907,13 @@ static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv,
1945 */ 1907 */
1946 lec_arp_hold(entry); 1908 lec_arp_hold(entry);
1947 *ret_entry = entry; 1909 *ret_entry = entry;
1948 pr_debug("lec: entry->status %d entry->vcc %p\n", entry->status, 1910 pr_debug("entry->status %d entry->vcc %p\n", entry->status,
1949 entry->vcc); 1911 entry->vcc);
1950 found = NULL; 1912 found = NULL;
1951 } else { 1913 } else {
1952 /* No matching entry was found */ 1914 /* No matching entry was found */
1953 entry = make_entry(priv, mac_to_find); 1915 entry = make_entry(priv, mac_to_find);
1954 pr_debug("LEC_ARP: Making entry\n"); 1916 pr_debug("Making entry\n");
1955 if (!entry) { 1917 if (!entry) {
1956 found = priv->mcast_vcc; 1918 found = priv->mcast_vcc;
1957 goto out; 1919 goto out;
@@ -1988,13 +1950,14 @@ lec_addr_delete(struct lec_priv *priv, const unsigned char *atm_addr,
1988 struct lec_arp_table *entry; 1950 struct lec_arp_table *entry;
1989 int i; 1951 int i;
1990 1952
1991 pr_debug("lec_addr_delete\n"); 1953 pr_debug("\n");
1992 spin_lock_irqsave(&priv->lec_arp_lock, flags); 1954 spin_lock_irqsave(&priv->lec_arp_lock, flags);
1993 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { 1955 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
1994 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_tables[i], next) { 1956 hlist_for_each_entry_safe(entry, node, next,
1995 if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN) 1957 &priv->lec_arp_tables[i], next) {
1996 && (permanent || 1958 if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN) &&
1997 !(entry->flags & LEC_PERMANENT_FLAG))) { 1959 (permanent ||
1960 !(entry->flags & LEC_PERMANENT_FLAG))) {
1998 lec_arp_remove(priv, entry); 1961 lec_arp_remove(priv, entry);
1999 lec_arp_put(entry); 1962 lec_arp_put(entry);
2000 } 1963 }
@@ -2019,10 +1982,8 @@ lec_arp_update(struct lec_priv *priv, const unsigned char *mac_addr,
2019 struct lec_arp_table *entry, *tmp; 1982 struct lec_arp_table *entry, *tmp;
2020 int i; 1983 int i;
2021 1984
2022 pr_debug("lec:%s", (targetless_le_arp) ? "targetless " : " "); 1985 pr_debug("%smac:%pM\n",
2023 pr_debug("lec_arp_update mac:%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x\n", 1986 (targetless_le_arp) ? "targetless " : "", mac_addr);
2024 mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3],
2025 mac_addr[4], mac_addr[5]);
2026 1987
2027 spin_lock_irqsave(&priv->lec_arp_lock, flags); 1988 spin_lock_irqsave(&priv->lec_arp_lock, flags);
2028 entry = lec_arp_find(priv, mac_addr); 1989 entry = lec_arp_find(priv, mac_addr);
@@ -2032,7 +1993,8 @@ lec_arp_update(struct lec_priv *priv, const unsigned char *mac_addr,
2032 * we have no entry in the cache. 7.1.30 1993 * we have no entry in the cache. 7.1.30
2033 */ 1994 */
2034 if (!hlist_empty(&priv->lec_arp_empty_ones)) { 1995 if (!hlist_empty(&priv->lec_arp_empty_ones)) {
2035 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_empty_ones, next) { 1996 hlist_for_each_entry_safe(entry, node, next,
1997 &priv->lec_arp_empty_ones, next) {
2036 if (memcmp(entry->atm_addr, atm_addr, ATM_ESA_LEN) == 0) { 1998 if (memcmp(entry->atm_addr, atm_addr, ATM_ESA_LEN) == 0) {
2037 hlist_del(&entry->next); 1999 hlist_del(&entry->next);
2038 del_timer(&entry->timer); 2000 del_timer(&entry->timer);
@@ -2076,7 +2038,8 @@ lec_arp_update(struct lec_priv *priv, const unsigned char *mac_addr,
2076 memcpy(entry->atm_addr, atm_addr, ATM_ESA_LEN); 2038 memcpy(entry->atm_addr, atm_addr, ATM_ESA_LEN);
2077 del_timer(&entry->timer); 2039 del_timer(&entry->timer);
2078 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { 2040 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
2079 hlist_for_each_entry(tmp, node, &priv->lec_arp_tables[i], next) { 2041 hlist_for_each_entry(tmp, node,
2042 &priv->lec_arp_tables[i], next) {
2080 if (entry != tmp && 2043 if (entry != tmp &&
2081 !memcmp(tmp->atm_addr, atm_addr, ATM_ESA_LEN)) { 2044 !memcmp(tmp->atm_addr, atm_addr, ATM_ESA_LEN)) {
2082 /* Vcc to this host exists */ 2045 /* Vcc to this host exists */
@@ -2121,14 +2084,13 @@ lec_vcc_added(struct lec_priv *priv, const struct atmlec_ioc *ioc_data,
2121 int i, found_entry = 0; 2084 int i, found_entry = 0;
2122 2085
2123 spin_lock_irqsave(&priv->lec_arp_lock, flags); 2086 spin_lock_irqsave(&priv->lec_arp_lock, flags);
2087 /* Vcc for Multicast Forward. No timer, LANEv2 7.1.20 and 2.3.5.3 */
2124 if (ioc_data->receive == 2) { 2088 if (ioc_data->receive == 2) {
2125 /* Vcc for Multicast Forward. No timer, LANEv2 7.1.20 and 2.3.5.3 */
2126
2127 pr_debug("LEC_ARP: Attaching mcast forward\n"); 2089 pr_debug("LEC_ARP: Attaching mcast forward\n");
2128#if 0 2090#if 0
2129 entry = lec_arp_find(priv, bus_mac); 2091 entry = lec_arp_find(priv, bus_mac);
2130 if (!entry) { 2092 if (!entry) {
2131 printk("LEC_ARP: Multicast entry not found!\n"); 2093 pr_info("LEC_ARP: Multicast entry not found!\n");
2132 goto out; 2094 goto out;
2133 } 2095 }
2134 memcpy(entry->atm_addr, ioc_data->atm_addr, ATM_ESA_LEN); 2096 memcpy(entry->atm_addr, ioc_data->atm_addr, ATM_ESA_LEN);
@@ -2149,19 +2111,17 @@ lec_vcc_added(struct lec_priv *priv, const struct atmlec_ioc *ioc_data,
2149 * Vcc which we don't want to make default vcc, 2111 * Vcc which we don't want to make default vcc,
2150 * attach it anyway. 2112 * attach it anyway.
2151 */ 2113 */
2152 pr_debug 2114 pr_debug("LEC_ARP:Attaching data direct, not default: %2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x\n",
2153 ("LEC_ARP:Attaching data direct, not default: " 2115 ioc_data->atm_addr[0], ioc_data->atm_addr[1],
2154 "%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x\n", 2116 ioc_data->atm_addr[2], ioc_data->atm_addr[3],
2155 ioc_data->atm_addr[0], ioc_data->atm_addr[1], 2117 ioc_data->atm_addr[4], ioc_data->atm_addr[5],
2156 ioc_data->atm_addr[2], ioc_data->atm_addr[3], 2118 ioc_data->atm_addr[6], ioc_data->atm_addr[7],
2157 ioc_data->atm_addr[4], ioc_data->atm_addr[5], 2119 ioc_data->atm_addr[8], ioc_data->atm_addr[9],
2158 ioc_data->atm_addr[6], ioc_data->atm_addr[7], 2120 ioc_data->atm_addr[10], ioc_data->atm_addr[11],
2159 ioc_data->atm_addr[8], ioc_data->atm_addr[9], 2121 ioc_data->atm_addr[12], ioc_data->atm_addr[13],
2160 ioc_data->atm_addr[10], ioc_data->atm_addr[11], 2122 ioc_data->atm_addr[14], ioc_data->atm_addr[15],
2161 ioc_data->atm_addr[12], ioc_data->atm_addr[13], 2123 ioc_data->atm_addr[16], ioc_data->atm_addr[17],
2162 ioc_data->atm_addr[14], ioc_data->atm_addr[15], 2124 ioc_data->atm_addr[18], ioc_data->atm_addr[19]);
2163 ioc_data->atm_addr[16], ioc_data->atm_addr[17],
2164 ioc_data->atm_addr[18], ioc_data->atm_addr[19]);
2165 entry = make_entry(priv, bus_mac); 2125 entry = make_entry(priv, bus_mac);
2166 if (entry == NULL) 2126 if (entry == NULL)
2167 goto out; 2127 goto out;
@@ -2177,29 +2137,28 @@ lec_vcc_added(struct lec_priv *priv, const struct atmlec_ioc *ioc_data,
2177 dump_arp_table(priv); 2137 dump_arp_table(priv);
2178 goto out; 2138 goto out;
2179 } 2139 }
2180 pr_debug 2140 pr_debug("LEC_ARP:Attaching data direct, default: %2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x\n",
2181 ("LEC_ARP:Attaching data direct, default: " 2141 ioc_data->atm_addr[0], ioc_data->atm_addr[1],
2182 "%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x\n", 2142 ioc_data->atm_addr[2], ioc_data->atm_addr[3],
2183 ioc_data->atm_addr[0], ioc_data->atm_addr[1], 2143 ioc_data->atm_addr[4], ioc_data->atm_addr[5],
2184 ioc_data->atm_addr[2], ioc_data->atm_addr[3], 2144 ioc_data->atm_addr[6], ioc_data->atm_addr[7],
2185 ioc_data->atm_addr[4], ioc_data->atm_addr[5], 2145 ioc_data->atm_addr[8], ioc_data->atm_addr[9],
2186 ioc_data->atm_addr[6], ioc_data->atm_addr[7], 2146 ioc_data->atm_addr[10], ioc_data->atm_addr[11],
2187 ioc_data->atm_addr[8], ioc_data->atm_addr[9], 2147 ioc_data->atm_addr[12], ioc_data->atm_addr[13],
2188 ioc_data->atm_addr[10], ioc_data->atm_addr[11], 2148 ioc_data->atm_addr[14], ioc_data->atm_addr[15],
2189 ioc_data->atm_addr[12], ioc_data->atm_addr[13], 2149 ioc_data->atm_addr[16], ioc_data->atm_addr[17],
2190 ioc_data->atm_addr[14], ioc_data->atm_addr[15], 2150 ioc_data->atm_addr[18], ioc_data->atm_addr[19]);
2191 ioc_data->atm_addr[16], ioc_data->atm_addr[17],
2192 ioc_data->atm_addr[18], ioc_data->atm_addr[19]);
2193 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { 2151 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
2194 hlist_for_each_entry(entry, node, &priv->lec_arp_tables[i], next) { 2152 hlist_for_each_entry(entry, node,
2153 &priv->lec_arp_tables[i], next) {
2195 if (memcmp 2154 if (memcmp
2196 (ioc_data->atm_addr, entry->atm_addr, 2155 (ioc_data->atm_addr, entry->atm_addr,
2197 ATM_ESA_LEN) == 0) { 2156 ATM_ESA_LEN) == 0) {
2198 pr_debug("LEC_ARP: Attaching data direct\n"); 2157 pr_debug("LEC_ARP: Attaching data direct\n");
2199 pr_debug("Currently -> Vcc: %d, Rvcc:%d\n", 2158 pr_debug("Currently -> Vcc: %d, Rvcc:%d\n",
2200 entry->vcc ? entry->vcc->vci : 0, 2159 entry->vcc ? entry->vcc->vci : 0,
2201 entry->recv_vcc ? entry->recv_vcc-> 2160 entry->recv_vcc ? entry->recv_vcc->
2202 vci : 0); 2161 vci : 0);
2203 found_entry = 1; 2162 found_entry = 1;
2204 del_timer(&entry->timer); 2163 del_timer(&entry->timer);
2205 entry->vcc = vcc; 2164 entry->vcc = vcc;
@@ -2271,19 +2230,21 @@ static void lec_flush_complete(struct lec_priv *priv, unsigned long tran_id)
2271 struct lec_arp_table *entry; 2230 struct lec_arp_table *entry;
2272 int i; 2231 int i;
2273 2232
2274 pr_debug("LEC:lec_flush_complete %lx\n", tran_id); 2233 pr_debug("%lx\n", tran_id);
2275restart: 2234restart:
2276 spin_lock_irqsave(&priv->lec_arp_lock, flags); 2235 spin_lock_irqsave(&priv->lec_arp_lock, flags);
2277 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { 2236 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
2278 hlist_for_each_entry(entry, node, &priv->lec_arp_tables[i], next) { 2237 hlist_for_each_entry(entry, node,
2279 if (entry->flush_tran_id == tran_id 2238 &priv->lec_arp_tables[i], next) {
2280 && entry->status == ESI_FLUSH_PENDING) { 2239 if (entry->flush_tran_id == tran_id &&
2240 entry->status == ESI_FLUSH_PENDING) {
2281 struct sk_buff *skb; 2241 struct sk_buff *skb;
2282 struct atm_vcc *vcc = entry->vcc; 2242 struct atm_vcc *vcc = entry->vcc;
2283 2243
2284 lec_arp_hold(entry); 2244 lec_arp_hold(entry);
2285 spin_unlock_irqrestore(&priv->lec_arp_lock, flags); 2245 spin_unlock_irqrestore(&priv->lec_arp_lock,
2286 while ((skb = skb_dequeue(&entry->tx_wait)) != NULL) 2246 flags);
2247 while ((skb = skb_dequeue(&entry->tx_wait)))
2287 lec_send(vcc, skb); 2248 lec_send(vcc, skb);
2288 entry->last_used = jiffies; 2249 entry->last_used = jiffies;
2289 entry->status = ESI_FORWARD_DIRECT; 2250 entry->status = ESI_FORWARD_DIRECT;
@@ -2308,11 +2269,12 @@ lec_set_flush_tran_id(struct lec_priv *priv,
2308 2269
2309 spin_lock_irqsave(&priv->lec_arp_lock, flags); 2270 spin_lock_irqsave(&priv->lec_arp_lock, flags);
2310 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) 2271 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++)
2311 hlist_for_each_entry(entry, node, &priv->lec_arp_tables[i], next) { 2272 hlist_for_each_entry(entry, node,
2273 &priv->lec_arp_tables[i], next) {
2312 if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN)) { 2274 if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN)) {
2313 entry->flush_tran_id = tran_id; 2275 entry->flush_tran_id = tran_id;
2314 pr_debug("Set flush transaction id to %lx for %p\n", 2276 pr_debug("Set flush transaction id to %lx for %p\n",
2315 tran_id, entry); 2277 tran_id, entry);
2316 } 2278 }
2317 } 2279 }
2318 spin_unlock_irqrestore(&priv->lec_arp_lock, flags); 2280 spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
@@ -2328,7 +2290,8 @@ static int lec_mcast_make(struct lec_priv *priv, struct atm_vcc *vcc)
2328 struct lec_vcc_priv *vpriv; 2290 struct lec_vcc_priv *vpriv;
2329 int err = 0; 2291 int err = 0;
2330 2292
2331 if (!(vpriv = kmalloc(sizeof(struct lec_vcc_priv), GFP_KERNEL))) 2293 vpriv = kmalloc(sizeof(struct lec_vcc_priv), GFP_KERNEL);
2294 if (!vpriv)
2332 return -ENOMEM; 2295 return -ENOMEM;
2333 vpriv->xoff = 0; 2296 vpriv->xoff = 0;
2334 vpriv->old_pop = vcc->pop; 2297 vpriv->old_pop = vcc->pop;
@@ -2368,18 +2331,19 @@ static void lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc)
2368 spin_lock_irqsave(&priv->lec_arp_lock, flags); 2331 spin_lock_irqsave(&priv->lec_arp_lock, flags);
2369 2332
2370 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { 2333 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
2371 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_tables[i], next) { 2334 hlist_for_each_entry_safe(entry, node, next,
2335 &priv->lec_arp_tables[i], next) {
2372 if (vcc == entry->vcc) { 2336 if (vcc == entry->vcc) {
2373 lec_arp_remove(priv, entry); 2337 lec_arp_remove(priv, entry);
2374 lec_arp_put(entry); 2338 lec_arp_put(entry);
2375 if (priv->mcast_vcc == vcc) { 2339 if (priv->mcast_vcc == vcc)
2376 priv->mcast_vcc = NULL; 2340 priv->mcast_vcc = NULL;
2377 }
2378 } 2341 }
2379 } 2342 }
2380 } 2343 }
2381 2344
2382 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_empty_ones, next) { 2345 hlist_for_each_entry_safe(entry, node, next,
2346 &priv->lec_arp_empty_ones, next) {
2383 if (entry->vcc == vcc) { 2347 if (entry->vcc == vcc) {
2384 lec_arp_clear_vccs(entry); 2348 lec_arp_clear_vccs(entry);
2385 del_timer(&entry->timer); 2349 del_timer(&entry->timer);
@@ -2388,7 +2352,8 @@ static void lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc)
2388 } 2352 }
2389 } 2353 }
2390 2354
2391 hlist_for_each_entry_safe(entry, node, next, &priv->lec_no_forward, next) { 2355 hlist_for_each_entry_safe(entry, node, next,
2356 &priv->lec_no_forward, next) {
2392 if (entry->recv_vcc == vcc) { 2357 if (entry->recv_vcc == vcc) {
2393 lec_arp_clear_vccs(entry); 2358 lec_arp_clear_vccs(entry);
2394 del_timer(&entry->timer); 2359 del_timer(&entry->timer);
@@ -2429,14 +2394,16 @@ lec_arp_check_empties(struct lec_priv *priv,
2429 src = hdr->h_source; 2394 src = hdr->h_source;
2430 2395
2431 spin_lock_irqsave(&priv->lec_arp_lock, flags); 2396 spin_lock_irqsave(&priv->lec_arp_lock, flags);
2432 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_empty_ones, next) { 2397 hlist_for_each_entry_safe(entry, node, next,
2398 &priv->lec_arp_empty_ones, next) {
2433 if (vcc == entry->vcc) { 2399 if (vcc == entry->vcc) {
2434 del_timer(&entry->timer); 2400 del_timer(&entry->timer);
2435 memcpy(entry->mac_addr, src, ETH_ALEN); 2401 memcpy(entry->mac_addr, src, ETH_ALEN);
2436 entry->status = ESI_FORWARD_DIRECT; 2402 entry->status = ESI_FORWARD_DIRECT;
2437 entry->last_used = jiffies; 2403 entry->last_used = jiffies;
2438 /* We might have got an entry */ 2404 /* We might have got an entry */
2439 if ((tmp = lec_arp_find(priv, src))) { 2405 tmp = lec_arp_find(priv, src);
2406 if (tmp) {
2440 lec_arp_remove(priv, tmp); 2407 lec_arp_remove(priv, tmp);
2441 lec_arp_put(tmp); 2408 lec_arp_put(tmp);
2442 } 2409 }