net/i40e: add dynamic mapping of SW flow types to HW pctypes
authorKirill Rybalchenko <kirill.rybalchenko@intel.com>
Wed, 4 Oct 2017 12:52:10 +0000 (13:52 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 6 Oct 2017 00:49:50 +0000 (02:49 +0200)
Implement dynamic mapping of software flow types to hardware pctypes.
This allows to add new flow types and pctypes for DDP without changing
API of the driver. The mapping table is located in private
data area for particular network adapter and can be individually
modified with set of appropriate functions.

Signed-off-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
drivers/net/i40e/i40e_ethdev.c
drivers/net/i40e/i40e_ethdev.h
drivers/net/i40e/i40e_ethdev_vf.c
drivers/net/i40e/i40e_fdir.c
drivers/net/i40e/i40e_flow.c
drivers/net/i40e/i40e_rxtx.c
drivers/net/i40e/i40e_rxtx.h

index 41c4033..0b151a0 100644 (file)
@@ -1070,6 +1070,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
                return 0;
        }
        i40e_set_default_ptype_table(dev);
+       i40e_set_default_pctype_table(dev);
        pci_dev = RTE_ETH_DEV_TO_PCI(dev);
        intr_handle = &pci_dev->intr_handle;
 
@@ -3020,7 +3021,7 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
        dev_info->hash_key_size = (I40E_PFQF_HKEY_MAX_INDEX + 1) *
                                                sizeof(uint32_t);
        dev_info->reta_size = pf->hash_lut_size;
-       dev_info->flow_type_rss_offloads = I40E_RSS_OFFLOAD_ALL;
+       dev_info->flow_type_rss_offloads = pf->adapter->flow_types_mask;
 
        dev_info->default_rxconf = (struct rte_eth_rxconf) {
                .rx_thresh = {
@@ -6611,104 +6612,36 @@ DONE:
 
 /* Configure hash enable flags for RSS */
 uint64_t
-i40e_config_hena(uint64_t flags, enum i40e_mac_type type)
+i40e_config_hena(const struct i40e_adapter *adapter, uint64_t flags)
 {
        uint64_t hena = 0;
+       int i;
 
        if (!flags)
                return hena;
 
-       if (flags & ETH_RSS_FRAG_IPV4)
-               hena |= 1ULL << I40E_FILTER_PCTYPE_FRAG_IPV4;
-       if (flags & ETH_RSS_NONFRAG_IPV4_TCP) {
-               if (type == I40E_MAC_X722) {
-                       hena |= (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP) |
-                        (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK);
-               } else
-                       hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP;
-       }
-       if (flags & ETH_RSS_NONFRAG_IPV4_UDP) {
-               if (type == I40E_MAC_X722) {
-                       hena |= (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_UDP) |
-                        (1ULL << I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP) |
-                        (1ULL << I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP);
-               } else
-                       hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
-       }
-       if (flags & ETH_RSS_NONFRAG_IPV4_SCTP)
-               hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_SCTP;
-       if (flags & ETH_RSS_NONFRAG_IPV4_OTHER)
-               hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_OTHER;
-       if (flags & ETH_RSS_FRAG_IPV6)
-               hena |= 1ULL << I40E_FILTER_PCTYPE_FRAG_IPV6;
-       if (flags & ETH_RSS_NONFRAG_IPV6_TCP) {
-               if (type == I40E_MAC_X722) {
-                       hena |= (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP) |
-                        (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK);
-               } else
-                       hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP;
+       for (i = RTE_ETH_FLOW_UNKNOWN + 1; i < I40E_FLOW_TYPE_MAX; i++) {
+               if (flags & (1ULL << i))
+                       hena |= adapter->pctypes_tbl[i];
        }
-       if (flags & ETH_RSS_NONFRAG_IPV6_UDP) {
-               if (type == I40E_MAC_X722) {
-                       hena |= (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_UDP) |
-                        (1ULL << I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP) |
-                        (1ULL << I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP);
-               } else
-                       hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_UDP;
-       }
-       if (flags & ETH_RSS_NONFRAG_IPV6_SCTP)
-               hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_SCTP;
-       if (flags & ETH_RSS_NONFRAG_IPV6_OTHER)
-               hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER;
-       if (flags & ETH_RSS_L2_PAYLOAD)
-               hena |= 1ULL << I40E_FILTER_PCTYPE_L2_PAYLOAD;
 
        return hena;
 }
 
 /* Parse the hash enable flags */
 uint64_t
-i40e_parse_hena(uint64_t flags)
+i40e_parse_hena(const struct i40e_adapter *adapter, uint64_t flags)
 {
        uint64_t rss_hf = 0;
 
        if (!flags)
                return rss_hf;
-       if (flags & (1ULL << I40E_FILTER_PCTYPE_FRAG_IPV4))
-               rss_hf |= ETH_RSS_FRAG_IPV4;
-       if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP))
-               rss_hf |= ETH_RSS_NONFRAG_IPV4_TCP;
-       if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK))
-               rss_hf |= ETH_RSS_NONFRAG_IPV4_TCP;
-       if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_UDP))
-               rss_hf |= ETH_RSS_NONFRAG_IPV4_UDP;
-       if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP))
-               rss_hf |= ETH_RSS_NONFRAG_IPV4_UDP;
-       if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP))
-               rss_hf |= ETH_RSS_NONFRAG_IPV4_UDP;
-       if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_SCTP))
-               rss_hf |= ETH_RSS_NONFRAG_IPV4_SCTP;
-       if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_OTHER))
-               rss_hf |= ETH_RSS_NONFRAG_IPV4_OTHER;
-       if (flags & (1ULL << I40E_FILTER_PCTYPE_FRAG_IPV6))
-               rss_hf |= ETH_RSS_FRAG_IPV6;
-       if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP))
-               rss_hf |= ETH_RSS_NONFRAG_IPV6_TCP;
-       if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK))
-               rss_hf |= ETH_RSS_NONFRAG_IPV6_TCP;
-       if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_UDP))
-               rss_hf |= ETH_RSS_NONFRAG_IPV6_UDP;
-       if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP))
-               rss_hf |= ETH_RSS_NONFRAG_IPV6_UDP;
-       if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP))
-               rss_hf |= ETH_RSS_NONFRAG_IPV6_UDP;
-       if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_SCTP))
-               rss_hf |= ETH_RSS_NONFRAG_IPV6_SCTP;
-       if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER))
-               rss_hf |= ETH_RSS_NONFRAG_IPV6_OTHER;
-       if (flags & (1ULL << I40E_FILTER_PCTYPE_L2_PAYLOAD))
-               rss_hf |= ETH_RSS_L2_PAYLOAD;
+       int i;
 
