Skip to content

Commit 096c0fa

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2024-09-30 (ice, idpf) 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. 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. * '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue: idpf: deinit virtchnl transaction manager after vport and vectors idpf: use actual mbx receive payload length idpf: fix VF dynamic interrupt ctl register initialization ice: fix VLAN replay after reset ice: disallow DPLL_PIN_STATE_SELECTABLE for dpll output pins ice: fix memleak in ice_init_tx_topology() ice: clear port vlan config during reset ice: Fix improper handling of refcount in ice_sriov_set_msix_vec_count() ice: Fix improper handling of refcount in ice_dpll_init_rclk_pins() ice: set correct dst VSI in only LAN filters ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 2d7a098 + 09d0fb5 commit 096c0fa

File tree

12 files changed

+120
-54
lines changed

12 files changed

+120
-54
lines changed

drivers/net/ethernet/intel/ice/ice_ddp.c

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static const struct ice_tunnel_type_scan tnls[] = {
3131
* Verifies various attributes of the package file, including length, format
3232
* version, and the requirement of at least one segment.
3333
*/
34-
static enum ice_ddp_state ice_verify_pkg(struct ice_pkg_hdr *pkg, u32 len)
34+
static enum ice_ddp_state ice_verify_pkg(const struct ice_pkg_hdr *pkg, u32 len)
3535
{
3636
u32 seg_count;
3737
u32 i;
@@ -57,13 +57,13 @@ static enum ice_ddp_state ice_verify_pkg(struct ice_pkg_hdr *pkg, u32 len)
5757
/* all segments must fit within length */
5858
for (i = 0; i < seg_count; i++) {
5959
u32 off = le32_to_cpu(pkg->seg_offset[i]);
60-
struct ice_generic_seg_hdr *seg;
60+
const struct ice_generic_seg_hdr *seg;
6161

6262
/* segment header must fit */
6363
if (len < off + sizeof(*seg))
6464
return ICE_DDP_PKG_INVALID_FILE;
6565

66-
seg = (struct ice_generic_seg_hdr *)((u8 *)pkg + off);
66+
seg = (void *)pkg + off;
6767

6868
/* segment body must fit */
6969
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)
119119
*
120120
* This helper function validates a buffer's header.
121121
*/
122-
static struct ice_buf_hdr *ice_pkg_val_buf(struct ice_buf *buf)
122+
static const struct ice_buf_hdr *ice_pkg_val_buf(const struct ice_buf *buf)
123123
{
124-
struct ice_buf_hdr *hdr;
124+
const struct ice_buf_hdr *hdr;
125125
u16 section_count;
126126
u16 data_end;
127127

128-
hdr = (struct ice_buf_hdr *)buf->buf;
128+
hdr = (const struct ice_buf_hdr *)buf->buf;
129129
/* verify data */
130130
section_count = le16_to_cpu(hdr->section_count);
131131
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)
165165
* unexpected value has been detected (for example an invalid section count or
166166
* an invalid buffer end value).
167167
*/
168-
static struct ice_buf_hdr *ice_pkg_enum_buf(struct ice_seg *ice_seg,
169-
struct ice_pkg_enum *state)
168+
static const struct ice_buf_hdr *ice_pkg_enum_buf(struct ice_seg *ice_seg,
169+
struct ice_pkg_enum *state)
170170
{
171171
if (ice_seg) {
172172
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)
18001800
* success it returns a pointer to the segment header, otherwise it will
18011801
* return NULL.
18021802
*/
1803-
static struct ice_generic_seg_hdr *
1803+
static const struct ice_generic_seg_hdr *
18041804
ice_find_seg_in_pkg(struct ice_hw *hw, u32 seg_type,
1805-
struct ice_pkg_hdr *pkg_hdr)
1805+
const struct ice_pkg_hdr *pkg_hdr)
18061806
{
18071807
u32 i;
18081808

@@ -1813,11 +1813,9 @@ ice_find_seg_in_pkg(struct ice_hw *hw, u32 seg_type,
18131813

18141814
/* Search all package segments for the requested segment type */
18151815
for (i = 0; i < le32_to_cpu(pkg_hdr->seg_count); i++) {
1816-
struct ice_generic_seg_hdr *seg;
1816+
const struct ice_generic_seg_hdr *seg;
18171817

1818-
seg = (struct ice_generic_seg_hdr
1819-
*)((u8 *)pkg_hdr +
1820-
le32_to_cpu(pkg_hdr->seg_offset[i]));
1818+
seg = (void *)pkg_hdr + le32_to_cpu(pkg_hdr->seg_offset[i]);
18211819

18221820
if (le32_to_cpu(seg->seg_type) == seg_type)
18231821
return seg;
@@ -2354,12 +2352,12 @@ ice_get_set_tx_topo(struct ice_hw *hw, u8 *buf, u16 buf_size,
23542352
*
23552353
* Return: zero when update was successful, negative values otherwise.
23562354
*/
2357-
int ice_cfg_tx_topo(struct ice_hw *hw, u8 *buf, u32 len)
2355+
int ice_cfg_tx_topo(struct ice_hw *hw, const void *buf, u32 len)
23582356
{
2359-
u8 *current_topo, *new_topo = NULL;
2360-
struct ice_run_time_cfg_seg *seg;
2361-
struct ice_buf_hdr *section;
2362-
struct ice_pkg_hdr *pkg_hdr;
2357+
u8 *new_topo = NULL, *topo __free(kfree) = NULL;
2358+
const struct ice_run_time_cfg_seg *seg;
2359+
const struct ice_buf_hdr *section;
2360+
const struct ice_pkg_hdr *pkg_hdr;
23632361
enum ice_ddp_state state;
23642362
u16 offset, size = 0;
23652363
u32 reg = 0;
@@ -2375,15 +2373,13 @@ int ice_cfg_tx_topo(struct ice_hw *hw, u8 *buf, u32 len)
23752373
return -EOPNOTSUPP;
23762374
}
23772375

2378-
current_topo = kzalloc(ICE_AQ_MAX_BUF_LEN, GFP_KERNEL);
2379-
if (!current_topo)
2376+
topo = kzalloc(ICE_AQ_MAX_BUF_LEN, GFP_KERNEL);
2377+
if (!topo)
23802378
return -ENOMEM;
23812379

2382-
/* Get the current Tx topology */
2383-
status = ice_get_set_tx_topo(hw, current_topo, ICE_AQ_MAX_BUF_LEN, NULL,
2384-
&flags, false);
2385-
2386-
kfree(current_topo);
2380+
/* Get the current Tx topology flags */
2381+
status = ice_get_set_tx_topo(hw, topo, ICE_AQ_MAX_BUF_LEN, NULL, &flags,
2382+
false);
23872383

23882384
if (status) {
23892385
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)
24192415
goto update_topo;
24202416
}
24212417

2422-
pkg_hdr = (struct ice_pkg_hdr *)buf;
2418+
pkg_hdr = (const struct ice_pkg_hdr *)buf;
24232419
state = ice_verify_pkg(pkg_hdr, len);
24242420
if (state) {
24252421
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)
24282424
}
24292425

24302426
/* Find runtime configuration segment */
2431-
seg = (struct ice_run_time_cfg_seg *)
2427+
seg = (const struct ice_run_time_cfg_seg *)
24322428
ice_find_seg_in_pkg(hw, SEGMENT_TYPE_ICE_RUN_TIME_CFG, pkg_hdr);
24332429
if (!seg) {
24342430
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)
24612457
return -EIO;
24622458
}
24632459

2464-
/* Get the new topology buffer */
2465-
new_topo = ((u8 *)section) + offset;
2460+
/* Get the new topology buffer, reuse current topo copy mem */
2461+
static_assert(ICE_PKG_BUF_SIZE == ICE_AQ_MAX_BUF_LEN);
2462+
new_topo = topo;
2463+
memcpy(new_topo, (u8 *)section + offset, size);
24662464

24672465
update_topo:
24682466
/* Acquire global lock to make sure that set topology issued

drivers/net/ethernet/intel/ice/ice_ddp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ struct ice_pkg_enum {
438438
u32 buf_idx;
439439

440440
u32 type;
441-
struct ice_buf_hdr *buf;
441+
const struct ice_buf_hdr *buf;
442442
u32 sect_idx;
443443
void *sect;
444444
u32 sect_type;
@@ -467,6 +467,6 @@ ice_pkg_enum_entry(struct ice_seg *ice_seg, struct ice_pkg_enum *state,
467467
void *ice_pkg_enum_section(struct ice_seg *ice_seg, struct ice_pkg_enum *state,
468468
u32 sect_type);
469469

470-
int ice_cfg_tx_topo(struct ice_hw *hw, u8 *buf, u32 len);
470+
int ice_cfg_tx_topo(struct ice_hw *hw, const void *buf, u32 len);
471471

472472
#endif

drivers/net/ethernet/intel/ice/ice_dpll.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,8 @@ ice_dpll_output_state_set(const struct dpll_pin *pin, void *pin_priv,
656656
struct ice_dpll_pin *p = pin_priv;
657657
struct ice_dpll *d = dpll_priv;
658658

659+
if (state == DPLL_PIN_STATE_SELECTABLE)
660+
return -EINVAL;
659661
if (!enable && p->state[d->dpll_idx] == DPLL_PIN_STATE_DISCONNECTED)
660662
return 0;
661663

@@ -1843,6 +1845,8 @@ ice_dpll_init_rclk_pins(struct ice_pf *pf, struct ice_dpll_pin *pin,
18431845
struct dpll_pin *parent;
18441846
int ret, i;
18451847

1848+
if (WARN_ON((!vsi || !vsi->netdev)))
1849+
return -EINVAL;
18461850
ret = ice_dpll_get_pins(pf, pin, start_idx, ICE_DPLL_RCLK_NUM_PER_PF,
18471851
pf->dplls.clock_id);
18481852
if (ret)
@@ -1858,8 +1862,6 @@ ice_dpll_init_rclk_pins(struct ice_pf *pf, struct ice_dpll_pin *pin,
18581862
if (ret)
18591863
goto unregister_pins;
18601864
}
1861-
if (WARN_ON((!vsi || !vsi->netdev)))
1862-
return -EINVAL;
18631865
dpll_netdev_pin_set(vsi->netdev, pf->dplls.rclk.pin);
18641866

18651867
return 0;

drivers/net/ethernet/intel/ice/ice_main.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4536,16 +4536,10 @@ ice_init_tx_topology(struct ice_hw *hw, const struct firmware *firmware)
45364536
u8 num_tx_sched_layers = hw->num_tx_sched_layers;
45374537
struct ice_pf *pf = hw->back;
45384538
struct device *dev;
4539-
u8 *buf_copy;
45404539
int err;
45414540

45424541
dev = ice_pf_to_dev(pf);
4543-
/* ice_cfg_tx_topo buf argument is not a constant,
4544-
* so we have to make a copy
4545-
*/
4546-
buf_copy = kmemdup(firmware->data, firmware->size, GFP_KERNEL);
4547-
4548-
err = ice_cfg_tx_topo(hw, buf_copy, firmware->size);
4542+
err = ice_cfg_tx_topo(hw, firmware->data, firmware->size);
45494543
if (!err) {
45504544
if (hw->num_tx_sched_layers > num_tx_sched_layers)
45514545
dev_info(dev, "Tx scheduling layers switching feature disabled\n");

drivers/net/ethernet/intel/ice/ice_sriov.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,8 +1096,10 @@ int ice_sriov_set_msix_vec_count(struct pci_dev *vf_dev, int msix_vec_count)
10961096
return -ENOENT;
10971097

10981098
vsi = ice_get_vf_vsi(vf);
1099-
if (!vsi)
1099+
if (!vsi) {
1100+
ice_put_vf(vf);
11001101
return -ENOENT;
1102+
}
11011103

11021104
prev_msix = vf->num_msix;
11031105
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)
11421144
vf->num_msix = prev_msix;
11431145
vf->num_vf_qs = prev_queues;
11441146
vf->first_vector_idx = ice_sriov_get_irqs(pf, vf->num_msix);
1145-
if (vf->first_vector_idx < 0)
1147+
if (vf->first_vector_idx < 0) {
1148+
ice_put_vf(vf);
11461149
return -EINVAL;
1150+
}
11471151

11481152
if (needs_rebuild) {
11491153
ice_vf_reconfig_vsi(vf);

drivers/net/ethernet/intel/ice/ice_switch.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6322,8 +6322,6 @@ ice_replay_vsi_fltr(struct ice_hw *hw, u16 vsi_handle, u8 recp_id,
63226322
if (!itr->vsi_list_info ||
63236323
!test_bit(vsi_handle, itr->vsi_list_info->vsi_map))
63246324
continue;
6325-
/* Clearing it so that the logic can add it back */
6326-
clear_bit(vsi_handle, itr->vsi_list_info->vsi_map);
63276325
f_entry.fltr_info.vsi_handle = vsi_handle;
63286326
f_entry.fltr_info.fltr_act = ICE_FWD_TO_VSI;
63296327
/* update the src in case it is VSI num */

drivers/net/ethernet/intel/ice/ice_tc_lib.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,17 @@ ice_eswitch_add_tc_fltr(struct ice_vsi *vsi, struct ice_tc_flower_fltr *fltr)
819819
rule_info.sw_act.flag |= ICE_FLTR_TX;
820820
rule_info.sw_act.src = vsi->idx;
821821
rule_info.flags_info.act = ICE_SINGLE_ACT_LAN_ENABLE;
822+
/* This is a specific case. The destination VSI index is
823+
* overwritten by the source VSI index. This type of filter
824+
* should allow the packet to go to the LAN, not to the
825+
* VSI passed here. It should set LAN_EN bit only. However,
826+
* the VSI must be a valid one. Setting source VSI index
827+
* here is safe. Even if the result from switch is set LAN_EN
828+
* and LB_EN (which normally will pass the packet to this VSI)
829+
* packet won't be seen on the VSI, because local loopback is
830+
* turned off.
831+
*/
832+
rule_info.sw_act.vsi_handle = vsi->idx;
822833
} else {
823834
/* VF to VF */
824835
rule_info.sw_act.flag |= ICE_FLTR_TX;

drivers/net/ethernet/intel/ice/ice_vf_lib.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,13 @@ static int ice_vf_rebuild_host_vlan_cfg(struct ice_vf *vf, struct ice_vsi *vsi)
335335

336336
err = vlan_ops->add_vlan(vsi, &vf->port_vlan_info);
337337
} else {
338+
/* clear possible previous port vlan config */
339+
err = ice_vsi_clear_port_vlan(vsi);
340+
if (err) {
341+
dev_err(dev, "failed to clear port VLAN via VSI parameters for VF %u, error %d\n",
342+
vf->vf_id, err);
343+
return err;
344+
}
338345
err = ice_vsi_add_vlan_zero(vsi);
339346
}
340347

drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,3 +787,60 @@ int ice_vsi_clear_outer_port_vlan(struct ice_vsi *vsi)
787787
kfree(ctxt);
788788
return err;
789789
}
790+
791+
int ice_vsi_clear_port_vlan(struct ice_vsi *vsi)
792+
{
793+
struct ice_hw *hw = &vsi->back->hw;
794+
struct ice_vsi_ctx *ctxt;
795+
int err;
796+
797+
ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
798+
if (!ctxt)
799+
return -ENOMEM;
800+
801+
ctxt->info = vsi->info;
802+
803+
ctxt->info.port_based_outer_vlan = 0;
804+
ctxt->info.port_based_inner_vlan = 0;
805+
806+
ctxt->info.inner_vlan_flags =
807+
FIELD_PREP(ICE_AQ_VSI_INNER_VLAN_TX_MODE_M,
808+
ICE_AQ_VSI_INNER_VLAN_TX_MODE_ALL);
809+
if (ice_is_dvm_ena(hw)) {
810+
ctxt->info.inner_vlan_flags |=
811+
FIELD_PREP(ICE_AQ_VSI_INNER_VLAN_EMODE_M,
812+
ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING);
813+
ctxt->info.outer_vlan_flags =
814+
FIELD_PREP(ICE_AQ_VSI_OUTER_VLAN_TX_MODE_M,
815+
ICE_AQ_VSI_OUTER_VLAN_TX_MODE_ALL);
816+
ctxt->info.outer_vlan_flags |=
817+
FIELD_PREP(ICE_AQ_VSI_OUTER_TAG_TYPE_M,
818+
ICE_AQ_VSI_OUTER_TAG_VLAN_8100);
819+
ctxt->info.outer_vlan_flags |=
820+
ICE_AQ_VSI_OUTER_VLAN_EMODE_NOTHING <<
821+
ICE_AQ_VSI_OUTER_VLAN_EMODE_S;
822+
}
823+
824+
ctxt->info.sw_flags2 &= ~ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;
825+
ctxt->info.valid_sections =
826+
cpu_to_le16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID |
827+
ICE_AQ_VSI_PROP_VLAN_VALID |
828+
ICE_AQ_VSI_PROP_SW_VALID);
829+
830+
err = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
831+
if (err) {
832+
dev_err(ice_pf_to_dev(vsi->back), "update VSI for clearing port based VLAN failed, err %d aq_err %s\n",
833+
err, ice_aq_str(hw->adminq.sq_last_status));
834+
} else {
835+
vsi->info.port_based_outer_vlan =
836+
ctxt->info.port_based_outer_vlan;
837+
vsi->info.port_based_inner_vlan =
838+
ctxt->info.port_based_inner_vlan;
839+
vsi->info.outer_vlan_flags = ctxt->info.outer_vlan_flags;
840+
vsi->info.inner_vlan_flags = ctxt->info.inner_vlan_flags;
841+
vsi->info.sw_flags2 = ctxt->info.sw_flags2;
842+
}
843+
844+
kfree(ctxt);
845+
return err;
846+
}

drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@ int ice_vsi_ena_outer_insertion(struct ice_vsi *vsi, u16 tpid);
3636
int ice_vsi_dis_outer_insertion(struct ice_vsi *vsi);
3737
int ice_vsi_set_outer_port_vlan(struct ice_vsi *vsi, struct ice_vlan *vlan);
3838
int ice_vsi_clear_outer_port_vlan(struct ice_vsi *vsi);
39+
int ice_vsi_clear_port_vlan(struct ice_vsi *vsi);
3940

4041
#endif /* _ICE_VSI_VLAN_LIB_H_ */

0 commit comments

Comments
 (0)