Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 194803
b: refs/heads/master
c: eecfd7c
h: refs/heads/master
i:
  194801: aacd77c
  194799: c9a1249
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed May 7, 2010
1 parent 95efa8c commit 28852c8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 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: 39e0786d3cf39c6d2f47b4818ae2da8b8ebc9ce2
refs/heads/master: eecfd7c4e36ff532d895885971d01d049bd3e014
28 changes: 22 additions & 6 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2205,6 +2205,14 @@ int netdev_max_backlog __read_mostly = 1000;
int netdev_budget __read_mostly = 300;
int weight_p __read_mostly = 64; /* old backlog weight */

/* Called with irq disabled */
static inline void ____napi_schedule(struct softnet_data *sd,
struct napi_struct *napi)
{
list_add_tail(&napi->poll_list, &sd->poll_list);
__raise_softirq_irqoff(NET_RX_SOFTIRQ);
}

#ifdef CONFIG_RPS

/* One global table that all flow-based protocols share. */
Expand Down Expand Up @@ -2363,7 +2371,7 @@ static void rps_trigger_softirq(void *data)
{
struct softnet_data *sd = data;

__napi_schedule(&sd->backlog);
____napi_schedule(sd, &sd->backlog);
sd->received_rps++;
}

Expand Down Expand Up @@ -2421,7 +2429,7 @@ static int enqueue_to_backlog(struct sk_buff *skb, int cpu,
/* Schedule NAPI for backlog device */
if (napi_schedule_prep(&sd->backlog)) {
if (!rps_ipi_queued(sd))
__napi_schedule(&sd->backlog);
____napi_schedule(sd, &sd->backlog);
}
goto enqueue;
}
Expand Down Expand Up @@ -3280,7 +3288,7 @@ static void net_rps_action_and_irq_enable(struct softnet_data *sd)
static int process_backlog(struct napi_struct *napi, int quota)
{
int work = 0;
struct softnet_data *sd = &__get_cpu_var(softnet_data);
struct softnet_data *sd = container_of(napi, struct softnet_data, backlog);

#ifdef CONFIG_RPS
/* Check if we have pending ipi, its better to send them now,
Expand Down Expand Up @@ -3313,7 +3321,16 @@ static int process_backlog(struct napi_struct *napi, int quota)
&sd->process_queue);
}
if (qlen < quota - work) {
__napi_complete(napi);
/*
* Inline a custom version of __napi_complete().
* only current cpu owns and manipulates this napi,
* and NAPI_STATE_SCHED is the only possible flag set on backlog.
* we can use a plain write instead of clear_bit(),
* and we dont need an smp_mb() memory barrier.
*/
list_del(&napi->poll_list);
napi->state = 0;

quota = work + qlen;
}
rps_unlock(sd);
Expand All @@ -3334,8 +3351,7 @@ void __napi_schedule(struct napi_struct *n)
unsigned long flags;

local_irq_save(flags);
list_add_tail(&n->poll_list, &__get_cpu_var(softnet_data).poll_list);
__raise_softirq_irqoff(NET_RX_SOFTIRQ);
____napi_schedule(&__get_cpu_var(softnet_data), n);
local_irq_restore(flags);
}
EXPORT_SYMBOL(__napi_schedule);
Expand Down

0 comments on commit 28852c8

Please sign in to comment.