Skip to content

Commit 068b2b6

Browse files
shinas-marvellkuba-moo
authored andcommitted
octeon_ep: support OCTEON CN98 devices
Add PCI Endpoint NIC support for Octeon CN98 devices. CN98 devices are part of Octeon 9 family products with similar PCI NIC characteristics to CN93, already supported driver. Add CN98 card to the device id table, as well as support differences in the register fields and certain usage scenarios such as unload. Signed-off-by: Shinas Rasheed <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent b77e23f commit 068b2b6

File tree

5 files changed

+30
-4
lines changed

5 files changed

+30
-4
lines changed

Documentation/networking/device_drivers/ethernet/marvell/octeon_ep.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ EndPoint NIC.
2222
Supported Devices
2323
=================
2424
Currently, this driver support following devices:
25+
* Network controller: Cavium, Inc. Device b100
2526
* Network controller: Cavium, Inc. Device b200
2627
* Network controller: Cavium, Inc. Device b400
2728
* Network controller: Cavium, Inc. Device b900

drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,15 @@ static void octep_init_config_cn93_pf(struct octep_device *oct)
216216
conf->sriov_cfg.vf_srn = CN93_SDP_EPF_RINFO_SRN(val);
217217

218218
val = octep_read_csr64(oct, CN93_SDP_MAC_PF_RING_CTL(oct->pcie_port));
219-
conf->pf_ring_cfg.srn = CN93_SDP_MAC_PF_RING_CTL_SRN(val);
220-
conf->pf_ring_cfg.max_io_rings = CN93_SDP_MAC_PF_RING_CTL_RPPF(val);
221-
conf->pf_ring_cfg.active_io_rings = conf->pf_ring_cfg.max_io_rings;
219+
if (oct->chip_id == OCTEP_PCI_DEVICE_ID_CN98_PF) {
220+
conf->pf_ring_cfg.srn = CN98_SDP_MAC_PF_RING_CTL_SRN(val);
221+
conf->pf_ring_cfg.max_io_rings = CN98_SDP_MAC_PF_RING_CTL_RPPF(val);
222+
conf->pf_ring_cfg.active_io_rings = conf->pf_ring_cfg.max_io_rings;
223+
} else {
224+
conf->pf_ring_cfg.srn = CN93_SDP_MAC_PF_RING_CTL_SRN(val);
225+
conf->pf_ring_cfg.max_io_rings = CN93_SDP_MAC_PF_RING_CTL_RPPF(val);
226+
conf->pf_ring_cfg.active_io_rings = conf->pf_ring_cfg.max_io_rings;
227+
}
222228
dev_info(&pdev->dev, "pf_srn=%u rpvf=%u nvfs=%u rppf=%u\n",
223229
conf->pf_ring_cfg.srn, conf->sriov_cfg.active_rings_per_vf,
224230
conf->sriov_cfg.active_vfs, conf->pf_ring_cfg.active_io_rings);
@@ -578,6 +584,13 @@ static irqreturn_t octep_ioq_intr_handler_cn93_pf(void *data)
578584
return IRQ_HANDLED;
579585
}
580586

587+
/* soft reset of 98xx */
588+
static int octep_soft_reset_cn98_pf(struct octep_device *oct)
589+
{
590+
dev_info(&oct->pdev->dev, "CN98XX: skip soft reset\n");
591+
return 0;
592+
}
593+
581594
/* soft reset of 93xx */
582595
static int octep_soft_reset_cn93_pf(struct octep_device *oct)
583596
{
@@ -806,7 +819,10 @@ void octep_device_setup_cn93_pf(struct octep_device *oct)
806819
oct->hw_ops.misc_intr_handler = octep_misc_intr_handler_cn93_pf;
807820
oct->hw_ops.rsvd_intr_handler = octep_rsvd_intr_handler_cn93_pf;
808821
oct->hw_ops.ioq_intr_handler = octep_ioq_intr_handler_cn93_pf;
809-
oct->hw_ops.soft_reset = octep_soft_reset_cn93_pf;
822+
if (oct->chip_id == OCTEP_PCI_DEVICE_ID_CN98_PF)
823+
oct->hw_ops.soft_reset = octep_soft_reset_cn98_pf;
824+
else
825+
oct->hw_ops.soft_reset = octep_soft_reset_cn93_pf;
810826
oct->hw_ops.reinit_regs = octep_reinit_regs_cn93_pf;
811827

812828
oct->hw_ops.enable_interrupts = octep_enable_interrupts_cn93_pf;

drivers/net/ethernet/marvell/octeon_ep/octep_main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ struct workqueue_struct *octep_wq;
2222

2323
/* Supported Devices */
2424
static const struct pci_device_id octep_pci_id_tbl[] = {
25+
{PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, OCTEP_PCI_DEVICE_ID_CN98_PF)},
2526
{PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, OCTEP_PCI_DEVICE_ID_CN93_PF)},
2627
{PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, OCTEP_PCI_DEVICE_ID_CNF95N_PF)},
2728
{PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, OCTEP_PCI_DEVICE_ID_CN10KA_PF)},
@@ -1147,6 +1148,8 @@ static void octep_ctrl_mbox_task(struct work_struct *work)
11471148
static const char *octep_devid_to_str(struct octep_device *oct)
11481149
{
11491150
switch (oct->chip_id) {
1151+
case OCTEP_PCI_DEVICE_ID_CN98_PF:
1152+
return "CN98XX";
11501153
case OCTEP_PCI_DEVICE_ID_CN93_PF:
11511154
return "CN93XX";
11521155
case OCTEP_PCI_DEVICE_ID_CNF95N_PF:
@@ -1197,6 +1200,7 @@ int octep_device_setup(struct octep_device *oct)
11971200
dev_info(&pdev->dev, "chip_id = 0x%x\n", pdev->device);
11981201

11991202
switch (oct->chip_id) {
1203+
case OCTEP_PCI_DEVICE_ID_CN98_PF:
12001204
case OCTEP_PCI_DEVICE_ID_CN93_PF:
12011205
case OCTEP_PCI_DEVICE_ID_CNF95N_PF:
12021206
dev_info(&pdev->dev, "Setting up OCTEON %s PF PASS%d.%d\n",

drivers/net/ethernet/marvell/octeon_ep/octep_main.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#define OCTEP_PCIID_CN93_PF 0xB200177d
1919
#define OCTEP_PCIID_CN93_VF 0xB203177d
2020

21+
#define OCTEP_PCI_DEVICE_ID_CN98_PF 0xB100
2122
#define OCTEP_PCI_DEVICE_ID_CN93_PF 0xB200
2223
#define OCTEP_PCI_DEVICE_ID_CN93_VF 0xB203
2324

drivers/net/ethernet/marvell/octeon_ep/octep_regs_cn9k_pf.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,10 @@
362362
#define CN93_SDP_MAC_PF_RING_CTL_SRN(val) (((val) >> 8) & 0xFF)
363363
#define CN93_SDP_MAC_PF_RING_CTL_RPPF(val) (((val) >> 16) & 0x3F)
364364

365+
#define CN98_SDP_MAC_PF_RING_CTL_NPFS(val) (((val) >> 48) & 0xF)
366+
#define CN98_SDP_MAC_PF_RING_CTL_SRN(val) ((val) & 0xFF)
367+
#define CN98_SDP_MAC_PF_RING_CTL_RPPF(val) (((val) >> 32) & 0x3F)
368+
365369
/* Number of non-queue interrupts in CN93xx */
366370
#define CN93_NUM_NON_IOQ_INTR 16
367371

0 commit comments

Comments
 (0)