linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Alvin Šipraga" <ALSI@bang-olufsen.dk>
To: Jakub Kicinski <kuba@kernel.org>
Cc: "Alvin Šipraga" <alvin@pqrs.dk>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Andrew Lunn" <andrew@lunn.ch>,
	"Vivien Didelot" <vivien.didelot@gmail.com>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Vladimir Oltean" <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Heiner Kallweit" <hkallweit1@gmail.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"Michael Rasmussen" <MIR@bang-olufsen.dk>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next 5/6] net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC
Date: Thu, 14 Oct 2021 12:44:37 +0000	[thread overview]
Message-ID: <80c80992-85c2-d971-ce1c-a37f8199da7a@bang-olufsen.dk> (raw)
In-Reply-To: <20211013081340.0ca97db1@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>

On 10/13/21 5:13 PM, Jakub Kicinski wrote:
> On Wed, 13 Oct 2021 08:33:36 +0000 Alvin Šipraga wrote:
>> On 10/12/21 5:27 PM, Jakub Kicinski wrote:
>>> On Tue, 12 Oct 2021 14:35:54 +0200 Alvin Šipraga wrote:
>>>> +	{ 0, 4, 2, "dot3StatsFCSErrors" },
>>>> +	{ 0, 6, 2, "dot3StatsSymbolErrors" },
>>>> +	{ 0, 8, 2, "dot3InPauseFrames" },
>>>> +	{ 0, 10, 2, "dot3ControlInUnknownOpcodes" },
>>> ...
>>>
>>> You must expose counters via existing standard APIs.
>>>
>>> You should implement these ethtool ops:
>>
>> I implement the dsa_switch_ops callback .get_ethtool_stats, using an
>> existing function rtl8366_get_ethtool_stats in the switch helper library
>> rtl8366.c. It was my understanding that this is the correct way to
>> expose counters within the DSA framework - please correct me if that is
>> wrong.
> 
> It's the legacy way, today we have a unified API for reporting those
> stats so user space SW doesn't have to maintain a myriad string matches
> to get to basic IEEE stats across vendors. Driver authors have a truly
> incredible ability to invent their own names for standard stats. It
> appears that your pick of names is also unique :)
> 
> It should be trivial to plumb the relevant ethtool_ops thru to
> dsa_switch_ops if relevant dsa ops don't exist.
> 
> You should also populate correct stats in dsa_switch_ops::get_stats64
> (see the large comment above the definition of struct
> rtnl_link_stats64 for mapping). A word of warning there, tho, that
> callback runs in an atomic context so if your driver needs to block it
> has to read the stats periodically from a async work.

OK, so just to clarify:

- get_ethtool_stats is deprecated - do not use
- get_eth_{phy,mac,ctrl,rmon}_stats is the new API - add DSA plumbing 
and use this
- get_stats64 orthogonal to ethtool stats but still important - use also 
this

For stats64 I will need to poll asynchronously - do you have any 
suggestion for how frequently I should do that? I see one DSA driver 
doing it every 3 seconds, for example.

Thanks

	Alvin

> 
>> The structure you highlight is just some internal glue to sort out the
>> internal register mapping. I borrowed the approach from the existing
>> rtl8366rb.c Realtek SMI subdriver.
> 
> The callbacks listed below are relatively new, they may have not
> existed when that driver was written. Also I may have missed it
> in review.
> 
>>> 	void	(*get_eth_phy_stats)(struct net_device *dev,
>>> 				     struct ethtool_eth_phy_stats *phy_stats);
>>> 	void	(*get_eth_mac_stats)(struct net_device *dev,
>>> 				     struct ethtool_eth_mac_stats *mac_stats);
>>> 	void	(*get_eth_ctrl_stats)(struct net_device *dev,
>>> 				      struct ethtool_eth_ctrl_stats *ctrl_stats);
>>> 	void	(*get_rmon_stats)(struct net_device *dev,
>>> 				  struct ethtool_rmon_stats *rmon_stats,
>>> 				  const struct ethtool_rmon_hist_range **ranges);


  reply	other threads:[~2021-10-14 12:44 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12 12:35 [PATCH net-next 0/6] net: dsa: add support for RTL8365MB-VC Alvin Šipraga
2021-10-12 12:35 ` [PATCH net-next 1/6] ether: add EtherType for proprietary Realtek protocols Alvin Šipraga
2021-10-12 13:09   ` Vladimir Oltean
2021-10-12 12:35 ` [PATCH net-next 2/6] net: dsa: move NET_DSA_TAG_RTL4_A to right place in Kconfig/Makefile Alvin Šipraga
2021-10-12 12:42   ` Vladimir Oltean
2021-10-13 10:50   ` Linus Walleij
2021-10-12 12:35 ` [PATCH net-next 3/6] dt-bindings: net: dsa: realtek-smi: document new compatible rtl8365mb Alvin Šipraga
2021-10-12 12:35 ` [PATCH net-next 4/6] net: dsa: tag_rtl8_4: add realtek 8 byte protocol 4 tag Alvin Šipraga
2021-10-12 12:50   ` Vladimir Oltean
2021-10-12 12:56     ` Alvin Šipraga
2021-10-13  9:45   ` DENG Qingfang
2021-10-13  9:52     ` Alvin Šipraga
2021-10-13 11:02   ` Linus Walleij
2021-10-12 12:35 ` [PATCH net-next 5/6] net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC Alvin Šipraga
2021-10-12 13:04   ` Vladimir Oltean
2021-10-12 13:22     ` Alvin Šipraga
2021-10-12 13:50       ` Alvin Šipraga
2021-10-12 14:03         ` Vladimir Oltean
2021-10-12 14:30           ` Alvin Šipraga
2021-10-12 15:27   ` Jakub Kicinski
2021-10-13  8:33     ` Alvin Šipraga
2021-10-13 15:13       ` Jakub Kicinski
2021-10-14 12:44         ` Alvin Šipraga [this message]
2021-10-14 14:08           ` Jakub Kicinski
2021-10-13  9:55   ` DENG Qingfang
2021-10-13 10:05     ` Alvin Šipraga
2021-10-13 10:10       ` Vladimir Oltean
2021-10-13 10:13       ` DENG Qingfang
2021-10-13 15:12   ` Linus Walleij
2021-10-14 12:11     ` Alvin Šipraga
2021-10-12 12:35 ` [PATCH net-next 6/6] net: phy: realtek: add support for RTL8365MB-VC internal PHYs Alvin Šipraga

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=80c80992-85c2-d971-ce1c-a37f8199da7a@bang-olufsen.dk \
    --to=alsi@bang-olufsen.dk \
    --cc=MIR@bang-olufsen.dk \
    --cc=alvin@pqrs.dk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=vivien.didelot@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 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).