]> git.droids-corp.org - dpdk.git/commitdiff
net/i40e: turn off flexible payload on driver init
authorKirill Rybalchenko <kirill.rybalchenko@intel.com>
Tue, 9 Jan 2018 15:36:54 +0000 (15:36 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 16 Jan 2018 17:47:49 +0000 (18:47 +0100)
Function i40e_GLQF_reg_init() overwrites global register for
flexible payload, forcing extraction of first 16 bytes of
L2/L3/L4 payload to the field vector even if flexible payload
is not used by an application. Such unconditional turn on of
flexible payload effectively disables ability to use outer
IP Destination address for RSS/FDIR for tunnelled packets,
as flexible payload overwrites outer IP destination address
on the field vector.
Now flexible payload turned on only when flow director is
enabled and configured.

Signed-off-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
drivers/net/i40e/i40e_ethdev.c
drivers/net/i40e/i40e_ethdev.h
drivers/net/i40e/i40e_fdir.c
drivers/net/i40e/i40e_flow.c

index 3dc026fbf536df10c63bda13eea56805847a02a0..c9551b083328f648afe4400e652644fcadd73dca 100644 (file)
@@ -671,17 +671,6 @@ RTE_PMD_REGISTER_KMOD_DEP(net_i40e, "* igb_uio | uio_pci_generic | vfio-pci");
 
 static inline void i40e_GLQF_reg_init(struct i40e_hw *hw)
 {
-       /*
-        * Force global configuration for flexible payload
-        * to the first 16 bytes of the corresponding L2/L3/L4 paylod.
-        * This should be removed from code once proper
-        * configuration API is added to avoid configuration conflicts
-        * between ports of the same device.
-        */
-       I40E_WRITE_REG(hw, I40E_GLQF_ORT(33), 0x000000E0);
-       I40E_WRITE_REG(hw, I40E_GLQF_ORT(34), 0x000000E3);
-       I40E_WRITE_REG(hw, I40E_GLQF_ORT(35), 0x000000E6);
-
        /*
         * Initialize registers for parsing packet type of QinQ
         * This should be removed from code once proper
@@ -1115,9 +1104,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
 
        /*
         * To work around the NVM issue, initialize registers
-        * for flexible payload and packet type of QinQ by
-        * software. It should be removed once issues are fixed
-        * in NVM.
+        * for packet type of QinQ by software.
+        * It should be removed once issues are fixed in NVM.
         */
        i40e_GLQF_reg_init(hw);
 
@@ -1286,6 +1274,10 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
 
        /* enable uio intr after callback register */
        rte_intr_enable(intr_handle);
+
+       /* By default disable flexible payload in global configuration */
+       i40e_flex_payload_reg_set_default(hw);
+
        /*
         * Add an ethertype filter to drop all flow control frames transmitted
         * from VSIs. By doing so, we stop VF from sending out PAUSE or PFC
@@ -1406,6 +1398,17 @@ i40e_rm_fdir_filter_list(struct i40e_pf *pf)
        }
 }
 
+void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)
+{
+       /*
+        * Disable by default flexible payload
+        * for corresponding L2/L3/L4 layers.
+        */
+       I40E_WRITE_REG(hw, I40E_GLQF_ORT(33), 0x00000000);
+       I40E_WRITE_REG(hw, I40E_GLQF_ORT(34), 0x00000000);
+       I40E_WRITE_REG(hw, I40E_GLQF_ORT(35), 0x00000000);
+}
+
 static int
 eth_i40e_dev_uninit(struct rte_eth_dev *dev)
 {
@@ -2203,6 +2206,9 @@ i40e_dev_close(struct rte_eth_dev *dev)
        i40e_res_pool_destroy(&pf->qp_pool);
        i40e_res_pool_destroy(&pf->msix_pool);
 
+       /* Disable flexible payload in global configuration */
+       i40e_flex_payload_reg_set_default(hw);
+
        /* force a PF reset to clean anything leftover */
        reg = I40E_READ_REG(hw, I40E_PFGEN_CTRL);
        I40E_WRITE_REG(hw, I40E_PFGEN_CTRL,
index c36402232f022d9d5eb1b1e085ee23d7ad2193a8..d598730c24e9cadb897d5095c338bb1a886f01fc 100644 (file)
@@ -1171,6 +1171,7 @@ int i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb);
 int i40e_flush_queue_region_all_conf(struct rte_eth_dev *dev,
                struct i40e_hw *hw, struct i40e_pf *pf, uint16_t on);
 void i40e_init_queue_region_conf(struct rte_eth_dev *dev);
+void i40e_flex_payload_reg_set_default(struct i40e_hw *hw);
 
 #define I40E_DEV_TO_PCI(eth_dev) \
        RTE_DEV_TO_PCI((eth_dev)->device)
index e471b5a515d2a98d2e8edba08c67d4b875e766dd..906c2048abbebd84ff4614f906c5b35f7216ede9 100644 (file)
@@ -505,7 +505,7 @@ i40e_set_flx_pld_cfg(struct i40e_pf *pf,
 {
        struct i40e_hw *hw = I40E_PF_TO_HW(pf);
        struct i40e_fdir_flex_pit flex_pit[I40E_MAX_FLXPLD_FIED];
-       uint32_t flx_pit;
+       uint32_t flx_pit, flx_ort;
        uint16_t num, min_next_off;  /* in words */
        uint8_t field_idx = 0;
        uint8_t layer_idx = 0;
@@ -519,9 +519,17 @@ i40e_set_flx_pld_cfg(struct i40e_pf *pf,
                layer_idx = I40E_FLXPLD_L4_IDX;
 
        memset(flex_pit, 0, sizeof(flex_pit));
-       num = i40e_srcoff_to_flx_pit(cfg->src_offset, flex_pit);
+       num = RTE_MIN(i40e_srcoff_to_flx_pit(cfg->src_offset, flex_pit),
+                     RTE_DIM(flex_pit));
 
-       for (i = 0; i < RTE_MIN(num, RTE_DIM(flex_pit)); i++) {
+       if (num) {
+               flx_ort = (1 << I40E_GLQF_ORT_FLX_PAYLOAD_SHIFT) |
+                         (num << I40E_GLQF_ORT_FIELD_CNT_SHIFT) |
+                         (layer_idx * I40E_MAX_FLXPLD_FIED);
+               I40E_WRITE_REG(hw, I40E_GLQF_ORT(33 + layer_idx), flx_ort);
+       }
+
+       for (i = 0; i < num; i++) {
                field_idx = layer_idx * I40E_MAX_FLXPLD_FIED + i;
                /* record the info in fdir structure */
                pf->fdir.flex_set[field_idx].src_offset =
index e522962c2fee5242817f15933fef06d5cd0e8f70..6feb7aa4dfbdd4389639f491f79747d8a064b5bf 100644 (file)
@@ -2248,11 +2248,18 @@ i40e_flow_set_fdir_flex_pit(struct i40e_pf *pf,
                            uint8_t raw_id)
 {
        struct i40e_hw *hw = I40E_PF_TO_HW(pf);
-       uint32_t flx_pit;
+       uint32_t flx_pit, flx_ort;
        uint8_t field_idx;
        uint16_t min_next_off = 0;  /* in words */
        uint8_t i;
 
+       if (raw_id) {
+               flx_ort = (1 << I40E_GLQF_ORT_FLX_PAYLOAD_SHIFT) |
+                         (raw_id << I40E_GLQF_ORT_FIELD_CNT_SHIFT) |
+                         (layer_idx * I40E_MAX_FLXPLD_FIED);
+               I40E_WRITE_REG(hw, I40E_GLQF_ORT(33 + layer_idx), flx_ort);
+       }
+
        /* Set flex pit */
        for (i = 0; i < raw_id; i++) {
                field_idx = layer_idx * I40E_MAX_FLXPLD_FIED + i;