+       for (i = RTE_ETH_FLOW_UNKNOWN + 1; i < I40E_FLOW_TYPE_MAX; i++) {
+               if (flags & adapter->pctypes_tbl[i])
+                       rss_hf |= (1ULL << i);
+       }
        return rss_hf;
 }
 
@@ -6799,7 +6732,7 @@ i40e_hw_rss_hash_set(struct i40e_pf *pf, struct rte_eth_rss_conf *rss_conf)
        if (ret)
                return ret;
 
-       hena = i40e_config_hena(rss_conf->rss_hf, hw->mac.type);
+       hena = i40e_config_hena(pf->adapter, rss_conf->rss_hf);
        i40e_write_rx_ctl(hw, I40E_PFQF_HENA(0), (uint32_t)hena);
        i40e_write_rx_ctl(hw, I40E_PFQF_HENA(1), (uint32_t)(hena >> 32));
        I40E_WRITE_FLUSH(hw);
@@ -6813,14 +6746,13 @@ i40e_dev_rss_hash_update(struct rte_eth_dev *dev,
 {
        struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
        struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-       uint64_t rss_hf = rss_conf->rss_hf & I40E_RSS_OFFLOAD_ALL;
+       uint64_t rss_hf = rss_conf->rss_hf & pf->adapter->flow_types_mask;
        uint64_t hena;
 
        hena = (uint64_t)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(0));
        hena |= ((uint64_t)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(1))) << 32;
-       if (!(hena & ((hw->mac.type == I40E_MAC_X722)
-                ? I40E_RSS_HENA_ALL_X722
-                : I40E_RSS_HENA_ALL))) { /* RSS disabled */
+
+       if (!(hena & pf->adapter->pctypes_mask)) { /* RSS disabled */
                if (rss_hf != 0) /* Enable RSS */
                        return -EINVAL;
                return 0; /* Nothing to do */
@@ -6845,7 +6777,7 @@ i40e_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 
        hena = (uint64_t)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(0));
        hena |= ((uint64_t)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(1))) << 32;
-       rss_conf->rss_hf = i40e_parse_hena(hena);
+       rss_conf->rss_hf = i40e_parse_hena(pf->adapter, hena);
 
        return 0;
 }
@@ -7620,7 +7552,7 @@ i40e_pf_config_rss(struct i40e_pf *pf)
        }
 
        rss_conf = pf->dev_data->dev_conf.rx_adv_conf.rss_conf;
-       if ((rss_conf.rss_hf & I40E_RSS_OFFLOAD_ALL) == 0) {
+       if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) == 0) {
                i40e_pf_disable_rss(pf);
                return 0;
        }
