Commit 31871f87 authored by Saeed Mahameed's avatar Saeed Mahameed Committed by David S. Miller

net/mlx5e: Move XDP SQ instance into RQ

To save many rq->channel->sq dereferences in fast-path.
And rename it to xdpsq.
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Reviewed-by: default avatarTariq Toukan <tariqt@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent eba2db2b
...@@ -479,7 +479,10 @@ struct mlx5e_rq { ...@@ -479,7 +479,10 @@ struct mlx5e_rq {
u16 rx_headroom; u16 rx_headroom;
struct mlx5e_rx_am am; /* Adaptive Moderation */ struct mlx5e_rx_am am; /* Adaptive Moderation */
/* XDP */
struct bpf_prog *xdp_prog; struct bpf_prog *xdp_prog;
struct mlx5e_sq xdpsq;
/* control */ /* control */
struct mlx5_wq_ctrl wq_ctrl; struct mlx5_wq_ctrl wq_ctrl;
...@@ -499,7 +502,6 @@ enum channel_flags { ...@@ -499,7 +502,6 @@ enum channel_flags {
struct mlx5e_channel { struct mlx5e_channel {
/* data path */ /* data path */
struct mlx5e_rq rq; struct mlx5e_rq rq;
struct mlx5e_sq xdp_sq;
struct mlx5e_sq sq[MLX5E_MAX_NUM_TC]; struct mlx5e_sq sq[MLX5E_MAX_NUM_TC];
struct mlx5e_sq icosq; /* internal control operations */ struct mlx5e_sq icosq; /* internal control operations */
bool xdp; bool xdp;
......
...@@ -1562,7 +1562,7 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix, ...@@ -1562,7 +1562,7 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
goto err_close_tx_cqs; goto err_close_tx_cqs;
/* XDP SQ CQ params are same as normal TXQ sq CQ params */ /* XDP SQ CQ params are same as normal TXQ sq CQ params */
err = c->xdp ? mlx5e_open_cq(c, &cparam->tx_cq, &c->xdp_sq.cq, err = c->xdp ? mlx5e_open_cq(c, &cparam->tx_cq, &c->rq.xdpsq.cq,
priv->params.tx_cq_moderation) : 0; priv->params.tx_cq_moderation) : 0;
if (err) if (err)
goto err_close_rx_cq; goto err_close_rx_cq;
...@@ -1587,7 +1587,7 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix, ...@@ -1587,7 +1587,7 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
} }
} }
err = c->xdp ? mlx5e_open_sq(c, 0, &cparam->xdp_sq, &c->xdp_sq) : 0; err = c->xdp ? mlx5e_open_sq(c, 0, &cparam->xdp_sq, &c->rq.xdpsq) : 0;
if (err) if (err)
goto err_close_sqs; goto err_close_sqs;
...@@ -1601,7 +1601,7 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix, ...@@ -1601,7 +1601,7 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
return 0; return 0;
err_close_xdp_sq: err_close_xdp_sq:
if (c->xdp) if (c->xdp)
mlx5e_close_sq(&c->xdp_sq); mlx5e_close_sq(&c->rq.xdpsq);
err_close_sqs: err_close_sqs:
mlx5e_close_sqs(c); mlx5e_close_sqs(c);
...@@ -1612,7 +1612,7 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix, ...@@ -1612,7 +1612,7 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
err_disable_napi: err_disable_napi:
napi_disable(&c->napi); napi_disable(&c->napi);
if (c->xdp) if (c->xdp)
mlx5e_close_cq(&c->xdp_sq.cq); mlx5e_close_cq(&c->rq.xdpsq.cq);
err_close_rx_cq: err_close_rx_cq:
mlx5e_close_cq(&c->rq.cq); mlx5e_close_cq(&c->rq.cq);
...@@ -1634,12 +1634,12 @@ static void mlx5e_close_channel(struct mlx5e_channel *c) ...@@ -1634,12 +1634,12 @@ static void mlx5e_close_channel(struct mlx5e_channel *c)
{ {
mlx5e_close_rq(&c->rq); mlx5e_close_rq(&c->rq);
if (c->xdp) if (c->xdp)
mlx5e_close_sq(&c->xdp_sq); mlx5e_close_sq(&c->rq.xdpsq);
mlx5e_close_sqs(c); mlx5e_close_sqs(c);
mlx5e_close_sq(&c->icosq); mlx5e_close_sq(&c->icosq);
napi_disable(&c->napi); napi_disable(&c->napi);
if (c->xdp) if (c->xdp)
mlx5e_close_cq(&c->xdp_sq.cq); mlx5e_close_cq(&c->rq.xdpsq.cq);
mlx5e_close_cq(&c->rq.cq); mlx5e_close_cq(&c->rq.cq);
mlx5e_close_tx_cqs(c); mlx5e_close_tx_cqs(c);
mlx5e_close_cq(&c->icosq.cq); mlx5e_close_cq(&c->icosq.cq);
......
...@@ -653,7 +653,7 @@ static inline bool mlx5e_xmit_xdp_frame(struct mlx5e_rq *rq, ...@@ -653,7 +653,7 @@ static inline bool mlx5e_xmit_xdp_frame(struct mlx5e_rq *rq,
struct mlx5e_dma_info *di, struct mlx5e_dma_info *di,
const struct xdp_buff *xdp) const struct xdp_buff *xdp)
{ {
struct mlx5e_sq *sq = &rq->channel->xdp_sq; struct mlx5e_sq *sq = &rq->xdpsq;
struct mlx5_wq_cyc *wq = &sq->wq; struct mlx5_wq_cyc *wq = &sq->wq;
u16 pi = sq->pc & wq->sz_m1; u16 pi = sq->pc & wq->sz_m1;
struct mlx5e_tx_wqe *wqe = mlx5_wq_cyc_get_wqe(wq, pi); struct mlx5e_tx_wqe *wqe = mlx5_wq_cyc_get_wqe(wq, pi);
...@@ -950,7 +950,7 @@ void mlx5e_handle_rx_cqe_mpwrq(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe) ...@@ -950,7 +950,7 @@ void mlx5e_handle_rx_cqe_mpwrq(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe)
int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget) int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget)
{ {
struct mlx5e_rq *rq = container_of(cq, struct mlx5e_rq, cq); struct mlx5e_rq *rq = container_of(cq, struct mlx5e_rq, cq);
struct mlx5e_sq *xdp_sq = &rq->channel->xdp_sq; struct mlx5e_sq *xdpsq = &rq->xdpsq;
int work_done = 0; int work_done = 0;
if (unlikely(!test_bit(MLX5E_RQ_STATE_ENABLED, &rq->state))) if (unlikely(!test_bit(MLX5E_RQ_STATE_ENABLED, &rq->state)))
...@@ -977,9 +977,9 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget) ...@@ -977,9 +977,9 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget)
rq->handle_rx_cqe(rq, cqe); rq->handle_rx_cqe(rq, cqe);
} }
if (xdp_sq->db.xdp.doorbell) { if (xdpsq->db.xdp.doorbell) {
mlx5e_xmit_xdp_doorbell(xdp_sq); mlx5e_xmit_xdp_doorbell(xdpsq);
xdp_sq->db.xdp.doorbell = false; xdpsq->db.xdp.doorbell = false;
} }
mlx5_cqwq_update_db_record(&cq->wq); mlx5_cqwq_update_db_record(&cq->wq);
...@@ -993,6 +993,7 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget) ...@@ -993,6 +993,7 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget)
bool mlx5e_poll_xdpsq_cq(struct mlx5e_cq *cq) bool mlx5e_poll_xdpsq_cq(struct mlx5e_cq *cq)
{ {
struct mlx5e_sq *sq; struct mlx5e_sq *sq;
struct mlx5e_rq *rq;
u16 sqcc; u16 sqcc;
int i; int i;
...@@ -1001,6 +1002,8 @@ bool mlx5e_poll_xdpsq_cq(struct mlx5e_cq *cq) ...@@ -1001,6 +1002,8 @@ bool mlx5e_poll_xdpsq_cq(struct mlx5e_cq *cq)
if (unlikely(!test_bit(MLX5E_SQ_STATE_ENABLED, &sq->state))) if (unlikely(!test_bit(MLX5E_SQ_STATE_ENABLED, &sq->state)))
return false; return false;
rq = container_of(sq, struct mlx5e_rq, xdpsq);
/* sq->cc must be updated only after mlx5_cqwq_update_db_record(), /* sq->cc must be updated only after mlx5_cqwq_update_db_record(),
* otherwise a cq overrun may occur * otherwise a cq overrun may occur
*/ */
...@@ -1037,7 +1040,7 @@ bool mlx5e_poll_xdpsq_cq(struct mlx5e_cq *cq) ...@@ -1037,7 +1040,7 @@ bool mlx5e_poll_xdpsq_cq(struct mlx5e_cq *cq)
sqcc += wi->num_wqebbs; sqcc += wi->num_wqebbs;
/* Recycle RX page */ /* Recycle RX page */
mlx5e_page_release(&sq->channel->rq, di, true); mlx5e_page_release(rq, di, true);
} while (!last_wqe); } while (!last_wqe);
} }
...@@ -1052,6 +1055,7 @@ bool mlx5e_poll_xdpsq_cq(struct mlx5e_cq *cq) ...@@ -1052,6 +1055,7 @@ bool mlx5e_poll_xdpsq_cq(struct mlx5e_cq *cq)
void mlx5e_free_xdpsq_descs(struct mlx5e_sq *sq) void mlx5e_free_xdpsq_descs(struct mlx5e_sq *sq)
{ {
struct mlx5e_rq *rq = container_of(sq, struct mlx5e_rq, xdpsq);
struct mlx5e_sq_wqe_info *wi; struct mlx5e_sq_wqe_info *wi;
struct mlx5e_dma_info *di; struct mlx5e_dma_info *di;
u16 ci; u16 ci;
...@@ -1068,6 +1072,6 @@ void mlx5e_free_xdpsq_descs(struct mlx5e_sq *sq) ...@@ -1068,6 +1072,6 @@ void mlx5e_free_xdpsq_descs(struct mlx5e_sq *sq)
sq->cc += wi->num_wqebbs; sq->cc += wi->num_wqebbs;
mlx5e_page_release(&sq->channel->rq, di, false); mlx5e_page_release(rq, di, false);
} }
} }
...@@ -122,7 +122,7 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget) ...@@ -122,7 +122,7 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
busy |= work_done == budget; busy |= work_done == budget;
if (c->xdp) if (c->xdp)
busy |= mlx5e_poll_xdpsq_cq(&c->xdp_sq.cq); busy |= mlx5e_poll_xdpsq_cq(&c->rq.xdpsq.cq);
mlx5e_poll_ico_cq(&c->icosq.cq); mlx5e_poll_ico_cq(&c->icosq.cq);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment