Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 277894
b: refs/heads/master
c: adc9300
h: refs/heads/master
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Nov 17, 2011
1 parent 4e0f93b commit 1f76bda
Show file tree
Hide file tree
Showing 5 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: d6f144830bdfa5fcf116e9ab8fc6a60d23fa623d
refs/heads/master: adc9300e78e6091a7eaa1821213836379d4dbaa8
5 changes: 5 additions & 0 deletions trunk/include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ enum {
#include <linux/cache.h>
#include <linux/skbuff.h>

#ifdef CONFIG_RPS
#include <linux/jump_label.h>
extern struct jump_label_key rps_needed;
#endif

struct neighbour;
struct neigh_parms;
struct sk_buff;
Expand Down
21 changes: 9 additions & 12 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2711,6 +2711,8 @@ EXPORT_SYMBOL(__skb_get_rxhash);
struct rps_sock_flow_table __rcu *rps_sock_flow_table __read_mostly;
EXPORT_SYMBOL(rps_sock_flow_table);

struct jump_label_key rps_needed __read_mostly;

static struct rps_dev_flow *
set_rps_cpu(struct net_device *dev, struct sk_buff *skb,
struct rps_dev_flow *rflow, u16 next_cpu)
Expand Down Expand Up @@ -2994,7 +2996,7 @@ int netif_rx(struct sk_buff *skb)

trace_netif_rx(skb);
#ifdef CONFIG_RPS
{
if (static_branch(&rps_needed)) {
struct rps_dev_flow voidflow, *rflow = &voidflow;
int cpu;

Expand All @@ -3009,14 +3011,13 @@ int netif_rx(struct sk_buff *skb)

rcu_read_unlock();
preempt_enable();
}
#else
} else
#endif
{
unsigned int qtail;
ret = enqueue_to_backlog(skb, get_cpu(), &qtail);
put_cpu();
}
#endif
return ret;
}
EXPORT_SYMBOL(netif_rx);
Expand Down Expand Up @@ -3359,7 +3360,7 @@ int netif_receive_skb(struct sk_buff *skb)
return NET_RX_SUCCESS;

#ifdef CONFIG_RPS
{
if (static_branch(&rps_needed)) {
struct rps_dev_flow voidflow, *rflow = &voidflow;
int cpu, ret;

Expand All @@ -3370,16 +3371,12 @@ int netif_receive_skb(struct sk_buff *skb)
if (cpu >= 0) {
ret = enqueue_to_backlog(skb, cpu, &rflow->last_qtail);
rcu_read_unlock();
} else {
rcu_read_unlock();
ret = __netif_receive_skb(skb);
return ret;
}

return ret;
rcu_read_unlock();
}
#else
return __netif_receive_skb(skb);
#endif
return __netif_receive_skb(skb);
}
EXPORT_SYMBOL(netif_receive_skb);

Expand Down
7 changes: 5 additions & 2 deletions trunk/net/core/net-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,9 +606,12 @@ static ssize_t store_rps_map(struct netdev_rx_queue *queue,
rcu_assign_pointer(queue->rps_map, map);
spin_unlock(&rps_map_lock);

if (old_map)
if (map)
jump_label_inc(&rps_needed);
if (old_map) {
kfree_rcu(old_map, rcu);

jump_label_dec(&rps_needed);
}
free_cpumask_var(mask);
return len;
}
Expand Down
9 changes: 7 additions & 2 deletions trunk/net/core/sysctl_net_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,13 @@ static int rps_sock_flow_sysctl(ctl_table *table, int write,

if (sock_table != orig_sock_table) {
rcu_assign_pointer(rps_sock_flow_table, sock_table);
synchronize_rcu();
vfree(orig_sock_table);
if (sock_table)
jump_label_inc(&rps_needed);
if (orig_sock_table) {
jump_label_dec(&rps_needed);
synchronize_rcu();
vfree(orig_sock_table);
}
}
}

Expand Down

0 comments on commit 1f76bda

Please sign in to comment.