diff options
author | Stephen Hemminger <shemminger@osdl.org> | 2006-04-14 18:59:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-04-14 18:59:37 -0400 |
commit | e49e76db031fdfaadb4907a319ea3a1dc9d2925f (patch) | |
tree | 552320f27f1a62d7cbc09e7ba1c5bedeec82ad4a /net/atm | |
parent | 2d9073922bc73f8cb847ce354f0896205f6981a1 (diff) |
[ATM] clip: run through Lindent
Run CLIP driver through Lindent script to fix formatting.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/atm')
-rw-r--r-- | net/atm/clip.c | 410 |
1 files changed, 199 insertions, 211 deletions
diff --git a/net/atm/clip.c b/net/atm/clip.c index b1f12f6c5fd6..00dddba67c81 100644 --- a/net/atm/clip.c +++ b/net/atm/clip.c | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ | 3 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ |
4 | 4 | ||
5 | |||
6 | #include <linux/config.h> | 5 | #include <linux/config.h> |
7 | #include <linux/string.h> | 6 | #include <linux/string.h> |
8 | #include <linux/errno.h> | 7 | #include <linux/errno.h> |
@@ -55,21 +54,23 @@ static struct atm_vcc *atmarpd; | |||
55 | static struct neigh_table clip_tbl; | 54 | static struct neigh_table clip_tbl; |
56 | static struct timer_list idle_timer; | 55 | static struct timer_list idle_timer; |
57 | 56 | ||
58 | static int to_atmarpd(enum atmarp_ctrl_type type,int itf,unsigned long ip) | 57 | static int to_atmarpd(enum atmarp_ctrl_type type, int itf, unsigned long ip) |
59 | { | 58 | { |
60 | struct sock *sk; | 59 | struct sock *sk; |
61 | struct atmarp_ctrl *ctrl; | 60 | struct atmarp_ctrl *ctrl; |
62 | struct sk_buff *skb; | 61 | struct sk_buff *skb; |
63 | 62 | ||
64 | DPRINTK("to_atmarpd(%d)\n",type); | 63 | DPRINTK("to_atmarpd(%d)\n", type); |
65 | if (!atmarpd) return -EUNATCH; | 64 | if (!atmarpd) |
65 | return -EUNATCH; | ||
66 | skb = alloc_skb(sizeof(struct atmarp_ctrl),GFP_ATOMIC); | 66 | skb = alloc_skb(sizeof(struct atmarp_ctrl),GFP_ATOMIC); |
67 | if (!skb) return -ENOMEM; | 67 | if (!skb) |
68 | return -ENOMEM; | ||
68 | ctrl = (struct atmarp_ctrl *) skb_put(skb,sizeof(struct atmarp_ctrl)); | 69 | ctrl = (struct atmarp_ctrl *) skb_put(skb,sizeof(struct atmarp_ctrl)); |
69 | ctrl->type = type; | 70 | ctrl->type = type; |
70 | ctrl->itf_num = itf; | 71 | ctrl->itf_num = itf; |
71 | ctrl->ip = ip; | 72 | ctrl->ip = ip; |
72 | atm_force_charge(atmarpd,skb->truesize); | 73 | atm_force_charge(atmarpd, skb->truesize); |
73 | 74 | ||
74 | sk = sk_atm(atmarpd); | 75 | sk = sk_atm(atmarpd); |
75 | skb_queue_tail(&sk->sk_receive_queue, skb); | 76 | skb_queue_tail(&sk->sk_receive_queue, skb); |
@@ -77,26 +78,24 @@ static int to_atmarpd(enum atmarp_ctrl_type type,int itf,unsigned long ip) | |||
77 | return 0; | 78 | return 0; |
78 | } | 79 | } |
79 | 80 | ||
80 | 81 | static void link_vcc(struct clip_vcc *clip_vcc, struct atmarp_entry *entry) | |
81 | static void link_vcc(struct clip_vcc *clip_vcc,struct atmarp_entry *entry) | ||
82 | { | 82 | { |
83 | DPRINTK("link_vcc %p to entry %p (neigh %p)\n",clip_vcc,entry, | 83 | DPRINTK("link_vcc %p to entry %p (neigh %p)\n", clip_vcc, entry, |
84 | entry->neigh); | 84 | entry->neigh); |
85 | clip_vcc->entry = entry; | 85 | clip_vcc->entry = entry; |
86 | clip_vcc->xoff = 0; /* @@@ may overrun buffer by one packet */ | 86 | clip_vcc->xoff = 0; /* @@@ may overrun buffer by one packet */ |
87 | clip_vcc->next = entry->vccs; | 87 | clip_vcc->next = entry->vccs; |
88 | entry->vccs = clip_vcc; | 88 | entry->vccs = clip_vcc; |
89 | entry->neigh->used = jiffies; | 89 | entry->neigh->used = jiffies; |
90 | } | 90 | } |
91 | 91 | ||
92 | |||
93 | static void unlink_clip_vcc(struct clip_vcc *clip_vcc) | 92 | static void unlink_clip_vcc(struct clip_vcc *clip_vcc) |
94 | { | 93 | { |
95 | struct atmarp_entry *entry = clip_vcc->entry; | 94 | struct atmarp_entry *entry = clip_vcc->entry; |
96 | struct clip_vcc **walk; | 95 | struct clip_vcc **walk; |
97 | 96 | ||
98 | if (!entry) { | 97 | if (!entry) { |
99 | printk(KERN_CRIT "!clip_vcc->entry (clip_vcc %p)\n",clip_vcc); | 98 | printk(KERN_CRIT "!clip_vcc->entry (clip_vcc %p)\n", clip_vcc); |
100 | return; | 99 | return; |
101 | } | 100 | } |
102 | spin_lock_bh(&entry->neigh->dev->xmit_lock); /* block clip_start_xmit() */ | 101 | spin_lock_bh(&entry->neigh->dev->xmit_lock); /* block clip_start_xmit() */ |
@@ -105,24 +104,24 @@ static void unlink_clip_vcc(struct clip_vcc *clip_vcc) | |||
105 | if (*walk == clip_vcc) { | 104 | if (*walk == clip_vcc) { |
106 | int error; | 105 | int error; |
107 | 106 | ||
108 | *walk = clip_vcc->next; /* atomic */ | 107 | *walk = clip_vcc->next; /* atomic */ |
109 | clip_vcc->entry = NULL; | 108 | clip_vcc->entry = NULL; |
110 | if (clip_vcc->xoff) | 109 | if (clip_vcc->xoff) |
111 | netif_wake_queue(entry->neigh->dev); | 110 | netif_wake_queue(entry->neigh->dev); |
112 | if (entry->vccs) | 111 | if (entry->vccs) |
113 | goto out; | 112 | goto out; |
114 | entry->expires = jiffies-1; | 113 | entry->expires = jiffies - 1; |
115 | /* force resolution or expiration */ | 114 | /* force resolution or expiration */ |
116 | error = neigh_update(entry->neigh, NULL, NUD_NONE, | 115 | error = neigh_update(entry->neigh, NULL, NUD_NONE, |
117 | NEIGH_UPDATE_F_ADMIN); | 116 | NEIGH_UPDATE_F_ADMIN); |
118 | if (error) | 117 | if (error) |
119 | printk(KERN_CRIT "unlink_clip_vcc: " | 118 | printk(KERN_CRIT "unlink_clip_vcc: " |
120 | "neigh_update failed with %d\n",error); | 119 | "neigh_update failed with %d\n", error); |
121 | goto out; | 120 | goto out; |
122 | } | 121 | } |
123 | printk(KERN_CRIT "ATMARP: unlink_clip_vcc failed (entry %p, vcc " | 122 | printk(KERN_CRIT "ATMARP: unlink_clip_vcc failed (entry %p, vcc " |
124 | "0x%p)\n",entry,clip_vcc); | 123 | "0x%p)\n", entry, clip_vcc); |
125 | out: | 124 | out: |
126 | spin_unlock_bh(&entry->neigh->dev->xmit_lock); | 125 | spin_unlock_bh(&entry->neigh->dev->xmit_lock); |
127 | } | 126 | } |
128 | 127 | ||
@@ -151,13 +150,13 @@ static int neigh_check_cb(struct neighbour *n) | |||
151 | DPRINTK("destruction postponed with ref %d\n", | 150 | DPRINTK("destruction postponed with ref %d\n", |
152 | atomic_read(&n->refcnt)); | 151 | atomic_read(&n->refcnt)); |
153 | 152 | ||
154 | while ((skb = skb_dequeue(&n->arp_queue)) != NULL) | 153 | while ((skb = skb_dequeue(&n->arp_queue)) != NULL) |
155 | dev_kfree_skb(skb); | 154 | dev_kfree_skb(skb); |
156 | 155 | ||
157 | return 0; | 156 | return 0; |
158 | } | 157 | } |
159 | 158 | ||
160 | DPRINTK("expired neigh %p\n",n); | 159 | DPRINTK("expired neigh %p\n", n); |
161 | return 1; | 160 | return 1; |
162 | } | 161 | } |
163 | 162 | ||
@@ -165,7 +164,7 @@ static void idle_timer_check(unsigned long dummy) | |||
165 | { | 164 | { |
166 | write_lock(&clip_tbl.lock); | 165 | write_lock(&clip_tbl.lock); |
167 | __neigh_for_each_release(&clip_tbl, neigh_check_cb); | 166 | __neigh_for_each_release(&clip_tbl, neigh_check_cb); |
168 | mod_timer(&idle_timer, jiffies+CLIP_CHECK_INTERVAL*HZ); | 167 | mod_timer(&idle_timer, jiffies + CLIP_CHECK_INTERVAL * HZ); |
169 | write_unlock(&clip_tbl.lock); | 168 | write_unlock(&clip_tbl.lock); |
170 | } | 169 | } |
171 | 170 | ||
@@ -175,13 +174,13 @@ static int clip_arp_rcv(struct sk_buff *skb) | |||
175 | 174 | ||
176 | DPRINTK("clip_arp_rcv\n"); | 175 | DPRINTK("clip_arp_rcv\n"); |
177 | vcc = ATM_SKB(skb)->vcc; | 176 | vcc = ATM_SKB(skb)->vcc; |
178 | if (!vcc || !atm_charge(vcc,skb->truesize)) { | 177 | if (!vcc || !atm_charge(vcc, skb->truesize)) { |
179 | dev_kfree_skb_any(skb); | 178 | dev_kfree_skb_any(skb); |
180 | return 0; | 179 | return 0; |
181 | } | 180 | } |
182 | DPRINTK("pushing to %p\n",vcc); | 181 | DPRINTK("pushing to %p\n", vcc); |
183 | DPRINTK("using %p\n",CLIP_VCC(vcc)->old_push); | 182 | DPRINTK("using %p\n", CLIP_VCC(vcc)->old_push); |
184 | CLIP_VCC(vcc)->old_push(vcc,skb); | 183 | CLIP_VCC(vcc)->old_push(vcc, skb); |
185 | return 0; | 184 | return 0; |
186 | } | 185 | } |
187 | 186 | ||
@@ -191,34 +190,38 @@ static const unsigned char llc_oui[] = { | |||
191 | 0x03, /* Ctrl: Unnumbered Information Command PDU */ | 190 | 0x03, /* Ctrl: Unnumbered Information Command PDU */ |
192 | 0x00, /* OUI: EtherType */ | 191 | 0x00, /* OUI: EtherType */ |
193 | 0x00, | 192 | 0x00, |
194 | 0x00 }; | 193 | 0x00 |
194 | }; | ||
195 | 195 | ||
196 | static void clip_push(struct atm_vcc *vcc,struct sk_buff *skb) | 196 | static void clip_push(struct atm_vcc *vcc, struct sk_buff *skb) |
197 | { | 197 | { |
198 | struct clip_vcc *clip_vcc = CLIP_VCC(vcc); | 198 | struct clip_vcc *clip_vcc = CLIP_VCC(vcc); |
199 | 199 | ||
200 | DPRINTK("clip push\n"); | 200 | DPRINTK("clip push\n"); |
201 | if (!skb) { | 201 | if (!skb) { |
202 | DPRINTK("removing VCC %p\n",clip_vcc); | 202 | DPRINTK("removing VCC %p\n", clip_vcc); |
203 | if (clip_vcc->entry) unlink_clip_vcc(clip_vcc); | 203 | if (clip_vcc->entry) |
204 | clip_vcc->old_push(vcc,NULL); /* pass on the bad news */ | 204 | unlink_clip_vcc(clip_vcc); |
205 | clip_vcc->old_push(vcc, NULL); /* pass on the bad news */ | ||
205 | kfree(clip_vcc); | 206 | kfree(clip_vcc); |
206 | return; | 207 | return; |
207 | } | 208 | } |
208 | atm_return(vcc,skb->truesize); | 209 | atm_return(vcc, skb->truesize); |
209 | skb->dev = clip_vcc->entry ? clip_vcc->entry->neigh->dev : clip_devs; | 210 | skb->dev = clip_vcc->entry ? clip_vcc->entry->neigh->dev : clip_devs; |
210 | /* clip_vcc->entry == NULL if we don't have an IP address yet */ | 211 | /* clip_vcc->entry == NULL if we don't have an IP address yet */ |
211 | if (!skb->dev) { | 212 | if (!skb->dev) { |
212 | dev_kfree_skb_any(skb); | 213 | dev_kfree_skb_any(skb); |
213 | return; | 214 | return; |
214 | } | 215 | } |
215 | ATM_SKB(skb)->vcc = vcc; | 216 | ATM_SKB(skb)->vcc = vcc; |
216 | skb->mac.raw = skb->data; | 217 | skb->mac.raw = skb->data; |
217 | if (!clip_vcc->encap || skb->len < RFC1483LLC_LEN || memcmp(skb->data, | 218 | if (!clip_vcc->encap |
218 | llc_oui,sizeof(llc_oui))) skb->protocol = htons(ETH_P_IP); | 219 | || skb->len < RFC1483LLC_LEN |
220 | || memcmp(skb->data, llc_oui, sizeof (llc_oui))) | ||
221 | skb->protocol = htons(ETH_P_IP); | ||
219 | else { | 222 | else { |
220 | skb->protocol = ((u16 *) skb->data)[3]; | 223 | skb->protocol = ((u16 *) skb->data)[3]; |
221 | skb_pull(skb,RFC1483LLC_LEN); | 224 | skb_pull(skb, RFC1483LLC_LEN); |
222 | if (skb->protocol == htons(ETH_P_ARP)) { | 225 | if (skb->protocol == htons(ETH_P_ARP)) { |
223 | PRIV(skb->dev)->stats.rx_packets++; | 226 | PRIV(skb->dev)->stats.rx_packets++; |
224 | PRIV(skb->dev)->stats.rx_bytes += skb->len; | 227 | PRIV(skb->dev)->stats.rx_bytes += skb->len; |
@@ -233,58 +236,54 @@ static void clip_push(struct atm_vcc *vcc,struct sk_buff *skb) | |||
233 | netif_rx(skb); | 236 | netif_rx(skb); |
234 | } | 237 | } |
235 | 238 | ||
236 | |||
237 | /* | 239 | /* |
238 | * Note: these spinlocks _must_not_ block on non-SMP. The only goal is that | 240 | * Note: these spinlocks _must_not_ block on non-SMP. The only goal is that |
239 | * clip_pop is atomic with respect to the critical section in clip_start_xmit. | 241 | * clip_pop is atomic with respect to the critical section in clip_start_xmit. |
240 | */ | 242 | */ |
241 | 243 | ||
242 | 244 | static void clip_pop(struct atm_vcc *vcc, struct sk_buff *skb) | |
243 | static void clip_pop(struct atm_vcc *vcc,struct sk_buff *skb) | ||
244 | { | 245 | { |
245 | struct clip_vcc *clip_vcc = CLIP_VCC(vcc); | 246 | struct clip_vcc *clip_vcc = CLIP_VCC(vcc); |
246 | struct net_device *dev = skb->dev; | 247 | struct net_device *dev = skb->dev; |
247 | int old; | 248 | int old; |
248 | unsigned long flags; | 249 | unsigned long flags; |
249 | 250 | ||
250 | DPRINTK("clip_pop(vcc %p)\n",vcc); | 251 | DPRINTK("clip_pop(vcc %p)\n", vcc); |
251 | clip_vcc->old_pop(vcc,skb); | 252 | clip_vcc->old_pop(vcc, skb); |
252 | /* skb->dev == NULL in outbound ARP packets */ | 253 | /* skb->dev == NULL in outbound ARP packets */ |
253 | if (!dev) return; | 254 | if (!dev) |
254 | spin_lock_irqsave(&PRIV(dev)->xoff_lock,flags); | 255 | return; |
255 | if (atm_may_send(vcc,0)) { | 256 | spin_lock_irqsave(&PRIV(dev)->xoff_lock, flags); |
256 | old = xchg(&clip_vcc->xoff,0); | 257 | if (atm_may_send(vcc, 0)) { |
257 | if (old) netif_wake_queue(dev); | 258 | old = xchg(&clip_vcc->xoff, 0); |
259 | if (old) | ||
260 | netif_wake_queue(dev); | ||
258 | } | 261 | } |
259 | spin_unlock_irqrestore(&PRIV(dev)->xoff_lock,flags); | 262 | spin_unlock_irqrestore(&PRIV(dev)->xoff_lock, flags); |
260 | } | 263 | } |
261 | 264 | ||
262 | |||
263 | static void clip_neigh_destroy(struct neighbour *neigh) | 265 | static void clip_neigh_destroy(struct neighbour *neigh) |
264 | { | 266 | { |
265 | DPRINTK("clip_neigh_destroy (neigh %p)\n",neigh); | 267 | DPRINTK("clip_neigh_destroy (neigh %p)\n", neigh); |
266 | if (NEIGH2ENTRY(neigh)->vccs) | 268 | if (NEIGH2ENTRY(neigh)->vccs) |
267 | printk(KERN_CRIT "clip_neigh_destroy: vccs != NULL !!!\n"); | 269 | printk(KERN_CRIT "clip_neigh_destroy: vccs != NULL !!!\n"); |
268 | NEIGH2ENTRY(neigh)->vccs = (void *) 0xdeadbeef; | 270 | NEIGH2ENTRY(neigh)->vccs = (void *) 0xdeadbeef; |
269 | } | 271 | } |
270 | 272 | ||
271 | 273 | static void clip_neigh_solicit(struct neighbour *neigh, struct sk_buff *skb) | |
272 | static void clip_neigh_solicit(struct neighbour *neigh,struct sk_buff *skb) | ||
273 | { | 274 | { |
274 | DPRINTK("clip_neigh_solicit (neigh %p, skb %p)\n",neigh,skb); | 275 | DPRINTK("clip_neigh_solicit (neigh %p, skb %p)\n", neigh, skb); |
275 | to_atmarpd(act_need,PRIV(neigh->dev)->number,NEIGH2ENTRY(neigh)->ip); | 276 | to_atmarpd(act_need, PRIV(neigh->dev)->number, NEIGH2ENTRY(neigh)->ip); |
276 | } | 277 | } |
277 | 278 | ||
278 | 279 | static void clip_neigh_error(struct neighbour *neigh, struct sk_buff *skb) | |
279 | static void clip_neigh_error(struct neighbour *neigh,struct sk_buff *skb) | ||
280 | { | 280 | { |
281 | #ifndef CONFIG_ATM_CLIP_NO_ICMP | 281 | #ifndef CONFIG_ATM_CLIP_NO_ICMP |
282 | icmp_send(skb,ICMP_DEST_UNREACH,ICMP_HOST_UNREACH,0); | 282 | icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0); |
283 | #endif | 283 | #endif |
284 | kfree_skb(skb); | 284 | kfree_skb(skb); |
285 | } | 285 | } |
286 | 286 | ||
287 | |||
288 | static struct neigh_ops clip_neigh_ops = { | 287 | static struct neigh_ops clip_neigh_ops = { |
289 | .family = AF_INET, | 288 | .family = AF_INET, |
290 | .solicit = clip_neigh_solicit, | 289 | .solicit = clip_neigh_solicit, |
@@ -295,7 +294,6 @@ static struct neigh_ops clip_neigh_ops = { | |||
295 | .queue_xmit = dev_queue_xmit, | 294 | .queue_xmit = dev_queue_xmit, |
296 | }; | 295 | }; |
297 | 296 | ||
298 | |||
299 | static int clip_constructor(struct neighbour *neigh) | 297 | static int clip_constructor(struct neighbour *neigh) |
300 | { | 298 | { |
301 | struct atmarp_entry *entry = NEIGH2ENTRY(neigh); | 299 | struct atmarp_entry *entry = NEIGH2ENTRY(neigh); |
@@ -303,9 +301,10 @@ static int clip_constructor(struct neighbour *neigh) | |||
303 | struct in_device *in_dev; | 301 | struct in_device *in_dev; |
304 | struct neigh_parms *parms; | 302 | struct neigh_parms *parms; |
305 | 303 | ||
306 | DPRINTK("clip_constructor (neigh %p, entry %p)\n",neigh,entry); | 304 | DPRINTK("clip_constructor (neigh %p, entry %p)\n", neigh, entry); |
307 | neigh->type = inet_addr_type(entry->ip); | 305 | neigh->type = inet_addr_type(entry->ip); |
308 | if (neigh->type != RTN_UNICAST) return -EINVAL; | 306 | if (neigh->type != RTN_UNICAST) |
307 | return -EINVAL; | ||
309 | 308 | ||
310 | rcu_read_lock(); | 309 | rcu_read_lock(); |
311 | in_dev = __in_dev_get_rcu(dev); | 310 | in_dev = __in_dev_get_rcu(dev); |
@@ -324,13 +323,13 @@ static int clip_constructor(struct neighbour *neigh) | |||
324 | neigh->ops->connected_output : neigh->ops->output; | 323 | neigh->ops->connected_output : neigh->ops->output; |
325 | entry->neigh = neigh; | 324 | entry->neigh = neigh; |
326 | entry->vccs = NULL; | 325 | entry->vccs = NULL; |
327 | entry->expires = jiffies-1; | 326 | entry->expires = jiffies - 1; |
328 | return 0; | 327 | return 0; |
329 | } | 328 | } |
330 | 329 | ||
331 | static u32 clip_hash(const void *pkey, const struct net_device *dev) | 330 | static u32 clip_hash(const void *pkey, const struct net_device *dev) |
332 | { | 331 | { |
333 | return jhash_2words(*(u32 *)pkey, dev->ifindex, clip_tbl.hash_rnd); | 332 | return jhash_2words(*(u32 *) pkey, dev->ifindex, clip_tbl.hash_rnd); |
334 | } | 333 | } |
335 | 334 | ||
336 | static struct neigh_table clip_tbl = { | 335 | static struct neigh_table clip_tbl = { |
@@ -364,7 +363,6 @@ static struct neigh_table clip_tbl = { | |||
364 | .gc_thresh3 = 1024, | 363 | .gc_thresh3 = 1024, |
365 | }; | 364 | }; |
366 | 365 | ||
367 | |||
368 | /* @@@ copy bh locking from arp.c -- need to bh-enable atm code before */ | 366 | /* @@@ copy bh locking from arp.c -- need to bh-enable atm code before */ |
369 | 367 | ||
370 | /* | 368 | /* |
@@ -374,15 +372,13 @@ static struct neigh_table clip_tbl = { | |||
374 | * clip_setentry. | 372 | * clip_setentry. |
375 | */ | 373 | */ |
376 | 374 | ||
377 | 375 | static int clip_encap(struct atm_vcc *vcc, int mode) | |
378 | static int clip_encap(struct atm_vcc *vcc,int mode) | ||
379 | { | 376 | { |
380 | CLIP_VCC(vcc)->encap = mode; | 377 | CLIP_VCC(vcc)->encap = mode; |
381 | return 0; | 378 | return 0; |
382 | } | 379 | } |
383 | 380 | ||
384 | 381 | static int clip_start_xmit(struct sk_buff *skb, struct net_device *dev) | |
385 | static int clip_start_xmit(struct sk_buff *skb,struct net_device *dev) | ||
386 | { | 382 | { |
387 | struct clip_priv *clip_priv = PRIV(dev); | 383 | struct clip_priv *clip_priv = PRIV(dev); |
388 | struct atmarp_entry *entry; | 384 | struct atmarp_entry *entry; |
@@ -390,7 +386,7 @@ static int clip_start_xmit(struct sk_buff *skb,struct net_device *dev) | |||
390 | int old; | 386 | int old; |
391 | unsigned long flags; | 387 | unsigned long flags; |
392 | 388 | ||
393 | DPRINTK("clip_start_xmit (skb %p)\n",skb); | 389 | DPRINTK("clip_start_xmit (skb %p)\n", skb); |
394 | if (!skb->dst) { | 390 | if (!skb->dst) { |
395 | printk(KERN_ERR "clip_start_xmit: skb->dst == NULL\n"); | 391 | printk(KERN_ERR "clip_start_xmit: skb->dst == NULL\n"); |
396 | dev_kfree_skb(skb); | 392 | dev_kfree_skb(skb); |
@@ -399,9 +395,9 @@ static int clip_start_xmit(struct sk_buff *skb,struct net_device *dev) | |||
399 | } | 395 | } |
400 | if (!skb->dst->neighbour) { | 396 | if (!skb->dst->neighbour) { |
401 | #if 0 | 397 | #if 0 |
402 | skb->dst->neighbour = clip_find_neighbour(skb->dst,1); | 398 | skb->dst->neighbour = clip_find_neighbour(skb->dst, 1); |
403 | if (!skb->dst->neighbour) { | 399 | if (!skb->dst->neighbour) { |
404 | dev_kfree_skb(skb); /* lost that one */ | 400 | dev_kfree_skb(skb); /* lost that one */ |
405 | clip_priv->stats.tx_dropped++; | 401 | clip_priv->stats.tx_dropped++; |
406 | return 0; | 402 | return 0; |
407 | } | 403 | } |
@@ -415,73 +411,73 @@ static int clip_start_xmit(struct sk_buff *skb,struct net_device *dev) | |||
415 | if (!entry->vccs) { | 411 | if (!entry->vccs) { |
416 | if (time_after(jiffies, entry->expires)) { | 412 | if (time_after(jiffies, entry->expires)) { |
417 | /* should be resolved */ | 413 | /* should be resolved */ |
418 | entry->expires = jiffies+ATMARP_RETRY_DELAY*HZ; | 414 | entry->expires = jiffies + ATMARP_RETRY_DELAY * HZ; |
419 | to_atmarpd(act_need,PRIV(dev)->number,entry->ip); | 415 | to_atmarpd(act_need, PRIV(dev)->number, entry->ip); |
420 | } | 416 | } |
421 | if (entry->neigh->arp_queue.qlen < ATMARP_MAX_UNRES_PACKETS) | 417 | if (entry->neigh->arp_queue.qlen < ATMARP_MAX_UNRES_PACKETS) |
422 | skb_queue_tail(&entry->neigh->arp_queue,skb); | 418 | skb_queue_tail(&entry->neigh->arp_queue, skb); |
423 | else { | 419 | else { |
424 | dev_kfree_skb(skb); | 420 | dev_kfree_skb(skb); |
425 | clip_priv->stats.tx_dropped++; | 421 | clip_priv->stats.tx_dropped++; |
426 | } | 422 | } |
427 | return 0; | 423 | return 0; |
428 | } | 424 | } |
429 | DPRINTK("neigh %p, vccs %p\n",entry,entry->vccs); | 425 | DPRINTK("neigh %p, vccs %p\n", entry, entry->vccs); |
430 | ATM_SKB(skb)->vcc = vcc = entry->vccs->vcc; | 426 | ATM_SKB(skb)->vcc = vcc = entry->vccs->vcc; |
431 | DPRINTK("using neighbour %p, vcc %p\n",skb->dst->neighbour,vcc); | 427 | DPRINTK("using neighbour %p, vcc %p\n", skb->dst->neighbour, vcc); |
432 | if (entry->vccs->encap) { | 428 | if (entry->vccs->encap) { |
433 | void *here; | 429 | void *here; |
434 | 430 | ||
435 | here = skb_push(skb,RFC1483LLC_LEN); | 431 | here = skb_push(skb, RFC1483LLC_LEN); |
436 | memcpy(here,llc_oui,sizeof(llc_oui)); | 432 | memcpy(here, llc_oui, sizeof(llc_oui)); |
437 | ((u16 *) here)[3] = skb->protocol; | 433 | ((u16 *) here)[3] = skb->protocol; |
438 | } | 434 | } |
439 | atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); | 435 | atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); |
440 | ATM_SKB(skb)->atm_options = vcc->atm_options; | 436 | ATM_SKB(skb)->atm_options = vcc->atm_options; |
441 | entry->vccs->last_use = jiffies; | 437 | entry->vccs->last_use = jiffies; |
442 | DPRINTK("atm_skb(%p)->vcc(%p)->dev(%p)\n",skb,vcc,vcc->dev); | 438 | DPRINTK("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, vcc, vcc->dev); |
443 | old = xchg(&entry->vccs->xoff,1); /* assume XOFF ... */ | 439 | old = xchg(&entry->vccs->xoff, 1); /* assume XOFF ... */ |
444 | if (old) { | 440 | if (old) { |
445 | printk(KERN_WARNING "clip_start_xmit: XOFF->XOFF transition\n"); | 441 | printk(KERN_WARNING "clip_start_xmit: XOFF->XOFF transition\n"); |
446 | return 0; | 442 | return 0; |
447 | } | 443 | } |
448 | clip_priv->stats.tx_packets++; | 444 | clip_priv->stats.tx_packets++; |
449 | clip_priv->stats.tx_bytes += skb->len; | 445 | clip_priv->stats.tx_bytes += skb->len; |
450 | (void) vcc->send(vcc,skb); | 446 | (void)vcc->send(vcc, skb); |
451 | if (atm_may_send(vcc,0)) { | 447 | if (atm_may_send(vcc, 0)) { |
452 | entry->vccs->xoff = 0; | 448 | entry->vccs->xoff = 0; |
453 | return 0; | 449 | return 0; |
454 | } | 450 | } |
455 | spin_lock_irqsave(&clip_priv->xoff_lock,flags); | 451 | spin_lock_irqsave(&clip_priv->xoff_lock, flags); |
456 | netif_stop_queue(dev); /* XOFF -> throttle immediately */ | 452 | netif_stop_queue(dev); /* XOFF -> throttle immediately */ |
457 | barrier(); | 453 | barrier(); |
458 | if (!entry->vccs->xoff) | 454 | if (!entry->vccs->xoff) |
459 | netif_start_queue(dev); | 455 | netif_start_queue(dev); |
460 | /* Oh, we just raced with clip_pop. netif_start_queue should be | 456 | /* Oh, we just raced with clip_pop. netif_start_queue should be |
461 | good enough, because nothing should really be asleep because | 457 | good enough, because nothing should really be asleep because |
462 | of the brief netif_stop_queue. If this isn't true or if it | 458 | of the brief netif_stop_queue. If this isn't true or if it |
463 | changes, use netif_wake_queue instead. */ | 459 | changes, use netif_wake_queue instead. */ |
464 | spin_unlock_irqrestore(&clip_priv->xoff_lock,flags); | 460 | spin_unlock_irqrestore(&clip_priv->xoff_lock, flags); |
465 | return 0; | 461 | return 0; |
466 | } | 462 | } |
467 | 463 | ||
468 | |||
469 | static struct net_device_stats *clip_get_stats(struct net_device *dev) | 464 | static struct net_device_stats *clip_get_stats(struct net_device *dev) |
470 | { | 465 | { |
471 | return &PRIV(dev)->stats; | 466 | return &PRIV(dev)->stats; |
472 | } | 467 | } |
473 | 468 | ||
474 | 469 | static int clip_mkip(struct atm_vcc *vcc, int timeout) | |
475 | static int clip_mkip(struct atm_vcc *vcc,int timeout) | ||
476 | { | 470 | { |
477 | struct clip_vcc *clip_vcc; | 471 | struct clip_vcc *clip_vcc; |
478 | struct sk_buff_head copy; | 472 | struct sk_buff_head copy; |
479 | struct sk_buff *skb; | 473 | struct sk_buff *skb; |
480 | 474 | ||
481 | if (!vcc->push) return -EBADFD; | 475 | if (!vcc->push) |
482 | clip_vcc = kmalloc(sizeof(struct clip_vcc),GFP_KERNEL); | 476 | return -EBADFD; |
483 | if (!clip_vcc) return -ENOMEM; | 477 | clip_vcc = kmalloc(sizeof(struct clip_vcc), GFP_KERNEL); |
484 | DPRINTK("mkip clip_vcc %p vcc %p\n",clip_vcc,vcc); | 478 | if (!clip_vcc) |
479 | return -ENOMEM; | ||
480 | DPRINTK("mkip clip_vcc %p vcc %p\n", clip_vcc, vcc); | ||
485 | clip_vcc->vcc = vcc; | 481 | clip_vcc->vcc = vcc; |
486 | vcc->user_back = clip_vcc; | 482 | vcc->user_back = clip_vcc; |
487 | set_bit(ATM_VF_IS_CLIP, &vcc->flags); | 483 | set_bit(ATM_VF_IS_CLIP, &vcc->flags); |
@@ -489,7 +485,7 @@ static int clip_mkip(struct atm_vcc *vcc,int timeout) | |||
489 | clip_vcc->xoff = 0; | 485 | clip_vcc->xoff = 0; |
490 | clip_vcc->encap = 1; | 486 | clip_vcc->encap = 1; |
491 | clip_vcc->last_use = jiffies; | 487 | clip_vcc->last_use = jiffies; |
492 | clip_vcc->idle_timeout = timeout*HZ; | 488 | clip_vcc->idle_timeout = timeout * HZ; |
493 | clip_vcc->old_push = vcc->push; | 489 | clip_vcc->old_push = vcc->push; |
494 | clip_vcc->old_pop = vcc->pop; | 490 | clip_vcc->old_pop = vcc->pop; |
495 | vcc->push = clip_push; | 491 | vcc->push = clip_push; |
@@ -499,27 +495,25 @@ static int clip_mkip(struct atm_vcc *vcc,int timeout) | |||
499 | /* re-process everything received between connection setup and MKIP */ | 495 | /* re-process everything received between connection setup and MKIP */ |
500 | while ((skb = skb_dequeue(©)) != NULL) | 496 | while ((skb = skb_dequeue(©)) != NULL) |
501 | if (!clip_devs) { | 497 | if (!clip_devs) { |
502 | atm_return(vcc,skb->truesize); | 498 | atm_return(vcc, skb->truesize); |
503 | kfree_skb(skb); | 499 | kfree_skb(skb); |
504 | } | 500 | } else { |
505 | else { | ||
506 | unsigned int len = skb->len; | 501 | unsigned int len = skb->len; |
507 | 502 | ||
508 | clip_push(vcc,skb); | 503 | clip_push(vcc, skb); |
509 | PRIV(skb->dev)->stats.rx_packets--; | 504 | PRIV(skb->dev)->stats.rx_packets--; |
510 | PRIV(skb->dev)->stats.rx_bytes -= len; | 505 | PRIV(skb->dev)->stats.rx_bytes -= len; |
511 | } | 506 | } |
512 | return 0; | 507 | return 0; |
513 | } | 508 | } |
514 | 509 | ||
515 | 510 | static int clip_setentry(struct atm_vcc *vcc, u32 ip) | |
516 | static int clip_setentry(struct atm_vcc *vcc,u32 ip) | ||
517 | { | 511 | { |
518 | struct neighbour *neigh; | 512 | struct neighbour *neigh; |
519 | struct atmarp_entry *entry; | 513 | struct atmarp_entry *entry; |
520 | int error; | 514 | int error; |
521 | struct clip_vcc *clip_vcc; | 515 | struct clip_vcc *clip_vcc; |
522 | struct flowi fl = { .nl_u = { .ip4_u = { .daddr = ip, .tos = 1 } } }; | 516 | struct flowi fl = { .nl_u = { .ip4_u = { .daddr = ip, .tos = 1}} }; |
523 | struct rtable *rt; | 517 | struct rtable *rt; |
524 | 518 | ||
525 | if (vcc->push != clip_push) { | 519 | if (vcc->push != clip_push) { |
@@ -536,28 +530,29 @@ static int clip_setentry(struct atm_vcc *vcc,u32 ip) | |||
536 | unlink_clip_vcc(clip_vcc); | 530 | unlink_clip_vcc(clip_vcc); |
537 | return 0; | 531 | return 0; |
538 | } | 532 | } |
539 | error = ip_route_output_key(&rt,&fl); | 533 | error = ip_route_output_key(&rt, &fl); |
540 | if (error) return error; | 534 | if (error) |
541 | neigh = __neigh_lookup(&clip_tbl,&ip,rt->u.dst.dev,1); | 535 | return error; |
536 | neigh = __neigh_lookup(&clip_tbl, &ip, rt->u.dst.dev, 1); | ||
542 | ip_rt_put(rt); | 537 | ip_rt_put(rt); |
543 | if (!neigh) | 538 | if (!neigh) |
544 | return -ENOMEM; | 539 | return -ENOMEM; |
545 | entry = NEIGH2ENTRY(neigh); | 540 | entry = NEIGH2ENTRY(neigh); |
546 | if (entry != clip_vcc->entry) { | 541 | if (entry != clip_vcc->entry) { |
547 | if (!clip_vcc->entry) DPRINTK("setentry: add\n"); | 542 | if (!clip_vcc->entry) |
543 | DPRINTK("setentry: add\n"); | ||
548 | else { | 544 | else { |
549 | DPRINTK("setentry: update\n"); | 545 | DPRINTK("setentry: update\n"); |
550 | unlink_clip_vcc(clip_vcc); | 546 | unlink_clip_vcc(clip_vcc); |
551 | } | 547 | } |
552 | link_vcc(clip_vcc,entry); | 548 | link_vcc(clip_vcc, entry); |
553 | } | 549 | } |
554 | error = neigh_update(neigh, llc_oui, NUD_PERMANENT, | 550 | error = neigh_update(neigh, llc_oui, NUD_PERMANENT, |
555 | NEIGH_UPDATE_F_OVERRIDE|NEIGH_UPDATE_F_ADMIN); | 551 | NEIGH_UPDATE_F_OVERRIDE | NEIGH_UPDATE_F_ADMIN); |
556 | neigh_release(neigh); | 552 | neigh_release(neigh); |
557 | return error; | 553 | return error; |
558 | } | 554 | } |
559 | 555 | ||
560 | |||
561 | static void clip_setup(struct net_device *dev) | 556 | static void clip_setup(struct net_device *dev) |
562 | { | 557 | { |
563 | dev->hard_start_xmit = clip_start_xmit; | 558 | dev->hard_start_xmit = clip_start_xmit; |
@@ -566,15 +561,14 @@ static void clip_setup(struct net_device *dev) | |||
566 | dev->type = ARPHRD_ATM; | 561 | dev->type = ARPHRD_ATM; |
567 | dev->hard_header_len = RFC1483LLC_LEN; | 562 | dev->hard_header_len = RFC1483LLC_LEN; |
568 | dev->mtu = RFC1626_MTU; | 563 | dev->mtu = RFC1626_MTU; |
569 | dev->tx_queue_len = 100; /* "normal" queue (packets) */ | 564 | dev->tx_queue_len = 100; /* "normal" queue (packets) */ |
570 | /* When using a "real" qdisc, the qdisc determines the queue */ | 565 | /* When using a "real" qdisc, the qdisc determines the queue */ |
571 | /* length. tx_queue_len is only used for the default case, */ | 566 | /* length. tx_queue_len is only used for the default case, */ |
572 | /* without any more elaborate queuing. 100 is a reasonable */ | 567 | /* without any more elaborate queuing. 100 is a reasonable */ |
573 | /* compromise between decent burst-tolerance and protection */ | 568 | /* compromise between decent burst-tolerance and protection */ |
574 | /* against memory hogs. */ | 569 | /* against memory hogs. */ |
575 | } | 570 | } |
576 | 571 | ||
577 | |||
578 | static int clip_create(int number) | 572 | static int clip_create(int number) |
579 | { | 573 | { |
580 | struct net_device *dev; | 574 | struct net_device *dev; |
@@ -583,19 +577,19 @@ static int clip_create(int number) | |||
583 | 577 | ||
584 | if (number != -1) { | 578 | if (number != -1) { |
585 | for (dev = clip_devs; dev; dev = PRIV(dev)->next) | 579 | for (dev = clip_devs; dev; dev = PRIV(dev)->next) |
586 | if (PRIV(dev)->number == number) return -EEXIST; | 580 | if (PRIV(dev)->number == number) |
587 | } | 581 | return -EEXIST; |
588 | else { | 582 | } else { |
589 | number = 0; | 583 | number = 0; |
590 | for (dev = clip_devs; dev; dev = PRIV(dev)->next) | 584 | for (dev = clip_devs; dev; dev = PRIV(dev)->next) |
591 | if (PRIV(dev)->number >= number) | 585 | if (PRIV(dev)->number >= number) |
592 | number = PRIV(dev)->number+1; | 586 | number = PRIV(dev)->number + 1; |
593 | } | 587 | } |
594 | dev = alloc_netdev(sizeof(struct clip_priv), "", clip_setup); | 588 | dev = alloc_netdev(sizeof(struct clip_priv), "", clip_setup); |
595 | if (!dev) | 589 | if (!dev) |
596 | return -ENOMEM; | 590 | return -ENOMEM; |
597 | clip_priv = PRIV(dev); | 591 | clip_priv = PRIV(dev); |
598 | sprintf(dev->name,"atm%d",number); | 592 | sprintf(dev->name, "atm%d", number); |
599 | spin_lock_init(&clip_priv->xoff_lock); | 593 | spin_lock_init(&clip_priv->xoff_lock); |
600 | clip_priv->number = number; | 594 | clip_priv->number = number; |
601 | error = register_netdev(dev); | 595 | error = register_netdev(dev); |
@@ -605,12 +599,11 @@ static int clip_create(int number) | |||
605 | } | 599 | } |
606 | clip_priv->next = clip_devs; | 600 | clip_priv->next = clip_devs; |
607 | clip_devs = dev; | 601 | clip_devs = dev; |
608 | DPRINTK("registered (net:%s)\n",dev->name); | 602 | DPRINTK("registered (net:%s)\n", dev->name); |
609 | return number; | 603 | return number; |
610 | } | 604 | } |
611 | 605 | ||
612 | 606 | static int clip_device_event(struct notifier_block *this, unsigned long event, | |
613 | static int clip_device_event(struct notifier_block *this,unsigned long event, | ||
614 | void *arg) | 607 | void *arg) |
615 | { | 608 | { |
616 | struct net_device *dev = arg; | 609 | struct net_device *dev = arg; |
@@ -625,40 +618,39 @@ static int clip_device_event(struct notifier_block *this,unsigned long event, | |||
625 | return NOTIFY_DONE; | 618 | return NOTIFY_DONE; |
626 | 619 | ||
627 | switch (event) { | 620 | switch (event) { |
628 | case NETDEV_UP: | 621 | case NETDEV_UP: |
629 | DPRINTK("clip_device_event NETDEV_UP\n"); | 622 | DPRINTK("clip_device_event NETDEV_UP\n"); |
630 | (void) to_atmarpd(act_up,PRIV(dev)->number,0); | 623 | (void)to_atmarpd(act_up, PRIV(dev)->number, 0); |
631 | break; | 624 | break; |
632 | case NETDEV_GOING_DOWN: | 625 | case NETDEV_GOING_DOWN: |
633 | DPRINTK("clip_device_event NETDEV_DOWN\n"); | 626 | DPRINTK("clip_device_event NETDEV_DOWN\n"); |
634 | (void) to_atmarpd(act_down,PRIV(dev)->number,0); | 627 | (void)to_atmarpd(act_down, PRIV(dev)->number, 0); |
635 | break; | 628 | break; |
636 | case NETDEV_CHANGE: | 629 | case NETDEV_CHANGE: |
637 | case NETDEV_CHANGEMTU: | 630 | case NETDEV_CHANGEMTU: |
638 | DPRINTK("clip_device_event NETDEV_CHANGE*\n"); | 631 | DPRINTK("clip_device_event NETDEV_CHANGE*\n"); |
639 | (void) to_atmarpd(act_change,PRIV(dev)->number,0); | 632 | (void)to_atmarpd(act_change, PRIV(dev)->number, 0); |
640 | break; | 633 | break; |
641 | case NETDEV_REBOOT: | 634 | case NETDEV_REBOOT: |
642 | case NETDEV_REGISTER: | 635 | case NETDEV_REGISTER: |
643 | case NETDEV_DOWN: | 636 | case NETDEV_DOWN: |
644 | DPRINTK("clip_device_event %ld\n",event); | 637 | DPRINTK("clip_device_event %ld\n", event); |
645 | /* ignore */ | 638 | /* ignore */ |
646 | break; | 639 | break; |
647 | default: | 640 | default: |
648 | printk(KERN_WARNING "clip_device_event: unknown event " | 641 | printk(KERN_WARNING "clip_device_event: unknown event " |
649 | "%ld\n",event); | 642 | "%ld\n", event); |
650 | break; | 643 | break; |
651 | } | 644 | } |
652 | return NOTIFY_DONE; | 645 | return NOTIFY_DONE; |
653 | } | 646 | } |
654 | 647 | ||
655 | 648 | static int clip_inet_event(struct notifier_block *this, unsigned long event, | |
656 | static int clip_inet_event(struct notifier_block *this,unsigned long event, | 649 | void *ifa) |
657 | void *ifa) | ||
658 | { | 650 | { |
659 | struct in_device *in_dev; | 651 | struct in_device *in_dev; |
660 | 652 | ||
661 | in_dev = ((struct in_ifaddr *) ifa)->ifa_dev; | 653 | in_dev = ((struct in_ifaddr *)ifa)->ifa_dev; |
662 | if (!in_dev || !in_dev->dev) { | 654 | if (!in_dev || !in_dev->dev) { |
663 | printk(KERN_WARNING "clip_inet_event: no device\n"); | 655 | printk(KERN_WARNING "clip_inet_event: no device\n"); |
664 | return NOTIFY_DONE; | 656 | return NOTIFY_DONE; |
@@ -667,8 +659,9 @@ static int clip_inet_event(struct notifier_block *this,unsigned long event, | |||
667 | * Transitions are of the down-change-up type, so it's sufficient to | 659 | * Transitions are of the down-change-up type, so it's sufficient to |
668 | * handle the change on up. | 660 | * handle the change on up. |
669 | */ | 661 | */ |
670 | if (event != NETDEV_UP) return NOTIFY_DONE; | 662 | if (event != NETDEV_UP) |
671 | return clip_device_event(this,NETDEV_CHANGE,in_dev->dev); | 663 | return NOTIFY_DONE; |
664 | return clip_device_event(this, NETDEV_CHANGE, in_dev->dev); | ||
672 | } | 665 | } |
673 | 666 | ||
674 | 667 | ||
@@ -744,53 +737,53 @@ static int clip_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
744 | int err = 0; | 737 | int err = 0; |
745 | 738 | ||
746 | switch (cmd) { | 739 | switch (cmd) { |
747 | case SIOCMKCLIP: | 740 | case SIOCMKCLIP: |
748 | case ATMARPD_CTRL: | 741 | case ATMARPD_CTRL: |
749 | case ATMARP_MKIP: | 742 | case ATMARP_MKIP: |
750 | case ATMARP_SETENTRY: | 743 | case ATMARP_SETENTRY: |
751 | case ATMARP_ENCAP: | 744 | case ATMARP_ENCAP: |
752 | if (!capable(CAP_NET_ADMIN)) | 745 | if (!capable(CAP_NET_ADMIN)) |
753 | return -EPERM; | 746 | return -EPERM; |
754 | break; | 747 | break; |
755 | default: | 748 | default: |
756 | return -ENOIOCTLCMD; | 749 | return -ENOIOCTLCMD; |
757 | } | 750 | } |
758 | 751 | ||
759 | switch (cmd) { | 752 | switch (cmd) { |
760 | case SIOCMKCLIP: | 753 | case SIOCMKCLIP: |
761 | err = clip_create(arg); | 754 | err = clip_create(arg); |
762 | break; | 755 | break; |
763 | case ATMARPD_CTRL: | 756 | case ATMARPD_CTRL: |
764 | err = atm_init_atmarp(vcc); | 757 | err = atm_init_atmarp(vcc); |
765 | if (!err) { | 758 | if (!err) { |
766 | sock->state = SS_CONNECTED; | 759 | sock->state = SS_CONNECTED; |
767 | __module_get(THIS_MODULE); | 760 | __module_get(THIS_MODULE); |
768 | } | 761 | } |
769 | break; | 762 | break; |
770 | case ATMARP_MKIP: | 763 | case ATMARP_MKIP: |
771 | err = clip_mkip(vcc ,arg); | 764 | err = clip_mkip(vcc, arg); |
772 | break; | 765 | break; |
773 | case ATMARP_SETENTRY: | 766 | case ATMARP_SETENTRY: |
774 | err = clip_setentry(vcc, arg); | 767 | err = clip_setentry(vcc, arg); |
775 | break; | 768 | break; |
776 | case ATMARP_ENCAP: | 769 | case ATMARP_ENCAP: |
777 | err = clip_encap(vcc, arg); | 770 | err = clip_encap(vcc, arg); |
778 | break; | 771 | break; |
779 | } | 772 | } |
780 | return err; | 773 | return err; |
781 | } | 774 | } |
782 | 775 | ||
783 | static struct atm_ioctl clip_ioctl_ops = { | 776 | static struct atm_ioctl clip_ioctl_ops = { |
784 | .owner = THIS_MODULE, | 777 | .owner = THIS_MODULE, |
785 | .ioctl = clip_ioctl, | 778 | .ioctl = clip_ioctl, |
786 | }; | 779 | }; |
787 | 780 | ||
788 | #ifdef CONFIG_PROC_FS | 781 | #ifdef CONFIG_PROC_FS |
789 | 782 | ||
790 | static void svc_addr(struct seq_file *seq, struct sockaddr_atmsvc *addr) | 783 | static void svc_addr(struct seq_file *seq, struct sockaddr_atmsvc *addr) |
791 | { | 784 | { |
792 | static int code[] = { 1,2,10,6,1,0 }; | 785 | static int code[] = { 1, 2, 10, 6, 1, 0 }; |
793 | static int e164[] = { 1,8,4,6,1,0 }; | 786 | static int e164[] = { 1, 8, 4, 6, 1, 0 }; |
794 | 787 | ||
795 | if (*addr->sas_addr.pub) { | 788 | if (*addr->sas_addr.pub) { |
796 | seq_printf(seq, "%s", addr->sas_addr.pub); | 789 | seq_printf(seq, "%s", addr->sas_addr.pub); |
@@ -809,7 +802,7 @@ static void svc_addr(struct seq_file *seq, struct sockaddr_atmsvc *addr) | |||
809 | for (i = 0; fields[i]; i++) { | 802 | for (i = 0; fields[i]; i++) { |
810 | for (j = fields[i]; j; j--) | 803 | for (j = fields[i]; j; j--) |
811 | seq_printf(seq, "%02X", *prv++); | 804 | seq_printf(seq, "%02X", *prv++); |
812 | if (fields[i+1]) | 805 | if (fields[i + 1]) |
813 | seq_putc(seq, '.'); | 806 | seq_putc(seq, '.'); |
814 | } | 807 | } |
815 | } | 808 | } |
@@ -828,8 +821,7 @@ static void atmarp_info(struct seq_file *seq, struct net_device *dev, | |||
828 | svc = ((clip_vcc == SEQ_NO_VCC_TOKEN) || | 821 | svc = ((clip_vcc == SEQ_NO_VCC_TOKEN) || |
829 | (sk_atm(clip_vcc->vcc)->sk_family == AF_ATMSVC)); | 822 | (sk_atm(clip_vcc->vcc)->sk_family == AF_ATMSVC)); |
830 | 823 | ||
831 | llc = ((clip_vcc == SEQ_NO_VCC_TOKEN) || | 824 | llc = ((clip_vcc == SEQ_NO_VCC_TOKEN) || clip_vcc->encap); |
832 | clip_vcc->encap); | ||
833 | 825 | ||
834 | if (clip_vcc == SEQ_NO_VCC_TOKEN) | 826 | if (clip_vcc == SEQ_NO_VCC_TOKEN) |
835 | exp = entry->neigh->used; | 827 | exp = entry->neigh->used; |
@@ -839,10 +831,7 @@ static void atmarp_info(struct seq_file *seq, struct net_device *dev, | |||
839 | exp = (jiffies - exp) / HZ; | 831 | exp = (jiffies - exp) / HZ; |
840 | 832 | ||
841 | seq_printf(seq, "%-6s%-4s%-4s%5ld ", | 833 | seq_printf(seq, "%-6s%-4s%-4s%5ld ", |
842 | dev->name, | 834 | dev->name, svc ? "SVC" : "PVC", llc ? "LLC" : "NULL", exp); |
843 | svc ? "SVC" : "PVC", | ||
844 | llc ? "LLC" : "NULL", | ||
845 | exp); | ||
846 | 835 | ||
847 | off = scnprintf(buf, sizeof(buf) - 1, "%d.%d.%d.%d", | 836 | off = scnprintf(buf, sizeof(buf) - 1, "%d.%d.%d.%d", |
848 | NIPQUAD(entry->ip)); | 837 | NIPQUAD(entry->ip)); |
@@ -860,8 +849,7 @@ static void atmarp_info(struct seq_file *seq, struct net_device *dev, | |||
860 | } else if (!svc) { | 849 | } else if (!svc) { |
861 | seq_printf(seq, "%d.%d.%d\n", | 850 | seq_printf(seq, "%d.%d.%d\n", |
862 | clip_vcc->vcc->dev->number, | 851 | clip_vcc->vcc->dev->number, |
863 | clip_vcc->vcc->vpi, | 852 | clip_vcc->vcc->vpi, clip_vcc->vcc->vci); |
864 | clip_vcc->vcc->vci); | ||
865 | } else { | 853 | } else { |
866 | svc_addr(seq, &clip_vcc->vcc->remote); | 854 | svc_addr(seq, &clip_vcc->vcc->remote); |
867 | seq_putc(seq, '\n'); | 855 | seq_putc(seq, '\n'); |
@@ -894,7 +882,7 @@ static struct clip_vcc *clip_seq_next_vcc(struct atmarp_entry *e, | |||
894 | } | 882 | } |
895 | 883 | ||
896 | static void *clip_seq_vcc_walk(struct clip_seq_state *state, | 884 | static void *clip_seq_vcc_walk(struct clip_seq_state *state, |
897 | struct atmarp_entry *e, loff_t *pos) | 885 | struct atmarp_entry *e, loff_t * pos) |
898 | { | 886 | { |
899 | struct clip_vcc *vcc = state->vcc; | 887 | struct clip_vcc *vcc = state->vcc; |
900 | 888 | ||
@@ -911,24 +899,24 @@ static void *clip_seq_vcc_walk(struct clip_seq_state *state, | |||
911 | 899 | ||
912 | return vcc; | 900 | return vcc; |
913 | } | 901 | } |
914 | 902 | ||
915 | static void *clip_seq_sub_iter(struct neigh_seq_state *_state, | 903 | static void *clip_seq_sub_iter(struct neigh_seq_state *_state, |
916 | struct neighbour *n, loff_t *pos) | 904 | struct neighbour *n, loff_t * pos) |
917 | { | 905 | { |
918 | struct clip_seq_state *state = (struct clip_seq_state *) _state; | 906 | struct clip_seq_state *state = (struct clip_seq_state *)_state; |
919 | 907 | ||
920 | return clip_seq_vcc_walk(state, NEIGH2ENTRY(n), pos); | 908 | return clip_seq_vcc_walk(state, NEIGH2ENTRY(n), pos); |
921 | } | 909 | } |
922 | 910 | ||
923 | static void *clip_seq_start(struct seq_file *seq, loff_t *pos) | 911 | static void *clip_seq_start(struct seq_file *seq, loff_t * pos) |
924 | { | 912 | { |
925 | return neigh_seq_start(seq, pos, &clip_tbl, NEIGH_SEQ_NEIGH_ONLY); | 913 | return neigh_seq_start(seq, pos, &clip_tbl, NEIGH_SEQ_NEIGH_ONLY); |
926 | } | 914 | } |
927 | 915 | ||
928 | static int clip_seq_show(struct seq_file *seq, void *v) | 916 | static int clip_seq_show(struct seq_file *seq, void *v) |
929 | { | 917 | { |
930 | static char atm_arp_banner[] = | 918 | static char atm_arp_banner[] = |
931 | "IPitf TypeEncp Idle IP address ATM address\n"; | 919 | "IPitf TypeEncp Idle IP address ATM address\n"; |
932 | 920 | ||
933 | if (v == SEQ_START_TOKEN) { | 921 | if (v == SEQ_START_TOKEN) { |
934 | seq_puts(seq, atm_arp_banner); | 922 | seq_puts(seq, atm_arp_banner); |
@@ -939,7 +927,7 @@ static int clip_seq_show(struct seq_file *seq, void *v) | |||
939 | 927 | ||
940 | atmarp_info(seq, n->dev, NEIGH2ENTRY(n), vcc); | 928 | atmarp_info(seq, n->dev, NEIGH2ENTRY(n), vcc); |
941 | } | 929 | } |
942 | return 0; | 930 | return 0; |
943 | } | 931 | } |
944 | 932 | ||
945 | static struct seq_operations arp_seq_ops = { | 933 | static struct seq_operations arp_seq_ops = { |
@@ -998,13 +986,13 @@ static int __init atm_clip_init(void) | |||
998 | setup_timer(&idle_timer, idle_timer_check, 0); | 986 | setup_timer(&idle_timer, idle_timer_check, 0); |
999 | 987 | ||
1000 | #ifdef CONFIG_PROC_FS | 988 | #ifdef CONFIG_PROC_FS |
1001 | { | 989 | { |
1002 | struct proc_dir_entry *p; | 990 | struct proc_dir_entry *p; |
1003 | 991 | ||
1004 | p = create_proc_entry("arp", S_IRUGO, atm_proc_root); | 992 | p = create_proc_entry("arp", S_IRUGO, atm_proc_root); |
1005 | if (p) | 993 | if (p) |
1006 | p->proc_fops = &arp_seq_fops; | 994 | p->proc_fops = &arp_seq_fops; |
1007 | } | 995 | } |
1008 | #endif | 996 | #endif |
1009 | 997 | ||
1010 | return 0; | 998 | return 0; |