mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: davem@davemloft.net
Cc: Maxime Chevallier <maxime.chevallier@bootlin.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Antoine Tenart <antoine.tenart@bootlin.com>,
	thomas.petazzoni@bootlin.com, gregory.clement@bootlin.com,
	miquel.raynal@bootlin.com, nadavh@marvell.com,
	stefanc@marvell.com, ymarkman@marvell.com, mw@semihalf.com,
	Russell King <linux@armlinux.org.uk>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH net-next 17/18] net: mvpp2: cls: Initialize lookup priorities for all entries in the flow
Date: Wed, 27 Mar 2019 09:44:21 +0100	[thread overview]
Message-ID: <20190327084422.4209-18-maxime.chevallier@bootlin.com> (raw)
In-Reply-To: <20190327084422.4209-1-maxime.chevallier@bootlin.com>

When classifying a packet pertaining to a given flow, the classifier
will issue multiple lookup commands until it finds one with the 'last'
bit set. It expects all prorities to be assign continuously (although
not necessarily in an ordered fashion) from 0 to the number of lookups.

We can initialize this once, and make sure unused lookups are given an
empty port map. This avoids having to maintain priorities and the
information of which lookup is the last.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
 .../net/ethernet/marvell/mvpp2/mvpp2_cls.c    | 37 ++++++++++++-------
 1 file changed, 24 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
