Skip to content

Commit 26a2beb

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-11-04 (ice, idpf, i40e, e1000e) For ice: Marcin adjusts ordering of calls in ice_eswitch_detach() to resolve a use after free issue. Mateusz corrects variable type for Flow Director queue to fix issues related to drop actions. For idpf: Pavan resolves issues related to reset on idpf; avoiding use of freed vport and correctly unrolling the mailbox task. For i40e: Aleksandr fixes a race condition involving addition and deletion of VF MAC filters. For e1000e: Vitaly reverts workaround for Meteor Lake causing regressions in power management flows. * '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue: e1000e: Remove Meteor Lake SMBUS workarounds i40e: fix race condition by adding filter's intermediate sync state idpf: fix idpf_vc_core_init error path idpf: avoid vport access in idpf_get_link_ksettings ice: change q_index variable type to s16 to store -1 value ice: Fix use after free during unload with ports in bridge ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 3f2f406 + b847372 commit 26a2beb

File tree

11 files changed

+32
-32
lines changed

11 files changed

+32
-32
lines changed

drivers/net/ethernet/intel/e1000e/ich8lan.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,12 +1205,10 @@ s32 e1000_enable_ulp_lpt_lp(struct e1000_hw *hw, bool to_sx)
12051205
if (ret_val)
12061206
goto out;
12071207

