diff options
author | Joe Perches <joe@perches.com> | 2010-01-26 06:40:09 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-01-27 00:16:00 -0500 |
commit | 5710044073ea734c0d7806d7fb9cd6308053704b (patch) | |
tree | de8cdf8c20b8ebc2248ad76dcbd67980cdf9ac46 /net/atm/mpc.c | |
parent | c48192a7075fb218d92810fbe76ddd8732f2bbb8 (diff) |
net/atm/mpc.c: checkpatch cleanups
Convert #include <asm... to #include <linux...
Add printk argument verification to dprintk and ddprintk
Spacing cleanups
Mostly 80 column wrapped.
printk->pr_info and pr_cont
Moved labels to column 1
Move trailing statements to new lines
switch/case cleanups
remove unnecessary breaks after returns
Remove unnecessary braces around single line statements
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/atm/mpc.c')
-rw-r--r-- | net/atm/mpc.c | 445 |
1 files changed, 252 insertions, 193 deletions
diff --git a/net/atm/mpc.c b/net/atm/mpc.c index 3c45aef47b7e..55dba22e44b3 100644 --- a/net/atm/mpc.c +++ b/net/atm/mpc.c | |||
@@ -15,8 +15,8 @@ | |||
15 | #include <net/sock.h> | 15 | #include <net/sock.h> |
16 | #include <linux/skbuff.h> | 16 | #include <linux/skbuff.h> |
17 | #include <linux/ip.h> | 17 | #include <linux/ip.h> |
18 | #include <linux/uaccess.h> | ||
18 | #include <asm/byteorder.h> | 19 | #include <asm/byteorder.h> |
19 | #include <asm/uaccess.h> | ||
20 | #include <net/checksum.h> /* for ip_fast_csum() */ | 20 | #include <net/checksum.h> /* for ip_fast_csum() */ |
21 | #include <net/arp.h> | 21 | #include <net/arp.h> |
22 | #include <net/dst.h> | 22 | #include <net/dst.h> |
@@ -38,15 +38,17 @@ | |||
38 | */ | 38 | */ |
39 | 39 | ||
40 | #if 0 | 40 | #if 0 |
41 | #define dprintk printk /* debug */ | 41 | #define dprintk(format, args...) printk(KERN_DEBUG format, ##args) /* debug */ |
42 | #else | 42 | #else |
43 | #define dprintk(format,args...) | 43 | #define dprintk(format, args...) \ |
44 | do { if (0) printk(KERN_DEBUG format, ##args); } while (0) | ||
44 | #endif | 45 | #endif |
45 | 46 | ||
46 | #if 0 | 47 | #if 0 |
47 | #define ddprintk printk /* more debug */ | 48 | #define ddprintk printk(KERN_DEBUG format, ##args) /* more debug */ |
48 | #else | 49 | #else |
49 | #define ddprintk(format,args...) | 50 | #define ddprintk(format, args...) \ |
51 | do { if (0) printk(KERN_DEBUG format, ##args); } while (0) | ||
50 | #endif | 52 | #endif |
51 | 53 | ||
52 | 54 | ||
@@ -54,15 +56,19 @@ | |||
54 | #define MPOA_TAG_LEN 4 | 56 | #define MPOA_TAG_LEN 4 |
55 | 57 | ||
56 | /* mpc_daemon -> kernel */ | 58 | /* mpc_daemon -> kernel */ |
57 | static void MPOA_trigger_rcvd (struct k_message *msg, struct mpoa_client *mpc); | 59 | static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc); |
58 | static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc); | 60 | static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc); |
59 | static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc); | 61 | static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc); |
60 | static void egress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc); | 62 | static void egress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc); |
61 | static void mps_death(struct k_message *msg, struct mpoa_client *mpc); | 63 | static void mps_death(struct k_message *msg, struct mpoa_client *mpc); |
62 | static void clean_up(struct k_message *msg, struct mpoa_client *mpc, int action); | 64 | static void clean_up(struct k_message *msg, struct mpoa_client *mpc, |
63 | static void MPOA_cache_impos_rcvd(struct k_message *msg, struct mpoa_client *mpc); | 65 | int action); |
64 | static void set_mpc_ctrl_addr_rcvd(struct k_message *mesg, struct mpoa_client *mpc); | 66 | static void MPOA_cache_impos_rcvd(struct k_message *msg, |
65 | static void set_mps_mac_addr_rcvd(struct k_message *mesg, struct mpoa_client *mpc); | 67 | struct mpoa_client *mpc); |
68 | static void set_mpc_ctrl_addr_rcvd(struct k_message *mesg, | ||
69 | struct mpoa_client *mpc); | ||
70 | static void set_mps_mac_addr_rcvd(struct k_message *mesg, | ||
71 | struct mpoa_client *mpc); | ||
66 | 72 | ||
67 | static const uint8_t *copy_macs(struct mpoa_client *mpc, | 73 | static const uint8_t *copy_macs(struct mpoa_client *mpc, |
68 | const uint8_t *router_mac, | 74 | const uint8_t *router_mac, |
@@ -76,10 +82,11 @@ static int msg_from_mpoad(struct atm_vcc *vcc, struct sk_buff *skb); | |||
76 | 82 | ||
77 | static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb); | 83 | static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb); |
78 | static netdev_tx_t mpc_send_packet(struct sk_buff *skb, | 84 | static netdev_tx_t mpc_send_packet(struct sk_buff *skb, |
79 | struct net_device *dev); | 85 | struct net_device *dev); |
80 | static int mpoa_event_listener(struct notifier_block *mpoa_notifier, unsigned long event, void *dev); | 86 | static int mpoa_event_listener(struct notifier_block *mpoa_notifier, |
87 | unsigned long event, void *dev); | ||
81 | static void mpc_timer_refresh(void); | 88 | static void mpc_timer_refresh(void); |
82 | static void mpc_cache_check( unsigned long checking_time ); | 89 | static void mpc_cache_check(unsigned long checking_time); |
83 | 90 | ||
84 | static struct llc_snap_hdr llc_snap_mpoa_ctrl = { | 91 | static struct llc_snap_hdr llc_snap_mpoa_ctrl = { |
85 | 0xaa, 0xaa, 0x03, | 92 | 0xaa, 0xaa, 0x03, |
@@ -169,7 +176,7 @@ struct atm_mpoa_qos *atm_mpoa_add_qos(__be32 dst_ip, struct atm_qos *qos) | |||
169 | 176 | ||
170 | entry = kmalloc(sizeof(struct atm_mpoa_qos), GFP_KERNEL); | 177 | entry = kmalloc(sizeof(struct atm_mpoa_qos), GFP_KERNEL); |
171 | if (entry == NULL) { | 178 | if (entry == NULL) { |
172 | printk("mpoa: atm_mpoa_add_qos: out of memory\n"); | 179 | pr_info("mpoa: out of memory\n"); |
173 | return entry; | 180 | return entry; |
174 | } | 181 | } |
175 | 182 | ||
@@ -187,10 +194,9 @@ struct atm_mpoa_qos *atm_mpoa_search_qos(__be32 dst_ip) | |||
187 | struct atm_mpoa_qos *qos; | 194 | struct atm_mpoa_qos *qos; |
188 | 195 | ||
189 | qos = qos_head; | 196 | qos = qos_head; |
190 | while( qos != NULL ){ | 197 | while (qos) { |
191 | if(qos->ipaddr == dst_ip) { | 198 | if (qos->ipaddr == dst_ip) |
192 | break; | 199 | break; |
193 | } | ||
194 | qos = qos->next; | 200 | qos = qos->next; |
195 | } | 201 | } |
196 | 202 | ||
@@ -202,10 +208,10 @@ struct atm_mpoa_qos *atm_mpoa_search_qos(__be32 dst_ip) | |||
202 | */ | 208 | */ |
203 | int atm_mpoa_delete_qos(struct atm_mpoa_qos *entry) | 209 | int atm_mpoa_delete_qos(struct atm_mpoa_qos *entry) |
204 | { | 210 | { |
205 | |||
206 | struct atm_mpoa_qos *curr; | 211 | struct atm_mpoa_qos *curr; |
207 | 212 | ||
208 | if (entry == NULL) return 0; | 213 | if (entry == NULL) |
214 | return 0; | ||
209 | if (entry == qos_head) { | 215 | if (entry == qos_head) { |
210 | qos_head = qos_head->next; | 216 | qos_head = qos_head->next; |
211 | kfree(entry); | 217 | kfree(entry); |
@@ -236,9 +242,17 @@ void atm_mpoa_disp_qos(struct seq_file *m) | |||
236 | 242 | ||
237 | while (qos != NULL) { | 243 | while (qos != NULL) { |
238 | seq_printf(m, "%pI4\n %-7d %-7d %-7d %-7d %-7d\n %-7d %-7d %-7d %-7d %-7d\n", | 244 | seq_printf(m, "%pI4\n %-7d %-7d %-7d %-7d %-7d\n %-7d %-7d %-7d %-7d %-7d\n", |
239 | &qos->ipaddr, | 245 | &qos->ipaddr, |
240 | qos->qos.txtp.max_pcr, qos->qos.txtp.pcr, qos->qos.txtp.min_pcr, qos->qos.txtp.max_cdv, qos->qos.txtp.max_sdu, | 246 | qos->qos.txtp.max_pcr, |
241 | qos->qos.rxtp.max_pcr, qos->qos.rxtp.pcr, qos->qos.rxtp.min_pcr, qos->qos.rxtp.max_cdv, qos->qos.rxtp.max_sdu); | 247 | qos->qos.txtp.pcr, |
248 | qos->qos.txtp.min_pcr, | ||
249 | qos->qos.txtp.max_cdv, | ||
250 | qos->qos.txtp.max_sdu, | ||
251 | qos->qos.rxtp.max_pcr, | ||
252 | qos->qos.rxtp.pcr, | ||
253 | qos->qos.rxtp.min_pcr, | ||
254 | qos->qos.rxtp.max_cdv, | ||
255 | qos->qos.rxtp.max_sdu); | ||
242 | qos = qos->next; | 256 | qos = qos->next; |
243 | } | 257 | } |
244 | } | 258 | } |
@@ -258,7 +272,7 @@ static struct mpoa_client *alloc_mpc(void) | |||
258 | { | 272 | { |
259 | struct mpoa_client *mpc; | 273 | struct mpoa_client *mpc; |
260 | 274 | ||
261 | mpc = kzalloc(sizeof (struct mpoa_client), GFP_KERNEL); | 275 | mpc = kzalloc(sizeof(struct mpoa_client), GFP_KERNEL); |
262 | if (mpc == NULL) | 276 | if (mpc == NULL) |
263 | return NULL; | 277 | return NULL; |
264 | rwlock_init(&mpc->ingress_lock); | 278 | rwlock_init(&mpc->ingress_lock); |
@@ -268,7 +282,7 @@ static struct mpoa_client *alloc_mpc(void) | |||
268 | 282 | ||
269 | mpc->parameters.mpc_p1 = MPC_P1; | 283 | mpc->parameters.mpc_p1 = MPC_P1; |
270 | mpc->parameters.mpc_p2 = MPC_P2; | 284 | mpc->parameters.mpc_p2 = MPC_P2; |
271 | memset(mpc->parameters.mpc_p3,0,sizeof(mpc->parameters.mpc_p3)); | 285 | memset(mpc->parameters.mpc_p3, 0, sizeof(mpc->parameters.mpc_p3)); |
272 | mpc->parameters.mpc_p4 = MPC_P4; | 286 | mpc->parameters.mpc_p4 = MPC_P4; |
273 | mpc->parameters.mpc_p5 = MPC_P5; | 287 | mpc->parameters.mpc_p5 = MPC_P5; |
274 | mpc->parameters.mpc_p6 = MPC_P6; | 288 | mpc->parameters.mpc_p6 = MPC_P6; |
@@ -290,7 +304,7 @@ static void start_mpc(struct mpoa_client *mpc, struct net_device *dev) | |||
290 | 304 | ||
291 | dprintk("mpoa: (%s) start_mpc:\n", mpc->dev->name); | 305 | dprintk("mpoa: (%s) start_mpc:\n", mpc->dev->name); |
292 | if (!dev->netdev_ops) | 306 | if (!dev->netdev_ops) |
293 | printk("mpoa: (%s) start_mpc not starting\n", dev->name); | 307 | pr_info("(%s) not starting\n", dev->name); |
294 | else { | 308 | else { |
295 | mpc->old_ops = dev->netdev_ops; | 309 | mpc->old_ops = dev->netdev_ops; |
296 | mpc->new_ops = *mpc->old_ops; | 310 | mpc->new_ops = *mpc->old_ops; |
@@ -321,25 +335,18 @@ static const char *mpoa_device_type_string(char type) __attribute__ ((unused)); | |||
321 | 335 | ||
322 | static const char *mpoa_device_type_string(char type) | 336 | static const char *mpoa_device_type_string(char type) |
323 | { | 337 | { |
324 | switch(type) { | 338 | switch (type) { |
325 | case NON_MPOA: | 339 | case NON_MPOA: |
326 | return "non-MPOA device"; | 340 | return "non-MPOA device"; |
327 | break; | ||
328 | case MPS: | 341 | case MPS: |
329 | return "MPS"; | 342 | return "MPS"; |
330 | break; | ||
331 | case MPC: | 343 | case MPC: |
332 | return "MPC"; | 344 | return "MPC"; |
333 | break; | ||
334 | case MPS_AND_MPC: | 345 | case MPS_AND_MPC: |
335 | return "both MPS and MPC"; | 346 | return "both MPS and MPC"; |
336 | break; | ||
337 | default: | ||
338 | return "unspecified (non-MPOA) device"; | ||
339 | break; | ||
340 | } | 347 | } |
341 | 348 | ||
342 | return ""; /* not reached */ | 349 | return "unspecified (non-MPOA) device"; |
343 | } | 350 | } |
344 | 351 | ||
345 | /* | 352 | /* |
@@ -368,22 +375,24 @@ static void lane2_assoc_ind(struct net_device *dev, const u8 *mac_addr, | |||
368 | dprintk("total length of all TLVs %d\n", sizeoftlvs); | 375 | dprintk("total length of all TLVs %d\n", sizeoftlvs); |
369 | mpc = find_mpc_by_lec(dev); /* Sampo-Fix: moved here from below */ | 376 | mpc = find_mpc_by_lec(dev); /* Sampo-Fix: moved here from below */ |
370 | if (mpc == NULL) { | 377 | if (mpc == NULL) { |
371 | printk("mpoa: (%s) lane2_assoc_ind: no mpc\n", dev->name); | 378 | pr_info("(%s) no mpc\n", dev->name); |
372 | return; | 379 | return; |
373 | } | 380 | } |
374 | end_of_tlvs = tlvs + sizeoftlvs; | 381 | end_of_tlvs = tlvs + sizeoftlvs; |
375 | while (end_of_tlvs - tlvs >= 5) { | 382 | while (end_of_tlvs - tlvs >= 5) { |
376 | type = (tlvs[0] << 24) | (tlvs[1] << 16) | (tlvs[2] << 8) | tlvs[3]; | 383 | type = ((tlvs[0] << 24) | (tlvs[1] << 16) | |
384 | (tlvs[2] << 8) | tlvs[3]); | ||
377 | length = tlvs[4]; | 385 | length = tlvs[4]; |
378 | tlvs += 5; | 386 | tlvs += 5; |
379 | dprintk(" type 0x%x length %02x\n", type, length); | 387 | dprintk(" type 0x%x length %02x\n", type, length); |
380 | if (tlvs + length > end_of_tlvs) { | 388 | if (tlvs + length > end_of_tlvs) { |
381 | printk("TLV value extends past its buffer, aborting parse\n"); | 389 | pr_info("TLV value extends past its buffer, aborting parse\n"); |
382 | return; | 390 | return; |
383 | } | 391 | } |
384 | 392 | ||
385 | if (type == 0) { | 393 | if (type == 0) { |
386 | printk("mpoa: (%s) lane2_assoc_ind: TLV type was 0, returning\n", dev->name); | 394 | pr_info("mpoa: (%s) TLV type was 0, returning\n", |
395 | dev->name); | ||
387 | return; | 396 | return; |
388 | } | 397 | } |
389 | 398 | ||
@@ -393,39 +402,47 @@ static void lane2_assoc_ind(struct net_device *dev, const u8 *mac_addr, | |||
393 | } | 402 | } |
394 | mpoa_device_type = *tlvs++; | 403 | mpoa_device_type = *tlvs++; |
395 | number_of_mps_macs = *tlvs++; | 404 | number_of_mps_macs = *tlvs++; |
396 | dprintk("mpoa: (%s) MPOA device type '%s', ", dev->name, mpoa_device_type_string(mpoa_device_type)); | 405 | dprintk("mpoa: (%s) MPOA device type '%s', ", |
406 | dev->name, mpoa_device_type_string(mpoa_device_type)); | ||
397 | if (mpoa_device_type == MPS_AND_MPC && | 407 | if (mpoa_device_type == MPS_AND_MPC && |
398 | length < (42 + number_of_mps_macs*ETH_ALEN)) { /* :) */ | 408 | length < (42 + number_of_mps_macs*ETH_ALEN)) { /* :) */ |
399 | printk("\nmpoa: (%s) lane2_assoc_ind: short MPOA Device Type TLV\n", | 409 | pr_info("(%s) short MPOA Device Type TLV\n", |
400 | dev->name); | 410 | dev->name); |
401 | continue; | 411 | continue; |
402 | } | 412 | } |
403 | if ((mpoa_device_type == MPS || mpoa_device_type == MPC) | 413 | if ((mpoa_device_type == MPS || mpoa_device_type == MPC) && |
404 | && length < 22 + number_of_mps_macs*ETH_ALEN) { | 414 | length < 22 + number_of_mps_macs*ETH_ALEN) { |
405 | printk("\nmpoa: (%s) lane2_assoc_ind: short MPOA Device Type TLV\n", | 415 | pr_info("(%s) short MPOA Device Type TLV\n", dev->name); |
406 | dev->name); | ||
407 | continue; | 416 | continue; |
408 | } | 417 | } |
409 | if (mpoa_device_type != MPS && mpoa_device_type != MPS_AND_MPC) { | 418 | if (mpoa_device_type != MPS && |
419 | mpoa_device_type != MPS_AND_MPC) { | ||
410 | dprintk("ignoring non-MPS device\n"); | 420 | dprintk("ignoring non-MPS device\n"); |
411 | if (mpoa_device_type == MPC) tlvs += 20; | 421 | if (mpoa_device_type == MPC) |
422 | tlvs += 20; | ||
412 | continue; /* we are only interested in MPSs */ | 423 | continue; /* we are only interested in MPSs */ |
413 | } | 424 | } |
414 | if (number_of_mps_macs == 0 && mpoa_device_type == MPS_AND_MPC) { | 425 | if (number_of_mps_macs == 0 && |
415 | printk("\nmpoa: (%s) lane2_assoc_ind: MPS_AND_MPC has zero MACs\n", dev->name); | 426 | mpoa_device_type == MPS_AND_MPC) { |
427 | pr_info("(%s) MPS_AND_MPC has zero MACs\n", dev->name); | ||
416 | continue; /* someone should read the spec */ | 428 | continue; /* someone should read the spec */ |
417 | } | 429 | } |
418 | dprintk("this MPS has %d MAC addresses\n", number_of_mps_macs); | 430 | dprintk("this MPS has %d MAC addresses\n", number_of_mps_macs); |
419 | 431 | ||
420 | /* ok, now we can go and tell our daemon the control address of MPS */ | 432 | /* |
433 | * ok, now we can go and tell our daemon | ||
434 | * the control address of MPS | ||
435 | */ | ||
421 | send_set_mps_ctrl_addr(tlvs, mpc); | 436 | send_set_mps_ctrl_addr(tlvs, mpc); |
422 | 437 | ||
423 | tlvs = copy_macs(mpc, mac_addr, tlvs, number_of_mps_macs, mpoa_device_type); | 438 | tlvs = copy_macs(mpc, mac_addr, tlvs, |
424 | if (tlvs == NULL) return; | 439 | number_of_mps_macs, mpoa_device_type); |
440 | if (tlvs == NULL) | ||
441 | return; | ||
425 | } | 442 | } |
426 | if (end_of_tlvs - tlvs != 0) | 443 | if (end_of_tlvs - tlvs != 0) |
427 | printk("mpoa: (%s) lane2_assoc_ind: ignoring %Zd bytes of trailing TLV carbage\n", | 444 | pr_info("(%s) ignoring %Zd bytes of trailing TLV garbage\n", |
428 | dev->name, end_of_tlvs - tlvs); | 445 | dev->name, end_of_tlvs - tlvs); |
429 | return; | 446 | return; |
430 | } | 447 | } |
431 | 448 | ||
@@ -443,11 +460,12 @@ static const uint8_t *copy_macs(struct mpoa_client *mpc, | |||
443 | num_macs = (mps_macs > 1) ? mps_macs : 1; | 460 | num_macs = (mps_macs > 1) ? mps_macs : 1; |
444 | 461 | ||
445 | if (mpc->number_of_mps_macs != num_macs) { /* need to reallocate? */ | 462 | if (mpc->number_of_mps_macs != num_macs) { /* need to reallocate? */ |
446 | if (mpc->number_of_mps_macs != 0) kfree(mpc->mps_macs); | 463 | if (mpc->number_of_mps_macs != 0) |
464 | kfree(mpc->mps_macs); | ||
447 | mpc->number_of_mps_macs = 0; | 465 | mpc->number_of_mps_macs = 0; |
448 | mpc->mps_macs = kmalloc(num_macs*ETH_ALEN, GFP_KERNEL); | 466 | mpc->mps_macs = kmalloc(num_macs * ETH_ALEN, GFP_KERNEL); |
449 | if (mpc->mps_macs == NULL) { | 467 | if (mpc->mps_macs == NULL) { |
450 | printk("mpoa: (%s) copy_macs: out of mem\n", mpc->dev->name); | 468 | pr_info("(%s) out of mem\n", mpc->dev->name); |
451 | return NULL; | 469 | return NULL; |
452 | } | 470 | } |
453 | } | 471 | } |
@@ -480,24 +498,30 @@ static int send_via_shortcut(struct sk_buff *skb, struct mpoa_client *mpc) | |||
480 | iph = (struct iphdr *)buff; | 498 | iph = (struct iphdr *)buff; |
481 | ipaddr = iph->daddr; | 499 | ipaddr = iph->daddr; |
482 | 500 | ||
483 | ddprintk("mpoa: (%s) send_via_shortcut: ipaddr 0x%x\n", mpc->dev->name, ipaddr); | 501 | ddprintk("mpoa: (%s) send_via_shortcut: ipaddr 0x%x\n", |
502 | mpc->dev->name, ipaddr); | ||
484 | 503 | ||
485 | entry = mpc->in_ops->get(ipaddr, mpc); | 504 | entry = mpc->in_ops->get(ipaddr, mpc); |
486 | if (entry == NULL) { | 505 | if (entry == NULL) { |
487 | entry = mpc->in_ops->add_entry(ipaddr, mpc); | 506 | entry = mpc->in_ops->add_entry(ipaddr, mpc); |
488 | if (entry != NULL) mpc->in_ops->put(entry); | 507 | if (entry != NULL) |
508 | mpc->in_ops->put(entry); | ||
489 | return 1; | 509 | return 1; |
490 | } | 510 | } |
491 | if (mpc->in_ops->cache_hit(entry, mpc) != OPEN){ /* threshold not exceeded or VCC not ready */ | 511 | /* threshold not exceeded or VCC not ready */ |
492 | ddprintk("mpoa: (%s) send_via_shortcut: cache_hit: returns != OPEN\n", mpc->dev->name); | 512 | if (mpc->in_ops->cache_hit(entry, mpc) != OPEN) { |
513 | ddprintk("mpoa: (%s) send_via_shortcut: cache_hit: returns != OPEN\n", | ||
514 | mpc->dev->name); | ||
493 | mpc->in_ops->put(entry); | 515 | mpc->in_ops->put(entry); |
494 | return 1; | 516 | return 1; |
495 | } | 517 | } |
496 | 518 | ||
497 | ddprintk("mpoa: (%s) send_via_shortcut: using shortcut\n", mpc->dev->name); | 519 | ddprintk("mpoa: (%s) send_via_shortcut: using shortcut\n", |
520 | mpc->dev->name); | ||
498 | /* MPOA spec A.1.4, MPOA client must decrement IP ttl at least by one */ | 521 | /* MPOA spec A.1.4, MPOA client must decrement IP ttl at least by one */ |
499 | if (iph->ttl <= 1) { | 522 | if (iph->ttl <= 1) { |
500 | ddprintk("mpoa: (%s) send_via_shortcut: IP ttl = %u, using LANE\n", mpc->dev->name, iph->ttl); | 523 | ddprintk("mpoa: (%s) send_via_shortcut: IP ttl = %u, using LANE\n", |
524 | mpc->dev->name, iph->ttl); | ||
501 | mpc->in_ops->put(entry); | 525 | mpc->in_ops->put(entry); |
502 | return 1; | 526 | return 1; |
503 | } | 527 | } |
@@ -506,15 +530,18 @@ static int send_via_shortcut(struct sk_buff *skb, struct mpoa_client *mpc) | |||
506 | iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl); | 530 | iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl); |
507 | 531 | ||
508 | if (entry->ctrl_info.tag != 0) { | 532 | if (entry->ctrl_info.tag != 0) { |
509 | ddprintk("mpoa: (%s) send_via_shortcut: adding tag 0x%x\n", mpc->dev->name, entry->ctrl_info.tag); | 533 | ddprintk("mpoa: (%s) send_via_shortcut: adding tag 0x%x\n", |
534 | mpc->dev->name, entry->ctrl_info.tag); | ||
510 | tagged_llc_snap_hdr.tag = entry->ctrl_info.tag; | 535 | tagged_llc_snap_hdr.tag = entry->ctrl_info.tag; |
511 | skb_pull(skb, ETH_HLEN); /* get rid of Eth header */ | 536 | skb_pull(skb, ETH_HLEN); /* get rid of Eth header */ |
512 | skb_push(skb, sizeof(tagged_llc_snap_hdr)); /* add LLC/SNAP header */ | 537 | skb_push(skb, sizeof(tagged_llc_snap_hdr)); |
538 | /* add LLC/SNAP header */ | ||
513 | skb_copy_to_linear_data(skb, &tagged_llc_snap_hdr, | 539 | skb_copy_to_linear_data(skb, &tagged_llc_snap_hdr, |
514 | sizeof(tagged_llc_snap_hdr)); | 540 | sizeof(tagged_llc_snap_hdr)); |
515 | } else { | 541 | } else { |
516 | skb_pull(skb, ETH_HLEN); /* get rid of Eth header */ | 542 | skb_pull(skb, ETH_HLEN); /* get rid of Eth header */ |
517 | skb_push(skb, sizeof(struct llc_snap_hdr)); /* add LLC/SNAP header + tag */ | 543 | skb_push(skb, sizeof(struct llc_snap_hdr)); |
544 | /* add LLC/SNAP header + tag */ | ||
518 | skb_copy_to_linear_data(skb, &llc_snap_mpoa_data, | 545 | skb_copy_to_linear_data(skb, &llc_snap_mpoa_data, |
519 | sizeof(struct llc_snap_hdr)); | 546 | sizeof(struct llc_snap_hdr)); |
520 | } | 547 | } |
@@ -539,8 +566,8 @@ static netdev_tx_t mpc_send_packet(struct sk_buff *skb, | |||
539 | int i = 0; | 566 | int i = 0; |
540 | 567 | ||
541 | mpc = find_mpc_by_lec(dev); /* this should NEVER fail */ | 568 | mpc = find_mpc_by_lec(dev); /* this should NEVER fail */ |
542 | if(mpc == NULL) { | 569 | if (mpc == NULL) { |
543 | printk("mpoa: (%s) mpc_send_packet: no MPC found\n", dev->name); | 570 | pr_info("(%s) no MPC found\n", dev->name); |
544 | goto non_ip; | 571 | goto non_ip; |
545 | } | 572 | } |
546 | 573 | ||
@@ -556,14 +583,15 @@ static netdev_tx_t mpc_send_packet(struct sk_buff *skb, | |||
556 | goto non_ip; | 583 | goto non_ip; |
557 | 584 | ||
558 | while (i < mpc->number_of_mps_macs) { | 585 | while (i < mpc->number_of_mps_macs) { |
559 | if (!compare_ether_addr(eth->h_dest, (mpc->mps_macs + i*ETH_ALEN))) | 586 | if (!compare_ether_addr(eth->h_dest, |
560 | if ( send_via_shortcut(skb, mpc) == 0 ) /* try shortcut */ | 587 | (mpc->mps_macs + i*ETH_ALEN))) |
561 | return NETDEV_TX_OK; /* success! */ | 588 | if (send_via_shortcut(skb, mpc) == 0) /* try shortcut */ |
589 | return NETDEV_TX_OK; | ||
562 | i++; | 590 | i++; |
563 | } | 591 | } |
564 | 592 | ||
565 | non_ip: | 593 | non_ip: |
566 | return mpc->old_ops->ndo_start_xmit(skb,dev); | 594 | return mpc->old_ops->ndo_start_xmit(skb, dev); |
567 | } | 595 | } |
568 | 596 | ||
569 | static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg) | 597 | static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg) |
@@ -576,7 +604,8 @@ static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg) | |||
576 | 604 | ||
577 | bytes_left = copy_from_user(&ioc_data, arg, sizeof(struct atmmpc_ioc)); | 605 | bytes_left = copy_from_user(&ioc_data, arg, sizeof(struct atmmpc_ioc)); |
578 | if (bytes_left != 0) { | 606 | if (bytes_left != 0) { |
579 | printk("mpoa: mpc_vcc_attach: Short read (missed %d bytes) from userland\n", bytes_left); | 607 | pr_info("mpoa:Short read (missed %d bytes) from userland\n", |
608 | bytes_left); | ||
580 | return -EFAULT; | 609 | return -EFAULT; |
581 | } | 610 | } |
582 | ipaddr = ioc_data.ipaddr; | 611 | ipaddr = ioc_data.ipaddr; |
@@ -589,18 +618,20 @@ static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg) | |||
589 | 618 | ||
590 | if (ioc_data.type == MPC_SOCKET_INGRESS) { | 619 | if (ioc_data.type == MPC_SOCKET_INGRESS) { |
591 | in_entry = mpc->in_ops->get(ipaddr, mpc); | 620 | in_entry = mpc->in_ops->get(ipaddr, mpc); |
592 | if (in_entry == NULL || in_entry->entry_state < INGRESS_RESOLVED) { | 621 | if (in_entry == NULL || |
593 | printk("mpoa: (%s) mpc_vcc_attach: did not find RESOLVED entry from ingress cache\n", | 622 | in_entry->entry_state < INGRESS_RESOLVED) { |
623 | pr_info("(%s) did not find RESOLVED entry from ingress cache\n", | ||
594 | mpc->dev->name); | 624 | mpc->dev->name); |
595 | if (in_entry != NULL) mpc->in_ops->put(in_entry); | 625 | if (in_entry != NULL) |
626 | mpc->in_ops->put(in_entry); | ||
596 | return -EINVAL; | 627 | return -EINVAL; |
597 | } | 628 | } |
598 | printk("mpoa: (%s) mpc_vcc_attach: attaching ingress SVC, entry = %pI4\n", | 629 | pr_info("(%s) attaching ingress SVC, entry = %pI4\n", |
599 | mpc->dev->name, &in_entry->ctrl_info.in_dst_ip); | 630 | mpc->dev->name, &in_entry->ctrl_info.in_dst_ip); |
600 | in_entry->shortcut = vcc; | 631 | in_entry->shortcut = vcc; |
601 | mpc->in_ops->put(in_entry); | 632 | mpc->in_ops->put(in_entry); |
602 | } else { | 633 | } else { |
603 | printk("mpoa: (%s) mpc_vcc_attach: attaching egress SVC\n", mpc->dev->name); | 634 | pr_info("(%s) attaching egress SVC\n", mpc->dev->name); |
604 | } | 635 | } |
605 | 636 | ||
606 | vcc->proto_data = mpc->dev; | 637 | vcc->proto_data = mpc->dev; |
@@ -620,7 +651,7 @@ static void mpc_vcc_close(struct atm_vcc *vcc, struct net_device *dev) | |||
620 | 651 | ||
621 | mpc = find_mpc_by_lec(dev); | 652 | mpc = find_mpc_by_lec(dev); |
622 | if (mpc == NULL) { | 653 | if (mpc == NULL) { |
623 | printk("mpoa: (%s) mpc_vcc_close: close for unknown MPC\n", dev->name); | 654 | pr_info("(%s) close for unknown MPC\n", dev->name); |
624 | return; | 655 | return; |
625 | } | 656 | } |
626 | 657 | ||
@@ -628,19 +659,21 @@ static void mpc_vcc_close(struct atm_vcc *vcc, struct net_device *dev) | |||
628 | in_entry = mpc->in_ops->get_by_vcc(vcc, mpc); | 659 | in_entry = mpc->in_ops->get_by_vcc(vcc, mpc); |
629 | if (in_entry) { | 660 | if (in_entry) { |
630 | dprintk("mpoa: (%s) mpc_vcc_close: ingress SVC closed ip = %pI4\n", | 661 | dprintk("mpoa: (%s) mpc_vcc_close: ingress SVC closed ip = %pI4\n", |
631 | mpc->dev->name, &in_entry->ctrl_info.in_dst_ip); | 662 | mpc->dev->name, &in_entry->ctrl_info.in_dst_ip); |
632 | in_entry->shortcut = NULL; | 663 | in_entry->shortcut = NULL; |
633 | mpc->in_ops->put(in_entry); | 664 | mpc->in_ops->put(in_entry); |
634 | } | 665 | } |
635 | eg_entry = mpc->eg_ops->get_by_vcc(vcc, mpc); | 666 | eg_entry = mpc->eg_ops->get_by_vcc(vcc, mpc); |
636 | if (eg_entry) { | 667 | if (eg_entry) { |
637 | dprintk("mpoa: (%s) mpc_vcc_close: egress SVC closed\n", mpc->dev->name); | 668 | dprintk("mpoa: (%s) mpc_vcc_close: egress SVC closed\n", |
669 | mpc->dev->name); | ||
638 | eg_entry->shortcut = NULL; | 670 | eg_entry->shortcut = NULL; |
639 | mpc->eg_ops->put(eg_entry); | 671 | mpc->eg_ops->put(eg_entry); |
640 | } | 672 | } |
641 | 673 | ||
642 | if (in_entry == NULL && eg_entry == NULL) | 674 | if (in_entry == NULL && eg_entry == NULL) |
643 | dprintk("mpoa: (%s) mpc_vcc_close: unused vcc closed\n", dev->name); | 675 | dprintk("mpoa: (%s) mpc_vcc_close: unused vcc closed\n", |
676 | dev->name); | ||
644 | 677 | ||
645 | return; | 678 | return; |
646 | } | 679 | } |
@@ -656,16 +689,19 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb) | |||
656 | 689 | ||
657 | ddprintk("mpoa: (%s) mpc_push:\n", dev->name); | 690 | ddprintk("mpoa: (%s) mpc_push:\n", dev->name); |
658 | if (skb == NULL) { | 691 | if (skb == NULL) { |
659 | dprintk("mpoa: (%s) mpc_push: null skb, closing VCC\n", dev->name); | 692 | dprintk("mpoa: (%s) mpc_push: null skb, closing VCC\n", |
693 | dev->name); | ||
660 | mpc_vcc_close(vcc, dev); | 694 | mpc_vcc_close(vcc, dev); |
661 | return; | 695 | return; |
662 | } | 696 | } |
663 | 697 | ||
664 | skb->dev = dev; | 698 | skb->dev = dev; |
665 | if (memcmp(skb->data, &llc_snap_mpoa_ctrl, sizeof(struct llc_snap_hdr)) == 0) { | 699 | if (memcmp(skb->data, &llc_snap_mpoa_ctrl, |
700 | sizeof(struct llc_snap_hdr)) == 0) { | ||
666 | struct sock *sk = sk_atm(vcc); | 701 | struct sock *sk = sk_atm(vcc); |
667 | 702 | ||
668 | dprintk("mpoa: (%s) mpc_push: control packet arrived\n", dev->name); | 703 | dprintk("mpoa: (%s) mpc_push: control packet arrived\n", |
704 | dev->name); | ||
669 | /* Pass control packets to daemon */ | 705 | /* Pass control packets to daemon */ |
670 | skb_queue_tail(&sk->sk_receive_queue, skb); | 706 | skb_queue_tail(&sk->sk_receive_queue, skb); |
671 | sk->sk_data_ready(sk, skb->len); | 707 | sk->sk_data_ready(sk, skb->len); |
@@ -677,20 +713,23 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb) | |||
677 | 713 | ||
678 | mpc = find_mpc_by_lec(dev); | 714 | mpc = find_mpc_by_lec(dev); |
679 | if (mpc == NULL) { | 715 | if (mpc == NULL) { |
680 | printk("mpoa: (%s) mpc_push: unknown MPC\n", dev->name); | 716 | pr_info("(%s) unknown MPC\n", dev->name); |
681 | return; | 717 | return; |
682 | } | 718 | } |
683 | 719 | ||
684 | if (memcmp(skb->data, &llc_snap_mpoa_data_tagged, sizeof(struct llc_snap_hdr)) == 0) { /* MPOA tagged data */ | 720 | if (memcmp(skb->data, &llc_snap_mpoa_data_tagged, |
685 | ddprintk("mpoa: (%s) mpc_push: tagged data packet arrived\n", dev->name); | 721 | sizeof(struct llc_snap_hdr)) == 0) { /* MPOA tagged data */ |
722 | ddprintk("mpoa: (%s) mpc_push: tagged data packet arrived\n", | ||
723 | dev->name); | ||
686 | 724 | ||
687 | } else if (memcmp(skb->data, &llc_snap_mpoa_data, sizeof(struct llc_snap_hdr)) == 0) { /* MPOA data */ | 725 | } else if (memcmp(skb->data, &llc_snap_mpoa_data, |
688 | printk("mpoa: (%s) mpc_push: non-tagged data packet arrived\n", dev->name); | 726 | sizeof(struct llc_snap_hdr)) == 0) { /* MPOA data */ |
689 | printk(" mpc_push: non-tagged data unsupported, purging\n"); | 727 | pr_info("(%s) Unsupported non-tagged data packet arrived. Purging\n", |
728 | dev->name); | ||
690 | dev_kfree_skb_any(skb); | 729 | dev_kfree_skb_any(skb); |
691 | return; | 730 | return; |
692 | } else { | 731 | } else { |
693 | printk("mpoa: (%s) mpc_push: garbage arrived, purging\n", dev->name); | 732 | pr_info("(%s) garbage arrived, purging\n", dev->name); |
694 | dev_kfree_skb_any(skb); | 733 | dev_kfree_skb_any(skb); |
695 | return; | 734 | return; |
696 | } | 735 | } |
@@ -700,8 +739,8 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb) | |||
700 | 739 | ||
701 | eg = mpc->eg_ops->get_by_tag(tag, mpc); | 740 | eg = mpc->eg_ops->get_by_tag(tag, mpc); |
702 | if (eg == NULL) { | 741 | if (eg == NULL) { |
703 | printk("mpoa: (%s) mpc_push: Didn't find egress cache entry, tag = %u\n", | 742 | pr_info("mpoa: (%s) Didn't find egress cache entry, tag = %u\n", |
704 | dev->name,tag); | 743 | dev->name, tag); |
705 | purge_egress_shortcut(vcc, NULL); | 744 | purge_egress_shortcut(vcc, NULL); |
706 | dev_kfree_skb_any(skb); | 745 | dev_kfree_skb_any(skb); |
707 | return; | 746 | return; |
@@ -713,13 +752,15 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb) | |||
713 | */ | 752 | */ |
714 | if (eg->shortcut == NULL) { | 753 | if (eg->shortcut == NULL) { |
715 | eg->shortcut = vcc; | 754 | eg->shortcut = vcc; |
716 | printk("mpoa: (%s) mpc_push: egress SVC in use\n", dev->name); | 755 | pr_info("(%s) egress SVC in use\n", dev->name); |
717 | } | 756 | } |
718 | 757 | ||
719 | skb_pull(skb, sizeof(struct llc_snap_hdr) + sizeof(tag)); /* get rid of LLC/SNAP header */ | 758 | skb_pull(skb, sizeof(struct llc_snap_hdr) + sizeof(tag)); |
720 | new_skb = skb_realloc_headroom(skb, eg->ctrl_info.DH_length); /* LLC/SNAP is shorter than MAC header :( */ | 759 | /* get rid of LLC/SNAP header */ |
760 | new_skb = skb_realloc_headroom(skb, eg->ctrl_info.DH_length); | ||
761 | /* LLC/SNAP is shorter than MAC header :( */ | ||
721 | dev_kfree_skb_any(skb); | 762 | dev_kfree_skb_any(skb); |
722 | if (new_skb == NULL){ | 763 | if (new_skb == NULL) { |
723 | mpc->eg_ops->put(eg); | 764 | mpc->eg_ops->put(eg); |
724 | return; | 765 | return; |
725 | } | 766 | } |
@@ -752,7 +793,7 @@ static struct atm_dev mpc_dev = { | |||
752 | /* members not explicitly initialised will be 0 */ | 793 | /* members not explicitly initialised will be 0 */ |
753 | }; | 794 | }; |
754 | 795 | ||
755 | static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg) | 796 | static int atm_mpoa_mpoad_attach(struct atm_vcc *vcc, int arg) |
756 | { | 797 | { |
757 | struct mpoa_client *mpc; | 798 | struct mpoa_client *mpc; |
758 | struct lec_priv *priv; | 799 | struct lec_priv *priv; |
@@ -772,15 +813,17 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg) | |||
772 | 813 | ||
773 | mpc = find_mpc_by_itfnum(arg); | 814 | mpc = find_mpc_by_itfnum(arg); |
774 | if (mpc == NULL) { | 815 | if (mpc == NULL) { |
775 | dprintk("mpoa: mpoad_attach: allocating new mpc for itf %d\n", arg); | 816 | dprintk("mpoa: mpoad_attach: allocating new mpc for itf %d\n", |
817 | arg); | ||
776 | mpc = alloc_mpc(); | 818 | mpc = alloc_mpc(); |
777 | if (mpc == NULL) | 819 | if (mpc == NULL) |
778 | return -ENOMEM; | 820 | return -ENOMEM; |
779 | mpc->dev_num = arg; | 821 | mpc->dev_num = arg; |
780 | mpc->dev = find_lec_by_itfnum(arg); /* NULL if there was no lec */ | 822 | mpc->dev = find_lec_by_itfnum(arg); |
823 | /* NULL if there was no lec */ | ||
781 | } | 824 | } |
782 | if (mpc->mpoad_vcc) { | 825 | if (mpc->mpoad_vcc) { |
783 | printk("mpoa: mpoad_attach: mpoad is already present for itf %d\n", arg); | 826 | pr_info("mpoad is already present for itf %d\n", arg); |
784 | return -EADDRINUSE; | 827 | return -EADDRINUSE; |
785 | } | 828 | } |
786 | 829 | ||
@@ -796,8 +839,8 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg) | |||
796 | mpc->mpoad_vcc = vcc; | 839 | mpc->mpoad_vcc = vcc; |
797 | vcc->dev = &mpc_dev; | 840 | vcc->dev = &mpc_dev; |
798 | vcc_insert_socket(sk_atm(vcc)); | 841 | vcc_insert_socket(sk_atm(vcc)); |
799 | set_bit(ATM_VF_META,&vcc->flags); | 842 | set_bit(ATM_VF_META, &vcc->flags); |
800 | set_bit(ATM_VF_READY,&vcc->flags); | 843 | set_bit(ATM_VF_READY, &vcc->flags); |
801 | 844 | ||
802 | if (mpc->dev) { | 845 | if (mpc->dev) { |
803 | char empty[ATM_ESA_LEN]; | 846 | char empty[ATM_ESA_LEN]; |
@@ -807,7 +850,7 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg) | |||
807 | /* set address if mpcd e.g. gets killed and restarted. | 850 | /* set address if mpcd e.g. gets killed and restarted. |
808 | * If we do not do it now we have to wait for the next LE_ARP | 851 | * If we do not do it now we have to wait for the next LE_ARP |
809 | */ | 852 | */ |
810 | if ( memcmp(mpc->mps_ctrl_addr, empty, ATM_ESA_LEN) != 0 ) | 853 | if (memcmp(mpc->mps_ctrl_addr, empty, ATM_ESA_LEN) != 0) |
811 | send_set_mps_ctrl_addr(mpc->mps_ctrl_addr, mpc); | 854 | send_set_mps_ctrl_addr(mpc->mps_ctrl_addr, mpc); |
812 | } | 855 | } |
813 | 856 | ||
@@ -819,7 +862,7 @@ static void send_set_mps_ctrl_addr(const char *addr, struct mpoa_client *mpc) | |||
819 | { | 862 | { |
820 | struct k_message mesg; | 863 | struct k_message mesg; |
821 | 864 | ||
822 | memcpy (mpc->mps_ctrl_addr, addr, ATM_ESA_LEN); | 865 | memcpy(mpc->mps_ctrl_addr, addr, ATM_ESA_LEN); |
823 | 866 | ||
824 | mesg.type = SET_MPS_CTRL_ADDR; | 867 | mesg.type = SET_MPS_CTRL_ADDR; |
825 | memcpy(mesg.MPS_ctrl, addr, ATM_ESA_LEN); | 868 | memcpy(mesg.MPS_ctrl, addr, ATM_ESA_LEN); |
@@ -835,11 +878,11 @@ static void mpoad_close(struct atm_vcc *vcc) | |||
835 | 878 | ||
836 | mpc = find_mpc_by_vcc(vcc); | 879 | mpc = find_mpc_by_vcc(vcc); |
837 | if (mpc == NULL) { | 880 | if (mpc == NULL) { |
838 | printk("mpoa: mpoad_close: did not find MPC\n"); | 881 | pr_info("did not find MPC\n"); |
839 | return; | 882 | return; |
840 | } | 883 | } |
841 | if (!mpc->mpoad_vcc) { | 884 | if (!mpc->mpoad_vcc) { |
842 | printk("mpoa: mpoad_close: close for non-present mpoad\n"); | 885 | pr_info("close for non-present mpoad\n"); |
843 | return; | 886 | return; |
844 | } | 887 | } |
845 | 888 | ||
@@ -859,7 +902,7 @@ static void mpoad_close(struct atm_vcc *vcc) | |||
859 | kfree_skb(skb); | 902 | kfree_skb(skb); |
860 | } | 903 | } |
861 | 904 | ||
862 | printk("mpoa: (%s) going down\n", | 905 | pr_info("(%s) going down\n", |
863 | (mpc->dev) ? mpc->dev->name : "<unknown>"); | 906 | (mpc->dev) ? mpc->dev->name : "<unknown>"); |
864 | module_put(THIS_MODULE); | 907 | module_put(THIS_MODULE); |
865 | 908 | ||
@@ -873,15 +916,16 @@ static int msg_from_mpoad(struct atm_vcc *vcc, struct sk_buff *skb) | |||
873 | { | 916 | { |
874 | 917 | ||
875 | struct mpoa_client *mpc = find_mpc_by_vcc(vcc); | 918 | struct mpoa_client *mpc = find_mpc_by_vcc(vcc); |
876 | struct k_message *mesg = (struct k_message*)skb->data; | 919 | struct k_message *mesg = (struct k_message *)skb->data; |
877 | atomic_sub(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); | 920 | atomic_sub(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); |
878 | 921 | ||
879 | if (mpc == NULL) { | 922 | if (mpc == NULL) { |
880 | printk("mpoa: msg_from_mpoad: no mpc found\n"); | 923 | pr_info("no mpc found\n"); |
881 | return 0; | 924 | return 0; |
882 | } | 925 | } |
883 | dprintk("mpoa: (%s) msg_from_mpoad:", (mpc->dev) ? mpc->dev->name : "<unknown>"); | 926 | dprintk("mpoa: (%s) msg_from_mpoad:", |
884 | switch(mesg->type) { | 927 | (mpc->dev) ? mpc->dev->name : "<unknown>"); |
928 | switch (mesg->type) { | ||
885 | case MPOA_RES_REPLY_RCVD: | 929 | case MPOA_RES_REPLY_RCVD: |
886 | dprintk(" mpoa_res_reply_rcvd\n"); | 930 | dprintk(" mpoa_res_reply_rcvd\n"); |
887 | MPOA_res_reply_rcvd(mesg, mpc); | 931 | MPOA_res_reply_rcvd(mesg, mpc); |
@@ -942,7 +986,7 @@ int msg_to_mpoad(struct k_message *mesg, struct mpoa_client *mpc) | |||
942 | struct sock *sk; | 986 | struct sock *sk; |
943 | 987 | ||
944 | if (mpc == NULL || !mpc->mpoad_vcc) { | 988 | if (mpc == NULL || !mpc->mpoad_vcc) { |
945 | printk("mpoa: msg_to_mpoad: mesg %d to a non-existent mpoad\n", mesg->type); | 989 | pr_info("mesg %d to a non-existent mpoad\n", mesg->type); |
946 | return -ENXIO; | 990 | return -ENXIO; |
947 | } | 991 | } |
948 | 992 | ||
@@ -960,7 +1004,8 @@ int msg_to_mpoad(struct k_message *mesg, struct mpoa_client *mpc) | |||
960 | return 0; | 1004 | return 0; |
961 | } | 1005 | } |
962 | 1006 | ||
963 | static int mpoa_event_listener(struct notifier_block *mpoa_notifier, unsigned long event, void *dev_ptr) | 1007 | static int mpoa_event_listener(struct notifier_block *mpoa_notifier, |
1008 | unsigned long event, void *dev_ptr) | ||
964 | { | 1009 | { |
965 | struct net_device *dev; | 1010 | struct net_device *dev; |
966 | struct mpoa_client *mpc; | 1011 | struct mpoa_client *mpc; |
@@ -983,10 +1028,10 @@ static int mpoa_event_listener(struct notifier_block *mpoa_notifier, unsigned lo | |||
983 | mpc = find_mpc_by_itfnum(priv->itfnum); | 1028 | mpc = find_mpc_by_itfnum(priv->itfnum); |
984 | if (mpc == NULL) { | 1029 | if (mpc == NULL) { |
985 | dprintk("mpoa: mpoa_event_listener: allocating new mpc for %s\n", | 1030 | dprintk("mpoa: mpoa_event_listener: allocating new mpc for %s\n", |
986 | dev->name); | 1031 | dev->name); |
987 | mpc = alloc_mpc(); | 1032 | mpc = alloc_mpc(); |
988 | if (mpc == NULL) { | 1033 | if (mpc == NULL) { |
989 | printk("mpoa: mpoa_event_listener: no new mpc"); | 1034 | pr_info("no new mpc"); |
990 | break; | 1035 | break; |
991 | } | 1036 | } |
992 | } | 1037 | } |
@@ -1010,9 +1055,8 @@ static int mpoa_event_listener(struct notifier_block *mpoa_notifier, unsigned lo | |||
1010 | mpc = find_mpc_by_lec(dev); | 1055 | mpc = find_mpc_by_lec(dev); |
1011 | if (mpc == NULL) | 1056 | if (mpc == NULL) |
1012 | break; | 1057 | break; |
1013 | if (mpc->mpoad_vcc != NULL) { | 1058 | if (mpc->mpoad_vcc != NULL) |
1014 | start_mpc(mpc, dev); | 1059 | start_mpc(mpc, dev); |
1015 | } | ||
1016 | break; | 1060 | break; |
1017 | case NETDEV_DOWN: | 1061 | case NETDEV_DOWN: |
1018 | /* the dev was ifconfig'ed down */ | 1062 | /* the dev was ifconfig'ed down */ |
@@ -1022,9 +1066,8 @@ static int mpoa_event_listener(struct notifier_block *mpoa_notifier, unsigned lo | |||
1022 | mpc = find_mpc_by_lec(dev); | 1066 | mpc = find_mpc_by_lec(dev); |
1023 | if (mpc == NULL) | 1067 | if (mpc == NULL) |
1024 | break; | 1068 | break; |
1025 | if (mpc->mpoad_vcc != NULL) { | 1069 | if (mpc->mpoad_vcc != NULL) |
1026 | stop_mpc(mpc); | 1070 | stop_mpc(mpc); |
1027 | } | ||
1028 | break; | 1071 | break; |
1029 | case NETDEV_REBOOT: | 1072 | case NETDEV_REBOOT: |
1030 | case NETDEV_CHANGE: | 1073 | case NETDEV_CHANGE: |
@@ -1051,7 +1094,7 @@ static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc) | |||
1051 | in_cache_entry *entry; | 1094 | in_cache_entry *entry; |
1052 | 1095 | ||
1053 | entry = mpc->in_ops->get(dst_ip, mpc); | 1096 | entry = mpc->in_ops->get(dst_ip, mpc); |
1054 | if(entry == NULL){ | 1097 | if (entry == NULL) { |
1055 | entry = mpc->in_ops->add_entry(dst_ip, mpc); | 1098 | entry = mpc->in_ops->add_entry(dst_ip, mpc); |
1056 | entry->entry_state = INGRESS_RESOLVING; | 1099 | entry->entry_state = INGRESS_RESOLVING; |
1057 | msg->type = SND_MPOA_RES_RQST; | 1100 | msg->type = SND_MPOA_RES_RQST; |
@@ -1062,7 +1105,7 @@ static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc) | |||
1062 | return; | 1105 | return; |
1063 | } | 1106 | } |
1064 | 1107 | ||
1065 | if(entry->entry_state == INGRESS_INVALID){ | 1108 | if (entry->entry_state == INGRESS_INVALID) { |
1066 | entry->entry_state = INGRESS_RESOLVING; | 1109 | entry->entry_state = INGRESS_RESOLVING; |
1067 | msg->type = SND_MPOA_RES_RQST; | 1110 | msg->type = SND_MPOA_RES_RQST; |
1068 | msg->content.in_info = entry->ctrl_info; | 1111 | msg->content.in_info = entry->ctrl_info; |
@@ -1072,7 +1115,7 @@ static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc) | |||
1072 | return; | 1115 | return; |
1073 | } | 1116 | } |
1074 | 1117 | ||
1075 | printk("mpoa: (%s) MPOA_trigger_rcvd: entry already in resolving state\n", | 1118 | pr_info("(%s) entry already in resolving state\n", |
1076 | (mpc->dev) ? mpc->dev->name : "<unknown>"); | 1119 | (mpc->dev) ? mpc->dev->name : "<unknown>"); |
1077 | mpc->in_ops->put(entry); | 1120 | mpc->in_ops->put(entry); |
1078 | return; | 1121 | return; |
@@ -1082,22 +1125,24 @@ static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc) | |||
1082 | * Things get complicated because we have to check if there's an egress | 1125 | * Things get complicated because we have to check if there's an egress |
1083 | * shortcut with suitable traffic parameters we could use. | 1126 | * shortcut with suitable traffic parameters we could use. |
1084 | */ | 1127 | */ |
1085 | static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_client *client, in_cache_entry *entry) | 1128 | static void check_qos_and_open_shortcut(struct k_message *msg, |
1129 | struct mpoa_client *client, | ||
1130 | in_cache_entry *entry) | ||
1086 | { | 1131 | { |
1087 | __be32 dst_ip = msg->content.in_info.in_dst_ip; | 1132 | __be32 dst_ip = msg->content.in_info.in_dst_ip; |
1088 | struct atm_mpoa_qos *qos = atm_mpoa_search_qos(dst_ip); | 1133 | struct atm_mpoa_qos *qos = atm_mpoa_search_qos(dst_ip); |
1089 | eg_cache_entry *eg_entry = client->eg_ops->get_by_src_ip(dst_ip, client); | 1134 | eg_cache_entry *eg_entry = client->eg_ops->get_by_src_ip(dst_ip, client); |
1090 | 1135 | ||
1091 | if(eg_entry && eg_entry->shortcut){ | 1136 | if (eg_entry && eg_entry->shortcut) { |
1092 | if(eg_entry->shortcut->qos.txtp.traffic_class & | 1137 | if (eg_entry->shortcut->qos.txtp.traffic_class & |
1093 | msg->qos.txtp.traffic_class & | 1138 | msg->qos.txtp.traffic_class & |
1094 | (qos ? qos->qos.txtp.traffic_class : ATM_UBR | ATM_CBR)){ | 1139 | (qos ? qos->qos.txtp.traffic_class : ATM_UBR | ATM_CBR)) { |
1095 | if(eg_entry->shortcut->qos.txtp.traffic_class == ATM_UBR) | 1140 | if (eg_entry->shortcut->qos.txtp.traffic_class == ATM_UBR) |
1096 | entry->shortcut = eg_entry->shortcut; | 1141 | entry->shortcut = eg_entry->shortcut; |
1097 | else if(eg_entry->shortcut->qos.txtp.max_pcr > 0) | 1142 | else if (eg_entry->shortcut->qos.txtp.max_pcr > 0) |
1098 | entry->shortcut = eg_entry->shortcut; | 1143 | entry->shortcut = eg_entry->shortcut; |
1099 | } | 1144 | } |
1100 | if(entry->shortcut){ | 1145 | if (entry->shortcut) { |
1101 | dprintk("mpoa: (%s) using egress SVC to reach %pI4\n", | 1146 | dprintk("mpoa: (%s) using egress SVC to reach %pI4\n", |
1102 | client->dev->name, &dst_ip); | 1147 | client->dev->name, &dst_ip); |
1103 | client->eg_ops->put(eg_entry); | 1148 | client->eg_ops->put(eg_entry); |
@@ -1109,12 +1154,13 @@ static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_clien | |||
1109 | 1154 | ||
1110 | /* No luck in the egress cache we must open an ingress SVC */ | 1155 | /* No luck in the egress cache we must open an ingress SVC */ |
1111 | msg->type = OPEN_INGRESS_SVC; | 1156 | msg->type = OPEN_INGRESS_SVC; |
1112 | if (qos && (qos->qos.txtp.traffic_class == msg->qos.txtp.traffic_class)) | 1157 | if (qos && |
1113 | { | 1158 | (qos->qos.txtp.traffic_class == msg->qos.txtp.traffic_class)) { |
1114 | msg->qos = qos->qos; | 1159 | msg->qos = qos->qos; |
1115 | printk("mpoa: (%s) trying to get a CBR shortcut\n",client->dev->name); | 1160 | pr_info("(%s) trying to get a CBR shortcut\n", |
1116 | } | 1161 | client->dev->name); |
1117 | else memset(&msg->qos,0,sizeof(struct atm_qos)); | 1162 | } else |
1163 | memset(&msg->qos, 0, sizeof(struct atm_qos)); | ||
1118 | msg_to_mpoad(msg, client); | 1164 | msg_to_mpoad(msg, client); |
1119 | return; | 1165 | return; |
1120 | } | 1166 | } |
@@ -1126,15 +1172,17 @@ static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc) | |||
1126 | 1172 | ||
1127 | dprintk("mpoa: (%s) MPOA_res_reply_rcvd: ip %pI4\n", | 1173 | dprintk("mpoa: (%s) MPOA_res_reply_rcvd: ip %pI4\n", |
1128 | mpc->dev->name, &dst_ip); | 1174 | mpc->dev->name, &dst_ip); |
1129 | ddprintk("mpoa: (%s) MPOA_res_reply_rcvd() entry = %p", mpc->dev->name, entry); | 1175 | ddprintk("mpoa: (%s) MPOA_res_reply_rcvd() entry = %p", |
1130 | if(entry == NULL){ | 1176 | mpc->dev->name, entry); |
1131 | printk("\nmpoa: (%s) ARGH, received res. reply for an entry that doesn't exist.\n", mpc->dev->name); | 1177 | if (entry == NULL) { |
1178 | pr_info("(%s) ARGH, received res. reply for an entry that doesn't exist.\n", | ||
1179 | mpc->dev->name); | ||
1132 | return; | 1180 | return; |
1133 | } | 1181 | } |
1134 | ddprintk(" entry_state = %d ", entry->entry_state); | 1182 | ddprintk(" entry_state = %d ", entry->entry_state); |
1135 | 1183 | ||
1136 | if (entry->entry_state == INGRESS_RESOLVED) { | 1184 | if (entry->entry_state == INGRESS_RESOLVED) { |
1137 | printk("\nmpoa: (%s) MPOA_res_reply_rcvd for RESOLVED entry!\n", mpc->dev->name); | 1185 | pr_info("(%s) RESOLVED entry!\n", mpc->dev->name); |
1138 | mpc->in_ops->put(entry); | 1186 | mpc->in_ops->put(entry); |
1139 | return; | 1187 | return; |
1140 | } | 1188 | } |
@@ -1145,15 +1193,16 @@ static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc) | |||
1145 | entry->refresh_time = 0; | 1193 | entry->refresh_time = 0; |
1146 | ddprintk("entry->shortcut = %p\n", entry->shortcut); | 1194 | ddprintk("entry->shortcut = %p\n", entry->shortcut); |
1147 | 1195 | ||
1148 | if(entry->entry_state == INGRESS_RESOLVING && entry->shortcut != NULL){ | 1196 | if (entry->entry_state == INGRESS_RESOLVING && |
1197 | entry->shortcut != NULL) { | ||
1149 | entry->entry_state = INGRESS_RESOLVED; | 1198 | entry->entry_state = INGRESS_RESOLVED; |
1150 | mpc->in_ops->put(entry); | 1199 | mpc->in_ops->put(entry); |
1151 | return; /* Shortcut already open... */ | 1200 | return; /* Shortcut already open... */ |
1152 | } | 1201 | } |
1153 | 1202 | ||
1154 | if (entry->shortcut != NULL) { | 1203 | if (entry->shortcut != NULL) { |
1155 | printk("mpoa: (%s) MPOA_res_reply_rcvd: entry->shortcut != NULL, impossible!\n", | 1204 | pr_info("(%s) entry->shortcut != NULL, impossible!\n", |
1156 | mpc->dev->name); | 1205 | mpc->dev->name); |
1157 | mpc->in_ops->put(entry); | 1206 | mpc->in_ops->put(entry); |
1158 | return; | 1207 | return; |
1159 | } | 1208 | } |
@@ -1172,9 +1221,9 @@ static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc) | |||
1172 | __be32 mask = msg->ip_mask; | 1221 | __be32 mask = msg->ip_mask; |
1173 | in_cache_entry *entry = mpc->in_ops->get_with_mask(dst_ip, mpc, mask); | 1222 | in_cache_entry *entry = mpc->in_ops->get_with_mask(dst_ip, mpc, mask); |
1174 | 1223 | ||
1175 | if(entry == NULL){ | 1224 | if (entry == NULL) { |
1176 | printk("mpoa: (%s) ingress_purge_rcvd: purge for a non-existing entry, ip = %pI4\n", | 1225 | pr_info("(%s) purge for a non-existing entry, ip = %pI4\n", |
1177 | mpc->dev->name, &dst_ip); | 1226 | mpc->dev->name, &dst_ip); |
1178 | return; | 1227 | return; |
1179 | } | 1228 | } |
1180 | 1229 | ||
@@ -1197,7 +1246,8 @@ static void egress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc) | |||
1197 | eg_cache_entry *entry = mpc->eg_ops->get_by_cache_id(cache_id, mpc); | 1246 | eg_cache_entry *entry = mpc->eg_ops->get_by_cache_id(cache_id, mpc); |
1198 | 1247 | ||
1199 | if (entry == NULL) { | 1248 | if (entry == NULL) { |
1200 | dprintk("mpoa: (%s) egress_purge_rcvd: purge for a non-existing entry\n", mpc->dev->name); | 1249 | dprintk("mpoa: (%s) egress_purge_rcvd: purge for a non-existing entry\n", |
1250 | mpc->dev->name); | ||
1201 | return; | 1251 | return; |
1202 | } | 1252 | } |
1203 | 1253 | ||
@@ -1218,13 +1268,13 @@ static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry) | |||
1218 | 1268 | ||
1219 | dprintk("mpoa: purge_egress_shortcut: entering\n"); | 1269 | dprintk("mpoa: purge_egress_shortcut: entering\n"); |
1220 | if (vcc == NULL) { | 1270 | if (vcc == NULL) { |
1221 | printk("mpoa: purge_egress_shortcut: vcc == NULL\n"); | 1271 | pr_info("vcc == NULL\n"); |
1222 | return; | 1272 | return; |
1223 | } | 1273 | } |
1224 | 1274 | ||
1225 | skb = alloc_skb(sizeof(struct k_message), GFP_ATOMIC); | 1275 | skb = alloc_skb(sizeof(struct k_message), GFP_ATOMIC); |
1226 | if (skb == NULL) { | 1276 | if (skb == NULL) { |
1227 | printk("mpoa: purge_egress_shortcut: out of memory\n"); | 1277 | pr_info("out of memory\n"); |
1228 | return; | 1278 | return; |
1229 | } | 1279 | } |
1230 | 1280 | ||
@@ -1249,14 +1299,14 @@ static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry) | |||
1249 | * Our MPS died. Tell our daemon to send NHRP data plane purge to each | 1299 | * Our MPS died. Tell our daemon to send NHRP data plane purge to each |
1250 | * of the egress shortcuts we have. | 1300 | * of the egress shortcuts we have. |
1251 | */ | 1301 | */ |
1252 | static void mps_death( struct k_message * msg, struct mpoa_client * mpc ) | 1302 | static void mps_death(struct k_message *msg, struct mpoa_client *mpc) |
1253 | { | 1303 | { |
1254 | eg_cache_entry *entry; | 1304 | eg_cache_entry *entry; |
1255 | 1305 | ||
1256 | dprintk("mpoa: (%s) mps_death:\n", mpc->dev->name); | 1306 | dprintk("mpoa: (%s) mps_death:\n", mpc->dev->name); |
1257 | 1307 | ||
1258 | if(memcmp(msg->MPS_ctrl, mpc->mps_ctrl_addr, ATM_ESA_LEN)){ | 1308 | if (memcmp(msg->MPS_ctrl, mpc->mps_ctrl_addr, ATM_ESA_LEN)) { |
1259 | printk("mpoa: (%s) mps_death: wrong MPS\n", mpc->dev->name); | 1309 | pr_info("(%s) wrong MPS\n", mpc->dev->name); |
1260 | return; | 1310 | return; |
1261 | } | 1311 | } |
1262 | 1312 | ||
@@ -1275,20 +1325,21 @@ static void mps_death( struct k_message * msg, struct mpoa_client * mpc ) | |||
1275 | return; | 1325 | return; |
1276 | } | 1326 | } |
1277 | 1327 | ||
1278 | static void MPOA_cache_impos_rcvd( struct k_message * msg, struct mpoa_client * mpc) | 1328 | static void MPOA_cache_impos_rcvd(struct k_message *msg, |
1329 | struct mpoa_client *mpc) | ||
1279 | { | 1330 | { |
1280 | uint16_t holding_time; | 1331 | uint16_t holding_time; |
1281 | eg_cache_entry *entry = mpc->eg_ops->get_by_cache_id(msg->content.eg_info.cache_id, mpc); | 1332 | eg_cache_entry *entry = mpc->eg_ops->get_by_cache_id(msg->content.eg_info.cache_id, mpc); |
1282 | 1333 | ||
1283 | holding_time = msg->content.eg_info.holding_time; | 1334 | holding_time = msg->content.eg_info.holding_time; |
1284 | dprintk("mpoa: (%s) MPOA_cache_impos_rcvd: entry = %p, holding_time = %u\n", | 1335 | dprintk("mpoa: (%s) MPOA_cache_impos_rcvd: entry = %p, holding_time = %u\n", |
1285 | mpc->dev->name, entry, holding_time); | 1336 | mpc->dev->name, entry, holding_time); |
1286 | if(entry == NULL && holding_time) { | 1337 | if (entry == NULL && holding_time) { |
1287 | entry = mpc->eg_ops->add_entry(msg, mpc); | 1338 | entry = mpc->eg_ops->add_entry(msg, mpc); |
1288 | mpc->eg_ops->put(entry); | 1339 | mpc->eg_ops->put(entry); |
1289 | return; | 1340 | return; |
1290 | } | 1341 | } |
1291 | if(holding_time){ | 1342 | if (holding_time) { |
1292 | mpc->eg_ops->update(entry, holding_time); | 1343 | mpc->eg_ops->update(entry, holding_time); |
1293 | return; | 1344 | return; |
1294 | } | 1345 | } |
@@ -1302,7 +1353,8 @@ static void MPOA_cache_impos_rcvd( struct k_message * msg, struct mpoa_client * | |||
1302 | return; | 1353 | return; |
1303 | } | 1354 | } |
1304 | 1355 | ||
1305 | static void set_mpc_ctrl_addr_rcvd(struct k_message *mesg, struct mpoa_client *mpc) | 1356 | static void set_mpc_ctrl_addr_rcvd(struct k_message *mesg, |
1357 | struct mpoa_client *mpc) | ||
1306 | { | 1358 | { |
1307 | struct lec_priv *priv; | 1359 | struct lec_priv *priv; |
1308 | int i, retval ; | 1360 | int i, retval ; |
@@ -1318,33 +1370,38 @@ static void set_mpc_ctrl_addr_rcvd(struct k_message *mesg, struct mpoa_client *m | |||
1318 | memcpy(mpc->our_ctrl_addr, mesg->MPS_ctrl, ATM_ESA_LEN); | 1370 | memcpy(mpc->our_ctrl_addr, mesg->MPS_ctrl, ATM_ESA_LEN); |
1319 | 1371 | ||
1320 | dprintk("mpoa: (%s) setting MPC ctrl ATM address to ", | 1372 | dprintk("mpoa: (%s) setting MPC ctrl ATM address to ", |
1321 | (mpc->dev) ? mpc->dev->name : "<unknown>"); | 1373 | (mpc->dev) ? mpc->dev->name : "<unknown>"); |
1322 | for (i = 7; i < sizeof(tlv); i++) | 1374 | for (i = 7; i < sizeof(tlv); i++) |
1323 | dprintk("%02x ", tlv[i]); | 1375 | dprintk("%02x ", tlv[i]); |
1324 | dprintk("\n"); | 1376 | dprintk("\n"); |
1325 | 1377 | ||
1326 | if (mpc->dev) { | 1378 | if (mpc->dev) { |
1327 | priv = netdev_priv(mpc->dev); | 1379 | priv = netdev_priv(mpc->dev); |
1328 | retval = priv->lane2_ops->associate_req(mpc->dev, mpc->dev->dev_addr, tlv, sizeof(tlv)); | 1380 | retval = priv->lane2_ops->associate_req(mpc->dev, |
1381 | mpc->dev->dev_addr, | ||
1382 | tlv, sizeof(tlv)); | ||
1329 | if (retval == 0) | 1383 | if (retval == 0) |
1330 | printk("mpoa: (%s) MPOA device type TLV association failed\n", mpc->dev->name); | 1384 | pr_info("(%s) MPOA device type TLV association failed\n", |
1385 | mpc->dev->name); | ||
1331 | retval = priv->lane2_ops->resolve(mpc->dev, NULL, 1, NULL, NULL); | 1386 | retval = priv->lane2_ops->resolve(mpc->dev, NULL, 1, NULL, NULL); |
1332 | if (retval < 0) | 1387 | if (retval < 0) |
1333 | printk("mpoa: (%s) targetless LE_ARP request failed\n", mpc->dev->name); | 1388 | pr_info("(%s) targetless LE_ARP request failed\n", |
1389 | mpc->dev->name); | ||
1334 | } | 1390 | } |
1335 | 1391 | ||
1336 | return; | 1392 | return; |
1337 | } | 1393 | } |
1338 | 1394 | ||
1339 | static void set_mps_mac_addr_rcvd(struct k_message *msg, struct mpoa_client *client) | 1395 | static void set_mps_mac_addr_rcvd(struct k_message *msg, |
1396 | struct mpoa_client *client) | ||
1340 | { | 1397 | { |
1341 | 1398 | ||
1342 | if(client->number_of_mps_macs) | 1399 | if (client->number_of_mps_macs) |
1343 | kfree(client->mps_macs); | 1400 | kfree(client->mps_macs); |
1344 | client->number_of_mps_macs = 0; | 1401 | client->number_of_mps_macs = 0; |
1345 | client->mps_macs = kmemdup(msg->MPS_ctrl, ETH_ALEN, GFP_KERNEL); | 1402 | client->mps_macs = kmemdup(msg->MPS_ctrl, ETH_ALEN, GFP_KERNEL); |
1346 | if (client->mps_macs == NULL) { | 1403 | if (client->mps_macs == NULL) { |
1347 | printk("mpoa: set_mps_mac_addr_rcvd: out of memory\n"); | 1404 | pr_info("out of memory\n"); |
1348 | return; | 1405 | return; |
1349 | } | 1406 | } |
1350 | client->number_of_mps_macs = 1; | 1407 | client->number_of_mps_macs = 1; |
@@ -1365,11 +1422,11 @@ static void clean_up(struct k_message *msg, struct mpoa_client *mpc, int action) | |||
1365 | /* FIXME: This knows too much of the cache structure */ | 1422 | /* FIXME: This knows too much of the cache structure */ |
1366 | read_lock_irq(&mpc->egress_lock); | 1423 | read_lock_irq(&mpc->egress_lock); |
1367 | entry = mpc->eg_cache; | 1424 | entry = mpc->eg_cache; |
1368 | while (entry != NULL){ | 1425 | while (entry != NULL) { |
1369 | msg->content.eg_info = entry->ctrl_info; | 1426 | msg->content.eg_info = entry->ctrl_info; |
1370 | dprintk("mpoa: cache_id %u\n", entry->ctrl_info.cache_id); | 1427 | dprintk("mpoa: cache_id %u\n", entry->ctrl_info.cache_id); |
1371 | msg_to_mpoad(msg, mpc); | 1428 | msg_to_mpoad(msg, mpc); |
1372 | entry = entry->next; | 1429 | entry = entry->next; |
1373 | } | 1430 | } |
1374 | read_unlock_irq(&mpc->egress_lock); | 1431 | read_unlock_irq(&mpc->egress_lock); |
1375 | 1432 | ||
@@ -1388,20 +1445,22 @@ static void mpc_timer_refresh(void) | |||
1388 | return; | 1445 | return; |
1389 | } | 1446 | } |
1390 | 1447 | ||
1391 | static void mpc_cache_check( unsigned long checking_time ) | 1448 | static void mpc_cache_check(unsigned long checking_time) |
1392 | { | 1449 | { |
1393 | struct mpoa_client *mpc = mpcs; | 1450 | struct mpoa_client *mpc = mpcs; |
1394 | static unsigned long previous_resolving_check_time; | 1451 | static unsigned long previous_resolving_check_time; |
1395 | static unsigned long previous_refresh_time; | 1452 | static unsigned long previous_refresh_time; |
1396 | 1453 | ||
1397 | while( mpc != NULL ){ | 1454 | while (mpc != NULL) { |
1398 | mpc->in_ops->clear_count(mpc); | 1455 | mpc->in_ops->clear_count(mpc); |
1399 | mpc->eg_ops->clear_expired(mpc); | 1456 | mpc->eg_ops->clear_expired(mpc); |
1400 | if(checking_time - previous_resolving_check_time > mpc->parameters.mpc_p4 * HZ ){ | 1457 | if (checking_time - previous_resolving_check_time > |
1458 | mpc->parameters.mpc_p4 * HZ) { | ||
1401 | mpc->in_ops->check_resolving(mpc); | 1459 | mpc->in_ops->check_resolving(mpc); |
1402 | previous_resolving_check_time = checking_time; | 1460 | previous_resolving_check_time = checking_time; |
1403 | } | 1461 | } |
1404 | if(checking_time - previous_refresh_time > mpc->parameters.mpc_p5 * HZ ){ | 1462 | if (checking_time - previous_refresh_time > |
1463 | mpc->parameters.mpc_p5 * HZ) { | ||
1405 | mpc->in_ops->refresh(mpc); | 1464 | mpc->in_ops->refresh(mpc); |
1406 | previous_refresh_time = checking_time; | 1465 | previous_refresh_time = checking_time; |
1407 | } | 1466 | } |
@@ -1412,7 +1471,8 @@ static void mpc_cache_check( unsigned long checking_time ) | |||
1412 | return; | 1471 | return; |
1413 | } | 1472 | } |
1414 | 1473 | ||
1415 | static int atm_mpoa_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | 1474 | static int atm_mpoa_ioctl(struct socket *sock, unsigned int cmd, |
1475 | unsigned long arg) | ||
1416 | { | 1476 | { |
1417 | int err = 0; | 1477 | int err = 0; |
1418 | struct atm_vcc *vcc = ATM_SD(sock); | 1478 | struct atm_vcc *vcc = ATM_SD(sock); |
@@ -1424,21 +1484,20 @@ static int atm_mpoa_ioctl(struct socket *sock, unsigned int cmd, unsigned long a | |||
1424 | return -EPERM; | 1484 | return -EPERM; |
1425 | 1485 | ||
1426 | switch (cmd) { | 1486 | switch (cmd) { |
1427 | case ATMMPC_CTRL: | 1487 | case ATMMPC_CTRL: |
1428 | err = atm_mpoa_mpoad_attach(vcc, (int)arg); | 1488 | err = atm_mpoa_mpoad_attach(vcc, (int)arg); |
1429 | if (err >= 0) | 1489 | if (err >= 0) |
1430 | sock->state = SS_CONNECTED; | 1490 | sock->state = SS_CONNECTED; |
1431 | break; | 1491 | break; |
1432 | case ATMMPC_DATA: | 1492 | case ATMMPC_DATA: |
1433 | err = atm_mpoa_vcc_attach(vcc, (void __user *)arg); | 1493 | err = atm_mpoa_vcc_attach(vcc, (void __user *)arg); |
1434 | break; | 1494 | break; |
1435 | default: | 1495 | default: |
1436 | break; | 1496 | break; |
1437 | } | 1497 | } |
1438 | return err; | 1498 | return err; |
1439 | } | 1499 | } |
1440 | 1500 | ||
1441 | |||
1442 | static struct atm_ioctl atm_ioctl_ops = { | 1501 | static struct atm_ioctl atm_ioctl_ops = { |
1443 | .owner = THIS_MODULE, | 1502 | .owner = THIS_MODULE, |
1444 | .ioctl = atm_mpoa_ioctl, | 1503 | .ioctl = atm_mpoa_ioctl, |
@@ -1451,7 +1510,7 @@ static __init int atm_mpoa_init(void) | |||
1451 | if (mpc_proc_init() != 0) | 1510 | if (mpc_proc_init() != 0) |
1452 | pr_info("failed to initialize /proc/mpoa\n"); | 1511 | pr_info("failed to initialize /proc/mpoa\n"); |
1453 | 1512 | ||
1454 | printk("mpc.c: " __DATE__ " " __TIME__ " initialized\n"); | 1513 | pr_info("mpc.c: " __DATE__ " " __TIME__ " initialized\n"); |
1455 | 1514 | ||
1456 | return 0; | 1515 | return 0; |
1457 | } | 1516 | } |