@@ -7841,9 +7773,9 @@ static int
 i40e_get_hash_filter_global_config(struct i40e_hw *hw,
                                   struct rte_eth_hash_global_conf *g_cfg)
 {
-       uint32_t reg, mask = I40E_FLOW_TYPES;
-       uint16_t i;
-       enum i40e_filter_pctype pctype;
+       struct i40e_adapter *adapter = (struct i40e_adapter *)hw->back;
+       uint32_t reg;
+       uint16_t i, j;
 
        memset(g_cfg, 0, sizeof(*g_cfg));
        reg = i40e_read_rx_ctl(hw, I40E_GLQF_CTL);
@@ -7854,29 +7786,38 @@ i40e_get_hash_filter_global_config(struct i40e_hw *hw,
        PMD_DRV_LOG(DEBUG, "Hash function is %s",
                (reg & I40E_GLQF_CTL_HTOEP_MASK) ? "Toeplitz" : "Simple XOR");
 
-       for (i = 0; mask && i < RTE_ETH_FLOW_MAX; i++) {
-               if (!(mask & (1UL << i)))
-                       continue;
-               mask &= ~(1UL << i);
-               /* Bit set indicats the coresponding flow type is supported */
-               g_cfg->valid_bit_mask[0] |= (1UL << i);
-               /* if flowtype is invalid, continue */
-               if (!I40E_VALID_FLOW(i))
+       /*
+        * We work only with lowest 32 bits which is not correct, but to work
+        * properly the valid_bit_mask size should be increased up to 64 bits
+        * and this will brake ABI. This modification will be done in next
+        * release
+        */
+       g_cfg->valid_bit_mask[0] = (uint32_t)adapter->flow_types_mask;
+
+       for (i = RTE_ETH_FLOW_UNKNOWN + 1; i < UINT32_BIT; i++) {
+               if (!adapter->pctypes_tbl[i])
                        continue;
-               pctype = i40e_flowtype_to_pctype(i);
-               reg = i40e_read_rx_ctl(hw, I40E_GLQF_HSYM(pctype));
-               if (reg & I40E_GLQF_HSYM_SYMH_ENA_MASK)
-                       g_cfg->sym_hash_enable_mask[0] |= (1UL << i);
+               for (j = I40E_FILTER_PCTYPE_INVALID + 1;
+                    j < I40E_FILTER_PCTYPE_MAX; j++) {
+                       if (adapter->pctypes_tbl[i] & (1ULL << j)) {
+                               reg = i40e_read_rx_ctl(hw, I40E_GLQF_HSYM(j));
+                               if (reg & I40E_GLQF_HSYM_SYMH_ENA_MASK) {
+                                       g_cfg->sym_hash_enable_mask[0] |=
+                                                               (1UL << i);
+                               }
+                       }
+               }
        }
 
        return 0;
 }
 
 static int
-i40e_hash_global_config_check(struct rte_eth_hash_global_conf *g_cfg)
+i40e_hash_global_config_check(const struct i40e_adapter *adapter,
+                             const struct rte_eth_hash_global_conf *g_cfg)
 {
        uint32_t i;
-       uint32_t mask0, i40e_mask = I40E_FLOW_TYPES;
+       uint32_t mask0, i40e_mask = adapter->flow_types_mask;
 
        if (g_cfg->hash_func != RTE_ETH_HASH_FUNCTION_TOEPLITZ &&
                g_cfg->hash_func != RTE_ETH_HASH_FUNCTION_SIMPLE_XOR &&
@@ -7919,64 +7860,36 @@ static int
 i40e_set_hash_filter_global_config(struct i40e_hw *hw,
                                   struct rte_eth_hash_global_conf *g_cfg)
 {
+       struct i40e_adapter *adapter = (struct i40e_adapter *)hw->back;
        int ret;
-       uint16_t i;
+       uint16_t i, j;
        uint32_t reg;
-       uint32_t mask0 = g_cfg->valid_bit_mask[0];
-       enum i40e_filter_pctype pctype;
+       /*
+        * We work only with lowest 32 bits which is not correct, but to work
+        * properly the valid_bit_mask size should be increased up to 64 bits
+        * and this will brake ABI. This modification will be done in next
+        * release
+        */
+       uint32_t mask0 = g_cfg->valid_bit_mask[0] &
+                                       (uint32_t)adapter->flow_types_mask;
 
        /* Check the input parameters */
-       ret = i40e_hash_global_config_check(g_cfg);
+       ret = i40e_hash_global_config_check(adapter, g_cfg);
        if (ret < 0)
                return ret;
 
-       for (i = 0; mask0 && i < UINT32_BIT; i++) {
-               if (!(mask0 & (1UL << i)))
-                       continue;
-               mask0 &= ~(1UL << i);
-               /* if flowtype is invalid, continue */
-               if (!I40E_VALID_FLOW(i))
-                       continue;
-               pctype = i40e_flowtype_to_pctype(i);
-               reg = (g_cfg->sym_hash_enable_mask[0] & (1UL << i)) ?
-                               I40E_GLQF_HSYM_SYMH_ENA_MASK : 0;
-               if (hw->mac.type == I40E_MAC_X722) {
-                       if (pctype == I40E_FILTER_PCTYPE_NONF_IPV4_UDP) {
-                               i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
-                                 I40E_FILTER_PCTYPE_NONF_IPV4_UDP), reg);
-                               i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
-                                 I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP),
-                                 reg);
-                               i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
-                                 I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP),
-                                 reg);
-                       } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV4_TCP) {
-                               i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
-                                 I40E_FILTER_PCTYPE_NONF_IPV4_TCP), reg);
-                               i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
-                                 I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK),
-                                 reg);
-                       } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_UDP) {
-                               i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
-                                 I40E_FILTER_PCTYPE_NONF_IPV6_UDP), reg);
-                               i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
-                                 I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP),
-                                 reg);
-                               i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
-                                 I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP),
-                                 reg);
-                       } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_TCP) {
-                               i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
-                                 I40E_FILTER_PCTYPE_NONF_IPV6_TCP), reg);
-                               i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
-                                 I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK),
-                                 reg);
-                       } else {
-                               i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(pctype),
-                                 reg);
+       for (i = RTE_ETH_FLOW_UNKNOWN + 1; mask0 && i < UINT32_BIT; i++) {
+               if (mask0 & (1UL << i)) {
+                       reg = (g_cfg->sym_hash_enable_mask[0] & (1UL << i)) ?
+                                       I40E_GLQF_HSYM_SYMH_ENA_MASK : 0;
+
+                       for (j = I40E_FILTER_PCTYPE_INVALID + 1;
+                            j < I40E_FILTER_PCTYPE_MAX; j++) {
+                               if (adapter->pctypes_tbl[i] & (1ULL << j))
+                                       i40e_write_rx_ctl(hw,
+                                                         I40E_GLQF_HSYM(j),
+                                                         reg);
                        }
-               } else {
-                       i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(pctype), reg);
                }
        }
 
@@ -8598,16 +8511,14 @@ i40e_filter_input_set_init(struct i40e_pf *pf)
        uint64_t input_set, inset_reg;
        uint32_t mask_reg[I40E_INSET_MASK_NUM_REG] = {0};
        int num, i;