1208-
if (hw->mac.type != e1000_pch_mtp) {
1209-
ret_val = e1000e_force_smbus(hw);
1210-
if (ret_val) {
1211-
e_dbg("Failed to force SMBUS: %d\n", ret_val);
1212-
goto release;
1213-
}
1208+
ret_val = e1000e_force_smbus(hw);
1209+
if (ret_val) {
1210+
e_dbg("Failed to force SMBUS: %d\n", ret_val);
1211+
goto release;
12141212
}
12151213

12161214
/* Si workaround for ULP entry flow on i127/rev6 h/w. Enable
@@ -1273,13 +1271,6 @@ s32 e1000_enable_ulp_lpt_lp(struct e1000_hw *hw, bool to_sx)
12731271
}
12741272

12751273
release:
1276-
if (hw->mac.type == e1000_pch_mtp) {
1277-
ret_val = e1000e_force_smbus(hw);
1278-
if (ret_val)
1279-
e_dbg("Failed to force SMBUS over MTL system: %d\n",
1280-
ret_val);
1281-
}
1282-
12831274
hw->phy.ops.release(hw);
12841275
out:
12851276
if (ret_val)

drivers/net/ethernet/intel/i40e/i40e.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,7 @@ enum i40e_filter_state {
755755
I40E_FILTER_ACTIVE, /* Added to switch by FW */
756756
I40E_FILTER_FAILED, /* Rejected by FW */
757757
I40E_FILTER_REMOVE, /* To be removed */
758+
I40E_FILTER_NEW_SYNC, /* New, not sent yet, is in i40e_sync_vsi_filters() */
758759
/* There is no 'removed' state; the filter struct is freed */
759760
};
760761
struct i40e_mac_filter {

drivers/net/ethernet/intel/i40e/i40e_debugfs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ static char *i40e_filter_state_string[] = {
8989
"ACTIVE",
9090
"FAILED",
9191
"REMOVE",
92+
"NEW_SYNC",
9293
};
9394

9495
/**

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,6 +1255,7 @@ int i40e_count_filters(struct i40e_vsi *vsi)
12551255

12561256
hash_for_each_safe(vsi->mac_filter_hash, bkt, h, f, hlist) {
12571257
if (f->state == I40E_FILTER_NEW ||
1258+
f->state == I40E_FILTER_NEW_SYNC ||
12581259
f->state == I40E_FILTER_ACTIVE)
12591260
++cnt;
12601261
}
@@ -1441,6 +1442,8 @@ static int i40e_correct_mac_vlan_filters(struct i40e_vsi *vsi,
14411442

14421443
new->f = add_head;
14431444
new->state = add_head->state;
1445+
if (add_head->state == I40E_FILTER_NEW)
1446+
add_head->state = I40E_FILTER_NEW_SYNC;
14441447

14451448
/* Add the new filter to the tmp list */
14461449
hlist_add_head(&new->hlist, tmp_add_list);
@@ -1550,6 +1553,8 @@ static int i40e_correct_vf_mac_vlan_filters(struct i40e_vsi *vsi,
15501553
return -ENOMEM;
15511554
new_mac->f = add_head;
15521555
new_mac->state = add_head->state;
1556+
if (add_head->state == I40E_FILTER_NEW)
1557+
add_head->state = I40E_FILTER_NEW_SYNC;
15531558

15541559
/* Add the new filter to the tmp list */
15551560
hlist_add_head(&new_mac->hlist, tmp_add_list);
@@ -2437,7 +2442,8 @@ static int
24372442
i40e_aqc_broadcast_filter(struct i40e_vsi *vsi, const char *vsi_name,
24382443
struct i40e_mac_filter *f)
24392444
{
2440-
bool enable = f->state == I40E_FILTER_NEW;
2445+
bool enable = f->state == I40E_FILTER_NEW ||
2446+
f->state == I40E_FILTER_NEW_SYNC;
24412447
struct i40e_hw *hw = &vsi->back->hw;
24422448
int aq_ret;
24432449

@@ -2611,6 +2617,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
26112617

26122618
/* Add it to the hash list */
26132619
hlist_add_head(&new->hlist, &tmp_add_list);
2620+
f->state = I40E_FILTER_NEW_SYNC;
26142621
}
26152622

26162623
/* Count the number of active (current and new) VLAN
@@ -2762,7 +2769,8 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
27622769
spin_lock_bh(&vsi->mac_filter_hash_lock);
27632770
hlist_for_each_entry_safe(new, h, &tmp_add_list, hlist) {
27642771
/* Only update the state if we're still NEW */
2765-
if (new->f->state == I40E_FILTER_NEW)
2772+
if (new->f->state == I40E_FILTER_NEW ||
2773+
new->f->state == I40E_FILTER_NEW_SYNC)
27662774
new->f->state = new->state;
27672775
hlist_del(&new->hlist);
27682776
netdev_hw_addr_refcnt(new->f, vsi->netdev, -1);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,13 +552,14 @@ int ice_eswitch_attach_sf(struct ice_pf *pf, struct ice_dynamic_port *sf)
552552
static void ice_eswitch_detach(struct ice_pf *pf, struct ice_repr *repr)
553553
{
554554
ice_eswitch_stop_reprs(pf);
555+
repr->ops.rem(repr);
556+
555557
xa_erase(&pf->eswitch.reprs, repr->id);
556558

557559
if (xa_empty(&pf->eswitch.reprs))
558560
ice_eswitch_disable_switchdev(pf);
559561

560562
ice_eswitch_release_repr(pf, repr);
561-
repr->ops.rem(repr);
562563
ice_repr_destroy(repr);
563564

564565
if (xa_empty(&pf->eswitch.reprs)) {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1830,11 +1830,12 @@ static int
18301830
ice_set_fdir_input_set(struct ice_vsi *vsi, struct ethtool_rx_flow_spec *fsp,
18311831
struct ice_fdir_fltr *input)
18321832
{
1833-
u16 dest_vsi, q_index = 0;
1833+
s16 q_index = ICE_FDIR_NO_QUEUE_IDX;
18341834
u16 orig_q_index = 0;
18351835
struct ice_pf *pf;
18361836
struct ice_hw *hw;
18371837
int flow_type;
1838+
u16 dest_vsi;
18381839
u8 dest_ctl;
18391840

18401841
if (!vsi || !fsp || !input)

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
*/
5454
#define ICE_FDIR_IPV4_PKT_FLAG_MF 0x20
5555

56+
#define ICE_FDIR_NO_QUEUE_IDX -1
57+
5658
enum ice_fltr_prgm_desc_dest {
5759
ICE_FLTR_PRGM_DESC_DEST_DROP_PKT,
5860
ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QINDEX,
@@ -186,7 +188,7 @@ struct ice_fdir_fltr {
186188
u16 flex_fltr;
187189

188190
/* filter control */
189-
u16 q_index;
191+
s16 q_index;
190192
u16 orig_q_index;
191193
u16 dest_vsi;
192194
u8 dest_ctl;

drivers/net/ethernet/intel/idpf/idpf.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ enum idpf_vport_state {
141141
* @adapter: Adapter back pointer
142142
* @vport: Vport back pointer
143143
* @vport_id: Vport identifier
144+
* @link_speed_mbps: Link speed in mbps
144145
* @vport_idx: Relative vport index
145146
* @state: See enum idpf_vport_state
146147
* @netstats: Packet and byte stats
@@ -150,6 +151,7 @@ struct idpf_netdev_priv {
150151
struct idpf_adapter *adapter;
151152
struct idpf_vport *vport;
152153
u32 vport_id;
154+
u32 link_speed_mbps;
153155
u16 vport_idx;
154156
enum idpf_vport_state state;
155157
struct rtnl_link_stats64 netstats;
@@ -287,7 +289,6 @@ struct idpf_port_stats {
287289
* @tx_itr_profile: TX profiles for Dynamic Interrupt Moderation
288290
* @port_stats: per port csum, header split, and other offload stats
289291
* @link_up: True if link is up
290-
* @link_speed_mbps: Link speed in mbps
291292
* @sw_marker_wq: workqueue for marker packets
292293
*/
293294
struct idpf_vport {
@@ -331,7 +332,6 @@ struct idpf_vport {
331332
struct idpf_port_stats port_stats;
332333

333334
bool link_up;
334-
u32 link_speed_mbps;
335335

336336
wait_queue_head_t sw_marker_wq;
337337
};

drivers/net/ethernet/intel/idpf/idpf_ethtool.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,24 +1296,19 @@ static void idpf_set_msglevel(struct net_device *netdev, u32 data)
12961296
static int idpf_get_link_ksettings(struct net_device *netdev,
12971297
struct ethtool_link_ksettings *cmd)
12981298
{
1299-
struct idpf_vport *vport;
1300-
1301-
idpf_vport_ctrl_lock(netdev);
1302-
vport = idpf_netdev_to_vport(netdev);
1299+
struct idpf_netdev_priv *np = netdev_priv(netdev);
13031300

13041301
ethtool_link_ksettings_zero_link_mode(cmd, supported);
13051302
cmd->base.autoneg = AUTONEG_DISABLE;
13061303
cmd->base.port = PORT_NONE;
1307-
if (vport->link_up) {
1304+
if (netif_carrier_ok(netdev)) {
13081305
cmd->base.duplex = DUPLEX_FULL;
1309-
cmd->base.speed = vport->link_speed_mbps;
1306+
cmd->base.speed = np->link_speed_mbps;
13101307
} else {
13111308
cmd->base.duplex = DUPLEX_UNKNOWN;
13121309
cmd->base.speed = SPEED_UNKNOWN;
13131310
}
13141311

1315-
idpf_vport_ctrl_unlock(netdev);
1316-
13171312
return 0;
13181313
}
13191314

drivers/net/ethernet/intel/idpf/idpf_lib.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,6 +1786,7 @@ static int idpf_init_hard_reset(struct idpf_adapter *adapter)
17861786
*/
17871787
err = idpf_vc_core_init(adapter);
17881788
if (err) {
1789+
cancel_delayed_work_sync(&adapter->mbx_task);
17891790
idpf_deinit_dflt_mbx(adapter);
17901791
goto unlock_mutex;
17911792
}
@@ -1860,7 +1861,7 @@ int idpf_initiate_soft_reset(struct idpf_vport *vport,
18601861
* mess with. Nothing below should use those variables from new_vport
18611862
* and should instead always refer to them in vport if they need to.
18621863
*/
1863-
memcpy(new_vport, vport, offsetof(struct idpf_vport, link_speed_mbps));
1864+
memcpy(new_vport, vport, offsetof(struct idpf_vport, link_up));
18641865

18651866
/* Adjust resource parameters prior to reallocating resources */
18661867
switch (reset_cause) {
@@ -1906,7 +1907,7 @@ int idpf_initiate_soft_reset(struct idpf_vport *vport,
19061907
/* Same comment as above regarding avoiding copying the wait_queues and
19071908
* mutexes applies here. We do not want to mess with those if possible.
19081909
*/
1909-
memcpy(vport, new_vport, offsetof(struct idpf_vport, link_speed_mbps));
1910+
memcpy(vport, new_vport, offsetof(struct idpf_vport, link_up));
19101911

19111912
if (reset_cause == IDPF_SR_Q_CHANGE)
19121913
idpf_vport_alloc_vec_indexes(vport);

0 commit comments

Comments
 (0)