Commit 64b62146 authored by Joe Damato's avatar Joe Damato Committed by Jakub Kicinski
Browse files

net/mlx4: link NAPI instances to queues and IRQs



Make mlx4 compatible with the newly added netlink queue GET APIs.

Signed-off-by: default avatarJoe Damato <jdamato@fastly.com>
Tested-by: default avatarMartin Karsten <mkarsten@uwaterloo.ca>
Acked-by: default avatarJakub Kicinski <kuba@kernel.org>
Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Link: https://lore.kernel.org/r/20240528181139.515070-3-jdamato@fastly.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 6166bb0c
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq,
		cq_idx = cq_idx % priv->rx_ring_num;
		rx_cq = priv->rx_cq[cq_idx];
		cq->vector = rx_cq->vector;
		irq = mlx4_eq_get_irq(mdev->dev, cq->vector);
	}

	if (cq->type == RX)
@@ -142,18 +143,23 @@ int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq,
	if (err)
		goto free_eq;

	cq->cq_idx = cq_idx;
	cq->mcq.event = mlx4_en_cq_event;

	switch (cq->type) {
	case TX:
		cq->mcq.comp = mlx4_en_tx_irq;
		netif_napi_add_tx(cq->dev, &cq->napi, mlx4_en_poll_tx_cq);
		netif_napi_set_irq(&cq->napi, irq);
		napi_enable(&cq->napi);
		netif_queue_set_napi(cq->dev, cq_idx, NETDEV_QUEUE_TYPE_TX, &cq->napi);
		break;
	case RX:
		cq->mcq.comp = mlx4_en_rx_irq;
		netif_napi_add(cq->dev, &cq->napi, mlx4_en_poll_rx_cq);
		netif_napi_set_irq(&cq->napi, irq);
		napi_enable(&cq->napi);
		netif_queue_set_napi(cq->dev, cq_idx, NETDEV_QUEUE_TYPE_RX, &cq->napi);
		break;
	case TX_XDP:
		/* nothing regarding napi, it's shared with rx ring */
@@ -189,6 +195,14 @@ void mlx4_en_destroy_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq **pcq)
void mlx4_en_deactivate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq)
{
	if (cq->type != TX_XDP) {
		enum netdev_queue_type qtype;

		if (cq->type == RX)
			qtype = NETDEV_QUEUE_TYPE_RX;
		else
			qtype = NETDEV_QUEUE_TYPE_TX;

		netif_queue_set_napi(cq->dev, cq->cq_idx, qtype, NULL);
		napi_disable(&cq->napi);
		netif_napi_del(&cq->napi);
	}
+1 −0
Original line number Diff line number Diff line
@@ -380,6 +380,7 @@ struct mlx4_en_cq {
#define MLX4_EN_OPCODE_ERROR	0x1e

	const struct cpumask *aff_mask;
	int cq_idx;
};

struct mlx4_en_port_profile {