mlx5: Enter network epoch when using if_foreach()

Summary: IFNET_RLOCK() is not sufficient, the epoch needs entered.

Reviewed by:	hselasky
Sponsored by:	Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38711
This commit is contained in:
Justin Hibbits 2023-02-21 14:43:53 -05:00
parent 6a6f2b0ce9
commit 70510800d1

View file

@ -3150,18 +3150,19 @@ mlx5_enable_roce_if_cb(if_t ifp, void *arg)
static int mlx5_enable_roce(struct mlx5_ib_dev *dev)
{
struct epoch_tracker et;
VNET_ITERATOR_DECL(vnet_iter);
int err;
/* Check if mlx5en net device already exists */
VNET_LIST_RLOCK();
NET_EPOCH_ENTER(et);
VNET_FOREACH(vnet_iter) {
IFNET_RLOCK();
CURVNET_SET_QUIET(vnet_iter);
if_foreach(mlx5_enable_roce_if_cb, dev);
CURVNET_RESTORE();
IFNET_RUNLOCK();
}
NET_EPOCH_EXIT(et);
VNET_LIST_RUNLOCK();
dev->roce.nb.notifier_call = mlx5_netdev_event;