Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Show First 20 Lines • Show All 3,660 Lines • ▼ Show 20 Lines | mlx5e_create_ifp(struct mlx5_core_dev *mdev) | ||||
struct ifnet *ifp; | struct ifnet *ifp; | ||||
struct mlx5e_priv *priv; | struct mlx5e_priv *priv; | ||||
u8 dev_addr[ETHER_ADDR_LEN] __aligned(4); | u8 dev_addr[ETHER_ADDR_LEN] __aligned(4); | ||||
struct sysctl_oid_list *child; | struct sysctl_oid_list *child; | ||||
int ncv = mdev->priv.eq_table.num_comp_vectors; | int ncv = mdev->priv.eq_table.num_comp_vectors; | ||||
char unit[16]; | char unit[16]; | ||||
struct pfil_head_args pa; | struct pfil_head_args pa; | ||||
int err; | int err; | ||||
int i; | int i, numa_domain; | ||||
u32 eth_proto_cap; | u32 eth_proto_cap; | ||||
if (mlx5e_check_required_hca_cap(mdev)) { | if (mlx5e_check_required_hca_cap(mdev)) { | ||||
mlx5_core_dbg(mdev, "mlx5e_check_required_hca_cap() failed\n"); | mlx5_core_dbg(mdev, "mlx5e_check_required_hca_cap() failed\n"); | ||||
return (NULL); | return (NULL); | ||||
} | } | ||||
/* | /* | ||||
* Try to allocate the priv and make room for worst-case | * Try to allocate the priv and make room for worst-case | ||||
* number of channel structures: | * number of channel structures: | ||||
*/ | */ | ||||
priv = malloc(sizeof(*priv) + | priv = malloc(sizeof(*priv) + | ||||
(sizeof(priv->channel[0]) * mdev->priv.eq_table.num_comp_vectors), | (sizeof(priv->channel[0]) * mdev->priv.eq_table.num_comp_vectors), | ||||
M_MLX5EN, M_WAITOK | M_ZERO); | M_MLX5EN, M_WAITOK | M_ZERO); | ||||
mlx5e_priv_mtx_init(priv); | mlx5e_priv_mtx_init(priv); | ||||
if (bus_get_domain(mdev->pdev->dev.bsddev, &numa_domain) != 0) | |||||
ifp = priv->ifp = if_alloc(IFT_ETHER); | ifp = priv->ifp = if_alloc(IFT_ETHER); | ||||
else | |||||
ifp = priv->ifp = if_alloc_domain(IFT_ETHER, numa_domain); | |||||
if (ifp == NULL) { | if (ifp == NULL) { | ||||
mlx5_core_err(mdev, "if_alloc() failed\n"); | mlx5_core_err(mdev, "if_alloc() failed\n"); | ||||
goto err_free_priv; | goto err_free_priv; | ||||
} | } | ||||
ifp->if_softc = priv; | ifp->if_softc = priv; | ||||
if_initname(ifp, "mce", device_get_unit(mdev->pdev->dev.bsddev)); | if_initname(ifp, "mce", device_get_unit(mdev->pdev->dev.bsddev)); | ||||
ifp->if_mtu = ETHERMTU; | ifp->if_mtu = ETHERMTU; | ||||
ifp->if_init = mlx5e_open; | ifp->if_init = mlx5e_open; | ||||
▲ Show 20 Lines • Show All 365 Lines • Show Last 20 Lines |