Skip to content

Commit a31eb63

Browse files
committed
Merge branch 'thunderx-next'
Sunil Goutham says: ==================== net: thunderx: Support for newer chips and miscellaneous patches This patch series adds support for VNIC on 81xx and 83xx SOCs. 81xx/83xx is different from 88xx in terms of capabilities and new type of interfaces supported (eg: QSGMII, RGMII) and have DLMs instead of QLMs which allows single BGX to have interfaces of different LMAC types. Also included some patches which are common for all 88xx/81xx/83xx SOCs like using netdev's name while registering irqs, reset receive queue stats and some changes to use standard API for split buffer Rx packets, generating RSS key e.t.c PS: Most of the patches were submitted earlier under different series but for some reason were not picked up by patchwork. Since new patches have been added in the meantime, resubmitting all as a new patchset. Changes from v1: - Incorporated Yuval Mintz's suggestion to use generic API to set minimum queue count i.e by using netif_get_num_default_rss_queues(). - Resolved a compilation issue reported by test robot while compiling patch 'Add support for 16 LMACs of 83xx' ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 2ce66f9 + 93db2cf commit a31eb63

File tree

11 files changed

+1059
-346
lines changed

11 files changed

+1059
-346
lines changed

drivers/net/ethernet/cavium/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,20 @@ config THUNDER_NIC_BGX
3636
depends on 64BIT
3737
select PHYLIB
3838
select MDIO_THUNDER
39+
select THUNDER_NIC_RGX
3940
---help---
4041
This driver supports programming and controlling of MAC
4142
interface from NIC physical function driver.
4243

44+
config THUNDER_NIC_RGX
45+
tristate "Thunder MAC interface driver (RGX)"
46+
depends on 64BIT
47+
select PHYLIB
48+
select MDIO_THUNDER
49+
---help---
50+
This driver supports configuring XCV block of RGX interface
51+
present on CN81XX chip.
52+
4353
config LIQUIDIO
4454
tristate "Cavium LiquidIO support"
4555
depends on 64BIT

drivers/net/ethernet/cavium/thunder/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Makefile for Cavium's Thunder ethernet device
33
#
44

5+
obj-$(CONFIG_THUNDER_NIC_RGX) += thunder_xcv.o
56
obj-$(CONFIG_THUNDER_NIC_BGX) += thunder_bgx.o
67
obj-$(CONFIG_THUNDER_NIC_PF) += nicpf.o
78
obj-$(CONFIG_THUNDER_NIC_VF) += nicvf.o

drivers/net/ethernet/cavium/thunder/nic.h

Lines changed: 49 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@
2020
#define PCI_DEVICE_ID_THUNDER_NIC_VF 0xA034
2121
#define PCI_DEVICE_ID_THUNDER_BGX 0xA026
2222

23+
/* Subsystem device IDs */
24+
#define PCI_SUBSYS_DEVID_88XX_NIC_PF 0xA11E
25+
#define PCI_SUBSYS_DEVID_81XX_NIC_PF 0xA21E
26+
#define PCI_SUBSYS_DEVID_83XX_NIC_PF 0xA31E
27+
28+
#define PCI_SUBSYS_DEVID_88XX_PASS1_NIC_VF 0xA11E
29+
#define PCI_SUBSYS_DEVID_88XX_NIC_VF 0xA134
30+
#define PCI_SUBSYS_DEVID_81XX_NIC_VF 0xA234
31+
#define PCI_SUBSYS_DEVID_83XX_NIC_VF 0xA334
32+
33+
2334
/* PCI BAR nos */
2435
#define PCI_CFG_REG_BAR_NUM 0
2536
#define PCI_MSIX_REG_BAR_NUM 4
@@ -41,40 +52,8 @@
4152
/* Max pkinds */
4253
#define NIC_MAX_PKIND 16
4354

44-
/* Rx Channels */
45-
/* Receive channel configuration in TNS bypass mode
46-
* Below is configuration in TNS bypass mode
47-
* BGX0-LMAC0-CHAN0 - VNIC CHAN0
48-
* BGX0-LMAC1-CHAN0 - VNIC CHAN16
49-
* ...
50-
* BGX1-LMAC0-CHAN0 - VNIC CHAN128
51-
* ...
52-
* BGX1-LMAC3-CHAN0 - VNIC CHAN174
53-
*/
54-
#define NIC_INTF_COUNT 2 /* Interfaces btw VNIC and TNS/BGX */
55-
#define NIC_CHANS_PER_INF 128
56-
#define NIC_MAX_CHANS (NIC_INTF_COUNT * NIC_CHANS_PER_INF)
57-
#define NIC_CPI_COUNT 2048 /* No of channel parse indices */
58-
59-
/* TNS bypass mode: 1-1 mapping between VNIC and BGX:LMAC */
60-
#define NIC_MAX_BGX MAX_BGX_PER_CN88XX
61-
#define NIC_CPI_PER_BGX (NIC_CPI_COUNT / NIC_MAX_BGX)
62-
#define NIC_MAX_CPI_PER_LMAC 64 /* Max when CPI_ALG is IP diffserv */
63-
#define NIC_RSSI_PER_BGX (NIC_RSSI_COUNT / NIC_MAX_BGX)
64-
65-
/* Tx scheduling */
66-
#define NIC_MAX_TL4 1024
67-
#define NIC_MAX_TL4_SHAPERS 256 /* 1 shaper for 4 TL4s */
68-
#define NIC_MAX_TL3 256
69-
#define NIC_MAX_TL3_SHAPERS 64 /* 1 shaper for 4 TL3s */
70-
#define NIC_MAX_TL2 64
71-
#define NIC_MAX_TL2_SHAPERS 2 /* 1 shaper for 32 TL2s */
72-
#define NIC_MAX_TL1 2
73-
74-
/* TNS bypass mode */
75-
#define NIC_TL2_PER_BGX 32
76-
#define NIC_TL4_PER_BGX (NIC_MAX_TL4 / NIC_MAX_BGX)
77-
#define NIC_TL4_PER_LMAC (NIC_MAX_TL4 / NIC_CHANS_PER_INF)
55+
/* Max when CPI_ALG is IP diffserv */
56+
#define NIC_MAX_CPI_PER_LMAC 64
7857

