[v2,46/66] net/ice/base: fix Rx functionality for ethertype filters

Message ID 20190611155221.2703-47-leyi.rong@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series shared code update |

Checks

Context Check Description
ci/Intel-compilation fail Compilation issues
ci/checkpatch success coding style OK

Commit Message

Leyi Rong June 11, 2019, 3:52 p.m. UTC
  In the function ice_add_eth_mac(), there is a line that
hard-codes the filter info flag to TX. This is redundant
and inaccurate. That flag will be set by the calling
function that built the list of filters to add, and
hard-coding it eliminates the Rx functionality of this
code. The paired function ice_remove_eth_mac() does not
do this, making a mis-matched pair.

Fixes: 157d00901f97 ("net/ice/base: add functions for ethertype filter")

Signed-off-by: Dave Ertman <david.m.ertman@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
---
 drivers/net/ice/base/ice_switch.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index cdecc39b0..2c376321b 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -2974,12 +2974,19 @@  ice_add_mac_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *mv_list)
  * ice_add_eth_mac - Add ethertype and MAC based filter rule
  * @hw: pointer to the hardware structure
  * @em_list: list of ether type MAC filter, MAC is optional
+ *
+ * This function requires the caller to populate the entries in
+ * the filter list with the necessary fields (including flags to
+ * indicate Tx or Rx rules).
  */
 enum ice_status
 ice_add_eth_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *em_list)
 {
 	struct ice_fltr_list_entry *em_list_itr;
 
+	if (!em_list || !hw)
+		return ICE_ERR_PARAM;
+
 	LIST_FOR_EACH_ENTRY(em_list_itr, em_list, ice_fltr_list_entry,
 			    list_entry) {
 		enum ice_sw_lkup_type l_type =
@@ -2989,7 +2996,6 @@  ice_add_eth_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *em_list)
 		    l_type != ICE_SW_LKUP_ETHERTYPE)
 			return ICE_ERR_PARAM;
 
-		em_list_itr->fltr_info.flag = ICE_FLTR_TX;
 		em_list_itr->status = ice_add_rule_internal(hw, l_type,
 							    em_list_itr);
 		if (em_list_itr->status)