linux-stable/net/dsa
Vladimir Oltean b94cbc909f net: dsa: fix error code getting shifted with 4 in dsa_slave_get_sset_count
DSA implements a bunch of 'standardized' ethtool statistics counters,
namely tx_packets, tx_bytes, rx_packets, rx_bytes. So whatever the
hardware driver returns in .get_sset_count(), we need to add 4 to that.

That is ok, except that .get_sset_count() can return a negative error
code, for example:

b53_get_sset_count
-> phy_ethtool_get_sset_count
   -> return -EIO

-EIO is -5, and with 4 added to it, it becomes -1, aka -EPERM. One can
imagine that certain error codes may even become positive, although
based on code inspection I did not see instances of that.

Check the error code first, if it is negative return it as-is.

Based on a similar patch for dsa_master_get_strings from Dan Carpenter:
https://patchwork.kernel.org/project/netdevbpf/patch/YJaSe3RPgn7gKxZv@mwanda/

Fixes: 91da11f870 ("net: Distributed Switch Architecture protocol support")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-05-10 14:36:59 -07:00
..
dsa.c net: dsa: allow changing the tag protocol via the "tagging" device attribute 2021-01-29 21:24:39 -08:00
dsa2.c net: dsa: Allow default tag protocol to be overridden from DT 2021-04-20 16:51:20 -07:00
dsa_priv.h net: dsa: sync up switchdev objects and port attributes when joining the bridge 2021-03-23 14:49:06 -07:00
Kconfig net: selftest: fix build issue if INET is disabled 2021-04-28 14:06:45 -07:00
Makefile net: dsa: add a second tagger for Ocelot switches based on tag_8021q 2021-01-29 21:25:27 -08:00
master.c net: dsa: fix a crash if ->get_sset_count() fails 2021-05-10 14:31:27 -07:00
port.c net: dsa: fix bridge support for drivers without port_bridge_flags callback 2021-04-21 10:47:27 -07:00
slave.c net: dsa: fix error code getting shifted with 4 in dsa_slave_get_sset_count 2021-05-10 14:36:59 -07:00
switch.c net: dsa: Only notify CPU ports of changes to the tag protocol 2021-04-20 16:51:19 -07:00
tag_8021q.c net: dsa: tag_8021q: add helpers to deduce whether a VLAN ID is RX or TX VLAN 2021-01-29 21:24:30 -08:00
tag_ar9331.c net: dsa: tag_ar9331: let DSA core deal with TX reallocation 2020-11-02 17:41:17 -08:00
tag_brcm.c net: dsa: tag_brcm: add support for legacy tags 2021-03-17 12:24:36 -07:00
tag_dsa.c net: dsa: tag_dsa: Support reception of packets from LAG devices 2021-01-14 17:11:56 -08:00
tag_gswip.c net: dsa: tag_gswip: let DSA core deal with TX reallocation 2020-11-02 17:41:16 -08:00
tag_hellcreek.c net: dsa: tag_hellcreek: Cleanup includes 2020-11-23 16:57:21 -08:00
tag_ksz.c net: dsa: tag_ksz: don't allocate additional memory for padding/tagging 2020-11-02 17:41:16 -08:00
tag_lan9303.c net: dsa: tag_lan9303: let DSA core deal with TX reallocation 2020-11-02 17:41:16 -08:00
tag_mtk.c net: dsa: mt7530: support MDB and bridge flag operations 2021-03-16 11:54:41 -07:00
tag_ocelot.c net: mscc: ocelot: support PTP Sync one-step timestamping 2021-04-27 14:10:15 -07:00
tag_ocelot_8021q.c net: mscc: ocelot: support PTP Sync one-step timestamping 2021-04-27 14:10:15 -07:00
tag_qca.c net: dsa: tag_qca: let DSA core deal with TX reallocation 2020-11-02 17:41:16 -08:00
tag_rtl4_a.c net: dsa: Fix a typo in tag_rtl4_a.c 2021-03-25 17:05:08 -07:00
tag_sja1105.c net: dsa: tag_sja1105: use a custom flow dissector procedure 2020-09-26 14:17:59 -07:00
tag_trailer.c net: dsa: trailer: don't allocate additional memory for padding/tagging 2020-11-02 17:41:16 -08:00
tag_xrs700x.c net: dsa: xrs700x: add HSR offloading support 2021-02-11 13:24:45 -08:00