Commit 8d1807a9 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'mlx5-misc-patches-2024-10-31'

Tariq Toukan says:

====================
mlx5 misc patches 2024-10-31

First patch by Cosmin fixes an issue in a recent commit.

Followed by 2 patches by Yevgeny that organize and rename the files
under the steering directory.

Finally, 2 patches by William that save the creation of the unused
egress-XDP_REDIRECT send queue on non-uplink representor.
====================

Link: https://patch.msgid.link/20241031125856.530927-1-tariqt@nvidia.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 9ff75a23 355cf274
Loading
Loading
Loading
Loading
+38 −25
Original line number Diff line number Diff line
@@ -109,35 +109,48 @@ mlx5_core-$(CONFIG_MLX5_EN_TLS) += en_accel/ktls_stats.o \
				   en_accel/fs_tcp.o en_accel/ktls.o en_accel/ktls_txrx.o \
				   en_accel/ktls_tx.o en_accel/ktls_rx.o

mlx5_core-$(CONFIG_MLX5_SW_STEERING) += steering/dr_domain.o steering/dr_table.o \
					steering/dr_matcher.o steering/dr_rule.o \
					steering/dr_icm_pool.o steering/dr_buddy.o \
					steering/dr_ste.o steering/dr_send.o \
					steering/dr_ste_v0.o steering/dr_ste_v1.o \
					steering/dr_ste_v2.o \
					steering/dr_cmd.o steering/dr_fw.o \
					steering/dr_action.o steering/fs_dr.o \
					steering/dr_definer.o steering/dr_ptrn.o \
					steering/dr_arg.o steering/dr_dbg.o lib/smfs.o
#
# SW Steering
#
mlx5_core-$(CONFIG_MLX5_SW_STEERING) += steering/sws/dr_domain.o \
					steering/sws/dr_table.o \
					steering/sws/dr_matcher.o \
					steering/sws/dr_rule.o \
					steering/sws/dr_icm_pool.o \
					steering/sws/dr_buddy.o \
					steering/sws/dr_ste.o \
					steering/sws/dr_send.o \
					steering/sws/dr_ste_v0.o \
					steering/sws/dr_ste_v1.o \
					steering/sws/dr_ste_v2.o \
					steering/sws/dr_cmd.o \
					steering/sws/dr_fw.o \
					steering/sws/dr_action.o \
					steering/sws/dr_definer.o \
					steering/sws/dr_ptrn.o \
					steering/sws/dr_arg.o \
					steering/sws/dr_dbg.o \
					steering/sws/fs_dr.o \
					lib/smfs.o

#
# HW Steering
#
mlx5_core-$(CONFIG_MLX5_HW_STEERING) += steering/hws/mlx5hws_cmd.o \
					steering/hws/mlx5hws_context.o \
					steering/hws/mlx5hws_pat_arg.o \
					steering/hws/mlx5hws_buddy.o \
					steering/hws/mlx5hws_pool.o \
					steering/hws/mlx5hws_table.o \
					steering/hws/mlx5hws_action.o \
					steering/hws/mlx5hws_rule.o \
					steering/hws/mlx5hws_matcher.o \
					steering/hws/mlx5hws_send.o \
					steering/hws/mlx5hws_definer.o \
					steering/hws/mlx5hws_bwc.o \
					steering/hws/mlx5hws_debug.o \
					steering/hws/mlx5hws_vport.o \
					steering/hws/mlx5hws_bwc_complex.o
mlx5_core-$(CONFIG_MLX5_HW_STEERING) += steering/hws/cmd.o \
					steering/hws/context.o \
					steering/hws/pat_arg.o \
					steering/hws/buddy.o \
					steering/hws/pool.o \
					steering/hws/table.o \
					steering/hws/action.o \
					steering/hws/rule.o \
					steering/hws/matcher.o \
					steering/hws/send.o \
					steering/hws/definer.o \
					steering/hws/bwc.o \
					steering/hws/debug.o \
					steering/hws/vport.o \
					steering/hws/bwc_complex.o


