diff mbox series

[v3,net-next,6/8] net: dsa: mv88e6xxx: Limit histogram counters to ingress traffic

Message ID 20231211223346.2497157-7-tobias@waldekranz.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: dsa: mv88e6xxx: Add "eth-mac" and "rmon" counter group support | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1115 this patch: 1115
netdev/cc_maintainers warning 2 maintainers not CCed: pabeni@redhat.com edumazet@google.com
netdev/build_clang success Errors and warnings before: 1142 this patch: 1142
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1142 this patch: 1142
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 49 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Tobias Waldekranz Dec. 11, 2023, 10:33 p.m. UTC
Chips in this family only has one set of histogram counters, which can
be used to count ingressing and/or egressing traffic. mv88e6xxx has,
up until this point, kept the hardware default of counting both
directions.

In the mean time, standard counter group support has been added to
ethtool. Via that interface, drivers may report ingress-only and
egress-only histograms separately - but not combined.

In order for mv88e6xxx to maximalize amount of diagnostic information
that can be exported via standard interfaces, we opt to limit the
histogram counters to ingress traffic only. Which will allow us to
export them via the standard "rmon" group in an upcoming commit.

The reason for choosing ingress-only over egress-only, is to be
compatible with RFC2819 (RMON MIB).

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
---
 drivers/net/dsa/mv88e6xxx/chip.c    | 6 +++---
 drivers/net/dsa/mv88e6xxx/global1.c | 7 +++----
 2 files changed, 6 insertions(+), 7 deletions(-)

Comments

Florian Fainelli Dec. 11, 2023, 11:03 p.m. UTC | #1
On 12/11/23 14:33, Tobias Waldekranz wrote:
> Chips in this family only has one set of histogram counters, which can
> be used to count ingressing and/or egressing traffic. mv88e6xxx has,
> up until this point, kept the hardware default of counting both
> directions.

s/has/have/

> 
> In the mean time, standard counter group support has been added to
> ethtool. Via that interface, drivers may report ingress-only and
> egress-only histograms separately - but not combined.
> 
> In order for mv88e6xxx to maximalize amount of diagnostic information
> that can be exported via standard interfaces, we opt to limit the
> histogram counters to ingress traffic only. Which will allow us to
> export them via the standard "rmon" group in an upcoming commit.

s/maximalize/maximize/

> 
> The reason for choosing ingress-only over egress-only, is to be
> compatible with RFC2819 (RMON MIB).
> 
> Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>

Out of curiosity: does this commit and the next one need to be swapped 
in order to surprises if someone happened to be bisecting across this 
patch series?

Unless there is something else that needs to be addressed, please 
address the two typos above, regardless:

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Tobias Waldekranz Dec. 11, 2023, 11:35 p.m. UTC | #2
On mon, dec 11, 2023 at 15:03, Florian Fainelli <f.fainelli@gmail.com> wrote:
> On 12/11/23 14:33, Tobias Waldekranz wrote:
>> Chips in this family only has one set of histogram counters, which can
>> be used to count ingressing and/or egressing traffic. mv88e6xxx has,
>> up until this point, kept the hardware default of counting both
>> directions.
>
> s/has/have/
>
>> 
>> In the mean time, standard counter group support has been added to
>> ethtool. Via that interface, drivers may report ingress-only and
>> egress-only histograms separately - but not combined.
>> 
>> In order for mv88e6xxx to maximalize amount of diagnostic information
>> that can be exported via standard interfaces, we opt to limit the
>> histogram counters to ingress traffic only. Which will allow us to
>> export them via the standard "rmon" group in an upcoming commit.
>
> s/maximalize/maximize/
>
>> 
>> The reason for choosing ingress-only over egress-only, is to be
>> compatible with RFC2819 (RMON MIB).
>> 
>> Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
>
> Out of curiosity: does this commit and the next one need to be swapped 
> in order to surprises if someone happened to be bisecting across this 
> patch series?

