Skip to content

Commit 91701f6

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 2023-02-06 (ice) This series contains updates to ice driver only. Ani removes WQ_MEM_RECLAIM flag from workqueue to resolve check_flush_dependency warning. Michal fixes KASAN out-of-bounds warning. Brett corrects behaviour for port VLAN Rx filters to prevent receiving of unintended traffic. Dan Carpenter fixes possible off by one issue. Zhang Changzhong adjusts error path for switch recipe to prevent memory leak. * '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue: ice: switch: fix potential memleak in ice_add_adv_recipe() ice: Fix off by one in ice_tc_forward_to_queue() ice: Fix disabling Rx VLAN filtering with port VLAN enabled ice: fix out-of-bounds KASAN warning in virtchnl ice: Do not use WQ_MEM_RECLAIM flag for workqueue ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 9b27517 + 4a606ce commit 91701f6

File tree

6 files changed

+30
-22
lines changed

6 files changed

+30
-22
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5524,7 +5524,7 @@ bool ice_fw_supports_report_dflt_cfg(struct ice_hw *hw)
55245524
* returned by the firmware is a 16 bit * value, but is indexed
55255525
* by [fls(speed) - 1]
55265526
*/
5527-
static const u32 ice_aq_to_link_speed[15] = {
5527+
static const u32 ice_aq_to_link_speed[] = {
55285528
SPEED_10, /* BIT(0) */
55295529
SPEED_100,
55305530
SPEED_1000,
@@ -5536,10 +5536,6 @@ static const u32 ice_aq_to_link_speed[15] = {
55365536
SPEED_40000,
55375537
SPEED_50000,
55385538
SPEED_100000, /* BIT(10) */
5539-
0,
5540-
0,
5541-
0,
5542-
0 /* BIT(14) */
55435539
};
55445540

55455541
/**
@@ -5550,5 +5546,8 @@ static const u32 ice_aq_to_link_speed[15] = {
55505546
*/
55515547
u32 ice_get_link_speed(u16 index)
55525548
{
5549+
if (index >= ARRAY_SIZE(ice_aq_to_link_speed))
5550+
return 0;
5551+
55535552
return ice_aq_to_link_speed[index];
55545553
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5541,7 +5541,7 @@ static int __init ice_module_init(void)
55415541
pr_info("%s\n", ice_driver_string);
55425542
pr_info("%s\n", ice_copyright);
55435543

5544-
ice_wq = alloc_workqueue("%s", WQ_MEM_RECLAIM, 0, KBUILD_MODNAME);
5544+
ice_wq = alloc_workqueue("%s", 0, 0, KBUILD_MODNAME);
55455545
if (!ice_wq) {
55465546
pr_err("Failed to create workqueue\n");
55475547
return -ENOMEM;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5420,7 +5420,7 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
54205420
*/
54215421
status = ice_add_special_words(rinfo, lkup_exts, ice_is_dvm_ena(hw));
54225422
if (status)
5423-
goto err_free_lkup_exts;
5423+
goto err_unroll;
54245424

54255425
/* Group match words into recipes using preferred recipe grouping
54265426
* criteria.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1681,7 +1681,7 @@ ice_tc_forward_to_queue(struct ice_vsi *vsi, struct ice_tc_flower_fltr *fltr,
16811681
struct ice_vsi *ch_vsi = NULL;
16821682
u16 queue = act->rx_queue;
16831683

1684-
if (queue > vsi->num_rxq) {
1684+
if (queue >= vsi->num_rxq) {
16851685
NL_SET_ERR_MSG_MOD(fltr->extack,
16861686
"Unable to add filter because specified queue is invalid");
16871687
return -EINVAL;

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

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ ice_aq_send_msg_to_vf(struct ice_hw *hw, u16 vfid, u32 v_opcode, u32 v_retval,
3939
return ice_sq_send_cmd(hw, &hw->mailboxq, &desc, msg, msglen, cd);
4040
}
4141

42-
static const u32 ice_legacy_aq_to_vc_speed[15] = {
42+
static const u32 ice_legacy_aq_to_vc_speed[] = {
4343
VIRTCHNL_LINK_SPEED_100MB, /* BIT(0) */
4444
VIRTCHNL_LINK_SPEED_100MB,
4545
VIRTCHNL_LINK_SPEED_1GB,
@@ -51,10 +51,6 @@ static const u32 ice_legacy_aq_to_vc_speed[15] = {
5151
VIRTCHNL_LINK_SPEED_40GB,
5252
VIRTCHNL_LINK_SPEED_40GB,
5353
VIRTCHNL_LINK_SPEED_40GB,
54-
VIRTCHNL_LINK_SPEED_UNKNOWN,
55-
VIRTCHNL_LINK_SPEED_UNKNOWN,
56-
VIRTCHNL_LINK_SPEED_UNKNOWN,
57-
VIRTCHNL_LINK_SPEED_UNKNOWN /* BIT(14) */
5854
};
5955

6056
/**
@@ -71,21 +67,20 @@ static const u32 ice_legacy_aq_to_vc_speed[15] = {
7167
*/
7268
u32 ice_conv_link_speed_to_virtchnl(bool adv_link_support, u16 link_speed)
7369
{
74-
u32 speed;
70+
/* convert a BIT() value into an array index */
71+
u32 index = fls(link_speed) - 1;
7572

76-
if (adv_link_support) {
77-
/* convert a BIT() value into an array index */
78-
speed = ice_get_link_speed(fls(link_speed) - 1);
79-
} else {
73+
if (adv_link_support)
74+
return ice_get_link_speed(index);
75+
else if (index < ARRAY_SIZE(ice_legacy_aq_to_vc_speed))
8076
/* Virtchnl speeds are not defined for every speed supported in
8177
* the hardware. To maintain compatibility with older AVF
8278
* drivers, while reporting the speed the new speed values are
8379
* resolved to the closest known virtchnl speeds
8480
*/
85-
speed = ice_legacy_aq_to_vc_speed[fls(link_speed) - 1];
86-
}
81+
return ice_legacy_aq_to_vc_speed[index];
8782

88-
return speed;
83+
return VIRTCHNL_LINK_SPEED_UNKNOWN;
8984
}
9085

9186
/* The mailbox overflow detection algorithm helps to check if there

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,17 @@ void ice_vf_vsi_init_vlan_ops(struct ice_vsi *vsi)
4444

4545
/* outer VLAN ops regardless of port VLAN config */
4646
vlan_ops->add_vlan = ice_vsi_add_vlan;
47-
vlan_ops->dis_rx_filtering = ice_vsi_dis_rx_vlan_filtering;
4847
vlan_ops->ena_tx_filtering = ice_vsi_ena_tx_vlan_filtering;
4948
vlan_ops->dis_tx_filtering = ice_vsi_dis_tx_vlan_filtering;
5049

5150
if (ice_vf_is_port_vlan_ena(vf)) {
5251
/* setup outer VLAN ops */
5352
vlan_ops->set_port_vlan = ice_vsi_set_outer_port_vlan;
53+
/* all Rx traffic should be in the domain of the
54+
* assigned port VLAN, so prevent disabling Rx VLAN
55+
* filtering
56+
*/
57+
vlan_ops->dis_rx_filtering = noop_vlan;
5458
vlan_ops->ena_rx_filtering =
5559
ice_vsi_ena_rx_vlan_filtering;
5660

@@ -63,6 +67,9 @@ void ice_vf_vsi_init_vlan_ops(struct ice_vsi *vsi)
6367
vlan_ops->ena_insertion = ice_vsi_ena_inner_insertion;
6468
vlan_ops->dis_insertion = ice_vsi_dis_inner_insertion;
6569
} else {
70+
vlan_ops->dis_rx_filtering =
71+
ice_vsi_dis_rx_vlan_filtering;
72+
6673
if (!test_bit(ICE_FLAG_VF_VLAN_PRUNING, pf->flags))
6774
vlan_ops->ena_rx_filtering = noop_vlan;
6875
else
@@ -96,7 +103,14 @@ void ice_vf_vsi_init_vlan_ops(struct ice_vsi *vsi)
96103
vlan_ops->set_port_vlan = ice_vsi_set_inner_port_vlan;
97104
vlan_ops->ena_rx_filtering =
98105
ice_vsi_ena_rx_vlan_filtering;
106+
/* all Rx traffic should be in the domain of the
107+
* assigned port VLAN, so prevent disabling Rx VLAN
108+
* filtering
109+
*/
110+
vlan_ops->dis_rx_filtering = noop_vlan;
99111
} else {
112+
vlan_ops->dis_rx_filtering =
113+
ice_vsi_dis_rx_vlan_filtering;
100114
if (!test_bit(ICE_FLAG_VF_VLAN_PRUNING, pf->flags))
101115
vlan_ops->ena_rx_filtering = noop_vlan;
102116
else

0 commit comments

Comments
 (0)