+       uint16_t flow_type;
 
        for (pctype = I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
             pctype <= I40E_FILTER_PCTYPE_L2_PAYLOAD; pctype++) {
-               if (hw->mac.type == I40E_MAC_X722) {
-                       if (!I40E_VALID_PCTYPE_X722(pctype))
-                               continue;
-               } else {
-                       if (!I40E_VALID_PCTYPE(pctype))
-                               continue;
-               }
+               flow_type = i40e_pctype_to_flowtype(pf->adapter, pctype);
+
+               if (flow_type == RTE_ETH_FLOW_UNKNOWN)
+                       continue;
 
                input_set = i40e_get_default_input_set(pctype);
 
@@ -8670,7 +8581,8 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,
                return -EINVAL;
        }
 
-       if (!I40E_VALID_FLOW(conf->flow_type)) {
+       pctype = i40e_flowtype_to_pctype(pf->adapter, conf->flow_type);
+       if (pctype == I40E_FILTER_PCTYPE_INVALID) {
                PMD_DRV_LOG(ERR, "invalid flow_type input.");
                return -EINVAL;
        }
@@ -8678,10 +8590,8 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,
        if (hw->mac.type == I40E_MAC_X722) {
                /* get translated pctype value in fd pctype register */
                pctype = (enum i40e_filter_pctype)i40e_read_rx_ctl(hw,
-                       I40E_GLQF_FD_PCTYPES((int)i40e_flowtype_to_pctype(
-                       conf->flow_type)));
-       } else
-               pctype = i40e_flowtype_to_pctype(conf->flow_type);
+                       I40E_GLQF_FD_PCTYPES((int)pctype));
+       }
 
        ret = i40e_parse_input_set(&input_set, pctype, conf->field,
                                   conf->inset_size);
@@ -8689,11 +8599,7 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,
                PMD_DRV_LOG(ERR, "Failed to parse input set");
                return -EINVAL;
        }
-       if (i40e_validate_input_set(pctype, RTE_ETH_FILTER_HASH,
-                                   input_set) != 0) {
-               PMD_DRV_LOG(ERR, "Invalid input set");
-               return -EINVAL;
-       }
+
        if (conf->op == RTE_ETH_INPUT_SET_ADD) {
                /* get inset value in register */
                inset_reg = i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, pctype));
@@ -8747,24 +8653,19 @@ i40e_fdir_filter_inset_select(struct i40e_pf *pf,
                return -EINVAL;
        }
 
-       if (!I40E_VALID_FLOW(conf->flow_type)) {
+       pctype = i40e_flowtype_to_pctype(pf->adapter, conf->flow_type);
+
+       if (pctype == I40E_FILTER_PCTYPE_INVALID) {
                PMD_DRV_LOG(ERR, "invalid flow_type input.");
                return -EINVAL;
        }
 
-       pctype = i40e_flowtype_to_pctype(conf->flow_type);
-
        ret = i40e_parse_input_set(&input_set, pctype, conf->field,
                                   conf->inset_size);
        if (ret) {
                PMD_DRV_LOG(ERR, "Failed to parse input set");
                return -EINVAL;
        }
-       if (i40e_validate_input_set(pctype, RTE_ETH_FILTER_FDIR,
-                                   input_set) != 0) {
-               PMD_DRV_LOG(ERR, "Invalid input set");
-               return -EINVAL;
-       }
 
        /* get inset value in register */
        inset_reg = i40e_read_rx_ctl(hw, I40E_PRTQF_FD_INSET(pctype, 1));
@@ -9203,72 +9104,42 @@ i40e_hw_init(struct rte_eth_dev *dev)
        i40e_set_symmetric_hash_enable_per_port(hw, 0);
 }
 
+/*
+ * For X722 it is possible to have multiple pctypes mapped to the same flowtype
+ * however this function will return only one highest pctype index,
+ * which is not quite correct. This is known problem of i40e driver
+ * and needs to be fixed later.
+ */
 enum i40e_filter_pctype
