DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ivan Malov <ivan.malov@oktetlabs.ru>
To: Alexander Kozyrev <akozyrev@nvidia.com>
Cc: dpdk-dev <dev@dpdk.org>, Ori Kam <orika@nvidia.com>,
	 Thomas Monjalon <thomas@monjalon.net>,
	 Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	 Ferruh Yigit <ferruh.yigit@intel.com>,
	mohammad.abdul.awal@intel.com,  Qi Zhang <qi.z.zhang@intel.com>,
	Jerin Jacob <jerinj@marvell.com>,
	 Ajit Khaparde <ajit.khaparde@broadcom.com>
Subject: Re: [PATCH v2 03/10] ethdev: bring in async queue-based flow rules
Date: Tue, 25 Jan 2022 03:00:12 +0300 (MSK)	[thread overview]
Message-ID: <2fb135e6-f492-bb8-1554-4df1f089fc79@oktetlabs.ru> (raw)

Hi Alexander,

This series is very helpful as it draws attention to
the problem of making flow API efficient. That said,
there is much room for improvement, especially in
what comes to keeping things clear and concise.

In example, the following APIs

- rte_flow_q_flow_create()
- rte_flow_q_flow_destroy()
- rte_flow_q_action_handle_create()
- rte_flow_q_action_handle_destroy()
- rte_flow_q_action_handle_update()

should probably be transformed into a unified one

int
rte_flow_q_submit_task(uint16_t                          port_id,
                        uint32_t                          queue_id,
                        const struct rte_flow_q_ops_attr *q_ops_attr,
                        enum rte_flow_q_task_type         task_type,
                        const void                       *task_data,
                        rte_flow_q_task_cookie_t          cookie,
                        struct rte_flow_error            *error);

with a handful of corresponding enum defines and data structures
for these 5 operations. Also, I suggest that the attribute "drain"
be replaced by "postpone" (invert the meaning).

By the way, shouldn't this variety of operation types cover such
from the tunnel offload model? Getting PMD's opaque "tunnel
match" items and "tunnel set" actions - things like that.

rte_flow_q_drain() should then be renamed to rte_flow_q_push_postponed().

The rationale behind my suggestion is that "drain" tricks readers into
thinking that the enqueued operations are going to be completely purged,
whilst the true intention of the API is to "push" them to the hardware.

rte_flow_q_dequeue() also needs to be revisited. The name suggests that
some "tasks" be cancelled, whereas in reality this API implies "poll"
semantics. So why not name it "rte_flow_q_poll"?

I believe this function should return an array of completions, just
like it does in the current version, but provide a "cookie" (can be
represented by a uintptr_t value) for each completion entry.

The rationale behind choosing "cookie" over "user_data" is clarity.
Term "user_data" sounds like "flow action conf" or "counter data",
whilst in reality it likely stands for something normally called
a cookie. Please correct me if I've got that wrong.


Well, the short of it: submit_task(), push_postponed() and poll().
Having a unified "submit_task()" API should allow to reduce the
amount of comment duplication.


In what comes to RST commentary, please consider a bullet-formatted
description for improved readability:

- Flow rule management is done via special flow management queues
- The queue operations are asynchronous and not thread-safe
- The operations can thus be invoked by the app's datapath
- The queue count is configured at initialisation stage
- Available operation types: submit_task, push_postponed and poll
- Polling provides completions for submitted tasks
- The completions can be reordered withing a queue
- Polling must be done on time to avoid overflows


Please note that the above review notes are just a quick primer,
nothing more. I may be mistaken with regard to some aspects.

I humbly request that we agree on the API sketch and naming
before going to the next review cycle.

Thank you.

--
Ivan M.

             reply	other threads:[~2022-01-25  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-25  0:00 Ivan Malov [this message]
2022-01-26  5:03 ` Alexander Kozyrev
2022-01-26 18:54   ` Ajit Khaparde
2022-01-27 21:55     ` Alexander Kozyrev
2022-02-01  0:17       ` Ivan Malov
2022-02-01 17:50         ` Ori Kam
2022-02-01 23:24           ` Ivan Malov
2022-02-02 12:39             ` Ori Kam

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=2fb135e6-f492-bb8-1554-4df1f089fc79@oktetlabs.ru \
    --to=ivan.malov@oktetlabs.ru \
    --cc=ajit.khaparde@broadcom.com \
    --cc=akozyrev@nvidia.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jerinj@marvell.com \
    --cc=mohammad.abdul.awal@intel.com \
    --cc=orika@nvidia.com \
    --cc=qi.z.zhang@intel.com \
    --cc=thomas@monjalon.net \
    /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).