add support for routed RFC2684 encaps. on ATM (patches written by joseangel), close #58
[openwrt.git] / target / linux / generic-2.4 / patches / 225-atm_br2684.patch
1 diff -Nur linux.old/net/atm/br2684.c linux.new/net/atm/br2684.c
2 --- linux.old/net/atm/br2684.c  2004-08-08 01:26:06.000000000 +0200
3 +++ linux.new/net/atm/br2684.c  2005-11-13 00:04:15.000000000 +0100
4 @@ -16,12 +16,9 @@
5  #include <linux/ip.h>
6  #include <asm/uaccess.h>
7  #include <net/arp.h>
8 -#include <linux/atm.h>
9 -#include <linux/atmdev.h>
10  
11  #include <linux/atmbr2684.h>
12  
13 -#include "common.h"
14  #include "ipcommon.h"
15  
16  /*
17 @@ -55,36 +52,57 @@
18  #define skb_debug(skb) do {} while (0)
19  #endif
20  
21 +#define        BR2684_LLC_LEN          3
22 +#define        BR2684_SNAP_LEN         3
23 +#define        BR2684_ETHERTYPE_LEN    2
24 +#define        BR2684_PID_LEN          2
25 +#define        BR2684_PAD_LEN          2
26 +
27 +static unsigned char llc_common[] = { 0xaa, 0xaa, 0x03 };
28 +static unsigned char snap_bridged[] = { 0x00, 0x80, 0xc2 };
29 +static unsigned char snap_routed[] = { 0x00, 0x00, 0x00 };
30 +static unsigned char pid_ipv4[] = { 0x00, 0x07 };
31 +static unsigned char ethertype_ipv4[] = { 0x08, 0x00 };
32 +static unsigned char ethertype_ipv6[] = { 0x86, 0xdd };
33 +static unsigned char pad_bridged[] = { 0x00, 0x00 };
34 +
35  static unsigned char llc_oui_pid_pad[] =
36      { 0xAA, 0xAA, 0x03, 0x00, 0x80, 0xC2, 0x00, 0x07, 0x00, 0x00 };
37 +static unsigned char llc_oui_ipv6[] =
38 +    { 0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x86, 0xdd };
39 +static unsigned char llc_oui_ipv4[] =
40 +    { 0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00 };
41  #define PADLEN (2)
42  
43  enum br2684_encaps {
44 -       e_vc  = BR2684_ENCAPS_VC,
45 +       e_vc = BR2684_ENCAPS_VC,
46         e_llc = BR2684_ENCAPS_LLC,
47  };
48  
49 +
50 +
51  struct br2684_vcc {
52 -       struct atm_vcc  *atmvcc;
53 +       struct atm_vcc *atmvcc;
54         struct br2684_dev *brdev;
55         /* keep old push,pop functions for chaining */
56 -       void (*old_push)(struct atm_vcc *vcc,struct sk_buff *skb);
57 +       void (*old_push) (struct atm_vcc * vcc, struct sk_buff * skb);
58         /* void (*old_pop)(struct atm_vcc *vcc,struct sk_buff *skb); */
59         enum br2684_encaps encaps;
60 +       enum br2684_payload payload;
61         struct list_head brvccs;
62  #ifdef CONFIG_ATM_BR2684_IPFILTER
63         struct br2684_filter filter;
64 -#endif /* CONFIG_ATM_BR2684_IPFILTER */
65 +#endif                         /* CONFIG_ATM_BR2684_IPFILTER */
66  #ifndef FASTER_VERSION
67         unsigned copies_needed, copies_failed;
68 -#endif /* FASTER_VERSION */
69 +#endif                         /* FASTER_VERSION */
70  };
71  
72  struct br2684_dev {
73         struct net_device net_dev;
74         struct list_head br2684_devs;
75         int number;
76 -       struct list_head brvccs; /* one device <=> one vcc (before xmas) */
77 +       struct list_head brvccs;        /* one device <=> one vcc (before xmas) */
78         struct net_device_stats stats;
79         int mac_was_set;
80  };
81 @@ -173,24 +197,84 @@
82                 }
83                 skb = skb2;
84         }
85 -       skb_push(skb, minheadroom);
86 -       if (brvcc->encaps == e_llc)
87 -               memcpy(skb->data, llc_oui_pid_pad, 10);
88 -       else
89 -               memset(skb->data, 0, 2);
90 -#endif /* FASTER_VERSION */
91 +
92 +       /* This skb_push is a problem: routed packets need less headroom than
93 +        * bridged packets.
94 +        */
95 +
96 +/*     skb_push(skb, minheadroom); */
97 +       if (brvcc->encaps == e_llc) {
98 +               int offset = 0;
99 +               int actual_headroom;
100 +
101 +               actual_headroom =
102 +                   BR2684_LLC_LEN +
103 +                   BR2684_SNAP_LEN +
104 +                   ((brvcc->payload == p_bridged) ?
105 +                    (BR2684_PID_LEN + BR2684_PAD_LEN) :
106 +                    BR2684_ETHERTYPE_LEN);
107 +
108 +               skb_push(skb, actual_headroom);
109 +               memcpy(skb->data, llc_common, BR2684_LLC_LEN);
110 +               offset += BR2684_LLC_LEN;
111 +
112 +               if (brvcc->payload == p_bridged) {
113 +                       memcpy(skb->data + offset, snap_bridged,
114 +                              BR2684_SNAP_LEN);
115 +                       offset += BR2684_SNAP_LEN;
116 +                       /* pid_ipv4 is poorly named.  should probably be
117 +                        * pid_ethernet
118 +                        */
119 +                       memcpy(skb->data + offset, pid_ipv4,
120 +                              BR2684_PID_LEN);
121 +                       offset += BR2684_PID_LEN;
122 +                       memcpy(skb->data + offset, pad_bridged,
123 +                              BR2684_PAD_LEN);
124 +                       offset += BR2684_PAD_LEN;
125 +               } else if (brvcc->payload == p_routed) {
126 +                       unsigned short prot =
127 +                           __constant_ntohs(skb->protocol);
128 +                       memcpy(skb->data + offset, snap_routed,
129 +                              BR2684_SNAP_LEN);
130 +                       offset += BR2684_SNAP_LEN;
131 +
132 +                       switch (prot) {
133 +                       case ETH_P_IP:
134 +                               memcpy(skb->data + offset,
135 +                                      ethertype_ipv4,
136 +                                      BR2684_ETHERTYPE_LEN);
137 +                               break;
138 +                       case ETH_P_IPV6:
139 +                               memcpy(skb->data + offset,
140 +                                      ethertype_ipv6,
141 +                                      BR2684_ETHERTYPE_LEN);
142 +                               break;
143 +                       default:
144 +                               dev_kfree_skb(skb);
145 +                               return 0;
146 +                       }
147 +                       offset += BR2684_ETHERTYPE_LEN;
148 +
149 +               }
150 +       } else {
151 +               skb_push(skb, 2);
152 +               if (brvcc->payload == p_bridged)
153 +                       memset(skb->data, 0, 2);
154 +       }
155 +#endif                         /* FASTER_VERSION */
156         skb_debug(skb);
157  
158         ATM_SKB(skb)->vcc = atmvcc = brvcc->atmvcc;
159 -       DPRINTK("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, atmvcc, atmvcc->dev);
160 +       DPRINTK("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, atmvcc,
161 +               atmvcc->dev);
162         if (!atm_may_send(atmvcc, skb->truesize)) {
163                 /* we free this here for now, because we cannot know in a higher 
164 -                       layer whether the skb point it supplied wasn't freed yet.
165 -                       now, it always is.
166 -               */
167 +                  layer whether the skb point it supplied wasn't freed yet.
168 +                  now, it always is.
169 +                */
170                 dev_kfree_skb(skb);
171                 return 0;
172 -               }
173 +       }
174         atomic_add(skb->truesize, &atmvcc->sk->wmem_alloc);
175         ATM_SKB(skb)->atm_options = atmvcc->atm_options;
176         brdev->stats.tx_packets++;
177 @@ -428,18 +512,39 @@
178         atm_return(atmvcc, skb->truesize);
179         DPRINTK("skb from brdev %p\n", brdev);
180         if (brvcc->encaps == e_llc) {
181 +               /* accept packets that have "ipv[46]" in the snap header */
182 +               /* 8 - 2 == sizeof(llc_oui_ipv6) - BR2684_ETHERTYPE_LEN */
183 +               if (memcmp(skb->data, llc_oui_ipv6, 8 - 2) == 0) {
184 +                       plen = sizeof(llc_oui_ipv6);
185 +
186 +                       if (memcmp(skb->data + 6, ethertype_ipv6, 2) == 0)
187 +                               skb->protocol =
188 +                                   __constant_htons(ETH_P_IPV6);
189 +                       else if (memcmp(skb->data + 6, ethertype_ipv4, 2)
190 +                                == 0)
191 +                               skb->protocol = __constant_htons(ETH_P_IP);
192 +                       else {
193 +                               brdev->stats.rx_errors++;
194 +                               dev_kfree_skb(skb);
195 +                               return;
196 +                       }
197 +                       skb_pull(skb, plen);
198 +                       skb->nh.raw = skb->data;
199 +                       skb->pkt_type = PACKET_HOST;
200 +               }
201 +
202                 /* let us waste some time for checking the encapsulation.
203                    Note, that only 7 char is checked so frames with a valid FCS
204                    are also accepted (but FCS is not checked of course) */
205 -               if (memcmp(skb->data, llc_oui_pid_pad, 7)) {
206 +               else if (memcmp(skb->data, llc_oui_pid_pad, 7) == 0) {
207 +                       skb_pull(skb, plen - ETH_HLEN);
208 +                       skb->protocol =
209 +                           eth_type_trans(skb, &brdev->net_dev);
210 +               } else {
211                         brdev->stats.rx_errors++;
212                         dev_kfree_skb(skb);
213                         return;
214                 }
215 -
216 -               /* Strip FCS if present */
217 -               if (skb->len > 7 && skb->data[7] == 0x01)
218 -                       __skb_trim(skb, skb->len - 4);
219         } else {
220                 plen = PADLEN + ETH_HLEN;       /* pad, dstmac,srcmac, ethtype */
221                 /* first 2 chars should be 0 */
222 @@ -448,13 +553,14 @@
223                         dev_kfree_skb(skb);
224                         return;
225                 }
226 +               skb_pull(skb, plen - ETH_HLEN);
227 +               skb->protocol = eth_type_trans(skb, &brdev->net_dev);
228         }
229         if (skb->len < plen) {
230                 brdev->stats.rx_errors++;
231                 dev_kfree_skb(skb);     /* dev_ not needed? */
232                 return;
233         }
234 -
235  #ifdef FASTER_VERSION
236         /* FIXME: tcpdump shows that pointer to mac header is 2 bytes earlier,
237            than should be. What else should I set? */
238 @@ -465,30 +571,29 @@
239         skb->protocol = ((u16 *) skb->data)[-1];
240  #else                          /* some protocols might require this: */
241         skb->protocol = br_type_trans(skb, &brdev->net_dev);
242 -#endif /* CONFIG_BR2684_FAST_TRANS */
243 +#endif                         /* CONFIG_BR2684_FAST_TRANS */
244  #else
245 -       skb_pull(skb, plen - ETH_HLEN);
246 -       skb->protocol = eth_type_trans(skb, &brdev->net_dev);
247 -#endif /* FASTER_VERSION */
248 +       /* skb_pull(skb, plen - ETH_HLEN); */
249 +       /* skb->protocol = eth_type_trans(skb, &brdev->net_dev); */
250 +#endif                         /* FASTER_VERSION */
251  #ifdef CONFIG_ATM_BR2684_IPFILTER
252         if (packet_fails_filter(skb->protocol, brvcc, skb)) {
253                 brdev->stats.rx_dropped++;
254                 dev_kfree_skb(skb);
255                 return;
256         }
257 -#endif /* CONFIG_ATM_BR2684_IPFILTER */
258 +#endif                         /* CONFIG_ATM_BR2684_IPFILTER */
259         skb->dev = &brdev->net_dev;
260 -       ATM_SKB(skb)->vcc = atmvcc;     /* needed ? */
261 +       /* ATM_SKB(skb)->vcc = atmvcc;  *//* needed ? */
262         DPRINTK("received packet's protocol: %x\n", ntohs(skb->protocol));
263         skb_debug(skb);
264 -       if (!(brdev->net_dev.flags & IFF_UP)) { /* sigh, interface is down */
265 +       if (!(brdev->net_dev.flags & IFF_UP)) { /* sigh, interface is down */
266                 brdev->stats.rx_dropped++;
267                 dev_kfree_skb(skb);
268                 return;
269         }
270         brdev->stats.rx_packets++;
271         brdev->stats.rx_bytes += skb->len;
272 -       memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data));
273         netif_rx(skb);
274  }
275  
276 @@ -525,10 +630,10 @@
277                 err = -EEXIST;
278                 goto error;
279         }
280 -       if (be.fcs_in != BR2684_FCSIN_NO || be.fcs_out != BR2684_FCSOUT_NO ||
281 -           be.fcs_auto || be.has_vpiid || be.send_padding || (be.encaps !=
282 -           BR2684_ENCAPS_VC && be.encaps != BR2684_ENCAPS_LLC) ||
283 -           be.min_size != 0) {
284 +       if (be.fcs_in != BR2684_FCSIN_NO || be.fcs_out != BR2684_FCSOUT_NO
285 +           || be.fcs_auto || be.has_vpiid || be.send_padding
286 +           || (be.encaps != BR2684_ENCAPS_VC
287 +               && be.encaps != BR2684_ENCAPS_LLC) || be.min_size != 0) {
288                 err = -EINVAL;
289                 goto error;
290         }
291 @@ -554,18 +659,21 @@
292         brvcc->atmvcc = atmvcc;
293         atmvcc->user_back = brvcc;
294         brvcc->encaps = (enum br2684_encaps) be.encaps;
295 +       brvcc->payload = (enum br2684_payload) be.payload;
296         brvcc->old_push = atmvcc->push;
297         barrier();
298         atmvcc->push = br2684_push;
299         skb_queue_head_init(&copy);
300         skb_migrate(&atmvcc->sk->receive_queue, &copy);
301         while ((skb = skb_dequeue(&copy))) {
302 +#ifdef notdef
303                 BRPRIV(skb->dev)->stats.rx_bytes -= skb->len;
304                 BRPRIV(skb->dev)->stats.rx_packets--;
305 +#endif
306                 br2684_push(atmvcc, skb);
307         }
308         return 0;
309 -    error:
310 +      error:
311         write_unlock_irq(&devs_lock);
312         MOD_DEC_USE_COUNT;
313         return err;
314 @@ -608,12 +717,25 @@
315  
316         if (ni.ifname[0] != '\0') {
317                 memcpy(brdev->net_dev.name, ni.ifname,
318 -                   sizeof(brdev->net_dev.name));
319 -               brdev->net_dev.name[sizeof(brdev->net_dev.name) - 1] = '\0';
320 +                      sizeof(brdev->net_dev.name));
321 +               brdev->net_dev.name[sizeof(brdev->net_dev.name) - 1] =
322 +                   '\0';
323         } else
324                 sprintf(brdev->net_dev.name, "nas%d", brdev->number);
325         DPRINTK("registered netdev %s\n", brdev->net_dev.name);
326 -       ether_setup(&brdev->net_dev);
327 +       if (ni.payload == p_routed) {
328 +               brdev->net_dev.hard_header_len = 0;
329 +               brdev->net_dev.addr_len = 0;
330 +               brdev->net_dev.mtu = 1500;
331 +
332 +               /* Type PPP seems most suitable */
333 +               brdev->net_dev.type = ARPHRD_PPP;
334 +               brdev->net_dev.flags =
335 +                   IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
336 +               brdev->net_dev.tx_queue_len = 100;
337 +       } else {
338 +               ether_setup(&brdev->net_dev);
339 +       }
340         brdev->mac_was_set = 0;
341  #ifdef FASTER_VERSION
342         my_eth_header = brdev->net_dev.hard_header;
343 @@ -677,12 +799,11 @@
344                 err = br2684_setfilt(atmvcc, arg);
345                 MOD_DEC_USE_COUNT;
346                 return err;
347 -#endif /* CONFIG_ATM_BR2684_IPFILTER */
348 +#endif                         /* CONFIG_ATM_BR2684_IPFILTER */
349         }
350         return -ENOIOCTLCMD;
351  }
352  
353 -#ifdef CONFIG_PROC_FS
354  /* Never put more than 256 bytes in at once */
355  static int br2684_proc_engine(loff_t pos, char *buf)
356  {
357 @@ -692,52 +813,62 @@
358         list_for_each(lhd, &br2684_devs) {
359                 brdev = list_entry_brdev(lhd);
360                 if (pos-- == 0)
361 -                       return sprintf(buf, "dev %.16s: num=%d, mac=%02X:%02X:"
362 -                           "%02X:%02X:%02X:%02X (%s)\n", brdev->net_dev.name,
363 -                           brdev->number,
364 -                           brdev->net_dev.dev_addr[0],
365 -                           brdev->net_dev.dev_addr[1],
366 -                           brdev->net_dev.dev_addr[2],
367 -                           brdev->net_dev.dev_addr[3],
368 -                           brdev->net_dev.dev_addr[4],
369 -                           brdev->net_dev.dev_addr[5],
370 -                           brdev->mac_was_set ? "set" : "auto");
371 +                       return sprintf(buf,
372 +                                      "dev %.16s: num=%d, mac=%02X:%02X:"
373 +                                      "%02X:%02X:%02X:%02X (%s)\n",
374 +                                      brdev->net_dev.name, brdev->number,
375 +                                      brdev->net_dev.dev_addr[0],
376 +                                      brdev->net_dev.dev_addr[1],
377 +                                      brdev->net_dev.dev_addr[2],
378 +                                      brdev->net_dev.dev_addr[3],
379 +                                      brdev->net_dev.dev_addr[4],
380 +                                      brdev->net_dev.dev_addr[5],
381 +                                      brdev->
382 +                                      mac_was_set ? "set" : "auto");
383                 list_for_each(lhc, &brdev->brvccs) {
384                         brvcc = list_entry_brvcc(lhc);
385                         if (pos-- == 0)
386 -                               return sprintf(buf, "  vcc %d.%d.%d: encaps=%s"
387 +                               return sprintf(buf,
388 +                                              "  vcc %d.%d.%d: encaps=%s"
389 +                                              ", payload=%s"
390  #ifndef FASTER_VERSION
391 -                                   ", failed copies %u/%u"
392 -#endif /* FASTER_VERSION */
393 -                                   "\n", brvcc->atmvcc->dev->number,
394 -                                   brvcc->atmvcc->vpi, brvcc->atmvcc->vci,
395 -                                   (brvcc->encaps == e_llc) ? "LLC" : "VC"
396 +                                              ", failed copies %u/%u"
397 +#endif                         /* FASTER_VERSION */
398 +                                              "\n",
399 +                                              brvcc->atmvcc->dev->number,
400 +                                              brvcc->atmvcc->vpi,
401 +                                              brvcc->atmvcc->vci,
402 +                                              (brvcc->encaps ==
403 +                                               e_llc) ? "LLC" : "VC",
404 +                                              (brvcc->payload ==
405 +                                               p_bridged) ? "bridged" :
406 +                                              "routed"
407  #ifndef FASTER_VERSION
408 -                                   , brvcc->copies_failed
409 -                                   , brvcc->copies_needed
410 -#endif /* FASTER_VERSION */
411 +                                              , brvcc->copies_failed,
412 +                                              brvcc->copies_needed
413 +#endif                         /* FASTER_VERSION */
414                                     );
415  #ifdef CONFIG_ATM_BR2684_IPFILTER
416  #define b1(var, byte)  ((u8 *) &brvcc->filter.var)[byte]
417  #define bs(var)                b1(var, 0), b1(var, 1), b1(var, 2), b1(var, 3)
418                         if (brvcc->filter.netmask != 0 && pos-- == 0)
419 -                               return sprintf(buf, "    filter=%d.%d.%d.%d/"
420 -                                   "%d.%d.%d.%d\n", bs(prefix), bs(netmask));
421 +                               return sprintf(buf,
422 +                                              "    filter=%d.%d.%d.%d/"
423 +                                              "%d.%d.%d.%d\n", bs(prefix),
424 +                                              bs(netmask));
425  #undef bs
426  #undef b1
427 -#endif /* CONFIG_ATM_BR2684_IPFILTER */
428 +#endif                         /* CONFIG_ATM_BR2684_IPFILTER */
429                 }
430         }
431         return 0;
432  }
433  
434  static ssize_t br2684_proc_read(struct file *file, char *buf, size_t count,
435 -       loff_t *pos)
436 +                               loff_t * pos)
437  {
438         unsigned long page;
439         int len = 0, x, left;
440 -       loff_t n = *pos;
441 -
442         page = get_free_page(GFP_KERNEL);
443         if (!page)
444                 return -ENOMEM;
445 @@ -746,7 +877,7 @@
446                 left = count;
447         read_lock(&devs_lock);
448         for (;;) {
449 -               x = br2684_proc_engine(n, &((char *) page)[len]);
450 +               x = br2684_proc_engine(*pos, &((char *) page)[len]);
451                 if (x == 0)
452                         break;
453                 if (x > left)
454 @@ -761,12 +892,11 @@
455                 }
456                 len += x;
457                 left -= x;
458 -               n++;
459 +               (*pos)++;
460                 if (left < 256)
461                         break;
462         }
463         read_unlock(&devs_lock);
464 -       *pos = n;
465         if (len > 0 && copy_to_user(buf, (char *) page, len))
466                 len = -EFAULT;
467         free_page(page);
468 @@ -774,34 +904,32 @@
469  }
470  
471  static struct file_operations br2684_proc_operations = {
472 -       read: br2684_proc_read,
473 +      read:br2684_proc_read,
474  };
475  
476  extern struct proc_dir_entry *atm_proc_root;   /* from proc.c */
477 -#endif /* CONFIG_PROC_FS */
478 +
479 +extern int (*br2684_ioctl_hook) (struct atm_vcc *, unsigned int,
480 +                                unsigned long);
481  
482  /* the following avoids some spurious warnings from the compiler */
483  #define UNUSED __attribute__((unused))
484  
485  static int __init UNUSED br2684_init(void)
486  {
487 -#ifdef CONFIG_PROC_FS
488         struct proc_dir_entry *p;
489         if ((p = create_proc_entry("br2684", 0, atm_proc_root)) == NULL)
490                 return -ENOMEM;
491         p->proc_fops = &br2684_proc_operations;
492 -#endif /* CONFIG_PROC_FS */
493 -       br2684_ioctl_set(br2684_ioctl);
494 +       br2684_ioctl_hook = br2684_ioctl;
495         return 0;
496  }
497  
498  static void __exit UNUSED br2684_exit(void)
499  {
500         struct br2684_dev *brdev;
501 -       br2684_ioctl_set(NULL);
502 -#ifdef CONFIG_PROC_FS
503 +       br2684_ioctl_hook = NULL;
504         remove_proc_entry("br2684", atm_proc_root);
505 -#endif /* CONFIG_PROC_FS */
506         while (!list_empty(&br2684_devs)) {
507                 brdev = list_entry_brdev(br2684_devs.next);
508                 unregister_netdev(&brdev->net_dev);
509 diff -Nur linux.old/net/atm/common.c linux.new/net/atm/common.c
510 --- linux.old/net/atm/common.c  2004-02-18 14:36:32.000000000 +0100
511 +++ linux.new/net/atm/common.c  2005-11-13 00:46:11.000000000 +0100
512 @@ -158,6 +158,7 @@
513  }
514  #ifdef CONFIG_ATM_BR2684_MODULE
515  EXPORT_SYMBOL(br2684_ioctl_set);
516 +EXPORT_SYMBOL(br2684_ioctl_hook);
517  #endif
518  #endif
519
520 diff -Nur linux.old/include/linux/atmbr2684.h linux.new/include/linux/atmbr2684.h
521 --- linux.old/include/linux/atmbr2684.h 2005-11-13 00:28:19.000000000 +0100
522 +++ linux.new/include/linux/atmbr2684.h 2005-11-13 00:06:42.000000000 +0100
523 @@ -3,6 +3,7 @@
524  
525  #include <linux/atm.h>
526  #include <linux/if.h>          /* For IFNAMSIZ */
527 +#include <linux/if_ether.h>    /* ETH_P_* */
528  
529  /*
530   * Type of media we're bridging (ethernet, token ring, etc)  Currently only
531 @@ -36,15 +37,24 @@
532  #define BR2684_ENCAPS_AUTODETECT (2)   /* Unsuported */
533  
534  /*
535 + * Is this VC bridged or routed?
536 + */
537 +
538 +#define        BR2684_PAYLOAD_ROUTED   (0)
539 +#define        BR2684_PAYLOAD_BRIDGED  (1)
540 +
541 +
542 +/*
543   * This is for the ATM_NEWBACKENDIF call - these are like socket families:
544   * the first element of the structure is the backend number and the rest
545   * is per-backend specific
546   */
547  struct atm_newif_br2684 {
548 -       atm_backend_t   backend_num;    /* ATM_BACKEND_BR2684 */
549 -       int             media;          /* BR2684_MEDIA_* */
550 -       char            ifname[IFNAMSIZ];
551 -       int             mtu;
552 +       atm_backend_t backend_num;      /* ATM_BACKEND_BR2684 */
553 +       int media;              /* BR2684_MEDIA_* */
554 +       char ifname[IFNAMSIZ];
555 +       int mtu;
556 +       int payload;            /* bridged or routed */
557  };
558  
559  /*
560 @@ -68,16 +78,17 @@
561   * is per-backend specific
562   */
563  struct atm_backend_br2684 {
564 -       atm_backend_t   backend_num;    /* ATM_BACKEND_BR2684 */
565 +       atm_backend_t backend_num;      /* ATM_BACKEND_BR2684 */
566         struct br2684_if_spec ifspec;
567 -       int     fcs_in;         /* BR2684_FCSIN_* */
568 -       int     fcs_out;        /* BR2684_FCSOUT_* */
569 -       int     fcs_auto;       /* 1: fcs_{in,out} disabled if no FCS rx'ed */
570 -       int     encaps;         /* BR2684_ENCAPS_* */
571 -       int     has_vpiid;      /* 1: use vpn_id - Unsupported */
572 -       __u8    vpn_id[7];
573 -       int     send_padding;   /* unsupported */
574 -       int     min_size;       /* we will pad smaller packets than this */
575 +       int fcs_in;             /* BR2684_FCSIN_* */
576 +       int fcs_out;            /* BR2684_FCSOUT_* */
577 +       int fcs_auto;           /* 1: fcs_{in,out} disabled if no FCS rx'ed */
578 +       int encaps;             /* BR2684_ENCAPS_* */
579 +       int payload;            /* BR2684_PAYLOAD_* */
580 +       int has_vpiid;          /* 1: use vpn_id - Unsupported */
581 +       __u8 vpn_id[7];
582 +       int send_padding;       /* unsupported */
583 +       int min_size;           /* we will pad smaller packets than this */
584  };
585  
586  /*
587 @@ -95,7 +106,12 @@
588         struct br2684_filter filter;
589  };
590  
591 +enum br2684_payload {
592 +       p_routed = BR2684_PAYLOAD_ROUTED,
593 +       p_bridged = BR2684_PAYLOAD_BRIDGED,
594 +};
595 +
596  #define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \
597                                 struct br2684_filter_set)
598  
599 -#endif /* _LINUX_ATMBR2684_H */
600 +#endif                         /* _LINUX_ATMBR2684_H */