[v5,2/7] net/mlx5: add VLAN push/pop DR commands to glue
Checks
Commit Message
This commit adds the mlx5dv VLAN push and pop commands to mlx5_glue
interface.
Signed-off-by: Moti Haimovsky <motih@mellanox.com>
---
drivers/net/mlx5/Makefile | 5 +++++
drivers/net/mlx5/meson.build | 2 ++
drivers/net/mlx5/mlx5_glue.c | 29 +++++++++++++++++++++++++++++
drivers/net/mlx5/mlx5_glue.h | 6 ++++++
4 files changed, 42 insertions(+)
Comments
> -----Original Message-----
> From: Moti Haimovsky <motih@mellanox.com>
> Sent: Monday, September 9, 2019 18:57
> To: Slava Ovsiienko <viacheslavo@mellanox.com>; Raslan Darawsheh
> <rasland@mellanox.com>
> Cc: dev@dpdk.org
> Subject: [PATCH v5 2/7] net/mlx5: add VLAN push/pop DR commands to glue
>
> This commit adds the mlx5dv VLAN push and pop commands to mlx5_glue
> interface.
>
> Signed-off-by: Moti Haimovsky <motih@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
> ---
> drivers/net/mlx5/Makefile | 5 +++++
> drivers/net/mlx5/meson.build | 2 ++
> drivers/net/mlx5/mlx5_glue.c | 29 +++++++++++++++++++++++++++++
> drivers/net/mlx5/mlx5_glue.h | 6 ++++++
> 4 files changed, 42 insertions(+)
>
> diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile index
> 9f6a7b4..d89a7b5 100644
> --- a/drivers/net/mlx5/Makefile
> +++ b/drivers/net/mlx5/Makefile
> @@ -164,6 +164,11 @@ mlx5_autoconf.h.new:
> $(RTE_SDK)/buildtools/auto-config-h.sh
> enum MLX5DV_DR_DOMAIN_TYPE_FDB \
> $(AUTOCONF_OUTPUT)
> $Q sh -- '$<' '$@' \
> + HAVE_MLX5DV_DR_VLAN \
> + infiniband/mlx5dv.h \
> + func mlx5dv_dr_action_create_push_vlan \
> + $(AUTOCONF_OUTPUT)
> + $Q sh -- '$<' '$@' \
> HAVE_IBV_DEVX_OBJ \
> infiniband/mlx5dv.h \
> func mlx5dv_devx_obj_create \
> diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
> index 3072c44..fb764fa 100644
> --- a/drivers/net/mlx5/meson.build
> +++ b/drivers/net/mlx5/meson.build
> @@ -132,6 +132,8 @@ if build
> 'MLX5DV_DR_DOMAIN_TYPE_NIC_RX' ],
> [ 'HAVE_MLX5DV_DR_ESWITCH', 'infiniband/mlx5dv.h',
> 'MLX5DV_DR_DOMAIN_TYPE_FDB' ],
> + [ 'HAVE_MLX5DV_DR_VLAN', 'infiniband/mlx5dv.h',
> + 'mlx5dv_dr_action_create_push_vlan' ],
> [ 'HAVE_SUPPORTED_40000baseKR4_Full', 'linux/ethtool.h',
> 'SUPPORTED_40000baseKR4_Full' ],
> [ 'HAVE_SUPPORTED_40000baseCR4_Full', 'linux/ethtool.h',
> diff --git a/drivers/net/mlx5/mlx5_glue.c b/drivers/net/mlx5/mlx5_glue.c
> index 50c369a..9ee37f4 100644
> --- a/drivers/net/mlx5/mlx5_glue.c
> +++ b/drivers/net/mlx5/mlx5_glue.c
> @@ -415,6 +415,31 @@
> }
>
> static void *
> +mlx5_glue_dr_create_flow_action_push_vlan(struct mlx5dv_dr_domain
> *domain,
> + rte_be32_t vlan_tag)
> +{
> +#ifdef HAVE_MLX5DV_DR_VLAN
> + return mlx5dv_dr_action_create_push_vlan(domain, vlan_tag); #else
> + (void)domain;
> + (void)vlan_tag;
> + errno = ENOTSUP;
> + return NULL;
> +#endif
> +}
> +
> +static void *
> +mlx5_glue_dr_create_flow_action_pop_vlan(void)
> +{
> +#ifdef HAVE_MLX5DV_DR_VLAN
> + return mlx5dv_dr_action_create_pop_vlan();
> +#else
> + errno = ENOTSUP;
> + return NULL;
> +#endif
> +}
> +
> +static void *
> mlx5_glue_dr_create_flow_tbl(void *domain, uint32_t level) { #ifdef
> HAVE_MLX5DV_DR @@ -1016,6 +1041,10 @@
> mlx5_glue_dr_create_flow_action_dest_vport,
> .dr_create_flow_action_drop =
> mlx5_glue_dr_create_flow_action_drop,
> + .dr_create_flow_action_push_vlan =
> + mlx5_glue_dr_create_flow_action_push_vlan,
> + .dr_create_flow_action_pop_vlan =
> + mlx5_glue_dr_create_flow_action_pop_vlan,
> .dr_create_flow_tbl = mlx5_glue_dr_create_flow_tbl,
> .dr_destroy_flow_tbl = mlx5_glue_dr_destroy_flow_tbl,
> .dr_create_domain = mlx5_glue_dr_create_domain, diff --git
> a/drivers/net/mlx5/mlx5_glue.h b/drivers/net/mlx5/mlx5_glue.h index
> 6b5dadf..82d6b10 100644
> --- a/drivers/net/mlx5/mlx5_glue.h
> +++ b/drivers/net/mlx5/mlx5_glue.h
> @@ -9,6 +9,8 @@
> #include <stddef.h>
> #include <stdint.h>
>
> +#include "rte_byteorder.h"
> +
> /* Verbs headers do not support -pedantic. */ #ifdef PEDANTIC #pragma
> GCC diagnostic ignored "-Wpedantic"
> @@ -156,6 +158,10 @@ struct mlx5_glue {
> void *(*dr_create_flow_action_dest_flow_tbl)(void *tbl);
> void *(*dr_create_flow_action_dest_vport)(void *domain, uint32_t
> vport);
> void *(*dr_create_flow_action_drop)();
> + void *(*dr_create_flow_action_push_vlan)
> + (struct mlx5dv_dr_domain *domain,
> + rte_be32_t vlan_tag);
> + void *(*dr_create_flow_action_pop_vlan)();
> void *(*dr_create_flow_tbl)(void *domain, uint32_t level);
> int (*dr_destroy_flow_tbl)(void *tbl);
> void *(*dr_create_domain)(struct ibv_context *ctx,
> --
> 1.8.3.1
@@ -164,6 +164,11 @@ mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh
enum MLX5DV_DR_DOMAIN_TYPE_FDB \
$(AUTOCONF_OUTPUT)
$Q sh -- '$<' '$@' \
+ HAVE_MLX5DV_DR_VLAN \
+ infiniband/mlx5dv.h \
+ func mlx5dv_dr_action_create_push_vlan \
+ $(AUTOCONF_OUTPUT)
+ $Q sh -- '$<' '$@' \
HAVE_IBV_DEVX_OBJ \
infiniband/mlx5dv.h \
func mlx5dv_devx_obj_create \
@@ -132,6 +132,8 @@ if build
'MLX5DV_DR_DOMAIN_TYPE_NIC_RX' ],
[ 'HAVE_MLX5DV_DR_ESWITCH', 'infiniband/mlx5dv.h',
'MLX5DV_DR_DOMAIN_TYPE_FDB' ],
+ [ 'HAVE_MLX5DV_DR_VLAN', 'infiniband/mlx5dv.h',
+ 'mlx5dv_dr_action_create_push_vlan' ],
[ 'HAVE_SUPPORTED_40000baseKR4_Full', 'linux/ethtool.h',
'SUPPORTED_40000baseKR4_Full' ],
[ 'HAVE_SUPPORTED_40000baseCR4_Full', 'linux/ethtool.h',
@@ -415,6 +415,31 @@
}
static void *
+mlx5_glue_dr_create_flow_action_push_vlan(struct mlx5dv_dr_domain *domain,
+ rte_be32_t vlan_tag)
+{
+#ifdef HAVE_MLX5DV_DR_VLAN
+ return mlx5dv_dr_action_create_push_vlan(domain, vlan_tag);
+#else
+ (void)domain;
+ (void)vlan_tag;
+ errno = ENOTSUP;
+ return NULL;
+#endif
+}
+
+static void *
+mlx5_glue_dr_create_flow_action_pop_vlan(void)
+{
+#ifdef HAVE_MLX5DV_DR_VLAN
+ return mlx5dv_dr_action_create_pop_vlan();
+#else
+ errno = ENOTSUP;
+ return NULL;
+#endif
+}
+
+static void *
mlx5_glue_dr_create_flow_tbl(void *domain, uint32_t level)
{
#ifdef HAVE_MLX5DV_DR
@@ -1016,6 +1041,10 @@
mlx5_glue_dr_create_flow_action_dest_vport,
.dr_create_flow_action_drop =
mlx5_glue_dr_create_flow_action_drop,
+ .dr_create_flow_action_push_vlan =
+ mlx5_glue_dr_create_flow_action_push_vlan,
+ .dr_create_flow_action_pop_vlan =
+ mlx5_glue_dr_create_flow_action_pop_vlan,
.dr_create_flow_tbl = mlx5_glue_dr_create_flow_tbl,
.dr_destroy_flow_tbl = mlx5_glue_dr_destroy_flow_tbl,
.dr_create_domain = mlx5_glue_dr_create_domain,
@@ -9,6 +9,8 @@
#include <stddef.h>
#include <stdint.h>
+#include "rte_byteorder.h"
+
/* Verbs headers do not support -pedantic. */
#ifdef PEDANTIC
#pragma GCC diagnostic ignored "-Wpedantic"
@@ -156,6 +158,10 @@ struct mlx5_glue {
void *(*dr_create_flow_action_dest_flow_tbl)(void *tbl);
void *(*dr_create_flow_action_dest_vport)(void *domain, uint32_t vport);
void *(*dr_create_flow_action_drop)();
+ void *(*dr_create_flow_action_push_vlan)
+ (struct mlx5dv_dr_domain *domain,
+ rte_be32_t vlan_tag);
+ void *(*dr_create_flow_action_pop_vlan)();
void *(*dr_create_flow_tbl)(void *domain, uint32_t level);
int (*dr_destroy_flow_tbl)(void *tbl);
void *(*dr_create_domain)(struct ibv_context *ctx,