net/mlx5: separate VLAN strip modification
[dpdk.git] / drivers / net / mlx5 / mlx5_devx.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2020 Mellanox Technologies, Ltd
3  */
4
5 #include <stddef.h>
6 #include <errno.h>
7 #include <string.h>
8 #include <stdint.h>
9 #include <sys/queue.h>
10
11 #include <rte_malloc.h>
12 #include <rte_common.h>
13 #include <rte_eal_paging.h>
14
15 #include <mlx5_glue.h>
16 #include <mlx5_devx_cmds.h>
17 #include <mlx5_malloc.h>
18
19 #include "mlx5.h"
20 #include "mlx5_common_os.h"
21 #include "mlx5_rxtx.h"
22 #include "mlx5_utils.h"
23 #include "mlx5_devx.h"
24
25 /**
26  * Modify RQ vlan stripping offload
27  *
28  * @param rxq_obj
29  *   Rx queue object.
30  *
31  * @return 0 on success, non-0 otherwise
32  */
33 static int
34 mlx5_rxq_obj_modify_rq_vlan_strip(struct mlx5_rxq_obj *rxq_obj, int on)
35 {
36         struct mlx5_devx_modify_rq_attr rq_attr;
37
38         memset(&rq_attr, 0, sizeof(rq_attr));
39         rq_attr.rq_state = MLX5_RQC_STATE_RDY;
40         rq_attr.state = MLX5_RQC_STATE_RDY;
41         rq_attr.vsd = (on ? 0 : 1);
42         rq_attr.modify_bitmask = MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_VSD;
43         return mlx5_devx_cmd_modify_rq(rxq_obj->rq, &rq_attr);
44 }
45
46 struct mlx5_obj_ops devx_obj_ops = {
47         .rxq_obj_modify_vlan_strip = mlx5_rxq_obj_modify_rq_vlan_strip,
48 };