From: <edward.cree@amd.com>
To: <linux-net-drivers@amd.com>, <davem@davemloft.net>,
<kuba@kernel.org>, <pabeni@redhat.com>, <edumazet@google.com>
Cc: Edward Cree <ecree.xilinx@gmail.com>, <netdev@vger.kernel.org>,
<habetsm.xilinx@gmail.com>, <michal.swiatkowski@linux.intel.com>,
<simon.horman@corigine.com>
Subject: [PATCH net-next v3 1/6] sfc: document TC-to-EF100-MAE action translation concepts
Date: Mon, 27 Mar 2023 11:36:03 +0100 [thread overview]
Message-ID: <6d89d6a33c33e5353c3c431f1f4957bf293269e7.1679912088.git.ecree.xilinx@gmail.com> (raw)
In-Reply-To: <cover.1679912088.git.ecree.xilinx@gmail.com>
From: Edward Cree <ecree.xilinx@gmail.com>
Includes an explanation of the lifetime of the 'cursor' action-set `act`.
Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
---
Changed in v2: newly added patch
---
drivers/net/ethernet/sfc/tc.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/sfc/tc.c b/drivers/net/ethernet/sfc/tc.c
index 2b07bb2fd735..34c1ff87ba5e 100644
--- a/drivers/net/ethernet/sfc/tc.c
+++ b/drivers/net/ethernet/sfc/tc.c
@@ -66,7 +66,7 @@ static const struct rhashtable_params efx_tc_match_action_ht_params = {
static void efx_tc_free_action_set(struct efx_nic *efx,
struct efx_tc_action_set *act, bool in_hw)
{
- /* Failure paths calling this on the 'running action' set in_hw=false,
+ /* Failure paths calling this on the 'cursor' action set in_hw=false,
* because if the alloc had succeeded we'd've put it in acts.list and
* not still have it in act.
*/
@@ -407,6 +407,30 @@ static int efx_tc_flower_replace(struct efx_nic *efx,
goto release;
}
+ /**
+ * DOC: TC action translation
+ *
+ * Actions in TC are sequential and cumulative, with delivery actions
+ * potentially anywhere in the order. The EF100 MAE, however, takes
+ * an 'action set list' consisting of 'action sets', each of which is
+ * applied to the _original_ packet, and consists of a set of optional
+ * actions in a fixed order with delivery at the end.
+ * To translate between these two models, we maintain a 'cursor', @act,
+ * which describes the cumulative effect of all the packet-mutating
+ * actions encountered so far; on handling a delivery (mirred or drop)
+ * action, once the action-set has been inserted into hardware, we
+ * append @act to the action-set list (@rule->acts); if this is a pipe
+ * action (mirred mirror) we then allocate a new @act with a copy of
+ * the cursor state _before_ the delivery action, otherwise we set @act
+ * to %NULL.
+ * This ensures that every allocated action-set is either attached to
+ * @rule->acts or pointed to by @act (and never both), and that only
+ * those action-sets in @rule->acts exist in hardware. Consequently,
+ * in the failure path, @act only needs to be freed in memory, whereas
+ * for @rule->acts we remove each action-set from hardware before
+ * freeing it (efx_tc_free_action_set_list()), even if the action-set
+ * list itself is not in hardware.
+ */
flow_action_for_each(i, fa, &fr->action) {
struct efx_tc_action_set save;
u16 tci;
next prev parent reply other threads:[~2023-03-27 10:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-27 10:36 [PATCH net-next v3 0/6] sfc: support TC decap rules edward.cree
2023-03-27 10:36 ` edward.cree [this message]
2023-03-27 10:36 ` [PATCH net-next v3 2/6] sfc: add notion of match on enc keys to MAE machinery edward.cree
2023-03-27 14:27 ` Simon Horman
2023-03-27 10:36 ` [PATCH net-next v3 3/6] sfc: handle enc keys in efx_tc_flower_parse_match() edward.cree
2023-03-27 10:36 ` [PATCH net-next v3 4/6] sfc: add functions to insert encap matches into the MAE edward.cree
2023-03-27 14:28 ` Simon Horman
2023-03-27 10:36 ` [PATCH net-next v3 5/6] sfc: add code to register and unregister encap matches edward.cree
2023-03-27 14:28 ` Simon Horman
2023-03-27 10:36 ` [PATCH net-next v3 6/6] sfc: add offloading of 'foreign' TC (decap) rules edward.cree
2023-03-29 8:10 ` [PATCH net-next v3 0/6] sfc: support TC decap rules patchwork-bot+netdevbpf
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=6d89d6a33c33e5353c3c431f1f4957bf293269e7.1679912088.git.ecree.xilinx@gmail.com \
--to=edward.cree@amd.com \
--cc=davem@davemloft.net \
--cc=ecree.xilinx@gmail.com \
--cc=edumazet@google.com \
--cc=habetsm.xilinx@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-net-drivers@amd.com \
--cc=michal.swiatkowski@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=simon.horman@corigine.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).