netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 4/8] xen-netback: accept an L4 or L3 skb hash value from the frontend
Date: Wed, 21 Oct 2015 11:36:21 +0100	[thread overview]
Message-ID: <1445423785-4654-5-git-send-email-paul.durrant@citrix.com> (raw)
In-Reply-To: <1445423785-4654-1-git-send-email-paul.durrant@citrix.com>

This patch adds an indication that netback is capable of handling hash
values passed from the frontend (see netif.h for details), and the code
necessary to process the additional xen_netif_extra_info segment and
set a hash on the skb.

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 | 25 +++++++++++++++++++++++++
 drivers/net/xen-netback/xenbus.c  |  8 ++++++++
 2 files changed, 33 insertions(+)

diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index 9f0c9f5..3799b5a 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -1383,6 +1383,28 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue,
 			}
 		}
 
+		if (extras[XEN_NETIF_EXTRA_TYPE_HASH - 1].type) {
+			struct xen_netif_extra_info *extra;
+			u32 hash = *(u32 *)extra->u.hash.value;
+
+			extra = &extras[XEN_NETIF_EXTRA_TYPE_HASH - 1];
+
+			switch (extra->u.hash.type) {
+			case XEN_NETIF_HASH_TYPE_TCPV4:
+			case XEN_NETIF_HASH_TYPE_TCPV6:
+				skb_set_hash(skb, hash, PKT_HASH_TYPE_L4);
+				break;
+
+			case XEN_NETIF_HASH_TYPE_IPV4:
+			case XEN_NETIF_HASH_TYPE_IPV6:
+				skb_set_hash(skb, hash, PKT_HASH_TYPE_L3);
+				break;
+
+			default:
+				break;
+			}
+		}
+
 		XENVIF_TX_CB(skb)->pending_idx = pending_idx;
 
 		__skb_put(skb, data_len);
@@ -1416,6 +1438,9 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue,
 		if (extras[XEN_NETIF_EXTRA_TYPE_GSO - 1].type)
 			queue->pending_tx_info[pending_idx].extra_count++;
 
+		if (extras[XEN_NETIF_EXTRA_TYPE_HASH - 1].type)
+			queue->pending_tx_info[pending_idx].extra_count++;
+
 		queue->pending_cons++;
 
 		gop = xenvif_get_requests(queue, skb, txfrags, gop,
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index 929a6e7..2fa8a16 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -335,6 +335,14 @@ static int netback_probe(struct xenbus_device *dev,
 			goto abort_transaction;
 		}
 
+		/* We support hash values. */
+		err = xenbus_printf(xbt, dev->nodename,
+				    "feature-hash", "%d", 1);
+		if (err) {
+			message = "writing feature-hash";
+			goto abort_transaction;
+		}
+
 		err = xenbus_transaction_end(xbt, 0);
 	} while (err == -EAGAIN);
 
-- 
2.1.4

  parent reply	other threads:[~2015-10-21 10:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-21 10:36 [PATCH net-next 0/8] xen-netback/core: packet hashing Paul Durrant
2015-10-21 10:36 ` [PATCH net-next 1/8] xen-netback: re-import canonical netif header Paul Durrant
2015-10-26 17:05   ` Wei Liu
2015-10-21 10:36 ` [PATCH net-next 2/8] xen-netback: remove GSO information from xenvif_rx_meta Paul Durrant
2015-10-26 17:05   ` Wei Liu
2015-10-21 10:36 ` [PATCH net-next 3/8] xen-netback: support multiple extra info segments passed from frontend Paul Durrant
2015-10-26 17:05   ` Wei Liu
2015-10-21 10:36 ` Paul Durrant [this message]
2015-10-26 17:05   ` [PATCH net-next 4/8] xen-netback: accept an L4 or L3 skb hash value from the frontend Wei Liu
2015-10-21 10:36 ` [PATCH net-next 5/8] skbuff: store hash type in socket buffer Paul Durrant
2015-10-21 10:36 ` [PATCH net-next 6/8] xen-netback: pass an L4 or L3 skb hash value to the frontend Paul Durrant
2015-10-26 17:05   ` Wei Liu
2015-10-21 10:36 ` [PATCH net-next 7/8] xen-netback: add support for a multi-queue hash mapping table Paul Durrant
2015-10-26 17:05   ` Wei Liu
2015-10-21 10:36 ` [PATCH net-next 8/8] xen-netback: add support for toeplitz hashing Paul Durrant
2015-10-26 17:05   ` Wei Liu
2015-10-22 14:15 ` [PATCH net-next 0/8] xen-netback/core: packet hashing David Miller
2015-10-24 11:55 ` David Miller
2015-10-26 10:38   ` [Xen-devel] " David Vrabel
2015-10-26 12:09     ` David Miller

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=1445423785-4654-5-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).