[2/4] net/mlx5: add definitions for DV encap and decap
Checks
Commit Message
This patch add the required definitions for DV encap/decap actions.
It also adds usage of the new actions definition in validation
function of existing drop operation.
Signed-off-by: Dekel Peled <dekelp@mellanox.com>
---
drivers/net/mlx5/mlx5_flow.c | 10 ++++++++++
drivers/net/mlx5/mlx5_flow.h | 7 +++++++
2 files changed, 17 insertions(+)
Comments
On Thu, Sep 27, 2018 at 05:50:43PM +0300, Dekel Peled wrote:
> This patch add the required definitions for DV encap/decap actions.
> It also adds usage of the new actions definition in validation
> function of existing drop operation.
>
> Signed-off-by: Dekel Peled <dekelp@mellanox.com>
> ---
> drivers/net/mlx5/mlx5_flow.c | 10 ++++++++++
> drivers/net/mlx5/mlx5_flow.h | 7 +++++++
> 2 files changed, 17 insertions(+)
>
> diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
> index 79a06df..fed0d29 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -768,6 +768,16 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
> RTE_FLOW_ERROR_TYPE_ACTION, NULL,
> "can't have 2 fate actions in"
> " same flow");
> + if (action_flags & (MLX5_ACTION_TUNNEL_DECAP |
> + MLX5_ACTION_TUNNEL_DECAP_L3 |
> + MLX5_ACTION_TUNNEL_ENCAP |
> + MLX5_ACTION_TUNNEL_ENCAP_L3))
> + return rte_flow_error_set(error,
> + ENOTSUP,
Shouldn't it be EINVAL?
> + RTE_FLOW_ERROR_TYPE_ACTION,
> + NULL,
> + "can't encap or decap and drop in"
> + " same flow");
> if (attr->egress)
> return rte_flow_error_set(error, ENOTSUP,
> RTE_FLOW_ERROR_TYPE_ATTR_EGRESS,
> diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
> index a353d07..4a4f923 100644
> --- a/drivers/net/mlx5/mlx5_flow.h
> +++ b/drivers/net/mlx5/mlx5_flow.h
> @@ -90,6 +90,10 @@
> #define MLX5_ACTION_OF_PUSH_VLAN (1u << 8)
> #define MLX5_ACTION_OF_SET_VLAN_VID (1u << 9)
> #define MLX5_ACTION_OF_SET_VLAN_PCP (1u << 10)
> +#define MLX5_ACTION_TUNNEL_ENCAP (1u << 11)
> +#define MLX5_ACTION_TUNNEL_DECAP (1u << 12)
> +#define MLX5_ACTION_TUNNEL_ENCAP_L3 (1u << 13)
> +#define MLX5_ACTION_TUNNEL_DECAP_L3 (1u << 14)
Please rebase it on top of my multi-table patchset, which is PR #878 because it
also adds new actions.
>
> /* possible L3 layers protocols filtering. */
> #define MLX5_IP_PROTOCOL_TCP 6
> @@ -175,6 +179,9 @@ struct mlx5_flow_dv {
> #ifdef HAVE_IBV_FLOW_DV_SUPPORT
> struct mlx5dv_flow_action_attr actions[MLX5_DV_MAX_NUMBER_OF_ACTIONS];
> /**< Action list. */
> +
No blank line.
> + struct ibv_flow_action *encap_verb; /**< Verbs object of encap. */
> + struct ibv_flow_action *decap_verb; /**< Verbs object of decap. */
> #endif
> int actions_n; /**< number of actions. */
> };
> --
> 1.8.3.1
>
Thanks, PSB.
> -----Original Message-----
> From: Yongseok Koh
> Sent: Wednesday, October 3, 2018 5:59 AM
> To: Dekel Peled <dekelp@mellanox.com>
> Cc: dev@dpdk.org; Shahaf Shuler <shahafs@mellanox.com>; Ori Kam
> <orika@mellanox.com>
> Subject: Re: [PATCH 2/4] net/mlx5: add definitions for DV encap and decap
>
> On Thu, Sep 27, 2018 at 05:50:43PM +0300, Dekel Peled wrote:
> > This patch add the required definitions for DV encap/decap actions.
> > It also adds usage of the new actions definition in validation
> > function of existing drop operation.
> >
> > Signed-off-by: Dekel Peled <dekelp@mellanox.com>
> > ---
> > drivers/net/mlx5/mlx5_flow.c | 10 ++++++++++
> > drivers/net/mlx5/mlx5_flow.h | 7 +++++++
> > 2 files changed, 17 insertions(+)
> >
> > diff --git a/drivers/net/mlx5/mlx5_flow.c
> > b/drivers/net/mlx5/mlx5_flow.c index 79a06df..fed0d29 100644
> > --- a/drivers/net/mlx5/mlx5_flow.c
> > +++ b/drivers/net/mlx5/mlx5_flow.c
> > @@ -768,6 +768,16 @@ uint32_t mlx5_flow_adjust_priority(struct
> rte_eth_dev *dev, int32_t priority,
> > RTE_FLOW_ERROR_TYPE_ACTION,
> NULL,
> > "can't have 2 fate actions in"
> > " same flow");
> > + if (action_flags & (MLX5_ACTION_TUNNEL_DECAP |
> > + MLX5_ACTION_TUNNEL_DECAP_L3 |
> > + MLX5_ACTION_TUNNEL_ENCAP |
> > + MLX5_ACTION_TUNNEL_ENCAP_L3))
> > + return rte_flow_error_set(error,
> > + ENOTSUP,
>
> Shouldn't it be EINVAL?
OK.
>
> > + RTE_FLOW_ERROR_TYPE_ACTION,
> > + NULL,
> > + "can't encap or decap and drop in"
> > + " same flow");
> > if (attr->egress)
> > return rte_flow_error_set(error, ENOTSUP,
> >
> RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, diff --git
> > a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index
> > a353d07..4a4f923 100644
> > --- a/drivers/net/mlx5/mlx5_flow.h
> > +++ b/drivers/net/mlx5/mlx5_flow.h
> > @@ -90,6 +90,10 @@
> > #define MLX5_ACTION_OF_PUSH_VLAN (1u << 8) #define
> > MLX5_ACTION_OF_SET_VLAN_VID (1u << 9) #define
> > MLX5_ACTION_OF_SET_VLAN_PCP (1u << 10)
> > +#define MLX5_ACTION_TUNNEL_ENCAP (1u << 11) #define
> > +MLX5_ACTION_TUNNEL_DECAP (1u << 12) #define
> > +MLX5_ACTION_TUNNEL_ENCAP_L3 (1u << 13) #define
> > +MLX5_ACTION_TUNNEL_DECAP_L3 (1u << 14)
>
> Please rebase it on top of my multi-table patchset, which is PR #878 because
> it also adds new actions.
Will do.
> >
> > /* possible L3 layers protocols filtering. */ #define
> > MLX5_IP_PROTOCOL_TCP 6 @@ -175,6 +179,9 @@ struct mlx5_flow_dv {
> > #ifdef HAVE_IBV_FLOW_DV_SUPPORT
> > struct mlx5dv_flow_action_attr
> actions[MLX5_DV_MAX_NUMBER_OF_ACTIONS];
> > /**< Action list. */
> > +
>
> No blank line.
OK.
>
> > + struct ibv_flow_action *encap_verb; /**< Verbs object of encap. */
> > + struct ibv_flow_action *decap_verb; /**< Verbs object of decap. */
> > #endif
> > int actions_n; /**< number of actions. */ };
> > --
> > 1.8.3.1
> >
@@ -768,6 +768,16 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
RTE_FLOW_ERROR_TYPE_ACTION, NULL,
"can't have 2 fate actions in"
" same flow");
+ if (action_flags & (MLX5_ACTION_TUNNEL_DECAP |
+ MLX5_ACTION_TUNNEL_DECAP_L3 |
+ MLX5_ACTION_TUNNEL_ENCAP |
+ MLX5_ACTION_TUNNEL_ENCAP_L3))
+ return rte_flow_error_set(error,
+ ENOTSUP,
+ RTE_FLOW_ERROR_TYPE_ACTION,
+ NULL,
+ "can't encap or decap and drop in"
+ " same flow");
if (attr->egress)
return rte_flow_error_set(error, ENOTSUP,
RTE_FLOW_ERROR_TYPE_ATTR_EGRESS,
@@ -90,6 +90,10 @@
#define MLX5_ACTION_OF_PUSH_VLAN (1u << 8)
#define MLX5_ACTION_OF_SET_VLAN_VID (1u << 9)
#define MLX5_ACTION_OF_SET_VLAN_PCP (1u << 10)
+#define MLX5_ACTION_TUNNEL_ENCAP (1u << 11)
+#define MLX5_ACTION_TUNNEL_DECAP (1u << 12)
+#define MLX5_ACTION_TUNNEL_ENCAP_L3 (1u << 13)
+#define MLX5_ACTION_TUNNEL_DECAP_L3 (1u << 14)
/* possible L3 layers protocols filtering. */
#define MLX5_IP_PROTOCOL_TCP 6
@@ -175,6 +179,9 @@ struct mlx5_flow_dv {
#ifdef HAVE_IBV_FLOW_DV_SUPPORT
struct mlx5dv_flow_action_attr actions[MLX5_DV_MAX_NUMBER_OF_ACTIONS];
/**< Action list. */
+
+ struct ibv_flow_action *encap_verb; /**< Verbs object of encap. */
+ struct ibv_flow_action *decap_verb; /**< Verbs object of decap. */
#endif
int actions_n; /**< number of actions. */
};