public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: "Malladi, Meghana" <m-malladi@ti.com>
Cc: vadim.fedorenko@linux.dev, horms@kernel.org,
	jacob.e.keller@intel.com, afd@ti.com, pmohan@couthit.com,
	basharath@couthit.com, rogerq@kernel.org, danishanwar@ti.com,
	pabeni@redhat.com, kuba@kernel.org, edumazet@google.com,
	davem@davemloft.net, andrew+netdev@lunn.ch,
	linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, srk@ti.com,
	Vignesh Raghavendra <vigneshr@ti.com>
Subject: Re: [PATCH net-next 2/2] net: ti: icssg-prueth: Add ethtool ops for Frame Preemption MAC Merge
Date: Wed, 28 Jan 2026 15:14:09 +0200	[thread overview]
Message-ID: <20260128131409.wesidsk3z7ixptyg@skbuf> (raw)
In-Reply-To: <931bb43b-fbba-4423-9a20-122602b3b630@ti.com>

On Wed, Jan 28, 2026 at 06:32:05PM +0530, Malladi, Meghana wrote:
> > > diff --git a/drivers/net/ethernet/ti/icssg/icssg_ethtool.c b/drivers/net/ethernet/ti/icssg/icssg_ethtool.c
> > > index b715af21d23a..ceca6d6ec0f4 100644
> > > --- a/drivers/net/ethernet/ti/icssg/icssg_ethtool.c
> > > +++ b/drivers/net/ethernet/ti/icssg/icssg_ethtool.c
> > > @@ -294,6 +294,61 @@ static int emac_set_per_queue_coalesce(struct net_device *ndev, u32 queue,
> > >   	return 0;
> > >   }
> > > +static int emac_get_mm(struct net_device *ndev, struct ethtool_mm_state *state)
> > > +{
> > > +	struct prueth_emac *emac = netdev_priv(ndev);
> > > +	struct prueth_qos_iet *iet = &emac->qos.iet;
> > > +	void __iomem *config;
> > > +
> > > +	config = emac->dram.va + ICSSG_CONFIG_OFFSET;
> > > +
> > > +	state->tx_enabled = iet->fpe_enabled;
> > 
> > I would expect state->tx_enabled to be returned from
> > iet->fpe_configured, aka from the same variable in which tx_enabled was
> > saved in emac_set_mm(). In case it's not clear, ethtool saves state in
> > the device driver and expects that state to be later returned in the
> > get() callback.
> 
> Ok got it, will fix it in v2. I am aware that ethtool saves state in the
> device driver which will be returned in the get() callback but didn't know
> that should be the case every time.

Driver, hardware or firmware. But certainly the state returned in get()
must have some relationship with the state previously set in set().
iet->fpe_enabled has no relationship with state->tx_enabled; it
represents more or less the "tx_active" state.

> > > +	state->tx_active = readb(config + PRE_EMPTION_ACTIVE_TX) ? true : false;
> > > +	state->verify_enabled = readb(config + PRE_EMPTION_ENABLE_VERIFY) ? true : false;
> > > +	state->verify_time = iet->verify_time_ms;
> > 
> > Why are some values returned from firmware and others from driver memory?
> 
> Sure, I will store all the values in the driver memory and return from them.
> But should that be the case all the time ?

Not necessarily, this implementation is just very inconsistent overall
and that raised the question whether there's any reason behind it.

> > > +
> > > +	return 0;
> > > +}
> > > +
> > > +static int emac_set_mm(struct net_device *ndev, struct ethtool_mm_cfg *cfg,
> > > +		       struct netlink_ext_ack *extack)
> > > +{
> > > +	struct prueth_emac *emac = netdev_priv(ndev);
> > > +	struct prueth_qos_iet *iet = &emac->qos.iet;
> > > +
> > > +	if (!cfg->pmac_enabled)
> > > +		netdev_err(ndev, "preemptible MAC is always enabled");
> > 
> > missing \n, OR use NL_SET_ERR_MSG_MOD(extack) which doesn't need \n.
> > Doing the latter is preferable, because the driver still accepts the
> > command while not modifying its internal state, and ethtool prints the
> > extack as warning if the return code was 0.
> > The catch is that openlldp sets pmac_enabled=false on exit, and that
> > would otherwise generate a noisy netdev_err() in your proposal (but
> > would be silent with the extack):
> > https://github.com/intel/openlldp/blob/master/lldp_8023.c#L443-L444
> > 
> 
> Ok makes sense, thanks for pointing this out.
> 
> > > +
> > > +	iet->verify_time_ms = cfg->verify_time;
> > > +	iet->tx_min_frag_size = cfg->tx_min_frag_size;
> > > +
> > > +	iet->fpe_configured = cfg->tx_enabled;
> > > +	iet->mac_verify_configured = cfg->verify_enabled;
> > 
> > Changes to the verification parameters should retrigger the verification
> > state machine, even if the link did not flap. Also, changes to the
> > ENABLED state should similarly be applied right away.
> 
> .set_mm() will return -EBUSY if the interfaces are up.

So it won't work with the openlldp stack?
tools/testing/selftests/drivers/net/hw/ethtool_mm.sh won't pass either?
(see h1_create() and h2_create())

I think adding such limitation will put the icssg in a world of its own,
technically implementing the same API as other network controllers but
practically not usable with the same scripts and tools.

  reply	other threads:[~2026-01-28 13:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-07 12:51 [PATCH net-next 0/2] Add Frame Preemption MAC Merge support for ICSSG Meghana Malladi
2026-01-07 12:51 ` [PATCH net-next 1/2] net: ti: icssg-prueth: Add Frame Preemption MAC Merge support Meghana Malladi
2026-01-07 16:32   ` Vadim Fedorenko
2026-01-12  4:48     ` [EXTERNAL] " Meghana Malladi
2026-01-12 17:50   ` Vladimir Oltean
2026-01-21 12:52     ` Meghana Malladi
2026-01-15 14:57   ` Simon Horman
2026-02-04 11:18     ` Meghana Malladi
2026-01-07 12:51 ` [PATCH net-next 2/2] net: ti: icssg-prueth: Add ethtool ops for Frame Preemption MAC Merge Meghana Malladi
2026-01-12 18:14   ` Vladimir Oltean
2026-01-28 13:02     ` Malladi, Meghana
2026-01-28 13:14       ` Vladimir Oltean [this message]
2026-02-04 11:16         ` Meghana Malladi

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=20260128131409.wesidsk3z7ixptyg@skbuf \
    --to=vladimir.oltean@nxp.com \
    --cc=afd@ti.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=basharath@couthit.com \
    --cc=danishanwar@ti.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m-malladi@ti.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pmohan@couthit.com \
    --cc=rogerq@kernel.org \
    --cc=srk@ti.com \
    --cc=vadim.fedorenko@linux.dev \
    --cc=vigneshr@ti.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