From: Suanming Mou <suanmingm@mellanox.com>
To: Matan Azrad <matan@mellanox.com>,
Slava Ovsiienko <viacheslavo@mellanox.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
Raslan Darawsheh <rasland@mellanox.com>,
"stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 2/2] net/mlx5: fix lack of match information in meter
Date: Thu, 20 Feb 2020 03:54:15 +0000 [thread overview]
Message-ID: <HE1PR05MB348449314DABA887E95A5E0FCC130@HE1PR05MB3484.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <AM0PR0502MB401978C95AB98DB683859E02D2100@AM0PR0502MB4019.eurprd05.prod.outlook.com>
> -----Original Message-----
> From: Matan Azrad <matan@mellanox.com>
> Sent: Wednesday, February 19, 2020 11:31 PM
> To: Suanming Mou <suanmingm@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@mellanox.com>;
> stable@dpdk.org
> Subject: RE: [PATCH 2/2] net/mlx5: fix lack of match information in meter
>
>
> Hi Mou
>
> One comment inline.
>
> From: Suanming Mou
> > As meter flows are split into three subflows each, the prefix subflow
> > with meter action color the packet, the meter subflow filters out the
> > colored packets, the suffix subflow applies all the remaining actions
> > to the passed packets.
> >
> > Currently, all the user defined items are matched in the prefix flow.
> > Flow id tag match item is the only item added to the meter suffix subflow.
> > Some of the remaining actions to be applied in the suffix subflow
> > require more information in the match item, or the suffix subflow will
> > not be created successfully.
> >
> > Actions require the L3/L4 type in the match items as below:
> > RTE_FLOW_ACTION_TYPE_SET_TP_SRC
> > RTE_FLOW_ACTION_TYPE_SET_TP_DST
> > RTE_FLOW_ACTION_TYPE_DEC_TTL
> > RTE_FLOW_ACTION_TYPE_SET_TTL
> > RTE_FLOW_ACTION_TYPE_RSS
> > RTE_FLOW_ACTION_TYPE_QUEUE
> >
> > Inherit the match item flags from meter prefix subflow to make actions
> > in suffix subflow get sufficient information.
> >
> > Fixes: 9ea9b049a960 ("net/mlx5: split meter flow")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
> > ---
> > drivers/net/mlx5/mlx5_flow.c | 22 +++++++++++----
> > drivers/net/mlx5/mlx5_flow_dv.c | 62
> > +++++++++++++++++++++++++++++++----------
> > 2 files changed, 65 insertions(+), 19 deletions(-)
> >
> > diff --git a/drivers/net/mlx5/mlx5_flow.c
> > b/drivers/net/mlx5/mlx5_flow.c index 2f57759..f533f78 100644
> > --- a/drivers/net/mlx5/mlx5_flow.c
> > +++ b/drivers/net/mlx5/mlx5_flow.c
> > @@ -3440,8 +3440,18 @@ uint32_t mlx5_flow_adjust_priority(struct
> > rte_eth_dev *dev, int32_t priority,
> > dev_flow->external = external;
> > /* Subflow object was created, we must include one in the list. */
> > LIST_INSERT_HEAD(&flow->dev_flows, dev_flow, next);
> > - if (prefix_flow)
> > + if (prefix_flow) {
> > + /*
> > + * Some suffix subflow need the item flags and decap action
> > + * flag to know if actions in suffix flow should be applied
> > + * to new outer layer or not.
> > + * Action flag will be overwritten in tanslate after using.
> > + * No need to copy the hash_fields, as it will be generated
> > + * by RSS action with the item layer flags.
> > + */
> > dev_flow->layers = prefix_flow->layers;
> > + dev_flow->actions = prefix_flow->actions;
>
> I don't think it is good to move the actions too.
> You just need to remove the outer layers here if you see decap, no?
> Now we have only one needed param, it is prefix layers only.
> please change all the commits to move to prefix_layers instead prefix_flow.
> in case of decap:
> Rss need the inner layers only and modify_actions need the inner layers only.
> so you can just zero the outer layers.
> please add comment on it in translate - somethink like "layers can be initiated
> by the user according to the prefix sub-flow in case of meter and metadata
> splitters".
Good suggestion, will update the V2 version.
>
> > + }
> > if (sub_flow)
> > *sub_flow = dev_flow;
> > return flow_drv_translate(dev, dev_flow, attr, items, actions,
> > error); @@ -3737,6 +3747,8 @@ uint32_t
> > mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
> > * Pointer to Ethernet device.
> > * @param[in] flow
> > * Parent flow structure pointer.
> > + * @param[in] prefix_flow
> > + * Prefix flow structure pointer.
> > * @param[in] attr
> > * Flow rule attributes.
> > * @param[in] items
> > @@ -3753,6 +3765,7 @@ uint32_t mlx5_flow_adjust_priority(struct
> > rte_eth_dev *dev, int32_t priority, static int
> > flow_create_split_metadata(struct rte_eth_dev *dev,
> > struct rte_flow *flow,
> > + struct mlx5_flow *prefix_flow,
> > const struct rte_flow_attr *attr,
> > const struct rte_flow_item items[],
> > const struct rte_flow_action actions[], @@ -3773,7
> > +3786,7 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev,
> > int32_t priority,
> > if (!config->dv_flow_en ||
> > config->dv_xmeta_en == MLX5_XMETA_MODE_LEGACY ||
> > !mlx5_flow_ext_mreg_supported(dev))
> > - return flow_create_split_inner(dev, flow, NULL, NULL,
> > + return flow_create_split_inner(dev, flow, NULL, prefix_flow,
> > attr, items, actions, external,
> > error);
> > actions_n = flow_parse_qrss_action(actions, &qrss); @@ -3856,7
> > +3869,7 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev,
> > int32_t priority,
> > goto exit;
> > }
> > /* Add the unmodified original or prefix subflow. */
> > - ret = flow_create_split_inner(dev, flow, &dev_flow, NULL, attr,
> > + ret = flow_create_split_inner(dev, flow, &dev_flow, prefix_flow,
> > attr,
> > items, ext_actions ? ext_actions :
> > actions, external, error);
> > if (ret < 0)
> > @@ -3892,7 +3905,6 @@ uint32_t mlx5_flow_adjust_priority(struct
> > rte_eth_dev *dev, int32_t priority,
> > .type = RTE_FLOW_ACTION_TYPE_END,
> > },
> > };
> > - struct mlx5_flow *prefix_flow;
> >
> > /*
> > * Configure the tag item only if there is no meter subflow.
> > @@ -4052,7 +4064,7 @@ uint32_t mlx5_flow_adjust_priority(struct
> > rte_eth_dev *dev, int32_t priority,
> > MLX5_FLOW_TABLE_LEVEL_SUFFIX;
> > }
> > /* Add the prefix subflow. */
> > - ret = flow_create_split_metadata(dev, flow, &sfx_attr,
> > + ret = flow_create_split_metadata(dev, flow, dev_flow, &sfx_attr,
> > sfx_items ? sfx_items : items,
> > sfx_actions ? sfx_actions : actions,
> > external, error);
> > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> > b/drivers/net/mlx5/mlx5_flow_dv.c index c958fca..359a037 100644
> > --- a/drivers/net/mlx5/mlx5_flow_dv.c
> > +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> > @@ -85,16 +85,44 @@
> > * Pointer to item specification.
> > * @param[out] attr
> > * Pointer to flow attributes structure.
> > + * @param[in] dev_flow
> > + * Pointer to the sub flow.
> > * @param[in] tunnel_decap
> > * Whether action is after tunnel decapsulation.
> > */
> > static void
> > flow_dv_attr_init(const struct rte_flow_item *item, union
> > flow_dv_attr *attr,
> > - bool tunnel_decap)
> > + struct mlx5_flow *dev_flow, bool tunnel_decap)
> > {
> > + if (dev_flow->layers) {
> > + if (dev_flow->actions & MLX5_FLOW_ACTION_DECAP) {
> > + if (dev_flow->layers &
> > MLX5_FLOW_LAYER_INNER_L3_IPV4)
> > + attr->ipv4 = 1;
> > + else if (dev_flow->layers &
> > + MLX5_FLOW_LAYER_INNER_L3_IPV6)
> > + attr->ipv6 = 1;
> > + if (dev_flow->layers &
> > MLX5_FLOW_LAYER_INNER_L4_TCP)
> > + attr->tcp = 1;
> > + else if (dev_flow->layers &
> > + MLX5_FLOW_LAYER_INNER_L4_UDP)
> > + attr->udp = 1;
> > + } else {
> > + if (dev_flow->layers &
> > MLX5_FLOW_LAYER_OUTER_L3_IPV4)
> > + attr->ipv4 = 1;
> > + else if (dev_flow->layers &
> > + MLX5_FLOW_LAYER_OUTER_L3_IPV6)
> > + attr->ipv6 = 1;
> > + if (dev_flow->layers &
> > MLX5_FLOW_LAYER_OUTER_L4_TCP)
> > + attr->tcp = 1;
> > + else if (dev_flow->layers &
> > + MLX5_FLOW_LAYER_OUTER_L4_UDP)
> > + attr->udp = 1;
> > + }
> > + attr->valid = 1;
> > + return;
> > + }
> > for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
> > uint8_t next_protocol = 0xff;
> > -
> > switch (item->type) {
> > case RTE_FLOW_ITEM_TYPE_GRE:
> > case RTE_FLOW_ITEM_TYPE_NVGRE:
> > @@ -640,6 +668,8 @@ struct field_modify_info modify_tcp[] = {
> > * Pointer to rte_flow_item objects list.
> > * @param[in] attr
> > * Pointer to flow attributes structure.
> > + * @param[in] dev_flow
> > + * Pointer to the sub flow.
> > * @param[in] tunnel_decap
> > * Whether action is after tunnel decapsulation.
> > * @param[out] error
> > @@ -653,8 +683,8 @@ struct field_modify_info modify_tcp[] = {
> > (struct mlx5_flow_dv_modify_hdr_resource
> *resource,
> > const struct rte_flow_action *action,
> > const struct rte_flow_item *items,
> > - union flow_dv_attr *attr, bool tunnel_decap,
> > - struct rte_flow_error *error)
> > + union flow_dv_attr *attr, struct mlx5_flow
> > *dev_flow,
> > + bool tunnel_decap, struct rte_flow_error *error)
> > {
> > const struct rte_flow_action_set_tp *conf =
> > (const struct rte_flow_action_set_tp *)(action->conf); @@ -
> > 666,7 +696,7 @@ struct field_modify_info modify_tcp[] = {
> > struct field_modify_info *field;
> >
> > if (!attr->valid)
> > - flow_dv_attr_init(items, attr, tunnel_decap);
> > + flow_dv_attr_init(items, attr, dev_flow, tunnel_decap);
> > if (attr->udp) {
> > memset(&udp, 0, sizeof(udp));
> > memset(&udp_mask, 0, sizeof(udp_mask)); @@ -716,6
> > +746,8 @@ struct field_modify_info modify_tcp[] = {
> > * Pointer to rte_flow_item objects list.
> > * @param[in] attr
> > * Pointer to flow attributes structure.
> > + * @param[in] dev_flow
> > + * Pointer to the sub flow.
> > * @param[in] tunnel_decap
> > * Whether action is after tunnel decapsulation.
> > * @param[out] error
> > @@ -729,8 +761,8 @@ struct field_modify_info modify_tcp[] = {
> > (struct mlx5_flow_dv_modify_hdr_resource
> *resource,
> > const struct rte_flow_action *action,
> > const struct rte_flow_item *items,
> > - union flow_dv_attr *attr, bool tunnel_decap,
> > - struct rte_flow_error *error)
> > + union flow_dv_attr *attr, struct mlx5_flow
> > *dev_flow,
> > + bool tunnel_decap, struct rte_flow_error *error)
> > {
> > const struct rte_flow_action_set_ttl *conf =
> > (const struct rte_flow_action_set_ttl *)(action->conf); @@ -
> > 742,7 +774,7 @@ struct field_modify_info modify_tcp[] = {
> > struct field_modify_info *field;
> >
> > if (!attr->valid)
> > - flow_dv_attr_init(items, attr, tunnel_decap);
> > + flow_dv_attr_init(items, attr, dev_flow, tunnel_decap);
> > if (attr->ipv4) {
> > memset(&ipv4, 0, sizeof(ipv4));
> > memset(&ipv4_mask, 0, sizeof(ipv4_mask)); @@ -778,6
> > +810,8 @@ struct field_modify_info modify_tcp[] = {
> > * Pointer to rte_flow_item objects list.
> > * @param[in] attr
> > * Pointer to flow attributes structure.
> > + * @param[in] dev_flow
> > + * Pointer to the sub flow.
> > * @param[in] tunnel_decap
> > * Whether action is after tunnel decapsulation.
> > * @param[out] error
> > @@ -790,8 +824,8 @@ struct field_modify_info modify_tcp[] = {
> > flow_dv_convert_action_modify_dec_ttl
> > (struct mlx5_flow_dv_modify_hdr_resource
> *resource,
> > const struct rte_flow_item *items,
> > - union flow_dv_attr *attr, bool tunnel_decap,
> > - struct rte_flow_error *error)
> > + union flow_dv_attr *attr, struct mlx5_flow
> > *dev_flow,
> > + bool tunnel_decap, struct rte_flow_error *error)
> > {
> > struct rte_flow_item item;
> > struct rte_flow_item_ipv4 ipv4;
> > @@ -801,7 +835,7 @@ struct field_modify_info modify_tcp[] = {
> > struct field_modify_info *field;
> >
> > if (!attr->valid)
> > - flow_dv_attr_init(items, attr, tunnel_decap);
> > + flow_dv_attr_init(items, attr, dev_flow, tunnel_decap);
> > if (attr->ipv4) {
> > memset(&ipv4, 0, sizeof(ipv4));
> > memset(&ipv4_mask, 0, sizeof(ipv4_mask)); @@ -7505,7
> > +7539,7 @@ struct field_modify_info modify_tcp[] = {
> > case RTE_FLOW_ACTION_TYPE_SET_TP_DST:
> > if (flow_dv_convert_action_modify_tp
> > (mhdr_res, actions, items,
> > - &flow_attr, !!(action_flags &
> > + &flow_attr, dev_flow, !!(action_flags
> > &
> > MLX5_FLOW_ACTION_DECAP),
> > error))
> > return -rte_errno;
> > action_flags |= actions->type ==
> > @@ -7515,7 +7549,7 @@ struct field_modify_info modify_tcp[] = {
> > break;
> > case RTE_FLOW_ACTION_TYPE_DEC_TTL:
> > if (flow_dv_convert_action_modify_dec_ttl
> > - (mhdr_res, items, &flow_attr,
> > + (mhdr_res, items, &flow_attr,
> > dev_flow,
> > !!(action_flags &
> > MLX5_FLOW_ACTION_DECAP),
> > error))
> > return -rte_errno;
> > @@ -7524,7 +7558,7 @@ struct field_modify_info modify_tcp[] = {
> > case RTE_FLOW_ACTION_TYPE_SET_TTL:
> > if (flow_dv_convert_action_modify_ttl
> > (mhdr_res, actions, items,
> > &flow_attr,
> > - !!(action_flags &
> > + dev_flow, !!(action_flags &
> > MLX5_FLOW_ACTION_DECAP),
> > error))
> > return -rte_errno;
> > action_flags |= MLX5_FLOW_ACTION_SET_TTL;
> > --
> > 1.8.3.1
next prev parent reply other threads:[~2020-02-20 3:54 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-19 14:31 [dpdk-dev] [PATCH 0/2] net/mlx5: copy the item flags from prefix flow Suanming Mou
2020-02-19 14:31 ` [dpdk-dev] [PATCH 1/2] net/mlx5: fix layer flags missing in metadata Suanming Mou
2020-02-19 14:31 ` [dpdk-dev] [PATCH 2/2] net/mlx5: fix lack of match information in meter Suanming Mou
2020-02-19 15:30 ` Matan Azrad
2020-02-20 3:54 ` Suanming Mou [this message]
2020-02-20 4:00 ` [dpdk-dev] [PATCH v2 0/2] net/mlx5: copy the item flags from prefix flow Suanming Mou
2020-02-20 4:00 ` [dpdk-dev] [PATCH v2 1/2] net/mlx5: fix layer flags missing in metadata Suanming Mou
2020-02-20 7:40 ` Matan Azrad
2020-02-20 4:00 ` [dpdk-dev] [PATCH v2 2/2] net/mlx5: fix lack of match information in meter Suanming Mou
2020-02-20 7:40 ` Matan Azrad
2020-02-20 12:13 ` [dpdk-dev] [PATCH 0/2] net/mlx5: copy the item flags from prefix flow Raslan Darawsheh
2020-02-20 13:46 ` Raslan Darawsheh
2020-02-20 13:53 ` [dpdk-dev] [PATCH v3 " Suanming Mou
2020-02-20 13:53 ` [dpdk-dev] [PATCH v3 1/2] net/mlx5: fix layer flags missing in metadata Suanming Mou
2020-02-20 13:53 ` [dpdk-dev] [PATCH v3 2/2] net/mlx5: fix lack of match information in meter Suanming Mou
2020-02-20 15:09 ` [dpdk-dev] [PATCH v3 0/2] net/mlx5: copy the item flags from prefix flow Raslan Darawsheh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=HE1PR05MB348449314DABA887E95A5E0FCC130@HE1PR05MB3484.eurprd05.prod.outlook.com \
--to=suanmingm@mellanox.com \
--cc=dev@dpdk.org \
--cc=matan@mellanox.com \
--cc=rasland@mellanox.com \
--cc=stable@dpdk.org \
--cc=viacheslavo@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).