mlx5: Numa domain improvements.
Properly allocate all mlx5en(4) structures from correct numa domain. While at it cleanup unused numa domain integers deriving from the Linux version of mlx5en(4). MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking
This commit is contained in:
parent
cbf6911e10
commit
7c3eff94bd
@ -985,8 +985,6 @@ void mlx5_drain_health_recovery(struct mlx5_core_dev *dev);
|
||||
void mlx5_trigger_health_work(struct mlx5_core_dev *dev);
|
||||
void mlx5_trigger_health_watchdog(struct mlx5_core_dev *dev);
|
||||
|
||||
#define mlx5_buf_alloc_node(dev, size, direct, buf, node) \
|
||||
mlx5_buf_alloc(dev, size, direct, buf)
|
||||
int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, int max_direct,
|
||||
struct mlx5_buf *buf);
|
||||
void mlx5_buf_free(struct mlx5_core_dev *dev, struct mlx5_buf *buf);
|
||||
@ -1072,10 +1070,14 @@ void mlx5_eq_debugfs_cleanup(struct mlx5_core_dev *dev);
|
||||
int mlx5_cq_debugfs_init(struct mlx5_core_dev *dev);
|
||||
void mlx5_cq_debugfs_cleanup(struct mlx5_core_dev *dev);
|
||||
int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db);
|
||||
int mlx5_db_alloc_node(struct mlx5_core_dev *dev, struct mlx5_db *db,
|
||||
int node);
|
||||
void mlx5_db_free(struct mlx5_core_dev *dev, struct mlx5_db *db);
|
||||
|
||||
static inline struct domainset *
|
||||
mlx5_dev_domainset(struct mlx5_core_dev *mdev)
|
||||
{
|
||||
return (linux_get_vm_domain_set(mdev->priv.numa_node));
|
||||
}
|
||||
|
||||
const char *mlx5_command_str(int command);
|
||||
int mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev);
|
||||
void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev);
|
||||
|
@ -147,8 +147,7 @@ void mlx5_buf_free(struct mlx5_core_dev *dev, struct mlx5_buf *buf)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mlx5_buf_free);
|
||||
|
||||
static struct mlx5_db_pgdir *mlx5_alloc_db_pgdir(struct mlx5_core_dev *dev,
|
||||
int node)
|
||||
static struct mlx5_db_pgdir *mlx5_alloc_db_pgdir(struct mlx5_core_dev *dev)
|
||||
{
|
||||
struct mlx5_db_pgdir *pgdir;
|
||||
|
||||
@ -199,7 +198,7 @@ static int mlx5_alloc_db_from_pgdir(struct mlx5_db_pgdir *pgdir,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mlx5_db_alloc_node(struct mlx5_core_dev *dev, struct mlx5_db *db, int node)
|
||||
int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db)
|
||||
{
|
||||
struct mlx5_db_pgdir *pgdir;
|
||||
int ret = 0;
|
||||
@ -210,7 +209,7 @@ int mlx5_db_alloc_node(struct mlx5_core_dev *dev, struct mlx5_db *db, int node)
|
||||
if (!mlx5_alloc_db_from_pgdir(pgdir, db))
|
||||
goto out;
|
||||
|
||||
pgdir = mlx5_alloc_db_pgdir(dev, node);
|
||||
pgdir = mlx5_alloc_db_pgdir(dev);
|
||||
if (!pgdir) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
@ -226,12 +225,6 @@ out:
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mlx5_db_alloc_node);
|
||||
|
||||
int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db)
|
||||
{
|
||||
return mlx5_db_alloc_node(dev, db, dev->priv.numa_node);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mlx5_db_alloc);
|
||||
|
||||
void mlx5_db_free(struct mlx5_core_dev *dev, struct mlx5_db *db)
|
||||
|
@ -82,8 +82,6 @@ SYSCTL_INT(_hw_mlx5, OID_AUTO, fast_unload_enabled, CTLFLAG_RWTUN,
|
||||
&mlx5_fast_unload_enabled, 0,
|
||||
"Set to enable fast unload. Clear to disable.");
|
||||
|
||||
#define NUMA_NO_NODE -1
|
||||
|
||||
static LIST_HEAD(intf_list);
|
||||
static LIST_HEAD(dev_list);
|
||||
static DEFINE_MUTEX(intf_mutex);
|
||||
@ -653,7 +651,7 @@ static int alloc_comp_eqs(struct mlx5_core_dev *dev)
|
||||
ncomp_vec = table->num_comp_vectors;
|
||||
nent = MLX5_COMP_EQ_SIZE;
|
||||
for (i = 0; i < ncomp_vec; i++) {
|
||||
eq = kzalloc(sizeof(*eq), GFP_KERNEL);
|
||||
eq = kzalloc_node(sizeof(*eq), GFP_KERNEL, dev->priv.numa_node);
|
||||
|
||||
err = mlx5_create_map_eq(dev, eq,
|
||||
i + MLX5_EQ_VEC_COMP_BASE, nent, 0);
|
||||
@ -715,7 +713,7 @@ static void mlx5_add_device(struct mlx5_interface *intf, struct mlx5_priv *priv)
|
||||
struct mlx5_device_context *dev_ctx;
|
||||
struct mlx5_core_dev *dev = container_of(priv, struct mlx5_core_dev, priv);
|
||||
|
||||
dev_ctx = kzalloc(sizeof(*dev_ctx), GFP_KERNEL);
|
||||
dev_ctx = kzalloc_node(sizeof(*dev_ctx), GFP_KERNEL, priv->numa_node);
|
||||
if (!dev_ctx)
|
||||
return;
|
||||
|
||||
@ -869,8 +867,6 @@ static int mlx5_pci_init(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
|
||||
INIT_LIST_HEAD(&priv->pgdir_list);
|
||||
spin_lock_init(&priv->mkey_lock);
|
||||
|
||||
priv->numa_node = NUMA_NO_NODE;
|
||||
|
||||
err = mlx5_pci_enable_device(dev);
|
||||
if (err) {
|
||||
mlx5_core_err(dev, "Cannot enable PCI device, aborting\n");
|
||||
@ -1314,14 +1310,20 @@ static int init_one(struct pci_dev *pdev,
|
||||
int num_vfs, sriov_pos;
|
||||
#endif
|
||||
int i,err;
|
||||
int numa_node;
|
||||
struct sysctl_oid *pme_sysctl_node;
|
||||
struct sysctl_oid *pme_err_sysctl_node;
|
||||
struct sysctl_oid *cap_sysctl_node;
|
||||
struct sysctl_oid *current_cap_sysctl_node;
|
||||
struct sysctl_oid *max_cap_sysctl_node;
|
||||
|
||||
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
||||
numa_node = dev_to_node(&pdev->dev);
|
||||
|
||||
dev = kzalloc_node(sizeof(*dev), GFP_KERNEL, numa_node);
|
||||
|
||||
priv = &dev->priv;
|
||||
priv->numa_node = numa_node;
|
||||
|
||||
if (id)
|
||||
priv->pci_dev_data = id->driver_data;
|
||||
|
||||
|
@ -69,15 +69,14 @@ int mlx5_wq_cyc_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param,
|
||||
wq->log_stride = MLX5_GET(wq, wqc, log_wq_stride);
|
||||
wq->sz_m1 = (1 << MLX5_GET(wq, wqc, log_wq_sz)) - 1;
|
||||
|
||||
err = mlx5_db_alloc_node(mdev, &wq_ctrl->db, param->db_numa_node);
|
||||
err = mlx5_db_alloc(mdev, &wq_ctrl->db);
|
||||
if (err) {
|
||||
mlx5_core_warn(mdev, "mlx5_db_alloc() failed, %d\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = mlx5_buf_alloc_node(mdev, mlx5_wq_cyc_get_byte_size(wq),
|
||||
max_direct, &wq_ctrl->buf,
|
||||
param->buf_numa_node);
|
||||
err = mlx5_buf_alloc(mdev, mlx5_wq_cyc_get_byte_size(wq),
|
||||
max_direct, &wq_ctrl->buf);
|
||||
if (err) {
|
||||
mlx5_core_warn(mdev, "mlx5_buf_alloc() failed, %d\n", err);
|
||||
goto err_db_free;
|
||||
@ -107,15 +106,14 @@ int mlx5_cqwq_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param,
|
||||
wq->log_sz = MLX5_GET(cqc, cqc, log_cq_size);
|
||||
wq->sz_m1 = (1 << wq->log_sz) - 1;
|
||||
|
||||
err = mlx5_db_alloc_node(mdev, &wq_ctrl->db, param->db_numa_node);
|
||||
err = mlx5_db_alloc(mdev, &wq_ctrl->db);
|
||||
if (err) {
|
||||
mlx5_core_warn(mdev, "mlx5_db_alloc() failed, %d\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = mlx5_buf_alloc_node(mdev, mlx5_cqwq_get_byte_size(wq),
|
||||
max_direct, &wq_ctrl->buf,
|
||||
param->buf_numa_node);
|
||||
err = mlx5_buf_alloc(mdev, mlx5_cqwq_get_byte_size(wq),
|
||||
max_direct, &wq_ctrl->buf);
|
||||
if (err) {
|
||||
mlx5_core_warn(mdev, "mlx5_buf_alloc() failed, %d\n", err);
|
||||
goto err_db_free;
|
||||
@ -146,15 +144,14 @@ int mlx5_wq_ll_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param,
|
||||
wq->log_stride = MLX5_GET(wq, wqc, log_wq_stride);
|
||||
wq->sz_m1 = (1 << MLX5_GET(wq, wqc, log_wq_sz)) - 1;
|
||||
|
||||
err = mlx5_db_alloc_node(mdev, &wq_ctrl->db, param->db_numa_node);
|
||||
err = mlx5_db_alloc(mdev, &wq_ctrl->db);
|
||||
if (err) {
|
||||
mlx5_core_warn(mdev, "mlx5_db_alloc() failed, %d\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = mlx5_buf_alloc_node(mdev, mlx5_wq_ll_get_byte_size(wq),
|
||||
max_direct, &wq_ctrl->buf,
|
||||
param->buf_numa_node);
|
||||
err = mlx5_buf_alloc(mdev, mlx5_wq_ll_get_byte_size(wq),
|
||||
max_direct, &wq_ctrl->buf);
|
||||
if (err) {
|
||||
mlx5_core_warn(mdev, "mlx5_buf_alloc() failed, %d\n", err);
|
||||
goto err_db_free;
|
||||
|
@ -32,8 +32,6 @@
|
||||
|
||||
struct mlx5_wq_param {
|
||||
int linear;
|
||||
int buf_numa_node;
|
||||
int db_numa_node;
|
||||
};
|
||||
|
||||
struct mlx5_wq_ctrl {
|
||||
|
@ -1261,7 +1261,8 @@ mlx5e_create_rq(struct mlx5e_channel *c,
|
||||
if (err)
|
||||
goto err_rq_wq_destroy;
|
||||
|
||||
rq->mbuf = malloc(wq_sz * sizeof(rq->mbuf[0]), M_MLX5EN, M_WAITOK | M_ZERO);
|
||||
rq->mbuf = malloc_domainset(wq_sz * sizeof(rq->mbuf[0]), M_MLX5EN,
|
||||
mlx5_dev_domainset(mdev), M_WAITOK | M_ZERO);
|
||||
for (i = 0; i != wq_sz; i++) {
|
||||
struct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(&rq->wq, i);
|
||||
int j;
|
||||
@ -1525,7 +1526,8 @@ mlx5e_alloc_sq_db(struct mlx5e_sq *sq)
|
||||
int err;
|
||||
int x;
|
||||
|
||||
sq->mbuf = malloc(wq_sz * sizeof(sq->mbuf[0]), M_MLX5EN, M_WAITOK | M_ZERO);
|
||||
sq->mbuf = malloc_domainset(wq_sz * sizeof(sq->mbuf[0]), M_MLX5EN,
|
||||
mlx5_dev_domainset(sq->priv->mdev), M_WAITOK | M_ZERO);
|
||||
|
||||
/* Create DMA descriptor MAPs */
|
||||
for (x = 0; x != wq_sz; x++) {
|
||||
@ -1619,6 +1621,11 @@ mlx5e_create_sq(struct mlx5e_channel *c,
|
||||
&sq->dma_tag)))
|
||||
goto done;
|
||||
|
||||
sq->mkey_be = cpu_to_be32(priv->mr.key);
|
||||
sq->ifp = priv->ifp;
|
||||
sq->priv = priv;
|
||||
sq->tc = tc;
|
||||
|
||||
err = mlx5_wq_cyc_create(mdev, ¶m->wq, sqc_wq, &sq->wq,
|
||||
&sq->wq_ctrl);
|
||||
if (err)
|
||||
@ -1630,11 +1637,6 @@ mlx5e_create_sq(struct mlx5e_channel *c,
|
||||
if (err)
|
||||
goto err_sq_wq_destroy;
|
||||
|
||||
sq->mkey_be = cpu_to_be32(priv->mr.key);
|
||||
sq->ifp = priv->ifp;
|
||||
sq->priv = priv;
|
||||
sq->tc = tc;
|
||||
|
||||
mlx5e_update_sq_inline(sq);
|
||||
|
||||
snprintf(buffer, sizeof(buffer), "txstat%dtc%d", c->ix, tc);
|
||||
@ -1927,9 +1929,6 @@ mlx5e_create_cq(struct mlx5e_priv *priv,
|
||||
int err;
|
||||
u32 i;
|
||||
|
||||
param->wq.buf_numa_node = 0;
|
||||
param->wq.db_numa_node = 0;
|
||||
|
||||
err = mlx5_vector2eqn(mdev, eq_ix, &eqn_not_used, &irqn);
|
||||
if (err)
|
||||
return (err);
|
||||
@ -2292,8 +2291,6 @@ mlx5e_build_rq_param(struct mlx5e_priv *priv,
|
||||
MLX5_SET(wq, wq, log_wq_sz, priv->params.log_rq_size);
|
||||
MLX5_SET(wq, wq, pd, priv->pdn);
|
||||
|
||||
param->wq.buf_numa_node = 0;
|
||||
param->wq.db_numa_node = 0;
|
||||
param->wq.linear = 1;
|
||||
}
|
||||
|
||||
@ -2308,8 +2305,6 @@ mlx5e_build_sq_param(struct mlx5e_priv *priv,
|
||||
MLX5_SET(wq, wq, log_wq_stride, ilog2(MLX5_SEND_WQE_BB));
|
||||
MLX5_SET(wq, wq, pd, priv->pdn);
|
||||
|
||||
param->wq.buf_numa_node = 0;
|
||||
param->wq.db_numa_node = 0;
|
||||
param->wq.linear = 1;
|
||||
}
|
||||
|
||||
@ -4430,13 +4425,14 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev)
|
||||
mlx5_core_dbg(mdev, "mlx5e_check_required_hca_cap() failed\n");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to allocate the priv and make room for worst-case
|
||||
* number of channel structures:
|
||||
*/
|
||||
priv = malloc(sizeof(*priv) +
|
||||
priv = malloc_domainset(sizeof(*priv) +
|
||||
(sizeof(priv->channel[0]) * mdev->priv.eq_table.num_comp_vectors),
|
||||
M_MLX5EN, M_WAITOK | M_ZERO);
|
||||
M_MLX5EN, mlx5_dev_domainset(mdev), M_WAITOK | M_ZERO);
|
||||
|
||||
ifp = priv->ifp = if_alloc_dev(IFT_ETHER, mdev->pdev->dev.bsddev);
|
||||
if (ifp == NULL) {
|
||||
|
@ -51,8 +51,6 @@ mlx5e_rl_build_sq_param(struct mlx5e_rl_priv_data *rl,
|
||||
MLX5_SET(wq, wq, log_wq_stride, ilog2(MLX5_SEND_WQE_BB));
|
||||
MLX5_SET(wq, wq, pd, rl->priv->pdn);
|
||||
|
||||
param->wq.buf_numa_node = 0;
|
||||
param->wq.db_numa_node = 0;
|
||||
param->wq.linear = 1;
|
||||
}
|
||||
|
||||
@ -116,6 +114,10 @@ mlx5e_rl_create_sq(struct mlx5e_priv *priv, struct mlx5e_sq *sq,
|
||||
&sq->dma_tag)))
|
||||
goto done;
|
||||
|
||||
sq->mkey_be = cpu_to_be32(priv->mr.key);
|
||||
sq->ifp = priv->ifp;
|
||||
sq->priv = priv;
|
||||
|
||||
err = mlx5_wq_cyc_create(mdev, ¶m->wq, sqc_wq, &sq->wq,
|
||||
&sq->wq_ctrl);
|
||||
if (err)
|
||||
@ -127,10 +129,6 @@ mlx5e_rl_create_sq(struct mlx5e_priv *priv, struct mlx5e_sq *sq,
|
||||
if (err)
|
||||
goto err_sq_wq_destroy;
|
||||
|
||||
sq->mkey_be = cpu_to_be32(priv->mr.key);
|
||||
sq->ifp = priv->ifp;
|
||||
sq->priv = priv;
|
||||
|
||||
mlx5e_update_sq_inline(sq);
|
||||
|
||||
return (0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user