From patchwork Tue Apr 14 06:56:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fan Du X-Patchwork-Id: 461067 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id 696741401DE for ; Tue, 14 Apr 2015 17:02:08 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 3804095E64; Tue, 14 Apr 2015 07:02:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HbsPhaXqYtNl; Tue, 14 Apr 2015 07:02:06 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 3FB6395E62; Tue, 14 Apr 2015 07:02:06 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id EE0C41C1774 for ; Tue, 14 Apr 2015 07:02:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id E856F32CA9 for ; Tue, 14 Apr 2015 07:02:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gkmjPfm0oDpF for ; Tue, 14 Apr 2015 07:02:04 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by silver.osuosl.org (Postfix) with ESMTP id 1D7FB2CEF5 for ; Tue, 14 Apr 2015 07:02:04 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 14 Apr 2015 00:02:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,574,1422950400"; d="scan'208";a="694886145" Received: from dufan-optiplex-9010.bj.intel.com ([10.238.155.116]) by fmsmga001.fm.intel.com with ESMTP; 14 Apr 2015 00:02:02 -0700 From: Fan Du To: jeffrey.t.kirsher@intel.com Date: Tue, 14 Apr 2015 14:56:11 +0800 Message-Id: <1428994571-16976-1-git-send-email-fan.du@intel.com> X-Mailer: git-send-email 1.7.9.5 Cc: e1000-devel@lists.sourceforge.net, intel-wired-lan@lists.osuosl.org, fengyuleidian0615@gmail.com Subject: [Intel-wired-lan] [PATCH] ixgbe: Specify rx hash type wrt rx desc RSS type X-BeenThere: intel-wired-lan@lists.osuosl.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@lists.osuosl.org Sender: "Intel-wired-lan" RSS could be leveraged by taking account L4 src/dst ports as ingredients, thus ingress skb rx hash type should honor such the real configuration. Signed-off-by: Fan Du --- Sorry for resending, I forgot to subscribe intel-wired-lan@lists.osuosl.org as previous mail is being held by list moderator. note: 1. I checked ixgbe_pci_tbl for 82598, 82599 x540 series, RSS type in adavanced descriptor is all supported. x550 is in trial version, so not checked. 2. ixgbevf looks like didn't even set rx hash type I'm not sure why this is left behind. IMHO it should be there. --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 23 +++++++++++++++++++++-- drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 1 + 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 395dc6b..8915992 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -1357,14 +1357,33 @@ static int __ixgbe_notify_dca(struct device *dev, void *data) } #endif /* CONFIG_IXGBE_DCA */ +static inline enum pkt_hash_types ixgbe_get_hash_type(__le16 pkt_info) +{ + switch (pkt_info & cpu_to_le16(IXGBE_RXDADV_RSSTYPE_MASK)) { + case IXGBE_RXDADV_RSSTYPE_IPV4_TCP: + case IXGBE_RXDADV_RSSTYPE_IPV4_UDP: + case IXGBE_RXDADV_RSSTYPE_IPV6_TCP: + case IXGBE_RXDADV_RSSTYPE_IPV6_UDP: + return PKT_HASH_TYPE_L4; + case IXGBE_RXDADV_RSSTYPE_IPV4: + case IXGBE_RXDADV_RSSTYPE_IPV6: + return PKT_HASH_TYPE_L3; + default: + return PKT_HASH_TYPE_NONE; + } +} + static inline void ixgbe_rx_hash(struct ixgbe_ring *ring, union ixgbe_adv_rx_desc *rx_desc, struct sk_buff *skb) { - if (ring->netdev->features & NETIF_F_RXHASH) + if (ring->netdev->features & NETIF_F_RXHASH) { + __le16 pkt_info = rx_desc->wb.lower.lo_dword.hs_rss.pkt_info; + skb_set_hash(skb, le32_to_cpu(rx_desc->wb.lower.hi_dword.rss), - PKT_HASH_TYPE_L3); + ixgbe_get_hash_type(pkt_info)); + } } #ifdef IXGBE_FCOE diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h index c3ddc94..97d600e 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h @@ -2225,6 +2225,7 @@ enum { #define IXGBE_RXDADV_RSSTYPE_IPV4_UDP 0x00000007 #define IXGBE_RXDADV_RSSTYPE_IPV6_UDP 0x00000008 #define IXGBE_RXDADV_RSSTYPE_IPV6_UDP_EX 0x00000009 +#define IXGBE_RXDADV_RSSTYPE_MASK 0x0000000F /* RSS Packet Types as indicated in the receive descriptor. */ #define IXGBE_RXDADV_PKTTYPE_NONE 0x00000000