From patchwork Tue Apr 14 06:36:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fan Du X-Patchwork-Id: 461058 X-Patchwork-Delegate: jeffrey.t.kirsher@intel.com 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 B6C941401AB for ; Tue, 14 Apr 2015 16:56:18 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 2C41095E4F; Tue, 14 Apr 2015 06:56:17 +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 CbZE5DQtWww2; Tue, 14 Apr 2015 06:56:14 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id DCB3E95E4B; Tue, 14 Apr 2015 06:56:14 +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 EE0161C1774 for ; Tue, 14 Apr 2015 06:42:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id E80BF32123 for ; Tue, 14 Apr 2015 06:42:42 +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 zn-GZQ5muPd6 for ; Tue, 14 Apr 2015 06:42:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by silver.osuosl.org (Postfix) with ESMTP id 49D8A3108E for ; Tue, 14 Apr 2015 06:42:42 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 13 Apr 2015 23:42:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,574,1422950400"; d="scan'208";a="555626778" Received: from dufan-optiplex-9010.bj.intel.com ([10.238.155.116]) by orsmga003.jf.intel.com with ESMTP; 13 Apr 2015 23:42:40 -0700 From: Fan Du To: jeffrey.t.kirsher@intel.com Date: Tue, 14 Apr 2015 14:36:49 +0800 Message-Id: <1428993409-16824-1-git-send-email-fan.du@intel.com> X-Mailer: git-send-email 1.7.9.5 X-Mailman-Approved-At: Tue, 14 Apr 2015 06:56:14 +0000 Cc: intel-wired-lan@lists.osuosl.org 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 --- 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