From patchwork Wed May 11 15:33:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 9072281 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CF3669F30C for ; Wed, 11 May 2016 15:52:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F12562012B for ; Wed, 11 May 2016 15:52:47 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 14BC920155 for ; Wed, 11 May 2016 15:52:47 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b0WPH-0002eV-Ee; Wed, 11 May 2016 15:50:39 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b0WPF-0002eI-Sn for xen-devel@lists.xenproject.org; Wed, 11 May 2016 15:50:37 +0000 Received: from [85.158.137.68] by server-4.bemta-3.messagelabs.com id 17/7A-03606-DC453375; Wed, 11 May 2016 15:50:37 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplkeJIrShJLcpLzFFi42JxWrrBXvdMiHG 4wZUObYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNePK7NSC7TwV324tYG9gXMvVxcjJISHgL7Hm xyM2EJtNQEdi6tNLrCC2iICdxLme92A2s4CWRMPEJUwgtrCAn8ShFzeBbA4OFgFViX0zi0HCv ALuEodevmWFGCkncf74T2YQm1PAQ+LHkbtsIOVCQDW/9wSDhIUEVCTWT53FBtEqKHFy5hMWiE 0SEgdfvGCGGMMtcfv0VOYJjHyzkJTNQlK2gJFpFaN6cWpRWWqRrrleUlFmekZJbmJmjq6hgbF ebmpxcWJ6ak5iUrFecn7uJkZgMDEAwQ7Gxu9OhxglOZiURHnfSBuHC/El5adUZiQWZ8QXleak Fh9ilOHgUJLg5Q4GygkWpaanVqRl5gDDGiYtwcGjJML7JAgozVtckJhbnJkOkTrFqCglzqsB0 icAksgozYNrg8XSJUZZKWFeRqBDhHgKUotyM0tQ5V8xinMwKgnzRoBM4cnMK4Gb/gpoMRPQ4u rrRiCLSxIRUlINjK752+4E5Bx2lJl3Pr316smSD3c//9L/3f6VhyVG/dTdXwvef0yMF6pVNLQ rqXn/pPH8hV8LpdjC3l8+msLnyFa22P2w6gYGNtMTHEtZD4VJVmZv517y3+xh5OFrGafUYz7t qHgk+uTEvLcZM+c+U8wXeH+3sTJaoT5Z/U3FyV8P5vja2MYK9imxFGckGmoxFxUnAgDzrSCno AIAAA== X-Env-Sender: prvs=93251a52a=Paul.Durrant@citrix.com X-Msg-Ref: server-4.tower-31.messagelabs.com!1462981834!29961071!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 65273 invoked from network); 11 May 2016 15:50:36 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-4.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 11 May 2016 15:50:36 -0000 X-IronPort-AV: E=Sophos;i="5.24,608,1454976000"; d="scan'208";a="359939372" From: Paul Durrant To: , Date: Wed, 11 May 2016 16:33:37 +0100 Message-ID: <1462980817-10149-5-git-send-email-paul.durrant@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1462980817-10149-1-git-send-email-paul.durrant@citrix.com> References: <1462980817-10149-1-git-send-email-paul.durrant@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Paul Durrant Subject: [Xen-devel] [PATCH net-next v3 4/4] xen-netback: use hash value from the frontend X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP My recent patch to include/xen/interface/io/netif.h defines a new extra info type that can be used to pass hash values between backend and guest frontend. This patch adds code to xen-netback to use the value in a hash extra info fragment passed from the guest frontend in a transmit-side (i.e. netback receive side) packet to set the skb hash accordingly. Signed-off-by: Paul Durrant Acked-by: Wei Liu --- drivers/net/xen-netback/netback.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index 7c72510..a5b5aad 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c @@ -1509,6 +1509,33 @@ 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; + enum pkt_hash_types type = PKT_HASH_TYPE_NONE; + + extra = &extras[XEN_NETIF_EXTRA_TYPE_HASH - 1]; + + switch (extra->u.hash.type) { + case _XEN_NETIF_CTRL_HASH_TYPE_IPV4: + case _XEN_NETIF_CTRL_HASH_TYPE_IPV6: + type = PKT_HASH_TYPE_L3; + break; + + case _XEN_NETIF_CTRL_HASH_TYPE_IPV4_TCP: + case _XEN_NETIF_CTRL_HASH_TYPE_IPV6_TCP: + type = PKT_HASH_TYPE_L4; + break; + + default: + break; + } + + if (type != PKT_HASH_TYPE_NONE) + skb_set_hash(skb, + *(u32 *)extra->u.hash.value, + type); + } + XENVIF_TX_CB(skb)->pending_idx = pending_idx; __skb_put(skb, data_len);