IB/mlx5: Enable WQ creation and modification with cvlan offload
Allow creating a WQ with cvlan stripping considering device's capabilities. The default value was fixed to disable vlan stripping till was asked explicitly. In addition, allow modification of a WQ to turn on/off this property. Signed-off-by: Noa Osherovich <noaos@mellanox.com> Reviewed-by: Maor Gottlieb <maorg@mellanox.com> Reviewed-by: Yishai Hadas <yishaih@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
e816133440
commit
b1f74a8437
|
@ -4624,9 +4624,20 @@ static int create_rq(struct mlx5_ib_rwq *rwq, struct ib_pd *pd,
|
||||||
MLX5_SET(wq, wq, log_wq_pg_sz, rwq->log_page_size);
|
MLX5_SET(wq, wq, log_wq_pg_sz, rwq->log_page_size);
|
||||||
MLX5_SET(wq, wq, wq_signature, rwq->wq_sig);
|
MLX5_SET(wq, wq, wq_signature, rwq->wq_sig);
|
||||||
MLX5_SET64(wq, wq, dbr_addr, rwq->db.dma);
|
MLX5_SET64(wq, wq, dbr_addr, rwq->db.dma);
|
||||||
|
if (init_attr->create_flags & IB_WQ_FLAGS_CVLAN_STRIPPING) {
|
||||||
|
if (!(MLX5_CAP_GEN(dev->mdev, eth_net_offloads) &&
|
||||||
|
MLX5_CAP_ETH(dev->mdev, vlan_cap))) {
|
||||||
|
mlx5_ib_dbg(dev, "VLAN offloads are not supported\n");
|
||||||
|
err = -EOPNOTSUPP;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
MLX5_SET(rqc, rqc, vsd, 1);
|
||||||
|
}
|
||||||
rq_pas0 = (__be64 *)MLX5_ADDR_OF(wq, wq, pas);
|
rq_pas0 = (__be64 *)MLX5_ADDR_OF(wq, wq, pas);
|
||||||
mlx5_ib_populate_pas(dev, rwq->umem, rwq->page_shift, rq_pas0, 0);
|
mlx5_ib_populate_pas(dev, rwq->umem, rwq->page_shift, rq_pas0, 0);
|
||||||
err = mlx5_core_create_rq_tracked(dev->mdev, in, inlen, &rwq->core_qp);
|
err = mlx5_core_create_rq_tracked(dev->mdev, in, inlen, &rwq->core_qp);
|
||||||
|
out:
|
||||||
kvfree(in);
|
kvfree(in);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -4910,6 +4921,22 @@ int mlx5_ib_modify_wq(struct ib_wq *wq, struct ib_wq_attr *wq_attr,
|
||||||
MLX5_SET(modify_rq_in, in, rq_state, curr_wq_state);
|
MLX5_SET(modify_rq_in, in, rq_state, curr_wq_state);
|
||||||
MLX5_SET(rqc, rqc, state, wq_state);
|
MLX5_SET(rqc, rqc, state, wq_state);
|
||||||
|
|
||||||
|
if (wq_attr_mask & IB_WQ_FLAGS) {
|
||||||
|
if (wq_attr->flags_mask & IB_WQ_FLAGS_CVLAN_STRIPPING) {
|
||||||
|
if (!(MLX5_CAP_GEN(dev->mdev, eth_net_offloads) &&
|
||||||
|
MLX5_CAP_ETH(dev->mdev, vlan_cap))) {
|
||||||
|
mlx5_ib_dbg(dev, "VLAN offloads are not "
|
||||||
|
"supported\n");
|
||||||
|
err = -EOPNOTSUPP;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
MLX5_SET64(modify_rq_in, in, modify_bitmask,
|
||||||
|
MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_VSD);
|
||||||
|
MLX5_SET(rqc, rqc, vsd,
|
||||||
|
(wq_attr->flags & IB_WQ_FLAGS_CVLAN_STRIPPING) ? 0 : 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (curr_wq_state == IB_WQS_RESET && wq_state == IB_WQS_RDY) {
|
if (curr_wq_state == IB_WQS_RESET && wq_state == IB_WQS_RDY) {
|
||||||
if (MLX5_CAP_GEN(dev->mdev, modify_rq_counter_set_id)) {
|
if (MLX5_CAP_GEN(dev->mdev, modify_rq_counter_set_id)) {
|
||||||
MLX5_SET64(modify_rq_in, in, modify_bitmask,
|
MLX5_SET64(modify_rq_in, in, modify_bitmask,
|
||||||
|
@ -4921,9 +4948,10 @@ int mlx5_ib_modify_wq(struct ib_wq *wq, struct ib_wq_attr *wq_attr,
|
||||||
}
|
}
|
||||||
|
|
||||||
err = mlx5_core_modify_rq(dev->mdev, rwq->core_qp.qpn, in, inlen);
|
err = mlx5_core_modify_rq(dev->mdev, rwq->core_qp.qpn, in, inlen);
|
||||||
kvfree(in);
|
|
||||||
if (!err)
|
if (!err)
|
||||||
rwq->ibwq.state = (wq_state == MLX5_RQC_STATE_ERR) ? IB_WQS_ERR : wq_state;
|
rwq->ibwq.state = (wq_state == MLX5_RQC_STATE_ERR) ? IB_WQS_ERR : wq_state;
|
||||||
|
|
||||||
|
out:
|
||||||
|
kvfree(in);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue