Commit 7cf6f811 authored by Tariq Toukan's avatar Tariq Toukan Committed by Saeed Mahameed
Browse files

net/mlx5e: XDP, Slight enhancement for WQE fetch function



Instead of passing an output param, let function return the
WQE pointer.
In addition, pass &pi so it gets its value in the function,
and save the redundant assignment that comes after it.

Signed-off-by: default avatarTariq Toukan <tariqt@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 6c085a8a
Loading
Loading
Loading
Loading
+1 −3
Original line number Original line Diff line number Diff line
@@ -187,14 +187,12 @@ static void mlx5e_xdp_mpwqe_session_start(struct mlx5e_xdpsq *sq)
	if (unlikely(contig_wqebbs < MLX5_SEND_WQE_MAX_WQEBBS))
	if (unlikely(contig_wqebbs < MLX5_SEND_WQE_MAX_WQEBBS))
		mlx5e_fill_xdpsq_frag_edge(sq, wq, pi, contig_wqebbs);
		mlx5e_fill_xdpsq_frag_edge(sq, wq, pi, contig_wqebbs);


	mlx5e_xdpsq_fetch_wqe(sq, &session->wqe);
	session->wqe = mlx5e_xdpsq_fetch_wqe(sq, &pi);


	prefetchw(session->wqe->data);
	prefetchw(session->wqe->data);
	session->ds_count  = MLX5E_XDP_TX_EMPTY_DS_COUNT;
	session->ds_count  = MLX5E_XDP_TX_EMPTY_DS_COUNT;
	session->pkt_count = 0;
	session->pkt_count = 0;


	pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc);

	mlx5e_xdp_update_inline_state(sq);
	mlx5e_xdp_update_inline_state(sq);


	stats->mpwqe++;
	stats->mpwqe++;
+8 −5
Original line number Original line Diff line number Diff line
@@ -190,14 +190,17 @@ mlx5e_xdp_mpwqe_add_dseg(struct mlx5e_xdpsq *sq,
	session->ds_count++;
	session->ds_count++;
}
}


static inline void mlx5e_xdpsq_fetch_wqe(struct mlx5e_xdpsq *sq,
static inline struct mlx5e_tx_wqe *
					 struct mlx5e_tx_wqe **wqe)
mlx5e_xdpsq_fetch_wqe(struct mlx5e_xdpsq *sq, u16 *pi)
{
{
	struct mlx5_wq_cyc *wq = &sq->wq;
	struct mlx5_wq_cyc *wq = &sq->wq;
	u16 pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc);
	struct mlx5e_tx_wqe *wqe;


	*wqe = mlx5_wq_cyc_get_wqe(wq, pi);
	*pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc);
	memset(*wqe, 0, sizeof(**wqe));
	wqe = mlx5_wq_cyc_get_wqe(wq, *pi);
	memset(wqe, 0, sizeof(*wqe));

	return wqe;
}
}


static inline void
static inline void