$Q sh -- '$<' '$@' \
HAVE_MLX5DV_DR \
infiniband/mlx5dv.h \
- enum MLX5DV_DR_NS_TYPE_TERMINATING \
+ enum MLX5DV_DR_DOMAIN_TYPE_NIC_RX \
$(AUTOCONF_OUTPUT)
$Q sh -- '$<' '$@' \
HAVE_MLX5DV_DR_ESWITCH \
infiniband/mlx5dv.h \
- enum MLX5DV_DR_NS_DOMAIN_FDB_BYPASS \
+ enum MLX5DV_DR_DOMAIN_TYPE_FDB \
$(AUTOCONF_OUTPUT)
$Q sh -- '$<' '$@' \
HAVE_IBV_DEVX_OBJ \
[ 'HAVE_IBV_FLOW_DEVX_COUNTERS', 'infiniband/mlx5dv.h',
'MLX5DV_FLOW_ACTION_COUNTERS_DEVX' ],
[ 'HAVE_MLX5DV_DR', 'infiniband/mlx5dv.h',
- 'MLX5DV_DR_NS_TYPE_TERMINATING' ],
+ 'MLX5DV_DR_DOMAIN_TYPE_NIC_RX' ],
[ 'HAVE_MLX5DV_DR_ESWITCH', 'infiniband/mlx5dv.h',
- 'MLX5DV_DR_NS_DOMAIN_FDB_BYPASS' ],
+ 'MLX5DV_DR_DOMAIN_TYPE_FDB' ],
[ 'HAVE_SUPPORTED_40000baseKR4_Full', 'linux/ethtool.h',
'SUPPORTED_40000baseKR4_Full' ],
[ 'HAVE_SUPPORTED_40000baseCR4_Full', 'linux/ethtool.h',
#ifdef HAVE_MLX5DV_DR
struct mlx5_ibv_shared *sh = priv->sh;
int err = 0;
- void *ns;
+ void *domain;
assert(sh);
if (sh->dv_refcnt) {
return 0;
}
/* Reference counter is zero, we should initialize structures. */
- ns = mlx5_glue->dr_create_ns(sh->ctx,
- MLX5DV_DR_NS_DOMAIN_INGRESS_BYPASS);
- if (!ns) {
- DRV_LOG(ERR, "ingress mlx5dv_dr_create_ns failed");
+ domain = mlx5_glue->dr_create_domain(sh->ctx,
+ MLX5DV_DR_DOMAIN_TYPE_NIC_RX);
+ if (!domain) {
+ DRV_LOG(ERR, "ingress mlx5dv_dr_create_domain failed");
err = errno;
goto error;
}
- sh->rx_ns = ns;
- ns = mlx5_glue->dr_create_ns(sh->ctx,
- MLX5DV_DR_NS_DOMAIN_EGRESS_BYPASS);
- if (!ns) {
- DRV_LOG(ERR, "egress mlx5dv_dr_create_ns failed");
+ sh->rx_domain = domain;
+ domain = mlx5_glue->dr_create_domain(sh->ctx,
+ MLX5DV_DR_DOMAIN_TYPE_NIC_TX);
+ if (!domain) {
+ DRV_LOG(ERR, "egress mlx5dv_dr_create_domain failed");
err = errno;
goto error;
}
pthread_mutex_init(&sh->dv_mutex, NULL);
- sh->tx_ns = ns;
+ sh->tx_domain = domain;
#ifdef HAVE_MLX5DV_DR_ESWITCH
if (priv->config.dv_esw_en) {
- ns = mlx5_glue->dr_create_ns(sh->ctx,
- MLX5DV_DR_NS_DOMAIN_FDB_BYPASS);
- if (!ns) {
- DRV_LOG(ERR, "FDB mlx5dv_dr_create_ns failed");
+ domain = mlx5_glue->dr_create_domain
+ (sh->ctx, MLX5DV_DR_DOMAIN_TYPE_FDB);
+ if (!domain) {
+ DRV_LOG(ERR, "FDB mlx5dv_dr_create_domain failed");
err = errno;
goto error;
}
- sh->fdb_ns = ns;
+ sh->fdb_domain = domain;
sh->esw_drop_action = mlx5_glue->dr_create_flow_action_drop();
}
#endif
error:
/* Rollback the created objects. */
- if (sh->rx_ns) {
- mlx5_glue->dr_destroy_ns(sh->rx_ns);
- sh->rx_ns = NULL;
+ if (sh->rx_domain) {
+ mlx5_glue->dr_destroy_domain(sh->rx_domain);
+ sh->rx_domain = NULL;
}
- if (sh->tx_ns) {
- mlx5_glue->dr_destroy_ns(sh->tx_ns);
- sh->tx_ns = NULL;
+ if (sh->tx_domain) {
+ mlx5_glue->dr_destroy_domain(sh->tx_domain);
+ sh->tx_domain = NULL;
}
- if (sh->fdb_ns) {
- mlx5_glue->dr_destroy_ns(sh->fdb_ns);
- sh->fdb_ns = NULL;
+ if (sh->fdb_domain) {
+ mlx5_glue->dr_destroy_domain(sh->fdb_domain);
+ sh->fdb_domain = NULL;
}
if (sh->esw_drop_action) {
mlx5_glue->destroy_flow_action(sh->esw_drop_action);
assert(sh->dv_refcnt);
if (sh->dv_refcnt && --sh->dv_refcnt)
return;
- if (sh->rx_ns) {
- mlx5_glue->dr_destroy_ns(sh->rx_ns);
- sh->rx_ns = NULL;
+ if (sh->rx_domain) {
+ mlx5_glue->dr_destroy_domain(sh->rx_domain);
+ sh->rx_domain = NULL;
}
- if (sh->tx_ns) {
- mlx5_glue->dr_destroy_ns(sh->tx_ns);
- sh->tx_ns = NULL;
+ if (sh->tx_domain) {
+ mlx5_glue->dr_destroy_domain(sh->tx_domain);
+ sh->tx_domain = NULL;
}
#ifdef HAVE_MLX5DV_DR_ESWITCH
- if (sh->fdb_ns) {
- mlx5_glue->dr_destroy_ns(sh->fdb_ns);
- sh->fdb_ns = NULL;
+ if (sh->fdb_domain) {
+ mlx5_glue->dr_destroy_domain(sh->fdb_domain);
+ sh->fdb_domain = NULL;
}
if (sh->esw_drop_action) {
mlx5_glue->destroy_flow_action(sh->esw_drop_action);
/* Shared DV/DR flow data section. */
pthread_mutex_t dv_mutex; /* DV context mutex. */
uint32_t dv_refcnt; /* DV/DR data reference counter. */
- void *fdb_ns; /* FDB Direct Rules name space handle. */
+ void *fdb_domain; /* FDB Direct Rules name space handle. */
struct mlx5_flow_tbl_resource fdb_tbl[MLX5_MAX_TABLES_FDB];
/* FDB Direct Rules tables. */
- void *rx_ns; /* RX Direct Rules name space handle. */
+ void *rx_domain; /* RX Direct Rules name space handle. */
struct mlx5_flow_tbl_resource rx_tbl[MLX5_MAX_TABLES];
/* RX Direct Rules tables. */
- void *tx_ns; /* TX Direct Rules name space handle. */
+ void *tx_domain; /* TX Direct Rules name space handle. */
struct mlx5_flow_tbl_resource tx_tbl[MLX5_MAX_TABLES];
void *esw_drop_action; /* Pointer to DR E-Switch drop action. */
/* TX Direct Rules tables/ */
#endif
#ifndef HAVE_MLX5DV_DR_ESWITCH
+#ifndef MLX5DV_FLOW_TABLE_TYPE_FDB
#define MLX5DV_FLOW_TABLE_TYPE_FDB 0
#endif
+#endif
#ifndef HAVE_MLX5DV_DR
#define MLX5DV_DR_ACTION_FLAGS_ROOT_LEVEL 1
struct mlx5_ibv_shared *sh = priv->sh;
struct mlx5_flow_dv_encap_decap_resource *cache_resource;
struct rte_flow *flow = dev_flow->flow;
- struct mlx5dv_dr_ns *ns;
+ struct mlx5dv_dr_domain *domain;
resource->flags = flow->group ? 0 : 1;
if (resource->ft_type == MLX5DV_FLOW_TABLE_TYPE_FDB)
- ns = sh->fdb_ns;
+ domain = sh->fdb_domain;
else if (resource->ft_type == MLX5DV_FLOW_TABLE_TYPE_NIC_RX)
- ns = sh->rx_ns;
+ domain = sh->rx_domain;
else
- ns = sh->tx_ns;
+ domain = sh->tx_domain;
/* Lookup a matching resource from cache. */
LIST_FOREACH(cache_resource, &sh->encaps_decaps, next) {
cache_resource->verbs_action =
mlx5_glue->dv_create_flow_action_packet_reformat
(sh->ctx, cache_resource->reformat_type,
- cache_resource->ft_type, ns, cache_resource->flags,
+ cache_resource->ft_type, domain, cache_resource->flags,
cache_resource->size,
(cache_resource->size ? cache_resource->buf : NULL));
if (!cache_resource->verbs_action) {
"cannot allocate resource memory");
*cache_resource = *resource;
cache_resource->action =
- mlx5_glue->dr_create_flow_action_dest_vport(priv->sh->fdb_ns,
- resource->port_id);
+ mlx5_glue->dr_create_flow_action_dest_vport
+ (priv->sh->fdb_domain, resource->port_id);
if (!cache_resource->action) {
rte_free(cache_resource);
return rte_flow_error_set(error, ENOMEM,
struct mlx5_priv *priv = dev->data->dev_private;
struct mlx5_ibv_shared *sh = priv->sh;
struct mlx5_flow_dv_modify_hdr_resource *cache_resource;
- struct mlx5dv_dr_ns *ns;
+ struct mlx5dv_dr_domain *ns;
if (resource->ft_type == MLX5DV_FLOW_TABLE_TYPE_FDB)
- ns = sh->fdb_ns;
+ ns = sh->fdb_domain;
else if (resource->ft_type == MLX5DV_FLOW_TABLE_TYPE_NIC_TX)
- ns = sh->tx_ns;
+ ns = sh->tx_domain;
else
- ns = sh->rx_ns;
+ ns = sh->rx_domain;
resource->flags =
dev_flow->flow->group ? 0 : MLX5DV_DR_ACTION_FLAGS_ROOT_LEVEL;
/* Lookup a matching resource from cache. */
tbl = &sh->fdb_tbl[table_id];
if (!tbl->obj)
tbl->obj = mlx5_glue->dr_create_flow_tbl
- (sh->fdb_ns, table_id);
+ (sh->fdb_domain, table_id);
} else if (egress) {
tbl = &sh->tx_tbl[table_id];
if (!tbl->obj)
tbl->obj = mlx5_glue->dr_create_flow_tbl
- (sh->tx_ns, table_id);
+ (sh->tx_domain, table_id);
} else {
tbl = &sh->rx_tbl[table_id];
if (!tbl->obj)
tbl->obj = mlx5_glue->dr_create_flow_tbl
- (sh->rx_ns, table_id);
+ (sh->rx_domain, table_id);
}
if (!tbl->obj) {
rte_flow_error_set(error, ENOMEM,
{
#ifdef HAVE_IBV_FLOW_DV_SUPPORT
#ifdef HAVE_MLX5DV_DR
- return mlx5dv_dr_destroy_action(action);
+ return mlx5dv_dr_action_destroy(action);
#else
struct mlx5dv_flow_action_attr *attr = action;
int res = 0;
mlx5_glue_dr_create_flow_action_dest_flow_tbl(void *tbl)
{
#ifdef HAVE_MLX5DV_DR
- return mlx5dv_dr_create_action_dest_flow_table(tbl);
+ return mlx5dv_dr_action_create_dest_table(tbl);
#else
(void)tbl;
return NULL;
}
static void *
-mlx5_glue_dr_create_flow_action_dest_vport(void *ns, uint32_t vport)
+mlx5_glue_dr_create_flow_action_dest_vport(void *domain, uint32_t vport)
{
#ifdef HAVE_MLX5DV_DR_ESWITCH
- return mlx5dv_dr_create_action_dest_vport(ns, vport);
+ return mlx5dv_dr_action_create_dest_vport(domain, vport);
#else
- (void)ns;
+ (void)domain;
(void)vport;
return NULL;
#endif
mlx5_glue_dr_create_flow_action_drop(void)
{
#ifdef HAVE_MLX5DV_DR_ESWITCH
- return mlx5dv_dr_create_action_drop();
+ return mlx5dv_dr_action_create_drop();
#else
return NULL;
#endif
}
static void *
-mlx5_glue_dr_create_flow_tbl(void *ns, uint32_t level)
+mlx5_glue_dr_create_flow_tbl(void *domain, uint32_t level)
{
#ifdef HAVE_MLX5DV_DR
- return mlx5dv_dr_create_ft(ns, level);
+ return mlx5dv_dr_table_create(domain, level);
#else
- (void)ns;
+ (void)domain;
(void)level;
return NULL;
#endif
mlx5_glue_dr_destroy_flow_tbl(void *tbl)
{
#ifdef HAVE_MLX5DV_DR
- return mlx5dv_dr_destroy_ft(tbl);
+ return mlx5dv_dr_table_destroy(tbl);
#else
(void)tbl;
return 0;
}
static void *
-mlx5_glue_dr_create_ns(struct ibv_context *ctx,
- enum mlx5dv_dr_ns_domain domain)
+mlx5_glue_dr_create_domain(struct ibv_context *ctx,
+ enum mlx5dv_dr_domain_type domain)
{
#ifdef HAVE_MLX5DV_DR
- return mlx5dv_dr_create_ns(ctx, domain);
+ return mlx5dv_dr_domain_create(ctx, domain);
#else
(void)ctx;
(void)domain;
}
static int
-mlx5_glue_dr_destroy_ns(void *ns)
+mlx5_glue_dr_destroy_domain(void *domain)
{
#ifdef HAVE_MLX5DV_DR
- return mlx5dv_dr_destroy_ns(ns);
+ return mlx5dv_dr_domain_destroy(domain);
#else
- (void)ns;
+ (void)domain;
return 0;
#endif
}
#ifdef HAVE_IBV_FLOW_DV_SUPPORT
#ifdef HAVE_MLX5DV_DR
(void)context;
- return mlx5dv_dr_create_matcher(tbl, matcher_attr->priority,
- matcher_attr->match_criteria_enable,
- matcher_attr->match_mask);
+ return mlx5dv_dr_matcher_create(tbl, matcher_attr->priority,
+ matcher_attr->match_criteria_enable,
+ matcher_attr->match_mask);
#else
(void)tbl;
return mlx5dv_create_flow_matcher(context, matcher_attr);
{
#ifdef HAVE_IBV_FLOW_DV_SUPPORT
#ifdef HAVE_MLX5DV_DR
- return mlx5dv_dr_create_rule(matcher, match_value, num_actions,
+ return mlx5dv_dr_rule_create(matcher, match_value, num_actions,
(struct mlx5dv_dr_action **)actions);
#else
struct mlx5dv_flow_action_attr actions_attr[8];
{
#ifdef HAVE_IBV_FLOW_DV_SUPPORT
#ifdef HAVE_MLX5DV_DR
- return mlx5dv_dr_create_action_devx_counter(counter_obj, offset);
+ return mlx5dv_dr_action_create_flow_counter(counter_obj, offset);
#else
struct mlx5dv_flow_action_attr *action;
{
#ifdef HAVE_IBV_FLOW_DV_SUPPORT
#ifdef HAVE_MLX5DV_DR
- return mlx5dv_dr_create_action_dest_ibv_qp(qp);
+ return mlx5dv_dr_action_create_dest_ibv_qp(qp);
#else
struct mlx5dv_flow_action_attr *action;
mlx5_glue_dv_create_flow_action_modify_header
(struct ibv_context *ctx,
enum mlx5dv_flow_table_type ft_type,
- void *ns, uint64_t flags,
+ void *domain, uint64_t flags,
size_t actions_sz,
uint64_t actions[])
{
#ifdef HAVE_MLX5DV_DR
(void)ctx;
(void)ft_type;
- return mlx5dv_dr_create_action_modify_header(ns, flags, actions_sz,
- actions);
+ return mlx5dv_dr_action_create_modify_header(domain, flags, actions_sz,
+ (__be64 *)actions);
#else
struct mlx5dv_flow_action_attr *action;
- (void)ns;
+ (void)domain;
(void)flags;
action = malloc(sizeof(*action));
if (!action)
#else
(void)ctx;
(void)ft_type;
- (void)ns;
+ (void)domain;
(void)flags;
(void)actions_sz;
(void)actions;
mlx5_glue_dv_create_flow_action_packet_reformat
(struct ibv_context *ctx,
enum mlx5dv_flow_action_packet_reformat_type reformat_type,
- enum mlx5dv_flow_table_type ft_type, struct mlx5dv_dr_ns *ns,
+ enum mlx5dv_flow_table_type ft_type,
+ struct mlx5dv_dr_domain *domain,
uint32_t flags, size_t data_sz, void *data)
{
#ifdef HAVE_IBV_FLOW_DV_SUPPORT
#ifdef HAVE_MLX5DV_DR
(void)ctx;
(void)ft_type;
- return mlx5dv_dr_create_action_packet_reformat(ns, flags,
+ return mlx5dv_dr_action_create_packet_reformat(domain, flags,
reformat_type, data_sz,
data);
#else
- (void)ns;
+ (void)domain;
(void)flags;
struct mlx5dv_flow_action_attr *action;
(void)ctx;
(void)reformat_type;
(void)ft_type;
- (void)ns;
+ (void)domain;
(void)flags;
(void)data_sz;
(void)data;
{
#ifdef HAVE_IBV_FLOW_DV_SUPPORT
#ifdef HAVE_MLX5DV_DR
- return mlx5dv_dr_create_action_tag(tag);
+ return mlx5dv_dr_action_create_tag(tag);
#else
struct mlx5dv_flow_action_attr *action;
action = malloc(sizeof(*action));
mlx5_glue_dv_destroy_flow(void *flow_id)
{
#ifdef HAVE_MLX5DV_DR
- return mlx5dv_dr_destroy_rule(flow_id);
+ return mlx5dv_dr_rule_destroy(flow_id);
#else
return ibv_destroy_flow(flow_id);
#endif
{
#ifdef HAVE_IBV_FLOW_DV_SUPPORT
#ifdef HAVE_MLX5DV_DR
- return mlx5dv_dr_destroy_matcher(matcher);
+ return mlx5dv_dr_matcher_destroy(matcher);
#else
return mlx5dv_destroy_flow_matcher(matcher);
#endif
mlx5_glue_dr_create_flow_action_drop,
.dr_create_flow_tbl = mlx5_glue_dr_create_flow_tbl,
.dr_destroy_flow_tbl = mlx5_glue_dr_destroy_flow_tbl,
- .dr_create_ns = mlx5_glue_dr_create_ns,
- .dr_destroy_ns = mlx5_glue_dr_destroy_ns,
+ .dr_create_domain = mlx5_glue_dr_create_domain,
+ .dr_destroy_domain = mlx5_glue_dr_destroy_domain,
.dv_create_cq = mlx5_glue_dv_create_cq,
.dv_create_wq = mlx5_glue_dv_create_wq,
.dv_query_device = mlx5_glue_dv_query_device,
#endif
#ifndef HAVE_MLX5DV_DR
-struct mlx5dv_dr_ns;
-enum mlx5dv_dr_ns_domain { unused, };
+enum mlx5dv_dr_domain_type { unused, };
+struct mlx5dv_dr_domain;
#endif
/* LIB_GLUE_VERSION must be updated every time this structure is modified. */
const char *(*port_state_str)(enum ibv_port_state port_state);
struct ibv_cq *(*cq_ex_to_cq)(struct ibv_cq_ex *cq);
void *(*dr_create_flow_action_dest_flow_tbl)(void *tbl);
- void *(*dr_create_flow_action_dest_vport)(void *ns, uint32_t vport);
+ void *(*dr_create_flow_action_dest_vport)(void *domain, uint32_t vport);
void *(*dr_create_flow_action_drop)();
- void *(*dr_create_flow_tbl)(void *ns, uint32_t level);
+ void *(*dr_create_flow_tbl)(void *domain, uint32_t level);
int (*dr_destroy_flow_tbl)(void *tbl);
- void *(*dr_create_ns)(struct ibv_context *ctx,
- enum mlx5dv_dr_ns_domain domain);
- int (*dr_destroy_ns)(void *ns);
+ void *(*dr_create_domain)(struct ibv_context *ctx,
+ enum mlx5dv_dr_domain_type domain);
+ int (*dr_destroy_domain)(void *domain);
struct ibv_cq_ex *(*dv_create_cq)
(struct ibv_context *context,
struct ibv_cq_init_attr_ex *cq_attr,
void *(*dv_create_flow_action_dest_ibv_qp)(void *qp);
void *(*dv_create_flow_action_modify_header)
(struct ibv_context *ctx, enum mlx5dv_flow_table_type ft_type,
- void *ns, uint64_t flags, size_t actions_sz,
+ void *domain, uint64_t flags, size_t actions_sz,
uint64_t actions[]);
void *(*dv_create_flow_action_packet_reformat)
(struct ibv_context *ctx,
enum mlx5dv_flow_action_packet_reformat_type reformat_type,
- enum mlx5dv_flow_table_type ft_type, struct mlx5dv_dr_ns *ns,
+ enum mlx5dv_flow_table_type ft_type,
+ struct mlx5dv_dr_domain *domain,
uint32_t flags, size_t data_sz, void *data);
void *(*dv_create_flow_action_tag)(uint32_t tag);
int (*dv_destroy_flow)(void *flow);