summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDekel Peled <dekelp@mellanox.com>2018-11-01 11:37:31 +0200
committerFerruh Yigit <ferruh.yigit@intel.com>2018-11-05 15:01:25 +0100
commit4b8727f08b5ec1aa18788254a887d2577bb6a2aa (patch)
tree104b1bbaa957e040ad3c9e7f1e3ec26ebf3db909 /drivers
parenta124cff00f6fe7ecdb640d8c08fbbc2ed95e5e63 (diff)
downloaddpdk-4b8727f08b5ec1aa18788254a887d2577bb6a2aa.zip
dpdk-4b8727f08b5ec1aa18788254a887d2577bb6a2aa.tar.gz
dpdk-4b8727f08b5ec1aa18788254a887d2577bb6a2aa.tar.xz
net/mlx5: add NVGRE decap action to Direct Verbs
This patch implements the NVGRE decap action in DV flow for MLX5 PMD. Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/mlx5/mlx5_flow.h4
-rw-r--r--drivers/net/mlx5/mlx5_flow_dv.c19
2 files changed, 17 insertions, 6 deletions
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 9a9500b..68f9227 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -95,6 +95,7 @@
#define MLX5_FLOW_ACTION_VXLAN_ENCAP (1u << 22)
#define MLX5_FLOW_ACTION_VXLAN_DECAP (1u << 23)
#define MLX5_FLOW_ACTION_NVGRE_ENCAP (1u << 24)
+#define MLX5_FLOW_ACTION_NVGRE_DECAP (1u << 25)
#define MLX5_FLOW_FATE_ACTIONS \
(MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | MLX5_FLOW_ACTION_RSS)
@@ -102,6 +103,9 @@
#define MLX5_FLOW_ENCAP_ACTIONS \
(MLX5_FLOW_ACTION_VXLAN_ENCAP | MLX5_FLOW_ACTION_NVGRE_ENCAP)
+#define MLX5_FLOW_DECAP_ACTIONS \
+ (MLX5_FLOW_ACTION_VXLAN_DECAP | MLX5_FLOW_ACTION_NVGRE_DECAP)
+
#ifndef IPPROTO_MPLS
#define IPPROTO_MPLS 137
#endif
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 4672ebc..156d0d0 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -127,8 +127,7 @@ flow_dv_validate_action_l2_encap(uint64_t action_flags,
return rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ACTION, NULL,
"can't drop and encap in same flow");
- if (action_flags & (MLX5_FLOW_ENCAP_ACTIONS |
- MLX5_FLOW_ACTION_VXLAN_DECAP))
+ if (action_flags & (MLX5_FLOW_ENCAP_ACTIONS | MLX5_FLOW_DECAP_ACTIONS))
return rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ACTION, NULL,
"can only have a single encap or"
@@ -164,8 +163,7 @@ flow_dv_validate_action_l2_decap(uint64_t action_flags,
return rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ACTION, NULL,
"can't drop and decap in same flow");
- if (action_flags & (MLX5_FLOW_ENCAP_ACTIONS |
- MLX5_FLOW_ACTION_VXLAN_DECAP))
+ if (action_flags & (MLX5_FLOW_ENCAP_ACTIONS | MLX5_FLOW_DECAP_ACTIONS))
return rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ACTION, NULL,
"can only have a single encap or"
@@ -745,11 +743,16 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
++actions_n;
break;
case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP:
+ case RTE_FLOW_ACTION_TYPE_NVGRE_DECAP:
ret = flow_dv_validate_action_l2_decap(action_flags,
attr, error);
if (ret < 0)
return ret;
- action_flags |= MLX5_FLOW_ACTION_VXLAN_DECAP;
+ action_flags |= actions->type ==
+ RTE_FLOW_ACTION_TYPE_VXLAN_DECAP ?
+ MLX5_FLOW_ACTION_VXLAN_DECAP :
+ MLX5_FLOW_ACTION_NVGRE_DECAP;
+
++actions_n;
break;
default:
@@ -1540,6 +1543,7 @@ flow_dv_create_action(struct rte_eth_dev *dev,
actions_n++;
break;
case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP:
+ case RTE_FLOW_ACTION_TYPE_NVGRE_DECAP:
dev_flow->dv.actions[actions_n].type =
MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION;
dev_flow->dv.actions[actions_n].action =
@@ -1548,7 +1552,10 @@ flow_dv_create_action(struct rte_eth_dev *dev,
return -rte_errno;
dev_flow->dv.encap_decap_verbs_action =
dev_flow->dv.actions[actions_n].action;
- flow->actions |= MLX5_FLOW_ACTION_VXLAN_DECAP;
+ flow->actions |= action->type ==
+ RTE_FLOW_ACTION_TYPE_VXLAN_DECAP ?
+ MLX5_FLOW_ACTION_VXLAN_DECAP :
+ MLX5_FLOW_ACTION_NVGRE_DECAP;
actions_n++;
break;
default: