mirror of https://gitee.com/openkylin/linux.git
net/mlx5e: Non-atomic indicator for ring enabled state
Rings enabled state change occurs in control path only, and is always followed by a napi_sychronize(), so that following NAPIs read the new value. This read does not need to be atomic. The RQ auto-moderation bit is not set/cleared in data-path. No need for atomic read, a regular read operation is sufficient. In RQ creation time as well, there's no multiple threads trying to access it yet, hence a regular read can be used. Signed-off-by: Tariq Toukan <tariqt@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
parent
604acb193b
commit
a1eaba4c5c
|
@ -295,6 +295,8 @@ enum {
|
|||
MLX5E_RQ_STATE_AM,
|
||||
};
|
||||
|
||||
#define MLX5E_TEST_BIT(state, nr) (state & BIT(nr))
|
||||
|
||||
struct mlx5e_cq {
|
||||
/* data path - accessed per cqe */
|
||||
struct mlx5_cqwq wq;
|
||||
|
|
|
@ -929,7 +929,7 @@ static int mlx5e_open_rq(struct mlx5e_channel *c,
|
|||
goto err_destroy_rq;
|
||||
|
||||
if (params->rx_am_enabled)
|
||||
set_bit(MLX5E_RQ_STATE_AM, &c->rq.state);
|
||||
c->rq.state |= BIT(MLX5E_RQ_STATE_AM);
|
||||
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -424,7 +424,7 @@ void mlx5e_post_rx_mpwqe(struct mlx5e_rq *rq)
|
|||
|
||||
clear_bit(MLX5E_RQ_STATE_UMR_WQE_IN_PROGRESS, &rq->state);
|
||||
|
||||
if (unlikely(!test_bit(MLX5E_RQ_STATE_ENABLED, &rq->state))) {
|
||||
if (unlikely(!MLX5E_TEST_BIT(rq->state, MLX5E_RQ_STATE_ENABLED))) {
|
||||
mlx5e_free_rx_mpwqe(rq, &rq->mpwqe.info[wq->head]);
|
||||
return;
|
||||
}
|
||||
|
@ -461,7 +461,7 @@ bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq)
|
|||
struct mlx5_wq_ll *wq = &rq->wq;
|
||||
int err;
|
||||
|
||||
if (unlikely(!test_bit(MLX5E_RQ_STATE_ENABLED, &rq->state)))
|
||||
if (unlikely(!MLX5E_TEST_BIT(rq->state, MLX5E_RQ_STATE_ENABLED)))
|
||||
return false;
|
||||
|
||||
if (mlx5_wq_ll_is_full(wq))
|
||||
|
@ -983,7 +983,7 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget)
|
|||
struct mlx5_cqe64 *cqe;
|
||||
int work_done = 0;
|
||||
|
||||
if (unlikely(!test_bit(MLX5E_RQ_STATE_ENABLED, &rq->state)))
|
||||
if (unlikely(!MLX5E_TEST_BIT(rq->state, MLX5E_RQ_STATE_ENABLED)))
|
||||
return 0;
|
||||
|
||||
if (cq->decmprs_left)
|
||||
|
@ -1031,7 +1031,7 @@ bool mlx5e_poll_xdpsq_cq(struct mlx5e_cq *cq)
|
|||
|
||||
sq = container_of(cq, struct mlx5e_xdpsq, cq);
|
||||
|
||||
if (unlikely(!test_bit(MLX5E_SQ_STATE_ENABLED, &sq->state)))
|
||||
if (unlikely(!MLX5E_TEST_BIT(sq->state, MLX5E_SQ_STATE_ENABLED)))
|
||||
return false;
|
||||
|
||||
cqe = mlx5_cqwq_get_cqe(&cq->wq);
|
||||
|
|
|
@ -403,7 +403,7 @@ bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget)
|
|||
|
||||
sq = container_of(cq, struct mlx5e_txqsq, cq);
|
||||
|
||||
if (unlikely(!test_bit(MLX5E_SQ_STATE_ENABLED, &sq->state)))
|
||||
if (unlikely(!MLX5E_TEST_BIT(sq->state, MLX5E_SQ_STATE_ENABLED)))
|
||||
return false;
|
||||
|
||||
cqe = mlx5_cqwq_get_cqe(&cq->wq);
|
||||
|
|
|
@ -69,7 +69,7 @@ static void mlx5e_poll_ico_cq(struct mlx5e_cq *cq)
|
|||
struct mlx5_cqe64 *cqe;
|
||||
u16 sqcc;
|
||||
|
||||
if (unlikely(!test_bit(MLX5E_SQ_STATE_ENABLED, &sq->state)))
|
||||
if (unlikely(!MLX5E_TEST_BIT(sq->state, MLX5E_SQ_STATE_ENABLED)))
|
||||
return;
|
||||
|
||||
cqe = mlx5_cqwq_get_cqe(&cq->wq);
|
||||
|
@ -129,7 +129,7 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
|
|||
for (i = 0; i < c->num_tc; i++)
|
||||
mlx5e_cq_arm(&c->sq[i].cq);
|
||||
|
||||
if (test_bit(MLX5E_RQ_STATE_AM, &c->rq.state))
|
||||
if (MLX5E_TEST_BIT(c->rq.state, MLX5E_RQ_STATE_AM))
|
||||
mlx5e_rx_am(&c->rq);
|
||||
|
||||
mlx5e_cq_arm(&c->rq.cq);
|
||||
|
|
Loading…
Reference in New Issue