DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ivan Malov <ivan.malov@oktetlabs.ru>
To: dev@dpdk.org
Subject: Re: [PATCH v2 02/10] ethdev: add flow item/action templates
Date: Wed, 19 Jan 2022 18:16:02 +0300 (MSK)	[thread overview]
Message-ID: <fda5b1a1-fb24-b4ed-d0be-3e5c40ef513c@oktetlabs.ru> (raw)

Hi,

> +Oftentimes in an application, many flow rules share a common structure
> +(the same pattern and/or action list) so they can be grouped and 
classified
> +together. This knowledge may be used as a source of optimization by a 
PMD/HW.
> +The flow rule creation is done by selecting a table, an item template
> +and an action template (which are bound to the table), and setting 
unique
> +values for the items and actions. This API is not thread-safe.

Consider:

+Typically, flow rules generated by a given application conform to a small
+group of "shapes". What defines a "shape" is a set of specific item masks
+and action types. This knowledge facilitates optimisations in PMDs / HW.
+
+With such "shapes" (templates) being grouped in tables, a flow rule can
+be created by selecting a template (pattern, action list) within a given
+table and filling out specific match / action properties.

> +     struct rte_flow_item_template *
> +     rte_flow_item_template_create(uint16_t port_id,
> +                             const struct rte_flow_item_template_attr 
*it_attr,
> +                             const struct rte_flow_item items[],
> +                             struct rte_flow_error *error);

I'm afraid "it_attr" is hardly readable. Also, the API name can
trick users into thinking that it's all about creating a single
item template rather than a flow pattern template.

Perhaps rename to "rte_flow_pattern_template_create()"?
Use "tmpl" instead of "template"? Or "shape" maybe?

For sure, "const struct rte_flow_item items[]" would look better
when renamed to "const struct rte_flow_item pattern[]".

The same goes for "rte_flow_action_template_create()" and "at_attr".

Perhaps, "rte_flow_action_list_shape_create()" then?

> +A table combines a number of item and action templates along with 
shared flow
> +rule attributes (group ID, priority and traffic direction). This way a 
PMD/HW

Please consider:

+A template table consists of multiple pattern templates and action list
+templates associated with a single set of rule attributes (group ID,
+priority, etc).

Perhaps rename "item_templates[]" and "action_templates[]"
to "pattern_templates[]" and "action_list_templates[]".
Maybe make use of the term "shape" here as well...

> +     /**
> +      * Relaxed matching policy, PMD may match only on items
> +      * with mask member set and skip matching on protocol
> +      * layers specified without any masks.
> +      * If not set, PMD will match on protocol layers
> +      * specified without any masks as well.
> +      * Packet data must be stacked in the same order as the
> +      * protocol layers to match inside packets,
> +      * starting from the lowest.
> +      */
> +     uint32_t relaxed_matching:1;

Consider rewording this to a bullet-formatted set of statements.
For brevity. For improved clarity.

> +      * Flow attributes that will be used in the table.

Perhaps: "Flow attributes to be used in each rule generated from this
table". Something like that.

> +                   struct rte_flow_item_template *item_templates[],
Perhaps, "const struct"? The name could be "pattern_templates".

> +                   uint8_t nb_item_templates,
Why not "unsigned int"? The name could be "nb_pattern_templates".

> +                   struct rte_flow_action_template *action_templates[],
> +                   uint8_t nb_action_templates,
Same questions here.

--
Ivan M.

             reply	other threads:[~2022-01-19 15:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-19 15:16 Ivan Malov [this message]
2022-01-25  4:04 ` Alexander Kozyrev
  -- strict thread matches above, loose matches on Subject: below --
2021-10-06  4:48 [dpdk-dev] [RFC 0/3] ethdev: datapath-focused flow rules management Alexander Kozyrev
2022-01-18 15:30 ` [PATCH v2 00/10] " Alexander Kozyrev
2022-01-18 15:30   ` [PATCH v2 02/10] ethdev: add flow item/action templates Alexander Kozyrev

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=fda5b1a1-fb24-b4ed-d0be-3e5c40ef513c@oktetlabs.ru \
    --to=ivan.malov@oktetlabs.ru \
    --cc=dev@dpdk.org \
    /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).