mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-08 13:44:01 +08:00
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 <tariqt@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
e4ff952a7e
commit
ccc109b8ed
@ -65,7 +65,7 @@ int mlx4_en_create_cq(struct mlx4_en_priv *priv,
|
|||||||
cq->buf_size = cq->size * mdev->dev->caps.cqe_size;
|
cq->buf_size = cq->size * mdev->dev->caps.cqe_size;
|
||||||
|
|
||||||
cq->ring = ring;
|
cq->ring = ring;
|
||||||
cq->is_tx = mode;
|
cq->type = mode;
|
||||||
cq->vector = mdev->dev->caps.num_comp_vectors;
|
cq->vector = mdev->dev->caps.num_comp_vectors;
|
||||||
|
|
||||||
/* Allocate HW buffers on provided NUMA node.
|
/* 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,
|
|||||||
*cq->mcq.arm_db = 0;
|
*cq->mcq.arm_db = 0;
|
||||||
memset(cq->buf, 0, cq->buf_size);
|
memset(cq->buf, 0, cq->buf_size);
|
||||||
|
|
||||||
if (cq->is_tx == RX) {
|
if (cq->type == RX) {
|
||||||
if (!mlx4_is_eq_vector_valid(mdev->dev, priv->port,
|
if (!mlx4_is_eq_vector_valid(mdev->dev, priv->port,
|
||||||
cq->vector)) {
|
cq->vector)) {
|
||||||
cq->vector = cpumask_first(priv->rx_ring[cq->ring]->affinity_mask);
|
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,
|
|||||||
cq->vector = rx_cq->vector;
|
cq->vector = rx_cq->vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cq->is_tx)
|
if (cq->type == RX)
|
||||||
cq->size = priv->rx_ring[cq->ring]->actual_size;
|
cq->size = priv->rx_ring[cq->ring]->actual_size;
|
||||||
|
|
||||||
if ((cq->is_tx && priv->hwtstamp_config.tx_type) ||
|
if ((cq->type != RX && priv->hwtstamp_config.tx_type) ||
|
||||||
(!cq->is_tx && priv->hwtstamp_config.rx_filter))
|
(cq->type == RX && priv->hwtstamp_config.rx_filter))
|
||||||
timestamp_en = 1;
|
timestamp_en = 1;
|
||||||
|
|
||||||
err = mlx4_cq_alloc(mdev->dev, cq->size, &cq->wqres.mtt,
|
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,
|
|||||||
if (err)
|
if (err)
|
||||||
goto free_eq;
|
goto free_eq;
|
||||||
|
|
||||||
cq->mcq.comp = cq->is_tx ? mlx4_en_tx_irq : mlx4_en_rx_irq;
|
cq->mcq.comp = cq->type != RX ? mlx4_en_tx_irq : mlx4_en_rx_irq;
|
||||||
cq->mcq.event = mlx4_en_cq_event;
|
cq->mcq.event = mlx4_en_cq_event;
|
||||||
|
|
||||||
if (cq->is_tx)
|
if (cq->type != RX)
|
||||||
netif_tx_napi_add(cq->dev, &cq->napi, mlx4_en_poll_tx_cq,
|
netif_tx_napi_add(cq->dev, &cq->napi, mlx4_en_poll_tx_cq,
|
||||||
NAPI_POLL_WEIGHT);
|
NAPI_POLL_WEIGHT);
|
||||||
else
|
else
|
||||||
@ -181,7 +181,7 @@ void mlx4_en_destroy_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq **pcq)
|
|||||||
|
|
||||||
mlx4_free_hwq_res(mdev->dev, &cq->wqres, cq->buf_size);
|
mlx4_free_hwq_res(mdev->dev, &cq->wqres, cq->buf_size);
|
||||||
if (mlx4_is_eq_vector_valid(mdev->dev, priv->port, cq->vector) &&
|
if (mlx4_is_eq_vector_valid(mdev->dev, priv->port, cq->vector) &&
|
||||||
cq->is_tx == RX)
|
cq->type == RX)
|
||||||
mlx4_release_eq(priv->mdev->dev, cq->vector);
|
mlx4_release_eq(priv->mdev->dev, cq->vector);
|
||||||
cq->vector = 0;
|
cq->vector = 0;
|
||||||
cq->buf_size = 0;
|
cq->buf_size = 0;
|
||||||
@ -193,7 +193,7 @@ void mlx4_en_destroy_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq **pcq)
|
|||||||
void mlx4_en_deactivate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq)
|
void mlx4_en_deactivate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq)
|
||||||
{
|
{
|
||||||
napi_disable(&cq->napi);
|
napi_disable(&cq->napi);
|
||||||
if (!cq->is_tx) {
|
if (cq->type == RX) {
|
||||||
napi_hash_del(&cq->napi);
|
napi_hash_del(&cq->napi);
|
||||||
synchronize_rcu();
|
synchronize_rcu();
|
||||||
}
|
}
|
||||||
|
@ -207,8 +207,9 @@ enum {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
enum cq_type {
|
enum cq_type {
|
||||||
RX = 0,
|
TX,
|
||||||
TX = 1,
|
TX_XDP,
|
||||||
|
RX,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -361,7 +362,7 @@ struct mlx4_en_cq {
|
|||||||
int size;
|
int size;
|
||||||
int buf_size;
|
int buf_size;
|
||||||
int vector;
|
int vector;
|
||||||
enum cq_type is_tx;
|
enum cq_type type;
|
||||||
u16 moder_time;
|
u16 moder_time;
|
||||||
u16 moder_cnt;
|
u16 moder_cnt;
|
||||||
struct mlx4_cqe *buf;
|
struct mlx4_cqe *buf;
|
||||||
|
Loading…
Reference in New Issue
Block a user