linux-stable/drivers/net/ethernet/freescale
Wei Fang 21225873be net: enetc: correct the indexes of highest and 2nd highest TCs
For ENETC hardware, the TCs are numbered from 0 to N-1, where N
is the number of TCs. Numerically higher TC has higher priority.
It's obvious that the highest priority TC index should be N-1 and
the 2nd highest priority TC index should be N-2.

However, the previous logic uses netdev_get_prio_tc_map() to get
the indexes of highest priority and 2nd highest priority TCs, it
does not make sense and is incorrect to give a "tc" argument to
netdev_get_prio_tc_map(). So the driver may get the wrong indexes
of the two highest priotiry TCs which would lead to failed to set
the CBS for the two highest priotiry TCs.

e.g.
$ tc qdisc add dev eno0 parent root handle 100: mqprio num_tc 6 \
	map 0 0 1 1 2 3 4 5 queues 1@0 1@1 1@2 1@3 2@4 2@6 hw 1
$ tc qdisc replace dev eno0 parent 100:6 cbs idleslope 100000 \
	sendslope -900000 hicredit 12 locredit -113 offload 1
$ Error: Specified device failed to setup cbs hardware offload.
  ^^^^^

In this example, the previous logic deems the indexes of the two
highest priotiry TCs should be 3 and 2. Actually, the indexes are
5 and 4, because the number of TCs is 6. So it would be failed to
configure the CBS for the two highest priority TCs.

Fixes: c431047c4e ("enetc: add support Credit Based Shaper(CBS) for hardware offload")
Signed-off-by: Wei Fang <wei.fang@nxp.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2023-06-08 20:57:54 +01:00
..
dpaa Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-04-26 10:17:46 +02:00
dpaa2 net: dpaa2-mac: use Autoneg bit rather than an_enabled 2023-03-22 22:43:05 -07:00
enetc net: enetc: correct the indexes of highest and 2nd highest TCs 2023-06-08 20:57:54 +01:00
fman phy-for-6.3 2023-02-24 17:22:11 -08:00
fs_enet net: ethernet: remove fs_mii_disconnect and fs_mii_connect declarations 2022-09-19 14:08:14 -07:00
fec.h net: fec: make use of MDIO C45 quirk 2023-04-05 18:58:30 -07:00
fec_main.c net: fec: add dma_wmb to ensure correct descriptor values 2023-05-19 09:17:53 +01:00
fec_mpc52xx.c net: Use of_property_read_bool() for boolean properties 2023-03-16 17:41:28 +00:00
fec_mpc52xx.h
fec_mpc52xx_phy.c powerpc/mpc5xxx: Switch mpc5xxx_get_bus_frequency() to use fwnode 2022-06-22 12:51:49 +10:00
fec_ptp.c ptp: convert remaining drivers to adjfine interface 2022-11-11 10:58:39 +00:00
fsl_pq_mdio.c
gianfar.c net: Use of_property_read_bool() for boolean properties 2023-03-16 17:41:28 +00:00
gianfar.h eth: gfar: remove a copy of the NAPI_POLL_WEIGHT define 2022-04-29 11:56:42 +01:00
gianfar_ethtool.c net: ethernet: move from strlcpy with unused retval to strscpy 2022-08-31 14:11:26 -07:00
Kconfig net: ethernet: Add missing depends on MDIO_DEVRES 2023-04-12 20:38:48 -07:00
Makefile
ucc_geth.c net: drop the weight argument from netif_napi_add 2022-09-28 18:57:14 -07:00
ucc_geth.h
ucc_geth_ethtool.c net: ethernet: move from strlcpy with unused retval to strscpy 2022-08-31 14:11:26 -07:00
xgmac_mdio.c net: phy: Remove probe_capabilities 2023-01-19 16:23:19 +01:00