Skip to content

Commit ccc109b

Browse files
Tariq Toukandavem330
authored andcommitted
net/mlx4_en: Add TX_XDP for CQ types
Support XDP CQ type, and refactor the CQ type enum. Rename the is_tx field to match the change. Signed-off-by: Tariq Toukan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e4ff952 commit ccc109b

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

drivers/net/ethernet/mellanox/mlx4/en_cq.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ int mlx4_en_create_cq(struct mlx4_en_priv *priv,
6565
cq->buf_size = cq->size * mdev->dev->caps.cqe_size;
6666

6767
cq->ring = ring;
68-
cq->is_tx = mode;
68+
cq->type = mode;
6969
cq->vector = mdev->dev->caps.num_comp_vectors;
7070

7171
/* Allocate HW buffers on provided NUMA node.
@@ -104,7 +104,7 @@ int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq,
104104
*cq->mcq.arm_db = 0;
105105
memset(cq->buf, 0, cq->buf_size);
106106

107-
if (cq->is_tx == RX) {
107+
if (cq->type == RX) {
108108
if (!mlx4_is_eq_vector_valid(mdev->dev, priv->port,
109109
cq->vector)) {
110110
cq->vector = cpumask_first(priv->rx_ring[cq->ring]->affinity_mask);
@@ -141,11 +141,11 @@ int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq,
141141
cq->vector = rx_cq->vector;
142142
}
143143

144-
if (!cq->is_tx)
144+
if (cq->type == RX)
145145
cq->size = priv->rx_ring[cq->ring]->actual_size;
146146

147-
if ((cq->is_tx && priv->hwtstamp_config.tx_type) ||
148-
(!cq->is_tx && priv->hwtstamp_config.rx_filter))
147+
if ((cq->type != RX && priv->hwtstamp_config.tx_type) ||
148+
(cq->type == RX && priv->hwtstamp_config.rx_filter))
149149
timestamp_en = 1;
150150

151151
err = mlx4_cq_alloc(mdev->dev, cq->size, &cq->wqres.mtt,
@@ -154,10 +154,10 @@ int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq,
154154
if (err)
155155
goto free_eq;
156156

157-
cq->mcq.comp = cq->is_tx ? mlx4_en_tx_irq : mlx4_en_rx_irq;
157+
cq->mcq.comp = cq->type != RX ? mlx4_en_tx_irq : mlx4_en_rx_irq;
158158
cq->mcq.event = mlx4_en_cq_event;
159159

160-
if (cq->is_tx)
160+
if (cq->type != RX)
161161
netif_tx_napi_add(cq->dev, &cq->napi, mlx4_en_poll_tx_cq,
162162
NAPI_POLL_WEIGHT);
163163
else
@@ -181,7 +181,7 @@ void mlx4_en_destroy_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq **pcq)
181181

182182
mlx4_free_hwq_res(mdev->dev, &cq->wqres, cq->buf_size);
183183
if (mlx4_is_eq_vector_valid(mdev->dev, priv->port, cq->vector) &&
184-
cq->is_tx == RX)
184+
cq->type == RX)
185185
mlx4_release_eq(priv->mdev->dev, cq->vector);
186186
cq->vector = 0;
187187
cq->buf_size = 0;
@@ -193,7 +193,7 @@ void mlx4_en_destroy_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq **pcq)
193193
void mlx4_en_deactivate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq)
194194
{
195195
napi_disable(&cq->napi);
196-
if (!cq->is_tx) {
196+
if (cq->type == RX) {
197197
napi_hash_del(&cq->napi);
198198
synchronize_rcu();
199199
}

drivers/net/ethernet/mellanox/mlx4/mlx4_en.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,9 @@ enum {
207207
*/
208208

209209
enum cq_type {
210-
RX = 0,
211-
TX = 1,
210+
TX,
211+
TX_XDP,
212+
RX,
212213
};
213214

214215

@@ -361,7 +362,7 @@ struct mlx4_en_cq {
361362
int size;
362363
int buf_size;
363364
int vector;
364-
enum cq_type is_tx;
365+
enum cq_type type;
365366
u16 moder_time;
366367
u16 moder_cnt;
367368
struct mlx4_cqe *buf;

0 commit comments

Comments
 (0)