net/i40e/base: allow egress traffic mirroring
authorHelin Zhang <helin.zhang@intel.com>
Tue, 24 May 2016 06:23:00 +0000 (14:23 +0800)
committerBruce Richardson <bruce.richardson@intel.com>
Mon, 20 Jun 2016 15:21:50 +0000 (17:21 +0200)
Allow egress traffic to be mirrored to VSIs in promiscuous mode, as latest
firmware supports that from API version 1.5.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
drivers/net/i40e/base/i40e_common.c
drivers/net/i40e/base/i40e_prototype.h
drivers/net/i40e/i40e_ethdev.c
drivers/net/i40e/i40e_pf.c

index e958099..ace5b84 100644 (file)
@@ -2214,10 +2214,12 @@ enum i40e_status_code i40e_aq_set_default_vsi(struct i40e_hw *hw,
  * @seid: vsi number
  * @set: set unicast promiscuous enable/disable
  * @cmd_details: pointer to command details structure or NULL
+ * @rx_only_promisc: flag to decide if egress traffic gets mirrored in promisc
  **/
 enum i40e_status_code i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw,
                                u16 seid, bool set,
-                               struct i40e_asq_cmd_details *cmd_details)
+                               struct i40e_asq_cmd_details *cmd_details,
+                               bool rx_only_promisc)
 {
        struct i40e_aq_desc desc;
        struct i40e_aqc_set_vsi_promiscuous_modes *cmd =
@@ -2230,8 +2232,9 @@ enum i40e_status_code i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw,
 
        if (set) {
                flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST;
-               if (((hw->aq.api_maj_ver == 1) && (hw->aq.api_min_ver >= 5)) ||
-                    (hw->aq.api_maj_ver > 1))
+               if (rx_only_promisc &&
+                   (((hw->aq.api_maj_ver == 1) && (hw->aq.api_min_ver >= 5)) ||
+                    (hw->aq.api_maj_ver > 1)))
                        flags |= I40E_AQC_SET_VSI_PROMISC_TX;
        }
 
index 48a08fd..03dda93 100644 (file)
@@ -166,7 +166,8 @@ enum i40e_status_code i40e_aq_set_vsi_broadcast(struct i40e_hw *hw,
                                u16 vsi_id, bool set_filter,
                                struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw,
-               u16 vsi_id, bool set, struct i40e_asq_cmd_details *cmd_details);
+               u16 vsi_id, bool set, struct i40e_asq_cmd_details *cmd_details,
+               bool rx_only_promisc);
 enum i40e_status_code i40e_aq_set_vsi_multicast_promiscuous(struct i40e_hw *hw,
                u16 vsi_id, bool set, struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_set_vsi_mc_promisc_on_vlan(struct i40e_hw *hw,
@@ -404,7 +405,6 @@ enum i40e_status_code i40e_aq_remove_cloud_filters(struct i40e_hw *hw,
                u16 vsi,
                struct i40e_aqc_add_remove_cloud_filters_element_data *filters,
                u8 filter_count);
-
 enum i40e_status_code i40e_aq_alternate_read(struct i40e_hw *hw,
                                u32 reg_addr0, u32 *reg_val0,
                                u32 reg_addr1, u32 *reg_val1);
index 6bbe5c8..c1fb89a 100644 (file)
@@ -1719,7 +1719,7 @@ i40e_dev_promiscuous_enable(struct rte_eth_dev *dev)
        int status;
 
        status = i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
-                                                       true, NULL);
+                                                    true, NULL, true);
        if (status != I40E_SUCCESS)
                PMD_DRV_LOG(ERR, "Failed to enable unicast promiscuous");
 
@@ -1739,7 +1739,7 @@ i40e_dev_promiscuous_disable(struct rte_eth_dev *dev)
        int status;
 
        status = i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
-                                                       false, NULL);
+                                                    false, NULL, true);
        if (status != I40E_SUCCESS)
                PMD_DRV_LOG(ERR, "Failed to disable unicast promiscuous");
 
index 5afd61a..b549caa 100644 (file)
@@ -810,7 +810,7 @@ i40e_pf_host_process_cmd_config_promisc_mode(
        if (promisc->flags & I40E_FLAG_VF_UNICAST_PROMISC)
                unicast = TRUE;
        ret = i40e_aq_set_vsi_unicast_promiscuous(hw,
-                       vf->vsi->seid, unicast, NULL);
+                       vf->vsi->seid, unicast, NULL, true);
        if (ret != I40E_SUCCESS)
                goto send_msg;