From patchwork Thu May 5 11:19:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 9023681 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 3CF95BF29F for ; Thu, 5 May 2016 11:35:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5E6CC203C1 for ; Thu, 5 May 2016 11:35:19 +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 740C3203A5 for ; Thu, 5 May 2016 11:35:18 +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 1ayHWi-0007n8-Ic; Thu, 05 May 2016 11:33:04 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ayHWg-0007mX-OV for xen-devel@lists.xenproject.org; Thu, 05 May 2016 11:33:02 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id C6/89-09532-E6F2B275; Thu, 05 May 2016 11:33:02 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjkeJIrShJLcpLzFFi42JxWrohUjdXXzv c4NVOVYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNWPZ023sBRt5Ko5uWczcwLicq4uRk0NCwF9i 7dOvTCA2m4COxNSnl1hBbBEBO4lzPe+BbA4OZgFPiZ5b5iBhYQFviQsdX1lAbBYBFYk5cy8yg pTwCrhJzHuXDDFRTuL88Z/MIDangLtE85KnYOVCQCWzPhxmhLBVJNZPncUGYvMKCEqcnPkErI ZZQELi4IsXzBBzuCVun57KPIGRbxaSsllIyhYwMq1iVC9OLSpLLdI10ksqykzPKMlNzMzRNTQ w08tNLS5OTE/NSUwq1kvOz93ECAwnBiDYwbjsr9MhRkkOJiVR3u1K2uFCfEn5KZUZicUZ8UWl OanFhxhlODiUJHjv6wLlBItS01Mr0jJzgIENk5bg4FES4V0DkuYtLkjMLc5Mh0idYlSUEuedC ZIQAElklObBtcGi6RKjrJQwLyPQIUI8BalFuZklqPKvGMU5GJWEedeBTOHJzCuBm/4KaDET0O L3czVBFpckIqSkGhgLS+6yGx4LCJmvLbz+ZfUPRm3vIkPFckHJFTe0n/KtVAuIP8rmdP39jB1 lz2O9903fWbRNR//LbOEPTAcyRF98NXp95NKsxEYmyWOsNVz7te+cYvlmpdxm2S98PN/8655p lasFl5lEF/MGdUhKsZXdC+WPYBMzT99ky/XjpvSJXX/NfDbMzFFiKc5INNRiLipOBAC1TOwGo QIAAA== X-Env-Sender: prvs=926422013=Paul.Durrant@citrix.com X-Msg-Ref: server-9.tower-21.messagelabs.com!1462447980!12709840!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 52536 invoked from network); 5 May 2016 11:33:01 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-9.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 5 May 2016 11:33:01 -0000 X-IronPort-AV: E=Sophos;i="5.24,582,1454976000"; d="scan'208";a="351827070" From: Paul Durrant To: , Date: Thu, 5 May 2016 12:19:30 +0100 Message-ID: <1462447170-1815-5-git-send-email-paul.durrant@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1462447170-1815-1-git-send-email-paul.durrant@citrix.com> References: <1462447170-1815-1-git-send-email-paul.durrant@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Paul Durrant , Wei Liu Subject: [Xen-devel] [PATCH net-next 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 Cc: Wei Liu 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);