Lines Matching full:nic

13 #include "nic.h"
122 struct nicvf *nic = netdev_priv(netdev); in nicvf_get_link_ksettings() local
128 if (!nic->link_up) { in nicvf_get_link_ksettings()
134 switch (nic->speed) { in nicvf_get_link_ksettings()
154 if (nic->mac_type == BGX_MODE_RXAUI) { in nicvf_get_link_ksettings()
171 cmd->base.duplex = nic->duplex; in nicvf_get_link_ksettings()
172 cmd->base.speed = nic->speed; in nicvf_get_link_ksettings()
184 struct nicvf *nic = netdev_priv(netdev); in nicvf_get_link() local
186 return nic->link_up; in nicvf_get_link()
192 struct nicvf *nic = netdev_priv(netdev); in nicvf_get_drvinfo() local
195 strscpy(info->bus_info, pci_name(nic->pdev), sizeof(info->bus_info)); in nicvf_get_drvinfo()
200 struct nicvf *nic = netdev_priv(netdev); in nicvf_get_msglevel() local
202 return nic->msg_enable; in nicvf_get_msglevel()
207 struct nicvf *nic = netdev_priv(netdev); in nicvf_set_msglevel() local
209 nic->msg_enable = lvl; in nicvf_set_msglevel()
212 static void nicvf_get_qset_strings(struct nicvf *nic, u8 **data, int qset) in nicvf_get_qset_strings() argument
217 for (qidx = 0; qidx < nic->qs->rq_cnt; qidx++) { in nicvf_get_qset_strings()
225 for (qidx = 0; qidx < nic->qs->sq_cnt; qidx++) { in nicvf_get_qset_strings()
236 struct nicvf *nic = netdev_priv(netdev); in nicvf_get_strings() local
253 nicvf_get_qset_strings(nic, &data, 0); in nicvf_get_strings()
255 for (sqs = 0; sqs < nic->sqs_count; sqs++) { in nicvf_get_strings()
256 if (!nic->snicvf[sqs]) in nicvf_get_strings()
258 nicvf_get_qset_strings(nic->snicvf[sqs], &data, sqs + 1); in nicvf_get_strings()
274 struct nicvf *nic = netdev_priv(netdev); in nicvf_get_sset_count() local
282 (nic->qs->rq_cnt + nic->qs->sq_cnt); in nicvf_get_sset_count()
283 for (sqs = 0; sqs < nic->sqs_count; sqs++) { in nicvf_get_sset_count()
286 snic = nic->snicvf[sqs]; in nicvf_get_sset_count()
298 static void nicvf_get_qset_stats(struct nicvf *nic, in nicvf_get_qset_stats() argument
303 if (!nic) in nicvf_get_qset_stats()
306 for (qidx = 0; qidx < nic->qs->rq_cnt; qidx++) { in nicvf_get_qset_stats()
307 nicvf_update_rq_stats(nic, qidx); in nicvf_get_qset_stats()
309 *((*data)++) = ((u64 *)&nic->qs->rq[qidx].stats) in nicvf_get_qset_stats()
313 for (qidx = 0; qidx < nic->qs->sq_cnt; qidx++) { in nicvf_get_qset_stats()
314 nicvf_update_sq_stats(nic, qidx); in nicvf_get_qset_stats()
316 *((*data)++) = ((u64 *)&nic->qs->sq[qidx].stats) in nicvf_get_qset_stats()
324 struct nicvf *nic = netdev_priv(netdev); in nicvf_get_ethtool_stats() local
328 nicvf_update_stats(nic); in nicvf_get_ethtool_stats()
331 nicvf_update_lmac_stats(nic); in nicvf_get_ethtool_stats()
334 *(data++) = ((u64 *)&nic->hw_stats) in nicvf_get_ethtool_stats()
339 tmp_stats += ((u64 *)per_cpu_ptr(nic->drv_stats, cpu)) in nicvf_get_ethtool_stats()
344 nicvf_get_qset_stats(nic, stats, &data); in nicvf_get_ethtool_stats()
346 for (sqs = 0; sqs < nic->sqs_count; sqs++) { in nicvf_get_ethtool_stats()
347 if (!nic->snicvf[sqs]) in nicvf_get_ethtool_stats()
349 nicvf_get_qset_stats(nic->snicvf[sqs], stats, &data); in nicvf_get_ethtool_stats()
353 *(data++) = nic->bgx_stats.rx_stats[stat]; in nicvf_get_ethtool_stats()
355 *(data++) = nic->bgx_stats.tx_stats[stat]; in nicvf_get_ethtool_stats()
366 struct nicvf *nic = netdev_priv(dev); in nicvf_get_regs() local
375 p[i++] = nicvf_reg_read(nic, NIC_VNIC_CFG); in nicvf_get_regs()
378 p[i++] = nicvf_reg_read(nic, in nicvf_get_regs()
381 p[i++] = nicvf_reg_read(nic, NIC_VF_INT); in nicvf_get_regs()
382 p[i++] = nicvf_reg_read(nic, NIC_VF_INT_W1S); in nicvf_get_regs()
383 p[i++] = nicvf_reg_read(nic, NIC_VF_ENA_W1C); in nicvf_get_regs()
384 p[i++] = nicvf_reg_read(nic, NIC_VF_ENA_W1S); in nicvf_get_regs()
385 p[i++] = nicvf_reg_read(nic, NIC_VNIC_RSS_CFG); in nicvf_get_regs()
388 p[i++] = nicvf_reg_read(nic, NIC_VNIC_RSS_KEY_0_4 | (key << 3)); in nicvf_get_regs()
392 p[i++] = nicvf_reg_read(nic, in nicvf_get_regs()
396 p[i++] = nicvf_reg_read(nic, in nicvf_get_regs()
399 p[i++] = nicvf_reg_read(nic, NIC_QSET_RQ_GEN_CFG); in nicvf_get_regs()
403 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_CFG, q); in nicvf_get_regs()
404 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_CFG2, q); in nicvf_get_regs()
405 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_THRESH, q); in nicvf_get_regs()
406 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_BASE, q); in nicvf_get_regs()
407 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_HEAD, q); in nicvf_get_regs()
408 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_TAIL, q); in nicvf_get_regs()
409 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_DOOR, q); in nicvf_get_regs()
410 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_STATUS, q); in nicvf_get_regs()
411 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_STATUS2, q); in nicvf_get_regs()
412 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_DEBUG, q); in nicvf_get_regs()
417 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RQ_0_7_CFG, q); in nicvf_get_regs()
418 p[i++] = nicvf_queue_reg_read(nic, in nicvf_get_regs()
421 p[i++] = nicvf_queue_reg_read(nic, reg_offset, q); in nicvf_get_regs()
425 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_CFG, q); in nicvf_get_regs()
426 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_THRESH, q); in nicvf_get_regs()
427 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_BASE, q); in nicvf_get_regs()
428 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_HEAD, q); in nicvf_get_regs()
429 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_TAIL, q); in nicvf_get_regs()
430 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_DOOR, q); in nicvf_get_regs()
431 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STATUS, q); in nicvf_get_regs()
432 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_DEBUG, q); in nicvf_get_regs()
437 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STAT_0_1, q); in nicvf_get_regs()
439 p[i++] = nicvf_queue_reg_read(nic, reg_offset, q); in nicvf_get_regs()
443 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_CFG, q); in nicvf_get_regs()
444 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_THRESH, q); in nicvf_get_regs()
445 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_BASE, q); in nicvf_get_regs()
446 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_HEAD, q); in nicvf_get_regs()
447 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_TAIL, q); in nicvf_get_regs()
448 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_DOOR, q); in nicvf_get_regs()
449 p[i++] = nicvf_queue_reg_read(nic, in nicvf_get_regs()
451 p[i++] = nicvf_queue_reg_read(nic, in nicvf_get_regs()
454 p[i++] = nicvf_queue_reg_read(nic, reg_offset, q); in nicvf_get_regs()
463 struct nicvf *nic = netdev_priv(netdev); in nicvf_get_coalesce() local
465 cmd->rx_coalesce_usecs = nic->cq_coalesce_usecs; in nicvf_get_coalesce()
474 struct nicvf *nic = netdev_priv(netdev); in nicvf_get_ringparam() local
475 struct queue_set *qs = nic->qs; in nicvf_get_ringparam()
488 struct nicvf *nic = netdev_priv(netdev); in nicvf_set_ringparam() local
489 struct queue_set *qs = nic->qs; in nicvf_set_ringparam()
493 if (pass1_silicon(nic->pdev)) in nicvf_set_ringparam()
519 static int nicvf_get_rss_hash_opts(struct nicvf *nic, in nicvf_get_rss_hash_opts() argument
547 struct nicvf *nic = netdev_priv(dev); in nicvf_get_rxnfc() local
552 info->data = nic->rx_queues; in nicvf_get_rxnfc()
556 return nicvf_get_rss_hash_opts(nic, info); in nicvf_get_rxnfc()
563 static int nicvf_set_rss_hash_opts(struct nicvf *nic, in nicvf_set_rss_hash_opts() argument
566 struct nicvf_rss_info *rss = &nic->rss_info; in nicvf_set_rss_hash_opts()
567 u64 rss_cfg = nicvf_reg_read(nic, NIC_VNIC_RSS_CFG); in nicvf_set_rss_hash_opts()
570 netdev_err(nic->netdev, in nicvf_set_rss_hash_opts()
573 netdev_info(nic->netdev, "Set RSS flow type = %d, data = %lld\n", in nicvf_set_rss_hash_opts()
627 nicvf_reg_write(nic, NIC_VNIC_RSS_CFG, rss_cfg); in nicvf_set_rss_hash_opts()
633 struct nicvf *nic = netdev_priv(dev); in nicvf_set_rxnfc() local
637 return nicvf_set_rss_hash_opts(nic, info); in nicvf_set_rxnfc()
651 struct nicvf *nic = netdev_priv(dev); in nicvf_get_rxfh_indir_size() local
653 return nic->rss_info.rss_size; in nicvf_get_rxfh_indir_size()
659 struct nicvf *nic = netdev_priv(dev); in nicvf_get_rxfh() local
660 struct nicvf_rss_info *rss = &nic->rss_info; in nicvf_get_rxfh()
680 struct nicvf *nic = netdev_priv(dev); in nicvf_set_rxfh() local
681 struct nicvf_rss_info *rss = &nic->rss_info; in nicvf_set_rxfh()
689 netdev_err(nic->netdev, in nicvf_set_rxfh()
701 nicvf_set_rss_key(nic); in nicvf_set_rxfh()
704 nicvf_config_rss(nic); in nicvf_set_rxfh()
712 struct nicvf *nic = netdev_priv(dev); in nicvf_get_channels() local
716 channel->max_rx = nic->max_queues; in nicvf_get_channels()
717 channel->max_tx = nic->max_queues; in nicvf_get_channels()
719 channel->rx_count = nic->rx_queues; in nicvf_get_channels()
720 channel->tx_count = nic->tx_queues; in nicvf_get_channels()
727 struct nicvf *nic = netdev_priv(dev); in nicvf_set_channels() local
734 if (channel->rx_count > nic->max_queues) in nicvf_set_channels()
736 if (channel->tx_count > nic->max_queues) in nicvf_set_channels()
739 if (channel->tx_count + channel->rx_count > nic->max_queues) { in nicvf_set_channels()
740 if (nic->xdp_prog) { in nicvf_set_channels()
741 netdev_err(nic->netdev, in nicvf_set_channels()
743 nic->max_queues); in nicvf_set_channels()
747 xdp_clear_features_flag(nic->netdev); in nicvf_set_channels()
748 } else if (!pass1_silicon(nic->pdev)) { in nicvf_set_channels()
755 nic->rx_queues = channel->rx_count; in nicvf_set_channels()
756 nic->tx_queues = channel->tx_count; in nicvf_set_channels()
757 if (!nic->xdp_prog) in nicvf_set_channels()
758 nic->xdp_tx_queues = 0; in nicvf_set_channels()
760 nic->xdp_tx_queues = channel->rx_count; in nicvf_set_channels()
762 txq_count = nic->xdp_tx_queues + nic->tx_queues; in nicvf_set_channels()
763 cqcount = max(nic->rx_queues, txq_count); in nicvf_set_channels()
766 nic->sqs_count = roundup(cqcount, MAX_CMP_QUEUES_PER_QS); in nicvf_set_channels()
767 nic->sqs_count = (nic->sqs_count / MAX_CMP_QUEUES_PER_QS) - 1; in nicvf_set_channels()
769 nic->sqs_count = 0; in nicvf_set_channels()
772 nic->qs->rq_cnt = min_t(u8, nic->rx_queues, MAX_RCV_QUEUES_PER_QS); in nicvf_set_channels()
773 nic->qs->sq_cnt = min_t(u8, txq_count, MAX_SND_QUEUES_PER_QS); in nicvf_set_channels()
774 nic->qs->cq_cnt = max(nic->qs->rq_cnt, nic->qs->sq_cnt); in nicvf_set_channels()
776 err = nicvf_set_real_num_queues(dev, nic->tx_queues, nic->rx_queues); in nicvf_set_channels()
784 nic->tx_queues, nic->rx_queues); in nicvf_set_channels()
792 struct nicvf *nic = netdev_priv(dev); in nicvf_get_pauseparam() local
796 if ((nic->mac_type == BGX_MODE_SGMII) || in nicvf_get_pauseparam()
797 (nic->mac_type == BGX_MODE_QSGMII) || in nicvf_get_pauseparam()
798 (nic->mac_type == BGX_MODE_RGMII)) in nicvf_get_pauseparam()
803 if (!nicvf_send_msg_to_pf(nic, &mbx)) { in nicvf_get_pauseparam()
804 pause->autoneg = nic->pfc.autoneg; in nicvf_get_pauseparam()
805 pause->rx_pause = nic->pfc.fc_rx; in nicvf_get_pauseparam()
806 pause->tx_pause = nic->pfc.fc_tx; in nicvf_get_pauseparam()
813 struct nicvf *nic = netdev_priv(dev); in nicvf_set_pauseparam() local
817 if ((nic->mac_type == BGX_MODE_SGMII) || in nicvf_set_pauseparam()
818 (nic->mac_type == BGX_MODE_QSGMII) || in nicvf_set_pauseparam()
819 (nic->mac_type == BGX_MODE_RGMII)) in nicvf_set_pauseparam()
829 if (nicvf_send_msg_to_pf(nic, &mbx)) in nicvf_set_pauseparam()
832 nic->pfc.fc_rx = pause->rx_pause; in nicvf_set_pauseparam()
833 nic->pfc.fc_tx = pause->tx_pause; in nicvf_set_pauseparam()
841 struct nicvf *nic = netdev_priv(netdev); in nicvf_get_ts_info() local
843 if (!nic->ptp_clock) in nicvf_get_ts_info()
851 info->phc_index = cavium_ptp_clock_index(nic->ptp_clock); in nicvf_get_ts_info()