diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-11-14 23:40:49 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:22:47 -0500 |
commit | c68b907028d35b0ad5a98b5e5552f0ad56a9ba1d (patch) | |
tree | 55a078b2a11da0bfe4b9cbe80608ff6493ee1966 /net | |
parent | ba4e58eca8aa9473b44fdfd312f26c4a2e7798b3 (diff) |
[NETPOLL]: Minor coding-style cleanups.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/netpoll.c | 99 |
1 files changed, 48 insertions, 51 deletions
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 0d1de3c47a01..0746c81c57b0 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -78,7 +78,7 @@ static void queue_process(void *p) | |||
78 | } | 78 | } |
79 | 79 | ||
80 | static int checksum_udp(struct sk_buff *skb, struct udphdr *uh, | 80 | static int checksum_udp(struct sk_buff *skb, struct udphdr *uh, |
81 | unsigned short ulen, u32 saddr, u32 daddr) | 81 | unsigned short ulen, u32 saddr, u32 daddr) |
82 | { | 82 | { |
83 | unsigned int psum; | 83 | unsigned int psum; |
84 | 84 | ||
@@ -144,12 +144,11 @@ static void service_arp_queue(struct netpoll_info *npi) | |||
144 | arp_reply(skb); | 144 | arp_reply(skb); |
145 | skb = skb_dequeue(&npi->arp_tx); | 145 | skb = skb_dequeue(&npi->arp_tx); |
146 | } | 146 | } |
147 | return; | ||
148 | } | 147 | } |
149 | 148 | ||
150 | void netpoll_poll(struct netpoll *np) | 149 | void netpoll_poll(struct netpoll *np) |
151 | { | 150 | { |
152 | if(!np->dev || !netif_running(np->dev) || !np->dev->poll_controller) | 151 | if (!np->dev || !netif_running(np->dev) || !np->dev->poll_controller) |
153 | return; | 152 | return; |
154 | 153 | ||
155 | /* Process pending work on NIC */ | 154 | /* Process pending work on NIC */ |
@@ -194,7 +193,7 @@ static void zap_completion_queue(void) | |||
194 | while (clist != NULL) { | 193 | while (clist != NULL) { |
195 | struct sk_buff *skb = clist; | 194 | struct sk_buff *skb = clist; |
196 | clist = clist->next; | 195 | clist = clist->next; |
197 | if(skb->destructor) | 196 | if (skb->destructor) |
198 | dev_kfree_skb_any(skb); /* put this one back */ | 197 | dev_kfree_skb_any(skb); /* put this one back */ |
199 | else | 198 | else |
200 | __kfree_skb(skb); | 199 | __kfree_skb(skb); |
@@ -217,7 +216,7 @@ repeat: | |||
217 | if (!skb) | 216 | if (!skb) |
218 | skb = skb_dequeue(&skb_pool); | 217 | skb = skb_dequeue(&skb_pool); |
219 | 218 | ||
220 | if(!skb) { | 219 | if (!skb) { |
221 | if (++count < 10) { | 220 | if (++count < 10) { |
222 | netpoll_poll(np); | 221 | netpoll_poll(np); |
223 | goto repeat; | 222 | goto repeat; |
@@ -243,12 +242,11 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb) | |||
243 | } | 242 | } |
244 | 243 | ||
245 | /* don't get messages out of order, and no recursion */ | 244 | /* don't get messages out of order, and no recursion */ |
246 | if ( skb_queue_len(&npinfo->txq) == 0 | 245 | if (skb_queue_len(&npinfo->txq) == 0 && |
247 | && npinfo->poll_owner != smp_processor_id() | 246 | npinfo->poll_owner != smp_processor_id() && |
248 | && netif_tx_trylock(dev)) { | 247 | netif_tx_trylock(dev)) { |
249 | |||
250 | /* try until next clock tick */ | 248 | /* try until next clock tick */ |
251 | for(tries = jiffies_to_usecs(1)/USEC_PER_POLL; tries > 0; --tries) { | 249 | for (tries = jiffies_to_usecs(1)/USEC_PER_POLL; tries > 0; --tries) { |
252 | if (!netif_queue_stopped(dev)) | 250 | if (!netif_queue_stopped(dev)) |
253 | status = dev->hard_start_xmit(skb, dev); | 251 | status = dev->hard_start_xmit(skb, dev); |
254 | 252 | ||
@@ -384,8 +382,8 @@ static void arp_reply(struct sk_buff *skb) | |||
384 | 382 | ||
385 | if (np->dev->hard_header && | 383 | if (np->dev->hard_header && |
386 | np->dev->hard_header(send_skb, skb->dev, ptype, | 384 | np->dev->hard_header(send_skb, skb->dev, ptype, |
387 | np->remote_mac, np->local_mac, | 385 | np->remote_mac, np->local_mac, |
388 | send_skb->len) < 0) { | 386 | send_skb->len) < 0) { |
389 | kfree_skb(send_skb); | 387 | kfree_skb(send_skb); |
390 | return; | 388 | return; |
391 | } | 389 | } |
@@ -423,7 +421,6 @@ int __netpoll_rx(struct sk_buff *skb) | |||
423 | struct netpoll_info *npi = skb->dev->npinfo; | 421 | struct netpoll_info *npi = skb->dev->npinfo; |
424 | struct netpoll *np = npi->rx_np; | 422 | struct netpoll *np = npi->rx_np; |
425 | 423 | ||
426 | |||
427 | if (!np) | 424 | if (!np) |
428 | goto out; | 425 | goto out; |
429 | if (skb->dev->type != ARPHRD_ETHER) | 426 | if (skb->dev->type != ARPHRD_ETHER) |
@@ -496,47 +493,47 @@ int netpoll_parse_options(struct netpoll *np, char *opt) | |||
496 | { | 493 | { |
497 | char *cur=opt, *delim; | 494 | char *cur=opt, *delim; |
498 | 495 | ||
499 | if(*cur != '@') { | 496 | if (*cur != '@') { |
500 | if ((delim = strchr(cur, '@')) == NULL) | 497 | if ((delim = strchr(cur, '@')) == NULL) |
501 | goto parse_failed; | 498 | goto parse_failed; |
502 | *delim=0; | 499 | *delim = 0; |
503 | np->local_port=simple_strtol(cur, NULL, 10); | 500 | np->local_port = simple_strtol(cur, NULL, 10); |
504 | cur=delim; | 501 | cur = delim; |
505 | } | 502 | } |
506 | cur++; | 503 | cur++; |
507 | printk(KERN_INFO "%s: local port %d\n", np->name, np->local_port); | 504 | printk(KERN_INFO "%s: local port %d\n", np->name, np->local_port); |
508 | 505 | ||
509 | if(*cur != '/') { | 506 | if (*cur != '/') { |
510 | if ((delim = strchr(cur, '/')) == NULL) | 507 | if ((delim = strchr(cur, '/')) == NULL) |
511 | goto parse_failed; | 508 | goto parse_failed; |
512 | *delim=0; | 509 | *delim = 0; |
513 | np->local_ip=ntohl(in_aton(cur)); | 510 | np->local_ip = ntohl(in_aton(cur)); |
514 | cur=delim; | 511 | cur = delim; |
515 | 512 | ||
516 | printk(KERN_INFO "%s: local IP %d.%d.%d.%d\n", | 513 | printk(KERN_INFO "%s: local IP %d.%d.%d.%d\n", |
517 | np->name, HIPQUAD(np->local_ip)); | 514 | np->name, HIPQUAD(np->local_ip)); |
518 | } | 515 | } |
519 | cur++; | 516 | cur++; |
520 | 517 | ||
521 | if ( *cur != ',') { | 518 | if (*cur != ',') { |
522 | /* parse out dev name */ | 519 | /* parse out dev name */ |
523 | if ((delim = strchr(cur, ',')) == NULL) | 520 | if ((delim = strchr(cur, ',')) == NULL) |
524 | goto parse_failed; | 521 | goto parse_failed; |
525 | *delim=0; | 522 | *delim = 0; |
526 | strlcpy(np->dev_name, cur, sizeof(np->dev_name)); | 523 | strlcpy(np->dev_name, cur, sizeof(np->dev_name)); |
527 | cur=delim; | 524 | cur = delim; |
528 | } | 525 | } |
529 | cur++; | 526 | cur++; |
530 | 527 | ||
531 | printk(KERN_INFO "%s: interface %s\n", np->name, np->dev_name); | 528 | printk(KERN_INFO "%s: interface %s\n", np->name, np->dev_name); |
532 | 529 | ||
533 | if ( *cur != '@' ) { | 530 | if (*cur != '@') { |
534 | /* dst port */ | 531 | /* dst port */ |
535 | if ((delim = strchr(cur, '@')) == NULL) | 532 | if ((delim = strchr(cur, '@')) == NULL) |
536 | goto parse_failed; | 533 | goto parse_failed; |
537 | *delim=0; | 534 | *delim = 0; |
538 | np->remote_port=simple_strtol(cur, NULL, 10); | 535 | np->remote_port = simple_strtol(cur, NULL, 10); |
539 | cur=delim; | 536 | cur = delim; |
540 | } | 537 | } |
541 | cur++; | 538 | cur++; |
542 | printk(KERN_INFO "%s: remote port %d\n", np->name, np->remote_port); | 539 | printk(KERN_INFO "%s: remote port %d\n", np->name, np->remote_port); |
@@ -544,42 +541,41 @@ int netpoll_parse_options(struct netpoll *np, char *opt) | |||
544 | /* dst ip */ | 541 | /* dst ip */ |
545 | if ((delim = strchr(cur, '/')) == NULL) | 542 | if ((delim = strchr(cur, '/')) == NULL) |
546 | goto parse_failed; | 543 | goto parse_failed; |
547 | *delim=0; | 544 | *delim = 0; |
548 | np->remote_ip=ntohl(in_aton(cur)); | 545 | np->remote_ip = ntohl(in_aton(cur)); |
549 | cur=delim+1; | 546 | cur = delim + 1; |
550 | 547 | ||
551 | printk(KERN_INFO "%s: remote IP %d.%d.%d.%d\n", | 548 | printk(KERN_INFO "%s: remote IP %d.%d.%d.%d\n", |
552 | np->name, HIPQUAD(np->remote_ip)); | 549 | np->name, HIPQUAD(np->remote_ip)); |
553 | 550 | ||
554 | if( *cur != 0 ) | 551 | if (*cur != 0) { |
555 | { | ||
556 | /* MAC address */ | 552 | /* MAC address */ |
557 | if ((delim = strchr(cur, ':')) == NULL) | 553 | if ((delim = strchr(cur, ':')) == NULL) |
558 | goto parse_failed; | 554 | goto parse_failed; |
559 | *delim=0; | 555 | *delim = 0; |
560 | np->remote_mac[0]=simple_strtol(cur, NULL, 16); | 556 | np->remote_mac[0] = simple_strtol(cur, NULL, 16); |
561 | cur=delim+1; | 557 | cur = delim + 1; |
562 | if ((delim = strchr(cur, ':')) == NULL) | 558 | if ((delim = strchr(cur, ':')) == NULL) |
563 | goto parse_failed; | 559 | goto parse_failed; |
564 | *delim=0; | 560 | *delim = 0; |
565 | np->remote_mac[1]=simple_strtol(cur, NULL, 16); | 561 | np->remote_mac[1] = simple_strtol(cur, NULL, 16); |
566 | cur=delim+1; | 562 | cur = delim + 1; |
567 | if ((delim = strchr(cur, ':')) == NULL) | 563 | if ((delim = strchr(cur, ':')) == NULL) |
568 | goto parse_failed; | 564 | goto parse_failed; |
569 | *delim=0; | 565 | *delim = 0; |
570 | np->remote_mac[2]=simple_strtol(cur, NULL, 16); | 566 | np->remote_mac[2] = simple_strtol(cur, NULL, 16); |
571 | cur=delim+1; | 567 | cur = delim + 1; |
572 | if ((delim = strchr(cur, ':')) == NULL) | 568 | if ((delim = strchr(cur, ':')) == NULL) |
573 | goto parse_failed; | 569 | goto parse_failed; |
574 | *delim=0; | 570 | *delim = 0; |
575 | np->remote_mac[3]=simple_strtol(cur, NULL, 16); | 571 | np->remote_mac[3] = simple_strtol(cur, NULL, 16); |
576 | cur=delim+1; | 572 | cur = delim + 1; |
577 | if ((delim = strchr(cur, ':')) == NULL) | 573 | if ((delim = strchr(cur, ':')) == NULL) |
578 | goto parse_failed; | 574 | goto parse_failed; |
579 | *delim=0; | 575 | *delim = 0; |
580 | np->remote_mac[4]=simple_strtol(cur, NULL, 16); | 576 | np->remote_mac[4] = simple_strtol(cur, NULL, 16); |
581 | cur=delim+1; | 577 | cur = delim + 1; |
582 | np->remote_mac[5]=simple_strtol(cur, NULL, 16); | 578 | np->remote_mac[5] = simple_strtol(cur, NULL, 16); |
583 | } | 579 | } |
584 | 580 | ||
585 | printk(KERN_INFO "%s: remote ethernet address " | 581 | printk(KERN_INFO "%s: remote ethernet address " |
@@ -735,7 +731,8 @@ int netpoll_setup(struct netpoll *np) | |||
735 | return err; | 731 | return err; |
736 | } | 732 | } |
737 | 733 | ||
738 | static int __init netpoll_init(void) { | 734 | static int __init netpoll_init(void) |
735 | { | ||
739 | skb_queue_head_init(&skb_pool); | 736 | skb_queue_head_init(&skb_pool); |
740 | return 0; | 737 | return 0; |
741 | } | 738 | } |