From: "Varis, Pekka" <p-varis@ti.com>
To: Roger Quadros <rogerq@kernel.org>,
"davem@davemloft.net" <davem@davemloft.net>,
"edumazet@google.com" <edumazet@google.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"vladimir.oltean@nxp.com" <vladimir.oltean@nxp.com>
Cc: "Vadapalli, Siddharth" <s-vadapalli@ti.com>,
"Gunasekaran, Ravi" <r-gunasekaran@ti.com>,
"Raghavendra, Vignesh" <vigneshr@ti.com>,
"Govindarajan, Sriramakrishnan" <srk@ti.com>,
"horms@kernel.org" <horms@kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: RE: [EXTERNAL] [PATCH v7 net-next 6/8] net: ethernet: ti: am65-cpsw-qos: Add Frame Preemption MAC Merge support
Date: Fri, 1 Dec 2023 16:01:33 +0000 [thread overview]
Message-ID: <c773050ad0534fb3a5a9edcf5302d297@ti.com> (raw)
In-Reply-To: <20231201135802.28139-7-rogerq@kernel.org>
> -----Original Message-----
> From: Roger Quadros <rogerq@kernel.org>
>
> Add driver support for viewing / changing the MAC Merge sublayer
> parameters and seeing the verification state machine's current state via
> ethtool.
>
> As hardware does not support interrupt notification for verification events
> we resort to polling on link up. On link up we try a couple of times for
> verification success and if unsuccessful then give up.
>
> The Frame Preemption feature is described in the Technical Reference
> Manual [1] in section:
> 12.3.1.4.6.7 Intersperced Express Traffic (IET – P802.3br/D2.0)
>
> Due to Silicon Errata i2208 [2] we set limit min IET fragment size to 124.
Should be 128 not 124
>
> [1] AM62x TRM - https://www.ti.com/lit/ug/spruiv7a/spruiv7a.pdf
> [2] AM62x Silicon Errata - https://www.ti.com/lit/er/sprz487c/sprz487c.pdf
>
> Signed-off-by: Roger Quadros <rogerq@kernel.org>
> ---
> drivers/net/ethernet/ti/am65-cpsw-ethtool.c | 157 ++++++++++++++++++
> drivers/net/ethernet/ti/am65-cpsw-nuss.c | 2 +
> drivers/net/ethernet/ti/am65-cpsw-nuss.h | 5 +
> drivers/net/ethernet/ti/am65-cpsw-qos.c | 175 ++++++++++++++++++++
> drivers/net/ethernet/ti/am65-cpsw-qos.h | 102 ++++++++++++
> 5 files changed, 441 insertions(+)
>
> Changelog:
>
> v7:
> - use else if
> - drop FIXME comment
> - fix lldp kselftest failure by limiting max_verify_time to spec limit of 128ms.
> - now passes all ethtool_mm.sh kselftests (patch 8 required)
>
> v6:
> - get mutex around am65_cpsw_iet_commit_preemptible_tcs() in
> am65_cpsw_iet_change_preemptible_tcs()
> - use "preemption" instead of "pre-emption"
> - call am65_cpsw_setup_mqprio() from within am65_cpsw_setup_taprio()
> - Now works with kselftest except the last test which fails
>
> v5:
> - No change
>
> v4:
> - Rebase and include in the same series as mqprio support.
>
> v3:
> - Rebase on top of v6.6-rc1 and mqprio support [1]
> - Support ethtool_ops :: get_mm_stats()
> - drop unused variables cmn_ctrl and verify_cnt
> - make am65_cpsw_iet_link_state_update() and
> am65_cpsw_iet_change_preemptible_tcs() static
>
> [1] https://lore.kernel.org/all/20230918075358.5878-1-rogerq@kernel.org/
>
> v2:
> - Use proper control bits for PMAC enable
> (AM65_CPSW_PN_CTL_IET_PORT_EN)
> and TX enable (AM65_CPSW_PN_IET_MAC_PENABLE)
> - Common IET Enable (AM65_CPSW_CTL_IET_EN) is set if any port has
> AM65_CPSW_PN_CTL_IET_PORT_EN set.
> - Fix workaround for erratum i2208. i.e. Limit rx_min_frag_size to 124
Should be 128 not 124
> - Fix am65_cpsw_iet_get_verify_timeout_ms() to default to timeout for
> 1G link if link is inactive.
> - resize the RX FIFO based on pmac_enabled, not tx_enabled.
>
>
> diff --git a/drivers/net/ethernet/ti/am65-cpsw-ethtool.c
> b/drivers/net/ethernet/ti/am65-cpsw-ethtool.c
> index b9e1d568604b..5571385b4baf 100644
> --- a/drivers/net/ethernet/ti/am65-cpsw-ethtool.c
> +++ b/drivers/net/ethernet/ti/am65-cpsw-ethtool.c
> @@ -11,6 +11,7 @@
> #include <linux/pm_runtime.h>
>
> #include "am65-cpsw-nuss.h"
> +#include "am65-cpsw-qos.h"
> #include "cpsw_ale.h"
> #include "am65-cpts.h"
>
> @@ -740,6 +741,159 @@ static int am65_cpsw_set_ethtool_priv_flags(struct
> net_device *ndev, u32 flags)
> return 0;
> }
>
> +static void am65_cpsw_port_iet_rx_enable(struct am65_cpsw_port *port,
> +bool enable) {
> + u32 val;
> +
> + val = readl(port->port_base + AM65_CPSW_PN_REG_CTL);
> + if (enable)
> + val |= AM65_CPSW_PN_CTL_IET_PORT_EN;
> + else
> + val &= ~AM65_CPSW_PN_CTL_IET_PORT_EN;
> +
> + writel(val, port->port_base + AM65_CPSW_PN_REG_CTL);
> + am65_cpsw_iet_common_enable(port->common);
> +}
> +
> +static void am65_cpsw_port_iet_tx_enable(struct am65_cpsw_port *port,
> +bool enable) {
> + u32 val;
> +
> + val = readl(port->port_base + AM65_CPSW_PN_REG_IET_CTRL);
> + if (enable)
> + val |= AM65_CPSW_PN_IET_MAC_PENABLE;
> + else
> + val &= ~AM65_CPSW_PN_IET_MAC_PENABLE;
> +
> + writel(val, port->port_base + AM65_CPSW_PN_REG_IET_CTRL); }
> +
> +static int am65_cpsw_get_mm(struct net_device *ndev, struct
> +ethtool_mm_state *state) {
> + struct am65_cpsw_port *port = am65_ndev_to_port(ndev);
> + struct am65_cpsw_ndev_priv *priv = netdev_priv(ndev);
> + u32 port_ctrl, iet_ctrl, iet_status;
> + u32 add_frag_size;
> +
> + mutex_lock(&priv->mm_lock);
> +
> + iet_ctrl = readl(port->port_base + AM65_CPSW_PN_REG_IET_CTRL);
> + port_ctrl = readl(port->port_base + AM65_CPSW_PN_REG_CTL);
> +
> + state->tx_enabled = !!(iet_ctrl &
> AM65_CPSW_PN_IET_MAC_PENABLE);
> + state->pmac_enabled = !!(port_ctrl &
> AM65_CPSW_PN_CTL_IET_PORT_EN);
> +
> + iet_status = readl(port->port_base +
> AM65_CPSW_PN_REG_IET_STATUS);
> +
> + if (iet_ctrl & AM65_CPSW_PN_IET_MAC_DISABLEVERIFY)
> + state->verify_status =
> ETHTOOL_MM_VERIFY_STATUS_DISABLED;
> + else if (iet_status & AM65_CPSW_PN_MAC_VERIFIED)
> + state->verify_status =
> ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED;
> + else if (iet_status & AM65_CPSW_PN_MAC_VERIFY_FAIL)
> + state->verify_status =
> ETHTOOL_MM_VERIFY_STATUS_FAILED;
> + else
> + state->verify_status =
> ETHTOOL_MM_VERIFY_STATUS_UNKNOWN;
> +
> + add_frag_size =
> AM65_CPSW_PN_IET_MAC_GET_ADDFRAGSIZE(iet_ctrl);
> + state->tx_min_frag_size =
> +ethtool_mm_frag_size_add_to_min(add_frag_size);
> +
> + /* Errata i2208: RX min fragment size cannot be less than 124 */
> + state->rx_min_frag_size = 124;
/* Errata i2208: RX min fragment size cannot be less than 128 */
state->rx_min_frag_size = 128;
Pekka
next prev parent reply other threads:[~2023-12-01 16:01 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-01 13:57 [PATCH v7 net-next 0/8] net: ethernet: am65-cpsw: Add mqprio, frame pre-emption & coalescing Roger Quadros
2023-12-01 13:57 ` [PATCH v7 net-next 1/8] net: ethernet: am65-cpsw: Build am65-cpsw-qos only if required Roger Quadros
2023-12-01 13:57 ` [PATCH v7 net-next 2/8] net: ethernet: am65-cpsw: cleanup TAPRIO handling Roger Quadros
2023-12-04 13:38 ` Vladimir Oltean
2023-12-01 13:57 ` [PATCH v7 net-next 3/8] net: ethernet: ti: am65-cpsw: Move code to avoid forward declaration Roger Quadros
2023-12-01 13:57 ` [PATCH v7 net-next 4/8] net: ethernet: am65-cpsw: Move register definitions to header file Roger Quadros
2023-12-01 13:57 ` [PATCH v7 net-next 5/8] net: ethernet: ti: am65-cpsw: add mqprio qdisc offload in channel mode Roger Quadros
2023-12-04 13:48 ` Vladimir Oltean
2023-12-01 13:58 ` [PATCH v7 net-next 6/8] net: ethernet: ti: am65-cpsw-qos: Add Frame Preemption MAC Merge support Roger Quadros
2023-12-01 16:01 ` Varis, Pekka [this message]
2023-12-04 9:30 ` [EXTERNAL] " Roger Quadros
2023-12-04 11:02 ` Vladimir Oltean
2023-12-04 11:10 ` Vladimir Oltean
2023-12-04 12:35 ` Vladimir Oltean
2023-12-08 10:13 ` Roger Quadros
2023-12-08 10:26 ` Roger Quadros
2023-12-08 12:33 ` Roger Quadros
2023-12-11 12:12 ` Vladimir Oltean
2023-12-11 12:14 ` Roger Quadros
2023-12-11 12:11 ` Vladimir Oltean
2023-12-11 12:25 ` Roger Quadros
2023-12-11 13:26 ` Vladimir Oltean
2023-12-07 15:24 ` Vladimir Oltean
2023-12-08 13:43 ` Roger Quadros
2023-12-11 13:29 ` Vladimir Oltean
2023-12-11 13:59 ` Roger Quadros
2023-12-01 13:58 ` [PATCH v7 net-next 7/8] net: ethernet: ti: am65-cpsw: add sw tx/rx irq coalescing based on hrtimers Roger Quadros
2023-12-01 13:58 ` [PATCH v7 net-next 8/8] selftests: forwarding: ethtool_mm: support devices with higher rx-min-frag-size Roger Quadros
2023-12-04 11:13 ` Vladimir Oltean
2023-12-04 12:36 ` Vladimir Oltean
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=c773050ad0534fb3a5a9edcf5302d297@ti.com \
--to=p-varis@ti.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=r-gunasekaran@ti.com \
--cc=rogerq@kernel.org \
--cc=s-vadapalli@ti.com \
--cc=srk@ti.com \
--cc=vigneshr@ti.com \
--cc=vladimir.oltean@nxp.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.