Skip to content

Commit

Permalink
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/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/20230714201041.1717834-1-anthony.l.nguyen@intel.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Paolo Abeni committed Jul 18, 2023
2 parents 162d626 + b3e7b3a commit 0380308
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 31 deletions.
2 changes: 2 additions & 0 deletions drivers/net/ethernet/intel/ice/ice_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,8 @@ void ice_vsi_free_q_vectors(struct ice_vsi *vsi)

ice_for_each_q_vector(vsi, v_idx)
ice_free_q_vector(vsi, v_idx);

vsi->num_q_vectors = 0;
}

/**
Expand Down
13 changes: 11 additions & 2 deletions drivers/net/ethernet/intel/ice/ice_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -2681,8 +2681,13 @@ ice_get_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring,

ring->rx_max_pending = ICE_MAX_NUM_DESC;
ring->tx_max_pending = ICE_MAX_NUM_DESC;
ring->rx_pending = vsi->rx_rings[0]->count;
ring->tx_pending = vsi->tx_rings[0]->count;
if (vsi->tx_rings && vsi->rx_rings) {
ring->rx_pending = vsi->rx_rings[0]->count;
ring->tx_pending = vsi->tx_rings[0]->count;
} else {
ring->rx_pending = 0;
ring->tx_pending = 0;
}

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

/* Return if there is no rings (device is reloading) */
if (!vsi->tx_rings || !vsi->rx_rings)
return -EBUSY;

new_tx_cnt = ALIGN(ring->tx_pending, ICE_REQ_DESC_MULTIPLE);
if (new_tx_cnt != ring->tx_pending)
netdev_info(netdev, "Requested Tx descriptor count rounded up to %d\n",
Expand Down
27 changes: 0 additions & 27 deletions drivers/net/ethernet/intel/ice/ice_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2972,39 +2972,12 @@ int ice_vsi_release(struct ice_vsi *vsi)
return -ENODEV;
pf = vsi->back;

/* do not unregister while driver is in the reset recovery pending
* state. Since reset/rebuild happens through PF service task workqueue,
* it's not a good idea to unregister netdev that is associated to the
* PF that is running the work queue items currently. This is done to
* avoid check_flush_dependency() warning on this wq
*/
if (vsi->netdev && !ice_is_reset_in_progress(pf->state) &&
(test_bit(ICE_VSI_NETDEV_REGISTERED, vsi->state))) {
unregister_netdev(vsi->netdev);
clear_bit(ICE_VSI_NETDEV_REGISTERED, vsi->state);
}

if (vsi->type == ICE_VSI_PF)
ice_devlink_destroy_pf_port(pf);

if (test_bit(ICE_FLAG_RSS_ENA, pf->flags))
ice_rss_clean(vsi);

ice_vsi_close(vsi);
ice_vsi_decfg(vsi);

if (vsi->netdev) {
if (test_bit(ICE_VSI_NETDEV_REGISTERED, vsi->state)) {
unregister_netdev(vsi->netdev);
clear_bit(ICE_VSI_NETDEV_REGISTERED, vsi->state);
}
if (test_bit(ICE_VSI_NETDEV_ALLOCD, vsi->state)) {
free_netdev(vsi->netdev);
vsi->netdev = NULL;
clear_bit(ICE_VSI_NETDEV_ALLOCD, vsi->state);
}
}

/* retain SW VSI data structure since it is needed to unregister and
* free VSI netdev when PF is not in reset recovery pending state,\
* for ex: during rmmod.
Expand Down
10 changes: 8 additions & 2 deletions drivers/net/ethernet/intel/ice/ice_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4430,9 +4430,9 @@ static int ice_start_eth(struct ice_vsi *vsi)
if (err)
return err;

rtnl_lock();
err = ice_vsi_open(vsi);
rtnl_unlock();
if (err)
ice_fltr_remove_all(vsi);

return err;
}
Expand Down Expand Up @@ -4895,13 +4895,15 @@ int ice_load(struct ice_pf *pf)
params = ice_vsi_to_params(vsi);
params.flags = ICE_VSI_FLAG_INIT;

rtnl_lock();
err = ice_vsi_cfg(vsi, &params);
if (err)
goto err_vsi_cfg;

err = ice_start_eth(ice_get_main_vsi(pf));
if (err)
goto err_start_eth;
rtnl_unlock();

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

err_init_rdma:
ice_vsi_close(ice_get_main_vsi(pf));
rtnl_lock();
err_start_eth:
ice_vsi_decfg(ice_get_main_vsi(pf));
err_vsi_cfg:
rtnl_unlock();
ice_deinit_dev(pf);
return err;
}
Expand All @@ -4931,8 +4935,10 @@ void ice_unload(struct ice_pf *pf)
{
ice_deinit_features(pf);
ice_deinit_rdma(pf);
rtnl_lock();
ice_stop_eth(ice_get_main_vsi(pf));
ice_vsi_decfg(ice_get_main_vsi(pf));
rtnl_unlock();
ice_deinit_dev(pf);
}

Expand Down

0 comments on commit 0380308

Please sign in to comment.