Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 41670
b: refs/heads/master
c: c68b907
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller committed Dec 3, 2006
1 parent 87c475a commit 9db4276
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 52 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ba4e58eca8aa9473b44fdfd312f26c4a2e7798b3
refs/heads/master: c68b907028d35b0ad5a98b5e5552f0ad56a9ba1d
99 changes: 48 additions & 51 deletions trunk/net/core/netpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static void queue_process(void *p)
}

static int checksum_udp(struct sk_buff *skb, struct udphdr *uh,
unsigned short ulen, u32 saddr, u32 daddr)
unsigned short ulen, u32 saddr, u32 daddr)
{
unsigned int psum;

Expand Down Expand Up @@ -144,12 +144,11 @@ static void service_arp_queue(struct netpoll_info *npi)
arp_reply(skb);
skb = skb_dequeue(&npi->arp_tx);
}
return;
}

void netpoll_poll(struct netpoll *np)
{
if(!np->dev || !netif_running(np->dev) || !np->dev->poll_controller)
if (!np->dev || !netif_running(np->dev) || !np->dev->poll_controller)
return;

/* Process pending work on NIC */
Expand Down Expand Up @@ -194,7 +193,7 @@ static void zap_completion_queue(void)
while (clist != NULL) {
struct sk_buff *skb = clist;
clist = clist->next;
if(skb->destructor)
if (skb->destructor)
dev_kfree_skb_any(skb); /* put this one back */
else
__kfree_skb(skb);
Expand All @@ -217,7 +216,7 @@ static struct sk_buff *find_skb(struct netpoll *np, int len, int reserve)
if (!skb)
skb = skb_dequeue(&skb_pool);

if(!skb) {
if (!skb) {
if (++count < 10) {
netpoll_poll(np);
goto repeat;
Expand All @@ -243,12 +242,11 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
}

/* don't get messages out of order, and no recursion */
if ( skb_queue_len(&npinfo->txq) == 0
&& npinfo->poll_owner != smp_processor_id()
&& netif_tx_trylock(dev)) {

if (skb_queue_len(&npinfo->txq) == 0 &&
npinfo->poll_owner != smp_processor_id() &&
netif_tx_trylock(dev)) {
/* try until next clock tick */
for(tries = jiffies_to_usecs(1)/USEC_PER_POLL; tries > 0; --tries) {
for (tries = jiffies_to_usecs(1)/USEC_PER_POLL; tries > 0; --tries) {
if (!netif_queue_stopped(dev))
status = dev->hard_start_xmit(skb, dev);

Expand Down Expand Up @@ -384,8 +382,8 @@ static void arp_reply(struct sk_buff *skb)

if (np->dev->hard_header &&
np->dev->hard_header(send_skb, skb->dev, ptype,
np->remote_mac, np->local_mac,
send_skb->len) < 0) {
np->remote_mac, np->local_mac,
send_skb->len) < 0) {
kfree_skb(send_skb);
return;
}
Expand Down Expand Up @@ -423,7 +421,6 @@ int __netpoll_rx(struct sk_buff *skb)
struct netpoll_info *npi = skb->dev->npinfo;
struct netpoll *np = npi->rx_np;


if (!np)
goto out;
if (skb->dev->type != ARPHRD_ETHER)
Expand Down Expand Up @@ -496,90 +493,89 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
{
char *cur=opt, *delim;

if(*cur != '@') {
if (*cur != '@') {
if ((delim = strchr(cur, '@')) == NULL)
goto parse_failed;
*delim=0;
np->local_port=simple_strtol(cur, NULL, 10);
cur=delim;
*delim = 0;
np->local_port = simple_strtol(cur, NULL, 10);
cur = delim;
}
cur++;
printk(KERN_INFO "%s: local port %d\n", np->name, np->local_port);

if(*cur != '/') {
if (*cur != '/') {
if ((delim = strchr(cur, '/')) == NULL)
goto parse_failed;
*delim=0;
np->local_ip=ntohl(in_aton(cur));
cur=delim;
*delim = 0;
np->local_ip = ntohl(in_aton(cur));
cur = delim;

printk(KERN_INFO "%s: local IP %d.%d.%d.%d\n",
np->name, HIPQUAD(np->local_ip));
}
cur++;

if ( *cur != ',') {
if (*cur != ',') {
/* parse out dev name */
if ((delim = strchr(cur, ',')) == NULL)
goto parse_failed;
*delim=0;
*delim = 0;
strlcpy(np->dev_name, cur, sizeof(np->dev_name));
cur=delim;
cur = delim;
}
cur++;

printk(KERN_INFO "%s: interface %s\n", np->name, np->dev_name);

if ( *cur != '@' ) {
if (*cur != '@') {
/* dst port */
if ((delim = strchr(cur, '@')) == NULL)
goto parse_failed;
*delim=0;
np->remote_port=simple_strtol(cur, NULL, 10);
cur=delim;
*delim = 0;
np->remote_port = simple_strtol(cur, NULL, 10);
cur = delim;
}
cur++;
printk(KERN_INFO "%s: remote port %d\n", np->name, np->remote_port);

/* dst ip */
if ((delim = strchr(cur, '/')) == NULL)
goto parse_failed;
*delim=0;
np->remote_ip=ntohl(in_aton(cur));
cur=delim+1;
*delim = 0;
np->remote_ip = ntohl(in_aton(cur));
cur = delim + 1;

printk(KERN_INFO "%s: remote IP %d.%d.%d.%d\n",
np->name, HIPQUAD(np->remote_ip));
np->name, HIPQUAD(np->remote_ip));

if( *cur != 0 )
{
if (*cur != 0) {
/* MAC address */
if ((delim = strchr(cur, ':')) == NULL)
goto parse_failed;
*delim=0;
np->remote_mac[0]=simple_strtol(cur, NULL, 16);
cur=delim+1;
*delim = 0;
np->remote_mac[0] = simple_strtol(cur, NULL, 16);
cur = delim + 1;
if ((delim = strchr(cur, ':')) == NULL)
goto parse_failed;
*delim=0;
np->remote_mac[1]=simple_strtol(cur, NULL, 16);
cur=delim+1;
*delim = 0;
np->remote_mac[1] = simple_strtol(cur, NULL, 16);
cur = delim + 1;
if ((delim = strchr(cur, ':')) == NULL)
goto parse_failed;
*delim=0;
np->remote_mac[2]=simple_strtol(cur, NULL, 16);
cur=delim+1;
*delim = 0;
np->remote_mac[2] = simple_strtol(cur, NULL, 16);
cur = delim + 1;
if ((delim = strchr(cur, ':')) == NULL)
goto parse_failed;
*delim=0;
np->remote_mac[3]=simple_strtol(cur, NULL, 16);
cur=delim+1;
*delim = 0;
np->remote_mac[3] = simple_strtol(cur, NULL, 16);
cur = delim + 1;
if ((delim = strchr(cur, ':')) == NULL)
goto parse_failed;
*delim=0;
np->remote_mac[4]=simple_strtol(cur, NULL, 16);
cur=delim+1;
np->remote_mac[5]=simple_strtol(cur, NULL, 16);
*delim = 0;
np->remote_mac[4] = simple_strtol(cur, NULL, 16);
cur = delim + 1;
np->remote_mac[5] = simple_strtol(cur, NULL, 16);
}

printk(KERN_INFO "%s: remote ethernet address "
Expand Down Expand Up @@ -735,7 +731,8 @@ int netpoll_setup(struct netpoll *np)
return err;
}

static int __init netpoll_init(void) {
static int __init netpoll_init(void)
{
skb_queue_head_init(&skb_pool);
return 0;
}
Expand Down

0 comments on commit 9db4276

Please sign in to comment.