index 7a889a925714..1087974d3b98 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
@@ -544,16 +544,27 @@ static void mvpp2_cls_flow_init(struct mvpp2 *priv,
 				const struct mvpp2_cls_flow *flow)
 {
 	struct mvpp2_cls_flow_entry fe;
-	int i;
+	int i, pri = 0;
+
+	/* Assign default values to all entries in the flow */
+	for (i = MVPP2_CLS_FLT_FIRST(flow->flow_id);
+	     i <= MVPP2_CLS_FLT_LAST(flow->flow_id); i++) {
+		memset(&fe, 0, sizeof(fe));
+		fe.index = i;
+		mvpp2_cls_flow_pri_set(&fe, pri++);
 
-	/* C2 lookup */
-	memset(&fe, 0, sizeof(fe));
-	fe.index = MVPP2_CLS_FLT_C2_RSS_ENTRY(flow->flow_id);
+		if (i == MVPP2_CLS_FLT_LAST(flow->flow_id))
+			mvpp2_cls_flow_last_set(&fe, 1);
+
+		mvpp2_cls_flow_write(priv, &fe);
+	}
+
+	/* RSS config C2 lookup */
+	mvpp2_cls_flow_read(priv, MVPP2_CLS_FLT_C2_RSS_ENTRY(flow->flow_id),
+			    &fe);
 
 	mvpp2_cls_flow_eng_set(&fe, MVPP22_CLS_ENGINE_C2);
 	mvpp2_cls_flow_port_id_sel(&fe, true);
-	mvpp2_cls_flow_last_set(&fe, 0);
-	mvpp2_cls_flow_pri_set(&fe, 0);
 	mvpp2_cls_flow_lu_type_set(&fe, MVPP2_CLS_LU_ALL);
 
 	/* Add all ports */
@@ -564,19 +575,19 @@ static void mvpp2_cls_flow_init(struct mvpp2 *priv,
 
 	/* C3Hx lookups */
 	for (i = 0; i < MVPP2_MAX_PORTS; i++) {
-		memset(&fe, 0, sizeof(fe));
-		fe.index = MVPP2_CLS_FLT_HASH_ENTRY(i, flow->flow_id);
+		mvpp2_cls_flow_read(priv,
+				    MVPP2_CLS_FLT_HASH_ENTRY(i, flow->flow_id),
+				    &fe);
 
+		/* Set a default engine. Will be overwritten when setting the
+		 * real HEK parameters
+		 */
+		mvpp2_cls_flow_eng_set(&fe, MVPP22_CLS_ENGINE_C3HA);
 		mvpp2_cls_flow_port_id_sel(&fe, true);
-		mvpp2_cls_flow_pri_set(&fe, i + 1);
 		mvpp2_cls_flow_port_add(&fe, BIT(i));
 
 		mvpp2_cls_flow_write(priv, &fe);
 	}
-
-	/* Update the last entry */
-	mvpp2_cls_flow_last_set(&fe, 1);
-	mvpp2_cls_flow_write(priv, &fe);
 }
 
 /* Adds a field to the Header Extracted Key generation parameters*/
-- 
2.20.1


  parent reply	other threads:[~2019-03-27  8:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-27  8:44 [PATCH net-next 00/18] net: mvpp2: Classifier updates and cleanups Maxime Chevallier
2019-03-27  8:44 ` [PATCH net-next 01/18] net: mvpp2: Don't use an int to store netdev_features_t Maxime Chevallier
2019-03-27  8:44 ` [PATCH net-next 02/18] net: mvpp2: cls: Add missing MAC_DA field extraction Maxime Chevallier
2019-03-27  8:44 ` [PATCH net-next 03/18] net: mvpp2: cls: Start cls flow entries from beginning of table Maxime Chevallier
2019-03-27  8:44 ` [PATCH net-next 04/18] net: mvpp2: cls: use Lookup Type in classification engines Maxime Chevallier
2019-03-27  8:44 ` [PATCH net-next 05/18] net: mvpp2: cls: Rename MVPP2_N_FLOWS to MVPP2_N_PRS_FLOWS Maxime Chevallier
2019-03-27  8:44 ` [PATCH net-next 06/18] net: mvpp2: cls: Make the flow definitions const Maxime Chevallier
2019-03-27  8:44 ` [PATCH net-next 07/18] net: mvpp2: debugfs: Store debugfs entries data in mvpp2 struct Maxime Chevallier
2019-03-27  8:44 ` [PATCH net-next 08/18] net: mvpp2: debugfs: Allow reading the flow table from debugfs Maxime Chevallier
2019-03-27  8:44 ` [PATCH net-next 09/18] net: mvpp2: debugfs: Allow reading the C2 engine " Maxime Chevallier
2019-03-27  8:44 ` [PATCH net-next 10/18] net: mvpp2: cls: Use iterators to go through the cls_table Maxime Chevallier
2019-03-27  8:44 ` [PATCH net-next 11/18] net: mvpp2: cls: Write C2 TCAM data last when writing a C2 entry Maxime Chevallier
2019-03-27  8:44 ` [PATCH net-next 12/18] net: mvpp2: cls: Move C2 read/write helpers around Maxime Chevallier
2019-03-27  8:44 ` [PATCH net-next 13/18] net: mvpp2: cls: Rename classifer per-port functions Maxime Chevallier
2019-03-27  8:44 ` [PATCH net-next 14/18] net: mvpp2: cls: Don't use the sequence attribute for classification Maxime Chevallier
2019-03-27  8:44 ` [PATCH net-next 15/18] net: mvpp2: cls: Rename the flow table macros Maxime Chevallier
2019-03-27  8:44 ` [PATCH net-next 16/18] net: mvpp2: cls: Invalidate all C2 entries except the ones we use Maxime Chevallier
2019-03-27  8:44 ` Maxime Chevallier [this message]
2019-03-27  8:44 ` [PATCH net-next 18/18] net: mvpp2: cls: Rework C2 engine macros Maxime Chevallier
2019-03-27 18:11 ` [PATCH net-next 00/18] net: mvpp2: Classifier updates and cleanups David Miller

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=20190327084422.4209-18-maxime.chevallier@bootlin.com \
    --to=maxime.chevallier@bootlin.com \
    --cc=antoine.tenart@bootlin.com \
    --cc=davem@davemloft.net \
    --cc=gregory.clement@bootlin.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=miquel.raynal@bootlin.com \
    --cc=mw@semihalf.com \
    --cc=nadavh@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=stefanc@marvell.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=ymarkman@marvell.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

all inboxes | Powered by JetHome®