Lines Matching refs:rpm
75 rpm_t *rpm = rpmd; in is_dev_rpm2() local
77 return (rpm->pdev->device == PCI_DEVID_CN10KB_RPM); in is_dev_rpm2()
80 struct mac_ops *rpm_get_mac_ops(rpm_t *rpm) in rpm_get_mac_ops() argument
82 if (is_dev_rpm2(rpm)) in rpm_get_mac_ops()
88 static void rpm_write(rpm_t *rpm, u64 lmac, u64 offset, u64 val) in rpm_write() argument
90 cgx_write(rpm, lmac, offset, val); in rpm_write()
93 static u64 rpm_read(rpm_t *rpm, u64 lmac, u64 offset) in rpm_read() argument
95 return cgx_read(rpm, lmac, offset); in rpm_read()
103 rpm_t *rpm = rpmd; in is_mac_rpmusx() local
105 return rpm_read(rpm, 0, RPMX_CONST1) & 0x700ULL; in is_mac_rpmusx()
110 rpm_t *rpm = rpmd; in rpm_get_nr_lmacs() local
112 return hweight8(rpm_read(rpm, 0, CGXX_CMRX_RX_LMACS) & 0xFULL); in rpm_get_nr_lmacs()
117 rpm_t *rpm = rpmd; in rpm2_get_nr_lmacs() local
119 return hweight8(rpm_read(rpm, 0, RPM2_CMRX_RX_LMACS) & 0xFFULL); in rpm2_get_nr_lmacs()
124 rpm_t *rpm = rpmd; in rpm_lmac_tx_enable() local
127 if (!is_lmac_valid(rpm, lmac_id)) in rpm_lmac_tx_enable()
130 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_tx_enable()
138 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_tx_enable()
144 rpm_t *rpm = rpmd; in rpm_lmac_rx_tx_enable() local
147 if (!is_lmac_valid(rpm, lmac_id)) in rpm_lmac_rx_tx_enable()
150 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_rx_tx_enable()
155 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_rx_tx_enable()
161 rpm_t *rpm = rpmd; in rpm_lmac_enadis_rx_pause_fwding() local
165 if (!rpm) in rpm_lmac_enadis_rx_pause_fwding()
168 lmac = lmac_pdata(lmac_id, rpm); in rpm_lmac_enadis_rx_pause_fwding()
177 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_enadis_rx_pause_fwding()
179 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_enadis_rx_pause_fwding()
181 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_enadis_rx_pause_fwding()
183 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_enadis_rx_pause_fwding()
190 rpm_t *rpm = rpmd; in rpm_lmac_get_pause_frm_status() local
193 if (!is_lmac_valid(rpm, lmac_id)) in rpm_lmac_get_pause_frm_status()
196 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_get_pause_frm_status()
205 static void rpm_cfg_pfc_quanta_thresh(rpm_t *rpm, int lmac_id, in rpm_cfg_pfc_quanta_thresh() argument
261 cfg = rpm_read(rpm, lmac_id, quanta_offset); in rpm_cfg_pfc_quanta_thresh()
270 rpm_write(rpm, lmac_id, quanta_offset, cfg); in rpm_cfg_pfc_quanta_thresh()
272 cfg = rpm_read(rpm, lmac_id, quanta_thresh); in rpm_cfg_pfc_quanta_thresh()
281 rpm_write(rpm, lmac_id, quanta_thresh, cfg); in rpm_cfg_pfc_quanta_thresh()
285 static void rpm2_lmac_cfg_bp(rpm_t *rpm, int lmac_id, u8 tx_pause, u8 rx_pause) in rpm2_lmac_cfg_bp() argument
289 cfg = rpm_read(rpm, lmac_id, RPM2_CMR_RX_OVR_BP); in rpm2_lmac_cfg_bp()
294 rpm_cfg_pfc_quanta_thresh(rpm, lmac_id, 1, true); in rpm2_lmac_cfg_bp()
298 rpm_cfg_pfc_quanta_thresh(rpm, lmac_id, 0xffff, false); in rpm2_lmac_cfg_bp()
302 rpm_write(rpm, lmac_id, RPM2_CMR_RX_OVR_BP, cfg); in rpm2_lmac_cfg_bp()
305 static void rpm_lmac_cfg_bp(rpm_t *rpm, int lmac_id, u8 tx_pause, u8 rx_pause) in rpm_lmac_cfg_bp() argument
309 cfg = rpm_read(rpm, 0, RPMX_CMR_RX_OVR_BP); in rpm_lmac_cfg_bp()
314 rpm_cfg_pfc_quanta_thresh(rpm, lmac_id, 1, true); in rpm_lmac_cfg_bp()
318 rpm_cfg_pfc_quanta_thresh(rpm, lmac_id, 0xffff, false); in rpm_lmac_cfg_bp()
322 rpm_write(rpm, 0, RPMX_CMR_RX_OVR_BP, cfg); in rpm_lmac_cfg_bp()
328 rpm_t *rpm = rpmd; in rpm_lmac_enadis_pause_frm() local
331 if (!is_lmac_valid(rpm, lmac_id)) in rpm_lmac_enadis_pause_frm()
334 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_enadis_pause_frm()
339 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_enadis_pause_frm()
341 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_enadis_pause_frm()
344 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_enadis_pause_frm()
346 if (is_dev_rpm2(rpm)) in rpm_lmac_enadis_pause_frm()
347 rpm2_lmac_cfg_bp(rpm, lmac_id, tx_pause, rx_pause); in rpm_lmac_enadis_pause_frm()
349 rpm_lmac_cfg_bp(rpm, lmac_id, tx_pause, rx_pause); in rpm_lmac_enadis_pause_frm()
356 rpm_t *rpm = rpmd; in rpm_lmac_pause_frm_config() local
360 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_pause_frm_config()
362 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_pause_frm_config()
365 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_pause_frm_config()
367 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_pause_frm_config()
370 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_pause_frm_config()
372 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_pause_frm_config()
375 if (is_dev_rpm2(rpm)) in rpm_lmac_pause_frm_config()
376 rpm_write(rpm, lmac_id, RPM2_CMR_CHAN_MSK_OR, 0xffff); in rpm_lmac_pause_frm_config()
378 rpm_write(rpm, 0, RPMX_CMR_CHAN_MSK_OR, ~0ULL); in rpm_lmac_pause_frm_config()
381 cfg = rpm_read(rpm, lmac_id, RPMX_CMRX_PRT_CBFC_CTL); in rpm_lmac_pause_frm_config()
383 rpm_write(rpm, lmac_id, RPMX_CMRX_PRT_CBFC_CTL, cfg); in rpm_lmac_pause_frm_config()
388 rpm_t *rpm = rpmd; in rpm_get_rx_stats() local
391 if (!is_lmac_valid(rpm, lmac_id)) in rpm_get_rx_stats()
394 mutex_lock(&rpm->lock); in rpm_get_rx_stats()
397 idx += lmac_id * rpm->mac_ops->rx_stats_cnt; in rpm_get_rx_stats()
400 val_lo = rpm_read(rpm, 0, RPMX_MTI_STAT_RX_STAT_PAGES_COUNTERX + in rpm_get_rx_stats()
406 val_hi = rpm_read(rpm, 0, RPMX_MTI_STAT_DATA_HI_CDC); in rpm_get_rx_stats()
410 mutex_unlock(&rpm->lock); in rpm_get_rx_stats()
416 rpm_t *rpm = rpmd; in rpm_get_tx_stats() local
419 if (!is_lmac_valid(rpm, lmac_id)) in rpm_get_tx_stats()
422 mutex_lock(&rpm->lock); in rpm_get_tx_stats()
425 idx += lmac_id * rpm->mac_ops->tx_stats_cnt; in rpm_get_tx_stats()
427 val_lo = rpm_read(rpm, 0, RPMX_MTI_STAT_TX_STAT_PAGES_COUNTERX + in rpm_get_tx_stats()
429 val_hi = rpm_read(rpm, 0, RPMX_MTI_STAT_DATA_HI_CDC); in rpm_get_tx_stats()
433 mutex_unlock(&rpm->lock); in rpm_get_tx_stats()
439 rpm_t *rpm = rpmd; in rpm_get_lmac_type() local
444 err = cgx_fwi_cmd_generic(req, &resp, rpm, 0); in rpm_get_lmac_type()
452 rpm_t *rpm = rpmd; in rpm_get_lmac_fifo_len() local
457 fifo_len = rpm->mac_ops->fifo_len; in rpm_get_lmac_fifo_len()
458 num_lmacs = rpm->mac_ops->get_nr_lmacs(rpm); in rpm_get_lmac_fifo_len()
467 hi_perf_lmac = rpm_read(rpm, 0, CGXX_CMRX_RX_LMACS); in rpm_get_lmac_fifo_len()
479 static int rpmusx_lmac_internal_loopback(rpm_t *rpm, int lmac_id, bool enable) in rpmusx_lmac_internal_loopback() argument
483 cfg = rpm_read(rpm, lmac_id, RPM2_USX_PCSX_CONTROL1); in rpmusx_lmac_internal_loopback()
489 rpm_write(rpm, lmac_id, RPM2_USX_PCSX_CONTROL1, cfg); in rpmusx_lmac_internal_loopback()
497 rpm_t *rpm = rpmd; in rpm2_get_lmac_fifo_len() local
501 lmac_info = rpm_read(rpm, 0, RPM2_CMRX_RX_LMACS); in rpm2_get_lmac_fifo_len()
507 fifo_len = rpm->mac_ops->fifo_len / 2; in rpm2_get_lmac_fifo_len()
539 rpm_t *rpm = rpmd; in rpm_lmac_internal_loopback() local
543 if (!is_lmac_valid(rpm, lmac_id)) in rpm_lmac_internal_loopback()
545 lmac_type = rpm->mac_ops->get_lmac_type(rpm, lmac_id); in rpm_lmac_internal_loopback()
548 dev_err(&rpm->pdev->dev, "loopback not supported for LPC mode\n"); in rpm_lmac_internal_loopback()
552 if (is_dev_rpm2(rpm) && is_mac_rpmusx(rpm)) in rpm_lmac_internal_loopback()
553 return rpmusx_lmac_internal_loopback(rpm, lmac_id, enable); in rpm_lmac_internal_loopback()
555 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1); in rpm_lmac_internal_loopback()
561 rpm_write(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1, cfg); in rpm_lmac_internal_loopback()
568 rpm_t *rpm = rpmd; in rpm_lmac_ptp_config() local
571 if (!is_lmac_valid(rpm, lmac_id)) in rpm_lmac_ptp_config()
574 cfg = rpm_read(rpm, lmac_id, RPMX_CMRX_CFG); in rpm_lmac_ptp_config()
583 rpm_write(rpm, lmac_id, RPMX_CMRX_CFG, cfg); in rpm_lmac_ptp_config()
585 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_XIF_MODE); in rpm_lmac_ptp_config()
594 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_XIF_MODE, cfg); in rpm_lmac_ptp_config()
600 rpm_t *rpm = rpmd; in rpm_lmac_pfc_config() local
602 if (!is_lmac_valid(rpm, lmac_id)) in rpm_lmac_pfc_config()
605 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_pfc_config()
606 class_en = rpm_read(rpm, lmac_id, RPMX_CMRX_PRT_CBFC_CTL); in rpm_lmac_pfc_config()
620 rpm_cfg_pfc_quanta_thresh(rpm, lmac_id, pfc_en, true); in rpm_lmac_pfc_config()
624 rpm_cfg_pfc_quanta_thresh(rpm, lmac_id, 0xfff, false); in rpm_lmac_pfc_config()
634 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_pfc_config()
636 pfc_class_mask_cfg = is_dev_rpm2(rpm) ? RPM2_CMRX_PRT_CBFC_CTL : in rpm_lmac_pfc_config()
639 rpm_write(rpm, lmac_id, pfc_class_mask_cfg, class_en); in rpm_lmac_pfc_config()
646 rpm_t *rpm = rpmd; in rpm_lmac_get_pfc_frm_cfg() local
649 if (!is_lmac_valid(rpm, lmac_id)) in rpm_lmac_get_pfc_frm_cfg()
652 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_get_pfc_frm_cfg()
664 rpm_t *rpm = rpmd; in rpm_get_fec_stats() local
667 if (!is_lmac_valid(rpm, lmac_id)) in rpm_get_fec_stats()
670 if (rpm->lmac_idmap[lmac_id]->link_info.fec == OTX2_FEC_NONE) in rpm_get_fec_stats()
673 if (rpm->lmac_idmap[lmac_id]->link_info.fec == OTX2_FEC_BASER) { in rpm_get_fec_stats()
674 val_lo = rpm_read(rpm, lmac_id, RPMX_MTI_FCFECX_VL0_CCW_LO); in rpm_get_fec_stats()
675 val_hi = rpm_read(rpm, lmac_id, RPMX_MTI_FCFECX_CW_HI); in rpm_get_fec_stats()
678 val_lo = rpm_read(rpm, lmac_id, RPMX_MTI_FCFECX_VL0_NCCW_LO); in rpm_get_fec_stats()
679 val_hi = rpm_read(rpm, lmac_id, RPMX_MTI_FCFECX_CW_HI); in rpm_get_fec_stats()
683 if (rpm->lmac_idmap[lmac_id]->link_info.lmac_type_id == in rpm_get_fec_stats()
685 val_lo = rpm_read(rpm, lmac_id, in rpm_get_fec_stats()
687 val_hi = rpm_read(rpm, lmac_id, in rpm_get_fec_stats()
691 val_lo = rpm_read(rpm, lmac_id, in rpm_get_fec_stats()
693 val_hi = rpm_read(rpm, lmac_id, in rpm_get_fec_stats()
699 cfg = rpm_read(rpm, 0, RPMX_MTI_STAT_STATN_CONTROL); in rpm_get_fec_stats()
701 rpm_write(rpm, 0, RPMX_MTI_STAT_STATN_CONTROL, cfg); in rpm_get_fec_stats()
703 val_lo = rpm_read(rpm, 0, in rpm_get_fec_stats()
705 val_hi = rpm_read(rpm, 0, RPMX_MTI_STAT_DATA_HI_CDC); in rpm_get_fec_stats()
708 val_lo = rpm_read(rpm, 0, in rpm_get_fec_stats()
710 val_hi = rpm_read(rpm, 0, RPMX_MTI_STAT_DATA_HI_CDC); in rpm_get_fec_stats()