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