Skip to content

Commit 0380308

Browse files
author
Paolo Abeni
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-07-14 (ice) This series contains updates to ice driver only. Petr Oros removes multiple calls made to unregister netdev and devlink_port. Michal fixes null pointer dereference that can occur during reload. ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2 parents 162d626 + b3e7b3a commit 0380308

File tree

4 files changed

+21
-31
lines changed

4 files changed

+21
-31
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,8 @@ void ice_vsi_free_q_vectors(struct ice_vsi *vsi)
800800

801801
ice_for_each_q_vector(vsi, v_idx)
802802
ice_free_q_vector(vsi, v_idx);
803+
804+
vsi->num_q_vectors = 0;
803805
}
804806

805807
/**

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2681,8 +2681,13 @@ ice_get_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring,
26812681

26822682
ring->rx_max_pending = ICE_MAX_NUM_DESC;
26832683
ring->tx_max_pending = ICE_MAX_NUM_DESC;
2684-
ring->rx_pending = vsi->rx_rings[0]->count;
2685-
ring->tx_pending = vsi->tx_rings[0]->count;
2684+
if (vsi->tx_rings && vsi->rx_rings) {
2685+
ring->rx_pending = vsi->rx_rings[0]->count;
2686+
ring->tx_pending = vsi->tx_rings[0]->count;
2687+
} else {
2688+
ring->rx_pending = 0;
2689+
ring->tx_pending = 0;
2690+
}
26862691

26872692
/* Rx mini and jumbo rings are not supported */
26882693
ring->rx_mini_max_pending = 0;
@@ -2716,6 +2721,10 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring,
27162721
return -EINVAL;
27172722
}
27182723

2724+
/* Return if there is no rings (device is reloading) */
2725+
if (!vsi->tx_rings || !vsi->rx_rings)
2726+
return -EBUSY;
2727+
27192728
new_tx_cnt = ALIGN(ring->tx_pending, ICE_REQ_DESC_MULTIPLE);
27202729
if (new_tx_cnt != ring->tx_pending)
27212730
netdev_info(netdev, "Requested Tx descriptor count rounded up to %d\n",

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

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2972,39 +2972,12 @@ int ice_vsi_release(struct ice_vsi *vsi)
29722972
return -ENODEV;
29732973
pf = vsi->back;
29742974

2975-
/* do not unregister while driver is in the reset recovery pending
2976-
* state. Since reset/rebuild happens through PF service task workqueue,
2977-
* it's not a good idea to unregister netdev that is associated to the
2978-
* PF that is running the work queue items currently. This is done to
2979-
* avoid check_flush_dependency() warning on this wq
2980-
*/
2981-
if (vsi->netdev && !ice_is_reset_in_progress(pf->state) &&
2982-
(test_bit(ICE_VSI_NETDEV_REGISTERED, vsi->state))) {
2983-
unregister_netdev(vsi->netdev);
2984-
clear_bit(ICE_VSI_NETDEV_REGISTERED, vsi->state);
2985-
}
2986-
2987-
if (vsi->type == ICE_VSI_PF)
2988-
ice_devlink_destroy_pf_port(pf);
2989-
29902975
if (test_bit(ICE_FLAG_RSS_ENA, pf->flags))
29912976
ice_rss_clean(vsi);
29922977

29932978
ice_vsi_close(vsi);
29942979
ice_vsi_decfg(vsi);
29952980

2996-
if (vsi->netdev) {
2997-
if (test_bit(ICE_VSI_NETDEV_REGISTERED, vsi->state)) {
2998-
unregister_netdev(vsi->netdev);
2999-
clear_bit(ICE_VSI_NETDEV_REGISTERED, vsi->state);
3000-
}
3001-
if (test_bit(ICE_VSI_NETDEV_ALLOCD, vsi->state)) {
3002-
free_netdev(vsi->netdev);
3003-
vsi->netdev = NULL;
3004-
clear_bit(ICE_VSI_NETDEV_ALLOCD, vsi->state);
3005-
}
3006-
}
3007-
30082981
/* retain SW VSI data structure since it is needed to unregister and
30092982
* free VSI netdev when PF is not in reset recovery pending state,\
30102983
* for ex: during rmmod.

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4430,9 +4430,9 @@ static int ice_start_eth(struct ice_vsi *vsi)
44304430
if (err)
44314431
return err;
44324432

4433-
rtnl_lock();
44344433
err = ice_vsi_open(vsi);
4435-
rtnl_unlock();
4434+
if (err)
4435+
ice_fltr_remove_all(vsi);
44364436

44374437
return err;
44384438
}
@@ -4895,13 +4895,15 @@ int ice_load(struct ice_pf *pf)
48954895
params = ice_vsi_to_params(vsi);
48964896
params.flags = ICE_VSI_FLAG_INIT;
48974897

4898+
rtnl_lock();
48984899
err = ice_vsi_cfg(vsi, &params);
48994900
if (err)
49004901
goto err_vsi_cfg;
49014902

49024903
err = ice_start_eth(ice_get_main_vsi(pf));
49034904
if (err)
49044905
goto err_start_eth;
4906+
rtnl_unlock();
49054907

49064908
err = ice_init_rdma(pf);
49074909
if (err)
@@ -4916,9 +4918,11 @@ int ice_load(struct ice_pf *pf)
49164918

49174919
err_init_rdma:
49184920
ice_vsi_close(ice_get_main_vsi(pf));
4921+
rtnl_lock();
49194922
err_start_eth:
49204923
ice_vsi_decfg(ice_get_main_vsi(pf));
49214924
err_vsi_cfg:
4925+
rtnl_unlock();
49224926
ice_deinit_dev(pf);
49234927
return err;
49244928
}
@@ -4931,8 +4935,10 @@ void ice_unload(struct ice_pf *pf)
49314935
{
49324936
ice_deinit_features(pf);
49334937
ice_deinit_rdma(pf);
4938+
rtnl_lock();
49344939
ice_stop_eth(ice_get_main_vsi(pf));
49354940
ice_vsi_decfg(ice_get_main_vsi(pf));
4941+
rtnl_unlock();
49364942
ice_deinit_dev(pf);
49374943
}
49384944

0 commit comments

Comments
 (0)