#
+1 −1
Original line number Diff line number Diff line
@@ -755,7 +755,7 @@ struct mlx5e_channel {
	u8                         lag_port;

	/* XDP_REDIRECT */
	struct mlx5e_xdpsq         xdpsq;
	struct mlx5e_xdpsq        *xdpsq;

	/* AF_XDP zero-copy */
	struct mlx5e_rq            xskrq;
+1 −1
Original line number Diff line number Diff line
@@ -865,7 +865,7 @@ int mlx5e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,
	if (unlikely(sq_num >= priv->channels.num))
		return -ENXIO;

	sq = &priv->channels.c[sq_num]->xdpsq;
	sq = priv->channels.c[sq_num]->xdpsq;

	for (i = 0; i < n; i++) {
		struct mlx5e_xmit_data_frags xdptxdf = {};
+54 −19
Original line number Diff line number Diff line
@@ -2086,6 +2086,44 @@ void mlx5e_close_xdpsq(struct mlx5e_xdpsq *sq)
	mlx5e_free_xdpsq(sq);
}

static struct mlx5e_xdpsq *mlx5e_open_xdpredirect_sq(struct mlx5e_channel *c,
						     struct mlx5e_params *params,
						     struct mlx5e_channel_param *cparam,
						     struct mlx5e_create_cq_param *ccp)
{
	struct mlx5e_xdpsq *xdpsq;
	int err;

	xdpsq = kvzalloc_node(sizeof(*xdpsq), GFP_KERNEL, c->cpu);
	if (!xdpsq)
		return ERR_PTR(-ENOMEM);

	err = mlx5e_open_cq(c->mdev, params->tx_cq_moderation,
			    &cparam->xdp_sq.cqp, ccp, &xdpsq->cq);
	if (err)
		goto err_free_xdpsq;

	err = mlx5e_open_xdpsq(c, params, &cparam->xdp_sq, NULL, xdpsq, true);
	if (err)
		goto err_close_xdpsq_cq;

	return xdpsq;

err_close_xdpsq_cq:
	mlx5e_close_cq(&xdpsq->cq);
err_free_xdpsq:
	kvfree(xdpsq);

	return ERR_PTR(err);
}

static void mlx5e_close_xdpredirect_sq(struct mlx5e_xdpsq *xdpsq)
{
	mlx5e_close_xdpsq(xdpsq);
	mlx5e_close_cq(&xdpsq->cq);
	kvfree(xdpsq);
}

static int mlx5e_alloc_cq_common(struct mlx5_core_dev *mdev,
				 struct net_device *netdev,
				 struct workqueue_struct *workqueue,
@@ -2476,6 +2514,7 @@ static int mlx5e_open_queues(struct mlx5e_channel *c,
			     struct mlx5e_params *params,
			     struct mlx5e_channel_param *cparam)
{
	const struct net_device_ops *netdev_ops = c->netdev->netdev_ops;
	struct dim_cq_moder icocq_moder = {0, 0};
	struct mlx5e_create_cq_param ccp;
	int err;
@@ -2496,15 +2535,18 @@ static int mlx5e_open_queues(struct mlx5e_channel *c,
	if (err)
		goto err_close_icosq_cq;

	err = mlx5e_open_cq(c->mdev, params->tx_cq_moderation, &cparam->xdp_sq.cqp, &ccp,
			    &c->xdpsq.cq);
	if (err)
	if (netdev_ops->ndo_xdp_xmit) {
		c->xdpsq = mlx5e_open_xdpredirect_sq(c, params, cparam, &ccp);
		if (IS_ERR(c->xdpsq)) {
			err = PTR_ERR(c->xdpsq);
			goto err_close_tx_cqs;
		}
	}

	err = mlx5e_open_cq(c->mdev, params->rx_cq_moderation, &cparam->rq.cqp, &ccp,
			    &c->rq.cq);
	if (err)
		goto err_close_xdp_tx_cqs;
		goto err_close_xdpredirect_sq;

	err = c->xdp ? mlx5e_open_cq(c->mdev, params->tx_cq_moderation, &cparam->xdp_sq.cqp,
				     &ccp, &c->rq_xdpsq.cq) : 0;
@@ -2516,7 +2558,7 @@ static int mlx5e_open_queues(struct mlx5e_channel *c,
	err = mlx5e_open_icosq(c, params, &cparam->async_icosq, &c->async_icosq,
			       mlx5e_async_icosq_err_cqe_work);
	if (err)
		goto err_close_xdpsq_cq;
		goto err_close_rq_xdpsq_cq;

	mutex_init(&c->icosq_recovery_lock);

@@ -2540,16 +2582,8 @@ static int mlx5e_open_queues(struct mlx5e_channel *c,
			goto err_close_rq;
	}

	err = mlx5e_open_xdpsq(c, params, &cparam->xdp_sq, NULL, &c->xdpsq, true);
	if (err)
		goto err_close_xdp_sq;

	return 0;

err_close_xdp_sq:
	if (c->xdp)
		mlx5e_close_xdpsq(&c->rq_xdpsq);

err_close_rq:
	mlx5e_close_rq(&c->rq);

@@ -2562,15 +2596,16 @@ static int mlx5e_open_queues(struct mlx5e_channel *c,
err_close_async_icosq:
	mlx5e_close_icosq(&c->async_icosq);

err_close_xdpsq_cq:
err_close_rq_xdpsq_cq:
	if (c->xdp)
		mlx5e_close_cq(&c->rq_xdpsq.cq);

err_close_rx_cq:
	mlx5e_close_cq(&c->rq.cq);

err_close_xdp_tx_cqs:
	mlx5e_close_cq(&c->xdpsq.cq);
err_close_xdpredirect_sq:
	if (c->xdpsq)
		mlx5e_close_xdpredirect_sq(c->xdpsq);

err_close_tx_cqs:
	mlx5e_close_tx_cqs(c);
@@ -2586,7 +2621,6 @@ static int mlx5e_open_queues(struct mlx5e_channel *c,

static void mlx5e_close_queues(struct mlx5e_channel *c)
{
	mlx5e_close_xdpsq(&c->xdpsq);
	if (c->xdp)
		mlx5e_close_xdpsq(&c->rq_xdpsq);
	/* The same ICOSQ is used for UMRs for both RQ and XSKRQ. */
@@ -2599,7 +2633,8 @@ static void mlx5e_close_queues(struct mlx5e_channel *c)
	if (c->xdp)
		mlx5e_close_cq(&c->rq_xdpsq.cq);
	mlx5e_close_cq(&c->rq.cq);
	mlx5e_close_cq(&c->xdpsq.cq);
	if (c->xdpsq)
		mlx5e_close_xdpredirect_sq(c->xdpsq);
	mlx5e_close_tx_cqs(c);
	mlx5e_close_cq(&c->icosq.cq);
	mlx5e_close_cq(&c->async_icosq.cq);
+2 −1
Original line number Diff line number Diff line
@@ -600,7 +600,8 @@ mlx5e_add_sqs_fwd_rules(struct mlx5e_priv *priv)
			if (c->xdp)
				sqs[num_sqs++] = c->rq_xdpsq.sqn;

			sqs[num_sqs++] = c->xdpsq.sqn;
			if (c->xdpsq)
				sqs[num_sqs++] = c->xdpsq->sqn;
		}
	}
	if (ptp_sq) {
Loading