i40e: extend flow director to support VF
authorJingjing Wu <jingjing.wu@intel.com>
Wed, 4 Nov 2015 03:29:10 +0000 (11:29 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 4 Nov 2015 12:40:57 +0000 (13:40 +0100)
This patch extends flow director to filtering in VFs.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
doc/guides/rel_notes/release_2_2.rst
drivers/net/i40e/i40e_fdir.c

index 76a1640..0c7abe9 100644 (file)
@@ -55,6 +55,8 @@ New Features
 
 * **Added different GRE key length for input set on Intel X710/XL710.**
 
+* **Added flow director support in i40e VF.**
+
 * **Added fm10k vector RX/TX.**
 
 * **Added fm10k TSO support for both PF and VF.**
index ba18c9d..0b45bd9 100644 (file)
@@ -1022,6 +1022,11 @@ i40e_add_del_fdir_filter(struct rte_eth_dev *dev,
                PMD_DRV_LOG(ERR, "Invalid queue ID");
                return -EINVAL;
        }
+       if (filter->input.flow_ext.is_vf &&
+               filter->input.flow_ext.dst_id >= pf->vf_num) {
+               PMD_DRV_LOG(ERR, "Invalid VF ID");
+               return -EINVAL;
+       }
 
        memset(pkt, 0, I40E_FDIR_PKT_LEN);
 
@@ -1061,7 +1066,7 @@ i40e_fdir_filter_programming(struct i40e_pf *pf,
        volatile struct i40e_tx_desc *txdp;
        volatile struct i40e_filter_program_desc *fdirdp;
        uint32_t td_cmd;
-       uint16_t i;
+       uint16_t vsi_id, i;
        uint8_t dest;
 
        PMD_DRV_LOG(INFO, "filling filter programming descriptor.");
@@ -1083,9 +1088,13 @@ i40e_fdir_filter_programming(struct i40e_pf *pf,
                                          I40E_TXD_FLTR_QW0_PCTYPE_SHIFT) &
                                          I40E_TXD_FLTR_QW0_PCTYPE_MASK);
 
-       /* Use LAN VSI Id by default */
+       if (filter->input.flow_ext.is_vf)
+               vsi_id = pf->vfs[filter->input.flow_ext.dst_id].vsi->vsi_id;
+       else
+               /* Use LAN VSI Id by default */
+               vsi_id = pf->main_vsi->vsi_id;
        fdirdp->qindex_flex_ptype_vsi |=
-               rte_cpu_to_le_32((pf->main_vsi->vsi_id <<
+               rte_cpu_to_le_32((vsi_id <<
                                  I40E_TXD_FLTR_QW0_DEST_VSI_SHIFT) &
                                  I40E_TXD_FLTR_QW0_DEST_VSI_MASK);