Intel Wired LAN Driver Updates 2024-09-30 (ice, idpf)
Subsystems (4)
Tony Nguyen
maintainerThis series contains updates to ice and idpf drivers:
For ice:
Michal corrects setting of dst VSI on LAN filters and adds clearing of port VLAN configuration during reset.
Gui-Dong Han corrects failures to decrement refcount in some error paths.
Przemek resolves a memory leak in ice_init_tx_topology().
Arkadiusz prevents setting of DPLL_PIN_STATE_SELECTABLE to an improper value.
Dave stops clearing of VLAN tracking bit to allow for VLANs to be properly restored after reset.
For idpf:
Ahmed sets uninitialized dyn_ctl_intrvl_s value.
Josh corrects use and reporting of mailbox size.
Larysa corrects order of function calls during de-initialization.
The following are changes since commit d505d3593b52b6c43507f119572409087416ba28:
net: wwan: qcom_bam_dmux: Fix missing pm_runtime_disable()
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue 100GbE
Ahmed Zaki (1):
idpf: fix VF dynamic interrupt ctl register initialization
Arkadiusz Kubalewski (1):
ice: disallow DPLL_PIN_STATE_SELECTABLE for dpll output pins
Dave Ertman (1):
ice: fix VLAN replay after reset
Gui-Dong Han (2):
ice: Fix improper handling of refcount in ice_dpll_init_rclk_pins()
ice: Fix improper handling of refcount in
ice_sriov_set_msix_vec_count()
Joshua Hay (1):
idpf: use actual mbx receive payload length
Larysa Zaremba (1):
idpf: deinit virtchnl transaction manager after vport and vectors
Michal Swiatkowski (2):
ice: set correct dst VSI in only LAN filters
ice: clear port vlan config during reset
Przemek Kitszel (1):
ice: fix memleak in ice_init_tx_topology()
drivers/net/ethernet/intel/ice/ice_ddp.c | 58 +++++++++---------- drivers/net/ethernet/intel/ice/ice_ddp.h | 4 +- drivers/net/ethernet/intel/ice/ice_dpll.c | 6 +- drivers/net/ethernet/intel/ice/ice_main.c | 8 +-- drivers/net/ethernet/intel/ice/ice_sriov.c | 8 ++- drivers/net/ethernet/intel/ice/ice_switch.c | 2 - drivers/net/ethernet/intel/ice/ice_tc_lib.c | 11 ++++ drivers/net/ethernet/intel/ice/ice_vf_lib.c | 7 +++ .../net/ethernet/intel/ice/ice_vsi_vlan_lib.c | 57 ++++++++++++++++++ .../net/ethernet/intel/ice/ice_vsi_vlan_lib.h | 1 + drivers/net/ethernet/intel/idpf/idpf_vf_dev.c | 1 + .../net/ethernet/intel/idpf/idpf_virtchnl.c | 11 +--- 12 files changed, 120 insertions(+), 54 deletions(-)
Signature · 1 line
2.42.0
Tony Nguyen
maintainerPATCH 1/10 ice: set correct dst VSI in only LAN filters
From: Michal Swiatkowski <[email protected]>
The filters set that will reproduce the problem:
$ tc filter add dev $VF0_PR ingress protocol arp prio 0 flower \ skip_sw dst_mac ff:ff:ff:ff:ff:ff action mirred egress \ redirect dev $PF0 $ tc filter add dev $VF0_PR ingress protocol arp prio 0 flower \ skip_sw dst_mac ff:ff:ff:ff:ff:ff src_mac 52:54:00:00:00:10 \ action mirred egress mirror dev $VF1_PR
Expected behaviour is to set all broadcast from VF0 to the LAN. If the src_mac match the value from filters, send packet to LAN and to VF1.
In this case both LAN_EN and LB_EN flags in switch is set in case of packet matching both filters. As dst VSI for the only LAN enable bit is PF VSI, the packet is being seen on PF. To fix this change dst VSI to the source VSI. It will block receiving any packet even when LB_EN is set by switch, because local loopback is clear on VF VSI during normal operation.
Side note: if the second filters action is redirect instead of mirror LAN_EN is clear, because switch is AND-ing LAN_EN from each matched filters and OR-ing LB_EN.
--- drivers/net/ethernet/intel/ice/ice_tc_lib.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/net/ethernet/intel/ice/ice_tc_lib.c +11 -0
@@ -819,6 +819,17 @@ ice_eswitch_add_tc_fltr(struct ice_vsi *vsi, struct ice_tc_flower_fltr *fltr) rule_info.sw_act.flag |=ICE_FLTR_TX ; rule_info.sw_act.src = vsi->idx; rule_info.flags_info.act =ICE_SINGLE_ACT_LAN_ENABLE ; +/* This is a specific case. The destination VSI index is +* overwritten by the source VSI index. This type of filter +* should allow the packet to go to the LAN, not to the +* VSI passed here. It should set LAN_EN bit only. However, +* the VSI must be a valid one. Setting source VSI index +* here is safe. Even if the result from switch is set LAN_EN +* and LB_EN (which normally will pass the packet to this VSI) +* packet won't be seen on the VSI, because local loopback is +* turned off. +*/ + rule_info.sw_act.vsi_handle = vsi->idx; }else {/* VF to VF */ rule_info.sw_act.flag |=ICE_FLTR_TX ;
Signature · 1 line
2.42.0
Tony Nguyen
maintainerPATCH 2/10 ice: Fix improper handling of refcount in ice_dpll_init_rclk_pins()
In reply to Tony NguyenFrom: Gui-Dong Han <[email protected]>
This patch addresses a reference count handling issue in the ice_dpll_init_rclk_pins() function. The function calls ice_dpll_get_pins(), which increments the reference count of the relevant resources. However, if the condition WARN_ON((!vsi || !vsi->netdev)) is met, the function currently returns an error without properly releasing the resources acquired by ice_dpll_get_pins(), leading to a reference count leak.
To resolve this, the check has been moved to the top of the function. This ensures that the function verifies the state before any resources are acquired, avoiding the need for additional resource management in the error path.
This bug was identified by an experimental static analysis tool developed by our team. The tool specializes in analyzing reference count operations and detecting potential issues where resources are not properly managed. In this case, the tool flagged the missing release operation as a potential problem, which led to the development of this patch.
--- drivers/net/ethernet/intel/ice/ice_dpll.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_dpll.c +2 -2
@@ -1843,6 +1843,8 @@ ice_dpll_init_rclk_pins(struct ice_pf *pf, struct ice_dpll_pin *pin,struct dpll_pin *parent;int ret, i; +if (WARN_ON ((!vsi || !vsi->netdev))) +return -EINVAL ; ret =ice_dpll_get_pins (pf, pin, start_idx,ICE_DPLL_RCLK_NUM_PER_PF , pf->dplls.clock_id);if (ret)
@@ -1858,8 +1860,6 @@ ice_dpll_init_rclk_pins(struct ice_pf *pf, struct ice_dpll_pin *pin,if (ret) goto unregister_pins; } -if (WARN_ON ((!vsi || !vsi->netdev))) -return -EINVAL ;dpll_netdev_pin_set (vsi->netdev, pf->dplls.rclk.pin);return 0 ;
Signature · 1 line
2.42.0
Re: [PATCH net 02/10] ice: Fix improper handling of refcount in ice_dpll_init_rclk_pins()
Quoted 44 lines · Tony Nguyen
From: Gui-Dong Han <[email protected]>
This patch addresses a reference count handling issue in the
ice_dpll_init_rclk_pins()function. The function callsice_dpll_get_pins(), which increments the reference count of the relevant resources. However, if the conditionWARN_ON((!vsi || !vsi->netdev))is met, the function currently returns an error without properly releasing the resources acquired byice_dpll_get_pins(), leading to a reference count leak.To resolve this, the check has been moved to the top of the function. This ensures that the function verifies the state before any resources are acquired, avoiding the need for additional resource management in the error path.
This bug was identified by an experimental static analysis tool developed by our team. The tool specializes in analyzing reference count operations and detecting potential issues where resources are not properly managed. In this case, the tool flagged the missing release operation as a potential problem, which led to the development of this patch.
Fixes d7999f5ea64b ("ice: implement dpll interface to control cgu")Signed-off-by Gui-Dong Han <[email protected]>Reviewed-by Simon Horman <[email protected]>Signed-off-by Tony Nguyen <[email protected]>--- drivers/net/ethernet/intel/ice/ice_dpll.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/ethernet/intel/ice/ice_dpll.c +2
-0@@ -1843,6 +1843,8 @@ ice_dpll_init_rclk_pins(struct ice_pf *pf, struct ice_dpll_pin *pin,struct dpll_pin *parent;int ret, i; +if (WARN_ON ((!vsi || !vsi->netdev))) +return -EINVAL ; ret =ice_dpll_get_pins (pf, pin, start_idx,ICE_DPLL_RCLK_NUM_PER_PF , pf->dplls.clock_id);if (ret)
drivers/net/ethernet/intel/ice/ice_dpll.c ice_dpll_init_rclk_pins(struct ice_pf *pf, struct ice_dpll_pin *pin, · line 1865
Quoted 8 lines
drivers/net/ethernet/intel/ice/ice_dpll.c +0
-2@@ -1858,8 +1860,6 @@ ice_dpll_init_rclk_pins(struct ice_pf *pf, struct ice_dpll_pin *pin,if (ret) goto unregister_pins; } -if (WARN_ON ((!vsi || !vsi->netdev))) -return -EINVAL ;dpll_netdev_pin_set (vsi->netdev, pf->dplls.rclk.pin);return 0 ;
Tony Nguyen
maintainerPATCH 3/10 ice: Fix improper handling of refcount in ice_sriov_set_msix_vec_count()
In reply to Tony NguyenFrom: Gui-Dong Han <[email protected]>
This patch addresses an issue with improper reference count handling in the ice_sriov_set_msix_vec_count() function.
First, the function calls ice_get_vf_by_id(), which increments the reference count of the vf pointer. If the subsequent call to ice_get_vf_vsi() fails, the function currently returns an error without decrementing the reference count of the vf pointer, leading to a reference count leak. The correct behavior, as implemented in this patch, is to decrement the reference count using ice_put_vf(vf) before returning an error when vsi is NULL.
Second, the function calls ice_sriov_get_irqs(), which sets vf->first_vector_idx. If this call returns a negative value, indicating an error, the function returns an error without decrementing the reference count of the vf pointer, resulting in another reference count leak. The patch addresses this by adding a call to ice_put_vf(vf) before returning an error when vf->first_vector_idx < 0.
This bug was identified by an experimental static analysis tool developed by our team. The tool specializes in analyzing reference count operations and identifying potential mismanagement of reference counts. In this case, the tool flagged the missing decrement operation as a potential issue, leading to this patch.
--- drivers/net/ethernet/intel/ice/ice_sriov.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_sriov.c +6 -2
@@ -1096,8 +1096,10 @@ int ice_sriov_set_msix_vec_count(struct pci_dev *vf_dev, int msix_vec_count)return -ENOENT ; vsi =ice_get_vf_vsi (vf); -if (!vsi) +if (!vsi) { +ice_put_vf (vf);return -ENOENT ; + } prev_msix = vf->num_msix; prev_queues = vf->num_vf_qs;
@@ -1142,8 +1144,10 @@ int ice_sriov_set_msix_vec_count(struct pci_dev *vf_dev, int msix_vec_count) vf->num_msix = prev_msix; vf->num_vf_qs = prev_queues; vf->first_vector_idx =ice_sriov_get_irqs (pf, vf->num_msix); -if (vf->first_vector_idx <0 ) +if (vf->first_vector_idx <0 ) { +ice_put_vf (vf);return -EINVAL ; + }if (needs_rebuild) {ice_vf_reconfig_vsi (vf);
Signature · 1 line
2.42.0
Re: [PATCH net 03/10] ice: Fix improper handling of refcount in ice_sriov_set_msix_vec_count()
Quoted 27 lines · Tony Nguyen
From: Gui-Dong Han <[email protected]>
This patch addresses an issue with improper reference count handling in the
ice_sriov_set_msix_vec_count()function.First, the function calls
ice_get_vf_by_id(), which increments the reference count of the vf pointer. If the subsequent call toice_get_vf_vsi()fails, the function currently returns an error without decrementing the reference count of the vf pointer, leading to a reference count leak. The correct behavior, as implemented in this patch, is to decrement the reference count usingice_put_vf(vf)before returning an error when vsi is NULL.Second, the function calls
ice_sriov_get_irqs(), which setsvf->first_vector_idx. If this call returns a negative value, indicating an error, the function returns an error without decrementing the reference count of the vf pointer, resulting in another reference count leak. The patch addresses this by adding a call toice_put_vf(vf)before returning an error whenvf->first_vector_idx< 0.This bug was identified by an experimental static analysis tool developed by our team. The tool specializes in analyzing reference count operations and identifying potential mismanagement of reference counts. In this case, the tool flagged the missing decrement operation as a potential issue, leading to this patch.
Quoted 7 lines
Fixes 4035c72dc1ba ("ice: reconfig host after changing MSI-X on VF")Fixes 4d38cb44bd32 ("ice: manage VFs MSI-X using resource tracking")Signed-off-by Gui-Dong Han <[email protected]>Reviewed-by Simon Horman <[email protected]>Tested-by Rafal Romanowski <[email protected]>Signed-off-by Tony Nguyen <[email protected]>
LGTM,
Signature · 2 lines
Regards, Kalesh A P
Tony Nguyen
maintainerPATCH 4/10 ice: clear port vlan config during reset
In reply to Tony NguyenFrom: Michal Swiatkowski <[email protected]>
Since commit 2a2cb4c6c181 ("ice: replace ice_vf_recreate_vsi() with ice_vf_reconfig_vsi()") VF VSI is only reconfigured instead of recreated. The context configuration from previous setting is still the same. If any of the config needs to be cleared it needs to be cleared explicitly.
Previously there was assumption that port vlan will be cleared automatically. Now, when VSI is only reconfigured we have to do it in the code.
Not clearing port vlan configuration leads to situation when the driver VSI config is different than the VSI config in HW. Traffic can't be passed after setting and clearing port vlan, because of invalid VSI config in HW.
Example reproduction:
Quoted 3 lines
ip a a dev $(VF) $(VF_IP_ADDRESS)
ip l s dev $(VF) up
ping $(VF_IP_ADDRESS)
ping is working fine here
Quoted 3 lines
ip link set eth5 vf 0 vlan 100
ip link set eth5 vf 0 vlan 0
ping $(VF_IP_ADDRESS)
ping isn't working
--- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 7 +++ .../net/ethernet/intel/ice/ice_vsi_vlan_lib.c | 57 +++++++++++++++++++ .../net/ethernet/intel/ice/ice_vsi_vlan_lib.h | 1 + 3 files changed, 65 insertions(+)
drivers/net/ethernet/intel/ice/ice_vf_lib.c +7 -0
@@ -335,6 +335,13 @@ static int ice_vf_rebuild_host_vlan_cfg(struct ice_vf *vf, struct ice_vsi *vsi) err = vlan_ops->add_vlan (vsi, &vf->port_vlan_info); }else { +/* clear possible previous port vlan config */ + err =ice_vsi_clear_port_vlan (vsi); +if (err) { +dev_err (dev,"failed to clear port VLAN via VSI parameters for VF %u, error %d\n" , + vf->vf_id, err); +return err; + } err =ice_vsi_add_vlan_zero (vsi); }
drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c +57 -0
60 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.h +1 -0
@@ -36,5 +36,6 @@ int ice_vsi_ena_outer_insertion(struct ice_vsi *vsi, u16 tpid);int ice_vsi_dis_outer_insertion (struct ice_vsi *vsi);int ice_vsi_set_outer_port_vlan (struct ice_vsi *vsi,struct ice_vlan *vlan);int ice_vsi_clear_outer_port_vlan (struct ice_vsi *vsi); +int ice_vsi_clear_port_vlan (struct ice_vsi *vsi);#endif /* _ICE_VSI_VLAN_LIB_H_ */
Signature · 1 line
2.42.0
Tony Nguyen
maintainerPATCH 5/10 ice: fix memleak in ice_init_tx_topology()
In reply to Tony NguyenFrom: Przemek Kitszel <[email protected]>
Fix leak of the FW blob (DDP pkg).
Make ice_cfg_tx_topo() const-correct, so ice_init_tx_topology() can avoid copying whole FW blob. Copy just the topology section, and only when needed. Reuse the buffer allocated for the read of the current topology.
This was found by kmemleak, with the following trace for each PF:
[<ffffffff8761044d>] kmemdup_noprof+0x1d/0x50
[<ffffffffc0a0a480>] ice_init_ddp_config+0x100/0x220 [ice]
[<ffffffffc0a0da7f>] ice_init_dev+0x6f/0x200 [ice]
[<ffffffffc0a0dc49>] ice_init+0x29/0x560 [ice]
[<ffffffffc0a10c1d>] ice_probe+0x21d/0x310 [ice]Constify ice_cfg_tx_topo() @buf parameter.
This cascades further down to few more functions.
--- drivers/net/ethernet/intel/ice/ice_ddp.c | 58 +++++++++++------------ drivers/net/ethernet/intel/ice/ice_ddp.h | 4 +- drivers/net/ethernet/intel/ice/ice_main.c | 8 +--- 3 files changed, 31 insertions(+), 39 deletions(-)
drivers/net/ethernet/intel/ice/ice_ddp.c +28 -30
@@ -31,7 +31,7 @@ static const struct ice_tunnel_type_scan tnls[] = {* Verifies various attributes of the package file, including length, format * version, and the requirement of at least one segment. */ -static enum ice_ddp_state ice_verify_pkg (struct ice_pkg_hdr *pkg,u32 len) +static enum ice_ddp_state ice_verify_pkg (const struct ice_pkg_hdr *pkg,u32 len) {u32 seg_count;u32 i;
@@ -57,13 +57,13 @@ static enum ice_ddp_state ice_verify_pkg(struct ice_pkg_hdr *pkg, u32 len)/* all segments must fit within length */ for (i =0 ; i < seg_count; i++) {u32 off =le32_to_cpu (pkg->seg_offset[i]); -struct ice_generic_seg_hdr *seg; +const struct ice_generic_seg_hdr *seg;/* segment header must fit */ if (len < off +sizeof (*seg))return ICE_DDP_PKG_INVALID_FILE ; - seg = (struct ice_generic_seg_hdr *)((u8 *)pkg + off); + seg = (void *)pkg + off;/* segment body must fit */ if (len < off +le32_to_cpu (seg->seg_size))
@@ -119,13 +119,13 @@ static enum ice_ddp_state ice_chk_pkg_version(struct ice_pkg_ver *pkg_ver)* * This helper function validates a buffer's header. */ -static struct ice_buf_hdr *ice_pkg_val_buf (struct ice_buf *buf) +static const struct ice_buf_hdr *ice_pkg_val_buf (const struct ice_buf *buf) { -struct ice_buf_hdr *hdr; +const struct ice_buf_hdr *hdr;u16 section_count;u16 data_end; - hdr = (struct ice_buf_hdr *)buf->buf; + hdr = (const struct ice_buf_hdr *)buf->buf;/* verify data */ section_count =le16_to_cpu (hdr->section_count);if (section_count <ICE_MIN_S_COUNT || section_count >ICE_MAX_S_COUNT )
@@ -165,8 +165,8 @@ static struct ice_buf_table *ice_find_buf_table(struct ice_seg *ice_seg)* unexpected value has been detected (for example an invalid section count or * an invalid buffer end value). */ -static struct ice_buf_hdr *ice_pkg_enum_buf (struct ice_seg *ice_seg, -struct ice_pkg_enum *state) +static const struct ice_buf_hdr *ice_pkg_enum_buf (struct ice_seg *ice_seg, +struct ice_pkg_enum *state) {if (ice_seg) { state->buf_table =ice_find_buf_table (ice_seg);
@@ -1800,9 +1800,9 @@ int ice_update_pkg(struct ice_hw *hw, struct ice_buf *bufs, u32 count)* success it returns a pointer to the segment header, otherwise it will * return NULL. */ -static struct ice_generic_seg_hdr * +static const struct ice_generic_seg_hdr *ice_find_seg_in_pkg (struct ice_hw *hw,u32 seg_type, -struct ice_pkg_hdr *pkg_hdr) +const struct ice_pkg_hdr *pkg_hdr) {u32 i;
@@ -1813,11 +1813,9 @@ ice_find_seg_in_pkg(struct ice_hw *hw, u32 seg_type,/* Search all package segments for the requested segment type */ for (i =0 ; i <le32_to_cpu (pkg_hdr->seg_count); i++) { -struct ice_generic_seg_hdr *seg; +const struct ice_generic_seg_hdr *seg; - seg = (struct ice_generic_seg_hdr - *)((u8 *)pkg_hdr + -le32_to_cpu (pkg_hdr->seg_offset[i])); + seg = (void *)pkg_hdr +le32_to_cpu (pkg_hdr->seg_offset[i]);if (le32_to_cpu (seg->seg_type) == seg_type)return seg;
@@ -2354,12 +2352,12 @@ ice_get_set_tx_topo(struct ice_hw *hw, u8 *buf, u16 buf_size,* * Return: zero when update was successful, negative values otherwise. */ -int ice_cfg_tx_topo (struct ice_hw *hw,u8 *buf,u32 len) +int ice_cfg_tx_topo (struct ice_hw *hw,const void *buf,u32 len) { -u8 *current_topo, *new_topo =NULL ; -struct ice_run_time_cfg_seg *seg; -struct ice_buf_hdr *section; -struct ice_pkg_hdr *pkg_hdr; + u8 *new_topo = NULL, *topo __free(kfree) = NULL; +const struct ice_run_time_cfg_seg *seg; +const struct ice_buf_hdr *section; +const struct ice_pkg_hdr *pkg_hdr;enum ice_ddp_state state;u16 offset, size =0 ;u32 reg =0 ;
@@ -2375,15 +2373,13 @@ int ice_cfg_tx_topo(struct ice_hw *hw, u8 *buf, u32 len)return -EOPNOTSUPP ; } - current_topo =kzalloc (ICE_AQ_MAX_BUF_LEN ,GFP_KERNEL ); -if (!current_topo) + topo =kzalloc (ICE_AQ_MAX_BUF_LEN ,GFP_KERNEL ); +if (!topo)return -ENOMEM ; -/* Get the current Tx topology */ - status =ice_get_set_tx_topo (hw, current_topo,ICE_AQ_MAX_BUF_LEN ,NULL , - &flags, false); - -kfree (current_topo); +/* Get the current Tx topology flags */ + status =ice_get_set_tx_topo (hw, topo,ICE_AQ_MAX_BUF_LEN ,NULL , &flags, + false);if (status) {ice_debug (hw,ICE_DBG_INIT ,"Get current topology is failed\n" );
@@ -2419,7 +2415,7 @@ int ice_cfg_tx_topo(struct ice_hw *hw, u8 *buf, u32 len) goto update_topo; } - pkg_hdr = (struct ice_pkg_hdr *)buf; + pkg_hdr = (const struct ice_pkg_hdr *)buf; state =ice_verify_pkg (pkg_hdr, len);if (state) { ice_debug(hw, ICE_DBG_INIT, "Failed to verify pkg (err: %d)\n",
@@ -2428,7 +2424,7 @@ int ice_cfg_tx_topo(struct ice_hw *hw, u8 *buf, u32 len) }/* Find runtime configuration segment */ - seg = (struct ice_run_time_cfg_seg *) + seg = (const struct ice_run_time_cfg_seg *)ice_find_seg_in_pkg (hw,SEGMENT_TYPE_ICE_RUN_TIME_CFG , pkg_hdr);if (!seg) {ice_debug (hw,ICE_DBG_INIT ,"5 layer topology segment is missing\n" );
@@ -2461,8 +2457,10 @@ int ice_cfg_tx_topo(struct ice_hw *hw, u8 *buf, u32 len)return -EIO ; } -/* Get the new topology buffer */ - new_topo = ((u8 *)section) + offset; +/* Get the new topology buffer, reuse current topo copy mem */ +static_assert (ICE_PKG_BUF_SIZE ==ICE_AQ_MAX_BUF_LEN ); + new_topo = topo; +memcpy (new_topo, (u8 *)section + offset, size); update_topo:/* Acquire global lock to make sure that set topology issued
drivers/net/ethernet/intel/ice/ice_ddp.h +2 -2
@@ -438,7 +438,7 @@ struct ice_pkg_enum {u32 buf_idx;u32 type; -struct ice_buf_hdr *buf; +const struct ice_buf_hdr *buf;u32 sect_idx;void *sect;u32 sect_type;
@@ -467,6 +467,6 @@ ice_pkg_enum_entry(struct ice_seg *ice_seg, struct ice_pkg_enum *state,void *ice_pkg_enum_section (struct ice_seg *ice_seg,struct ice_pkg_enum *state,u32 sect_type); -int ice_cfg_tx_topo (struct ice_hw *hw,u8 *buf,u32 len); +int ice_cfg_tx_topo (struct ice_hw *hw,const void *buf,u32 len);#endif
drivers/net/ethernet/intel/ice/ice_main.c +1 -7
@@ -4536,16 +4536,10 @@ ice_init_tx_topology(struct ice_hw *hw, const struct firmware *firmware)u8 num_tx_sched_layers = hw->num_tx_sched_layers;struct ice_pf *pf = hw->back;struct device *dev; -u8 *buf_copy;int err; dev =ice_pf_to_dev (pf); -/* ice_cfg_tx_topo buf argument is not a constant, -* so we have to make a copy -*/ - buf_copy =kmemdup (firmware->data, firmware->size,GFP_KERNEL ); - - err =ice_cfg_tx_topo (hw, buf_copy, firmware->size); + err =ice_cfg_tx_topo (hw, firmware->data, firmware->size);if (!err) {if (hw->num_tx_sched_layers > num_tx_sched_layers)dev_info (dev,"Tx scheduling layers switching feature disabled\n" );
Signature · 1 line
2.42.0
Tony Nguyen
maintainerPATCH 6/10 ice: disallow DPLL_PIN_STATE_SELECTABLE for dpll output pins
In reply to Tony NguyenFrom: Arkadiusz Kubalewski <[email protected]>
Currently the user may request DPLL_PIN_STATE_SELECTABLE for an output pin, and this would actually set the DISCONNECTED state instead.
It doesn't make any sense. SELECTABLE is valid only in case of input pins (on AUTOMATIC type dpll), where dpll itself would select best valid input. For the output pin only CONNECTED/DISCONNECTED are expected.
--- drivers/net/ethernet/intel/ice/ice_dpll.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/ice/ice_dpll.c +2 -0
@@ -656,6 +656,8 @@ ice_dpll_output_state_set(const struct dpll_pin *pin, void *pin_priv,struct ice_dpll_pin *p = pin_priv;struct ice_dpll *d = dpll_priv; +if (state ==DPLL_PIN_STATE_SELECTABLE ) +return -EINVAL ;if (!enable && p->state[d->dpll_idx] ==DPLL_PIN_STATE_DISCONNECTED )return 0 ;
Signature · 1 line
2.42.0
Tony Nguyen
maintainerPATCH 7/10 ice: fix VLAN replay after reset
In reply to Tony NguyenFrom: Dave Ertman <[email protected]>
There is a bug currently when there are more than one VLAN defined and any reset that affects the PF is initiated, after the reset rebuild no traffic will pass on any VLAN but the last one created.
This is caused by the iteration though the VLANs during replay each clearing the vsi_map bitmap of the VSI that is being replayed. The problem is that during rhe replay, the pointer to the vsi_map bitmap is used by each successive vlan to determine if it should be replayed on this VSI.
The logic was that the replay of the VLAN would replace the bit in the map before the next VLAN would iterate through. But, since the replay copies the old bitmap pointer to filt_replay_rules and creates a new one for the recreated VLANS, it does not do this, and leaves the old bitmap broken to be used to replay the remaining VLANs.
Since the old bitmap will be cleaned up in post replay cleanup, there is no need to alter it and break following VLAN replay, so don't clear the bit.
--- drivers/net/ethernet/intel/ice/ice_switch.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_switch.c +0 -2
@@ -6322,8 +6322,6 @@ ice_replay_vsi_fltr(struct ice_hw *hw, u16 vsi_handle, u8 recp_id,if (!itr->vsi_list_info || !test_bit (vsi_handle, itr->vsi_list_info->vsi_map))continue ; -/* Clearing it so that the logic can add it back */ -clear_bit (vsi_handle, itr->vsi_list_info->vsi_map); f_entry.fltr_info.vsi_handle = vsi_handle; f_entry.fltr_info.fltr_act =ICE_FWD_TO_VSI ;/* update the src in case it is VSI num */
Signature · 1 line
2.42.0
Tony Nguyen
maintainerPATCH 8/10 idpf: fix VF dynamic interrupt ctl register initialization
In reply to Tony NguyenFrom: Ahmed Zaki <[email protected]>
The VF's dynamic interrupt ctl "dyn_ctl_intrvl_s" is not initialized in idpf_vf_intr_reg_init(). This resulted in the following UBSAN error whenever a VF is created:
[ 564.345655] UBSAN: shift-out-of-bounds in drivers/net/ethernet/intel/idpf/idpf_txrx.c:3654:10 [ 564.345663] shift exponent 4294967295 is too large for 32-bit type 'int' [ 564.345671] CPU: 33 UID: 0 PID: 2458 Comm: NetworkManager Not tainted 6.11.0-rc4+ #1 [ 564.345678] Hardware name: Intel Corporation M50CYP2SBSTD/M50CYP2SBSTD, BIOS SE5C6200.86B.0027.P10.2201070222 01/07/2022 [ 564.345683] Call Trace: [ 564.345688] <TASK> [ 564.345693] dump_stack_lvl+0x91/0xb0 [ 564.345708] __ubsan_handle_shift_out_of_bounds+0x16b/0x320 [ 564.345730] idpf_vport_intr_update_itr_ena_irq.cold+0x13/0x39 [idpf] [ 564.345755] ? __pfx_idpf_vport_intr_update_itr_ena_irq+0x10/0x10 [idpf] [ 564.345771] ? static_obj+0x95/0xd0 [ 564.345782] ? lockdep_init_map_type+0x1a5/0x800 [ 564.345794] idpf_vport_intr_ena+0x5ef/0x9f0 [idpf] [ 564.345814] idpf_vport_open+0x2cc/0x1240 [idpf] [ 564.345837] idpf_open+0x6d/0xc0 [idpf] [ 564.345850] __dev_open+0x241/0x420
--- drivers/net/ethernet/intel/idpf/idpf_vf_dev.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c +1 -0
@@ -99,6 +99,7 @@ static int idpf_vf_intr_reg_init(struct idpf_vport *vport) intr->dyn_ctl_intena_m =VF_INT_DYN_CTLN_INTENA_M ; intr->dyn_ctl_intena_msk_m =VF_INT_DYN_CTLN_INTENA_MSK_M ; intr->dyn_ctl_itridx_s =VF_INT_DYN_CTLN_ITR_INDX_S ; + intr->dyn_ctl_intrvl_s =VF_INT_DYN_CTLN_INTERVAL_S ; intr->dyn_ctl_wb_on_itr_m =VF_INT_DYN_CTLN_WB_ON_ITR_M ; spacing = IDPF_ITR_IDX_SPACING(reg_vals[vec_id].itrn_index_spacing,
Signature · 1 line
2.42.0
Re: [PATCH net 08/10] idpf: fix VF dynamic interrupt ctl register initialization
Quoted 24 lines · Tony Nguyen
From: Ahmed Zaki <[email protected]>
The VF's dynamic interrupt ctl "
dyn_ctl_intrvl_s" is not initialized inidpf_vf_intr_reg_init(). This resulted in the following UBSAN error whenever a VF is created:[ 564.345655] UBSAN: shift-out-of-bounds in drivers/net/ethernet/intel/idpf/idpf_txrx.c:3654:10 [ 564.345663] shift exponent 4294967295 is too large for 32-bit type 'int' [ 564.345671] CPU: 33 UID: 0 PID: 2458 Comm: NetworkManager Not tainted 6.11.0-rc4+ #1 [ 564.345678] Hardware name: Intel Corporation M50CYP2SBSTD/M50CYP2SBSTD, BIOS SE5C6200.86B.0027.P10.2201070222 01/07/2022 [ 564.345683] Call Trace: [ 564.345688] <TASK> [ 564.345693] dump_stack_lvl+0x91/0xb0 [ 564.345708] __ubsan_handle_shift_out_of_bounds+0x16b/0x320 [ 564.345730] idpf_vport_intr_update_itr_ena_irq.cold+0x13/0x39 [idpf] [ 564.345755] ? __pfx_idpf_vport_intr_update_itr_ena_irq+0x10/0x10 [idpf] [ 564.345771] ? static_obj+0x95/0xd0 [ 564.345782] ? lockdep_init_map_type+0x1a5/0x800 [ 564.345794] idpf_vport_intr_ena+0x5ef/0x9f0 [idpf] [ 564.345814] idpf_vport_open+0x2cc/0x1240 [idpf] [ 564.345837] idpf_open+0x6d/0xc0 [idpf] [ 564.345850] __dev_open+0x241/0x420
Quoted 6 lines
Fixes d4d558718266 ("idpf: initialize interrupts and enable vport")Reviewed-by Przemek Kitszel <[email protected]>Signed-off-by Ahmed Zaki <[email protected]>Reviewed-by Simon Horman <[email protected]>Tested-by Krishneil Singh <[email protected]>Signed-off-by Tony Nguyen <[email protected]>
LGTM,
Signature · 2 lines
Regards, Kalesh A P
Tony Nguyen
maintainerPATCH 9/10 idpf: use actual mbx receive payload length
In reply to Tony NguyenFrom: Joshua Hay <[email protected]>
When a mailbox message is received, the driver is checking for a non 0 datalen in the controlq descriptor. If it is valid, the payload is attached to the ctlq message to give to the upper layer. However, the payload response size given to the upper layer was taken from the buffer metadata which is _always_ the max buffer size. This meant the API was returning 4K as the payload size for all messages. This went unnoticed since the virtchnl exchange response logic was checking for a response size less than 0 (error), not less than exact size, or not greater than or equal to the max mailbox buffer size (4K). All of these checks will pass in the success case since the size provided is always 4K. However, this breaks anyone that wants to validate the exact response size.
Fetch the actual payload length from the value provided in the descriptor data_len field (instead of the buffer metadata).
Unfortunately, this means we lose some extra error parsing for variable sized virtchnl responses such as create vport and get ptypes. However, the original checks weren't really helping anyways since the size was _always_ 4K.
--- drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c +1 -8
@@ -666,7 +666,7 @@ idpf_vc_xn_forward_reply(struct idpf_adapter *adapter,if (ctlq_msg->data_len) { payload = ctlq_msg->ctx.indirect.payload->va; - payload_size = ctlq_msg->ctx.indirect.payload->size; + payload_size = ctlq_msg->data_len; } xn->reply_sz = payload_size;
@@ -1295,10 +1295,6 @@ int idpf_send_create_vport_msg(struct idpf_adapter *adapter, err = reply_sz; goto free_vport_params; } -if (reply_sz <IDPF_CTLQ_MAX_BUF_LEN ) { - err = -EIO ; - goto free_vport_params; - }return 0 ;
@@ -2602,9 +2598,6 @@ int idpf_send_get_rx_ptype_msg(struct idpf_vport *vport)if (reply_sz <0 )return reply_sz; -if (reply_sz <IDPF_CTLQ_MAX_BUF_LEN ) -return -EIO ; - ptypes_recvd +=le16_to_cpu (ptype_info->num_ptypes);if (ptypes_recvd > max_ptype)return -EINVAL ;
Signature · 1 line
2.42.0
Tony Nguyen
maintainerPATCH 10/10 idpf: deinit virtchnl transaction manager after vport and vectors
In reply to Tony NguyenFrom: Larysa Zaremba <[email protected]>
When the device is removed, idpf is supposed to make certain virtchnl requests e.g. VIRTCHNL2_OP_DEALLOC_VECTORS and VIRTCHNL2_OP_DESTROY_VPORT.
However, this does not happen due to the referenced commit introducing virtchnl transaction manager and placing its deinitialization before those messages are sent. Then the sending is impossible due to no transactions being available.
Lack of cleanup can lead to the FW becoming unresponsive from e.g. unloading-loading the driver and creating-destroying VFs afterwards.
Move transaction manager deinitialization to after other virtchnl-related cleanup is done.
--- drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c +1 -1
@@ -3081,9 +3081,9 @@ void idpf_vc_core_deinit(struct idpf_adapter *adapter)if (!test_bit (IDPF_VC_CORE_INIT , adapter->flags))return ; -idpf_vc_xn_shutdown (adapter->vcxn_mngr);idpf_deinit_task (adapter);idpf_intr_rel (adapter); +idpf_vc_xn_shutdown (adapter->vcxn_mngr);cancel_delayed_work_sync (&adapter->serv_task);cancel_delayed_work_sync (&adapter->mbx_task);
Signature · 1 line
2.42.0
This series was applied to netdev/net.git (main) by Tony Nguyen <[email protected]>:
Hello:
This series was applied to netdev/net.git (main)
by Tony Nguyen <[email protected]>:
Quoted 8 lines · On Mon, 30 Sep 2024 15:35:47 -0700 you wrote:
This series contains updates to ice and idpf drivers:
For ice:
Michal corrects setting of dst VSI on LAN filters and adds clearing of port VLAN configuration during reset.
[...]
Here is the summary with links:
- [net,01/10] ice: set correct dst VSI in only LAN filters
https://git.kernel.org/netdev/net/c/839e3f9bee42 - [net,02/10] ice: Fix improper handling of refcount in ice_dpll_init_rclk_pins() https://git.kernel.org/netdev/net/c/ccca30a18e36 - [net,03/10] ice: Fix improper handling of refcount in ice_sriov_set_msix_vec_count() https://git.kernel.org/netdev/net/c/d517cf89874c - [net,04/10] ice: clear port vlan config during reset https://git.kernel.org/netdev/net/c/d019b1a9128d - [net,05/10] ice: fix memleak in ice_init_tx_topology() https://git.kernel.org/netdev/net/c/c188afdc3611 - [net,06/10] ice: disallow DPLL_PIN_STATE_SELECTABLE for dpll output pins https://git.kernel.org/netdev/net/c/afe6e30e7701 - [net,07/10] ice: fix VLAN replay after reset https://git.kernel.org/netdev/net/c/0eae2c136cb6 - [net,08/10] idpf: fix VF dynamic interrupt ctl register initialization https://git.kernel.org/netdev/net/c/d382c7bc236d - [net,09/10] idpf: use actual mbx receive payload length https://git.kernel.org/netdev/net/c/640f70063e6d - [net,10/10] idpf: deinit virtchnl transaction manager after vport and vectors https://git.kernel.org/netdev/net/c/09d0fb5cb30e
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html