mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-25 14:13:01 -04:00
net: Make RFS socket operations not be inet specific.
Idea from Eric Dumazet. As for placement inside of struct sock, I tried to choose a place that otherwise has a 32-bit hole on 64-bit systems. Signed-off-by: David S. Miller <davem@davemloft.net> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
This commit is contained in:
parent
c4ee6a5348
commit
c58dc01bab
5 changed files with 45 additions and 44 deletions
|
|
@ -102,7 +102,6 @@ struct rtable;
|
|||
* @uc_ttl - Unicast TTL
|
||||
* @inet_sport - Source port
|
||||
* @inet_id - ID counter for DF pkts
|
||||
* @rxhash - flow hash received from netif layer
|
||||
* @tos - TOS
|
||||
* @mc_ttl - Multicasting TTL
|
||||
* @is_icsk - is this an inet_connection_sock?
|
||||
|
|
@ -126,9 +125,6 @@ struct inet_sock {
|
|||
__u16 cmsg_flags;
|
||||
__be16 inet_sport;
|
||||
__u16 inet_id;
|
||||
#ifdef CONFIG_RPS
|
||||
__u32 rxhash;
|
||||
#endif
|
||||
|
||||
struct ip_options *opt;
|
||||
__u8 tos;
|
||||
|
|
@ -224,37 +220,4 @@ static inline __u8 inet_sk_flowi_flags(const struct sock *sk)
|
|||
return inet_sk(sk)->transparent ? FLOWI_FLAG_ANYSRC : 0;
|
||||
}
|
||||
|
||||
static inline void inet_rps_record_flow(const struct sock *sk)
|
||||
{
|
||||
#ifdef CONFIG_RPS
|
||||
struct rps_sock_flow_table *sock_flow_table;
|
||||
|
||||
rcu_read_lock();
|
||||
sock_flow_table = rcu_dereference(rps_sock_flow_table);
|
||||
rps_record_sock_flow(sock_flow_table, inet_sk(sk)->rxhash);
|
||||
rcu_read_unlock();
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void inet_rps_reset_flow(const struct sock *sk)
|
||||
{
|
||||
#ifdef CONFIG_RPS
|
||||
struct rps_sock_flow_table *sock_flow_table;
|
||||
|
||||
rcu_read_lock();
|
||||
sock_flow_table = rcu_dereference(rps_sock_flow_table);
|
||||
rps_reset_sock_flow(sock_flow_table, inet_sk(sk)->rxhash);
|
||||
rcu_read_unlock();
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void inet_rps_save_rxhash(struct sock *sk, u32 rxhash)
|
||||
{
|
||||
#ifdef CONFIG_RPS
|
||||
if (unlikely(inet_sk(sk)->rxhash != rxhash)) {
|
||||
inet_rps_reset_flow(sk);
|
||||
inet_sk(sk)->rxhash = rxhash;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif /* _INET_SOCK_H */
|
||||
|
|
|
|||
|
|
@ -198,6 +198,7 @@ struct sock_common {
|
|||
* @sk_rcvlowat: %SO_RCVLOWAT setting
|
||||
* @sk_rcvtimeo: %SO_RCVTIMEO setting
|
||||
* @sk_sndtimeo: %SO_SNDTIMEO setting
|
||||
* @sk_rxhash: flow hash received from netif layer
|
||||
* @sk_filter: socket filtering instructions
|
||||
* @sk_protinfo: private area, net family specific, when not using slab
|
||||
* @sk_timer: sock cleanup timer
|
||||
|
|
@ -279,6 +280,9 @@ struct sock {
|
|||
int sk_gso_type;
|
||||
unsigned int sk_gso_max_size;
|
||||
int sk_rcvlowat;
|
||||
#ifdef CONFIG_RPS
|
||||
__u32 sk_rxhash;
|
||||
#endif
|
||||
unsigned long sk_flags;
|
||||
unsigned long sk_lingertime;
|
||||
struct sk_buff_head sk_error_queue;
|
||||
|
|
@ -620,6 +624,40 @@ static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb)
|
|||
return sk->sk_backlog_rcv(sk, skb);
|
||||
}
|
||||
|
||||
static inline void sock_rps_record_flow(const struct sock *sk)
|
||||
{
|
||||
#ifdef CONFIG_RPS
|
||||
struct rps_sock_flow_table *sock_flow_table;
|
||||
|
||||
rcu_read_lock();
|
||||
sock_flow_table = rcu_dereference(rps_sock_flow_table);
|
||||
rps_record_sock_flow(sock_flow_table, sk->sk_rxhash);
|
||||
rcu_read_unlock();
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void sock_rps_reset_flow(const struct sock *sk)
|
||||
{
|
||||
#ifdef CONFIG_RPS
|
||||
struct rps_sock_flow_table *sock_flow_table;
|
||||
|
||||
rcu_read_lock();
|
||||
sock_flow_table = rcu_dereference(rps_sock_flow_table);
|
||||
rps_reset_sock_flow(sock_flow_table, sk->sk_rxhash);
|
||||
rcu_read_unlock();
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void sock_rps_save_rxhash(struct sock *sk, u32 rxhash)
|
||||
{
|
||||
#ifdef CONFIG_RPS
|
||||
if (unlikely(sk->sk_rxhash != rxhash)) {
|
||||
sock_rps_reset_flow(sk);
|
||||
sk->sk_rxhash = rxhash;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#define sk_wait_event(__sk, __timeo, __condition) \
|
||||
({ int __rc; \
|
||||
release_sock(__sk); \
|
||||
|
|
|
|||
Loading…
Reference in a new issue