aboutsummaryrefslogtreecommitdiffstats
path: root/net/atm
diff options
context:
space:
mode:
Diffstat (limited to 'net/atm')
-rw-r--r--net/atm/Makefile3
-rw-r--r--net/atm/br2684.c30
-rw-r--r--net/atm/clip.c39
-rw-r--r--net/atm/ipcommon.c63
-rw-r--r--net/atm/ipcommon.h22
-rw-r--r--net/atm/lec.c16
-rw-r--r--net/atm/lec.h6
-rw-r--r--net/atm/mpc.c29
-rw-r--r--net/atm/mpc.h6
-rw-r--r--net/atm/mpoa_caches.c20
-rw-r--r--net/atm/mpoa_caches.h16
-rw-r--r--net/atm/mpoa_proc.c6
12 files changed, 99 insertions, 157 deletions
diff --git a/net/atm/Makefile b/net/atm/Makefile
index 89656d6c0b90..cc50bd1ff1de 100644
--- a/net/atm/Makefile
+++ b/net/atm/Makefile
@@ -7,10 +7,7 @@ mpoa-objs := mpc.o mpoa_caches.o mpoa_proc.o
7 7
8obj-$(CONFIG_ATM) += atm.o 8obj-$(CONFIG_ATM) += atm.o
9obj-$(CONFIG_ATM_CLIP) += clip.o 9obj-$(CONFIG_ATM_CLIP) += clip.o
10atm-$(subst m,y,$(CONFIG_ATM_CLIP)) += ipcommon.o
11obj-$(CONFIG_ATM_BR2684) += br2684.o 10obj-$(CONFIG_ATM_BR2684) += br2684.o
12atm-$(subst m,y,$(CONFIG_ATM_BR2684)) += ipcommon.o
13atm-$(subst m,y,$(CONFIG_NET_SCH_ATM)) += ipcommon.o
14atm-$(CONFIG_PROC_FS) += proc.o 11atm-$(CONFIG_PROC_FS) += proc.o
15 12
16obj-$(CONFIG_ATM_LANE) += lec.o 13obj-$(CONFIG_ATM_LANE) += lec.o
diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index d00cca97eb33..83a1c1b1d6cd 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -23,7 +23,6 @@ Author: Marcell GAL, 2000, XDSL Ltd, Hungary
23#include <linux/atmbr2684.h> 23#include <linux/atmbr2684.h>
24 24
25#include "common.h" 25#include "common.h"
26#include "ipcommon.h"
27 26
28/* 27/*
29 * Define this to use a version of the code which interacts with the higher 28 * Define this to use a version of the code which interacts with the higher
@@ -372,7 +371,7 @@ static int br2684_setfilt(struct atm_vcc *atmvcc, void __user *arg)
372 371
373/* Returns 1 if packet should be dropped */ 372/* Returns 1 if packet should be dropped */
374static inline int 373static inline int
375packet_fails_filter(u16 type, struct br2684_vcc *brvcc, struct sk_buff *skb) 374packet_fails_filter(__be16 type, struct br2684_vcc *brvcc, struct sk_buff *skb)
376{ 375{
377 if (brvcc->filter.netmask == 0) 376 if (brvcc->filter.netmask == 0)
378 return 0; /* no filter in place */ 377 return 0; /* no filter in place */
@@ -500,11 +499,12 @@ Note: we do not have explicit unassign, but look at _push()
500*/ 499*/
501 int err; 500 int err;
502 struct br2684_vcc *brvcc; 501 struct br2684_vcc *brvcc;
503 struct sk_buff_head copy;
504 struct sk_buff *skb; 502 struct sk_buff *skb;
503 struct sk_buff_head *rq;
505 struct br2684_dev *brdev; 504 struct br2684_dev *brdev;
506 struct net_device *net_dev; 505 struct net_device *net_dev;
507 struct atm_backend_br2684 be; 506 struct atm_backend_br2684 be;
507 unsigned long flags;
508 508
509 if (copy_from_user(&be, arg, sizeof be)) 509 if (copy_from_user(&be, arg, sizeof be))
510 return -EFAULT; 510 return -EFAULT;
@@ -554,12 +554,30 @@ Note: we do not have explicit unassign, but look at _push()
554 brvcc->old_push = atmvcc->push; 554 brvcc->old_push = atmvcc->push;
555 barrier(); 555 barrier();
556 atmvcc->push = br2684_push; 556 atmvcc->push = br2684_push;
557 skb_queue_head_init(&copy); 557
558 skb_migrate(&sk_atm(atmvcc)->sk_receive_queue, &copy); 558 rq = &sk_atm(atmvcc)->sk_receive_queue;
559 while ((skb = skb_dequeue(&copy)) != NULL) { 559
560 spin_lock_irqsave(&rq->lock, flags);
561 if (skb_queue_empty(rq)) {
562 skb = NULL;
563 } else {
564 /* NULL terminate the list. */
565 rq->prev->next = NULL;
566 skb = rq->next;
567 }
568 rq->prev = rq->next = (struct sk_buff *)rq;
569 rq->qlen = 0;
570 spin_unlock_irqrestore(&rq->lock, flags);
571
572 while (skb) {
573 struct sk_buff *next = skb->next;
574
575 skb->next = skb->prev = NULL;
560 BRPRIV(skb->dev)->stats.rx_bytes -= skb->len; 576 BRPRIV(skb->dev)->stats.rx_bytes -= skb->len;
561 BRPRIV(skb->dev)->stats.rx_packets--; 577 BRPRIV(skb->dev)->stats.rx_packets--;
562 br2684_push(atmvcc, skb); 578 br2684_push(atmvcc, skb);
579
580 skb = next;
563 } 581 }
564 __module_get(THIS_MODULE); 582 __module_get(THIS_MODULE);
565 return 0; 583 return 0;
diff --git a/net/atm/clip.c b/net/atm/clip.c
index 7af2c411da82..5f8a1d222720 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -38,7 +38,6 @@
38 38
39#include "common.h" 39#include "common.h"
40#include "resources.h" 40#include "resources.h"
41#include "ipcommon.h"
42#include <net/atmclip.h> 41#include <net/atmclip.h>
43 42
44 43
@@ -54,7 +53,7 @@ static struct atm_vcc *atmarpd;
54static struct neigh_table clip_tbl; 53static struct neigh_table clip_tbl;
55static struct timer_list idle_timer; 54static struct timer_list idle_timer;
56 55
57static int to_atmarpd(enum atmarp_ctrl_type type, int itf, unsigned long ip) 56static int to_atmarpd(enum atmarp_ctrl_type type, int itf, __be32 ip)
58{ 57{
59 struct sock *sk; 58 struct sock *sk;
60 struct atmarp_ctrl *ctrl; 59 struct atmarp_ctrl *ctrl;
@@ -220,7 +219,7 @@ static void clip_push(struct atm_vcc *vcc, struct sk_buff *skb)
220 || memcmp(skb->data, llc_oui, sizeof (llc_oui))) 219 || memcmp(skb->data, llc_oui, sizeof (llc_oui)))
221 skb->protocol = htons(ETH_P_IP); 220 skb->protocol = htons(ETH_P_IP);
222 else { 221 else {
223 skb->protocol = ((u16 *) skb->data)[3]; 222 skb->protocol = ((__be16 *) skb->data)[3];
224 skb_pull(skb, RFC1483LLC_LEN); 223 skb_pull(skb, RFC1483LLC_LEN);
225 if (skb->protocol == htons(ETH_P_ARP)) { 224 if (skb->protocol == htons(ETH_P_ARP)) {
226 PRIV(skb->dev)->stats.rx_packets++; 225 PRIV(skb->dev)->stats.rx_packets++;
@@ -430,7 +429,7 @@ static int clip_start_xmit(struct sk_buff *skb, struct net_device *dev)
430 429
431 here = skb_push(skb, RFC1483LLC_LEN); 430 here = skb_push(skb, RFC1483LLC_LEN);
432 memcpy(here, llc_oui, sizeof(llc_oui)); 431 memcpy(here, llc_oui, sizeof(llc_oui));
433 ((u16 *) here)[3] = skb->protocol; 432 ((__be16 *) here)[3] = skb->protocol;
434 } 433 }
435 atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); 434 atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);
436 ATM_SKB(skb)->atm_options = vcc->atm_options; 435 ATM_SKB(skb)->atm_options = vcc->atm_options;
@@ -469,8 +468,9 @@ static struct net_device_stats *clip_get_stats(struct net_device *dev)
469static int clip_mkip(struct atm_vcc *vcc, int timeout) 468static int clip_mkip(struct atm_vcc *vcc, int timeout)
470{ 469{
471 struct clip_vcc *clip_vcc; 470 struct clip_vcc *clip_vcc;
472 struct sk_buff_head copy;
473 struct sk_buff *skb; 471 struct sk_buff *skb;
472 struct sk_buff_head *rq;
473 unsigned long flags;
474 474
475 if (!vcc->push) 475 if (!vcc->push)
476 return -EBADFD; 476 return -EBADFD;
@@ -490,10 +490,26 @@ static int clip_mkip(struct atm_vcc *vcc, int timeout)
490 clip_vcc->old_pop = vcc->pop; 490 clip_vcc->old_pop = vcc->pop;
491 vcc->push = clip_push; 491 vcc->push = clip_push;
492 vcc->pop = clip_pop; 492 vcc->pop = clip_pop;
493 skb_queue_head_init(&copy); 493
494 skb_migrate(&sk_atm(vcc)->sk_receive_queue, &copy); 494 rq = &sk_atm(vcc)->sk_receive_queue;
495
496 spin_lock_irqsave(&rq->lock, flags);
497 if (skb_queue_empty(rq)) {
498 skb = NULL;
499 } else {
500 /* NULL terminate the list. */
501 rq->prev->next = NULL;
502 skb = rq->next;
503 }
504 rq->prev = rq->next = (struct sk_buff *)rq;
505 rq->qlen = 0;
506 spin_unlock_irqrestore(&rq->lock, flags);
507
495 /* re-process everything received between connection setup and MKIP */ 508 /* re-process everything received between connection setup and MKIP */
496 while ((skb = skb_dequeue(&copy)) != NULL) 509 while (skb) {
510 struct sk_buff *next = skb->next;
511
512 skb->next = skb->prev = NULL;
497 if (!clip_devs) { 513 if (!clip_devs) {
498 atm_return(vcc, skb->truesize); 514 atm_return(vcc, skb->truesize);
499 kfree_skb(skb); 515 kfree_skb(skb);
@@ -506,10 +522,13 @@ static int clip_mkip(struct atm_vcc *vcc, int timeout)
506 PRIV(skb->dev)->stats.rx_bytes -= len; 522 PRIV(skb->dev)->stats.rx_bytes -= len;
507 kfree_skb(skb); 523 kfree_skb(skb);
508 } 524 }
525
526 skb = next;
527 }
509 return 0; 528 return 0;
510} 529}
511 530
512static int clip_setentry(struct atm_vcc *vcc, u32 ip) 531static int clip_setentry(struct atm_vcc *vcc, __be32 ip)
513{ 532{
514 struct neighbour *neigh; 533 struct neighbour *neigh;
515 struct atmarp_entry *entry; 534 struct atmarp_entry *entry;
@@ -752,7 +771,7 @@ static int clip_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
752 err = clip_mkip(vcc, arg); 771 err = clip_mkip(vcc, arg);
753 break; 772 break;
754 case ATMARP_SETENTRY: 773 case ATMARP_SETENTRY:
755 err = clip_setentry(vcc, arg); 774 err = clip_setentry(vcc, (__force __be32)arg);
756 break; 775 break;
757 case ATMARP_ENCAP: 776 case ATMARP_ENCAP:
758 err = clip_encap(vcc, arg); 777 err = clip_encap(vcc, arg);
diff --git a/net/atm/ipcommon.c b/net/atm/ipcommon.c
deleted file mode 100644
index 1d3de42fada0..000000000000
--- a/net/atm/ipcommon.c
+++ /dev/null
@@ -1,63 +0,0 @@
1/* net/atm/ipcommon.c - Common items for all ways of doing IP over ATM */
2
3/* Written 1996-2000 by Werner Almesberger, EPFL LRC/ICA */
4
5
6#include <linux/module.h>
7#include <linux/string.h>
8#include <linux/skbuff.h>
9#include <linux/netdevice.h>
10#include <linux/in.h>
11#include <linux/atmdev.h>
12#include <linux/atmclip.h>
13
14#include "common.h"
15#include "ipcommon.h"
16
17
18#if 0
19#define DPRINTK(format,args...) printk(KERN_DEBUG format,##args)
20#else
21#define DPRINTK(format,args...)
22#endif
23
24
25/*
26 * skb_migrate appends the list at "from" to "to", emptying "from" in the
27 * process. skb_migrate is atomic with respect to all other skb operations on
28 * "from" and "to". Note that it locks both lists at the same time, so to deal
29 * with the lock ordering, the locks are taken in address order.
30 *
31 * This function should live in skbuff.c or skbuff.h.
32 */
33
34
35void skb_migrate(struct sk_buff_head *from, struct sk_buff_head *to)
36{
37 unsigned long flags;
38 struct sk_buff *skb_from = (struct sk_buff *) from;
39 struct sk_buff *skb_to = (struct sk_buff *) to;
40 struct sk_buff *prev;
41
42 if ((unsigned long) from < (unsigned long) to) {
43 spin_lock_irqsave(&from->lock, flags);
44 spin_lock_nested(&to->lock, SINGLE_DEPTH_NESTING);
45 } else {
46 spin_lock_irqsave(&to->lock, flags);
47 spin_lock_nested(&from->lock, SINGLE_DEPTH_NESTING);
48 }
49 prev = from->prev;
50 from->next->prev = to->prev;
51 prev->next = skb_to;
52 to->prev->next = from->next;
53 to->prev = from->prev;
54 to->qlen += from->qlen;
55 spin_unlock(&to->lock);
56 from->prev = skb_from;
57 from->next = skb_from;
58 from->qlen = 0;
59 spin_unlock_irqrestore(&from->lock, flags);
60}
61
62
63EXPORT_SYMBOL(skb_migrate);
diff --git a/net/atm/ipcommon.h b/net/atm/ipcommon.h
deleted file mode 100644
index d72165f60939..000000000000
--- a/net/atm/ipcommon.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/* net/atm/ipcommon.h - Common items for all ways of doing IP over ATM */
2
3/* Written 1996-2000 by Werner Almesberger, EPFL LRC/ICA */
4
5
6#ifndef NET_ATM_IPCOMMON_H
7#define NET_ATM_IPCOMMON_H
8
9
10#include <linux/string.h>
11#include <linux/skbuff.h>
12#include <linux/netdevice.h>
13#include <linux/atmdev.h>
14
15/*
16 * Appends all skbs from "from" to "to". The operation is atomic with respect
17 * to all other skb operations on "from" or "to".
18 */
19
20void skb_migrate(struct sk_buff_head *from,struct sk_buff_head *to);
21
22#endif
diff --git a/net/atm/lec.c b/net/atm/lec.c
index e801fff69dc0..3fc0abeeaf34 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -204,9 +204,9 @@ static unsigned char *get_tr_dst(unsigned char *packet, unsigned char *rdesc)
204 memset(rdesc, 0, ETH_ALEN); 204 memset(rdesc, 0, ETH_ALEN);
205 /* offset 4 comes from LAN destination field in LE control frames */ 205 /* offset 4 comes from LAN destination field in LE control frames */
206 if (trh->rcf & htons((uint16_t) TR_RCF_DIR_BIT)) 206 if (trh->rcf & htons((uint16_t) TR_RCF_DIR_BIT))
207 memcpy(&rdesc[4], &trh->rseg[num_rdsc - 2], sizeof(uint16_t)); 207 memcpy(&rdesc[4], &trh->rseg[num_rdsc - 2], sizeof(__be16));
208 else { 208 else {
209 memcpy(&rdesc[4], &trh->rseg[1], sizeof(uint16_t)); 209 memcpy(&rdesc[4], &trh->rseg[1], sizeof(__be16));
210 rdesc[5] = ((ntohs(trh->rseg[0]) & 0x000f) | (rdesc[5] & 0xf0)); 210 rdesc[5] = ((ntohs(trh->rseg[0]) & 0x000f) | (rdesc[5] & 0xf0));
211 } 211 }
212 212
@@ -775,7 +775,7 @@ static void lec_push(struct atm_vcc *vcc, struct sk_buff *skb)
775 unsigned char *src, *dst; 775 unsigned char *src, *dst;
776 776
777 atm_return(vcc, skb->truesize); 777 atm_return(vcc, skb->truesize);
778 if (*(uint16_t *) skb->data == htons(priv->lecid) || 778 if (*(__be16 *) skb->data == htons(priv->lecid) ||
779 !priv->lecd || !(dev->flags & IFF_UP)) { 779 !priv->lecd || !(dev->flags & IFF_UP)) {
780 /* 780 /*
781 * Probably looping back, or if lecd is missing, 781 * Probably looping back, or if lecd is missing,
@@ -1321,11 +1321,10 @@ static int lane2_resolve(struct net_device *dev, u8 *dst_mac, int force,
1321 if (table == NULL) 1321 if (table == NULL)
1322 return -1; 1322 return -1;
1323 1323
1324 *tlvs = kmalloc(table->sizeoftlvs, GFP_ATOMIC); 1324 *tlvs = kmemdup(table->tlvs, table->sizeoftlvs, GFP_ATOMIC);
1325 if (*tlvs == NULL) 1325 if (*tlvs == NULL)
1326 return -1; 1326 return -1;
1327 1327
1328 memcpy(*tlvs, table->tlvs, table->sizeoftlvs);
1329 *sizeoftlvs = table->sizeoftlvs; 1328 *sizeoftlvs = table->sizeoftlvs;
1330 1329
1331 return 0; 1330 return 0;
@@ -1364,11 +1363,10 @@ static int lane2_associate_req(struct net_device *dev, u8 *lan_dst,
1364 1363
1365 kfree(priv->tlvs); /* NULL if there was no previous association */ 1364 kfree(priv->tlvs); /* NULL if there was no previous association */
1366 1365
1367 priv->tlvs = kmalloc(sizeoftlvs, GFP_KERNEL); 1366 priv->tlvs = kmemdup(tlvs, sizeoftlvs, GFP_KERNEL);
1368 if (priv->tlvs == NULL) 1367 if (priv->tlvs == NULL)
1369 return (0); 1368 return (0);
1370 priv->sizeoftlvs = sizeoftlvs; 1369 priv->sizeoftlvs = sizeoftlvs;
1371 memcpy(priv->tlvs, tlvs, sizeoftlvs);
1372 1370
1373 skb = alloc_skb(sizeoftlvs, GFP_ATOMIC); 1371 skb = alloc_skb(sizeoftlvs, GFP_ATOMIC);
1374 if (skb == NULL) 1372 if (skb == NULL)
@@ -1409,12 +1407,10 @@ static void lane2_associate_ind(struct net_device *dev, u8 *mac_addr,
1409 1407
1410 kfree(entry->tlvs); 1408 kfree(entry->tlvs);
1411 1409
1412 entry->tlvs = kmalloc(sizeoftlvs, GFP_KERNEL); 1410 entry->tlvs = kmemdup(tlvs, sizeoftlvs, GFP_KERNEL);
1413 if (entry->tlvs == NULL) 1411 if (entry->tlvs == NULL)
1414 return; 1412 return;
1415
1416 entry->sizeoftlvs = sizeoftlvs; 1413 entry->sizeoftlvs = sizeoftlvs;
1417 memcpy(entry->tlvs, tlvs, sizeoftlvs);
1418#endif 1414#endif
1419#if 0 1415#if 0
1420 printk("lec.c: lane2_associate_ind()\n"); 1416 printk("lec.c: lane2_associate_ind()\n");
diff --git a/net/atm/lec.h b/net/atm/lec.h
index 984e8e6e083a..99136babd535 100644
--- a/net/atm/lec.h
+++ b/net/atm/lec.h
@@ -14,14 +14,14 @@
14#define LEC_HEADER_LEN 16 14#define LEC_HEADER_LEN 16
15 15
16struct lecdatahdr_8023 { 16struct lecdatahdr_8023 {
17 unsigned short le_header; 17 __be16 le_header;
18 unsigned char h_dest[ETH_ALEN]; 18 unsigned char h_dest[ETH_ALEN];
19 unsigned char h_source[ETH_ALEN]; 19 unsigned char h_source[ETH_ALEN];
20 unsigned short h_type; 20 __be16 h_type;
21}; 21};
22 22
23struct lecdatahdr_8025 { 23struct lecdatahdr_8025 {
24 unsigned short le_header; 24 __be16 le_header;
25 unsigned char ac_pad; 25 unsigned char ac_pad;
26 unsigned char fc; 26 unsigned char fc;
27 unsigned char h_dest[ETH_ALEN]; 27 unsigned char h_dest[ETH_ALEN];
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index 0d2b994af511..c18f73715ef9 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -152,7 +152,7 @@ static struct mpoa_client *find_mpc_by_lec(struct net_device *dev)
152/* 152/*
153 * Overwrites the old entry or makes a new one. 153 * Overwrites the old entry or makes a new one.
154 */ 154 */
155struct atm_mpoa_qos *atm_mpoa_add_qos(uint32_t dst_ip, struct atm_qos *qos) 155struct atm_mpoa_qos *atm_mpoa_add_qos(__be32 dst_ip, struct atm_qos *qos)
156{ 156{
157 struct atm_mpoa_qos *entry; 157 struct atm_mpoa_qos *entry;
158 158
@@ -177,7 +177,7 @@ struct atm_mpoa_qos *atm_mpoa_add_qos(uint32_t dst_ip, struct atm_qos *qos)
177 return entry; 177 return entry;
178} 178}
179 179
180struct atm_mpoa_qos *atm_mpoa_search_qos(uint32_t dst_ip) 180struct atm_mpoa_qos *atm_mpoa_search_qos(__be32 dst_ip)
181{ 181{
182 struct atm_mpoa_qos *qos; 182 struct atm_mpoa_qos *qos;
183 183
@@ -460,11 +460,11 @@ static int send_via_shortcut(struct sk_buff *skb, struct mpoa_client *mpc)
460 in_cache_entry *entry; 460 in_cache_entry *entry;
461 struct iphdr *iph; 461 struct iphdr *iph;
462 char *buff; 462 char *buff;
463 uint32_t ipaddr = 0; 463 __be32 ipaddr = 0;
464 464
465 static struct { 465 static struct {
466 struct llc_snap_hdr hdr; 466 struct llc_snap_hdr hdr;
467 uint32_t tag; 467 __be32 tag;
468 } tagged_llc_snap_hdr = { 468 } tagged_llc_snap_hdr = {
469 {0xaa, 0xaa, 0x03, {0x00, 0x00, 0x00}, {0x88, 0x4c}}, 469 {0xaa, 0xaa, 0x03, {0x00, 0x00, 0x00}, {0x88, 0x4c}},
470 0 470 0
@@ -559,7 +559,7 @@ static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg)
559 struct mpoa_client *mpc; 559 struct mpoa_client *mpc;
560 struct atmmpc_ioc ioc_data; 560 struct atmmpc_ioc ioc_data;
561 in_cache_entry *in_entry; 561 in_cache_entry *in_entry;
562 uint32_t ipaddr; 562 __be32 ipaddr;
563 563
564 bytes_left = copy_from_user(&ioc_data, arg, sizeof(struct atmmpc_ioc)); 564 bytes_left = copy_from_user(&ioc_data, arg, sizeof(struct atmmpc_ioc));
565 if (bytes_left != 0) { 565 if (bytes_left != 0) {
@@ -638,7 +638,7 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb)
638 struct sk_buff *new_skb; 638 struct sk_buff *new_skb;
639 eg_cache_entry *eg; 639 eg_cache_entry *eg;
640 struct mpoa_client *mpc; 640 struct mpoa_client *mpc;
641 uint32_t tag; 641 __be32 tag;
642 char *tmp; 642 char *tmp;
643 643
644 ddprintk("mpoa: (%s) mpc_push:\n", dev->name); 644 ddprintk("mpoa: (%s) mpc_push:\n", dev->name);
@@ -683,7 +683,7 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb)
683 } 683 }
684 684
685 tmp = skb->data + sizeof(struct llc_snap_hdr); 685 tmp = skb->data + sizeof(struct llc_snap_hdr);
686 tag = *(uint32_t *)tmp; 686 tag = *(__be32 *)tmp;
687 687
688 eg = mpc->eg_ops->get_by_tag(tag, mpc); 688 eg = mpc->eg_ops->get_by_tag(tag, mpc);
689 if (eg == NULL) { 689 if (eg == NULL) {
@@ -1029,7 +1029,7 @@ static int mpoa_event_listener(struct notifier_block *mpoa_notifier, unsigned lo
1029 1029
1030static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc) 1030static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc)
1031{ 1031{
1032 uint32_t dst_ip = msg->content.in_info.in_dst_ip; 1032 __be32 dst_ip = msg->content.in_info.in_dst_ip;
1033 in_cache_entry *entry; 1033 in_cache_entry *entry;
1034 1034
1035 entry = mpc->in_ops->get(dst_ip, mpc); 1035 entry = mpc->in_ops->get(dst_ip, mpc);
@@ -1066,7 +1066,7 @@ static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc)
1066 */ 1066 */
1067static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_client *client, in_cache_entry *entry) 1067static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_client *client, in_cache_entry *entry)
1068{ 1068{
1069 uint32_t dst_ip = msg->content.in_info.in_dst_ip; 1069 __be32 dst_ip = msg->content.in_info.in_dst_ip;
1070 struct atm_mpoa_qos *qos = atm_mpoa_search_qos(dst_ip); 1070 struct atm_mpoa_qos *qos = atm_mpoa_search_qos(dst_ip);
1071 eg_cache_entry *eg_entry = client->eg_ops->get_by_src_ip(dst_ip, client); 1071 eg_cache_entry *eg_entry = client->eg_ops->get_by_src_ip(dst_ip, client);
1072 1072
@@ -1102,7 +1102,7 @@ static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_clien
1102 1102
1103static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc) 1103static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc)
1104{ 1104{
1105 uint32_t dst_ip = msg->content.in_info.in_dst_ip; 1105 __be32 dst_ip = msg->content.in_info.in_dst_ip;
1106 in_cache_entry *entry = mpc->in_ops->get(dst_ip, mpc); 1106 in_cache_entry *entry = mpc->in_ops->get(dst_ip, mpc);
1107 1107
1108 dprintk("mpoa: (%s) MPOA_res_reply_rcvd: ip %u.%u.%u.%u\n", mpc->dev->name, NIPQUAD(dst_ip)); 1108 dprintk("mpoa: (%s) MPOA_res_reply_rcvd: ip %u.%u.%u.%u\n", mpc->dev->name, NIPQUAD(dst_ip));
@@ -1148,8 +1148,8 @@ static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc)
1148 1148
1149static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc) 1149static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc)
1150{ 1150{
1151 uint32_t dst_ip = msg->content.in_info.in_dst_ip; 1151 __be32 dst_ip = msg->content.in_info.in_dst_ip;
1152 uint32_t mask = msg->ip_mask; 1152 __be32 mask = msg->ip_mask;
1153 in_cache_entry *entry = mpc->in_ops->get_with_mask(dst_ip, mpc, mask); 1153 in_cache_entry *entry = mpc->in_ops->get_with_mask(dst_ip, mpc, mask);
1154 1154
1155 if(entry == NULL){ 1155 if(entry == NULL){
@@ -1173,7 +1173,7 @@ static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc)
1173 1173
1174static void egress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc) 1174static void egress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc)
1175{ 1175{
1176 uint32_t cache_id = msg->content.eg_info.cache_id; 1176 __be32 cache_id = msg->content.eg_info.cache_id;
1177 eg_cache_entry *entry = mpc->eg_ops->get_by_cache_id(cache_id, mpc); 1177 eg_cache_entry *entry = mpc->eg_ops->get_by_cache_id(cache_id, mpc);
1178 1178
1179 if (entry == NULL) { 1179 if (entry == NULL) {
@@ -1322,13 +1322,12 @@ static void set_mps_mac_addr_rcvd(struct k_message *msg, struct mpoa_client *cli
1322 if(client->number_of_mps_macs) 1322 if(client->number_of_mps_macs)
1323 kfree(client->mps_macs); 1323 kfree(client->mps_macs);
1324 client->number_of_mps_macs = 0; 1324 client->number_of_mps_macs = 0;
1325 client->mps_macs = kmalloc(ETH_ALEN,GFP_KERNEL); 1325 client->mps_macs = kmemdup(msg->MPS_ctrl, ETH_ALEN, GFP_KERNEL);
1326 if (client->mps_macs == NULL) { 1326 if (client->mps_macs == NULL) {
1327 printk("mpoa: set_mps_mac_addr_rcvd: out of memory\n"); 1327 printk("mpoa: set_mps_mac_addr_rcvd: out of memory\n");
1328 return; 1328 return;
1329 } 1329 }
1330 client->number_of_mps_macs = 1; 1330 client->number_of_mps_macs = 1;
1331 memcpy(client->mps_macs, msg->MPS_ctrl, ETH_ALEN);
1332 1331
1333 return; 1332 return;
1334} 1333}
diff --git a/net/atm/mpc.h b/net/atm/mpc.h
index 3c7981a229e8..51f460d005c3 100644
--- a/net/atm/mpc.h
+++ b/net/atm/mpc.h
@@ -36,14 +36,14 @@ struct mpoa_client {
36 36
37struct atm_mpoa_qos { 37struct atm_mpoa_qos {
38 struct atm_mpoa_qos *next; 38 struct atm_mpoa_qos *next;
39 uint32_t ipaddr; 39 __be32 ipaddr;
40 struct atm_qos qos; 40 struct atm_qos qos;
41}; 41};
42 42
43 43
44/* MPOA QoS operations */ 44/* MPOA QoS operations */
45struct atm_mpoa_qos *atm_mpoa_add_qos(uint32_t dst_ip, struct atm_qos *qos); 45struct atm_mpoa_qos *atm_mpoa_add_qos(__be32 dst_ip, struct atm_qos *qos);
46struct atm_mpoa_qos *atm_mpoa_search_qos(uint32_t dst_ip); 46struct atm_mpoa_qos *atm_mpoa_search_qos(__be32 dst_ip);
47int atm_mpoa_delete_qos(struct atm_mpoa_qos *qos); 47int atm_mpoa_delete_qos(struct atm_mpoa_qos *qos);
48 48
49/* Display QoS entries. This is for the procfs */ 49/* Display QoS entries. This is for the procfs */
diff --git a/net/atm/mpoa_caches.c b/net/atm/mpoa_caches.c
index fbf13cdcf46e..697a081533b5 100644
--- a/net/atm/mpoa_caches.c
+++ b/net/atm/mpoa_caches.c
@@ -22,7 +22,7 @@
22#define ddprintk(format,args...) 22#define ddprintk(format,args...)
23#endif 23#endif
24 24
25static in_cache_entry *in_cache_get(uint32_t dst_ip, 25static in_cache_entry *in_cache_get(__be32 dst_ip,
26 struct mpoa_client *client) 26 struct mpoa_client *client)
27{ 27{
28 in_cache_entry *entry; 28 in_cache_entry *entry;
@@ -42,9 +42,9 @@ static in_cache_entry *in_cache_get(uint32_t dst_ip,
42 return NULL; 42 return NULL;
43} 43}
44 44
45static in_cache_entry *in_cache_get_with_mask(uint32_t dst_ip, 45static in_cache_entry *in_cache_get_with_mask(__be32 dst_ip,
46 struct mpoa_client *client, 46 struct mpoa_client *client,
47 uint32_t mask) 47 __be32 mask)
48{ 48{
49 in_cache_entry *entry; 49 in_cache_entry *entry;
50 50
@@ -84,10 +84,10 @@ static in_cache_entry *in_cache_get_by_vcc(struct atm_vcc *vcc,
84 return NULL; 84 return NULL;
85} 85}
86 86
87static in_cache_entry *in_cache_add_entry(uint32_t dst_ip, 87static in_cache_entry *in_cache_add_entry(__be32 dst_ip,
88 struct mpoa_client *client) 88 struct mpoa_client *client)
89{ 89{
90 in_cache_entry* entry = kmalloc(sizeof(in_cache_entry), GFP_KERNEL); 90 in_cache_entry *entry = kzalloc(sizeof(in_cache_entry), GFP_KERNEL);
91 91
92 if (entry == NULL) { 92 if (entry == NULL) {
93 printk("mpoa: mpoa_caches.c: new_in_cache_entry: out of memory\n"); 93 printk("mpoa: mpoa_caches.c: new_in_cache_entry: out of memory\n");
@@ -95,7 +95,6 @@ static in_cache_entry *in_cache_add_entry(uint32_t dst_ip,
95 } 95 }
96 96
97 dprintk("mpoa: mpoa_caches.c: adding an ingress entry, ip = %u.%u.%u.%u\n", NIPQUAD(dst_ip)); 97 dprintk("mpoa: mpoa_caches.c: adding an ingress entry, ip = %u.%u.%u.%u\n", NIPQUAD(dst_ip));
98 memset(entry,0,sizeof(in_cache_entry));
99 98
100 atomic_set(&entry->use, 1); 99 atomic_set(&entry->use, 1);
101 dprintk("mpoa: mpoa_caches.c: new_in_cache_entry: about to lock\n"); 100 dprintk("mpoa: mpoa_caches.c: new_in_cache_entry: about to lock\n");
@@ -319,7 +318,7 @@ static void in_destroy_cache(struct mpoa_client *mpc)
319 return; 318 return;
320} 319}
321 320
322static eg_cache_entry *eg_cache_get_by_cache_id(uint32_t cache_id, struct mpoa_client *mpc) 321static eg_cache_entry *eg_cache_get_by_cache_id(__be32 cache_id, struct mpoa_client *mpc)
323{ 322{
324 eg_cache_entry *entry; 323 eg_cache_entry *entry;
325 324
@@ -339,7 +338,7 @@ static eg_cache_entry *eg_cache_get_by_cache_id(uint32_t cache_id, struct mpoa_c
339} 338}
340 339
341/* This can be called from any context since it saves CPU flags */ 340/* This can be called from any context since it saves CPU flags */
342static eg_cache_entry *eg_cache_get_by_tag(uint32_t tag, struct mpoa_client *mpc) 341static eg_cache_entry *eg_cache_get_by_tag(__be32 tag, struct mpoa_client *mpc)
343{ 342{
344 unsigned long flags; 343 unsigned long flags;
345 eg_cache_entry *entry; 344 eg_cache_entry *entry;
@@ -380,7 +379,7 @@ static eg_cache_entry *eg_cache_get_by_vcc(struct atm_vcc *vcc, struct mpoa_clie
380 return NULL; 379 return NULL;
381} 380}
382 381
383static eg_cache_entry *eg_cache_get_by_src_ip(uint32_t ipaddr, struct mpoa_client *mpc) 382static eg_cache_entry *eg_cache_get_by_src_ip(__be32 ipaddr, struct mpoa_client *mpc)
384{ 383{
385 eg_cache_entry *entry; 384 eg_cache_entry *entry;
386 385
@@ -447,7 +446,7 @@ static void eg_cache_remove_entry(eg_cache_entry *entry,
447 446
448static eg_cache_entry *eg_cache_add_entry(struct k_message *msg, struct mpoa_client *client) 447static eg_cache_entry *eg_cache_add_entry(struct k_message *msg, struct mpoa_client *client)
449{ 448{
450 eg_cache_entry *entry = kmalloc(sizeof(eg_cache_entry), GFP_KERNEL); 449 eg_cache_entry *entry = kzalloc(sizeof(eg_cache_entry), GFP_KERNEL);
451 450
452 if (entry == NULL) { 451 if (entry == NULL) {
453 printk("mpoa: mpoa_caches.c: new_eg_cache_entry: out of memory\n"); 452 printk("mpoa: mpoa_caches.c: new_eg_cache_entry: out of memory\n");
@@ -455,7 +454,6 @@ static eg_cache_entry *eg_cache_add_entry(struct k_message *msg, struct mpoa_cli
455 } 454 }
456 455
457 dprintk("mpoa: mpoa_caches.c: adding an egress entry, ip = %u.%u.%u.%u, this should be our IP\n", NIPQUAD(msg->content.eg_info.eg_dst_ip)); 456 dprintk("mpoa: mpoa_caches.c: adding an egress entry, ip = %u.%u.%u.%u, this should be our IP\n", NIPQUAD(msg->content.eg_info.eg_dst_ip));
458 memset(entry, 0, sizeof(eg_cache_entry));
459 457
460 atomic_set(&entry->use, 1); 458 atomic_set(&entry->use, 1);
461 dprintk("mpoa: mpoa_caches.c: new_eg_cache_entry: about to lock\n"); 459 dprintk("mpoa: mpoa_caches.c: new_eg_cache_entry: about to lock\n");
diff --git a/net/atm/mpoa_caches.h b/net/atm/mpoa_caches.h
index 6c9886a03d0b..84de977def2e 100644
--- a/net/atm/mpoa_caches.h
+++ b/net/atm/mpoa_caches.h
@@ -29,12 +29,12 @@ typedef struct in_cache_entry {
29} in_cache_entry; 29} in_cache_entry;
30 30
31struct in_cache_ops{ 31struct in_cache_ops{
32 in_cache_entry *(*add_entry)(uint32_t dst_ip, 32 in_cache_entry *(*add_entry)(__be32 dst_ip,
33 struct mpoa_client *client); 33 struct mpoa_client *client);
34 in_cache_entry *(*get)(uint32_t dst_ip, struct mpoa_client *client); 34 in_cache_entry *(*get)(__be32 dst_ip, struct mpoa_client *client);
35 in_cache_entry *(*get_with_mask)(uint32_t dst_ip, 35 in_cache_entry *(*get_with_mask)(__be32 dst_ip,
36 struct mpoa_client *client, 36 struct mpoa_client *client,
37 uint32_t mask); 37 __be32 mask);
38 in_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc, 38 in_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc,
39 struct mpoa_client *client); 39 struct mpoa_client *client);
40 void (*put)(in_cache_entry *entry); 40 void (*put)(in_cache_entry *entry);
@@ -56,17 +56,17 @@ typedef struct eg_cache_entry{
56 struct atm_vcc *shortcut; 56 struct atm_vcc *shortcut;
57 uint32_t packets_rcvd; 57 uint32_t packets_rcvd;
58 uint16_t entry_state; 58 uint16_t entry_state;
59 uint32_t latest_ip_addr; /* The src IP address of the last packet */ 59 __be32 latest_ip_addr; /* The src IP address of the last packet */
60 struct eg_ctrl_info ctrl_info; 60 struct eg_ctrl_info ctrl_info;
61 atomic_t use; 61 atomic_t use;
62} eg_cache_entry; 62} eg_cache_entry;
63 63
64struct eg_cache_ops{ 64struct eg_cache_ops{
65 eg_cache_entry *(*add_entry)(struct k_message *msg, struct mpoa_client *client); 65 eg_cache_entry *(*add_entry)(struct k_message *msg, struct mpoa_client *client);
66 eg_cache_entry *(*get_by_cache_id)(uint32_t cache_id, struct mpoa_client *client); 66 eg_cache_entry *(*get_by_cache_id)(__be32 cache_id, struct mpoa_client *client);
67 eg_cache_entry *(*get_by_tag)(uint32_t cache_id, struct mpoa_client *client); 67 eg_cache_entry *(*get_by_tag)(__be32 cache_id, struct mpoa_client *client);
68 eg_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc, struct mpoa_client *client); 68 eg_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc, struct mpoa_client *client);
69 eg_cache_entry *(*get_by_src_ip)(uint32_t ipaddr, struct mpoa_client *client); 69 eg_cache_entry *(*get_by_src_ip)(__be32 ipaddr, struct mpoa_client *client);
70 void (*put)(eg_cache_entry *entry); 70 void (*put)(eg_cache_entry *entry);
71 void (*remove_entry)(eg_cache_entry *entry, struct mpoa_client *client); 71 void (*remove_entry)(eg_cache_entry *entry, struct mpoa_client *client);
72 void (*update)(eg_cache_entry *entry, uint16_t holding_time); 72 void (*update)(eg_cache_entry *entry, uint16_t holding_time);
diff --git a/net/atm/mpoa_proc.c b/net/atm/mpoa_proc.c
index d37b8911b3ab..3844c85d602f 100644
--- a/net/atm/mpoa_proc.c
+++ b/net/atm/mpoa_proc.c
@@ -231,14 +231,14 @@ static int parse_qos(const char *buff)
231 */ 231 */
232 unsigned char ip[4]; 232 unsigned char ip[4];
233 int tx_pcr, tx_sdu, rx_pcr, rx_sdu; 233 int tx_pcr, tx_sdu, rx_pcr, rx_sdu;
234 uint32_t ipaddr; 234 __be32 ipaddr;
235 struct atm_qos qos; 235 struct atm_qos qos;
236 236
237 memset(&qos, 0, sizeof(struct atm_qos)); 237 memset(&qos, 0, sizeof(struct atm_qos));
238 238
239 if (sscanf(buff, "del %hhu.%hhu.%hhu.%hhu", 239 if (sscanf(buff, "del %hhu.%hhu.%hhu.%hhu",
240 ip, ip+1, ip+2, ip+3) == 4) { 240 ip, ip+1, ip+2, ip+3) == 4) {
241 ipaddr = *(uint32_t *)ip; 241 ipaddr = *(__be32 *)ip;
242 return atm_mpoa_delete_qos(atm_mpoa_search_qos(ipaddr)); 242 return atm_mpoa_delete_qos(atm_mpoa_search_qos(ipaddr));
243 } 243 }
244 244
@@ -250,7 +250,7 @@ static int parse_qos(const char *buff)
250 ip, ip+1, ip+2, ip+3, &tx_pcr, &tx_sdu, &rx_pcr, &rx_sdu) != 8) 250 ip, ip+1, ip+2, ip+3, &tx_pcr, &tx_sdu, &rx_pcr, &rx_sdu) != 8)
251 return 0; 251 return 0;
252 252
253 ipaddr = *(uint32_t *)ip; 253 ipaddr = *(__be32 *)ip;
254 qos.txtp.traffic_class = ATM_CBR; 254 qos.txtp.traffic_class = ATM_CBR;
255 qos.txtp.max_pcr = tx_pcr; 255 qos.txtp.max_pcr = tx_pcr;
256 qos.txtp.max_sdu = tx_sdu; 256 qos.txtp.max_sdu = tx_sdu;