1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2020 Mellanox Technologies, Ltd
12 #include "mlx5_autoconf.h"
15 #include <rte_malloc.h>
16 #include <rte_ethdev_driver.h>
17 #include <rte_common.h>
19 #include <mlx5_glue.h>
20 #include <mlx5_common.h>
21 #include <mlx5_common_mr.h>
22 #include <mlx5_rxtx.h>
23 #include <mlx5_verbs.h>
25 * Register mr. Given protection domain pointer, pointer to addr and length
26 * register the memory region.
29 * Pointer to protection domain context.
31 * Pointer to memory start address.
33 * Length of the memory to register.
35 * pmd_mr struct set with lkey, address, length and pointer to mr object
38 * 0 on successful registration, -1 otherwise
41 mlx5_reg_mr(void *pd, void *addr, size_t length,
42 struct mlx5_pmd_mr *pmd_mr)
44 return mlx5_common_verbs_reg_mr(pd, addr, length, pmd_mr);
48 * Deregister mr. Given the mlx5 pmd MR - deregister the MR
51 * pmd_mr struct set with lkey, address, length and pointer to mr object
55 mlx5_dereg_mr(struct mlx5_pmd_mr *pmd_mr)
57 mlx5_common_verbs_dereg_mr(pmd_mr);
60 /* verbs operations. */
61 const struct mlx5_verbs_ops mlx5_verbs_ops = {
62 .reg_mr = mlx5_reg_mr,
63 .dereg_mr = mlx5_dereg_mr,
67 * Modify Rx WQ vlan stripping offload
72 * @return 0 on success, non-0 otherwise
75 mlx5_rxq_obj_modify_wq_vlan_strip(struct mlx5_rxq_obj *rxq_obj, int on)
77 uint16_t vlan_offloads =
78 (on ? IBV_WQ_FLAGS_CVLAN_STRIPPING : 0) |
80 struct ibv_wq_attr mod;
81 mod = (struct ibv_wq_attr){
82 .attr_mask = IBV_WQ_ATTR_FLAGS,
83 .flags_mask = IBV_WQ_FLAGS_CVLAN_STRIPPING,
84 .flags = vlan_offloads,
86 return mlx5_glue->modify_wq(rxq_obj->wq, &mod);
89 struct mlx5_obj_ops ibv_obj_ops = {
90 .rxq_obj_modify_vlan_strip = mlx5_rxq_obj_modify_wq_vlan_strip,