netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	vivien.didelot@savoirfairelinux.com
Subject: Re: [PATCH net-next] net: dsa: Provide CPU port statistics to master netdev
Date: Wed, 27 Apr 2016 14:43:02 -0700	[thread overview]
Message-ID: <57213266.8020004@gmail.com> (raw)
In-Reply-To: <20160427190308.GE29024@lunn.ch>

On 27/04/16 12:03, Andrew Lunn wrote:
>> +	if (stringset == ETH_SS_STATS && ds->drv->get_strings) {
>> +		ndata = data + mcount * len;
>> +		/* This function copies ETH_GSTRINGS_LEN bytes, we will mangle
>> +		 * the output after to prepend our CPU port prefix we
>> +		 * constructed earlier
>> +		 */
>> +		ds->drv->get_strings(ds, cpu_port, ndata);
>> +		count = ds->drv->get_sset_count(ds);
>> +		for (i = 0; i < count; i++) {
>> +			memmove(ndata + (i * len + sizeof(pfx)),
>> +				ndata + i * len, len - sizeof(pfx));
>> +			memcpy(ndata + i * len, pfx, sizeof(pfx));
> 
> Hi Florian
> 
> Did you check what happens if this causes the NULL terminator to be
> discarded? Does ethtool handle that? As i said before, it is unclear
> if one is required.

I just did yes. So ethtool has a do_gstringset() function which
NULL-terminates every strings set except the statistics kind
(ETH_SS_STATS or ETH_SS_PHY_STATS) but this is not much of a problem
because it limits the output to ETH_GSTRING_LEN anyway.

After injecting a bit of error in net/dsa/slave.c to have a much bigger
prefix making us push the stats names, the stats are correcty truncated
by ethtool. So we seem to be good to go with the current code in kernel
and user space.
-- 
Florian

  reply	other threads:[~2016-04-27 21:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-27 18:45 [PATCH net-next] net: dsa: Provide CPU port statistics to master netdev Florian Fainelli
2016-04-27 19:03 ` Andrew Lunn
2016-04-27 21:43   ` Florian Fainelli [this message]
2016-04-28 21:16 ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2016-06-04  0:05 [PATCH net-next 0/9] net: dsa: misc improvements Florian Fainelli
2016-06-04  0:05 ` [PATCH net-next] net: dsa: Provide CPU port statistics to master netdev Florian Fainelli
2016-06-04  0:06   ` Florian Fainelli

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=57213266.8020004@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@savoirfairelinux.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).