Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b8dd786f authored by Yevgeny Petrilin's avatar Yevgeny Petrilin Committed by Roland Dreier
Browse files

mlx4_core: Add support for multiple completion event vectors



When using MSI-X mode, create a completion event queue for each CPU.
Report the number of completion EQs in a new struct mlx4_caps member,
num_comp_vectors, and extend the mlx4_cq_alloc() interface with a
vector parameter so that consumers can specify which completion EQ
should be used to report events for the CQ being created.

Signed-off-by: default avatarYevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 061e41fd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -222,7 +222,7 @@ struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev, int entries, int vector
	}

	err = mlx4_cq_alloc(dev->dev, entries, &cq->buf.mtt, uar,
			    cq->db.dma, &cq->mcq, 0);
			    cq->db.dma, &cq->mcq, vector, 0);
	if (err)
		goto err_dbmap;

+1 −1
Original line number Diff line number Diff line
@@ -578,7 +578,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
	mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB)
		ibdev->num_ports++;
	ibdev->ib_dev.phys_port_cnt     = ibdev->num_ports;
	ibdev->ib_dev.num_comp_vectors	= 1;
	ibdev->ib_dev.num_comp_vectors	= dev->caps.num_comp_vectors;
	ibdev->ib_dev.dma_device	= &dev->pdev->dev;

	ibdev->ib_dev.uverbs_abi_ver	= MLX4_IB_UVERBS_ABI_VERSION;
+8 −3
Original line number Diff line number Diff line
@@ -189,7 +189,7 @@ EXPORT_SYMBOL_GPL(mlx4_cq_resize);

int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt,
		  struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq,
		  int collapsed)
		  unsigned vector, int collapsed)
{
	struct mlx4_priv *priv = mlx4_priv(dev);
	struct mlx4_cq_table *cq_table = &priv->cq_table;
@@ -198,6 +198,11 @@ int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt,
	u64 mtt_addr;
	int err;

	if (vector >= dev->caps.num_comp_vectors)
		return -EINVAL;

	cq->vector = vector;

	cq->cqn = mlx4_bitmap_alloc(&cq_table->bitmap);
	if (cq->cqn == -1)
		return -ENOMEM;
@@ -227,7 +232,7 @@ int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt,

	cq_context->flags	    = cpu_to_be32(!!collapsed << 18);
	cq_context->logsize_usrpage = cpu_to_be32((ilog2(nent) << 24) | uar->index);
	cq_context->comp_eqn        = priv->eq_table.eq[MLX4_EQ_COMP].eqn;
	cq_context->comp_eqn	    = priv->eq_table.eq[vector].eqn;
	cq_context->log_page_size   = mtt->page_shift - MLX4_ICM_PAGE_SHIFT;

	mtt_addr = mlx4_mtt_addr(dev, mtt);
@@ -276,7 +281,7 @@ void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq)
	if (err)
		mlx4_warn(dev, "HW2SW_CQ failed (%d) for CQN %06x\n", err, cq->cqn);

	synchronize_irq(priv->eq_table.eq[MLX4_EQ_COMP].irq);
	synchronize_irq(priv->eq_table.eq[cq->vector].irq);

	spin_lock_irq(&cq_table->lock);
	radix_tree_delete(&cq_table->tree, cq->cqn);
+6 −3
Original line number Diff line number Diff line
@@ -51,10 +51,13 @@ int mlx4_en_create_cq(struct mlx4_en_priv *priv,
	int err;

	cq->size = entries;
	if (mode == RX)
	if (mode == RX) {
		cq->buf_size = cq->size * sizeof(struct mlx4_cqe);
	else
		cq->vector   = ring % mdev->dev->caps.num_comp_vectors;
	} else {
		cq->buf_size = sizeof(struct mlx4_cqe);
		cq->vector   = 0;
	}

	cq->ring = ring;
	cq->is_tx = mode;
@@ -86,7 +89,7 @@ int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq)
	memset(cq->buf, 0, cq->buf_size);

	err = mlx4_cq_alloc(mdev->dev, cq->size, &cq->wqres.mtt, &mdev->priv_uar,
			    cq->wqres.db.dma, &cq->mcq, cq->is_tx);
			    cq->wqres.db.dma, &cq->mcq, cq->vector, cq->is_tx);
	if (err)
		return err;

+2 −2
Original line number Diff line number Diff line
@@ -170,9 +170,9 @@ static void *mlx4_en_add(struct mlx4_dev *dev)
		mlx4_info(mdev, "Using %d tx rings for port:%d\n",
			  mdev->profile.prof[i].tx_ring_num, i);
		if (!mdev->profile.prof[i].rx_ring_num) {
			mdev->profile.prof[i].rx_ring_num = 1;
			mdev->profile.prof[i].rx_ring_num = dev->caps.num_comp_vectors;
			mlx4_info(mdev, "Defaulting to %d rx rings for port:%d\n",
				  1, i);
				  mdev->profile.prof[i].rx_ring_num, i);
		} else
			mlx4_info(mdev, "Using %d rx rings for port:%d\n",
				  mdev->profile.prof[i].rx_ring_num, i);
Loading