Lines Matching refs:pfvf
72 static struct cgx_fw_data *otx2_get_fwdata(struct otx2_nic *pfvf);
77 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2_get_drvinfo() local
80 strscpy(info->bus_info, pci_name(pfvf->pdev), sizeof(info->bus_info)); in otx2_get_drvinfo()
83 static void otx2_get_qset_strings(struct otx2_nic *pfvf, u8 **data, int qset) in otx2_get_qset_strings() argument
85 int start_qidx = qset * pfvf->hw.rx_queues; in otx2_get_qset_strings()
88 for (qidx = 0; qidx < pfvf->hw.rx_queues; qidx++) in otx2_get_qset_strings()
93 for (qidx = 0; qidx < otx2_get_total_tx_queues(pfvf); qidx++) in otx2_get_qset_strings()
95 if (qidx >= pfvf->hw.non_qos_queues) in otx2_get_qset_strings()
98 pfvf->hw.non_qos_queues, in otx2_get_qset_strings()
108 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2_get_strings() local
120 otx2_get_qset_strings(pfvf, &data, 0); in otx2_get_strings()
122 if (!test_bit(CN10K_RPM, &pfvf->hw.cap_flag)) { in otx2_get_strings()
135 static void otx2_get_qset_stats(struct otx2_nic *pfvf, in otx2_get_qset_stats() argument
140 if (!pfvf) in otx2_get_qset_stats()
142 for (qidx = 0; qidx < pfvf->hw.rx_queues; qidx++) { in otx2_get_qset_stats()
143 if (!otx2_update_rq_stats(pfvf, qidx)) { in otx2_get_qset_stats()
149 *((*data)++) = ((u64 *)&pfvf->qset.rq[qidx].stats) in otx2_get_qset_stats()
153 for (qidx = 0; qidx < otx2_get_total_tx_queues(pfvf); qidx++) { in otx2_get_qset_stats()
154 if (!otx2_update_sq_stats(pfvf, qidx)) { in otx2_get_qset_stats()
160 *((*data)++) = ((u64 *)&pfvf->qset.sq[qidx].stats) in otx2_get_qset_stats()
165 static int otx2_get_phy_fec_stats(struct otx2_nic *pfvf) in otx2_get_phy_fec_stats() argument
170 mutex_lock(&pfvf->mbox.lock); in otx2_get_phy_fec_stats()
171 req = otx2_mbox_alloc_msg_cgx_get_phy_fec_stats(&pfvf->mbox); in otx2_get_phy_fec_stats()
175 if (!otx2_sync_mbox_msg(&pfvf->mbox)) in otx2_get_phy_fec_stats()
178 mutex_unlock(&pfvf->mbox.lock); in otx2_get_phy_fec_stats()
186 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2_get_ethtool_stats() local
191 otx2_get_dev_stats(pfvf); in otx2_get_ethtool_stats()
193 *(data++) = ((u64 *)&pfvf->hw.dev_stats) in otx2_get_ethtool_stats()
197 *(data++) = atomic_read(&((atomic_t *)&pfvf->hw.drv_stats) in otx2_get_ethtool_stats()
200 otx2_get_qset_stats(pfvf, stats, &data); in otx2_get_ethtool_stats()
202 if (!test_bit(CN10K_RPM, &pfvf->hw.cap_flag)) { in otx2_get_ethtool_stats()
203 otx2_update_lmac_stats(pfvf); in otx2_get_ethtool_stats()
205 *(data++) = pfvf->hw.cgx_rx_stats[stat]; in otx2_get_ethtool_stats()
207 *(data++) = pfvf->hw.cgx_tx_stats[stat]; in otx2_get_ethtool_stats()
210 *(data++) = pfvf->reset_count; in otx2_get_ethtool_stats()
212 fec_corr_blks = pfvf->hw.cgx_fec_corr_blks; in otx2_get_ethtool_stats()
213 fec_uncorr_blks = pfvf->hw.cgx_fec_uncorr_blks; in otx2_get_ethtool_stats()
215 rsp = otx2_get_fwdata(pfvf); in otx2_get_ethtool_stats()
217 !otx2_get_phy_fec_stats(pfvf)) { in otx2_get_ethtool_stats()
221 rsp = otx2_get_fwdata(pfvf); in otx2_get_ethtool_stats()
225 if (pfvf->linfo.fec == OTX2_FEC_BASER) { in otx2_get_ethtool_stats()
241 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2_get_sset_count() local
248 (pfvf->hw.rx_queues + otx2_get_total_tx_queues(pfvf)); in otx2_get_sset_count()
249 if (!test_bit(CN10K_RPM, &pfvf->hw.cap_flag)) in otx2_get_sset_count()
251 otx2_update_lmac_fec_stats(pfvf); in otx2_get_sset_count()
261 struct otx2_nic *pfvf = netdev_priv(dev); in otx2_get_channels() local
263 channel->max_rx = pfvf->hw.max_queues; in otx2_get_channels()
264 channel->max_tx = pfvf->hw.max_queues; in otx2_get_channels()
266 channel->rx_count = pfvf->hw.rx_queues; in otx2_get_channels()
267 channel->tx_count = pfvf->hw.tx_queues; in otx2_get_channels()
274 struct otx2_nic *pfvf = netdev_priv(dev); in otx2_set_channels() local
281 if (bitmap_weight(&pfvf->rq_bmap, pfvf->hw.rx_queues) > 1) { in otx2_set_channels()
290 qos_txqs = bitmap_weight(pfvf->qos.qos_sq_bmap, in otx2_set_channels()
298 pfvf->hw.rx_queues = channel->rx_count; in otx2_set_channels()
299 pfvf->hw.tx_queues = channel->tx_count; in otx2_set_channels()
300 if (pfvf->xdp_prog) in otx2_set_channels()
301 pfvf->hw.xdp_queues = channel->rx_count; in otx2_set_channels()
307 pfvf->hw.tx_queues, pfvf->hw.rx_queues); in otx2_set_channels()
315 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2_get_pauseparam() local
318 if (is_otx2_lbkvf(pfvf->pdev)) in otx2_get_pauseparam()
321 mutex_lock(&pfvf->mbox.lock); in otx2_get_pauseparam()
322 req = otx2_mbox_alloc_msg_cgx_cfg_pause_frm(&pfvf->mbox); in otx2_get_pauseparam()
324 mutex_unlock(&pfvf->mbox.lock); in otx2_get_pauseparam()
328 if (!otx2_sync_mbox_msg(&pfvf->mbox)) { in otx2_get_pauseparam()
330 otx2_mbox_get_rsp(&pfvf->mbox.mbox, 0, &req->hdr); in otx2_get_pauseparam()
332 mutex_unlock(&pfvf->mbox.lock); in otx2_get_pauseparam()
339 mutex_unlock(&pfvf->mbox.lock); in otx2_get_pauseparam()
345 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2_set_pauseparam() local
350 if (is_otx2_lbkvf(pfvf->pdev)) in otx2_set_pauseparam()
354 pfvf->flags |= OTX2_FLAG_RX_PAUSE_ENABLED; in otx2_set_pauseparam()
356 pfvf->flags &= ~OTX2_FLAG_RX_PAUSE_ENABLED; in otx2_set_pauseparam()
359 pfvf->flags |= OTX2_FLAG_TX_PAUSE_ENABLED; in otx2_set_pauseparam()
361 pfvf->flags &= ~OTX2_FLAG_TX_PAUSE_ENABLED; in otx2_set_pauseparam()
363 return otx2_config_pause_frm(pfvf); in otx2_set_pauseparam()
371 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2_get_ringparam() local
372 struct otx2_qset *qs = &pfvf->qset; in otx2_get_ringparam()
378 kernel_ring->rx_buf_len = pfvf->hw.rbuf_len; in otx2_get_ringparam()
379 kernel_ring->cqe_size = pfvf->hw.xqe_size; in otx2_get_ringparam()
387 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2_set_ringparam() local
389 u32 old_rx_buf_len = pfvf->hw.rbuf_len; in otx2_set_ringparam()
392 struct otx2_qset *qs = &pfvf->qset; in otx2_set_ringparam()
418 if (rx_count < pfvf->hw.rq_skid) in otx2_set_ringparam()
419 rx_count = pfvf->hw.rq_skid; in otx2_set_ringparam()
431 rx_buf_len == old_rx_buf_len && xqe_size == pfvf->hw.xqe_size) in otx2_set_ringparam()
441 pfvf->hw.rbuf_len = rx_buf_len; in otx2_set_ringparam()
442 pfvf->hw.xqe_size = xqe_size; in otx2_set_ringparam()
455 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2_get_coalesce() local
456 struct otx2_hw *hw = &pfvf->hw; in otx2_get_coalesce()
462 if ((pfvf->flags & OTX2_FLAG_ADPTV_INT_COAL_ENABLED) == in otx2_get_coalesce()
479 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2_set_coalesce() local
480 struct otx2_hw *hw = &pfvf->hw; in otx2_set_coalesce()
494 if ((pfvf->flags & OTX2_FLAG_ADPTV_INT_COAL_ENABLED) == in otx2_set_coalesce()
498 pfvf->flags &= ~OTX2_FLAG_ADPTV_INT_COAL_ENABLED; in otx2_set_coalesce()
502 pfvf->flags |= OTX2_FLAG_ADPTV_INT_COAL_ENABLED; in otx2_set_coalesce()
548 ((pfvf->flags & OTX2_FLAG_ADPTV_INT_COAL_ENABLED) != in otx2_set_coalesce()
555 for (qidx = 0; qidx < pfvf->hw.cint_cnt; qidx++) in otx2_set_coalesce()
556 otx2_config_irq_coalescing(pfvf, qidx); in otx2_set_coalesce()
562 static int otx2_get_rss_hash_opts(struct otx2_nic *pfvf, in otx2_get_rss_hash_opts() argument
565 struct otx2_rss_info *rss = &pfvf->hw.rss_info; in otx2_get_rss_hash_opts()
612 static int otx2_set_rss_hash_opts(struct otx2_nic *pfvf, in otx2_set_rss_hash_opts() argument
615 struct otx2_rss_info *rss = &pfvf->hw.rss_info; in otx2_set_rss_hash_opts()
620 netdev_err(pfvf->netdev, in otx2_set_rss_hash_opts()
691 netdev_err(pfvf->netdev, in otx2_set_rss_hash_opts()
716 otx2_set_flowkey_cfg(pfvf); in otx2_set_rss_hash_opts()
724 struct otx2_nic *pfvf = netdev_priv(dev); in otx2_get_rxnfc() local
729 nfc->data = pfvf->hw.rx_queues; in otx2_get_rxnfc()
734 nfc->rule_cnt = pfvf->flow_cfg->nr_flows; in otx2_get_rxnfc()
740 ret = otx2_get_flow(pfvf, nfc, nfc->fs.location); in otx2_get_rxnfc()
744 ret = otx2_get_all_flows(pfvf, nfc, rules); in otx2_get_rxnfc()
747 return otx2_get_rss_hash_opts(pfvf, nfc); in otx2_get_rxnfc()
757 struct otx2_nic *pfvf = netdev_priv(dev); in otx2_set_rxnfc() local
760 pfvf->flow_cfg->ntuple = ntuple; in otx2_set_rxnfc()
763 ret = otx2_set_rss_hash_opts(pfvf, nfc); in otx2_set_rxnfc()
767 ret = otx2_add_flow(pfvf, nfc); in otx2_set_rxnfc()
771 ret = otx2_remove_flow(pfvf, nfc->fs.location); in otx2_set_rxnfc()
782 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2_get_rxfh_key_size() local
785 rss = &pfvf->hw.rss_info; in otx2_get_rxfh_key_size()
795 static int otx2_rss_ctx_delete(struct otx2_nic *pfvf, int ctx_id) in otx2_rss_ctx_delete() argument
797 struct otx2_rss_info *rss = &pfvf->hw.rss_info; in otx2_rss_ctx_delete()
799 otx2_rss_ctx_flow_del(pfvf, ctx_id); in otx2_rss_ctx_delete()
806 static int otx2_rss_ctx_create(struct otx2_nic *pfvf, in otx2_rss_ctx_create() argument
809 struct otx2_rss_info *rss = &pfvf->hw.rss_info; in otx2_rss_ctx_create()
833 struct otx2_nic *pfvf = netdev_priv(dev); in otx2_set_rxfh() local
849 rss = &pfvf->hw.rss_info; in otx2_set_rxfh()
858 otx2_set_rss_key(pfvf); in otx2_set_rxfh()
861 return otx2_rss_ctx_delete(pfvf, rss_context); in otx2_set_rxfh()
864 ret = otx2_rss_ctx_create(pfvf, &rss_context); in otx2_set_rxfh()
874 otx2_set_rss_table(pfvf, rss_context); in otx2_set_rxfh()
884 struct otx2_nic *pfvf = netdev_priv(dev); in otx2_get_rxfh() local
890 rss = &pfvf->hw.rss_info; in otx2_get_rxfh()
900 rx_queues = pfvf->hw.rx_queues; in otx2_get_rxfh()
924 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2_get_msglevel() local
926 return pfvf->msg_enable; in otx2_get_msglevel()
931 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2_set_msglevel() local
933 pfvf->msg_enable = val; in otx2_set_msglevel()
938 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2_get_link() local
941 if (is_otx2_lbkvf(pfvf->pdev)) in otx2_get_link()
943 return pfvf->linfo.link_up; in otx2_get_link()
949 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2_get_ts_info() local
951 if (!pfvf->ptp) in otx2_get_ts_info()
959 info->phc_index = otx2_ptp_clock_index(pfvf); in otx2_get_ts_info()
962 if (test_bit(CN10K_PTP_ONESTEP, &pfvf->hw.cap_flag)) in otx2_get_ts_info()
971 static struct cgx_fw_data *otx2_get_fwdata(struct otx2_nic *pfvf) in otx2_get_fwdata() argument
977 mutex_lock(&pfvf->mbox.lock); in otx2_get_fwdata()
978 req = otx2_mbox_alloc_msg_cgx_get_aux_link_info(&pfvf->mbox); in otx2_get_fwdata()
980 mutex_unlock(&pfvf->mbox.lock); in otx2_get_fwdata()
984 err = otx2_sync_mbox_msg(&pfvf->mbox); in otx2_get_fwdata()
987 otx2_mbox_get_rsp(&pfvf->mbox.mbox, 0, &req->hdr); in otx2_get_fwdata()
992 mutex_unlock(&pfvf->mbox.lock); in otx2_get_fwdata()
999 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2_get_fecparam() local
1007 if (pfvf->linfo.fec < FEC_MAX_INDEX) in otx2_get_fecparam()
1008 fecparam->active_fec = fec[pfvf->linfo.fec]; in otx2_get_fecparam()
1010 rsp = otx2_get_fwdata(pfvf); in otx2_get_fecparam()
1026 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2_set_fecparam() local
1027 struct mbox *mbox = &pfvf->mbox; in otx2_set_fecparam()
1044 netdev_warn(pfvf->netdev, "Unsupported FEC mode: %d", in otx2_set_fecparam()
1049 if (fec == pfvf->linfo.fec) in otx2_set_fecparam()
1053 req = otx2_mbox_alloc_msg_cgx_set_fec_param(&pfvf->mbox); in otx2_set_fecparam()
1059 err = otx2_sync_mbox_msg(&pfvf->mbox); in otx2_set_fecparam()
1063 rsp = (struct fec_mode *)otx2_mbox_get_rsp(&pfvf->mbox.mbox, in otx2_set_fecparam()
1071 pfvf->linfo.fec = rsp->fec; in otx2_set_fecparam()
1183 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2_get_link_ksettings() local
1186 cmd->base.duplex = pfvf->linfo.full_duplex; in otx2_get_link_ksettings()
1187 cmd->base.speed = pfvf->linfo.speed; in otx2_get_link_ksettings()
1188 cmd->base.autoneg = pfvf->linfo.an; in otx2_get_link_ksettings()
1190 rsp = otx2_get_fwdata(pfvf); in otx2_get_link_ksettings()
1274 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2_get_fec_stats() local
1277 otx2_update_lmac_fec_stats(pfvf); in otx2_get_fec_stats()
1280 fec_stats->corrected_blocks.total = pfvf->hw.cgx_fec_corr_blks; in otx2_get_fec_stats()
1281 fec_stats->uncorrectable_blocks.total = pfvf->hw.cgx_fec_uncorr_blks; in otx2_get_fec_stats()
1283 rsp = otx2_get_fwdata(pfvf); in otx2_get_fec_stats()
1285 !otx2_get_phy_fec_stats(pfvf)) { in otx2_get_fec_stats()
1289 rsp = otx2_get_fwdata(pfvf); in otx2_get_fec_stats()
1293 if (pfvf->linfo.fec == OTX2_FEC_BASER) { in otx2_get_fec_stats()
1410 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2vf_get_link_ksettings() local
1412 if (is_otx2_lbkvf(pfvf->pdev)) { in otx2vf_get_link_ksettings()