Lines Matching defs:nic

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