-i40e_flowtype_to_pctype(uint16_t flow_type)
-{
-       static const enum i40e_filter_pctype pctype_table[] = {
-               [RTE_ETH_FLOW_FRAG_IPV4] = I40E_FILTER_PCTYPE_FRAG_IPV4,
-               [RTE_ETH_FLOW_NONFRAG_IPV4_UDP] =
-                       I40E_FILTER_PCTYPE_NONF_IPV4_UDP,
-               [RTE_ETH_FLOW_NONFRAG_IPV4_TCP] =
-                       I40E_FILTER_PCTYPE_NONF_IPV4_TCP,
-               [RTE_ETH_FLOW_NONFRAG_IPV4_SCTP] =
-                       I40E_FILTER_PCTYPE_NONF_IPV4_SCTP,
-               [RTE_ETH_FLOW_NONFRAG_IPV4_OTHER] =
-                       I40E_FILTER_PCTYPE_NONF_IPV4_OTHER,
-               [RTE_ETH_FLOW_FRAG_IPV6] = I40E_FILTER_PCTYPE_FRAG_IPV6,
-               [RTE_ETH_FLOW_NONFRAG_IPV6_UDP] =
-                       I40E_FILTER_PCTYPE_NONF_IPV6_UDP,
-               [RTE_ETH_FLOW_NONFRAG_IPV6_TCP] =
-                       I40E_FILTER_PCTYPE_NONF_IPV6_TCP,
-               [RTE_ETH_FLOW_NONFRAG_IPV6_SCTP] =
-                       I40E_FILTER_PCTYPE_NONF_IPV6_SCTP,
-               [RTE_ETH_FLOW_NONFRAG_IPV6_OTHER] =
-                       I40E_FILTER_PCTYPE_NONF_IPV6_OTHER,
-               [RTE_ETH_FLOW_L2_PAYLOAD] = I40E_FILTER_PCTYPE_L2_PAYLOAD,
-       };
+i40e_flowtype_to_pctype(const struct i40e_adapter *adapter, uint16_t flow_type)
+{
+       int i;
+       uint64_t pctype_mask;
 
-       return pctype_table[flow_type];
+       if (flow_type < I40E_FLOW_TYPE_MAX) {
+               pctype_mask = adapter->pctypes_tbl[flow_type];
+               for (i = I40E_FILTER_PCTYPE_MAX - 1; i > 0; i--) {
+                       if (pctype_mask & (1ULL << i))
+                               return (enum i40e_filter_pctype)i;
+               }
+       }
+       return I40E_FILTER_PCTYPE_INVALID;
 }
 
 uint16_t
-i40e_pctype_to_flowtype(enum i40e_filter_pctype pctype)
+i40e_pctype_to_flowtype(const struct i40e_adapter *adapter,
+                       enum i40e_filter_pctype pctype)
 {
-       static const uint16_t flowtype_table[] = {
-               [I40E_FILTER_PCTYPE_FRAG_IPV4] = RTE_ETH_FLOW_FRAG_IPV4,
-               [I40E_FILTER_PCTYPE_NONF_IPV4_UDP] =
-                       RTE_ETH_FLOW_NONFRAG_IPV4_UDP,
-               [I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP] =
-                       RTE_ETH_FLOW_NONFRAG_IPV4_UDP,
-               [I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP] =
-                       RTE_ETH_FLOW_NONFRAG_IPV4_UDP,
-               [I40E_FILTER_PCTYPE_NONF_IPV4_TCP] =
-                       RTE_ETH_FLOW_NONFRAG_IPV4_TCP,
-               [I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK] =
-                       RTE_ETH_FLOW_NONFRAG_IPV4_TCP,
-               [I40E_FILTER_PCTYPE_NONF_IPV4_SCTP] =
-                       RTE_ETH_FLOW_NONFRAG_IPV4_SCTP,
-               [I40E_FILTER_PCTYPE_NONF_IPV4_OTHER] =
-                       RTE_ETH_FLOW_NONFRAG_IPV4_OTHER,
-               [I40E_FILTER_PCTYPE_FRAG_IPV6] = RTE_ETH_FLOW_FRAG_IPV6,
-               [I40E_FILTER_PCTYPE_NONF_IPV6_UDP] =
-                       RTE_ETH_FLOW_NONFRAG_IPV6_UDP,
-               [I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP] =
-                       RTE_ETH_FLOW_NONFRAG_IPV6_UDP,
-               [I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP] =
-                       RTE_ETH_FLOW_NONFRAG_IPV6_UDP,
-               [I40E_FILTER_PCTYPE_NONF_IPV6_TCP] =
-                       RTE_ETH_FLOW_NONFRAG_IPV6_TCP,
-               [I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK] =
-                       RTE_ETH_FLOW_NONFRAG_IPV6_TCP,
-               [I40E_FILTER_PCTYPE_NONF_IPV6_SCTP] =
-                       RTE_ETH_FLOW_NONFRAG_IPV6_SCTP,
-               [I40E_FILTER_PCTYPE_NONF_IPV6_OTHER] =
-                       RTE_ETH_FLOW_NONFRAG_IPV6_OTHER,
-               [I40E_FILTER_PCTYPE_L2_PAYLOAD] = RTE_ETH_FLOW_L2_PAYLOAD,
-       };
+       uint16_t flowtype;
+       uint64_t pctype_mask = 1ULL << pctype;
+
+       for (flowtype = RTE_ETH_FLOW_UNKNOWN + 1; flowtype < I40E_FLOW_TYPE_MAX;
+            flowtype++) {
+               if (adapter->pctypes_tbl[flowtype] & pctype_mask)
+                       return flowtype;
+       }
 
-       return flowtype_table[pctype];
+       return RTE_ETH_FLOW_UNKNOWN;
 }
 
 /*
index ad80f0f..5b84da2 100644 (file)
@@ -478,8 +478,9 @@ struct i40e_fdir_flex_mask {
        } bitmask[I40E_FDIR_BITMASK_NUM_WORD];
 };
 
-#define I40E_FILTER_PCTYPE_MAX 64
-#define I40E_MAX_FDIR_FILTER_NUM (1024 * 8)
+#define I40E_FILTER_PCTYPE_INVALID 0
+#define I40E_FILTER_PCTYPE_MAX     64
+#define I40E_MAX_FDIR_FILTER_NUM   (1024 * 8)
 
 struct i40e_fdir_filter {
        TAILQ_ENTRY(i40e_fdir_filter) rules;
@@ -852,7 +853,8 @@ struct i40e_vf {
        uint64_t flags;
 };
 
-#define I40E_MAX_PKT_TYPE 256
+#define I40E_MAX_PKT_TYPE  256
+#define I40E_FLOW_TYPE_MAX 64
 
 /*
  * Structure to store private data for each PF/VF instance.
@@ -881,6 +883,10 @@ struct i40e_adapter {
 
        /* ptype mapping table */
        uint32_t ptype_tbl[I40E_MAX_PKT_TYPE] __rte_cache_min_aligned;
+       /* flow type to pctype mapping table */
+       uint64_t pctypes_tbl[I40E_FLOW_TYPE_MAX] __rte_cache_min_aligned;
+       uint64_t flow_types_mask;
+       uint64_t pctypes_mask;
 };
 
 extern const struct rte_flow_ops i40e_flow_ops;
