From patchwork Fri May 13 08:37:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 9089511 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0879BBF440 for ; Fri, 13 May 2016 08:53:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2CDB5201F4 for ; Fri, 13 May 2016 08:53:40 +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 1349820212 for ; Fri, 13 May 2016 08:53:39 +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 1b18oU-0003yZ-LL; Fri, 13 May 2016 08:51:14 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b18oT-0003xz-NL for xen-devel@lists.xenproject.org; Fri, 13 May 2016 08:51:13 +0000 Received: from [193.109.254.147] by server-10.bemta-14.messagelabs.com id 3F/B0-02972-18595375; Fri, 13 May 2016 08:51:13 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplkeJIrShJLcpLzFFi42JxWrrBXrdhqmm 4wakTmhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8aV2akF23kqvt1awN7AuJari5GTQ0LAX+J/ cxcziM0moCMx9eklVhBbRMBO4lzPezCbWUBLomHiEqYuRg4OYQE/iWM/JEBMFgFViR8z/UAqe AXcJTp3rmCEmCgncf74T7CJnAIeEhNnrGMBsYWAaq50NTBC2CoS66fOYoPoFZQ4OfMJC8QmCY mDL14wQ8zhlrh9eirzBEa+WUjKZiEpW8DItIpRvTi1qCy1SNdUL6koMz2jJDcxM0fX0NBELze 1uDgxPTUnMalYLzk/dxMjMJgYgGAH47rFzocYJTmYlER5mwpNw4X4kvJTKjMSizPii0pzUosP McpwcChJ8K6YApQTLEpNT61Iy8wBhjVMWoKDR0mEdwtImre4IDG3ODMdInWKUVFKnFcbJCEAk sgozYNrg8XSJUZZKWFeRqBDhHgKUotyM0tQ5V8xinMwKgnz7gKZwpOZVwI3/RXQYiagxdXXjU AWlyQipKQaGGfNKhVQn/jiZuiKRUJ7/MUj7+2uTQ+qbQifrHb1gkvVxklBDxq02XxYNz/7Osl mySMNPreZQedCX28JFb3Hcnvpw4USyVF1+ROLM8R3/PX6XS51nktLIPiKzIYpmhyPbFdNuGNl szkwzYmb8dYlX9X1tgqLmv+lMWm4Xb6Yf7F1R5DTwbRz85VYijMSDbWYi4oTATdT4R6gAgAA X-Env-Sender: prvs=934d503c5=Paul.Durrant@citrix.com X-Msg-Ref: server-9.tower-27.messagelabs.com!1463129470!41279372!2 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 2969 invoked from network); 13 May 2016 08:51:12 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-9.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 13 May 2016 08:51:12 -0000 X-IronPort-AV: E=Sophos;i="5.24,613,1454976000"; d="scan'208";a="360567322" From: Paul Durrant To: , Date: Fri, 13 May 2016 09:37:29 +0100 Message-ID: <1463128649-20832-5-git-send-email-paul.durrant@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1463128649-20832-1-git-send-email-paul.durrant@citrix.com> References: <1463128649-20832-1-git-send-email-paul.durrant@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Paul Durrant Subject: [Xen-devel] [PATCH net-next v4 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);