Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 198570
b: refs/heads/master
c: 76cc8b1
h: refs/heads/master
v: v3
  • Loading branch information
Tom Herbert authored and David S. Miller committed May 21, 2010
1 parent 8315e03 commit ba65f00
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 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: 1f01bfd202bc539bccd282befa2bbdb8d6ad80ee
refs/heads/master: 76cc8b13a6e41b537fd262b600da1571314add62
14 changes: 11 additions & 3 deletions trunk/include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -1407,17 +1407,25 @@ struct softnet_data {
struct softnet_data *rps_ipi_next;
unsigned int cpu;
unsigned int input_queue_head;
unsigned int input_queue_tail;
#endif
unsigned dropped;
struct sk_buff_head input_pkt_queue;
struct napi_struct backlog;
};

static inline void input_queue_head_add(struct softnet_data *sd,
unsigned int len)
static inline void input_queue_head_incr(struct softnet_data *sd)
{
#ifdef CONFIG_RPS
sd->input_queue_head += len;
sd->input_queue_head++;
#endif
}

static inline void input_queue_tail_incr_save(struct softnet_data *sd,
unsigned int *qtail)
{
#ifdef CONFIG_RPS
*qtail = ++sd->input_queue_tail;
#endif
}

Expand Down
28 changes: 15 additions & 13 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2426,10 +2426,7 @@ static int enqueue_to_backlog(struct sk_buff *skb, int cpu,
if (skb_queue_len(&sd->input_pkt_queue)) {
enqueue:
__skb_queue_tail(&sd->input_pkt_queue, skb);
#ifdef CONFIG_RPS
*qtail = sd->input_queue_head +
skb_queue_len(&sd->input_pkt_queue);
#endif
input_queue_tail_incr_save(sd, qtail);
rps_unlock(sd);
local_irq_restore(flags);
return NET_RX_SUCCESS;
Expand Down Expand Up @@ -2964,7 +2961,7 @@ static void flush_backlog(void *arg)
if (skb->dev == dev) {
__skb_unlink(skb, &sd->input_pkt_queue);
kfree_skb(skb);
input_queue_head_add(sd, 1);
input_queue_head_incr(sd);
}
}
rps_unlock(sd);
Expand All @@ -2973,6 +2970,7 @@ static void flush_backlog(void *arg)
if (skb->dev == dev) {
__skb_unlink(skb, &sd->process_queue);
kfree_skb(skb);
input_queue_head_incr(sd);
}
}
}
Expand Down Expand Up @@ -3328,18 +3326,20 @@ static int process_backlog(struct napi_struct *napi, int quota)
while ((skb = __skb_dequeue(&sd->process_queue))) {
local_irq_enable();
__netif_receive_skb(skb);
if (++work >= quota)
return work;
local_irq_disable();
input_queue_head_incr(sd);
if (++work >= quota) {
local_irq_enable();
return work;
}
}

rps_lock(sd);
qlen = skb_queue_len(&sd->input_pkt_queue);
if (qlen) {
input_queue_head_add(sd, qlen);
if (qlen)
skb_queue_splice_tail_init(&sd->input_pkt_queue,
&sd->process_queue);
}

if (qlen < quota - work) {
/*
* Inline a custom version of __napi_complete().
Expand Down Expand Up @@ -5679,12 +5679,14 @@ static int dev_cpu_callback(struct notifier_block *nfb,
local_irq_enable();

/* Process offline CPU's input_pkt_queue */
while ((skb = __skb_dequeue(&oldsd->input_pkt_queue))) {
while ((skb = __skb_dequeue(&oldsd->process_queue))) {
netif_rx(skb);
input_queue_head_add(oldsd, 1);
input_queue_head_incr(oldsd);
}
while ((skb = __skb_dequeue(&oldsd->process_queue)))
while ((skb = __skb_dequeue(&oldsd->input_pkt_queue))) {
netif_rx(skb);
input_queue_head_incr(oldsd);
}

return NOTIFY_OK;
}
Expand Down

0 comments on commit ba65f00

Please sign in to comment.