I'm not sure I follow. This commit only changes the behavior of the
existing counters (ethtool -S). If it was swapped with the next one,
then there would be one commit in the history in which the "rmon"
histogram counters would report the wrong values (the bug pointed out by
Vladimir on v2)

> Unless there is something else that needs to be addressed, please 
> address the two typos above, regardless:

s/Unless/If/?

> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>

Thanks for the review!
Florian Fainelli Dec. 12, 2023, 12:13 a.m. UTC | #3
On 12/11/23 15:35, Tobias Waldekranz wrote:
> On mon, dec 11, 2023 at 15:03, Florian Fainelli <f.fainelli@gmail.com> wrote:
>> On 12/11/23 14:33, Tobias Waldekranz wrote:
>>> Chips in this family only has one set of histogram counters, which can
>>> be used to count ingressing and/or egressing traffic. mv88e6xxx has,
>>> up until this point, kept the hardware default of counting both
>>> directions.
>>
>> s/has/have/
>>
>>>
>>> In the mean time, standard counter group support has been added to
>>> ethtool. Via that interface, drivers may report ingress-only and
>>> egress-only histograms separately - but not combined.
>>>
>>> In order for mv88e6xxx to maximalize amount of diagnostic information
>>> that can be exported via standard interfaces, we opt to limit the
>>> histogram counters to ingress traffic only. Which will allow us to
>>> export them via the standard "rmon" group in an upcoming commit.
>>
>> s/maximalize/maximize/
>>
>>>
>>> The reason for choosing ingress-only over egress-only, is to be
>>> compatible with RFC2819 (RMON MIB).
>>>
>>> Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
>>
>> Out of curiosity: does this commit and the next one need to be swapped
>> in order to surprises if someone happened to be bisecting across this
>> patch series?
> 
> I'm not sure I follow. This commit only changes the behavior of the
> existing counters (ethtool -S). If it was swapped with the next one,
> then there would be one commit in the history in which the "rmon"
> histogram counters would report the wrong values (the bug pointed out by
> Vladimir on v2)

Right, somehow I thought there was provision for reporting the TX 
histograms through the rmon interface which your subsequent patch would 
do, but it does not appear so, never mind then.

> 
>> Unless there is something else that needs to be addressed, please
>> address the two typos above, regardless:
> 
> s/Unless/If/?

Yes, the latter!
Vladimir Oltean Dec. 14, 2023, 10:53 a.m. UTC | #4
On Mon, Dec 11, 2023 at 11:33:44PM +0100, Tobias Waldekranz wrote:
> Chips in this family only has one set of histogram counters, which can
> be used to count ingressing and/or egressing traffic. mv88e6xxx has,
> up until this point, kept the hardware default of counting both
> directions.
> 
> In the mean time, standard counter group support has been added to
> ethtool. Via that interface, drivers may report ingress-only and
> egress-only histograms separately - but not combined.
> 
> In order for mv88e6xxx to maximalize amount of diagnostic information
> that can be exported via standard interfaces, we opt to limit the
> histogram counters to ingress traffic only. Which will allow us to
> export them via the standard "rmon" group in an upcoming commit.
> 
> The reason for choosing ingress-only over egress-only, is to be
> compatible with RFC2819 (RMON MIB).
> 
> Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
> ---

I guess this needs an ack from Andrew.
Andrew Lunn Dec. 14, 2023, 11:51 a.m. UTC | #5
On Mon, Dec 11, 2023 at 11:33:44PM +0100, Tobias Waldekranz wrote:
> Chips in this family only has one set of histogram counters, which can
> be used to count ingressing and/or egressing traffic. mv88e6xxx has,
> up until this point, kept the hardware default of counting both
> directions.
> 
> In the mean time, standard counter group support has been added to
> ethtool. Via that interface, drivers may report ingress-only and
> egress-only histograms separately - but not combined.
> 
> In order for mv88e6xxx to maximalize amount of diagnostic information
> that can be exported via standard interfaces, we opt to limit the
> histogram counters to ingress traffic only. Which will allow us to
> export them via the standard "rmon" group in an upcoming commit.
> 
> The reason for choosing ingress-only over egress-only, is to be
> compatible with RFC2819 (RMON MIB).
> 
> Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>

