From: Paul Durrant <paul.durrant@citrix.com>
To: <netdev@vger.kernel.org>, <xen-devel@lists.xenproject.org>
Cc: Paul Durrant <paul.durrant@citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
Wei Liu <wei.liu2@citrix.com>
Subject: [PATCH net-next v1 8/8] xen-netback: use toeplitz hash value from the frontend
Date: Fri, 12 Feb 2016 10:13:25 +0000 [thread overview]
Message-ID: <1455272005-17144-9-git-send-email-paul.durrant@citrix.com> (raw)
In-Reply-To: <1455272005-17144-1-git-send-email-paul.durrant@citrix.com>
This patch adds code to xen-netback to use the value in a toeplitz hash
extra info fragment passed from the VM frontend in a transmit-side packet
to set the skb hash accordingly.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
drivers/net/xen-netback/netback.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index 57c91fe..f550b8a 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -1341,6 +1341,28 @@ void xenvif_mcast_addr_list_free(struct xenvif *vif)
}
}
+static void xenvif_set_skb_hash(struct xenvif *vif,
+ struct sk_buff *skb,
+ struct xen_netif_extra_info *extra)
+{
+ u32 hash = *(u32 *)extra->u.toeplitz.value;
+ enum pkt_hash_types type = PKT_HASH_TYPE_NONE;
+
+ switch (extra->u.toeplitz.type) {
+ case _XEN_NETIF_CTRL_TOEPLITZ_HASH_IPV4:
+ case _XEN_NETIF_CTRL_TOEPLITZ_HASH_IPV6:
+ type = PKT_HASH_TYPE_L3;
+ break;
+
+ case _XEN_NETIF_CTRL_TOEPLITZ_HASH_IPV4_TCP:
+ case _XEN_NETIF_CTRL_TOEPLITZ_HASH_IPV6_TCP:
+ type = PKT_HASH_TYPE_L4;
+ break;
+ }
+
+ skb_set_hash(skb, hash, type);
+}
+
static void xenvif_tx_build_gops(struct xenvif_queue *queue,
int budget,
unsigned *copy_ops,
@@ -1502,6 +1524,13 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue,
}
}
+ if (extras[XEN_NETIF_EXTRA_TYPE_TOEPLITZ - 1].type) {
+ struct xen_netif_extra_info *extra;
+
+ extra = &extras[XEN_NETIF_EXTRA_TYPE_TOEPLITZ - 1];
+ xenvif_set_skb_hash(queue->vif, skb, extra);
+ }
+
XENVIF_TX_CB(skb)->pending_idx = pending_idx;
__skb_put(skb, data_len);
--
2.1.4
next prev parent reply other threads:[~2016-02-12 10:21 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-12 10:13 [PATCH net-next v1 0/8] xen-netback: support toeplitz hashing Paul Durrant
2016-02-12 10:13 ` [PATCH net-next v1 1/8] skbuff: store hash type in socket buffer Paul Durrant
2016-02-14 22:25 ` Tom Herbert
2016-02-15 8:50 ` Paul Durrant
2016-02-12 10:13 ` [PATCH net-next v1 2/8] xen-netback: re-import canonical netif header Paul Durrant
2016-02-12 10:13 ` [PATCH net-next v1 3/8] xen-netback: support multiple extra info fragments passed from frontend Paul Durrant
2016-02-12 10:13 ` [PATCH net-next v1 4/8] xen-netback: reduce log spam Paul Durrant
2016-02-12 10:13 ` [PATCH net-next v1 5/8] xen-netback: add support for the control ring Paul Durrant
2016-02-12 10:13 ` [PATCH net-next v1 6/8] xen-netback: add an implementation of toeplitz hashing Paul Durrant
2016-02-14 22:13 ` Tom Herbert
2016-02-12 10:13 ` [PATCH net-next v1 7/8] xen-netback: pass toeplitz hash value to the frontend Paul Durrant
2016-02-14 22:17 ` Tom Herbert
2016-02-12 10:13 ` Paul Durrant [this message]
2016-02-12 10:54 ` [PATCH net-next v1 0/8] xen-netback: support toeplitz hashing David Miller
2016-02-12 11:07 ` Paul Durrant
2016-02-12 16:41 ` David Miller
2016-02-12 16:59 ` Paul Durrant
2016-02-14 22:01 ` Tom Herbert
2016-02-15 8:48 ` Paul Durrant
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=1455272005-17144-9-git-send-email-paul.durrant@citrix.com \
--to=paul.durrant@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=netdev@vger.kernel.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/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).