7958
/* NIC VF Interrupts */
8059
#define NICVF_INTR_CQ 0
@@ -148,7 +127,6 @@ struct nicvf_cq_poll {
148127
struct napi_struct napi;
149128
};
150129

151-
#define NIC_RSSI_COUNT 4096 /* Total no of RSS indices */
152130
#define NIC_MAX_RSS_HASH_BITS 8
153131
#define NIC_MAX_RSS_IDR_TBL_SIZE (1 << NIC_MAX_RSS_HASH_BITS)
154132
#define RSS_HASH_KEY_SIZE 5 /* 320 bit key */
@@ -273,6 +251,7 @@ struct nicvf {
273251
struct net_device *netdev;
274252
struct pci_dev *pdev;
275253
void __iomem *reg_base;
254+
#define MAX_QUEUES_PER_QSET 8
276255
struct queue_set *qs;
277256
struct nicvf_cq_poll *napi[8];
278257
u8 vf_id;
@@ -368,6 +347,7 @@ struct nicvf {
368347
#define NIC_MBOX_MSG_PNICVF_PTR 0x14 /* Get primary qset nicvf ptr */
369348
#define NIC_MBOX_MSG_SNICVF_PTR 0x15 /* Send sqet nicvf ptr to PVF */
370349
#define NIC_MBOX_MSG_LOOPBACK 0x16 /* Set interface in loopback */
350+
#define NIC_MBOX_MSG_RESET_STAT_COUNTER 0x17 /* Reset statistics counters */
371351
#define NIC_MBOX_MSG_CFG_DONE 0xF0 /* VF configuration done */
372352
#define NIC_MBOX_MSG_SHUTDOWN 0xF1 /* VF is being shutdown */
373353

@@ -484,6 +464,31 @@ struct set_loopback {
484464
bool enable;
485465
};
486466

467+
/* Reset statistics counters */
468+
struct reset_stat_cfg {
469+
u8 msg;
470+
/* Bitmap to select NIC_PF_VNIC(vf_id)_RX_STAT(0..13) */
471+
u16 rx_stat_mask;
472+
/* Bitmap to select NIC_PF_VNIC(vf_id)_TX_STAT(0..4) */
473+
u8 tx_stat_mask;
474+
/* Bitmap to select NIC_PF_QS(0..127)_RQ(0..7)_STAT(0..1)
475+
* bit14, bit15 NIC_PF_QS(vf_id)_RQ7_STAT(0..1)
476+
* bit12, bit13 NIC_PF_QS(vf_id)_RQ6_STAT(0..1)
477+
* ..
478+
* bit2, bit3 NIC_PF_QS(vf_id)_RQ1_STAT(0..1)
479+
* bit0, bit1 NIC_PF_QS(vf_id)_RQ0_STAT(0..1)
480+
*/
481+
u16 rq_stat_mask;
482+
/* Bitmap to select NIC_PF_QS(0..127)_SQ(0..7)_STAT(0..1)
483+
* bit14, bit15 NIC_PF_QS(vf_id)_SQ7_STAT(0..1)
484+
* bit12, bit13 NIC_PF_QS(vf_id)_SQ6_STAT(0..1)
485+
* ..
486+
* bit2, bit3 NIC_PF_QS(vf_id)_SQ1_STAT(0..1)
487+
* bit0, bit1 NIC_PF_QS(vf_id)_SQ0_STAT(0..1)
488+
*/
489+
u16 sq_stat_mask;
490+
};
491+
487492
/* 128 bit shared memory between PF and each VF */
488493
union nic_mbx {
489494
struct { u8 msg; } msg;
@@ -501,6 +506,7 @@ union nic_mbx {
501506
struct sqs_alloc sqs_alloc;
502507
struct nicvf_ptr nicvf;
503508
struct set_loopback lbk;
509+
struct reset_stat_cfg reset_stat;
504510
};
505511

506512
#define NIC_NODE_ID_MASK 0x03
@@ -514,7 +520,14 @@ static inline int nic_get_node_id(struct pci_dev *pdev)
514520

515521
static inline bool pass1_silicon(struct pci_dev *pdev)
516522
{
517-
return pdev->revision < 8;
523+
return (pdev->revision < 8) &&
524+
(pdev->subsystem_device == PCI_SUBSYS_DEVID_88XX_NIC_PF);
525+
}
526+
527+
static inline bool pass2_silicon(struct pci_dev *pdev)
528+
{
529+
return (pdev->revision >= 8) &&
530+
(pdev->subsystem_device == PCI_SUBSYS_DEVID_88XX_NIC_PF);
518531
}
519532

520533
int nicvf_set_real_num_queues(struct net_device *netdev,

0 commit comments

Comments
 (0)