only do hotplug2 init if hotplug2 is present
[openwrt.git] / target / linux / brcm63xx / patches / 100-atm_hacks.patch
1 diff -urN linux-2.6.19.1/include/linux/atm.h linux-2.6.19.1.new/include/linux/atm.h
2 --- linux-2.6.19.1/include/linux/atm.h 2006-12-11 20:32:53.000000000 +0100
3 +++ linux-2.6.19.1.new/include/linux/atm.h 2007-01-07 18:38:50.000000000 +0100
4 @@ -48,6 +48,9 @@
5 #define ATM_AAL2 2 /* AAL2 (VBR) */
6 #define ATM_AAL34 3 /* AAL3/4 (data) */
7 #define ATM_AAL5 5 /* AAL5 (data) */
8 +#if defined(CONFIG_MIPS_BCM963XX)
9 +#define ATM_BCM_AAL0 14 /* "raw" ATM cells */
10 +#endif
11
12 /*
13 * socket option name coding functions
14 diff -urN linux-2.6.19.1/include/linux/atmbr2684.h linux-2.6.19.1.new/include/linux/atmbr2684.h
15 --- linux-2.6.19.1/include/linux/atmbr2684.h 2006-12-11 20:32:53.000000000 +0100
16 +++ linux-2.6.19.1.new/include/linux/atmbr2684.h 2007-01-07 18:24:01.000000000 +0100
17 @@ -78,6 +78,10 @@
18 __u8 vpn_id[7];
19 int send_padding; /* unsupported */
20 int min_size; /* we will pad smaller packets than this */
21 +#if defined(CONFIG_MIPS_BCM963XX)
22 +#define FILTER_PPPOE 1
23 + int proto_filter; /* protocol filter flag, current only PPPoE */
24 +#endif
25 };
26
27 /*
28 diff -urN linux-2.6.19.1/include/linux/atmdev.h linux-2.6.19.1.new/include/linux/atmdev.h
29 --- linux-2.6.19.1/include/linux/atmdev.h 2006-12-11 20:32:53.000000000 +0100
30 +++ linux-2.6.19.1.new/include/linux/atmdev.h 2007-01-07 18:37:34.000000000 +0100
31 @@ -29,6 +29,10 @@
32 #define ATM_DS3_PCR (8000*12)
33 /* DS3: 12 cells in a 125 usec time slot */
34
35 +#if defined(CONFIG_MIPS_BCM963XX)
36 +#define atm_sk(__sk) ((struct atm_vcc *)(__sk)->sk_protinfo)
37 +#define ATM_SD(s) (atm_sk((s)->sk))
38 +#endif
39
40 #define __AAL_STAT_ITEMS \
41 __HANDLE_ITEM(tx); /* TX okay */ \
42 @@ -111,6 +115,9 @@
43 #define ATM_BACKEND_RAW 0
44 #define ATM_BACKEND_PPP 1 /* PPPoATM - RFC2364 */
45 #define ATM_BACKEND_BR2684 2 /* Bridged RFC1483/2684 */
46 +#if defined(CONFIG_MIPS_BCM963XX)
47 +#define ATM_BACKEND_RT2684 3 /* Routed RFC1483/2684 */
48 +#endif
49
50 /* for ATM_GETTYPE */
51 #define ATM_ITFTYP_LEN 8 /* maximum length of interface type name */
52 @@ -274,6 +281,9 @@
53
54
55 enum {
56 +#if defined(CONFIG_MIPS_BCM963XX)
57 + ATM_DF_CLOSE, /* close device when last VCC is closed */
58 +#endif
59 ATM_DF_REMOVED, /* device was removed from atm_devs list */
60 };
61
62 @@ -285,8 +295,10 @@
63 #define ATM_ATMOPT_CLP 1 /* set CLP bit */
64
65 struct atm_vcc {
66 +#if !defined(CONFIG_MIPS_BCM963XX)
67 /* struct sock has to be the first member of atm_vcc */
68 struct sock sk;
69 +#endif
70 unsigned long flags; /* VCC flags (ATM_VF_*) */
71 short vpi; /* VPI and VCI (types must be equal */
72 /* with sockaddr) */
73 @@ -303,6 +315,9 @@
74 void *dev_data; /* per-device data */
75 void *proto_data; /* per-protocol data */
76 struct k_atm_aal_stats *stats; /* pointer to AAL stats group */
77 +#if defined(CONFIG_MIPS_BCM963XX)
78 + struct sock *sk; /* socket backpointer */
79 +#endif
80 /* SVC part --- may move later ------------------------------------- */
81 short itf; /* interface number */
82 struct sockaddr_atmsvc local;
83 @@ -332,7 +347,11 @@
84
85 struct atm_dev_addr {
86 struct sockaddr_atmsvc addr; /* ATM address */
87 +#if defined(CONFIG_MIPS_BCM963XX)
88 + struct atm_dev_addr *next; /* next address */
89 +#else
90 struct list_head entry; /* next address */
91 +#endif
92 };
93
94 enum atm_addr_type_t { ATM_ADDR_LOCAL, ATM_ADDR_LECS };
95 @@ -346,8 +365,12 @@
96 void *dev_data; /* per-device data */
97 void *phy_data; /* private PHY date */
98 unsigned long flags; /* device flags (ATM_DF_*) */
99 +#if defined(CONFIG_MIPS_BCM963XX)
100 + struct atm_dev_addr *local; /* local ATM addresses */
101 +#else
102 struct list_head local; /* local ATM addresses */
103 struct list_head lecs; /* LECS ATM addresses learned via ILMI */
104 +#endif
105 unsigned char esi[ESI_LEN]; /* ESI ("MAC" addr) */
106 struct atm_cirange ci_range; /* VPI/VCI range */
107 struct k_atm_dev_stats stats; /* statistics */
108 @@ -359,7 +382,9 @@
109 struct proc_dir_entry *proc_entry; /* proc entry */
110 char *proc_name; /* proc entry name */
111 #endif
112 +#if !defined(CONFIG_MIPS_BCM963XX)
113 struct class_device class_dev; /* sysfs class device */
114 +#endif
115 struct list_head dev_list; /* linkage */
116 };
117
118 @@ -416,7 +441,13 @@
119 int number,unsigned long *flags); /* number == -1: pick first available */
120 struct atm_dev *atm_dev_lookup(int number);
121 void atm_dev_deregister(struct atm_dev *dev);
122 +#if defined(CONFIG_MIPS_BCM963XX)
123 +void shutdown_atm_dev(struct atm_dev *dev);
124 +#endif
125 void vcc_insert_socket(struct sock *sk);
126 +#if defined(CONFIG_MIPS_BCM963XX)
127 +void vcc_remove_socket(struct sock *sk);
128 +#endif
129
130
131 /*
132 @@ -432,20 +463,33 @@
133
134 static inline void atm_force_charge(struct atm_vcc *vcc,int truesize)
135 {
136 +#if defined(CONFIG_MIPS_BCM963XX)
137 + atomic_add(truesize, &vcc->sk->sk_rmem_alloc);
138 +#else
139 atomic_add(truesize, &sk_atm(vcc)->sk_rmem_alloc);
140 +#endif
141 }
142
143
144 static inline void atm_return(struct atm_vcc *vcc,int truesize)
145 {
146 +#if defined(CONFIG_MIPS_BCM963XX)
147 + atomic_sub(truesize, &vcc->sk->sk_rmem_alloc);
148 +#else
149 atomic_sub(truesize, &sk_atm(vcc)->sk_rmem_alloc);
150 +#endif
151 }
152
153
154 static inline int atm_may_send(struct atm_vcc *vcc,unsigned int size)
155 {
156 +#if defined(CONFIG_MIPS_BCM963XX)
157 + return (size + atomic_read(&vcc->sk->sk_wmem_alloc)) <
158 + vcc->sk->sk_sndbuf;
159 +#else
160 return (size + atomic_read(&sk_atm(vcc)->sk_wmem_alloc)) <
161 sk_atm(vcc)->sk_sndbuf;
162 +#endif
163 }
164
165
166 @@ -457,12 +501,20 @@
167
168 static inline void atm_dev_put(struct atm_dev *dev)
169 {
170 +#if defined(CONFIG_MIPS_BCM963XX)
171 + atomic_dec(&dev->refcnt);
172 +
173 + if ((atomic_read(&dev->refcnt) == 1) &&
174 + test_bit(ATM_DF_CLOSE,&dev->flags))
175 + shutdown_atm_dev(dev);
176 +#else
177 if (atomic_dec_and_test(&dev->refcnt)) {
178 BUG_ON(!test_bit(ATM_DF_REMOVED, &dev->flags));
179 if (dev->ops->dev_close)
180 dev->ops->dev_close(dev);
181 class_device_put(&dev->class_dev);
182 }
183 +#endif
184 }
185
186
This page took 0.05322 seconds and 5 git commands to generate.