Keeping the hardware defaults is pretty arbitrary. So i don't see why
we cannot change it to fulfil standard RMON.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
diff mbox series

Patch

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 6f1f71cb0de5..a3bd12ceba7b 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -1221,7 +1221,7 @@  static size_t mv88e6095_stats_get_stat(struct mv88e6xxx_chip *chip, int port,
 		return 0;
 
 	*data = _mv88e6xxx_get_ethtool_stat(chip, stat, port, 0,
-					    MV88E6XXX_G1_STATS_OP_HIST_RX_TX);
+					    MV88E6XXX_G1_STATS_OP_HIST_RX);
 	return 1;
 }
 
@@ -1233,7 +1233,7 @@  static size_t mv88e6250_stats_get_stat(struct mv88e6xxx_chip *chip, int port,
 		return 0;
 
 	*data = _mv88e6xxx_get_ethtool_stat(chip, stat, port, 0,
-					    MV88E6XXX_G1_STATS_OP_HIST_RX_TX);
+					    MV88E6XXX_G1_STATS_OP_HIST_RX);
 	return 1;
 }
 
@@ -1246,7 +1246,7 @@  static size_t mv88e6320_stats_get_stat(struct mv88e6xxx_chip *chip, int port,
 
 	*data = _mv88e6xxx_get_ethtool_stat(chip, stat, port,
 					    MV88E6XXX_G1_STATS_OP_BANK_1_BIT_9,
-					    MV88E6XXX_G1_STATS_OP_HIST_RX_TX);
+					    MV88E6XXX_G1_STATS_OP_HIST_RX);
 	return 1;
 }
 
diff --git a/drivers/net/dsa/mv88e6xxx/global1.c b/drivers/net/dsa/mv88e6xxx/global1.c
index 174c773b38c2..49444a72ff09 100644
--- a/drivers/net/dsa/mv88e6xxx/global1.c
+++ b/drivers/net/dsa/mv88e6xxx/global1.c
@@ -462,8 +462,7 @@  int mv88e6390_g1_rmu_disable(struct mv88e6xxx_chip *chip)
 int mv88e6390_g1_stats_set_histogram(struct mv88e6xxx_chip *chip)
 {
 	return mv88e6xxx_g1_ctl2_mask(chip, MV88E6390_G1_CTL2_HIST_MODE_MASK,
-				      MV88E6390_G1_CTL2_HIST_MODE_RX |
-				      MV88E6390_G1_CTL2_HIST_MODE_TX);
+				      MV88E6390_G1_CTL2_HIST_MODE_RX);
 }
 
 int mv88e6xxx_g1_set_device_number(struct mv88e6xxx_chip *chip, int index)
@@ -491,7 +490,7 @@  int mv88e6095_g1_stats_set_histogram(struct mv88e6xxx_chip *chip)
 	if (err)
 		return err;
 
-	val |= MV88E6XXX_G1_STATS_OP_HIST_RX_TX;
+	val |= MV88E6XXX_G1_STATS_OP_HIST_RX;
 
 	err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_STATS_OP, val);
 
@@ -506,7 +505,7 @@  int mv88e6xxx_g1_stats_snapshot(struct mv88e6xxx_chip *chip, int port)
 	err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_STATS_OP,
 				 MV88E6XXX_G1_STATS_OP_BUSY |
 				 MV88E6XXX_G1_STATS_OP_CAPTURE_PORT |
-				 MV88E6XXX_G1_STATS_OP_HIST_RX_TX | port);
+				 MV88E6XXX_G1_STATS_OP_HIST_RX | port);
 	if (err)
 		return err;