]> git.droids-corp.org - dpdk.git/commitdiff
net/nfp: support hardware RSS v2
authorAlejandro Lucero <alejandro.lucero@netronome.com>
Wed, 11 Apr 2018 13:10:15 +0000 (14:10 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 13 Apr 2018 22:43:30 +0000 (00:43 +0200)
Chained metadata instead of prepend metadata was added in
firmware version 4. However, it could be old firmwares evolving
but not supporting chained metadata.

This patch adds support for an old firmware being updated and
getting a firmware version number higher than 4, but it still not
implementing chained metadata.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
drivers/net/nfp/nfp_net.c
drivers/net/nfp/nfp_net_ctrl.h

index f9227b42e625c1ee55286f95855f7ff40f60863f..bedd4b66871191ce8e7896ae18813e2d329731c7 100644 (file)
@@ -1957,14 +1957,10 @@ nfp_net_set_hash(struct nfp_net_rxq *rxq, struct nfp_net_rx_desc *rxd,
        if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS))
                return;
 
-       if (NFD_CFG_MAJOR_VERSION_of(hw->ver) <= 3) {
-               if (!(rxd->rxd.flags & PCIE_DESC_RX_RSS))
-                       return;
-
-               hash = rte_be_to_cpu_32(*(uint32_t *)NFP_HASH_OFFSET);
-               hash_type = rte_be_to_cpu_32(*(uint32_t *)NFP_HASH_TYPE_OFFSET);
-
-       } else if (NFP_DESC_META_LEN(rxd)) {
+       /* this is true for new firmwares */
+       if (likely(((hw->cap & NFP_NET_CFG_CTRL_RSS2) ||
+           (NFD_CFG_MAJOR_VERSION_of(hw->ver) == 4)) &&
+            NFP_DESC_META_LEN(rxd))) {
                /*
                 * new metadata api:
                 * <----  32 bit  ----->
@@ -1997,7 +1993,11 @@ nfp_net_set_hash(struct nfp_net_rxq *rxq, struct nfp_net_rx_desc *rxd,
                        return;
                }
        } else {
-               return;
+               if (!(rxd->rxd.flags & PCIE_DESC_RX_RSS))
+                       return;
+
+               hash = rte_be_to_cpu_32(*(uint32_t *)NFP_HASH_OFFSET);
+               hash_type = rte_be_to_cpu_32(*(uint32_t *)NFP_HASH_TYPE_OFFSET);
        }
 
        mbuf->hash.rss = hash;
@@ -2952,9 +2952,11 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
        else
                hw->rx_offset = nn_cfg_readl(hw, NFP_NET_CFG_RX_OFFSET_ADDR);
 
-       PMD_INIT_LOG(INFO, "VER: %#x, Maximum supported MTU: %d",
-                    hw->ver, hw->max_mtu);
-       PMD_INIT_LOG(INFO, "CAP: %#x, %s%s%s%s%s%s%s%s%s%s%s%s", hw->cap,
+       PMD_INIT_LOG(INFO, "VER: %u.%u, Maximum supported MTU: %d",
+                          NFD_CFG_MAJOR_VERSION_of(hw->ver),
+                          NFD_CFG_MINOR_VERSION_of(hw->ver), hw->max_mtu);
+
+       PMD_INIT_LOG(INFO, "CAP: %#x, %s%s%s%s%s%s%s%s%s%s%s%s%s", hw->cap,
                     hw->cap & NFP_NET_CFG_CTRL_PROMISC ? "PROMISC " : "",
                     hw->cap & NFP_NET_CFG_CTRL_L2BC    ? "L2BCFILT " : "",
                     hw->cap & NFP_NET_CFG_CTRL_L2MC    ? "L2MCFILT " : "",
@@ -2966,7 +2968,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
                     hw->cap & NFP_NET_CFG_CTRL_GATHER  ? "GATHER "  : "",
                     hw->cap & NFP_NET_CFG_CTRL_LSO     ? "TSO "     : "",
                     hw->cap & NFP_NET_CFG_CTRL_LSO2     ? "TSOv2 "     : "",
-                    hw->cap & NFP_NET_CFG_CTRL_RSS     ? "RSS "     : "");
+                    hw->cap & NFP_NET_CFG_CTRL_RSS     ? "RSS "     : "",
+                    hw->cap & NFP_NET_CFG_CTRL_RSS2     ? "RSSv2 "     : "");
 
        hw->ctrl = 0;
 
index 7d242d3606476681c3ebc895f874b9103dde1d19..14eb1766da099f6dfd8248f7b80959922c760631 100644 (file)
 #define   NFP_NET_CFG_CTRL_NVGRE          (0x1 << 25) /* Enable NVGRE */
 #define   NFP_NET_CFG_CTRL_MSIX_TX_OFF    (0x1 << 26) /* Disable MSIX for TX */
 #define   NFP_NET_CFG_CTRL_LSO2           (0x1 << 28) /* LSO/TSO (version 2) */
+#define   NFP_NET_CFG_CTRL_RSS2           (0x1 << 29) /* RSS (version 2) */
 #define NFP_NET_CFG_UPDATE              0x0004
 #define   NFP_NET_CFG_UPDATE_GEN          (0x1 <<  0) /* General update */
 #define   NFP_NET_CFG_UPDATE_RING         (0x1 <<  1) /* Ring config change */