Skip to content

Commit 981239e

Browse files
committed
Merge branch 'support-octeon-cn98-devices'
Shinas Rasheed says: ==================== support OCTEON CN98 devices Implement device unload control net API required for CN98 devices and add support in driver for the same. V1: https://lore.kernel.org/all/[email protected]/ ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 000db9e + 068b2b6 commit 981239e

File tree

7 files changed

+56
-5
lines changed

7 files changed

+56
-5
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_ctrl_net.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static atomic_t ctrl_net_msg_id;
2626

2727
/* Control plane version in which OCTEP_CTRL_NET_H2F_CMD was added */
2828
static const u32 octep_ctrl_net_h2f_cmd_versions[OCTEP_CTRL_NET_H2F_CMD_MAX] = {
29-
[OCTEP_CTRL_NET_H2F_CMD_INVALID ... OCTEP_CTRL_NET_H2F_CMD_GET_INFO] =
29+
[OCTEP_CTRL_NET_H2F_CMD_INVALID ... OCTEP_CTRL_NET_H2F_CMD_DEV_REMOVE] =
3030
OCTEP_CP_VERSION(1, 0, 0)
3131
};
3232

@@ -393,10 +393,24 @@ int octep_ctrl_net_get_info(struct octep_device *oct, int vfid,
393393
return 0;
394394
}
395395

396+
int octep_ctrl_net_dev_remove(struct octep_device *oct, int vfid)
397+
{
398+
struct octep_ctrl_net_wait_data d = {};
399+
struct octep_ctrl_net_h2f_req *req;
400+
401+
req = &d.data.req;
402+
dev_dbg(&oct->pdev->dev, "Sending dev_unload msg to fw\n");
403+
init_send_req(&d.msg, req, sizeof(int), vfid);
404+
req->hdr.s.cmd = OCTEP_CTRL_NET_H2F_CMD_DEV_REMOVE;
405+
406+
return octep_send_mbox_req(oct, &d, false);
407+
}
396408
int octep_ctrl_net_uninit(struct octep_device *oct)
397409
{
398410
struct octep_ctrl_net_wait_data *pos, *n;
399411

412+
octep_ctrl_net_dev_remove(oct, OCTEP_CTRL_NET_INVALID_VFID);
413+
400414
list_for_each_entry_safe(pos, n, &oct->ctrl_req_wait_list, list)
401415
pos->done = 1;
402416

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ enum octep_ctrl_net_h2f_cmd {
4242
OCTEP_CTRL_NET_H2F_CMD_RX_STATE,
4343
OCTEP_CTRL_NET_H2F_CMD_LINK_INFO,
4444
OCTEP_CTRL_NET_H2F_CMD_GET_INFO,
45+
OCTEP_CTRL_NET_H2F_CMD_DEV_REMOVE,
4546
OCTEP_CTRL_NET_H2F_CMD_MAX
4647
};
4748

@@ -370,6 +371,16 @@ void octep_ctrl_net_recv_fw_messages(struct octep_device *oct);
370371
int octep_ctrl_net_get_info(struct octep_device *oct, int vfid,
371372
struct octep_fw_info *info);
372373

374+
/**
375+
* octep_ctrl_net_dev_remove() - Indicate to firmware that a device unload has happened.
376+
*
377+
* @oct: non-null pointer to struct octep_device.
378+
* @vfid: Index of virtual function.
379+
*
380+
* return value: 0 on success, -errno on failure.
381+
*/
382+
int octep_ctrl_net_dev_remove(struct octep_device *oct, int vfid);
383+
373384
/**
374385
* octep_ctrl_net_uninit() - Uninitialize data for ctrl net.
375386
*

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)