]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ice: do not add LLDP-specific filter if not necessary
authorLarysa Zaremba <larysa.zaremba@intel.com>
Fri, 14 Feb 2025 08:50:36 +0000 (09:50 +0100)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Fri, 11 Apr 2025 16:44:26 +0000 (09:44 -0700)
Commit 34295a3696fb ("ice: implement new LLDP filter command")
introduced the ability to use LLDP-specific filter that directs all
LLDP traffic to a single VSI. However, current goal is for all trusted VFs
to be able to see LLDP neighbors, which is impossible to do with the
special filter.

Make using the generic filter the default choice and fall back to special
one only if a generic filter cannot be added. That way setups with "NVMs
where an already existent LLDP filter is blocking the creation of a filter
to allow LLDP packets" will still be able to configure software Rx LLDP on
PF only, while all other setups would be able to forward them to VFs too.

Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice.h
drivers/net/ethernet/intel/ice/ice_common.c
drivers/net/ethernet/intel/ice/ice_common.h
drivers/net/ethernet/intel/ice/ice_lib.c

index fd083647c14acb1eba633e342c847b7274413ca4..2694951a0b1d606d12d2553a0e7b7023ae902c8f 100644 (file)
@@ -515,6 +515,7 @@ enum ice_pf_flags {
        ICE_FLAG_MTU_CHANGED,
        ICE_FLAG_GNSS,                  /* GNSS successfully initialized */
        ICE_FLAG_DPLL,                  /* SyncE/PTP dplls initialized */
+       ICE_FLAG_LLDP_AQ_FLTR,
        ICE_PF_FLAGS_NBITS              /* must be last */
 };
 
index 59df31c2c83f7e72a83704b6e6b3eaa7d509b622..e725b785d0932378e7ae977f3ac3e999664a36f6 100644 (file)
@@ -6011,15 +6011,21 @@ bool ice_fw_supports_lldp_fltr_ctrl(struct ice_hw *hw)
 /**
  * ice_lldp_fltr_add_remove - add or remove a LLDP Rx switch filter
  * @hw: pointer to HW struct
- * @vsi_num: absolute HW index for VSI
+ * @vsi: VSI to add the filter to
  * @add: boolean for if adding or removing a filter
+ *
+ * Return: 0 on success, -EOPNOTSUPP if the operation cannot be performed
+ *        with this HW or VSI, otherwise an error corresponding to
+ *        the AQ transaction result.
  */
-int
-ice_lldp_fltr_add_remove(struct ice_hw *hw, u16 vsi_num, bool add)
+int ice_lldp_fltr_add_remove(struct ice_hw *hw, struct ice_vsi *vsi, bool add)
 {
        struct ice_aqc_lldp_filter_ctrl *cmd;
        struct ice_aq_desc desc;
 
+       if (vsi->type != ICE_VSI_PF || !ice_fw_supports_lldp_fltr_ctrl(hw))
+               return -EOPNOTSUPP;
+
        cmd = &desc.params.lldp_filter_ctrl;
 
        ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_lldp_filter_ctrl);
@@ -6029,7 +6035,7 @@ ice_lldp_fltr_add_remove(struct ice_hw *hw, u16 vsi_num, bool add)
        else
                cmd->cmd_flags = ICE_AQC_LLDP_FILTER_ACTION_DELETE;
 
-       cmd->vsi_num = cpu_to_le16(vsi_num);
+       cmd->vsi_num = cpu_to_le16(vsi->vsi_num);
 
        return ice_aq_send_cmd(hw, &desc, NULL, 0, NULL);
 }
index 9b00aa0ddf10e6e34fc420c643cec5e9ca5f9933..64c530b3919171011313bff4cac33323cbd00da1 100644 (file)
@@ -290,8 +290,7 @@ int
 ice_aq_set_lldp_mib(struct ice_hw *hw, u8 mib_type, void *buf, u16 buf_size,
                    struct ice_sq_cd *cd);
 bool ice_fw_supports_lldp_fltr_ctrl(struct ice_hw *hw);
-int
-ice_lldp_fltr_add_remove(struct ice_hw *hw, u16 vsi_num, bool add);
+int ice_lldp_fltr_add_remove(struct ice_hw *hw, struct ice_vsi *vsi, bool add);
 int ice_lldp_execute_pending_mib(struct ice_hw *hw);
 int
 ice_aq_read_i2c(struct ice_hw *hw, struct ice_aqc_link_topo_addr topo_addr,
index 0bcf9d127ac9e7d28c607ad3d3c2529ab640ef35..542b76b5707a079e346d405f9f8e62382628ef6c 100644 (file)
@@ -2085,19 +2085,28 @@ void ice_cfg_sw_lldp(struct ice_vsi *vsi, bool tx, bool create)
                status = eth_fltr(vsi, ETH_P_LLDP, ICE_FLTR_TX,
                                  ICE_DROP_PACKET);
        } else {
-               if (ice_fw_supports_lldp_fltr_ctrl(&pf->hw)) {
-                       status = ice_lldp_fltr_add_remove(&pf->hw, vsi->vsi_num,
-                                                         create);
-               } else {
+               if (!test_bit(ICE_FLAG_LLDP_AQ_FLTR, pf->flags)) {
                        status = eth_fltr(vsi, ETH_P_LLDP, ICE_FLTR_RX,
                                          ICE_FWD_TO_VSI);
+                       if (!status || !create)
+                               goto report;
+
+                       dev_info(dev,
+                                "Failed to add generic LLDP Rx filter on VSI %i error: %d, falling back to specialized AQ control\n",
+                                vsi->vsi_num, status);
                }
+
+               status = ice_lldp_fltr_add_remove(&pf->hw, vsi, create);
+               if (!status)
+                       set_bit(ICE_FLAG_LLDP_AQ_FLTR, pf->flags);
+
        }
 
+report:
        if (status)
-               dev_dbg(dev, "Fail %s %s LLDP rule on VSI %i error: %d\n",
-                       create ? "adding" : "removing", tx ? "TX" : "RX",
-                       vsi->vsi_num, status);
+               dev_warn(dev, "Failed to %s %s LLDP rule on VSI %i error: %d\n",
+                        create ? "add" : "remove", tx ? "Tx" : "Rx",
+                        vsi->vsi_num, status);
 }
 
 /**