net: enetc: ensure we always have a minimum number of TXQs for stack
authorVladimir Oltean <vladimir.oltean@nxp.com>
Fri, 3 Feb 2023 00:11:16 +0000 (02:11 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sat, 4 Feb 2023 04:05:57 +0000 (20:05 -0800)
commit800db2d125c2bc22c448e2386c3518e663d6db71
tree39517501525c218341b5f975adbc63640339ac30
parent4ea1dd743eb6c76dec6ed28fae7e1629961a55af
net: enetc: ensure we always have a minimum number of TXQs for stack

Currently it can happen that an mqprio qdisc is installed with num_tc 8,
and this will reserve 8 (out of 8) TXQs for the network stack. Then we
can attach an XDP program, and this will crop 2 TXQs, leaving just 6 for
mqprio. That's not what the user requested, and we should fail it.

On the other hand, if mqprio isn't requested, we still give the 8 TXQs
to the network stack (with hashing among a single traffic class), but
then, cropping 2 TXQs for XDP is fine, because the user didn't
explicitly ask for any number of TXQs, so no expectations are violated.

Simply put, the logic that mqprio should impose a minimum number of TXQs
for the network never existed. Let's say (more or less arbitrarily) that
without mqprio, the driver expects a minimum number of TXQs equal to the
number of CPUs (on NXP LS1028A, that is either 1, or 2). And with mqprio,
mqprio gives the minimum required number of TXQs.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/freescale/enetc/enetc.c
drivers/net/ethernet/freescale/enetc/enetc.h