diff options
author | David S. Miller <davem@davemloft.net> | 2012-02-10 23:32:28 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-02-10 23:32:28 -0500 |
commit | d5ef8a4d87ab21d575ac86366599c9152a28028d (patch) | |
tree | 8b1be85ad1af7ee6a0e3e36c77ae738c966c1f21 /include/net | |
parent | d9dd966d7fc088a6bed991c2b1e2fba4485e0a31 (diff) | |
parent | 8df54d622a120058ee8bec38743c9b8f091c8e58 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
drivers/infiniband/hw/nes/nes_cm.c
Simple whitespace conflict.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/flow.h | 10 | ||||
-rw-r--r-- | include/net/netprio_cgroup.h | 48 | ||||
-rw-r--r-- | include/net/route.h | 4 |
3 files changed, 54 insertions, 8 deletions
diff --git a/include/net/flow.h b/include/net/flow.h index 9b582437fbea..6c469dbdb917 100644 --- a/include/net/flow.h +++ b/include/net/flow.h | |||
@@ -93,6 +93,16 @@ static inline void flowi4_init_output(struct flowi4 *fl4, int oif, | |||
93 | fl4->fl4_dport = dport; | 93 | fl4->fl4_dport = dport; |
94 | fl4->fl4_sport = sport; | 94 | fl4->fl4_sport = sport; |
95 | } | 95 | } |
96 | |||
97 | /* Reset some input parameters after previous lookup */ | ||
98 | static inline void flowi4_update_output(struct flowi4 *fl4, int oif, __u8 tos, | ||
99 | __be32 daddr, __be32 saddr) | ||
100 | { | ||
101 | fl4->flowi4_oif = oif; | ||
102 | fl4->flowi4_tos = tos; | ||
103 | fl4->daddr = daddr; | ||
104 | fl4->saddr = saddr; | ||
105 | } | ||
96 | 106 | ||
97 | 107 | ||
98 | struct flowi6 { | 108 | struct flowi6 { |
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h index 7b2d43139c8e..d58fdec47597 100644 --- a/include/net/netprio_cgroup.h +++ b/include/net/netprio_cgroup.h | |||
@@ -37,19 +37,51 @@ extern int net_prio_subsys_id; | |||
37 | 37 | ||
38 | extern void sock_update_netprioidx(struct sock *sk); | 38 | extern void sock_update_netprioidx(struct sock *sk); |
39 | 39 | ||
40 | static inline struct cgroup_netprio_state | 40 | #if IS_BUILTIN(CONFIG_NETPRIO_CGROUP) |
41 | *task_netprio_state(struct task_struct *p) | 41 | |
42 | static inline u32 task_netprioidx(struct task_struct *p) | ||
42 | { | 43 | { |
43 | #if IS_ENABLED(CONFIG_NETPRIO_CGROUP) | 44 | struct cgroup_netprio_state *state; |
44 | return container_of(task_subsys_state(p, net_prio_subsys_id), | 45 | u32 idx; |
45 | struct cgroup_netprio_state, css); | 46 | |
46 | #else | 47 | rcu_read_lock(); |
47 | return NULL; | 48 | state = container_of(task_subsys_state(p, net_prio_subsys_id), |
48 | #endif | 49 | struct cgroup_netprio_state, css); |
50 | idx = state->prioidx; | ||
51 | rcu_read_unlock(); | ||
52 | return idx; | ||
53 | } | ||
54 | |||
55 | #elif IS_MODULE(CONFIG_NETPRIO_CGROUP) | ||
56 | |||
57 | static inline u32 task_netprioidx(struct task_struct *p) | ||
58 | { | ||
59 | struct cgroup_netprio_state *state; | ||
60 | int subsys_id; | ||
61 | u32 idx = 0; | ||
62 | |||
63 | rcu_read_lock(); | ||
64 | subsys_id = rcu_dereference_index_check(net_prio_subsys_id, | ||
65 | rcu_read_lock_held()); | ||
66 | if (subsys_id >= 0) { | ||
67 | state = container_of(task_subsys_state(p, subsys_id), | ||
68 | struct cgroup_netprio_state, css); | ||
69 | idx = state->prioidx; | ||
70 | } | ||
71 | rcu_read_unlock(); | ||
72 | return idx; | ||
49 | } | 73 | } |
50 | 74 | ||
51 | #else | 75 | #else |
52 | 76 | ||
77 | static inline u32 task_netprioidx(struct task_struct *p) | ||
78 | { | ||
79 | return 0; | ||
80 | } | ||
81 | |||
82 | #endif /* CONFIG_NETPRIO_CGROUP */ | ||
83 | |||
84 | #else | ||
53 | #define sock_update_netprioidx(sk) | 85 | #define sock_update_netprioidx(sk) |
54 | #endif | 86 | #endif |
55 | 87 | ||
diff --git a/include/net/route.h b/include/net/route.h index 91855d185b53..b1c0d5b564c2 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -270,6 +270,7 @@ static inline struct rtable *ip_route_connect(struct flowi4 *fl4, | |||
270 | if (IS_ERR(rt)) | 270 | if (IS_ERR(rt)) |
271 | return rt; | 271 | return rt; |
272 | ip_rt_put(rt); | 272 | ip_rt_put(rt); |
273 | flowi4_update_output(fl4, oif, tos, fl4->daddr, fl4->saddr); | ||
273 | } | 274 | } |
274 | security_sk_classify_flow(sk, flowi4_to_flowi(fl4)); | 275 | security_sk_classify_flow(sk, flowi4_to_flowi(fl4)); |
275 | return ip_route_output_flow(net, fl4, sk); | 276 | return ip_route_output_flow(net, fl4, sk); |
@@ -284,6 +285,9 @@ static inline struct rtable *ip_route_newports(struct flowi4 *fl4, struct rtable | |||
284 | fl4->fl4_dport = dport; | 285 | fl4->fl4_dport = dport; |
285 | fl4->fl4_sport = sport; | 286 | fl4->fl4_sport = sport; |
286 | ip_rt_put(rt); | 287 | ip_rt_put(rt); |
288 | flowi4_update_output(fl4, sk->sk_bound_dev_if, | ||
289 | RT_CONN_FLAGS(sk), fl4->daddr, | ||
290 | fl4->saddr); | ||
287 | security_sk_classify_flow(sk, flowi4_to_flowi(fl4)); | 291 | security_sk_classify_flow(sk, flowi4_to_flowi(fl4)); |
288 | return ip_route_output_flow(sock_net(sk), fl4, sk); | 292 | return ip_route_output_flow(sock_net(sk), fl4, sk); |
289 | } | 293 | } |