Skip to content

Commit

Permalink
net/netvsc: use ethdev API to set VF MTU
Browse files Browse the repository at this point in the history
The current code uses unnecessary locking to set VF MTU, resulting in
deadlock on hot add/remove path. Fix this by using rte_eth_dev_set_mtu()
to set VF MTU.

Fixes: 45c8360 ("net/netvsc: support MTU set")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Long Li <longli@microsoft.com>
Reviewed-by: Wei Hu <weh@microsoft.com>
  • Loading branch information
shemminger authored and ferruhy committed Jul 21, 2024
1 parent 82c7f5c commit ab49fdb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/netvsc/hn_vf.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ int hn_vf_add(struct rte_eth_dev *dev, struct hn_data *hv)
goto exit;
}

ret = hn_vf_mtu_set(dev, dev->data->mtu);
ret = rte_eth_dev_set_mtu(port, dev->data->mtu);
if (ret) {
PMD_DRV_LOG(ERR, "Failed to set VF MTU");
goto exit;
Expand Down Expand Up @@ -796,7 +796,7 @@ int hn_vf_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
rte_rwlock_read_lock(&hv->vf_lock);
vf_dev = hn_get_vf_dev(hv);
if (hv->vf_ctx.vf_vsc_switched && vf_dev)
ret = vf_dev->dev_ops->mtu_set(vf_dev, mtu);
ret = rte_eth_dev_set_mtu(vf_dev->data->port_id, mtu);
rte_rwlock_read_unlock(&hv->vf_lock);

return ret;
Expand Down

0 comments on commit ab49fdb

Please sign in to comment.