All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Xiaoliang Yang <xiaoliang.yang_1@nxp.com>,
	Rui Sousa <rui.sousa@nxp.com>,
	Claudiu Manoil <claudiu.manoil@nxp.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	UNGLinuxDriver@microchip.com, Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Michael Walle <michael@walle.cc>,
	Vinicius Costa Gomes <vinicius.gomes@intel.com>,
	Maxim Kochetkov <fido_max@inbox.ru>,
	Colin Foster <colin.foster@in-advantage.com>,
	Richie Pearn <richard.pearn@nxp.com>,
	Kurt Kanzenbach <kurt@linutronix.de>,
	Vladimir Oltean <olteanv@gmail.com>,
	Jesse Brandeburg <jesse.brandeburg@intel.com>,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Jose Abreu <joabreu@synopsys.com>,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	Jiri Pirko <jiri@resnulli.us>,
	Gerhard Engleder <gerhard@engleder-embedded.com>,
	Grygorii Strashko <grygorii.strashko@ti.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH net-next 07/13] net: enetc: offload per-tc max SDU from tc-taprio
Date: Wed, 14 Sep 2022 18:32:57 +0300	[thread overview]
Message-ID: <20220914153303.1792444-8-vladimir.oltean@nxp.com> (raw)
In-Reply-To: <20220914153303.1792444-1-vladimir.oltean@nxp.com>

The driver currently sets the PTCMSDUR register statically to the max
MTU supported by the interface. Keep this logic if tc-taprio is absent
or if the max_sdu for a traffic class is 0, and follow the requested max
SDU size otherwise.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/ethernet/freescale/enetc/enetc.h  |  3 +++
 .../net/ethernet/freescale/enetc/enetc_pf.c   | 25 ++++++++++++++++---
 .../net/ethernet/freescale/enetc/enetc_qos.c  | 10 +++++---
 3 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/ethernet/freescale/enetc/enetc.h
index f4cf12c743fe..4d0bdfef51b7 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc.h
+++ b/drivers/net/ethernet/freescale/enetc/enetc.h
@@ -455,6 +455,9 @@ static inline void enetc_cbd_free_data_mem(struct enetc_si *si, int size,
 			  data, *dma);
 }
 
+void enetc_reset_ptcmsdur(struct enetc_hw *hw);
+void enetc_set_ptcmsdur(struct enetc_hw *hw, u32 *queue_max_sdu);
+
 #ifdef CONFIG_FSL_ENETC_QOS
 int enetc_setup_tc_taprio(struct net_device *ndev, void *type_data);
 void enetc_sched_speed_set(struct enetc_ndev_priv *priv, int speed);
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
index c4a0e836d4f0..03275846f416 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
@@ -516,15 +516,34 @@ static void enetc_port_si_configure(struct enetc_si *si)
 	enetc_port_wr(hw, ENETC_PSIVLANFMR, ENETC_PSIVLANFMR_VS);
 }
 
