net: thunderx: Set max queue count taking XDP_TX into account
authorSunil Goutham <sgoutham@cavium.com>
Fri, 24 Nov 2017 12:04:03 +0000 (15:04 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Mar 2018 08:17:54 +0000 (09:17 +0100)
[ Upstream commit 87de083857aa269fb171ef0b39696b2888361c58 ]

on T81 there are only 4 cores, hence setting max queue count to 4
would leave nothing for XDP_TX. This patch fixes this by doubling
max queue count in above scenarios.

Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
Signed-off-by: cjacob <cjacob@caviumnetworks.com>
Signed-off-by: Aleksey Makarov <aleksey.makarov@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/cavium/thunder/nicvf_main.c

index 8a37012c9c89637560fc3ae7554718b0f96163e4..c75d4ea9342b3ed9df6c36ff0ae8d48fb54c6f4c 100644 (file)
@@ -1576,6 +1576,11 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        nic->pdev = pdev;
        nic->pnicvf = nic;
        nic->max_queues = qcount;
+       /* If no of CPUs are too low, there won't be any queues left
+        * for XDP_TX, hence double it.
+        */
+       if (!nic->t88)
+               nic->max_queues *= 2;
 
        /* MAP VF's configuration registers */
        nic->reg_base = pcim_iomap(pdev, PCI_CFG_REG_BAR_NUM, 0);