Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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/20231127162135.2529363-1-srasheed@marvell.com/
====================

Link: https://lore.kernel.org/r/20231129045348.2538843-1-srasheed@marvell.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+56 -5
+1
Documentation/networking/device_drivers/ethernet/marvell/octeon_ep.rst
··· 22 22 Supported Devices 23 23 ================= 24 24 Currently, this driver support following devices: 25 + * Network controller: Cavium, Inc. Device b100 25 26 * Network controller: Cavium, Inc. Device b200 26 27 * Network controller: Cavium, Inc. Device b400 27 28 * Network controller: Cavium, Inc. Device b900
+20 -4
drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c
··· 216 216 conf->sriov_cfg.vf_srn = CN93_SDP_EPF_RINFO_SRN(val); 217 217 218 218 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 + } 222 228 dev_info(&pdev->dev, "pf_srn=%u rpvf=%u nvfs=%u rppf=%u\n", 223 229 conf->pf_ring_cfg.srn, conf->sriov_cfg.active_rings_per_vf, 224 230 conf->sriov_cfg.active_vfs, conf->pf_ring_cfg.active_io_rings); ··· 584 578 return IRQ_HANDLED; 585 579 } 586 580 581 + /* soft reset of 98xx */ 582 + static int octep_soft_reset_cn98_pf(struct octep_device *oct) 583 + { 584 + dev_info(&oct->pdev->dev, "CN98XX: skip soft reset\n"); 585 + return 0; 586 + } 587 + 587 588 /* soft reset of 93xx */ 588 589 static int octep_soft_reset_cn93_pf(struct octep_device *oct) 589 590 { ··· 819 806 oct->hw_ops.misc_intr_handler = octep_misc_intr_handler_cn93_pf; 820 807 oct->hw_ops.rsvd_intr_handler = octep_rsvd_intr_handler_cn93_pf; 821 808 oct->hw_ops.ioq_intr_handler = octep_ioq_intr_handler_cn93_pf; 822 - oct->hw_ops.soft_reset = octep_soft_reset_cn93_pf; 809 + if (oct->chip_id == OCTEP_PCI_DEVICE_ID_CN98_PF) 810 + oct->hw_ops.soft_reset = octep_soft_reset_cn98_pf; 811 + else 812 + oct->hw_ops.soft_reset = octep_soft_reset_cn93_pf; 823 813 oct->hw_ops.reinit_regs = octep_reinit_regs_cn93_pf; 824 814 825 815 oct->hw_ops.enable_interrupts = octep_enable_interrupts_cn93_pf;
+15 -1
drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
··· 26 26 27 27 /* Control plane version in which OCTEP_CTRL_NET_H2F_CMD was added */ 28 28 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] = 30 30 OCTEP_CP_VERSION(1, 0, 0) 31 31 }; 32 32 ··· 393 393 return 0; 394 394 } 395 395 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 + } 396 408 int octep_ctrl_net_uninit(struct octep_device *oct) 397 409 { 398 410 struct octep_ctrl_net_wait_data *pos, *n; 411 + 412 + octep_ctrl_net_dev_remove(oct, OCTEP_CTRL_NET_INVALID_VFID); 399 413 400 414 list_for_each_entry_safe(pos, n, &oct->ctrl_req_wait_list, list) 401 415 pos->done = 1;
+11
drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.h
··· 42 42 OCTEP_CTRL_NET_H2F_CMD_RX_STATE, 43 43 OCTEP_CTRL_NET_H2F_CMD_LINK_INFO, 44 44 OCTEP_CTRL_NET_H2F_CMD_GET_INFO, 45 + OCTEP_CTRL_NET_H2F_CMD_DEV_REMOVE, 45 46 OCTEP_CTRL_NET_H2F_CMD_MAX 46 47 }; 47 48 ··· 370 369 */ 371 370 int octep_ctrl_net_get_info(struct octep_device *oct, int vfid, 372 371 struct octep_fw_info *info); 372 + 373 + /** 374 + * octep_ctrl_net_dev_remove() - Indicate to firmware that a device unload has happened. 375 + * 376 + * @oct: non-null pointer to struct octep_device. 377 + * @vfid: Index of virtual function. 378 + * 379 + * return value: 0 on success, -errno on failure. 380 + */ 381 + int octep_ctrl_net_dev_remove(struct octep_device *oct, int vfid); 373 382 374 383 /** 375 384 * octep_ctrl_net_uninit() - Uninitialize data for ctrl net.
+4
drivers/net/ethernet/marvell/octeon_ep/octep_main.c
··· 22 22 23 23 /* Supported Devices */ 24 24 static const struct pci_device_id octep_pci_id_tbl[] = { 25 + {PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, OCTEP_PCI_DEVICE_ID_CN98_PF)}, 25 26 {PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, OCTEP_PCI_DEVICE_ID_CN93_PF)}, 26 27 {PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, OCTEP_PCI_DEVICE_ID_CNF95N_PF)}, 27 28 {PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, OCTEP_PCI_DEVICE_ID_CN10KA_PF)}, ··· 1148 1147 static const char *octep_devid_to_str(struct octep_device *oct) 1149 1148 { 1150 1149 switch (oct->chip_id) { 1150 + case OCTEP_PCI_DEVICE_ID_CN98_PF: 1151 + return "CN98XX"; 1151 1152 case OCTEP_PCI_DEVICE_ID_CN93_PF: 1152 1153 return "CN93XX"; 1153 1154 case OCTEP_PCI_DEVICE_ID_CNF95N_PF: ··· 1200 1197 dev_info(&pdev->dev, "chip_id = 0x%x\n", pdev->device); 1201 1198 1202 1199 switch (oct->chip_id) { 1200 + case OCTEP_PCI_DEVICE_ID_CN98_PF: 1203 1201 case OCTEP_PCI_DEVICE_ID_CN93_PF: 1204 1202 case OCTEP_PCI_DEVICE_ID_CNF95N_PF: 1205 1203 dev_info(&pdev->dev, "Setting up OCTEON %s PF PASS%d.%d\n",
+1
drivers/net/ethernet/marvell/octeon_ep/octep_main.h
··· 18 18 #define OCTEP_PCIID_CN93_PF 0xB200177d 19 19 #define OCTEP_PCIID_CN93_VF 0xB203177d 20 20 21 + #define OCTEP_PCI_DEVICE_ID_CN98_PF 0xB100 21 22 #define OCTEP_PCI_DEVICE_ID_CN93_PF 0xB200 22 23 #define OCTEP_PCI_DEVICE_ID_CN93_VF 0xB203 23 24
+4
drivers/net/ethernet/marvell/octeon_ep/octep_regs_cn9k_pf.h
··· 362 362 #define CN93_SDP_MAC_PF_RING_CTL_SRN(val) (((val) >> 8) & 0xFF) 363 363 #define CN93_SDP_MAC_PF_RING_CTL_RPPF(val) (((val) >> 16) & 0x3F) 364 364 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 + 365 369 /* Number of non-queue interrupts in CN93xx */ 366 370 #define CN93_NUM_NON_IOQ_INTR 16 367 371