@@ -925,8 +931,8 @@ int i40e_vsi_vlan_pvid_set(struct i40e_vsi *vsi,
                           struct i40e_vsi_vlan_pvid_info *info);
 int i40e_vsi_config_vlan_stripping(struct i40e_vsi *vsi, bool on);
 int i40e_vsi_config_vlan_filter(struct i40e_vsi *vsi, bool on);
-uint64_t i40e_config_hena(uint64_t flags, enum i40e_mac_type type);
-uint64_t i40e_parse_hena(uint64_t flags);
+uint64_t i40e_config_hena(const struct i40e_adapter *adapter, uint64_t flags);
+uint64_t i40e_parse_hena(const struct i40e_adapter *adapter, uint64_t flags);
 enum i40e_status_code i40e_fdir_setup_tx_resources(struct i40e_pf *pf);
 enum i40e_status_code i40e_fdir_setup_rx_resources(struct i40e_pf *pf);
 int i40e_fdir_setup(struct i40e_pf *pf);
@@ -935,8 +941,11 @@ const struct rte_memzone *i40e_memzone_reserve(const char *name,
                                        int socket_id);
 int i40e_fdir_configure(struct rte_eth_dev *dev);
 void i40e_fdir_teardown(struct i40e_pf *pf);
-enum i40e_filter_pctype i40e_flowtype_to_pctype(uint16_t flow_type);
-uint16_t i40e_pctype_to_flowtype(enum i40e_filter_pctype pctype);
+enum i40e_filter_pctype
+       i40e_flowtype_to_pctype(const struct i40e_adapter *adapter,
+                               uint16_t flow_type);
+uint16_t i40e_pctype_to_flowtype(const struct i40e_adapter *adapter,
+                                enum i40e_filter_pctype pctype);
 int i40e_fdir_ctrl_func(struct rte_eth_dev *dev,
                          enum rte_filter_op filter_op,
                          void *arg);
index a903deb..111ac39 100644 (file)
@@ -1443,6 +1443,7 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
                return 0;
        }
        i40e_set_default_ptype_table(eth_dev);
+       i40e_set_default_pctype_table(eth_dev);
        rte_eth_copy_pci_info(eth_dev, pci_dev);
        eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
 
@@ -2178,7 +2179,7 @@ i40evf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
        dev_info->max_rx_pktlen = I40E_FRAME_SIZE_MAX;
        dev_info->hash_key_size = (I40E_VFQF_HKEY_MAX_INDEX + 1) * sizeof(uint32_t);
        dev_info->reta_size = ETH_RSS_RETA_SIZE_64;
-       dev_info->flow_type_rss_offloads = I40E_RSS_OFFLOAD_ALL;
+       dev_info->flow_type_rss_offloads = vf->adapter->flow_types_mask;
        dev_info->max_mac_addrs = I40E_NUM_MACADDR_MAX;
        dev_info->rx_offload_capa =
                DEV_RX_OFFLOAD_VLAN_STRIP |
@@ -2506,7 +2507,7 @@ i40evf_hw_rss_hash_set(struct i40e_vf *vf, struct rte_eth_rss_conf *rss_conf)
        if (ret)
                return ret;
 
-       hena = i40e_config_hena(rss_conf->rss_hf, hw->mac.type);
+       hena = i40e_config_hena(vf->adapter, rss_conf->rss_hf);
        i40e_write_rx_ctl(hw, I40E_VFQF_HENA(0), (uint32_t)hena);
        i40e_write_rx_ctl(hw, I40E_VFQF_HENA(1), (uint32_t)(hena >> 32));
        I40EVF_WRITE_FLUSH(hw);
@@ -2549,7 +2550,7 @@ i40evf_config_rss(struct i40e_vf *vf)
        }
 
        rss_conf = vf->dev_data->dev_conf.rx_adv_conf.rss_conf;
