netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhi Yong Wu <zwu.kernel@gmail.com>
To: therbert@google.com
Cc: netdev@vger.kernel.org, edumazet@google.com,
	Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Subject: [PATCH 1/2] net: Allow setting sock flow hash without a sock
Date: Sun, 22 Dec 2013 18:54:31 +0800	[thread overview]
Message-ID: <1387709672-21917-2-git-send-email-zwu.kernel@gmail.com> (raw)
In-Reply-To: <1387709672-21917-1-git-send-email-zwu.kernel@gmail.com>

From: Tom Herbert <therbert@google.com>

This patch adds sock_rps_record_flow_hash and sock_rps_reset_flow_hash
which take a hash value as an argument and sets the sock_flow_table
accordingly.  This allows the table to be populated in cases where flow
is being tracked outside of a sock structure.

sock_rps_record_flow and sock_rps_reset_flow call this function
where the hash is taken from sk_rxhash.

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
 include/net/sock.h |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/include/net/sock.h b/include/net/sock.h
index 2ef3c3e..8ee90ad 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -820,30 +820,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)
+static inline void sock_rps_record_flow_hash(__u32 hash)
 {
 #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);
+	rps_record_sock_flow(sock_flow_table, hash);
 	rcu_read_unlock();
 #endif
 }
 
-static inline void sock_rps_reset_flow(const struct sock *sk)
+static inline void sock_rps_reset_flow_hash(__u32 hash)
 {
 #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);
+	rps_reset_sock_flow(sock_flow_table, hash);
 	rcu_read_unlock();
 #endif
 }
 
+static inline void sock_rps_record_flow(const struct sock *sk)
+{
+	sock_rps_record_flow_hash(sk->sk_rxhash);
+}
+
+static inline void sock_rps_reset_flow(const struct sock *sk)
+{
+	sock_rps_reset_flow_hash(sk->sk_rxhash);
+}
+
 static inline void sock_rps_save_rxhash(struct sock *sk,
 					const struct sk_buff *skb)
 {
-- 
1.7.6.5

  reply	other threads:[~2013-12-22 10:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-22 10:54 [PATCH 0/2] tun: add the RFS support Zhi Yong Wu
2013-12-22 10:54 ` Zhi Yong Wu [this message]
2013-12-22 10:54 ` [PATCH 2/2] tun: Add support for RFS on tun flows Zhi Yong Wu
2014-01-02  4:44   ` Jason Wang
2014-01-02  5:07     ` Zhi Yong Wu
2014-01-02  5:41       ` Jason Wang
2014-01-02  6:35         ` Zhi Yong Wu
2013-12-31 18:32 ` [PATCH 0/2] tun: add the RFS support David Miller
2013-12-31 22:33   ` Tom Herbert
2014-01-01  6:44     ` Zhi Yong Wu
2014-01-02 18:13       ` Tom Herbert
2014-01-04 10:53         ` Zhi Yong Wu
2014-01-13 13:29     ` Zhi Yong Wu
2014-01-13 16:49       ` Tom Herbert
2014-01-14  3:28         ` Zhi Yong Wu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1387709672-21917-2-git-send-email-zwu.kernel@gmail.com \
    --to=zwu.kernel@gmail.com \
    --cc=edumazet@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=therbert@google.com \
    --cc=wuzhy@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).