Intel Wired LAN Driver Updates 2022-02-18
Subsystems (3)
Tony Nguyen
maintainerThis series contains updates to ice driver only.
Wojciech fixes protocol matching for slow-path switchdev so that all packets are correctly redirected.
Michal removes accidental unconditional setting of l4 port filtering flag.
Jake adds locking to protect VF reset and removal to fix various issues that can be encountered when they race with each other.
Tom Rix propagates an error and initializes a struct to resolve reported Clang issues.
The following are changes since commit b352c3465bb808ab700d03f5bac2f7a6f37c5350:
net: ll_temac: check the return value of devm_kmalloc()
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue 100GbE
Jacob Keller (1):
ice: fix concurrent reset and removal of VFs
Michal Swiatkowski (1):
ice: fix setting l4 port flag when adding filter
Tom Rix (2):
ice: check the return of ice_ptp_gettimex64
ice: initialize local variable 'tlv'
Wojciech Drewek (1):
ice: Match on all profiles in slow-path
drivers/net/ethernet/intel/ice/ice.h | 1 - drivers/net/ethernet/intel/ice/ice_common.c | 2 +- drivers/net/ethernet/intel/ice/ice_eswitch.c | 1 + drivers/net/ethernet/intel/ice/ice_main.c | 2 + .../ethernet/intel/ice/ice_protocol_type.h | 1 + drivers/net/ethernet/intel/ice/ice_ptp.c | 5 ++- drivers/net/ethernet/intel/ice/ice_switch.c | 4 +- drivers/net/ethernet/intel/ice/ice_tc_lib.c | 4 +- .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 42 +++++++++++-------- 9 files changed, 39 insertions(+), 23 deletions(-)
Signature · 1 line
2.31.1
Tony Nguyen
maintainerPATCH 1/5 ice: Match on all profiles in slow-path
From: Wojciech Drewek <[email protected]>
In switchdev mode, slow-path rules need to match all protocols, in order to correctly redirect unfiltered or missed packets to the uplink. To set this up for the virtual function to uplink flow, the rule that redirects packets to the control VSI must have the tunnel type set to ICE_SW_TUN_AND_NON_TUN. As a result of that new tunnel type being set, ice_get_compat_fv_bitmap will select ICE_PROF_ALL. At that point all profiles would be selected for this rule, resulting in the desired behavior. Without this change slow-path would not work with tunnel protocols.
--- drivers/net/ethernet/intel/ice/ice_eswitch.c | 1 + drivers/net/ethernet/intel/ice/ice_protocol_type.h | 1 + drivers/net/ethernet/intel/ice/ice_switch.c | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_eswitch.c +1 -0
@@ -44,6 +44,7 @@ ice_eswitch_add_vf_mac_rule(struct ice_pf *pf, struct ice_vf *vf, const u8 *mac) ctrl_vsi->rxq_map[vf->vf_id]; rule_info.flags_info.act |=ICE_SINGLE_ACT_LB_ENABLE ; rule_info.flags_info.act_valid = true; + rule_info.tun_type =ICE_SW_TUN_AND_NON_TUN ; err =ice_add_adv_rule (hw, list, lkups_cnt, &rule_info, vf->repr->mac_rule);
drivers/net/ethernet/intel/ice/ice_protocol_type.h +1 -0
@@ -47,6 +47,7 @@ enum ice_protocol_type {enum ice_sw_tunnel_type {ICE_NON_TUN =0 , +ICE_SW_TUN_AND_NON_TUN ,ICE_SW_TUN_VXLAN ,ICE_SW_TUN_GENEVE ,ICE_SW_TUN_NVGRE ,
drivers/net/ethernet/intel/ice/ice_switch.c +3 -1
@@ -4537,6 +4537,7 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,case ICE_SW_TUN_NVGRE : prof_type =ICE_PROF_TUN_GRE ;break ; +case ICE_SW_TUN_AND_NON_TUN :default : prof_type =ICE_PROF_ALL ;break ;
@@ -5305,7 +5306,8 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,if (status) goto err_ice_add_adv_rule; -if (rinfo->tun_type !=ICE_NON_TUN ) { +if (rinfo->tun_type !=ICE_NON_TUN && + rinfo->tun_type !=ICE_SW_TUN_AND_NON_TUN ) { status =ice_fill_adv_packet_tun (hw, rinfo->tun_type, s_rule->pdata.lkup_tx_rx.hdr, pkt_offsets);
Signature · 1 line
2.31.1
Tony Nguyen
maintainerPATCH 2/5 ice: fix setting l4 port flag when adding filter
In reply to Tony NguyenFrom: Michal Swiatkowski <[email protected]>
Accidentally filter flag for none encapsulated l4 port field is always set. Even if user wants to add encapsulated l4 port field.
Remove this unnecessary flag setting.
--- drivers/net/ethernet/intel/ice/ice_tc_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_tc_lib.c +2 -2
@@ -709,7 +709,7 @@ ice_tc_set_port(struct flow_match_ports match, fltr->flags |=ICE_TC_FLWR_FIELD_ENC_DEST_L4_PORT ; else fltr->flags |= ICE_TC_FLWR_FIELD_DEST_L4_PORT; - fltr->flags |=ICE_TC_FLWR_FIELD_DEST_L4_PORT ; + headers->l4_key.dst_port = match.key->dst; headers->l4_mask.dst_port = match.mask->dst; }
@@ -718,7 +718,7 @@ ice_tc_set_port(struct flow_match_ports match, fltr->flags |=ICE_TC_FLWR_FIELD_ENC_SRC_L4_PORT ; else fltr->flags |= ICE_TC_FLWR_FIELD_SRC_L4_PORT; - fltr->flags |=ICE_TC_FLWR_FIELD_SRC_L4_PORT ; + headers->l4_key.src_port = match.key->src; headers->l4_mask.src_port = match.mask->src; }
Signature · 1 line
2.31.1
Tony Nguyen
maintainerPATCH 3/5 ice: fix concurrent reset and removal of VFs
In reply to Tony NguyenFrom: Jacob Keller <[email protected]>
Commit c503e63200c6 ("ice: Stop processing VF messages during teardown") introduced a driver state flag, ICE_VF_DEINIT_IN_PROGRESS, which is intended to prevent some issues with concurrently handling messages from VFs while tearing down the VFs.
This change was motivated by crashes caused while tearing down and bringing up VFs in rapid succession.
It turns out that the fix actually introduces issues with the VF driver caused because the PF no longer responds to any messages sent by the VF during its .remove routine. This results in the VF potentially removing its DMA memory before the PF has shut down the device queues.
Additionally, the fix doesn't actually resolve concurrency issues within the ice driver. It is possible for a VF to initiate a reset just prior to the ice driver removing VFs. This can result in the remove task concurrently operating while the VF is being reset. This results in similar memory corruption and panics purportedly fixed by that commit.
Fix this concurrency at its root by protecting both the reset and removal flows using the existing VF cfg_lock. This ensures that we cannot remove the VF while any outstanding critical tasks such as a virtchnl message or a reset are occurring.
This locking change also fixes the root cause originally fixed by commit c503e63200c6 ("ice: Stop processing VF messages during teardown"), so we can simply revert it.
Note that I kept these two changes together because simply reverting the original commit alone would leave the driver vulnerable to worse race conditions.
--- drivers/net/ethernet/intel/ice/ice.h | 1 - drivers/net/ethernet/intel/ice/ice_main.c | 2 + .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 42 +++++++++++-------- 3 files changed, 27 insertions(+), 18 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +0 -1
@@ -280,7 +280,6 @@ enum ice_pf_state {ICE_VFLR_EVENT_PENDING ,ICE_FLTR_OVERFLOW_PROMISC ,ICE_VF_DIS , -ICE_VF_DEINIT_IN_PROGRESS ,ICE_CFG_BUSY ,ICE_SERVICE_SCHED , ICE_SERVICE_DIS,
drivers/net/ethernet/intel/ice/ice_main.c +2 -0
@@ -1799,7 +1799,9 @@ static void ice_handle_mdd_event(struct ice_pf *pf)* reset, so print the event prior to reset. */ ice_print_vf_rx_mdd_event (vf); +mutex_lock (&pf->vf[i].cfg_lock);ice_reset_vf (&pf->vf[i], false); +mutex_unlock (&pf->vf[i].cfg_lock); } } }
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +25 -17
106 lines not on this page · raw message
Signature · 1 line
2.31.1
Tony Nguyen
maintainerPATCH 4/5 ice: check the return of ice_ptp_gettimex64
In reply to Tony NguyenFrom: Tom Rix <[email protected]>
Clang static analysis reports this issue time64.h:69:50: warning: The left operand of '+'
is a garbage value set_normalized_timespec64(&ts_delta, lhs.tv_sec + rhs.tv_sec,
~~~~~~~~~~ ^
In ice_ptp_adjtime_nonatomic(), the timespec64 variable 'now' is set by ice_ptp_gettimex64(). This function can fail with -EBUSY, so 'now' can have a gargbage value.
So check the return.
--- drivers/net/ethernet/intel/ice/ice_ptp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_ptp.c +4 -1
@@ -1533,9 +1533,12 @@ ice_ptp_settime64(struct ptp_clock_info *info, const struct timespec64 *ts)static int ice_ptp_adjtime_nonatomic (struct ptp_clock_info *info,s64 delta) {struct timespec64 now, then; +int ret; then =ns_to_timespec64 (delta); -ice_ptp_gettimex64 (info, &now,NULL ); + ret =ice_ptp_gettimex64 (info, &now,NULL ); +if (ret) +return ret; now =timespec64_add (now, then);return ice_ptp_settime64 (info, (const struct timespec64 *)&now);
Signature · 1 line
2.31.1
Tony Nguyen
maintainerPATCH 5/5 ice: initialize local variable 'tlv'
In reply to Tony NguyenFrom: Tom Rix <[email protected]>
Clang static analysis reports this issues ice_common.c:5008:21: warning: The left expression of the compound
assignment is an uninitialized value. The computed value will also be garbage
ldo->phy_type_low |= ((u64)buf << (i * 16)); ~~~~~~~~~~~~~~~~~ ^
When called from ice_cfg_phy_fec() ldo is the uninitialized local variable tlv. So initialize.
--- drivers/net/ethernet/intel/ice/ice_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_common.c +1 -1
@@ -3340,7 +3340,7 @@ ice_cfg_phy_fec(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg,if (fec ==ICE_FEC_AUTO &&ice_fw_supports_link_override (hw) && !ice_fw_supports_report_dflt_cfg (hw)) { -struct ice_link_default_override_tlv tlv; +struct ice_link_default_override_tlv tlv = {0 }; status =ice_get_link_default_override (&tlv, pi);if (status)
Signature · 1 line
2.31.1