-static void enetc_configure_port_mac(struct enetc_hw *hw)
+void enetc_set_ptcmsdur(struct enetc_hw *hw, u32 *max_sdu)
 {
 	int tc;
 
-	enetc_port_wr(hw, ENETC_PM0_MAXFRM,
-		      ENETC_SET_MAXFRM(ENETC_RX_MAXFRM_SIZE));
+	for (tc = 0; tc < 8; tc++) {
+		u32 val = ENETC_MAC_MAXFRM_SIZE;
+
+		if (max_sdu[tc])
+			val = max_sdu[tc] + VLAN_ETH_HLEN;
+
+		enetc_port_wr(hw, ENETC_PTCMSDUR(tc), val);
+	}
+}
+
+void enetc_reset_ptcmsdur(struct enetc_hw *hw)
+{
+	int tc;
 
 	for (tc = 0; tc < 8; tc++)
 		enetc_port_wr(hw, ENETC_PTCMSDUR(tc), ENETC_MAC_MAXFRM_SIZE);
+}
+
+static void enetc_configure_port_mac(struct enetc_hw *hw)
+{
+	enetc_port_wr(hw, ENETC_PM0_MAXFRM,
+		      ENETC_SET_MAXFRM(ENETC_RX_MAXFRM_SIZE));
+
+	enetc_reset_ptcmsdur(hw);
 
 	enetc_port_wr(hw, ENETC_PM0_CMD_CFG, ENETC_PM0_CMD_PHY_TX_EN |
 		      ENETC_PM0_CMD_TXP	| ENETC_PM0_PROMISC);
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_qos.c b/drivers/net/ethernet/freescale/enetc/enetc_qos.c
index 29be8a1ecee1..a412f27bc4a4 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_qos.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_qos.c
@@ -68,6 +68,7 @@ static int enetc_setup_taprio(struct net_device *ndev,
 	tge = enetc_rd(hw, ENETC_QBV_PTGCR_OFFSET);
 	if (!admin_conf->enable) {
 		enetc_wr(hw, ENETC_QBV_PTGCR_OFFSET, tge & ~ENETC_QBV_TGE);
+		enetc_reset_ptcmsdur(hw);
 
 		priv->active_offloads &= ~ENETC_F_QBV;
 
@@ -123,10 +124,13 @@ static int enetc_setup_taprio(struct net_device *ndev,
 
 	enetc_cbd_free_data_mem(priv->si, data_size, tmp, &dma);
 
-	if (!err)
-		priv->active_offloads |= ENETC_F_QBV;
+	if (err)
+		return err;
 
-	return err;
+	enetc_set_ptcmsdur(hw, admin_conf->max_sdu);
+	priv->active_offloads |= ENETC_F_QBV;
+
+	return 0;
 }
 
 int enetc_setup_tc_taprio(struct net_device *ndev, void *type_data)
-- 
2.34.1


  parent reply	other threads:[~2022-09-14 15:35 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14 15:32 [PATCH net-next 00/13] Add tc-taprio support for queueMaxSDU Vladimir Oltean
2022-09-14 15:32 ` [PATCH net-next 01/13] net/sched: taprio: remove redundant FULL_OFFLOAD_IS_ENABLED check in taprio_enqueue Vladimir Oltean
2022-09-14 15:32 ` [PATCH net-next 02/13] net/sched: taprio: stop going through private ops for dequeue and peek Vladimir Oltean
2022-09-14 15:32 ` [PATCH net-next 03/13] net/sched: taprio: add extack messages in taprio_init Vladimir Oltean
2022-09-14 15:32 ` [PATCH net-next 04/13] net/sched: taprio: allow user input of per-tc max SDU Vladimir Oltean
2022-09-14 21:43   ` Vinicius Costa Gomes
2022-09-14 22:10     ` Vladimir Oltean
2022-09-14 23:00       ` Vinicius Costa Gomes
2022-09-14 23:03         ` Vladimir Oltean
2022-09-14 23:17           ` Vinicius Costa Gomes
2022-09-14 23:03   ` Vinicius Costa Gomes
2022-09-14 23:11     ` Vladimir Oltean
2022-09-14 15:32 ` [PATCH net-next 05/13] net: dsa: felix: offload per-tc max SDU from tc-taprio Vladimir Oltean
2022-09-14 15:32 ` [PATCH net-next 06/13] net: enetc: cache accesses to &priv->si->hw Vladimir Oltean
2022-09-14 15:32 ` Vladimir Oltean [this message]
2022-09-14 15:32 ` [PATCH net-next 08/13] net: dsa: hellcreek: deny tc-taprio changes to per-tc max SDU Vladimir Oltean
2022-09-14 18:13   ` Kurt Kanzenbach
2022-09-14 18:40     ` Vladimir Oltean
2022-09-14 20:13       ` Vladimir Oltean
2022-09-15  6:15       ` Kurt Kanzenbach
2022-09-15 11:59         ` Vladimir Oltean
2022-09-19 13:36           ` Kurt Kanzenbach
2022-09-21 11:23           ` Kurt Kanzenbach
2022-09-21 11:29             ` Vladimir Oltean
2022-09-21 11:46               ` Kurt Kanzenbach
2022-09-21 14:12                 ` Vladimir Oltean
2022-09-21 14:21                   ` Vladimir Oltean
2022-09-22  8:10                     ` Kurt Kanzenbach
2022-09-14 15:32 ` [PATCH net-next 09/13] net: dsa: sja1105: " Vladimir Oltean
2022-09-14 15:33 ` [PATCH net-next 10/13] tsnep: " Vladimir Oltean
2022-09-15 19:01   ` Gerhard Engleder
2022-09-16 13:57     ` Vladimir Oltean
2022-09-16 19:53       ` Gerhard Engleder
2022-09-16 22:16         ` Vladimir Oltean
2022-09-14 15:33 ` [PATCH net-next 11/13] igc: " Vladimir Oltean
2022-09-14 15:33 ` [PATCH net-next 12/13] net: stmmac: " Vladimir Oltean
2022-09-14 15:33 ` [PATCH net-next 13/13] net: am65-cpsw: " Vladimir Oltean
2022-09-14 21:47 ` [PATCH net-next 00/13] Add tc-taprio support for queueMaxSDU Vinicius Costa Gomes

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=20220914153303.1792444-8-vladimir.oltean@nxp.com \
    --to=vladimir.oltean@nxp.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=claudiu.manoil@nxp.com \
    --cc=colin.foster@in-advantage.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=fido_max@inbox.ru \
    --cc=gerhard@engleder-embedded.com \
    --cc=grygorii.strashko@ti.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=joabreu@synopsys.com \
    --cc=kuba@kernel.org \
    --cc=kurt@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael@walle.cc \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=peppe.cavallaro@st.com \
    --cc=richard.pearn@nxp.com \
    --cc=rui.sousa@nxp.com \
    --cc=vinicius.gomes@intel.com \
    --cc=vivien.didelot@gmail.com \
    --cc=xiaoliang.yang_1@nxp.com \
    --cc=xiyou.wangcong@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.