net: convert print_mac to %pM
[deliverable/linux.git] / net / atm / lec.c
1 /*
2 * lec.c: Lan Emulation driver
3 *
4 * Marko Kiiskila <mkiiskila@yahoo.com>
5 */
6
7 #include <linux/kernel.h>
8 #include <linux/bitops.h>
9 #include <linux/capability.h>
10
11 /* We are ethernet device */
12 #include <linux/if_ether.h>
13 #include <linux/netdevice.h>
14 #include <linux/etherdevice.h>
15 #include <net/sock.h>
16 #include <linux/skbuff.h>
17 #include <linux/ip.h>
18 #include <asm/byteorder.h>
19 #include <asm/uaccess.h>
20 #include <net/arp.h>
21 #include <net/dst.h>
22 #include <linux/proc_fs.h>
23 #include <linux/spinlock.h>
24 #include <linux/seq_file.h>
25
26 /* TokenRing if needed */
27 #ifdef CONFIG_TR
28 #include <linux/trdevice.h>
29 #endif
30
31 /* And atm device */
32 #include <linux/atmdev.h>
33 #include <linux/atmlec.h>
34
35 /* Proxy LEC knows about bridging */
36 #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
37 #include <linux/if_bridge.h>
38 #include "../bridge/br_private.h"
39
40 static unsigned char bridge_ula_lec[] = { 0x01, 0x80, 0xc2, 0x00, 0x00 };
41 #endif
42
43 /* Modular too */
44 #include <linux/module.h>
45 #include <linux/init.h>
46
47 #include "lec.h"
48 #include "lec_arpc.h"
49 #include "resources.h"
50
51 #define DUMP_PACKETS 0 /*
52 * 0 = None,
53 * 1 = 30 first bytes
54 * 2 = Whole packet
55 */
56
57 #define LEC_UNRES_QUE_LEN 8 /*
58 * number of tx packets to queue for a
59 * single destination while waiting for SVC
60 */
61
62 static int lec_open(struct net_device *dev);
63 static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev);
64 static int lec_close(struct net_device *dev);
65 static struct net_device_stats *lec_get_stats(struct net_device *dev);
66 static void lec_init(struct net_device *dev);
67 static struct lec_arp_table *lec_arp_find(struct lec_priv *priv,
68 const unsigned char *mac_addr);
69 static int lec_arp_remove(struct lec_priv *priv,
70 struct lec_arp_table *to_remove);
71 /* LANE2 functions */
72 static void lane2_associate_ind(struct net_device *dev, const u8 *mac_address,
73 const u8 *tlvs, u32 sizeoftlvs);
74 static int lane2_resolve(struct net_device *dev, const u8 *dst_mac, int force,
75 u8 **tlvs, u32 *sizeoftlvs);
76 static int lane2_associate_req(struct net_device *dev, const u8 *lan_dst,
77 const u8 *tlvs, u32 sizeoftlvs);
78
79 static int lec_addr_delete(struct lec_priv *priv, const unsigned char *atm_addr,
80 unsigned long permanent);
81 static void lec_arp_check_empties(struct lec_priv *priv,
82 struct atm_vcc *vcc, struct sk_buff *skb);
83 static void lec_arp_destroy(struct lec_priv *priv);
84 static void lec_arp_init(struct lec_priv *priv);
85 static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv,
86 const unsigned char *mac_to_find,
87 int is_rdesc,
88 struct lec_arp_table **ret_entry);
89 static void lec_arp_update(struct lec_priv *priv, const unsigned char *mac_addr,
90 const unsigned char *atm_addr, unsigned long remoteflag,
91 unsigned int targetless_le_arp);
92 static void lec_flush_complete(struct lec_priv *priv, unsigned long tran_id);
93 static int lec_mcast_make(struct lec_priv *priv, struct atm_vcc *vcc);
94 static void lec_set_flush_tran_id(struct lec_priv *priv,
95 const unsigned char *atm_addr,
96 unsigned long tran_id);
97 static void lec_vcc_added(struct lec_priv *priv, const struct atmlec_ioc *ioc_data,
98 struct atm_vcc *vcc,
99 void (*old_push) (struct atm_vcc *vcc,
100 struct sk_buff *skb));
101 static void lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc);
102
103 /* must be done under lec_arp_lock */
104 static inline void lec_arp_hold(struct lec_arp_table *entry)
105 {
106 atomic_inc(&entry->usage);
107 }
108
109 static inline void lec_arp_put(struct lec_arp_table *entry)
110 {
111 if (atomic_dec_and_test(&entry->usage))
112 kfree(entry);
113 }
114
115
116 static struct lane2_ops lane2_ops = {
117 lane2_resolve, /* resolve, spec 3.1.3 */
118 lane2_associate_req, /* associate_req, spec 3.1.4 */
119 NULL /* associate indicator, spec 3.1.5 */
120 };
121
122 static unsigned char bus_mac[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
123
124 /* Device structures */
125 static struct net_device *dev_lec[MAX_LEC_ITF];
126
127 #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
128 static void lec_handle_bridge(struct sk_buff *skb, struct net_device *dev)
129 {
130 struct ethhdr *eth;
131 char *buff;
132 struct lec_priv *priv;
133
134 /*
135 * Check if this is a BPDU. If so, ask zeppelin to send
136 * LE_TOPOLOGY_REQUEST with the same value of Topology Change bit
137 * as the Config BPDU has
138 */
139 eth = (struct ethhdr *)skb->data;
140 buff = skb->data + skb->dev->hard_header_len;
141 if (*buff++ == 0x42 && *buff++ == 0x42 && *buff++ == 0x03) {
142 struct sock *sk;
143 struct sk_buff *skb2;
144 struct atmlec_msg *mesg;
145
146 skb2 = alloc_skb(sizeof(struct atmlec_msg), GFP_ATOMIC);
147 if (skb2 == NULL)
148 return;
149 skb2->len = sizeof(struct atmlec_msg);
150 mesg = (struct atmlec_msg *)skb2->data;
151 mesg->type = l_topology_change;
152 buff += 4;
153 mesg->content.normal.flag = *buff & 0x01; /* 0x01 is topology change */
154
155 priv = (struct lec_priv *)dev->priv;
156 atm_force_charge(priv->lecd, skb2->truesize);
157 sk = sk_atm(priv->lecd);
158 skb_queue_tail(&sk->sk_receive_queue, skb2);
159 sk->sk_data_ready(sk, skb2->len);
160 }
161
162 return;
163 }
164 #endif /* defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) */
165
166 /*
167 * Modelled after tr_type_trans
168 * All multicast and ARE or STE frames go to BUS.
169 * Non source routed frames go by destination address.
170 * Last hop source routed frames go by destination address.
171 * Not last hop source routed frames go by _next_ route descriptor.
172 * Returns pointer to destination MAC address or fills in rdesc
173 * and returns NULL.
174 */
175 #ifdef CONFIG_TR
176 static unsigned char *get_tr_dst(unsigned char *packet, unsigned char *rdesc)
177 {
178 struct trh_hdr *trh;
179 unsigned int riflen, num_rdsc;
180
181 trh = (struct trh_hdr *)packet;
182 if (trh->daddr[0] & (uint8_t) 0x80)
183 return bus_mac; /* multicast */
184
185 if (trh->saddr[0] & TR_RII) {
186 riflen = (ntohs(trh->rcf) & TR_RCF_LEN_MASK) >> 8;
187 if ((ntohs(trh->rcf) >> 13) != 0)
188 return bus_mac; /* ARE or STE */
189 } else
190 return trh->daddr; /* not source routed */
191
192 if (riflen < 6)
193 return trh->daddr; /* last hop, source routed */
194
195 /* riflen is 6 or more, packet has more than one route descriptor */
196 num_rdsc = (riflen / 2) - 1;
197 memset(rdesc, 0, ETH_ALEN);
198 /* offset 4 comes from LAN destination field in LE control frames */
199 if (trh->rcf & htons((uint16_t) TR_RCF_DIR_BIT))
200 memcpy(&rdesc[4], &trh->rseg[num_rdsc - 2], sizeof(__be16));
201 else {
202 memcpy(&rdesc[4], &trh->rseg[1], sizeof(__be16));
203 rdesc[5] = ((ntohs(trh->rseg[0]) & 0x000f) | (rdesc[5] & 0xf0));
204 }
205
206 return NULL;
207 }
208 #endif /* CONFIG_TR */
209
210 /*
211 * Open/initialize the netdevice. This is called (in the current kernel)
212 * sometime after booting when the 'ifconfig' program is run.
213 *
214 * This routine should set everything up anew at each open, even
215 * registers that "should" only need to be set once at boot, so that
216 * there is non-reboot way to recover if something goes wrong.
217 */
218
219 static int lec_open(struct net_device *dev)
220 {
221 struct lec_priv *priv = (struct lec_priv *)dev->priv;
222
223 netif_start_queue(dev);
224 memset(&priv->stats, 0, sizeof(struct net_device_stats));
225
226 return 0;
227 }
228
229 static __inline__ void
230 lec_send(struct atm_vcc *vcc, struct sk_buff *skb, struct lec_priv *priv)
231 {
232 ATM_SKB(skb)->vcc = vcc;
233 ATM_SKB(skb)->atm_options = vcc->atm_options;
234
235 atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);
236 if (vcc->send(vcc, skb) < 0) {
237 priv->stats.tx_dropped++;
238 return;
239 }
240
241 priv->stats.tx_packets++;
242 priv->stats.tx_bytes += skb->len;
243 }
244
245 static void lec_tx_timeout(struct net_device *dev)
246 {
247 printk(KERN_INFO "%s: tx timeout\n", dev->name);
248 dev->trans_start = jiffies;
249 netif_wake_queue(dev);
250 }
251
252 static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev)
253 {
254 struct sk_buff *skb2;
255 struct lec_priv *priv = (struct lec_priv *)dev->priv;
256 struct lecdatahdr_8023 *lec_h;
257 struct atm_vcc *vcc;
258 struct lec_arp_table *entry;
259 unsigned char *dst;
260 int min_frame_size;
261 #ifdef CONFIG_TR
262 unsigned char rdesc[ETH_ALEN]; /* Token Ring route descriptor */
263 #endif
264 int is_rdesc;
265 #if DUMP_PACKETS > 0
266 char buf[300];
267 int i = 0;
268 #endif /* DUMP_PACKETS >0 */
269
270 pr_debug("lec_start_xmit called\n");
271 if (!priv->lecd) {
272 printk("%s:No lecd attached\n", dev->name);
273 priv->stats.tx_errors++;
274 netif_stop_queue(dev);
275 return -EUNATCH;
276 }
277
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),
280 (long)skb_end_pointer(skb));
281 #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
282 if (memcmp(skb->data, bridge_ula_lec, sizeof(bridge_ula_lec)) == 0)
283 lec_handle_bridge(skb, dev);
284 #endif
285
286 /* Make sure we have room for lec_id */
287 if (skb_headroom(skb) < 2) {
288
289 pr_debug("lec_start_xmit: reallocating skb\n");
290 skb2 = skb_realloc_headroom(skb, LEC_HEADER_LEN);
291 kfree_skb(skb);
292 if (skb2 == NULL)
293 return 0;
294 skb = skb2;
295 }
296 skb_push(skb, 2);
297
298 /* Put le header to place, works for TokenRing too */
299 lec_h = (struct lecdatahdr_8023 *)skb->data;
300 lec_h->le_header = htons(priv->lecid);
301
302 #ifdef CONFIG_TR
303 /*
304 * Ugly. Use this to realign Token Ring packets for
305 * e.g. PCA-200E driver.
306 */
307 if (priv->is_trdev) {
308 skb2 = skb_realloc_headroom(skb, LEC_HEADER_LEN);
309 kfree_skb(skb);
310 if (skb2 == NULL)
311 return 0;
312 skb = skb2;
313 }
314 #endif
315
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
320 for (i = 0; i < skb->len && i < 99; i++) {
321 sprintf(buf + i * 3, "%2.2x ", 0xff & skb->data[i]);
322 }
323 #elif DUMP_PACKETS >= 1
324 for (i = 0; i < skb->len && i < 30; i++) {
325 sprintf(buf + i * 3, "%2.2x ", 0xff & skb->data[i]);
326 }
327 #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
334 /* Minimum ethernet-frame size */
335 #ifdef CONFIG_TR
336 if (priv->is_trdev)
337 min_frame_size = LEC_MINIMUM_8025_SIZE;
338 else
339 #endif
340 min_frame_size = LEC_MINIMUM_8023_SIZE;
341 if (skb->len < min_frame_size) {
342 if ((skb->len + skb_tailroom(skb)) < min_frame_size) {
343 skb2 = skb_copy_expand(skb, 0,
344 min_frame_size - skb->truesize,
345 GFP_ATOMIC);
346 dev_kfree_skb(skb);
347 if (skb2 == NULL) {
348 priv->stats.tx_dropped++;
349 return 0;
350 }
351 skb = skb2;
352 }
353 skb_put(skb, min_frame_size - skb->len);
354 }
355
356 /* Send to right vcc */
357 is_rdesc = 0;
358 dst = lec_h->h_dest;
359 #ifdef CONFIG_TR
360 if (priv->is_trdev) {
361 dst = get_tr_dst(skb->data + 2, rdesc);
362 if (dst == NULL) {
363 dst = rdesc;
364 is_rdesc = 1;
365 }
366 }
367 #endif
368 entry = NULL;
369 vcc = lec_arp_resolve(priv, dst, is_rdesc, &entry);
370 pr_debug("%s:vcc:%p vcc_flags:%lx, entry:%p\n", dev->name,
371 vcc, vcc ? vcc->flags : 0, entry);
372 if (!vcc || !test_bit(ATM_VF_READY, &vcc->flags)) {
373 if (entry && (entry->tx_wait.qlen < LEC_UNRES_QUE_LEN)) {
374 pr_debug("%s:lec_start_xmit: queuing packet, ",
375 dev->name);
376 pr_debug("MAC address %pM\n", lec_h->h_dest);
377 skb_queue_tail(&entry->tx_wait, skb);
378 } else {
379 pr_debug
380 ("%s:lec_start_xmit: tx queue full or no arp entry, dropping, ",
381 dev->name);
382 pr_debug("MAC address %pM\n", lec_h->h_dest);
383 priv->stats.tx_dropped++;
384 dev_kfree_skb(skb);
385 }
386 goto out;
387 }
388 #if DUMP_PACKETS > 0
389 printk("%s:sending to vpi:%d vci:%d\n", dev->name, vcc->vpi, vcc->vci);
390 #endif /* DUMP_PACKETS > 0 */
391
392 while (entry && (skb2 = skb_dequeue(&entry->tx_wait))) {
393 pr_debug("lec.c: emptying tx queue, ");
394 pr_debug("MAC address %pM\n", lec_h->h_dest);
395 lec_send(vcc, skb2, priv);
396 }
397
398 lec_send(vcc, skb, priv);
399
400 if (!atm_may_send(vcc, 0)) {
401 struct lec_vcc_priv *vpriv = LEC_VCC_PRIV(vcc);
402
403 vpriv->xoff = 1;
404 netif_stop_queue(dev);
405
406 /*
407 * vcc->pop() might have occurred in between, making
408 * the vcc usuable again. Since xmit is serialized,
409 * this is the only situation we have to re-test.
410 */
411
412 if (atm_may_send(vcc, 0))
413 netif_wake_queue(dev);
414 }
415
416 out:
417 if (entry)
418 lec_arp_put(entry);
419 dev->trans_start = jiffies;
420 return 0;
421 }
422
423 /* The inverse routine to net_open(). */
424 static int lec_close(struct net_device *dev)
425 {
426 netif_stop_queue(dev);
427 return 0;
428 }
429
430 /*
431 * Get the current statistics.
432 * This may be called with the card open or closed.
433 */
434 static struct net_device_stats *lec_get_stats(struct net_device *dev)
435 {
436 return &((struct lec_priv *)dev->priv)->stats;
437 }
438
439 static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
440 {
441 unsigned long flags;
442 struct net_device *dev = (struct net_device *)vcc->proto_data;
443 struct lec_priv *priv = (struct lec_priv *)dev->priv;
444 struct atmlec_msg *mesg;
445 struct lec_arp_table *entry;
446 int i;
447 char *tmp; /* FIXME */
448
449 atomic_sub(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);
450 mesg = (struct atmlec_msg *)skb->data;
451 tmp = skb->data;
452 tmp += sizeof(struct atmlec_msg);
453 pr_debug("%s: msg from zeppelin:%d\n", dev->name, mesg->type);
454 switch (mesg->type) {
455 case l_set_mac_addr:
456 for (i = 0; i < 6; i++) {
457 dev->dev_addr[i] = mesg->content.normal.mac_addr[i];
458 }
459 break;
460 case l_del_mac_addr:
461 for (i = 0; i < 6; i++) {
462 dev->dev_addr[i] = 0;
463 }
464 break;
465 case l_addr_delete:
466 lec_addr_delete(priv, mesg->content.normal.atm_addr,
467 mesg->content.normal.flag);
468 break;
469 case l_topology_change:
470 priv->topology_change = mesg->content.normal.flag;
471 break;
472 case l_flush_complete:
473 lec_flush_complete(priv, mesg->content.normal.flag);
474 break;
475 case l_narp_req: /* LANE2: see 7.1.35 in the lane2 spec */
476 spin_lock_irqsave(&priv->lec_arp_lock, flags);
477 entry = lec_arp_find(priv, mesg->content.normal.mac_addr);
478 lec_arp_remove(priv, entry);
479 spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
480
481 if (mesg->content.normal.no_source_le_narp)
482 break;
483 /* FALL THROUGH */
484 case l_arp_update:
485 lec_arp_update(priv, mesg->content.normal.mac_addr,
486 mesg->content.normal.atm_addr,
487 mesg->content.normal.flag,
488 mesg->content.normal.targetless_le_arp);
489 pr_debug("lec: in l_arp_update\n");
490 if (mesg->sizeoftlvs != 0) { /* LANE2 3.1.5 */
491 pr_debug("lec: LANE2 3.1.5, got tlvs, size %d\n",
492 mesg->sizeoftlvs);
493 lane2_associate_ind(dev, mesg->content.normal.mac_addr,
494 tmp, mesg->sizeoftlvs);
495 }
496 break;
497 case l_config:
498 priv->maximum_unknown_frame_count =
499 mesg->content.config.maximum_unknown_frame_count;
500 priv->max_unknown_frame_time =
501 (mesg->content.config.max_unknown_frame_time * HZ);
502 priv->max_retry_count = mesg->content.config.max_retry_count;
503 priv->aging_time = (mesg->content.config.aging_time * HZ);
504 priv->forward_delay_time =
505 (mesg->content.config.forward_delay_time * HZ);
506 priv->arp_response_time =
507 (mesg->content.config.arp_response_time * HZ);
508 priv->flush_timeout = (mesg->content.config.flush_timeout * HZ);
509 priv->path_switching_delay =
510 (mesg->content.config.path_switching_delay * HZ);
511 priv->lane_version = mesg->content.config.lane_version; /* LANE2 */
512 priv->lane2_ops = NULL;
513 if (priv->lane_version > 1)
514 priv->lane2_ops = &lane2_ops;
515 if (dev->change_mtu(dev, mesg->content.config.mtu))
516 printk("%s: change_mtu to %d failed\n", dev->name,
517 mesg->content.config.mtu);
518 priv->is_proxy = mesg->content.config.is_proxy;
519 break;
520 case l_flush_tran_id:
521 lec_set_flush_tran_id(priv, mesg->content.normal.atm_addr,
522 mesg->content.normal.flag);
523 break;
524 case l_set_lecid:
525 priv->lecid =
526 (unsigned short)(0xffff & mesg->content.normal.flag);
527 break;
528 case l_should_bridge:
529 #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
530 {
531 struct net_bridge_fdb_entry *f;
532
533 pr_debug("%s: bridge zeppelin asks about %pM\n",
534 dev->name, mesg->content.proxy.mac_addr);
535
536 if (br_fdb_get_hook == NULL || dev->br_port == NULL)
537 break;
538
539 f = br_fdb_get_hook(dev->br_port->br,
540 mesg->content.proxy.mac_addr);
541 if (f != NULL && f->dst->dev != dev
542 && f->dst->state == BR_STATE_FORWARDING) {
543 /* hit from bridge table, send LE_ARP_RESPONSE */
544 struct sk_buff *skb2;
545 struct sock *sk;
546
547 pr_debug
548 ("%s: entry found, responding to zeppelin\n",
549 dev->name);
550 skb2 =
551 alloc_skb(sizeof(struct atmlec_msg),
552 GFP_ATOMIC);
553 if (skb2 == NULL) {
554 br_fdb_put_hook(f);
555 break;
556 }
557 skb2->len = sizeof(struct atmlec_msg);
558 skb_copy_to_linear_data(skb2, mesg,
559 sizeof(*mesg));
560 atm_force_charge(priv->lecd, skb2->truesize);
561 sk = sk_atm(priv->lecd);
562 skb_queue_tail(&sk->sk_receive_queue, skb2);
563 sk->sk_data_ready(sk, skb2->len);
564 }
565 if (f != NULL)
566 br_fdb_put_hook(f);
567 }
568 #endif /* defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) */
569 break;
570 default:
571 printk("%s: Unknown message type %d\n", dev->name, mesg->type);
572 dev_kfree_skb(skb);
573 return -EINVAL;
574 }
575 dev_kfree_skb(skb);
576 return 0;
577 }
578
579 static void lec_atm_close(struct atm_vcc *vcc)
580 {
581 struct sk_buff *skb;
582 struct net_device *dev = (struct net_device *)vcc->proto_data;
583 struct lec_priv *priv = (struct lec_priv *)dev->priv;
584
585 priv->lecd = NULL;
586 /* Do something needful? */
587
588 netif_stop_queue(dev);
589 lec_arp_destroy(priv);
590
591 if (skb_peek(&sk_atm(vcc)->sk_receive_queue))
592 printk("%s lec_atm_close: closing with messages pending\n",
593 dev->name);
594 while ((skb = skb_dequeue(&sk_atm(vcc)->sk_receive_queue)) != NULL) {
595 atm_return(vcc, skb->truesize);
596 dev_kfree_skb(skb);
597 }
598
599 printk("%s: Shut down!\n", dev->name);
600 module_put(THIS_MODULE);
601 }
602
603 static struct atmdev_ops lecdev_ops = {
604 .close = lec_atm_close,
605 .send = lec_atm_send
606 };
607
608 static struct atm_dev lecatm_dev = {
609 .ops = &lecdev_ops,
610 .type = "lec",
611 .number = 999, /* dummy device number */
612 .lock = __SPIN_LOCK_UNLOCKED(lecatm_dev.lock)
613 };
614
615 /*
616 * LANE2: new argument struct sk_buff *data contains
617 * the LE_ARP based TLVs introduced in the LANE2 spec
618 */
619 static int
620 send_to_lecd(struct lec_priv *priv, atmlec_msg_type type,
621 const unsigned char *mac_addr, const unsigned char *atm_addr,
622 struct sk_buff *data)
623 {
624 struct sock *sk;
625 struct sk_buff *skb;
626 struct atmlec_msg *mesg;
627
628 if (!priv || !priv->lecd) {
629 return -1;
630 }
631 skb = alloc_skb(sizeof(struct atmlec_msg), GFP_ATOMIC);
632 if (!skb)
633 return -1;
634 skb->len = sizeof(struct atmlec_msg);
635 mesg = (struct atmlec_msg *)skb->data;
636 memset(mesg, 0, sizeof(struct atmlec_msg));
637 mesg->type = type;
638 if (data != NULL)
639 mesg->sizeoftlvs = data->len;
640 if (mac_addr)
641 memcpy(&mesg->content.normal.mac_addr, mac_addr, ETH_ALEN);
642 else
643 mesg->content.normal.targetless_le_arp = 1;
644 if (atm_addr)
645 memcpy(&mesg->content.normal.atm_addr, atm_addr, ATM_ESA_LEN);
646
647 atm_force_charge(priv->lecd, skb->truesize);
648 sk = sk_atm(priv->lecd);
649 skb_queue_tail(&sk->sk_receive_queue, skb);
650 sk->sk_data_ready(sk, skb->len);
651
652 if (data != NULL) {
653 pr_debug("lec: about to send %d bytes of data\n", data->len);
654 atm_force_charge(priv->lecd, data->truesize);
655 skb_queue_tail(&sk->sk_receive_queue, data);
656 sk->sk_data_ready(sk, skb->len);
657 }
658
659 return 0;
660 }
661
662 /* shamelessly stolen from drivers/net/net_init.c */
663 static int lec_change_mtu(struct net_device *dev, int new_mtu)
664 {
665 if ((new_mtu < 68) || (new_mtu > 18190))
666 return -EINVAL;
667 dev->mtu = new_mtu;
668 return 0;
669 }
670
671 static void lec_set_multicast_list(struct net_device *dev)
672 {
673 /*
674 * by default, all multicast frames arrive over the bus.
675 * eventually support selective multicast service
676 */
677 return;
678 }
679
680 static void lec_init(struct net_device *dev)
681 {
682 dev->change_mtu = lec_change_mtu;
683 dev->open = lec_open;
684 dev->stop = lec_close;
685 dev->hard_start_xmit = lec_start_xmit;
686 dev->tx_timeout = lec_tx_timeout;
687
688 dev->get_stats = lec_get_stats;
689 dev->set_multicast_list = lec_set_multicast_list;
690 dev->do_ioctl = NULL;
691 printk("%s: Initialized!\n", dev->name);
692 }
693
694 static const unsigned char lec_ctrl_magic[] = {
695 0xff,
696 0x00,
697 0x01,
698 0x01
699 };
700
701 #define LEC_DATA_DIRECT_8023 2
702 #define LEC_DATA_DIRECT_8025 3
703
704 static int lec_is_data_direct(struct atm_vcc *vcc)
705 {
706 return ((vcc->sap.blli[0].l3.tr9577.snap[4] == LEC_DATA_DIRECT_8023) ||
707 (vcc->sap.blli[0].l3.tr9577.snap[4] == LEC_DATA_DIRECT_8025));
708 }
709
710 static void lec_push(struct atm_vcc *vcc, struct sk_buff *skb)
711 {
712 unsigned long flags;
713 struct net_device *dev = (struct net_device *)vcc->proto_data;
714 struct lec_priv *priv = (struct lec_priv *)dev->priv;
715
716 #if DUMP_PACKETS >0
717 int i = 0;
718 char buf[300];
719
720 printk("%s: lec_push vcc vpi:%d vci:%d\n", dev->name,
721 vcc->vpi, vcc->vci);
722 #endif
723 if (!skb) {
724 pr_debug("%s: null skb\n", dev->name);
725 lec_vcc_close(priv, vcc);
726 return;
727 }
728 #if DUMP_PACKETS > 0
729 printk("%s: rcv datalen:%ld lecid:%4.4x\n", dev->name,
730 skb->len, priv->lecid);
731 #if DUMP_PACKETS >= 2
732 for (i = 0; i < skb->len && i < 99; i++) {
733 sprintf(buf + i * 3, "%2.2x ", 0xff & skb->data[i]);
734 }
735 #elif DUMP_PACKETS >= 1
736 for (i = 0; i < skb->len && i < 30; i++) {
737 sprintf(buf + i * 3, "%2.2x ", 0xff & skb->data[i]);
738 }
739 #endif /* DUMP_PACKETS >= 1 */
740 if (i == skb->len)
741 printk("%s\n", buf);
742 else
743 printk("%s...\n", buf);
744 #endif /* DUMP_PACKETS > 0 */
745 if (memcmp(skb->data, lec_ctrl_magic, 4) == 0) { /* Control frame, to daemon */
746 struct sock *sk = sk_atm(vcc);
747
748 pr_debug("%s: To daemon\n", dev->name);
749 skb_queue_tail(&sk->sk_receive_queue, skb);
750 sk->sk_data_ready(sk, skb->len);
751 } else { /* Data frame, queue to protocol handlers */
752 struct lec_arp_table *entry;
753 unsigned char *src, *dst;
754
755 atm_return(vcc, skb->truesize);
756 if (*(__be16 *) skb->data == htons(priv->lecid) ||
757 !priv->lecd || !(dev->flags & IFF_UP)) {
758 /*
759 * Probably looping back, or if lecd is missing,
760 * lecd has gone down
761 */
762 pr_debug("Ignoring frame...\n");
763 dev_kfree_skb(skb);
764 return;
765 }
766 #ifdef CONFIG_TR
767 if (priv->is_trdev)
768 dst = ((struct lecdatahdr_8025 *)skb->data)->h_dest;
769 else
770 #endif
771 dst = ((struct lecdatahdr_8023 *)skb->data)->h_dest;
772
773 /*
774 * If this is a Data Direct VCC, and the VCC does not match
775 * the LE_ARP cache entry, delete the LE_ARP cache entry.
776 */
777 spin_lock_irqsave(&priv->lec_arp_lock, flags);
778 if (lec_is_data_direct(vcc)) {
779 #ifdef CONFIG_TR
780 if (priv->is_trdev)
781 src =
782 ((struct lecdatahdr_8025 *)skb->data)->
783 h_source;
784 else
785 #endif
786 src =
787 ((struct lecdatahdr_8023 *)skb->data)->
788 h_source;
789 entry = lec_arp_find(priv, src);
790 if (entry && entry->vcc != vcc) {
791 lec_arp_remove(priv, entry);
792 lec_arp_put(entry);
793 }
794 }
795 spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
796
797 if (!(dst[0] & 0x01) && /* Never filter Multi/Broadcast */
798 !priv->is_proxy && /* Proxy wants all the packets */
799 memcmp(dst, dev->dev_addr, dev->addr_len)) {
800 dev_kfree_skb(skb);
801 return;
802 }
803 if (!hlist_empty(&priv->lec_arp_empty_ones)) {
804 lec_arp_check_empties(priv, vcc, skb);
805 }
806 skb_pull(skb, 2); /* skip lec_id */
807 #ifdef CONFIG_TR
808 if (priv->is_trdev)
809 skb->protocol = tr_type_trans(skb, dev);
810 else
811 #endif
812 skb->protocol = eth_type_trans(skb, dev);
813 priv->stats.rx_packets++;
814 priv->stats.rx_bytes += skb->len;
815 memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data));
816 netif_rx(skb);
817 }
818 }
819
820 static void lec_pop(struct atm_vcc *vcc, struct sk_buff *skb)
821 {
822 struct lec_vcc_priv *vpriv = LEC_VCC_PRIV(vcc);
823 struct net_device *dev = skb->dev;
824
825 if (vpriv == NULL) {
826 printk("lec_pop(): vpriv = NULL!?!?!?\n");
827 return;
828 }
829
830 vpriv->old_pop(vcc, skb);
831
832 if (vpriv->xoff && atm_may_send(vcc, 0)) {
833 vpriv->xoff = 0;
834 if (netif_running(dev) && netif_queue_stopped(dev))
835 netif_wake_queue(dev);
836 }
837 }
838
839 static int lec_vcc_attach(struct atm_vcc *vcc, void __user *arg)
840 {
841 struct lec_vcc_priv *vpriv;
842 int bytes_left;
843 struct atmlec_ioc ioc_data;
844
845 /* Lecd must be up in this case */
846 bytes_left = copy_from_user(&ioc_data, arg, sizeof(struct atmlec_ioc));
847 if (bytes_left != 0) {
848 printk
849 ("lec: lec_vcc_attach, copy from user failed for %d bytes\n",
850 bytes_left);
851 }
852 if (ioc_data.dev_num < 0 || ioc_data.dev_num >= MAX_LEC_ITF ||
853 !dev_lec[ioc_data.dev_num])
854 return -EINVAL;
855 if (!(vpriv = kmalloc(sizeof(struct lec_vcc_priv), GFP_KERNEL)))
856 return -ENOMEM;
857 vpriv->xoff = 0;
858 vpriv->old_pop = vcc->pop;
859 vcc->user_back = vpriv;
860 vcc->pop = lec_pop;
861 lec_vcc_added(dev_lec[ioc_data.dev_num]->priv,
862 &ioc_data, vcc, vcc->push);
863 vcc->proto_data = dev_lec[ioc_data.dev_num];
864 vcc->push = lec_push;
865 return 0;
866 }
867
868 static int lec_mcast_attach(struct atm_vcc *vcc, int arg)
869 {
870 if (arg < 0 || arg >= MAX_LEC_ITF || !dev_lec[arg])
871 return -EINVAL;
872 vcc->proto_data = dev_lec[arg];
873 return (lec_mcast_make((struct lec_priv *)dev_lec[arg]->priv, vcc));
874 }
875
876 /* Initialize device. */
877 static int lecd_attach(struct atm_vcc *vcc, int arg)
878 {
879 int i;
880 struct lec_priv *priv;
881
882 if (arg < 0)
883 i = 0;
884 else
885 i = arg;
886 #ifdef CONFIG_TR
887 if (arg >= MAX_LEC_ITF)
888 return -EINVAL;
889 #else /* Reserve the top NUM_TR_DEVS for TR */
890 if (arg >= (MAX_LEC_ITF - NUM_TR_DEVS))
891 return -EINVAL;
892 #endif
893 if (!dev_lec[i]) {
894 int is_trdev, size;
895
896 is_trdev = 0;
897 if (i >= (MAX_LEC_ITF - NUM_TR_DEVS))
898 is_trdev = 1;
899
900 size = sizeof(struct lec_priv);
901 #ifdef CONFIG_TR
902 if (is_trdev)
903 dev_lec[i] = alloc_trdev(size);
904 else
905 #endif
906 dev_lec[i] = alloc_etherdev(size);
907 if (!dev_lec[i])
908 return -ENOMEM;
909 snprintf(dev_lec[i]->name, IFNAMSIZ, "lec%d", i);
910 if (register_netdev(dev_lec[i])) {
911 free_netdev(dev_lec[i]);
912 return -EINVAL;
913 }
914
915 priv = dev_lec[i]->priv;
916 priv->is_trdev = is_trdev;
917 lec_init(dev_lec[i]);
918 } else {
919 priv = dev_lec[i]->priv;
920 if (priv->lecd)
921 return -EADDRINUSE;
922 }
923 lec_arp_init(priv);
924 priv->itfnum = i; /* LANE2 addition */
925 priv->lecd = vcc;
926 vcc->dev = &lecatm_dev;
927 vcc_insert_socket(sk_atm(vcc));
928
929 vcc->proto_data = dev_lec[i];
930 set_bit(ATM_VF_META, &vcc->flags);
931 set_bit(ATM_VF_READY, &vcc->flags);
932
933 /* Set default values to these variables */
934 priv->maximum_unknown_frame_count = 1;
935 priv->max_unknown_frame_time = (1 * HZ);
936 priv->vcc_timeout_period = (1200 * HZ);
937 priv->max_retry_count = 1;
938 priv->aging_time = (300 * HZ);
939 priv->forward_delay_time = (15 * HZ);
940 priv->topology_change = 0;
941 priv->arp_response_time = (1 * HZ);
942 priv->flush_timeout = (4 * HZ);
943 priv->path_switching_delay = (6 * HZ);
944
945 if (dev_lec[i]->flags & IFF_UP) {
946 netif_start_queue(dev_lec[i]);
947 }
948 __module_get(THIS_MODULE);
949 return i;
950 }
951
952 #ifdef CONFIG_PROC_FS
953 static char *lec_arp_get_status_string(unsigned char status)
954 {
955 static char *lec_arp_status_string[] = {
956 "ESI_UNKNOWN ",
957 "ESI_ARP_PENDING ",
958 "ESI_VC_PENDING ",
959 "<Undefined> ",
960 "ESI_FLUSH_PENDING ",
961 "ESI_FORWARD_DIRECT"
962 };
963
964 if (status > ESI_FORWARD_DIRECT)
965 status = 3; /* ESI_UNDEFINED */
966 return lec_arp_status_string[status];
967 }
968
969 static void lec_info(struct seq_file *seq, struct lec_arp_table *entry)
970 {
971 int i;
972
973 for (i = 0; i < ETH_ALEN; i++)
974 seq_printf(seq, "%2.2x", entry->mac_addr[i] & 0xff);
975 seq_printf(seq, " ");
976 for (i = 0; i < ATM_ESA_LEN; i++)
977 seq_printf(seq, "%2.2x", entry->atm_addr[i] & 0xff);
978 seq_printf(seq, " %s %4.4x", lec_arp_get_status_string(entry->status),
979 entry->flags & 0xffff);
980 if (entry->vcc)
981 seq_printf(seq, "%3d %3d ", entry->vcc->vpi, entry->vcc->vci);
982 else
983 seq_printf(seq, " ");
984 if (entry->recv_vcc) {
985 seq_printf(seq, " %3d %3d", entry->recv_vcc->vpi,
986 entry->recv_vcc->vci);
987 }
988 seq_putc(seq, '\n');
989 }
990
991 struct lec_state {
992 unsigned long flags;
993 struct lec_priv *locked;
994 struct hlist_node *node;
995 struct net_device *dev;
996 int itf;
997 int arp_table;
998 int misc_table;
999 };
1000
1001 static void *lec_tbl_walk(struct lec_state *state, struct hlist_head *tbl,
1002 loff_t *l)
1003 {
1004 struct hlist_node *e = state->node;
1005 struct lec_arp_table *tmp;
1006
1007 if (!e)
1008 e = tbl->first;
1009 if (e == SEQ_START_TOKEN) {
1010 e = tbl->first;
1011 --*l;
1012 }
1013
1014 hlist_for_each_entry_from(tmp, e, next) {
1015 if (--*l < 0)
1016 break;
1017 }
1018 state->node = e;
1019
1020 return (*l < 0) ? state : NULL;
1021 }
1022
1023 static void *lec_arp_walk(struct lec_state *state, loff_t *l,
1024 struct lec_priv *priv)
1025 {
1026 void *v = NULL;
1027 int p;
1028
1029 for (p = state->arp_table; p < LEC_ARP_TABLE_SIZE; p++) {
1030 v = lec_tbl_walk(state, &priv->lec_arp_tables[p], l);
1031 if (v)
1032 break;
1033 }
1034 state->arp_table = p;
1035 return v;
1036 }
1037
1038 static void *lec_misc_walk(struct lec_state *state, loff_t *l,
1039 struct lec_priv *priv)
1040 {
1041 struct hlist_head *lec_misc_tables[] = {
1042 &priv->lec_arp_empty_ones,
1043 &priv->lec_no_forward,
1044 &priv->mcast_fwds
1045 };
1046 void *v = NULL;
1047 int q;
1048
1049 for (q = state->misc_table; q < ARRAY_SIZE(lec_misc_tables); q++) {
1050 v = lec_tbl_walk(state, lec_misc_tables[q], l);
1051 if (v)
1052 break;
1053 }
1054 state->misc_table = q;
1055 return v;
1056 }
1057
1058 static void *lec_priv_walk(struct lec_state *state, loff_t *l,
1059 struct lec_priv *priv)
1060 {
1061 if (!state->locked) {
1062 state->locked = priv;
1063 spin_lock_irqsave(&priv->lec_arp_lock, state->flags);
1064 }
1065 if (!lec_arp_walk(state, l, priv) && !lec_misc_walk(state, l, priv)) {
1066 spin_unlock_irqrestore(&priv->lec_arp_lock, state->flags);
1067 state->locked = NULL;
1068 /* Partial state reset for the next time we get called */
1069 state->arp_table = state->misc_table = 0;
1070 }
1071 return state->locked;
1072 }
1073
1074 static void *lec_itf_walk(struct lec_state *state, loff_t *l)
1075 {
1076 struct net_device *dev;
1077 void *v;
1078
1079 dev = state->dev ? state->dev : dev_lec[state->itf];
1080 v = (dev && dev->priv) ? lec_priv_walk(state, l, dev->priv) : NULL;
1081 if (!v && dev) {
1082 dev_put(dev);
1083 /* Partial state reset for the next time we get called */
1084 dev = NULL;
1085 }
1086 state->dev = dev;
1087 return v;
1088 }
1089
1090 static void *lec_get_idx(struct lec_state *state, loff_t l)
1091 {
1092 void *v = NULL;
1093
1094 for (; state->itf < MAX_LEC_ITF; state->itf++) {
1095 v = lec_itf_walk(state, &l);
1096 if (v)
1097 break;
1098 }
1099 return v;
1100 }
1101
1102 static void *lec_seq_start(struct seq_file *seq, loff_t *pos)
1103 {
1104 struct lec_state *state = seq->private;
1105
1106 state->itf = 0;
1107 state->dev = NULL;
1108 state->locked = NULL;
1109 state->arp_table = 0;
1110 state->misc_table = 0;
1111 state->node = SEQ_START_TOKEN;
1112
1113 return *pos ? lec_get_idx(state, *pos) : SEQ_START_TOKEN;
1114 }
1115
1116 static void lec_seq_stop(struct seq_file *seq, void *v)
1117 {
1118 struct lec_state *state = seq->private;
1119
1120 if (state->dev) {
1121 spin_unlock_irqrestore(&state->locked->lec_arp_lock,
1122 state->flags);
1123 dev_put(state->dev);
1124 }
1125 }
1126
1127 static void *lec_seq_next(struct seq_file *seq, void *v, loff_t *pos)
1128 {
1129 struct lec_state *state = seq->private;
1130
1131 v = lec_get_idx(state, 1);
1132 *pos += !!PTR_ERR(v);
1133 return v;
1134 }
1135
1136 static int lec_seq_show(struct seq_file *seq, void *v)
1137 {
1138 static char lec_banner[] = "Itf MAC ATM destination"
1139 " Status Flags "
1140 "VPI/VCI Recv VPI/VCI\n";
1141
1142 if (v == SEQ_START_TOKEN)
1143 seq_puts(seq, lec_banner);
1144 else {
1145 struct lec_state *state = seq->private;
1146 struct net_device *dev = state->dev;
1147 struct lec_arp_table *entry = hlist_entry(state->node, struct lec_arp_table, next);
1148
1149 seq_printf(seq, "%s ", dev->name);
1150 lec_info(seq, entry);
1151 }
1152 return 0;
1153 }
1154
1155 static const struct seq_operations lec_seq_ops = {
1156 .start = lec_seq_start,
1157 .next = lec_seq_next,
1158 .stop = lec_seq_stop,
1159 .show = lec_seq_show,
1160 };
1161
1162 static int lec_seq_open(struct inode *inode, struct file *file)
1163 {
1164 return seq_open_private(file, &lec_seq_ops, sizeof(struct lec_state));
1165 }
1166
1167 static const struct file_operations lec_seq_fops = {
1168 .owner = THIS_MODULE,
1169 .open = lec_seq_open,
1170 .read = seq_read,
1171 .llseek = seq_lseek,
1172 .release = seq_release_private,
1173 };
1174 #endif
1175
1176 static int lane_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1177 {
1178 struct atm_vcc *vcc = ATM_SD(sock);
1179 int err = 0;
1180
1181 switch (cmd) {
1182 case ATMLEC_CTRL:
1183 case ATMLEC_MCAST:
1184 case ATMLEC_DATA:
1185 if (!capable(CAP_NET_ADMIN))
1186 return -EPERM;
1187 break;
1188 default:
1189 return -ENOIOCTLCMD;
1190 }
1191
1192 switch (cmd) {
1193 case ATMLEC_CTRL:
1194 err = lecd_attach(vcc, (int)arg);
1195 if (err >= 0)
1196 sock->state = SS_CONNECTED;
1197 break;
1198 case ATMLEC_MCAST:
1199 err = lec_mcast_attach(vcc, (int)arg);
1200 break;
1201 case ATMLEC_DATA:
1202 err = lec_vcc_attach(vcc, (void __user *)arg);
1203 break;
1204 }
1205
1206 return err;
1207 }
1208
1209 static struct atm_ioctl lane_ioctl_ops = {
1210 .owner = THIS_MODULE,
1211 .ioctl = lane_ioctl,
1212 };
1213
1214 static int __init lane_module_init(void)
1215 {
1216 #ifdef CONFIG_PROC_FS
1217 struct proc_dir_entry *p;
1218
1219 p = proc_create("lec", S_IRUGO, atm_proc_root, &lec_seq_fops);
1220 if (!p) {
1221 printk(KERN_ERR "Unable to initialize /proc/net/atm/lec\n");
1222 return -ENOMEM;
1223 }
1224 #endif
1225
1226 register_atm_ioctl(&lane_ioctl_ops);
1227 printk("lec.c: " __DATE__ " " __TIME__ " initialized\n");
1228 return 0;
1229 }
1230
1231 static void __exit lane_module_cleanup(void)
1232 {
1233 int i;
1234 struct lec_priv *priv;
1235
1236 remove_proc_entry("lec", atm_proc_root);
1237
1238 deregister_atm_ioctl(&lane_ioctl_ops);
1239
1240 for (i = 0; i < MAX_LEC_ITF; i++) {
1241 if (dev_lec[i] != NULL) {
1242 priv = (struct lec_priv *)dev_lec[i]->priv;
1243 unregister_netdev(dev_lec[i]);
1244 free_netdev(dev_lec[i]);
1245 dev_lec[i] = NULL;
1246 }
1247 }
1248
1249 return;
1250 }
1251
1252 module_init(lane_module_init);
1253 module_exit(lane_module_cleanup);
1254
1255 /*
1256 * LANE2: 3.1.3, LE_RESOLVE.request
1257 * Non force allocates memory and fills in *tlvs, fills in *sizeoftlvs.
1258 * If sizeoftlvs == NULL the default TLVs associated with with this
1259 * lec will be used.
1260 * If dst_mac == NULL, targetless LE_ARP will be sent
1261 */
1262 static int lane2_resolve(struct net_device *dev, const u8 *dst_mac, int force,
1263 u8 **tlvs, u32 *sizeoftlvs)
1264 {
1265 unsigned long flags;
1266 struct lec_priv *priv = (struct lec_priv *)dev->priv;
1267 struct lec_arp_table *table;
1268 struct sk_buff *skb;
1269 int retval;
1270
1271 if (force == 0) {
1272 spin_lock_irqsave(&priv->lec_arp_lock, flags);
1273 table = lec_arp_find(priv, dst_mac);
1274 spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
1275 if (table == NULL)
1276 return -1;
1277
1278 *tlvs = kmemdup(table->tlvs, table->sizeoftlvs, GFP_ATOMIC);
1279 if (*tlvs == NULL)
1280 return -1;
1281
1282 *sizeoftlvs = table->sizeoftlvs;
1283
1284 return 0;
1285 }
1286
1287 if (sizeoftlvs == NULL)
1288 retval = send_to_lecd(priv, l_arp_xmt, dst_mac, NULL, NULL);
1289
1290 else {
1291 skb = alloc_skb(*sizeoftlvs, GFP_ATOMIC);
1292 if (skb == NULL)
1293 return -1;
1294 skb->len = *sizeoftlvs;
1295 skb_copy_to_linear_data(skb, *tlvs, *sizeoftlvs);
1296 retval = send_to_lecd(priv, l_arp_xmt, dst_mac, NULL, skb);
1297 }
1298 return retval;
1299 }
1300
1301 /*
1302 * LANE2: 3.1.4, LE_ASSOCIATE.request
1303 * Associate the *tlvs with the *lan_dst address.
1304 * Will overwrite any previous association
1305 * Returns 1 for success, 0 for failure (out of memory)
1306 *
1307 */
1308 static int lane2_associate_req(struct net_device *dev, const u8 *lan_dst,
1309 const u8 *tlvs, u32 sizeoftlvs)
1310 {
1311 int retval;
1312 struct sk_buff *skb;
1313 struct lec_priv *priv = (struct lec_priv *)dev->priv;
1314
1315 if (compare_ether_addr(lan_dst, dev->dev_addr))
1316 return (0); /* not our mac address */
1317
1318 kfree(priv->tlvs); /* NULL if there was no previous association */
1319
1320 priv->tlvs = kmemdup(tlvs, sizeoftlvs, GFP_KERNEL);
1321 if (priv->tlvs == NULL)
1322 return (0);
1323 priv->sizeoftlvs = sizeoftlvs;
1324
1325 skb = alloc_skb(sizeoftlvs, GFP_ATOMIC);
1326 if (skb == NULL)
1327 return 0;
1328 skb->len = sizeoftlvs;
1329 skb_copy_to_linear_data(skb, tlvs, sizeoftlvs);
1330 retval = send_to_lecd(priv, l_associate_req, NULL, NULL, skb);
1331 if (retval != 0)
1332 printk("lec.c: lane2_associate_req() failed\n");
1333 /*
1334 * If the previous association has changed we must
1335 * somehow notify other LANE entities about the change
1336 */
1337 return (1);
1338 }
1339
1340 /*
1341 * LANE2: 3.1.5, LE_ASSOCIATE.indication
1342 *
1343 */
1344 static void lane2_associate_ind(struct net_device *dev, const u8 *mac_addr,
1345 const u8 *tlvs, u32 sizeoftlvs)
1346 {
1347 #if 0
1348 int i = 0;
1349 #endif
1350 struct lec_priv *priv = (struct lec_priv *)dev->priv;
1351 #if 0 /*
1352 * Why have the TLVs in LE_ARP entries
1353 * since we do not use them? When you
1354 * uncomment this code, make sure the
1355 * TLVs get freed when entry is killed
1356 */
1357 struct lec_arp_table *entry = lec_arp_find(priv, mac_addr);
1358
1359 if (entry == NULL)
1360 return; /* should not happen */
1361
1362 kfree(entry->tlvs);
1363
1364 entry->tlvs = kmemdup(tlvs, sizeoftlvs, GFP_KERNEL);
1365 if (entry->tlvs == NULL)
1366 return;
1367 entry->sizeoftlvs = sizeoftlvs;
1368 #endif
1369 #if 0
1370 printk("lec.c: lane2_associate_ind()\n");
1371 printk("dump of tlvs, sizeoftlvs=%d\n", sizeoftlvs);
1372 while (i < sizeoftlvs)
1373 printk("%02x ", tlvs[i++]);
1374
1375 printk("\n");
1376 #endif
1377
1378 /* tell MPOA about the TLVs we saw */
1379 if (priv->lane2_ops && priv->lane2_ops->associate_indicator) {
1380 priv->lane2_ops->associate_indicator(dev, mac_addr,
1381 tlvs, sizeoftlvs);
1382 }
1383 return;
1384 }
1385
1386 /*
1387 * Here starts what used to lec_arpc.c
1388 *
1389 * lec_arpc.c was added here when making
1390 * lane client modular. October 1997
1391 */
1392
1393 #include <linux/types.h>
1394 #include <linux/timer.h>
1395 #include <asm/param.h>
1396 #include <asm/atomic.h>
1397 #include <linux/inetdevice.h>
1398 #include <net/route.h>
1399
1400 #if 0
1401 #define pr_debug(format,args...)
1402 /*
1403 #define pr_debug printk
1404 */
1405 #endif
1406 #define DEBUG_ARP_TABLE 0
1407
1408 #define LEC_ARP_REFRESH_INTERVAL (3*HZ)
1409
1410 static void lec_arp_check_expire(struct work_struct *work);
1411 static void lec_arp_expire_arp(unsigned long data);
1412
1413 /*
1414 * Arp table funcs
1415 */
1416
1417 #define HASH(ch) (ch & (LEC_ARP_TABLE_SIZE -1))
1418
1419 /*
1420 * Initialization of arp-cache
1421 */
1422 static void lec_arp_init(struct lec_priv *priv)
1423 {
1424 unsigned short i;
1425
1426 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
1427 INIT_HLIST_HEAD(&priv->lec_arp_tables[i]);
1428 }
1429 INIT_HLIST_HEAD(&priv->lec_arp_empty_ones);
1430 INIT_HLIST_HEAD(&priv->lec_no_forward);
1431 INIT_HLIST_HEAD(&priv->mcast_fwds);
1432 spin_lock_init(&priv->lec_arp_lock);
1433 INIT_DELAYED_WORK(&priv->lec_arp_work, lec_arp_check_expire);
1434 schedule_delayed_work(&priv->lec_arp_work, LEC_ARP_REFRESH_INTERVAL);
1435 }
1436
1437 static void lec_arp_clear_vccs(struct lec_arp_table *entry)
1438 {
1439 if (entry->vcc) {
1440 struct atm_vcc *vcc = entry->vcc;
1441 struct lec_vcc_priv *vpriv = LEC_VCC_PRIV(vcc);
1442 struct net_device *dev = (struct net_device *)vcc->proto_data;
1443
1444 vcc->pop = vpriv->old_pop;
1445 if (vpriv->xoff)
1446 netif_wake_queue(dev);
1447 kfree(vpriv);
1448 vcc->user_back = NULL;
1449 vcc->push = entry->old_push;
1450 vcc_release_async(vcc, -EPIPE);
1451 entry->vcc = NULL;
1452 }
1453 if (entry->recv_vcc) {
1454 entry->recv_vcc->push = entry->old_recv_push;
1455 vcc_release_async(entry->recv_vcc, -EPIPE);
1456 entry->recv_vcc = NULL;
1457 }
1458 }
1459
1460 /*
1461 * Insert entry to lec_arp_table
1462 * LANE2: Add to the end of the list to satisfy 8.1.13
1463 */
1464 static inline void
1465 lec_arp_add(struct lec_priv *priv, struct lec_arp_table *entry)
1466 {
1467 struct hlist_head *tmp;
1468
1469 tmp = &priv->lec_arp_tables[HASH(entry->mac_addr[ETH_ALEN - 1])];
1470 hlist_add_head(&entry->next, tmp);
1471
1472 pr_debug("LEC_ARP: Added entry:%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n",
1473 0xff & entry->mac_addr[0], 0xff & entry->mac_addr[1],
1474 0xff & entry->mac_addr[2], 0xff & entry->mac_addr[3],
1475 0xff & entry->mac_addr[4], 0xff & entry->mac_addr[5]);
1476 }
1477
1478 /*
1479 * Remove entry from lec_arp_table
1480 */
1481 static int
1482 lec_arp_remove(struct lec_priv *priv, struct lec_arp_table *to_remove)
1483 {
1484 struct hlist_node *node;
1485 struct lec_arp_table *entry;
1486 int i, remove_vcc = 1;
1487
1488 if (!to_remove) {
1489 return -1;
1490 }
1491
1492 hlist_del(&to_remove->next);
1493 del_timer(&to_remove->timer);
1494
1495 /* If this is the only MAC connected to this VCC, also tear down the VCC */
1496 if (to_remove->status >= ESI_FLUSH_PENDING) {
1497 /*
1498 * ESI_FLUSH_PENDING, ESI_FORWARD_DIRECT
1499 */
1500 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
1501 hlist_for_each_entry(entry, node, &priv->lec_arp_tables[i], next) {
1502 if (memcmp(to_remove->atm_addr,
1503 entry->atm_addr, ATM_ESA_LEN) == 0) {
1504 remove_vcc = 0;
1505 break;
1506 }
1507 }
1508 }
1509 if (remove_vcc)
1510 lec_arp_clear_vccs(to_remove);
1511 }
1512 skb_queue_purge(&to_remove->tx_wait); /* FIXME: good place for this? */
1513
1514 pr_debug("LEC_ARP: Removed entry:%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n",
1515 0xff & to_remove->mac_addr[0], 0xff & to_remove->mac_addr[1],
1516 0xff & to_remove->mac_addr[2], 0xff & to_remove->mac_addr[3],
1517 0xff & to_remove->mac_addr[4], 0xff & to_remove->mac_addr[5]);
1518 return 0;
1519 }
1520
1521 #if DEBUG_ARP_TABLE
1522 static char *get_status_string(unsigned char st)
1523 {
1524 switch (st) {
1525 case ESI_UNKNOWN:
1526 return "ESI_UNKNOWN";
1527 case ESI_ARP_PENDING:
1528 return "ESI_ARP_PENDING";
1529 case ESI_VC_PENDING:
1530 return "ESI_VC_PENDING";
1531 case ESI_FLUSH_PENDING:
1532 return "ESI_FLUSH_PENDING";
1533 case ESI_FORWARD_DIRECT:
1534 return "ESI_FORWARD_DIRECT";
1535 default:
1536 return "<UNKNOWN>";
1537 }
1538 }
1539
1540 static void dump_arp_table(struct lec_priv *priv)
1541 {
1542 struct hlist_node *node;
1543 struct lec_arp_table *rulla;
1544 char buf[256];
1545 int i, j, offset;
1546
1547 printk("Dump %p:\n", priv);
1548 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
1549 hlist_for_each_entry(rulla, node, &priv->lec_arp_tables[i], next) {
1550 offset = 0;
1551 offset += sprintf(buf, "%d: %p\n", i, rulla);
1552 offset += sprintf(buf + offset, "Mac:");
1553 for (j = 0; j < ETH_ALEN; j++) {
1554 offset += sprintf(buf + offset,
1555 "%2.2x ",
1556 rulla->mac_addr[j] & 0xff);
1557 }
1558 offset += sprintf(buf + offset, "Atm:");
1559 for (j = 0; j < ATM_ESA_LEN; j++) {
1560 offset += sprintf(buf + offset,
1561 "%2.2x ",
1562 rulla->atm_addr[j] & 0xff);
1563 }
1564 offset += sprintf(buf + offset,
1565 "Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ",
1566 rulla->vcc ? rulla->vcc->vpi : 0,
1567 rulla->vcc ? rulla->vcc->vci : 0,
1568 rulla->recv_vcc ? rulla->recv_vcc->
1569 vpi : 0,
1570 rulla->recv_vcc ? rulla->recv_vcc->
1571 vci : 0, rulla->last_used,
1572 rulla->timestamp, rulla->no_tries);
1573 offset +=
1574 sprintf(buf + offset,
1575 "Flags:%x, Packets_flooded:%x, Status: %s ",
1576 rulla->flags, rulla->packets_flooded,
1577 get_status_string(rulla->status));
1578 printk("%s\n", buf);
1579 }
1580 }
1581
1582 if (!hlist_empty(&priv->lec_no_forward))
1583 printk("No forward\n");
1584 hlist_for_each_entry(rulla, node, &priv->lec_no_forward, next) {
1585 offset = 0;
1586 offset += sprintf(buf + offset, "Mac:");
1587 for (j = 0; j < ETH_ALEN; j++) {
1588 offset += sprintf(buf + offset, "%2.2x ",
1589 rulla->mac_addr[j] & 0xff);
1590 }
1591 offset += sprintf(buf + offset, "Atm:");
1592 for (j = 0; j < ATM_ESA_LEN; j++) {
1593 offset += sprintf(buf + offset, "%2.2x ",
1594 rulla->atm_addr[j] & 0xff);
1595 }
1596 offset += sprintf(buf + offset,
1597 "Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ",
1598 rulla->vcc ? rulla->vcc->vpi : 0,
1599 rulla->vcc ? rulla->vcc->vci : 0,
1600 rulla->recv_vcc ? rulla->recv_vcc->vpi : 0,
1601 rulla->recv_vcc ? rulla->recv_vcc->vci : 0,
1602 rulla->last_used,
1603 rulla->timestamp, rulla->no_tries);
1604 offset += sprintf(buf + offset,
1605 "Flags:%x, Packets_flooded:%x, Status: %s ",
1606 rulla->flags, rulla->packets_flooded,
1607 get_status_string(rulla->status));
1608 printk("%s\n", buf);
1609 }
1610
1611 if (!hlist_empty(&priv->lec_arp_empty_ones))
1612 printk("Empty ones\n");
1613 hlist_for_each_entry(rulla, node, &priv->lec_arp_empty_ones, next) {
1614 offset = 0;
1615 offset += sprintf(buf + offset, "Mac:");
1616 for (j = 0; j < ETH_ALEN; j++) {
1617 offset += sprintf(buf + offset, "%2.2x ",
1618 rulla->mac_addr[j] & 0xff);
1619 }
1620 offset += sprintf(buf + offset, "Atm:");
1621 for (j = 0; j < ATM_ESA_LEN; j++) {
1622 offset += sprintf(buf + offset, "%2.2x ",
1623 rulla->atm_addr[j] & 0xff);
1624 }
1625 offset += sprintf(buf + offset,
1626 "Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ",
1627 rulla->vcc ? rulla->vcc->vpi : 0,
1628 rulla->vcc ? rulla->vcc->vci : 0,
1629 rulla->recv_vcc ? rulla->recv_vcc->vpi : 0,
1630 rulla->recv_vcc ? rulla->recv_vcc->vci : 0,
1631 rulla->last_used,
1632 rulla->timestamp, rulla->no_tries);
1633 offset += sprintf(buf + offset,
1634 "Flags:%x, Packets_flooded:%x, Status: %s ",
1635 rulla->flags, rulla->packets_flooded,
1636 get_status_string(rulla->status));
1637 printk("%s", buf);
1638 }
1639
1640 if (!hlist_empty(&priv->mcast_fwds))
1641 printk("Multicast Forward VCCs\n");
1642 hlist_for_each_entry(rulla, node, &priv->mcast_fwds, next) {
1643 offset = 0;
1644 offset += sprintf(buf + offset, "Mac:");
1645 for (j = 0; j < ETH_ALEN; j++) {
1646 offset += sprintf(buf + offset, "%2.2x ",
1647 rulla->mac_addr[j] & 0xff);
1648 }
1649 offset += sprintf(buf + offset, "Atm:");
1650 for (j = 0; j < ATM_ESA_LEN; j++) {
1651 offset += sprintf(buf + offset, "%2.2x ",
1652 rulla->atm_addr[j] & 0xff);
1653 }
1654 offset += sprintf(buf + offset,
1655 "Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ",
1656 rulla->vcc ? rulla->vcc->vpi : 0,
1657 rulla->vcc ? rulla->vcc->vci : 0,
1658 rulla->recv_vcc ? rulla->recv_vcc->vpi : 0,
1659 rulla->recv_vcc ? rulla->recv_vcc->vci : 0,
1660 rulla->last_used,
1661 rulla->timestamp, rulla->no_tries);
1662 offset += sprintf(buf + offset,
1663 "Flags:%x, Packets_flooded:%x, Status: %s ",
1664 rulla->flags, rulla->packets_flooded,
1665 get_status_string(rulla->status));
1666 printk("%s\n", buf);
1667 }
1668
1669 }
1670 #else
1671 #define dump_arp_table(priv) do { } while (0)
1672 #endif
1673
1674 /*
1675 * Destruction of arp-cache
1676 */
1677 static void lec_arp_destroy(struct lec_priv *priv)
1678 {
1679 unsigned long flags;
1680 struct hlist_node *node, *next;
1681 struct lec_arp_table *entry;
1682 int i;
1683
1684 cancel_rearming_delayed_work(&priv->lec_arp_work);
1685
1686 /*
1687 * Remove all entries
1688 */
1689
1690 spin_lock_irqsave(&priv->lec_arp_lock, flags);
1691 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
1692 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_tables[i], next) {
1693 lec_arp_remove(priv, entry);
1694 lec_arp_put(entry);
1695 }
1696 INIT_HLIST_HEAD(&priv->lec_arp_tables[i]);
1697 }
1698
1699 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_empty_ones, next) {
1700 del_timer_sync(&entry->timer);
1701 lec_arp_clear_vccs(entry);
1702 hlist_del(&entry->next);
1703 lec_arp_put(entry);
1704 }
1705 INIT_HLIST_HEAD(&priv->lec_arp_empty_ones);
1706
1707 hlist_for_each_entry_safe(entry, node, next, &priv->lec_no_forward, next) {
1708 del_timer_sync(&entry->timer);
1709 lec_arp_clear_vccs(entry);
1710 hlist_del(&entry->next);
1711 lec_arp_put(entry);
1712 }
1713 INIT_HLIST_HEAD(&priv->lec_no_forward);
1714
1715 hlist_for_each_entry_safe(entry, node, next, &priv->mcast_fwds, next) {
1716 /* No timer, LANEv2 7.1.20 and 2.3.5.3 */
1717 lec_arp_clear_vccs(entry);
1718 hlist_del(&entry->next);
1719 lec_arp_put(entry);
1720 }
1721 INIT_HLIST_HEAD(&priv->mcast_fwds);
1722 priv->mcast_vcc = NULL;
1723 spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
1724 }
1725
1726 /*
1727 * Find entry by mac_address
1728 */
1729 static struct lec_arp_table *lec_arp_find(struct lec_priv *priv,
1730 const unsigned char *mac_addr)
1731 {
1732 struct hlist_node *node;
1733 struct hlist_head *head;
1734 struct lec_arp_table *entry;
1735
1736 pr_debug("LEC_ARP: lec_arp_find :%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n",
1737 mac_addr[0] & 0xff, mac_addr[1] & 0xff, mac_addr[2] & 0xff,
1738 mac_addr[3] & 0xff, mac_addr[4] & 0xff, mac_addr[5] & 0xff);
1739
1740 head = &priv->lec_arp_tables[HASH(mac_addr[ETH_ALEN - 1])];
1741 hlist_for_each_entry(entry, node, head, next) {
1742 if (!compare_ether_addr(mac_addr, entry->mac_addr)) {
1743 return entry;
1744 }
1745 }
1746 return NULL;
1747 }
1748
1749 static struct lec_arp_table *make_entry(struct lec_priv *priv,
1750 const unsigned char *mac_addr)
1751 {
1752 struct lec_arp_table *to_return;
1753
1754 to_return = kzalloc(sizeof(struct lec_arp_table), GFP_ATOMIC);
1755 if (!to_return) {
1756 printk("LEC: Arp entry kmalloc failed\n");
1757 return NULL;
1758 }
1759 memcpy(to_return->mac_addr, mac_addr, ETH_ALEN);
1760 INIT_HLIST_NODE(&to_return->next);
1761 setup_timer(&to_return->timer, lec_arp_expire_arp,
1762 (unsigned long)to_return);
1763 to_return->last_used = jiffies;
1764 to_return->priv = priv;
1765 skb_queue_head_init(&to_return->tx_wait);
1766 atomic_set(&to_return->usage, 1);
1767 return to_return;
1768 }
1769
1770 /* Arp sent timer expired */
1771 static void lec_arp_expire_arp(unsigned long data)
1772 {
1773 struct lec_arp_table *entry;
1774
1775 entry = (struct lec_arp_table *)data;
1776
1777 pr_debug("lec_arp_expire_arp\n");
1778 if (entry->status == ESI_ARP_PENDING) {
1779 if (entry->no_tries <= entry->priv->max_retry_count) {
1780 if (entry->is_rdesc)
1781 send_to_lecd(entry->priv, l_rdesc_arp_xmt,
1782 entry->mac_addr, NULL, NULL);
1783 else
1784 send_to_lecd(entry->priv, l_arp_xmt,
1785 entry->mac_addr, NULL, NULL);
1786 entry->no_tries++;
1787 }
1788 mod_timer(&entry->timer, jiffies + (1 * HZ));
1789 }
1790 }
1791
1792 /* Unknown/unused vcc expire, remove associated entry */
1793 static void lec_arp_expire_vcc(unsigned long data)
1794 {
1795 unsigned long flags;
1796 struct lec_arp_table *to_remove = (struct lec_arp_table *)data;
1797 struct lec_priv *priv = (struct lec_priv *)to_remove->priv;
1798
1799 del_timer(&to_remove->timer);
1800
1801 pr_debug("LEC_ARP %p %p: lec_arp_expire_vcc vpi:%d vci:%d\n",
1802 to_remove, priv,
1803 to_remove->vcc ? to_remove->recv_vcc->vpi : 0,
1804 to_remove->vcc ? to_remove->recv_vcc->vci : 0);
1805
1806 spin_lock_irqsave(&priv->lec_arp_lock, flags);
1807 hlist_del(&to_remove->next);
1808 spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
1809
1810 lec_arp_clear_vccs(to_remove);
1811 lec_arp_put(to_remove);
1812 }
1813
1814 /*
1815 * Expire entries.
1816 * 1. Re-set timer
1817 * 2. For each entry, delete entries that have aged past the age limit.
1818 * 3. For each entry, depending on the status of the entry, perform
1819 * the following maintenance.
1820 * a. If status is ESI_VC_PENDING or ESI_ARP_PENDING then if the
1821 * tick_count is above the max_unknown_frame_time, clear
1822 * the tick_count to zero and clear the packets_flooded counter
1823 * to zero. This supports the packet rate limit per address
1824 * while flooding unknowns.
1825 * b. If the status is ESI_FLUSH_PENDING and the tick_count is greater
1826 * than or equal to the path_switching_delay, change the status
1827 * to ESI_FORWARD_DIRECT. This causes the flush period to end
1828 * regardless of the progress of the flush protocol.
1829 */
1830 static void lec_arp_check_expire(struct work_struct *work)
1831 {
1832 unsigned long flags;
1833 struct lec_priv *priv =
1834 container_of(work, struct lec_priv, lec_arp_work.work);
1835 struct hlist_node *node, *next;
1836 struct lec_arp_table *entry;
1837 unsigned long now;
1838 unsigned long time_to_check;
1839 int i;
1840
1841 pr_debug("lec_arp_check_expire %p\n", priv);
1842 now = jiffies;
1843 restart:
1844 spin_lock_irqsave(&priv->lec_arp_lock, flags);
1845 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
1846 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_tables[i], next) {
1847 if ((entry->flags) & LEC_REMOTE_FLAG &&
1848 priv->topology_change)
1849 time_to_check = priv->forward_delay_time;
1850 else
1851 time_to_check = priv->aging_time;
1852
1853 pr_debug("About to expire: %lx - %lx > %lx\n",
1854 now, entry->last_used, time_to_check);
1855 if (time_after(now, entry->last_used + time_to_check)
1856 && !(entry->flags & LEC_PERMANENT_FLAG)
1857 && !(entry->mac_addr[0] & 0x01)) { /* LANE2: 7.1.20 */
1858 /* Remove entry */
1859 pr_debug("LEC:Entry timed out\n");
1860 lec_arp_remove(priv, entry);
1861 lec_arp_put(entry);
1862 } else {
1863 /* Something else */
1864 if ((entry->status == ESI_VC_PENDING ||
1865 entry->status == ESI_ARP_PENDING)
1866 && time_after_eq(now,
1867 entry->timestamp +
1868 priv->
1869 max_unknown_frame_time)) {
1870 entry->timestamp = jiffies;
1871 entry->packets_flooded = 0;
1872 if (entry->status == ESI_VC_PENDING)
1873 send_to_lecd(priv, l_svc_setup,
1874 entry->mac_addr,
1875 entry->atm_addr,
1876 NULL);
1877 }
1878 if (entry->status == ESI_FLUSH_PENDING
1879 &&
1880 time_after_eq(now, entry->timestamp +
1881 priv->path_switching_delay)) {
1882 struct sk_buff *skb;
1883 struct atm_vcc *vcc = entry->vcc;
1884
1885 lec_arp_hold(entry);
1886 spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
1887 while ((skb = skb_dequeue(&entry->tx_wait)) != NULL)
1888 lec_send(vcc, skb, entry->priv);
1889 entry->last_used = jiffies;
1890 entry->status = ESI_FORWARD_DIRECT;
1891 lec_arp_put(entry);
1892 goto restart;
1893 }
1894 }
1895 }
1896 }
1897 spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
1898
1899 schedule_delayed_work(&priv->lec_arp_work, LEC_ARP_REFRESH_INTERVAL);
1900 }
1901
1902 /*
1903 * Try to find vcc where mac_address is attached.
1904 *
1905 */
1906 static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv,
1907 const unsigned char *mac_to_find, int is_rdesc,
1908 struct lec_arp_table **ret_entry)
1909 {
1910 unsigned long flags;
1911 struct lec_arp_table *entry;
1912 struct atm_vcc *found;
1913
1914 if (mac_to_find[0] & 0x01) {
1915 switch (priv->lane_version) {
1916 case 1:
1917 return priv->mcast_vcc;
1918 case 2: /* LANE2 wants arp for multicast addresses */
1919 if (!compare_ether_addr(mac_to_find, bus_mac))
1920 return priv->mcast_vcc;
1921 break;
1922 default:
1923 break;
1924 }
1925 }
1926
1927 spin_lock_irqsave(&priv->lec_arp_lock, flags);
1928 entry = lec_arp_find(priv, mac_to_find);
1929
1930 if (entry) {
1931 if (entry->status == ESI_FORWARD_DIRECT) {
1932 /* Connection Ok */
1933 entry->last_used = jiffies;
1934 lec_arp_hold(entry);
1935 *ret_entry = entry;
1936 found = entry->vcc;
1937 goto out;
1938 }
1939 /*
1940 * If the LE_ARP cache entry is still pending, reset count to 0
1941 * so another LE_ARP request can be made for this frame.
1942 */
1943 if (entry->status == ESI_ARP_PENDING) {
1944 entry->no_tries = 0;
1945 }
1946 /*
1947 * Data direct VC not yet set up, check to see if the unknown
1948 * frame count is greater than the limit. If the limit has
1949 * not been reached, allow the caller to send packet to
1950 * BUS.
1951 */
1952 if (entry->status != ESI_FLUSH_PENDING &&
1953 entry->packets_flooded <
1954 priv->maximum_unknown_frame_count) {
1955 entry->packets_flooded++;
1956 pr_debug("LEC_ARP: Flooding..\n");
1957 found = priv->mcast_vcc;
1958 goto out;
1959 }
1960 /*
1961 * We got here because entry->status == ESI_FLUSH_PENDING
1962 * or BUS flood limit was reached for an entry which is
1963 * in ESI_ARP_PENDING or ESI_VC_PENDING state.
1964 */
1965 lec_arp_hold(entry);
1966 *ret_entry = entry;
1967 pr_debug("lec: entry->status %d entry->vcc %p\n", entry->status,
1968 entry->vcc);
1969 found = NULL;
1970 } else {
1971 /* No matching entry was found */
1972 entry = make_entry(priv, mac_to_find);
1973 pr_debug("LEC_ARP: Making entry\n");
1974 if (!entry) {
1975 found = priv->mcast_vcc;
1976 goto out;
1977 }
1978 lec_arp_add(priv, entry);
1979 /* We want arp-request(s) to be sent */
1980 entry->packets_flooded = 1;
1981 entry->status = ESI_ARP_PENDING;
1982 entry->no_tries = 1;
1983 entry->last_used = entry->timestamp = jiffies;
1984 entry->is_rdesc = is_rdesc;
1985 if (entry->is_rdesc)
1986 send_to_lecd(priv, l_rdesc_arp_xmt, mac_to_find, NULL,
1987 NULL);
1988 else
1989 send_to_lecd(priv, l_arp_xmt, mac_to_find, NULL, NULL);
1990 entry->timer.expires = jiffies + (1 * HZ);
1991 entry->timer.function = lec_arp_expire_arp;
1992 add_timer(&entry->timer);
1993 found = priv->mcast_vcc;
1994 }
1995
1996 out:
1997 spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
1998 return found;
1999 }
2000
2001 static int
2002 lec_addr_delete(struct lec_priv *priv, const unsigned char *atm_addr,
2003 unsigned long permanent)
2004 {
2005 unsigned long flags;
2006 struct hlist_node *node, *next;
2007 struct lec_arp_table *entry;
2008 int i;
2009
2010 pr_debug("lec_addr_delete\n");
2011 spin_lock_irqsave(&priv->lec_arp_lock, flags);
2012 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
2013 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_tables[i], next) {
2014 if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN)
2015 && (permanent ||
2016 !(entry->flags & LEC_PERMANENT_FLAG))) {
2017 lec_arp_remove(priv, entry);
2018 lec_arp_put(entry);
2019 }
2020 spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
2021 return 0;
2022 }
2023 }
2024 spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
2025 return -1;
2026 }
2027
2028 /*
2029 * Notifies: Response to arp_request (atm_addr != NULL)
2030 */
2031 static void
2032 lec_arp_update(struct lec_priv *priv, const unsigned char *mac_addr,
2033 const unsigned char *atm_addr, unsigned long remoteflag,
2034 unsigned int targetless_le_arp)
2035 {
2036 unsigned long flags;
2037 struct hlist_node *node, *next;
2038 struct lec_arp_table *entry, *tmp;
2039 int i;
2040
2041 pr_debug("lec:%s", (targetless_le_arp) ? "targetless " : " ");
2042 pr_debug("lec_arp_update mac:%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x\n",
2043 mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3],
2044 mac_addr[4], mac_addr[5]);
2045
2046 spin_lock_irqsave(&priv->lec_arp_lock, flags);
2047 entry = lec_arp_find(priv, mac_addr);
2048 if (entry == NULL && targetless_le_arp)
2049 goto out; /*
2050 * LANE2: ignore targetless LE_ARPs for which
2051 * we have no entry in the cache. 7.1.30
2052 */
2053 if (!hlist_empty(&priv->lec_arp_empty_ones)) {
2054 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_empty_ones, next) {
2055 if (memcmp(entry->atm_addr, atm_addr, ATM_ESA_LEN) == 0) {
2056 hlist_del(&entry->next);
2057 del_timer(&entry->timer);
2058 tmp = lec_arp_find(priv, mac_addr);
2059 if (tmp) {
2060 del_timer(&tmp->timer);
2061 tmp->status = ESI_FORWARD_DIRECT;
2062 memcpy(tmp->atm_addr, atm_addr, ATM_ESA_LEN);
2063 tmp->vcc = entry->vcc;
2064 tmp->old_push = entry->old_push;
2065 tmp->last_used = jiffies;
2066 del_timer(&entry->timer);
2067 lec_arp_put(entry);
2068 entry = tmp;
2069 } else {
2070 entry->status = ESI_FORWARD_DIRECT;
2071 memcpy(entry->mac_addr, mac_addr, ETH_ALEN);
2072 entry->last_used = jiffies;
2073 lec_arp_add(priv, entry);
2074 }
2075 if (remoteflag)
2076 entry->flags |= LEC_REMOTE_FLAG;
2077 else
2078 entry->flags &= ~LEC_REMOTE_FLAG;
2079 pr_debug("After update\n");
2080 dump_arp_table(priv);
2081 goto out;
2082 }
2083 }
2084 }
2085
2086 entry = lec_arp_find(priv, mac_addr);
2087 if (!entry) {
2088 entry = make_entry(priv, mac_addr);
2089 if (!entry)
2090 goto out;
2091 entry->status = ESI_UNKNOWN;
2092 lec_arp_add(priv, entry);
2093 /* Temporary, changes before end of function */
2094 }
2095 memcpy(entry->atm_addr, atm_addr, ATM_ESA_LEN);
2096 del_timer(&entry->timer);
2097 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
2098 hlist_for_each_entry(tmp, node, &priv->lec_arp_tables[i], next) {
2099 if (entry != tmp &&
2100 !memcmp(tmp->atm_addr, atm_addr, ATM_ESA_LEN)) {
2101 /* Vcc to this host exists */
2102 if (tmp->status > ESI_VC_PENDING) {
2103 /*
2104 * ESI_FLUSH_PENDING,
2105 * ESI_FORWARD_DIRECT
2106 */
2107 entry->vcc = tmp->vcc;
2108 entry->old_push = tmp->old_push;
2109 }
2110 entry->status = tmp->status;
2111 break;
2112 }
2113 }
2114 }
2115 if (remoteflag)
2116 entry->flags |= LEC_REMOTE_FLAG;
2117 else
2118 entry->flags &= ~LEC_REMOTE_FLAG;
2119 if (entry->status == ESI_ARP_PENDING || entry->status == ESI_UNKNOWN) {
2120 entry->status = ESI_VC_PENDING;
2121 send_to_lecd(priv, l_svc_setup, entry->mac_addr, atm_addr, NULL);
2122 }
2123 pr_debug("After update2\n");
2124 dump_arp_table(priv);
2125 out:
2126 spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
2127 }
2128
2129 /*
2130 * Notifies: Vcc setup ready
2131 */
2132 static void
2133 lec_vcc_added(struct lec_priv *priv, const struct atmlec_ioc *ioc_data,
2134 struct atm_vcc *vcc,
2135 void (*old_push) (struct atm_vcc *vcc, struct sk_buff *skb))
2136 {
2137 unsigned long flags;
2138 struct hlist_node *node;
2139 struct lec_arp_table *entry;
2140 int i, found_entry = 0;
2141
2142 spin_lock_irqsave(&priv->lec_arp_lock, flags);
2143 if (ioc_data->receive == 2) {
2144 /* Vcc for Multicast Forward. No timer, LANEv2 7.1.20 and 2.3.5.3 */
2145
2146 pr_debug("LEC_ARP: Attaching mcast forward\n");
2147 #if 0
2148 entry = lec_arp_find(priv, bus_mac);
2149 if (!entry) {
2150 printk("LEC_ARP: Multicast entry not found!\n");
2151 goto out;
2152 }
2153 memcpy(entry->atm_addr, ioc_data->atm_addr, ATM_ESA_LEN);
2154 entry->recv_vcc = vcc;
2155 entry->old_recv_push = old_push;
2156 #endif
2157 entry = make_entry(priv, bus_mac);
2158 if (entry == NULL)
2159 goto out;
2160 del_timer(&entry->timer);
2161 memcpy(entry->atm_addr, ioc_data->atm_addr, ATM_ESA_LEN);
2162 entry->recv_vcc = vcc;
2163 entry->old_recv_push = old_push;
2164 hlist_add_head(&entry->next, &priv->mcast_fwds);
2165 goto out;
2166 } else if (ioc_data->receive == 1) {
2167 /*
2168 * Vcc which we don't want to make default vcc,
2169 * attach it anyway.
2170 */
2171 pr_debug
2172 ("LEC_ARP:Attaching data direct, not default: "
2173 "%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",
2174 ioc_data->atm_addr[0], ioc_data->atm_addr[1],
2175 ioc_data->atm_addr[2], ioc_data->atm_addr[3],
2176 ioc_data->atm_addr[4], ioc_data->atm_addr[5],
2177 ioc_data->atm_addr[6], ioc_data->atm_addr[7],
2178 ioc_data->atm_addr[8], ioc_data->atm_addr[9],
2179 ioc_data->atm_addr[10], ioc_data->atm_addr[11],
2180 ioc_data->atm_addr[12], ioc_data->atm_addr[13],
2181 ioc_data->atm_addr[14], ioc_data->atm_addr[15],
2182 ioc_data->atm_addr[16], ioc_data->atm_addr[17],
2183 ioc_data->atm_addr[18], ioc_data->atm_addr[19]);
2184 entry = make_entry(priv, bus_mac);
2185 if (entry == NULL)
2186 goto out;
2187 memcpy(entry->atm_addr, ioc_data->atm_addr, ATM_ESA_LEN);
2188 memset(entry->mac_addr, 0, ETH_ALEN);
2189 entry->recv_vcc = vcc;
2190 entry->old_recv_push = old_push;
2191 entry->status = ESI_UNKNOWN;
2192 entry->timer.expires = jiffies + priv->vcc_timeout_period;
2193 entry->timer.function = lec_arp_expire_vcc;
2194 hlist_add_head(&entry->next, &priv->lec_no_forward);
2195 add_timer(&entry->timer);
2196 dump_arp_table(priv);
2197 goto out;
2198 }
2199 pr_debug
2200 ("LEC_ARP:Attaching data direct, default: "
2201 "%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",
2202 ioc_data->atm_addr[0], ioc_data->atm_addr[1],
2203 ioc_data->atm_addr[2], ioc_data->atm_addr[3],
2204 ioc_data->atm_addr[4], ioc_data->atm_addr[5],
2205 ioc_data->atm_addr[6], ioc_data->atm_addr[7],
2206 ioc_data->atm_addr[8], ioc_data->atm_addr[9],
2207 ioc_data->atm_addr[10], ioc_data->atm_addr[11],
2208 ioc_data->atm_addr[12], ioc_data->atm_addr[13],
2209 ioc_data->atm_addr[14], ioc_data->atm_addr[15],
2210 ioc_data->atm_addr[16], ioc_data->atm_addr[17],
2211 ioc_data->atm_addr[18], ioc_data->atm_addr[19]);
2212 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
2213 hlist_for_each_entry(entry, node, &priv->lec_arp_tables[i], next) {
2214 if (memcmp
2215 (ioc_data->atm_addr, entry->atm_addr,
2216 ATM_ESA_LEN) == 0) {
2217 pr_debug("LEC_ARP: Attaching data direct\n");
2218 pr_debug("Currently -> Vcc: %d, Rvcc:%d\n",
2219 entry->vcc ? entry->vcc->vci : 0,
2220 entry->recv_vcc ? entry->recv_vcc->
2221 vci : 0);
2222 found_entry = 1;
2223 del_timer(&entry->timer);
2224 entry->vcc = vcc;
2225 entry->old_push = old_push;
2226 if (entry->status == ESI_VC_PENDING) {
2227 if (priv->maximum_unknown_frame_count
2228 == 0)
2229 entry->status =
2230 ESI_FORWARD_DIRECT;
2231 else {
2232 entry->timestamp = jiffies;
2233 entry->status =
2234 ESI_FLUSH_PENDING;
2235 #if 0
2236 send_to_lecd(priv, l_flush_xmt,
2237 NULL,
2238 entry->atm_addr,
2239 NULL);
2240 #endif
2241 }
2242 } else {
2243 /*
2244 * They were forming a connection
2245 * to us, and we to them. Our
2246 * ATM address is numerically lower
2247 * than theirs, so we make connection
2248 * we formed into default VCC (8.1.11).
2249 * Connection they made gets torn
2250 * down. This might confuse some
2251 * clients. Can be changed if
2252 * someone reports trouble...
2253 */
2254 ;
2255 }
2256 }
2257 }
2258 }
2259 if (found_entry) {
2260 pr_debug("After vcc was added\n");
2261 dump_arp_table(priv);
2262 goto out;
2263 }
2264 /*
2265 * Not found, snatch address from first data packet that arrives
2266 * from this vcc
2267 */
2268 entry = make_entry(priv, bus_mac);
2269 if (!entry)
2270 goto out;
2271 entry->vcc = vcc;
2272 entry->old_push = old_push;
2273 memcpy(entry->atm_addr, ioc_data->atm_addr, ATM_ESA_LEN);
2274 memset(entry->mac_addr, 0, ETH_ALEN);
2275 entry->status = ESI_UNKNOWN;
2276 hlist_add_head(&entry->next, &priv->lec_arp_empty_ones);
2277 entry->timer.expires = jiffies + priv->vcc_timeout_period;
2278 entry->timer.function = lec_arp_expire_vcc;
2279 add_timer(&entry->timer);
2280 pr_debug("After vcc was added\n");
2281 dump_arp_table(priv);
2282 out:
2283 spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
2284 }
2285
2286 static void lec_flush_complete(struct lec_priv *priv, unsigned long tran_id)
2287 {
2288 unsigned long flags;
2289 struct hlist_node *node;
2290 struct lec_arp_table *entry;
2291 int i;
2292
2293 pr_debug("LEC:lec_flush_complete %lx\n", tran_id);
2294 restart:
2295 spin_lock_irqsave(&priv->lec_arp_lock, flags);
2296 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
2297 hlist_for_each_entry(entry, node, &priv->lec_arp_tables[i], next) {
2298 if (entry->flush_tran_id == tran_id
2299 && entry->status == ESI_FLUSH_PENDING) {
2300 struct sk_buff *skb;
2301 struct atm_vcc *vcc = entry->vcc;
2302
2303 lec_arp_hold(entry);
2304 spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
2305 while ((skb = skb_dequeue(&entry->tx_wait)) != NULL)
2306 lec_send(vcc, skb, entry->priv);
2307 entry->last_used = jiffies;
2308 entry->status = ESI_FORWARD_DIRECT;
2309 lec_arp_put(entry);
2310 pr_debug("LEC_ARP: Flushed\n");
2311 goto restart;
2312 }
2313 }
2314 }
2315 spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
2316 dump_arp_table(priv);
2317 }
2318
2319 static void
2320 lec_set_flush_tran_id(struct lec_priv *priv,
2321 const unsigned char *atm_addr, unsigned long tran_id)
2322 {
2323 unsigned long flags;
2324 struct hlist_node *node;
2325 struct lec_arp_table *entry;
2326 int i;
2327
2328 spin_lock_irqsave(&priv->lec_arp_lock, flags);
2329 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++)
2330 hlist_for_each_entry(entry, node, &priv->lec_arp_tables[i], next) {
2331 if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN)) {
2332 entry->flush_tran_id = tran_id;
2333 pr_debug("Set flush transaction id to %lx for %p\n",
2334 tran_id, entry);
2335 }
2336 }
2337 spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
2338 }
2339
2340 static int lec_mcast_make(struct lec_priv *priv, struct atm_vcc *vcc)
2341 {
2342 unsigned long flags;
2343 unsigned char mac_addr[] = {
2344 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
2345 };
2346 struct lec_arp_table *to_add;
2347 struct lec_vcc_priv *vpriv;
2348 int err = 0;
2349
2350 if (!(vpriv = kmalloc(sizeof(struct lec_vcc_priv), GFP_KERNEL)))
2351 return -ENOMEM;
2352 vpriv->xoff = 0;
2353 vpriv->old_pop = vcc->pop;
2354 vcc->user_back = vpriv;
2355 vcc->pop = lec_pop;
2356 spin_lock_irqsave(&priv->lec_arp_lock, flags);
2357 to_add = make_entry(priv, mac_addr);
2358 if (!to_add) {
2359 vcc->pop = vpriv->old_pop;
2360 kfree(vpriv);
2361 err = -ENOMEM;
2362 goto out;
2363 }
2364 memcpy(to_add->atm_addr, vcc->remote.sas_addr.prv, ATM_ESA_LEN);
2365 to_add->status = ESI_FORWARD_DIRECT;
2366 to_add->flags |= LEC_PERMANENT_FLAG;
2367 to_add->vcc = vcc;
2368 to_add->old_push = vcc->push;
2369 vcc->push = lec_push;
2370 priv->mcast_vcc = vcc;
2371 lec_arp_add(priv, to_add);
2372 out:
2373 spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
2374 return err;
2375 }
2376
2377 static void lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc)
2378 {
2379 unsigned long flags;
2380 struct hlist_node *node, *next;
2381 struct lec_arp_table *entry;
2382 int i;
2383
2384 pr_debug("LEC_ARP: lec_vcc_close vpi:%d vci:%d\n", vcc->vpi, vcc->vci);
2385 dump_arp_table(priv);
2386
2387 spin_lock_irqsave(&priv->lec_arp_lock, flags);
2388
2389 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
2390 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_tables[i], next) {
2391 if (vcc == entry->vcc) {
2392 lec_arp_remove(priv, entry);
2393 lec_arp_put(entry);
2394 if (priv->mcast_vcc == vcc) {
2395 priv->mcast_vcc = NULL;
2396 }
2397 }
2398 }
2399 }
2400
2401 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_empty_ones, next) {
2402 if (entry->vcc == vcc) {
2403 lec_arp_clear_vccs(entry);
2404 del_timer(&entry->timer);
2405 hlist_del(&entry->next);
2406 lec_arp_put(entry);
2407 }
2408 }
2409
2410 hlist_for_each_entry_safe(entry, node, next, &priv->lec_no_forward, next) {
2411 if (entry->recv_vcc == vcc) {
2412 lec_arp_clear_vccs(entry);
2413 del_timer(&entry->timer);
2414 hlist_del(&entry->next);
2415 lec_arp_put(entry);
2416 }
2417 }
2418
2419 hlist_for_each_entry_safe(entry, node, next, &priv->mcast_fwds, next) {
2420 if (entry->recv_vcc == vcc) {
2421 lec_arp_clear_vccs(entry);
2422 /* No timer, LANEv2 7.1.20 and 2.3.5.3 */
2423 hlist_del(&entry->next);
2424 lec_arp_put(entry);
2425 }
2426 }
2427
2428 spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
2429 dump_arp_table(priv);
2430 }
2431
2432 static void
2433 lec_arp_check_empties(struct lec_priv *priv,
2434 struct atm_vcc *vcc, struct sk_buff *skb)
2435 {
2436 unsigned long flags;
2437 struct hlist_node *node, *next;
2438 struct lec_arp_table *entry, *tmp;
2439 struct lecdatahdr_8023 *hdr = (struct lecdatahdr_8023 *)skb->data;
2440 unsigned char *src;
2441 #ifdef CONFIG_TR
2442 struct lecdatahdr_8025 *tr_hdr = (struct lecdatahdr_8025 *)skb->data;
2443
2444 if (priv->is_trdev)
2445 src = tr_hdr->h_source;
2446 else
2447 #endif
2448 src = hdr->h_source;
2449
2450 spin_lock_irqsave(&priv->lec_arp_lock, flags);
2451 hlist_for_each_entry_safe(entry, node, next, &priv->lec_arp_empty_ones, next) {
2452 if (vcc == entry->vcc) {
2453 del_timer(&entry->timer);
2454 memcpy(entry->mac_addr, src, ETH_ALEN);
2455 entry->status = ESI_FORWARD_DIRECT;
2456 entry->last_used = jiffies;
2457 /* We might have got an entry */
2458 if ((tmp = lec_arp_find(priv, src))) {
2459 lec_arp_remove(priv, tmp);
2460 lec_arp_put(tmp);
2461 }
2462 hlist_del(&entry->next);
2463 lec_arp_add(priv, entry);
2464 goto out;
2465 }
2466 }
2467 pr_debug("LEC_ARP: Arp_check_empties: entry not found!\n");
2468 out:
2469 spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
2470 }
2471
2472 MODULE_LICENSE("GPL");
This page took 0.116775 seconds and 5 git commands to generate.