-       if ((rss_conf.rss_hf & I40E_RSS_OFFLOAD_ALL) == 0) {
+       if ((rss_conf.rss_hf & vf->adapter->flow_types_mask) == 0) {
                i40evf_disable_rss(vf);
                PMD_DRV_LOG(DEBUG, "No hash flag is set");
                return 0;
@@ -2574,14 +2575,13 @@ i40evf_dev_rss_hash_update(struct rte_eth_dev *dev,
 {
        struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
        struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-       uint64_t rss_hf = rss_conf->rss_hf & I40E_RSS_OFFLOAD_ALL;
+       uint64_t rss_hf = rss_conf->rss_hf & vf->adapter->flow_types_mask;
        uint64_t hena;
 
        hena = (uint64_t)i40e_read_rx_ctl(hw, I40E_VFQF_HENA(0));
        hena |= ((uint64_t)i40e_read_rx_ctl(hw, I40E_VFQF_HENA(1))) << 32;
-       if (!(hena & ((hw->mac.type == I40E_MAC_X722)
-                ? I40E_RSS_HENA_ALL_X722
-                : I40E_RSS_HENA_ALL))) { /* RSS disabled */
+
+       if (!(hena & vf->adapter->pctypes_mask)) { /* RSS disabled */
                if (rss_hf != 0) /* Enable RSS */
                        return -EINVAL;
                return 0;
@@ -2607,7 +2607,7 @@ i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 
        hena = (uint64_t)i40e_read_rx_ctl(hw, I40E_VFQF_HENA(0));
        hena |= ((uint64_t)i40e_read_rx_ctl(hw, I40E_VFQF_HENA(1))) << 32;
-       rss_conf->rss_hf = i40e_parse_hena(hena);
+       rss_conf->rss_hf = i40e_parse_hena(vf->adapter, hena);
 
        return 0;
 }
index 84c0a1f..268ada0 100644 (file)
@@ -323,6 +323,7 @@ i40e_init_flx_pld(struct i40e_pf *pf)
        struct i40e_hw *hw = I40E_PF_TO_HW(pf);
        uint8_t pctype;
        int i, index;
+       uint16_t flow_type;
 
        /*
         * Define the bytes stream extracted as flexible payload in
@@ -344,15 +345,10 @@ i40e_init_flx_pld(struct i40e_pf *pf)
        /* initialize the masks */
        for (pctype = I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
             pctype <= I40E_FILTER_PCTYPE_L2_PAYLOAD; pctype++) {
-               if (hw->mac.type == I40E_MAC_X722) {
-                       if (!I40E_VALID_PCTYPE_X722(
-                                (enum i40e_filter_pctype)pctype))
-                               continue;
-               } else {
-                       if (!I40E_VALID_PCTYPE(
-                                (enum i40e_filter_pctype)pctype))
-                               continue;
-               }
+               flow_type = i40e_pctype_to_flowtype(pf->adapter, pctype);
+
+               if (flow_type == RTE_ETH_FLOW_UNKNOWN)
+                       continue;
                pf->fdir.flex_mask[pctype].word_mask = 0;
                i40e_write_rx_ctl(hw, I40E_PRTQF_FD_FLXINSET(pctype), 0);
                for (i = 0; i < I40E_FDIR_BITMASK_NUM_WORD; i++) {
@@ -449,7 +445,8 @@ i40e_check_fdir_flex_payload(const struct rte_eth_flex_payload_cfg *flex_cfg)
  * arguments are valid
  */
 static int
-i40e_check_fdir_flex_conf(const struct rte_eth_fdir_flex_conf *conf)
+i40e_check_fdir_flex_conf(const struct i40e_adapter *adapter,
+                         const struct rte_eth_fdir_flex_conf *conf)
 {
        const struct rte_eth_flex_payload_cfg *flex_cfg;
        const struct rte_eth_fdir_flex_mask *flex_mask;
@@ -457,6 +454,7 @@ i40e_check_fdir_flex_conf(const struct rte_eth_fdir_flex_conf *conf)
        uint8_t nb_bitmask;
        uint16_t i, j;
        int ret = 0;
+       enum i40e_filter_pctype pctype;
 
        if (conf == NULL) {
                PMD_DRV_LOG(INFO, "NULL pointer.");
@@ -487,7 +485,8 @@ i40e_check_fdir_flex_conf(const struct rte_eth_fdir_flex_conf *conf)
        }
        for (i = 0; i < conf->nb_flexmasks; i++) {
                flex_mask = &conf->flex_mask[i];
-               if (!I40E_VALID_FLOW(flex_mask->flow_type)) {
+               pctype = i40e_flowtype_to_pctype(adapter, flex_mask->flow_type);
+               if (pctype == I40E_FILTER_PCTYPE_INVALID) {
                        PMD_DRV_LOG(WARNING, "invalid flow type.");
                        return -EINVAL;
                }
@@ -650,7 +649,7 @@ i40e_fdir_configure(struct rte_eth_dev *dev)
        i40e_init_flx_pld(pf); /* set flex config to default value */
 
        conf = &dev->data->dev_conf.fdir_conf.flex_conf;
-       ret = i40e_check_fdir_flex_conf(conf);
+       ret = i40e_check_fdir_flex_conf(pf->adapter, conf);
        if (ret < 0) {
                PMD_DRV_LOG(ERR, " invalid configuration arguments.");
                return -EINVAL;
@@ -664,11 +663,11 @@ i40e_fdir_configure(struct rte_eth_dev *dev)
                        /* get translated pctype value in fd pctype register */
                        pctype = (enum i40e_filter_pctype)i40e_read_rx_ctl(
                                hw, I40E_GLQF_FD_PCTYPES(
-                               (int)i40e_flowtype_to_pctype(
+                               (int)i40e_flowtype_to_pctype(pf->adapter,
                                conf->flex_mask[i].flow_type)));
                } else
-                       pctype = i40e_flowtype_to_pctype(
-                               conf->flex_mask[i].flow_type);
+                       pctype = i40e_flowtype_to_pctype(pf->adapter,
+                                               conf->flex_mask[i].flow_type);
 
                i40e_set_flex_mask_on_pctype(pf, pctype, &conf->flex_mask[i]);
        }
@@ -1100,7 +1099,8 @@ i40e_add_del_fdir_filter(struct rte_eth_dev *dev,
                return -ENOTSUP;
        }
 
-       if (!I40E_VALID_FLOW(filter->input.flow_type)) {
+       pctype = i40e_flowtype_to_pctype(pf->adapter, filter->input.flow_type);
+       if (pctype == I40E_FILTER_PCTYPE_INVALID) {
                PMD_DRV_LOG(ERR, "invalid flow_type input.");
                return -EINVAL;
        }
@@ -1141,12 +1141,8 @@ i40e_add_del_fdir_filter(struct rte_eth_dev *dev,
        if (hw->mac.type == I40E_MAC_X722) {
                /* get translated pctype value in fd pctype register */
                pctype = (enum i40e_filter_pctype)i40e_read_rx_ctl(
-                       hw, I40E_GLQF_FD_PCTYPES(
-                       (int)i40e_flowtype_to_pctype(
-                       filter->input.flow_type)));
-       } else
-               pctype = i40e_flowtype_to_pctype(filter->input.flow_type);
-
+                       hw, I40E_GLQF_FD_PCTYPES((int)pctype));
+       }
        ret = i40e_fdir_filter_programming(pf, pctype, filter, add);
        if (ret < 0) {
                PMD_DRV_LOG(ERR, "fdir programming fails for PCTYPE(%u).",
@@ -1384,7 +1380,6 @@ i40e_fdir_info_get_flex_mask(struct i40e_pf *pf,
 {
        struct i40e_fdir_flex_mask *mask;
        struct rte_eth_fdir_flex_mask *ptr = flex_mask;
-       struct i40e_hw *hw = I40E_PF_TO_HW(pf);
        uint16_t flow_type;
        uint8_t i, j;
        uint16_t off_bytes, mask_tmp;
@@ -1393,14 +1388,11 @@ i40e_fdir_info_get_flex_mask(struct i40e_pf *pf,
             i <= I40E_FILTER_PCTYPE_L2_PAYLOAD;
             i++) {
                mask =  &pf->fdir.flex_mask[i];
-               if (hw->mac.type == I40E_MAC_X722) {
-                       if (!I40E_VALID_PCTYPE_X722((enum i40e_filter_pctype)i))
-                               continue;
-               } else {
-                       if (!I40E_VALID_PCTYPE((enum i40e_filter_pctype)i))
-                               continue;
-               }
-               flow_type = i40e_pctype_to_flowtype((enum i40e_filter_pctype)i);
+               flow_type = i40e_pctype_to_flowtype(pf->adapter,
+                                                   (enum i40e_filter_pctype)i);
+               if (flow_type == RTE_ETH_FLOW_UNKNOWN)
+                       continue;
+
                for (j = 0; j < I40E_FDIR_MAX_FLEXWORD_NUM; j++) {
                        if (mask->word_mask & I40E_FLEX_WORD_MASK(j)) {
                                ptr->mask[j * sizeof(uint16_t)] = UINT8_MAX;
index b92719a..5d8afc6 100644 (file)
@@ -2776,8 +2776,9 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
                }
        }
 
-       pctype = i40e_flowtype_to_pctype(flow_type);
-       if (pctype == 0 || pctype > I40E_FILTER_PCTYPE_L2_PAYLOAD) {
+       pctype = i40e_flowtype_to_pctype(pf->adapter, flow_type);
+       if (pctype == I40E_FILTER_PCTYPE_INVALID ||
+           pctype > I40E_FILTER_PCTYPE_L2_PAYLOAD) {
                rte_flow_error_set(error, EINVAL,
                                   RTE_FLOW_ERROR_TYPE_ITEM, item,
                                   "Unsupported flow type");
index 3a7b68e..f69050f 100644 (file)
@@ -2943,6 +2943,64 @@ i40e_set_default_ptype_table(struct rte_eth_dev *dev)
                ad->ptype_tbl[i] = i40e_get_default_pkt_type(i);
 }
 
+void __attribute__((cold))
+i40e_set_default_pctype_table(struct rte_eth_dev *dev)
+{
+       struct i40e_adapter *ad =
+                       I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+       struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+       int i;
+
+       for (i = 0; i < I40E_FLOW_TYPE_MAX; i++)
+               ad->pctypes_tbl[i] = 0ULL;
+       ad->flow_types_mask = 0ULL;
+       ad->pctypes_mask = 0ULL;
+
+       ad->pctypes_tbl[RTE_ETH_FLOW_FRAG_IPV4] =
+                               (1ULL << I40E_FILTER_PCTYPE_FRAG_IPV4);
+       ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV4_UDP] =
+                               (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_UDP);
+       ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV4_TCP] =
+                               (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP);
+       ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV4_SCTP] =
+                               (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_SCTP);
+       ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV4_OTHER] =
+                               (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_OTHER);
+       ad->pctypes_tbl[RTE_ETH_FLOW_FRAG_IPV6] =
+                               (1ULL << I40E_FILTER_PCTYPE_FRAG_IPV6);
+       ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV6_UDP] =
+                               (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_UDP);
+       ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV6_TCP] =
+                               (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP);
+       ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV6_SCTP] =
+                               (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_SCTP);
+       ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV6_OTHER] =
+                               (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER);
+       ad->pctypes_tbl[RTE_ETH_FLOW_L2_PAYLOAD] =
+                               (1ULL << I40E_FILTER_PCTYPE_L2_PAYLOAD);
+
+       if (hw->mac.type == I40E_MAC_X722) {
+               ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV4_UDP] |=
+                       (1ULL << I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP);
+               ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV4_UDP] |=
+                       (1ULL << I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP);
+               ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV4_TCP] |=
+                       (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK);
+               ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV6_UDP] |=
+                       (1ULL << I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP);
+               ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV6_UDP] |=
+                       (1ULL << I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP);
+               ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV6_TCP] |=
+                       (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK);
+       }
+
+       for (i = 0; i < I40E_FLOW_TYPE_MAX; i++) {
+               if (ad->pctypes_tbl[i])
+                       ad->flow_types_mask |= (1ULL << i);
+               ad->pctypes_mask |= ad->pctypes_tbl[i];
+       }
+}
+
 /* Stubs needed for linkage when CONFIG_RTE_I40E_INC_VECTOR is set to 'n' */
 int __attribute__((weak))
 i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev __rte_unused *dev)
index 20084d6..2a58ced 100644 (file)
@@ -255,6 +255,7 @@ void i40e_set_tx_function_flag(struct rte_eth_dev *dev,
                               struct i40e_tx_queue *txq);
 void i40e_set_tx_function(struct rte_eth_dev *dev);
 void i40e_set_default_ptype_table(struct rte_eth_dev *dev);
+void i40e_set_default_pctype_table(struct rte_eth_dev *dev);
 
 /* For each value it means, datasheet of hardware can tell more details
  *