summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5/mlx5_glue.c
diff options
context:
space:
mode:
authorDekel Peled <dekelp@mellanox.com>2018-11-01 11:37:27 +0200
committerFerruh Yigit <ferruh.yigit@intel.com>2018-11-05 15:01:25 +0100
commit56ef2c58159696ce37e4eedf769296a79e6a76a7 (patch)
treeb88ff6469ac6d4e76e4bf46d72ad1294dbe9162d /drivers/net/mlx5/mlx5_glue.c
parentbe685863a9ea636bf7924f0a8034bb4c21fb1402 (diff)
downloaddpdk-56ef2c58159696ce37e4eedf769296a79e6a76a7.zip
dpdk-56ef2c58159696ce37e4eedf769296a79e6a76a7.tar.gz
dpdk-56ef2c58159696ce37e4eedf769296a79e6a76a7.tar.xz
net/mlx5: add flow action functions to glue
This patch adds glue functions for operations: - Create packet reformat (encap/decap) flow action. - Destroy flow action. The new operations depend on HAVE_IBV_FLOW_DV_SUPPORT. Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
Diffstat (limited to 'drivers/net/mlx5/mlx5_glue.c')
-rw-r--r--drivers/net/mlx5/mlx5_glue.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/net/mlx5/mlx5_glue.c b/drivers/net/mlx5/mlx5_glue.c
index 1afb114..dd10ad6 100644
--- a/drivers/net/mlx5/mlx5_glue.c
+++ b/drivers/net/mlx5/mlx5_glue.c
@@ -174,6 +174,17 @@ mlx5_glue_destroy_flow(struct ibv_flow *flow_id)
return ibv_destroy_flow(flow_id);
}
+static int
+mlx5_glue_destroy_flow_action(struct ibv_flow_action *action)
+{
+#ifdef HAVE_IBV_FLOW_DV_SUPPORT
+ return ibv_destroy_flow_action(action);
+#else
+ (void)action;
+ return ENOTSUP;
+#endif
+}
+
static struct ibv_qp *
mlx5_glue_create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *qp_init_attr)
{
@@ -444,6 +455,30 @@ mlx5_glue_dv_destroy_flow_matcher(struct mlx5dv_flow_matcher *matcher)
#endif
}
+static struct ibv_flow_action *
+mlx5_glue_dv_create_flow_action_packet_reformat
+ (struct ibv_context *ctx,
+ size_t data_sz,
+ void *data,
+ enum mlx5dv_flow_action_packet_reformat_type reformat_type,
+ enum mlx5dv_flow_table_type ft_type)
+{
+#ifdef HAVE_IBV_FLOW_DV_SUPPORT
+ return mlx5dv_create_flow_action_packet_reformat(ctx,
+ data_sz,
+ data,
+ reformat_type,
+ ft_type);
+#else
+ (void)ctx;
+ (void)data_sz;
+ (void)data;
+ (void)reformat_type;
+ (void)ft_type;
+ return NULL;
+#endif
+}
+
alignas(RTE_CACHE_LINE_SIZE)
const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){
.version = MLX5_GLUE_VERSION,
@@ -470,6 +505,7 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){
.modify_wq = mlx5_glue_modify_wq,
.create_flow = mlx5_glue_create_flow,
.destroy_flow = mlx5_glue_destroy_flow,
+ .destroy_flow_action = mlx5_glue_destroy_flow_action,
.create_qp = mlx5_glue_create_qp,
.create_qp_ex = mlx5_glue_create_qp_ex,
.destroy_qp = mlx5_glue_destroy_qp,
@@ -497,4 +533,6 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){
.dv_create_flow_matcher = mlx5_glue_dv_create_flow_matcher,
.dv_destroy_flow_matcher = mlx5_glue_dv_destroy_flow_matcher,
.dv_create_flow = mlx5_glue_dv_create_flow,
+ .dv_create_flow_action_packet_reformat =
+ mlx5_glue_dv_create_flow_action_packet_reformat,
};