diff options
author | Mark Starovoytov <mstarovoitov@marvell.com> | 2020-05-22 11:19:44 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-05-22 14:08:28 -0700 |
commit | 14ef766b13822001087d468aa41f22caa2a42022 (patch) | |
tree | df4bd4449befbd400f2150e5f8d94e36ca10e701 /drivers/net/ethernet/aquantia/atlantic/aq_main.c | |
parent | 7327699f35f8e90b32c03080b5cba4e9aa95e087 (diff) |
net: atlantic: automatically downgrade the number of queues if necessary
This patch adds support for automatic queue number downgrade.
On A2: this is a must have, because only TC0/TC1 support more than 4Q.
Other TCs support 4Qs maximum.
Thus, on A2 we must downgrade the number of queues per TC to 4, if more
than 2 TCs are requested.
On A1: this allows using 8TCs even on systems with cpu count >= 8, when
we have 8 queues by default.
We will just automatically switch to 8TCx4Q mode in this case.
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/aquantia/atlantic/aq_main.c')
-rw-r--r-- | drivers/net/ethernet/aquantia/atlantic/aq_main.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_main.c b/drivers/net/ethernet/aquantia/atlantic/aq_main.c index d8817047f4ef..57a116ccad55 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_main.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_main.c @@ -337,9 +337,12 @@ static int aq_validate_mqprio_opt(struct aq_nic_s *self, const unsigned int num_tc) { const bool has_min_rate = !!(mqprio->flags & TC_MQPRIO_F_MIN_RATE); + struct aq_nic_cfg_s *aq_nic_cfg = aq_nic_get_cfg(self); + const unsigned int tcs_max = min_t(u8, aq_nic_cfg->aq_hw_caps->tcs_max, + AQ_CFG_TCS_MAX); int i; - if (num_tc > aq_hw_num_tcs(self->aq_hw)) { + if (num_tc > tcs_max) { netdev_err(self->ndev, "Too many TCs requested\n"); return -EOPNOTSUPP; } |