Lines Matching refs:cgx

61 static int cgx_fwi_link_change(struct cgx *cgx, int lmac_id, bool en);
74 struct cgx *cgx = cgxd; in is_dev_rpm() local
76 return (cgx->pdev->device == PCI_DEVID_CN10K_RPM); in is_dev_rpm()
79 bool is_lmac_valid(struct cgx *cgx, int lmac_id) in is_lmac_valid() argument
81 if (!cgx || lmac_id < 0 || lmac_id >= MAX_LMAC_PER_CGX) in is_lmac_valid()
83 return test_bit(lmac_id, &cgx->lmac_bmap); in is_lmac_valid()
89 static int get_sequence_id_of_lmac(struct cgx *cgx, int lmac_id) in get_sequence_id_of_lmac() argument
93 for_each_set_bit(tmp, &cgx->lmac_bmap, MAX_LMAC_PER_CGX) { in get_sequence_id_of_lmac()
107 return ((struct cgx *)cgxd)->mac_ops; in get_mac_ops()
110 void cgx_write(struct cgx *cgx, u64 lmac, u64 offset, u64 val) in cgx_write() argument
112 writeq(val, cgx->reg_base + (lmac << cgx->mac_ops->lmac_offset) + in cgx_write()
116 u64 cgx_read(struct cgx *cgx, u64 lmac, u64 offset) in cgx_read() argument
118 return readq(cgx->reg_base + (lmac << cgx->mac_ops->lmac_offset) + in cgx_read()
122 struct lmac *lmac_pdata(u8 lmac_id, struct cgx *cgx) in lmac_pdata() argument
124 if (!cgx || lmac_id >= MAX_LMAC_PER_CGX) in lmac_pdata()
127 return cgx->lmac_idmap[lmac_id]; in lmac_pdata()
132 struct cgx *cgx_dev; in cgx_get_cgxcnt_max()
147 struct cgx *cgx = cgxd; in cgx_get_lmac_cnt() local
149 if (!cgx) in cgx_get_lmac_cnt()
152 return cgx->lmac_count; in cgx_get_lmac_cnt()
157 struct cgx *cgx_dev; in cgx_get_pdata()
168 struct cgx *cgx_dev = cgx_get_pdata(cgx_id); in cgx_lmac_write()
175 struct cgx *cgx_dev = cgx_get_pdata(cgx_id); in cgx_lmac_read()
182 struct cgx *cgx = cgxd; in cgx_get_cgxid() local
184 if (!cgx) in cgx_get_cgxid()
187 return cgx->cgx_id; in cgx_get_cgxid()
192 struct cgx *cgx_dev = cgx_get_pdata(cgx_id); in cgx_lmac_get_p2x()
237 struct cgx *cgx_dev = cgx_get_pdata(cgx_id); in cgx_lmac_addr_set()
269 struct cgx *cgx = cgxd; in cgx_read_dmac_ctrl() local
274 cgx = cgxd; in cgx_read_dmac_ctrl()
276 mac_ops = cgx->mac_ops; in cgx_read_dmac_ctrl()
284 struct cgx *cgx; in cgx_read_dmac_entry() local
289 cgx = cgxd; in cgx_read_dmac_entry()
290 mac_ops = cgx->mac_ops; in cgx_read_dmac_entry()
291 return cgx_read(cgx, 0, (CGXX_CMRX_RX_DMAC_CAM0 + (index * 8))); in cgx_read_dmac_entry()
296 struct cgx *cgx_dev = cgx_get_pdata(cgx_id); in cgx_lmac_addr_add()
339 struct cgx *cgx_dev = cgx_get_pdata(cgx_id); in cgx_lmac_addr_reset()
374 struct cgx *cgx_dev = cgx_get_pdata(cgx_id); in cgx_lmac_addr_update()
407 struct cgx *cgx_dev = cgx_get_pdata(cgx_id); in cgx_lmac_addr_del()
453 struct cgx *cgx_dev = cgx_get_pdata(cgx_id); in cgx_lmac_addr_max_entries_get()
464 struct cgx *cgx_dev = cgx_get_pdata(cgx_id); in cgx_lmac_addr_get()
483 struct cgx *cgx = cgxd; in cgx_set_pkind() local
485 if (!is_lmac_valid(cgx, lmac_id)) in cgx_set_pkind()
488 cgx_write(cgx, lmac_id, CGXX_CMRX_RX_ID_MAP, (pkind & 0x3F)); in cgx_set_pkind()
494 struct cgx *cgx = cgxd; in cgx_get_lmac_type() local
497 cfg = cgx_read(cgx, lmac_id, CGXX_CMRX_CFG); in cgx_get_lmac_type()
504 struct cgx *cgx = cgxd; in cgx_lmac_internal_loopback() local
508 if (!is_lmac_valid(cgx, lmac_id)) in cgx_lmac_internal_loopback()
511 lmac_type = cgx->mac_ops->get_lmac_type(cgx, lmac_id); in cgx_lmac_internal_loopback()
513 cfg = cgx_read(cgx, lmac_id, CGXX_GMP_PCS_MRX_CTL); in cgx_lmac_internal_loopback()
518 cgx_write(cgx, lmac_id, CGXX_GMP_PCS_MRX_CTL, cfg); in cgx_lmac_internal_loopback()
520 cfg = cgx_read(cgx, lmac_id, CGXX_SPUX_CONTROL1); in cgx_lmac_internal_loopback()
525 cgx_write(cgx, lmac_id, CGXX_SPUX_CONTROL1, cfg); in cgx_lmac_internal_loopback()
532 struct cgx *cgx = cgx_get_pdata(cgx_id); in cgx_lmac_promisc_config() local
533 struct lmac *lmac = lmac_pdata(lmac_id, cgx); in cgx_lmac_promisc_config()
540 if (!cgx) in cgx_lmac_promisc_config()
543 id = get_sequence_id_of_lmac(cgx, lmac_id); in cgx_lmac_promisc_config()
545 mac_ops = cgx->mac_ops; in cgx_lmac_promisc_config()
548 cfg = cgx_read(cgx, lmac_id, CGXX_CMRX_RX_DMAC_CTL0); in cgx_lmac_promisc_config()
551 cgx_write(cgx, lmac_id, CGXX_CMRX_RX_DMAC_CTL0, cfg); in cgx_lmac_promisc_config()
555 cfg = cgx_read(cgx, 0, in cgx_lmac_promisc_config()
558 cgx_write(cgx, 0, in cgx_lmac_promisc_config()
563 cfg = cgx_read(cgx, lmac_id, CGXX_CMRX_RX_DMAC_CTL0); in cgx_lmac_promisc_config()
565 cgx_write(cgx, lmac_id, CGXX_CMRX_RX_DMAC_CTL0, cfg); in cgx_lmac_promisc_config()
568 cfg = cgx_read(cgx, 0, in cgx_lmac_promisc_config()
572 cgx_write(cgx, 0, in cgx_lmac_promisc_config()
584 struct cgx *cgx = cgxd; in cgx_lmac_enadis_rx_pause_fwding() local
587 if (!cgx) in cgx_lmac_enadis_rx_pause_fwding()
591 cfg = cgx_read(cgx, lmac_id, CGXX_GMP_GMI_RXX_FRM_CTL); in cgx_lmac_enadis_rx_pause_fwding()
593 cgx_write(cgx, lmac_id, CGXX_GMP_GMI_RXX_FRM_CTL, cfg); in cgx_lmac_enadis_rx_pause_fwding()
595 cfg = cgx_read(cgx, lmac_id, CGXX_SMUX_RX_FRM_CTL); in cgx_lmac_enadis_rx_pause_fwding()
597 cgx_write(cgx, lmac_id, CGXX_SMUX_RX_FRM_CTL, cfg); in cgx_lmac_enadis_rx_pause_fwding()
599 cfg = cgx_read(cgx, lmac_id, CGXX_GMP_GMI_RXX_FRM_CTL); in cgx_lmac_enadis_rx_pause_fwding()
601 cgx_write(cgx, lmac_id, CGXX_GMP_GMI_RXX_FRM_CTL, cfg); in cgx_lmac_enadis_rx_pause_fwding()
603 cfg = cgx_read(cgx, lmac_id, CGXX_SMUX_RX_FRM_CTL); in cgx_lmac_enadis_rx_pause_fwding()
605 cgx_write(cgx, lmac_id, CGXX_SMUX_RX_FRM_CTL, cfg); in cgx_lmac_enadis_rx_pause_fwding()
611 struct cgx *cgx = cgxd; in cgx_get_rx_stats() local
613 if (!is_lmac_valid(cgx, lmac_id)) in cgx_get_rx_stats()
615 *rx_stat = cgx_read(cgx, lmac_id, CGXX_CMRX_RX_STAT0 + (idx * 8)); in cgx_get_rx_stats()
621 struct cgx *cgx = cgxd; in cgx_get_tx_stats() local
623 if (!is_lmac_valid(cgx, lmac_id)) in cgx_get_tx_stats()
625 *tx_stat = cgx_read(cgx, lmac_id, CGXX_CMRX_TX_STAT0 + (idx * 8)); in cgx_get_tx_stats()
631 return ((struct cgx *)cgxd)->hw_features; in cgx_features_get()
666 struct cgx *cgx = cgxd; in cgx_get_fec_stats() local
668 if (!cgx || lmac_id >= cgx->lmac_count) in cgx_get_fec_stats()
671 cgx_set_fec_stats_count(&cgx->lmac_idmap[lmac_id]->link_info); in cgx_get_fec_stats()
672 if (cgx->lmac_idmap[lmac_id]->link_info.fec == OTX2_FEC_BASER) { in cgx_get_fec_stats()
681 cgx_read(cgx, lmac_id, corr_reg + (stats * 8)); in cgx_get_fec_stats()
683 cgx_read(cgx, lmac_id, uncorr_reg + (stats * 8)); in cgx_get_fec_stats()
690 struct cgx *cgx = cgxd; in cgx_lmac_rx_tx_enable() local
693 if (!is_lmac_valid(cgx, lmac_id)) in cgx_lmac_rx_tx_enable()
696 cfg = cgx_read(cgx, lmac_id, CGXX_CMRX_CFG); in cgx_lmac_rx_tx_enable()
701 cgx_write(cgx, lmac_id, CGXX_CMRX_CFG, cfg); in cgx_lmac_rx_tx_enable()
707 struct cgx *cgx = cgxd; in cgx_lmac_tx_enable() local
710 if (!is_lmac_valid(cgx, lmac_id)) in cgx_lmac_tx_enable()
713 cfg = cgx_read(cgx, lmac_id, CGXX_CMRX_CFG); in cgx_lmac_tx_enable()
721 cgx_write(cgx, lmac_id, CGXX_CMRX_CFG, cfg); in cgx_lmac_tx_enable()
728 struct cgx *cgx = cgxd; in cgx_lmac_get_pause_frm_status() local
731 if (is_dev_rpm(cgx)) in cgx_lmac_get_pause_frm_status()
734 if (!is_lmac_valid(cgx, lmac_id)) in cgx_lmac_get_pause_frm_status()
737 cfg = cgx_read(cgx, lmac_id, CGXX_SMUX_RX_FRM_CTL); in cgx_lmac_get_pause_frm_status()
740 cfg = cgx_read(cgx, lmac_id, CGXX_SMUX_TX_CTL); in cgx_lmac_get_pause_frm_status()
748 struct cgx *cgx = cgxd; in cgx_lmac_enadis_pause_frm() local
751 if (is_dev_rpm(cgx)) in cgx_lmac_enadis_pause_frm()
754 if (!is_lmac_valid(cgx, lmac_id)) in cgx_lmac_enadis_pause_frm()
757 cfg = cgx_read(cgx, lmac_id, CGXX_SMUX_RX_FRM_CTL); in cgx_lmac_enadis_pause_frm()
760 cgx_write(cgx, lmac_id, CGXX_SMUX_RX_FRM_CTL, cfg); in cgx_lmac_enadis_pause_frm()
762 cfg = cgx_read(cgx, lmac_id, CGXX_SMUX_TX_CTL); in cgx_lmac_enadis_pause_frm()
765 cgx_write(cgx, lmac_id, CGXX_SMUX_TX_CTL, cfg); in cgx_lmac_enadis_pause_frm()
767 cfg = cgx_read(cgx, 0, CGXX_CMR_RX_OVR_BP); in cgx_lmac_enadis_pause_frm()
774 cgx_write(cgx, 0, CGXX_CMR_RX_OVR_BP, cfg); in cgx_lmac_enadis_pause_frm()
780 struct cgx *cgx = cgxd; in cgx_lmac_pause_frm_config() local
783 if (!is_lmac_valid(cgx, lmac_id)) in cgx_lmac_pause_frm_config()
787 cfg = cgx_read(cgx, lmac_id, CGXX_SMUX_RX_FRM_CTL); in cgx_lmac_pause_frm_config()
789 cgx_write(cgx, lmac_id, CGXX_SMUX_RX_FRM_CTL, cfg); in cgx_lmac_pause_frm_config()
791 cfg = cgx_read(cgx, lmac_id, CGXX_GMP_GMI_RXX_FRM_CTL); in cgx_lmac_pause_frm_config()
793 cgx_write(cgx, lmac_id, CGXX_GMP_GMI_RXX_FRM_CTL, cfg); in cgx_lmac_pause_frm_config()
796 cfg = cgx_read(cgx, lmac_id, CGXX_SMUX_TX_CTL); in cgx_lmac_pause_frm_config()
798 cgx_write(cgx, lmac_id, CGXX_SMUX_TX_CTL, cfg); in cgx_lmac_pause_frm_config()
801 cgx_write(cgx, lmac_id, CGXX_SMUX_TX_PAUSE_PKT_TIME, in cgx_lmac_pause_frm_config()
803 cfg = cgx_read(cgx, lmac_id, CGXX_SMUX_TX_PAUSE_PKT_INTERVAL); in cgx_lmac_pause_frm_config()
805 cgx_write(cgx, lmac_id, CGXX_SMUX_TX_PAUSE_PKT_INTERVAL, in cgx_lmac_pause_frm_config()
808 cgx_write(cgx, lmac_id, CGXX_GMP_GMI_TX_PAUSE_PKT_TIME, in cgx_lmac_pause_frm_config()
811 cfg = cgx_read(cgx, lmac_id, in cgx_lmac_pause_frm_config()
814 cgx_write(cgx, lmac_id, CGXX_GMP_GMI_TX_PAUSE_PKT_INTERVAL, in cgx_lmac_pause_frm_config()
818 cfg = cgx_read(cgx, lmac_id, CGXX_SMUX_RX_FRM_CTL); in cgx_lmac_pause_frm_config()
820 cgx_write(cgx, lmac_id, CGXX_SMUX_RX_FRM_CTL, cfg); in cgx_lmac_pause_frm_config()
822 cfg = cgx_read(cgx, lmac_id, CGXX_GMP_GMI_RXX_FRM_CTL); in cgx_lmac_pause_frm_config()
824 cgx_write(cgx, lmac_id, CGXX_GMP_GMI_RXX_FRM_CTL, cfg); in cgx_lmac_pause_frm_config()
827 cfg = cgx_read(cgx, lmac_id, CGXX_SMUX_TX_CTL); in cgx_lmac_pause_frm_config()
829 cgx_write(cgx, lmac_id, CGXX_SMUX_TX_CTL, cfg); in cgx_lmac_pause_frm_config()
835 struct cgx *cgx = cgxd; in cgx_lmac_ptp_config() local
838 if (!cgx) in cgx_lmac_ptp_config()
843 cfg = cgx_read(cgx, lmac_id, CGXX_GMP_GMI_RXX_FRM_CTL); in cgx_lmac_ptp_config()
845 cgx_write(cgx, lmac_id, CGXX_GMP_GMI_RXX_FRM_CTL, cfg); in cgx_lmac_ptp_config()
847 cfg = cgx_read(cgx, lmac_id, CGXX_SMUX_RX_FRM_CTL); in cgx_lmac_ptp_config()
849 cgx_write(cgx, lmac_id, CGXX_SMUX_RX_FRM_CTL, cfg); in cgx_lmac_ptp_config()
852 cfg = cgx_read(cgx, lmac_id, CGXX_GMP_GMI_RXX_FRM_CTL); in cgx_lmac_ptp_config()
854 cgx_write(cgx, lmac_id, CGXX_GMP_GMI_RXX_FRM_CTL, cfg); in cgx_lmac_ptp_config()
856 cfg = cgx_read(cgx, lmac_id, CGXX_SMUX_RX_FRM_CTL); in cgx_lmac_ptp_config()
858 cgx_write(cgx, lmac_id, CGXX_SMUX_RX_FRM_CTL, cfg); in cgx_lmac_ptp_config()
865 struct cgx *cgx = lmac->cgx; in cgx_fwi_cmd_send() local
876 cmd = cgx_read(cgx, lmac->lmac_id, CGX_COMMAND_REG); in cgx_fwi_cmd_send()
889 cgx_write(cgx, lmac->lmac_id, CGX_COMMAND_REG, req); in cgx_fwi_cmd_send()
894 dev = &cgx->pdev->dev; in cgx_fwi_cmd_send()
896 cgx->cgx_id, lmac->lmac_id); in cgx_fwi_cmd_send()
911 int cgx_fwi_cmd_generic(u64 req, u64 *resp, struct cgx *cgx, int lmac_id) in cgx_fwi_cmd_generic() argument
916 lmac = lmac_pdata(lmac_id, cgx); in cgx_fwi_cmd_generic()
1072 struct cgx *cgx, u8 lmac_id) in link_status_user_format() argument
1081 linfo->lmac_type_id = cgx_get_lmac_type(cgx, lmac_id); in link_status_user_format()
1091 struct cgx *cgx = lmac->cgx; in cgx_link_change_handler() local
1096 dev = &cgx->pdev->dev; in cgx_link_change_handler()
1098 link_status_user_format(lstat, &event.link_uinfo, cgx, lmac->lmac_id); in cgx_link_change_handler()
1101 event.cgx_id = cgx->cgx_id; in cgx_link_change_handler()
1116 cgx->cgx_id, lmac->lmac_id); in cgx_link_change_handler()
1119 cgx->cgx_id, lmac->lmac_id, err_type); in cgx_link_change_handler()
1122 cgx->cgx_id, lmac->lmac_id, in cgx_link_change_handler()
1158 struct cgx *cgx; in cgx_fwi_event_handler() local
1160 cgx = lmac->cgx; in cgx_fwi_event_handler()
1163 offset = cgx->mac_ops->int_register; in cgx_fwi_event_handler()
1164 clear_bit = cgx->mac_ops->int_ena_bit; in cgx_fwi_event_handler()
1166 event = cgx_read(cgx, lmac->lmac_id, CGX_EVENT_REG); in cgx_fwi_event_handler()
1200 cgx_write(lmac->cgx, lmac->lmac_id, CGX_EVENT_REG, 0); in cgx_fwi_event_handler()
1201 cgx_write(lmac->cgx, lmac->lmac_id, offset, clear_bit); in cgx_fwi_event_handler()
1211 struct cgx *cgx = cgxd; in cgx_lmac_evh_register() local
1214 lmac = lmac_pdata(lmac_id, cgx); in cgx_lmac_evh_register()
1227 struct cgx *cgx = cgxd; in cgx_lmac_evh_unregister() local
1229 lmac = lmac_pdata(lmac_id, cgx); in cgx_lmac_evh_unregister()
1244 struct cgx *cgx; in cgx_get_fwdata_base() local
1248 cgx = list_first_entry_or_null(&cgx_list, struct cgx, cgx_list); in cgx_get_fwdata_base()
1249 if (!cgx) in cgx_get_fwdata_base()
1252 first_lmac = find_first_bit(&cgx->lmac_bmap, MAX_LMAC_PER_CGX); in cgx_get_fwdata_base()
1254 err = cgx_fwi_cmd_generic(req, &resp, cgx, first_lmac); in cgx_get_fwdata_base()
1264 struct cgx *cgx = cgxd; in cgx_set_link_mode() local
1267 if (!cgx) in cgx_set_link_mode()
1283 return cgx_fwi_cmd_generic(req, &resp, cgx, lmac_id); in cgx_set_link_mode()
1288 struct cgx *cgx; in cgx_set_fec() local
1291 cgx = cgx_get_pdata(cgx_id); in cgx_set_fec()
1292 if (!cgx) in cgx_set_fec()
1297 err = cgx_fwi_cmd_generic(req, &resp, cgx, lmac_id); in cgx_set_fec()
1301 cgx->lmac_idmap[lmac_id]->link_info.fec = in cgx_set_fec()
1303 return cgx->lmac_idmap[lmac_id]->link_info.fec; in cgx_set_fec()
1308 struct cgx *cgx = cgxd; in cgx_get_phy_fec_stats() local
1311 if (!cgx) in cgx_get_phy_fec_stats()
1315 return cgx_fwi_cmd_generic(req, &resp, cgx, lmac_id); in cgx_get_phy_fec_stats()
1318 static int cgx_fwi_link_change(struct cgx *cgx, int lmac_id, bool enable) in cgx_fwi_link_change() argument
1328 return cgx_fwi_cmd_generic(req, &resp, cgx, lmac_id); in cgx_fwi_link_change()
1331 static inline int cgx_fwi_read_version(u64 *resp, struct cgx *cgx) in cgx_fwi_read_version() argument
1333 int first_lmac = find_first_bit(&cgx->lmac_bmap, MAX_LMAC_PER_CGX); in cgx_fwi_read_version()
1337 return cgx_fwi_cmd_generic(req, resp, cgx, first_lmac); in cgx_fwi_read_version()
1340 static int cgx_lmac_verify_fwi_version(struct cgx *cgx) in cgx_lmac_verify_fwi_version() argument
1342 struct device *dev = &cgx->pdev->dev; in cgx_lmac_verify_fwi_version()
1347 if (!cgx->lmac_count) in cgx_lmac_verify_fwi_version()
1350 err = cgx_fwi_read_version(&resp, cgx); in cgx_lmac_verify_fwi_version()
1366 struct cgx *cgx = container_of(work, struct cgx, cgx_cmd_work); in cgx_lmac_linkup_work() local
1367 struct device *dev = &cgx->pdev->dev; in cgx_lmac_linkup_work()
1371 for_each_set_bit(i, &cgx->lmac_bmap, MAX_LMAC_PER_CGX) { in cgx_lmac_linkup_work()
1372 err = cgx_fwi_link_change(cgx, i, true); in cgx_lmac_linkup_work()
1375 cgx->cgx_id, i); in cgx_lmac_linkup_work()
1381 struct cgx *cgx = cgxd; in cgx_lmac_linkup_start() local
1383 if (!cgx) in cgx_lmac_linkup_start()
1386 queue_work(cgx->cgx_cmd_workq, &cgx->cgx_cmd_work); in cgx_lmac_linkup_start()
1391 static void cgx_lmac_get_fifolen(struct cgx *cgx) in cgx_lmac_get_fifolen() argument
1395 cfg = cgx_read(cgx, 0, CGX_CONST); in cgx_lmac_get_fifolen()
1396 cgx->mac_ops->fifo_len = FIELD_GET(CGX_CONST_RXFIFO_SIZE, cfg); in cgx_lmac_get_fifolen()
1399 static int cgx_configure_interrupt(struct cgx *cgx, struct lmac *lmac, in cgx_configure_interrupt() argument
1402 struct mac_ops *mac_ops = cgx->mac_ops; in cgx_configure_interrupt()
1407 irq = pci_irq_vector(cgx->pdev, mac_ops->lmac_fwi + in cgx_configure_interrupt()
1422 cgx_write(cgx, lmac->lmac_id, offset, ena_bit); in cgx_configure_interrupt()
1428 struct cgx *cgx = cgxd; in cgx_get_nr_lmacs() local
1430 return cgx_read(cgx, 0, CGXX_CMRX_RX_LMACS) & 0x7ULL; in cgx_get_nr_lmacs()
1435 struct cgx *cgx = cgxd; in cgx_get_lmacid() local
1437 return cgx->lmac_idmap[lmac_index]->lmac_id; in cgx_get_lmacid()
1442 struct cgx *cgx = cgxd; in cgx_get_lmac_bmap() local
1444 return cgx->lmac_bmap; in cgx_get_lmac_bmap()
1447 static int cgx_lmac_init(struct cgx *cgx) in cgx_lmac_init() argument
1453 cgx_lmac_get_fifolen(cgx); in cgx_lmac_init()
1455 cgx->lmac_count = cgx->mac_ops->get_nr_lmacs(cgx); in cgx_lmac_init()
1459 if (cgx->mac_ops->non_contiguous_serdes_lane) in cgx_lmac_init()
1460 lmac_list = cgx_read(cgx, 0, CGXX_CMRX_RX_LMACS) & 0xFULL; in cgx_lmac_init()
1462 if (cgx->lmac_count > MAX_LMAC_PER_CGX) in cgx_lmac_init()
1463 cgx->lmac_count = MAX_LMAC_PER_CGX; in cgx_lmac_init()
1465 for (i = 0; i < cgx->lmac_count; i++) { in cgx_lmac_init()
1474 sprintf(lmac->name, "cgx_fwi_%d_%d", cgx->cgx_id, i); in cgx_lmac_init()
1475 if (cgx->mac_ops->non_contiguous_serdes_lane) { in cgx_lmac_init()
1482 lmac->cgx = cgx; in cgx_lmac_init()
1484 MAX_DMAC_ENTRIES_PER_CGX / cgx->lmac_count; in cgx_lmac_init()
1495 err = cgx_configure_interrupt(cgx, lmac, lmac->lmac_id, false); in cgx_lmac_init()
1500 cgx->lmac_idmap[lmac->lmac_id] = lmac; in cgx_lmac_init()
1501 set_bit(lmac->lmac_id, &cgx->lmac_bmap); in cgx_lmac_init()
1502 cgx->mac_ops->mac_pause_frm_config(cgx, lmac->lmac_id, true); in cgx_lmac_init()
1505 return cgx_lmac_verify_fwi_version(cgx); in cgx_lmac_init()
1516 static int cgx_lmac_exit(struct cgx *cgx) in cgx_lmac_exit() argument
1521 if (cgx->cgx_cmd_workq) { in cgx_lmac_exit()
1522 destroy_workqueue(cgx->cgx_cmd_workq); in cgx_lmac_exit()
1523 cgx->cgx_cmd_workq = NULL; in cgx_lmac_exit()
1527 for_each_set_bit(i, &cgx->lmac_bmap, MAX_LMAC_PER_CGX) { in cgx_lmac_exit()
1528 lmac = cgx->lmac_idmap[i]; in cgx_lmac_exit()
1531 cgx->mac_ops->mac_pause_frm_config(cgx, lmac->lmac_id, false); in cgx_lmac_exit()
1532 cgx_configure_interrupt(cgx, lmac, lmac->lmac_id, true); in cgx_lmac_exit()
1541 static void cgx_populate_features(struct cgx *cgx) in cgx_populate_features() argument
1543 if (is_dev_rpm(cgx)) in cgx_populate_features()
1544 cgx->hw_features = (RVU_LMAC_FEAT_DMACF | RVU_MAC_RPM | in cgx_populate_features()
1547 cgx->hw_features = (RVU_LMAC_FEAT_FC | RVU_LMAC_FEAT_HIGIG2 | in cgx_populate_features()
1578 struct cgx *cgx; in cgx_probe() local
1581 cgx = devm_kzalloc(dev, sizeof(*cgx), GFP_KERNEL); in cgx_probe()
1582 if (!cgx) in cgx_probe()
1584 cgx->pdev = pdev; in cgx_probe()
1586 pci_set_drvdata(pdev, cgx); in cgx_probe()
1590 cgx->mac_ops = rpm_get_mac_ops(); in cgx_probe()
1592 cgx->mac_ops = &cgx_mac_ops; in cgx_probe()
1608 cgx->reg_base = pcim_iomap(pdev, PCI_CFG_REG_BAR_NUM, 0); in cgx_probe()
1609 if (!cgx->reg_base) { in cgx_probe()
1615 nvec = pci_msix_vec_count(cgx->pdev); in cgx_probe()
1623 cgx->cgx_id = (pci_resource_start(pdev, PCI_CFG_REG_BAR_NUM) >> 24) in cgx_probe()
1627 INIT_WORK(&cgx->cgx_cmd_work, cgx_lmac_linkup_work); in cgx_probe()
1628 cgx->cgx_cmd_workq = alloc_workqueue("cgx_cmd_workq", 0, 0); in cgx_probe()
1629 if (!cgx->cgx_cmd_workq) { in cgx_probe()
1635 list_add(&cgx->cgx_list, &cgx_list); in cgx_probe()
1638 cgx_populate_features(cgx); in cgx_probe()
1640 mutex_init(&cgx->lock); in cgx_probe()
1642 err = cgx_lmac_init(cgx); in cgx_probe()
1649 cgx_lmac_exit(cgx); in cgx_probe()
1650 list_del(&cgx->cgx_list); in cgx_probe()
1663 struct cgx *cgx = pci_get_drvdata(pdev); in cgx_remove() local
1665 if (cgx) { in cgx_remove()
1666 cgx_lmac_exit(cgx); in cgx_remove()
1667 list_del(&cgx->cgx_list); in cgx_remove()