hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
....@@ -25,7 +25,6 @@
2525 static int bnxt_hwrm_fwd_async_event_cmpl(struct bnxt *bp,
2626 struct bnxt_vf_info *vf, u16 event_id)
2727 {
28
- struct hwrm_fwd_async_event_cmpl_output *resp = bp->hwrm_cmd_resp_addr;
2928 struct hwrm_fwd_async_event_cmpl_input req = {0};
3029 struct hwrm_async_event_cmpl *async_cmpl;
3130 int rc = 0;
....@@ -40,23 +39,10 @@
4039 async_cmpl->type = cpu_to_le16(ASYNC_EVENT_CMPL_TYPE_HWRM_ASYNC_EVENT);
4140 async_cmpl->event_id = cpu_to_le16(event_id);
4241
43
- mutex_lock(&bp->hwrm_cmd_lock);
44
- rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
45
-
46
- if (rc) {
42
+ rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
43
+ if (rc)
4744 netdev_err(bp->dev, "hwrm_fwd_async_event_cmpl failed. rc:%d\n",
4845 rc);
49
- goto fwd_async_event_cmpl_exit;
50
- }
51
-
52
- if (resp->error_code) {
53
- netdev_err(bp->dev, "hwrm_fwd_async_event_cmpl error %d\n",
54
- resp->error_code);
55
- rc = -1;
56
- }
57
-
58
-fwd_async_event_cmpl_exit:
59
- mutex_unlock(&bp->hwrm_cmd_lock);
6046 return rc;
6147 }
6248
....@@ -119,6 +105,50 @@
119105 return rc;
120106 }
121107
108
+static int bnxt_hwrm_func_qcfg_flags(struct bnxt *bp, struct bnxt_vf_info *vf)
109
+{
110
+ struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr;
111
+ struct hwrm_func_qcfg_input req = {0};
112
+ int rc;
113
+
114
+ bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_QCFG, -1, -1);
115
+ req.fid = cpu_to_le16(vf->fw_fid);
116
+ mutex_lock(&bp->hwrm_cmd_lock);
117
+ rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
118
+ if (rc) {
119
+ mutex_unlock(&bp->hwrm_cmd_lock);
120
+ return rc;
121
+ }
122
+ vf->func_qcfg_flags = le16_to_cpu(resp->flags);
123
+ mutex_unlock(&bp->hwrm_cmd_lock);
124
+ return 0;
125
+}
126
+
127
+static bool bnxt_is_trusted_vf(struct bnxt *bp, struct bnxt_vf_info *vf)
128
+{
129
+ if (!(bp->fw_cap & BNXT_FW_CAP_TRUSTED_VF))
130
+ return !!(vf->flags & BNXT_VF_TRUST);
131
+
132
+ bnxt_hwrm_func_qcfg_flags(bp, vf);
133
+ return !!(vf->func_qcfg_flags & FUNC_QCFG_RESP_FLAGS_TRUSTED_VF);
134
+}
135
+
136
+static int bnxt_hwrm_set_trusted_vf(struct bnxt *bp, struct bnxt_vf_info *vf)
137
+{
138
+ struct hwrm_func_cfg_input req = {0};
139
+
140
+ if (!(bp->fw_cap & BNXT_FW_CAP_TRUSTED_VF))
141
+ return 0;
142
+
143
+ bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_CFG, -1, -1);
144
+ req.fid = cpu_to_le16(vf->fw_fid);
145
+ if (vf->flags & BNXT_VF_TRUST)
146
+ req.flags = cpu_to_le32(FUNC_CFG_REQ_FLAGS_TRUSTED_VF_ENABLE);
147
+ else
148
+ req.flags = cpu_to_le32(FUNC_CFG_REQ_FLAGS_TRUSTED_VF_DISABLE);
149
+ return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
150
+}
151
+
122152 int bnxt_set_vf_trust(struct net_device *dev, int vf_id, bool trusted)
123153 {
124154 struct bnxt *bp = netdev_priv(dev);
....@@ -133,6 +163,7 @@
133163 else
134164 vf->flags &= ~BNXT_VF_TRUST;
135165
166
+ bnxt_hwrm_set_trusted_vf(bp, vf);
136167 return 0;
137168 }
138169
....@@ -162,7 +193,7 @@
162193 else
163194 ivi->qos = 0;
164195 ivi->spoofchk = !!(vf->flags & BNXT_VF_SPOOFCHK);
165
- ivi->trusted = !!(vf->flags & BNXT_VF_TRUST);
196
+ ivi->trusted = bnxt_is_trusted_vf(bp, vf);
166197 if (!(vf->flags & BNXT_VF_LINK_FORCED))
167198 ivi->linkstate = IFLA_VF_LINK_STATE_AUTO;
168199 else if (vf->flags & BNXT_VF_LINK_UP)
....@@ -433,10 +464,42 @@
433464 return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
434465 }
435466
467
+/* Caller holds bp->hwrm_cmd_lock mutex lock */
468
+static void __bnxt_set_vf_params(struct bnxt *bp, int vf_id)
469
+{
470
+ struct hwrm_func_cfg_input req = {0};
471
+ struct bnxt_vf_info *vf;
472
+
473
+ vf = &bp->pf.vf[vf_id];
474
+ bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_CFG, -1, -1);
475
+ req.fid = cpu_to_le16(vf->fw_fid);
476
+
477
+ if (is_valid_ether_addr(vf->mac_addr)) {
478
+ req.enables |= cpu_to_le32(FUNC_CFG_REQ_ENABLES_DFLT_MAC_ADDR);
479
+ memcpy(req.dflt_mac_addr, vf->mac_addr, ETH_ALEN);
480
+ }
481
+ if (vf->vlan) {
482
+ req.enables |= cpu_to_le32(FUNC_CFG_REQ_ENABLES_DFLT_VLAN);
483
+ req.dflt_vlan = cpu_to_le16(vf->vlan);
484
+ }
485
+ if (vf->max_tx_rate) {
486
+ req.enables |= cpu_to_le32(FUNC_CFG_REQ_ENABLES_MAX_BW);
487
+ req.max_bw = cpu_to_le32(vf->max_tx_rate);
488
+#ifdef HAVE_IFLA_TX_RATE
489
+ req.enables |= cpu_to_le32(FUNC_CFG_REQ_ENABLES_MIN_BW);
490
+ req.min_bw = cpu_to_le32(vf->min_tx_rate);
491
+#endif
492
+ }
493
+ if (vf->flags & BNXT_VF_TRUST)
494
+ req.flags |= cpu_to_le32(FUNC_CFG_REQ_FLAGS_TRUSTED_VF_ENABLE);
495
+
496
+ _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
497
+}
498
+
436499 /* Only called by PF to reserve resources for VFs, returns actual number of
437500 * VFs configured, or < 0 on error.
438501 */
439
-static int bnxt_hwrm_func_vf_resc_cfg(struct bnxt *bp, int num_vfs)
502
+static int bnxt_hwrm_func_vf_resc_cfg(struct bnxt *bp, int num_vfs, bool reset)
440503 {
441504 struct hwrm_func_vf_resource_cfg_input req = {0};
442505 struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
....@@ -444,22 +507,29 @@
444507 u16 vf_stat_ctx, vf_vnics, vf_ring_grps;
445508 struct bnxt_pf_info *pf = &bp->pf;
446509 int i, rc = 0, min = 1;
510
+ u16 vf_msix = 0;
511
+ u16 vf_rss;
447512
448513 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_VF_RESOURCE_CFG, -1, -1);
449514
450
- vf_cp_rings = bnxt_get_max_func_cp_rings_for_en(bp) - bp->cp_nr_rings;
451
- vf_stat_ctx = hw_resc->max_stat_ctxs - bp->num_stat_ctxs;
515
+ if (bp->flags & BNXT_FLAG_CHIP_P5) {
516
+ vf_msix = hw_resc->max_nqs - bnxt_nq_rings_in_use(bp);
517
+ vf_ring_grps = 0;
518
+ } else {
519
+ vf_ring_grps = hw_resc->max_hw_ring_grps - bp->rx_nr_rings;
520
+ }
521
+ vf_cp_rings = bnxt_get_avail_cp_rings_for_en(bp);
522
+ vf_stat_ctx = bnxt_get_avail_stat_ctxs_for_en(bp);
452523 if (bp->flags & BNXT_FLAG_AGG_RINGS)
453524 vf_rx_rings = hw_resc->max_rx_rings - bp->rx_nr_rings * 2;
454525 else
455526 vf_rx_rings = hw_resc->max_rx_rings - bp->rx_nr_rings;
456
- vf_ring_grps = hw_resc->max_hw_ring_grps - bp->rx_nr_rings;
457527 vf_tx_rings = hw_resc->max_tx_rings - bp->tx_nr_rings;
458528 vf_vnics = hw_resc->max_vnics - bp->nr_vnics;
459529 vf_vnics = min_t(u16, vf_vnics, vf_rx_rings);
530
+ vf_rss = hw_resc->max_rsscos_ctxs - bp->rsscos_nr_ctxs;
460531
461532 req.min_rsscos_ctx = cpu_to_le16(BNXT_VF_MIN_RSS_CTX);
462
- req.max_rsscos_ctx = cpu_to_le16(BNXT_VF_MAX_RSS_CTX);
463533 if (pf->vf_resv_strategy == BNXT_VF_RESV_STRATEGY_MINIMAL_STATIC) {
464534 min = 0;
465535 req.min_rsscos_ctx = cpu_to_le16(min);
....@@ -472,7 +542,8 @@
472542 req.min_l2_ctxs = cpu_to_le16(min);
473543 req.min_vnics = cpu_to_le16(min);
474544 req.min_stat_ctx = cpu_to_le16(min);
475
- req.min_hw_ring_grps = cpu_to_le16(min);
545
+ if (!(bp->flags & BNXT_FLAG_CHIP_P5))
546
+ req.min_hw_ring_grps = cpu_to_le16(min);
476547 } else {
477548 vf_cp_rings /= num_vfs;
478549 vf_tx_rings /= num_vfs;
....@@ -480,6 +551,7 @@
480551 vf_vnics /= num_vfs;
481552 vf_stat_ctx /= num_vfs;
482553 vf_ring_grps /= num_vfs;
554
+ vf_rss /= num_vfs;
483555
484556 req.min_cmpl_rings = cpu_to_le16(vf_cp_rings);
485557 req.min_tx_rings = cpu_to_le16(vf_tx_rings);
....@@ -488,6 +560,7 @@
488560 req.min_vnics = cpu_to_le16(vf_vnics);
489561 req.min_stat_ctx = cpu_to_le16(vf_stat_ctx);
490562 req.min_hw_ring_grps = cpu_to_le16(vf_ring_grps);
563
+ req.min_rsscos_ctx = cpu_to_le16(vf_rss);
491564 }
492565 req.max_cmpl_rings = cpu_to_le16(vf_cp_rings);
493566 req.max_tx_rings = cpu_to_le16(vf_tx_rings);
....@@ -496,16 +569,20 @@
496569 req.max_vnics = cpu_to_le16(vf_vnics);
497570 req.max_stat_ctx = cpu_to_le16(vf_stat_ctx);
498571 req.max_hw_ring_grps = cpu_to_le16(vf_ring_grps);
572
+ req.max_rsscos_ctx = cpu_to_le16(vf_rss);
573
+ if (bp->flags & BNXT_FLAG_CHIP_P5)
574
+ req.max_msix = cpu_to_le16(vf_msix / num_vfs);
499575
500576 mutex_lock(&bp->hwrm_cmd_lock);
501577 for (i = 0; i < num_vfs; i++) {
578
+ if (reset)
579
+ __bnxt_set_vf_params(bp, i);
580
+
502581 req.vf_id = cpu_to_le16(pf->first_vf_id + i);
503582 rc = _hwrm_send_message(bp, &req, sizeof(req),
504583 HWRM_CMD_TIMEOUT);
505
- if (rc) {
506
- rc = -ENOMEM;
584
+ if (rc)
507585 break;
508
- }
509586 pf->active_vfs = i + 1;
510587 pf->vf[i].fw_fid = pf->first_vf_id + i;
511588 }
....@@ -518,9 +595,11 @@
518595 hw_resc->max_hw_ring_grps -= le16_to_cpu(req.min_hw_ring_grps) *
519596 n;
520597 hw_resc->max_cp_rings -= le16_to_cpu(req.min_cmpl_rings) * n;
521
- hw_resc->max_rsscos_ctxs -= pf->active_vfs;
598
+ hw_resc->max_rsscos_ctxs -= le16_to_cpu(req.min_rsscos_ctx) * n;
522599 hw_resc->max_stat_ctxs -= le16_to_cpu(req.min_stat_ctx) * n;
523600 hw_resc->max_vnics -= le16_to_cpu(req.min_vnics) * n;
601
+ if (bp->flags & BNXT_FLAG_CHIP_P5)
602
+ hw_resc->max_nqs -= vf_msix;
524603
525604 rc = pf->active_vfs;
526605 }
....@@ -535,19 +614,16 @@
535614 u32 rc = 0, mtu, i;
536615 u16 vf_tx_rings, vf_rx_rings, vf_cp_rings, vf_stat_ctx, vf_vnics;
537616 struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
538
- u16 vf_ring_grps, max_stat_ctxs;
539617 struct hwrm_func_cfg_input req = {0};
540618 struct bnxt_pf_info *pf = &bp->pf;
541619 int total_vf_tx_rings = 0;
620
+ u16 vf_ring_grps;
542621
543622 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_CFG, -1, -1);
544623
545
- max_stat_ctxs = hw_resc->max_stat_ctxs;
546
-
547624 /* Remaining rings are distributed equally amongs VF's for now */
548
- vf_cp_rings = (bnxt_get_max_func_cp_rings_for_en(bp) -
549
- bp->cp_nr_rings) / num_vfs;
550
- vf_stat_ctx = (max_stat_ctxs - bp->num_stat_ctxs) / num_vfs;
625
+ vf_cp_rings = bnxt_get_avail_cp_rings_for_en(bp) / num_vfs;
626
+ vf_stat_ctx = bnxt_get_avail_stat_ctxs_for_en(bp) / num_vfs;
551627 if (bp->flags & BNXT_FLAG_AGG_RINGS)
552628 vf_rx_rings = (hw_resc->max_rx_rings - bp->rx_nr_rings * 2) /
553629 num_vfs;
....@@ -570,7 +646,7 @@
570646 FUNC_CFG_REQ_ENABLES_NUM_VNICS |
571647 FUNC_CFG_REQ_ENABLES_NUM_HW_RING_GRPS);
572648
573
- mtu = bp->dev->mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
649
+ mtu = bp->dev->mtu + ETH_HLEN + VLAN_HLEN;
574650 req.mru = cpu_to_le16(mtu);
575651 req.mtu = cpu_to_le16(mtu);
576652
....@@ -603,8 +679,6 @@
603679 total_vf_tx_rings += vf_tx_rsvd;
604680 }
605681 mutex_unlock(&bp->hwrm_cmd_lock);
606
- if (rc)
607
- rc = -ENOMEM;
608682 if (pf->active_vfs) {
609683 hw_resc->max_tx_rings -= total_vf_tx_rings;
610684 hw_resc->max_rx_rings -= vf_rx_rings * num_vfs;
....@@ -618,12 +692,38 @@
618692 return rc;
619693 }
620694
621
-static int bnxt_func_cfg(struct bnxt *bp, int num_vfs)
695
+static int bnxt_func_cfg(struct bnxt *bp, int num_vfs, bool reset)
622696 {
623697 if (BNXT_NEW_RM(bp))
624
- return bnxt_hwrm_func_vf_resc_cfg(bp, num_vfs);
698
+ return bnxt_hwrm_func_vf_resc_cfg(bp, num_vfs, reset);
625699 else
626700 return bnxt_hwrm_func_cfg(bp, num_vfs);
701
+}
702
+
703
+int bnxt_cfg_hw_sriov(struct bnxt *bp, int *num_vfs, bool reset)
704
+{
705
+ int rc;
706
+
707
+ /* Register buffers for VFs */
708
+ rc = bnxt_hwrm_func_buf_rgtr(bp);
709
+ if (rc)
710
+ return rc;
711
+
712
+ /* Reserve resources for VFs */
713
+ rc = bnxt_func_cfg(bp, *num_vfs, reset);
714
+ if (rc != *num_vfs) {
715
+ if (rc <= 0) {
716
+ netdev_warn(bp->dev, "Unable to reserve resources for SRIOV.\n");
717
+ *num_vfs = 0;
718
+ return rc;
719
+ }
720
+ netdev_warn(bp->dev, "Only able to reserve resources for %d VFs.\n",
721
+ rc);
722
+ *num_vfs = rc;
723
+ }
724
+
725
+ bnxt_ulp_sriov_cfg(bp, *num_vfs);
726
+ return 0;
627727 }
628728
629729 static int bnxt_sriov_enable(struct bnxt *bp, int *num_vfs)
....@@ -640,8 +740,8 @@
640740 */
641741 vfs_supported = *num_vfs;
642742
643
- avail_cp = bnxt_get_max_func_cp_rings_for_en(bp) - bp->cp_nr_rings;
644
- avail_stat = hw_resc->max_stat_ctxs - bp->num_stat_ctxs;
743
+ avail_cp = bnxt_get_avail_cp_rings_for_en(bp);
744
+ avail_stat = bnxt_get_avail_stat_ctxs_for_en(bp);
645745 avail_cp = min_t(int, avail_cp, avail_stat);
646746
647747 while (vfs_supported) {
....@@ -691,24 +791,9 @@
691791 if (rc)
692792 goto err_out1;
693793
694
- /* Reserve resources for VFs */
695
- rc = bnxt_func_cfg(bp, *num_vfs);
696
- if (rc != *num_vfs) {
697
- if (rc <= 0) {
698
- netdev_warn(bp->dev, "Unable to reserve resources for SRIOV.\n");
699
- *num_vfs = 0;
700
- goto err_out2;
701
- }
702
- netdev_warn(bp->dev, "Only able to reserve resources for %d VFs.\n", rc);
703
- *num_vfs = rc;
704
- }
705
-
706
- /* Register buffers for VFs */
707
- rc = bnxt_hwrm_func_buf_rgtr(bp);
794
+ rc = bnxt_cfg_hw_sriov(bp, num_vfs, false);
708795 if (rc)
709796 goto err_out2;
710
-
711
- bnxt_ulp_sriov_cfg(bp, *num_vfs);
712797
713798 rc = pci_enable_sriov(bp->pdev, *num_vfs);
714799 if (rc)
....@@ -775,6 +860,11 @@
775860 rtnl_unlock();
776861 return 0;
777862 }
863
+ if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) {
864
+ netdev_warn(dev, "Reject SRIOV config request when FW reset is in progress\n");
865
+ rtnl_unlock();
866
+ return 0;
867
+ }
778868 bp->sriov_cfg = true;
779869 rtnl_unlock();
780870
....@@ -808,7 +898,6 @@
808898 {
809899 int rc = 0;
810900 struct hwrm_fwd_resp_input req = {0};
811
- struct hwrm_fwd_resp_output *resp = bp->hwrm_cmd_resp_addr;
812901
813902 if (BNXT_FWD_RESP_SIZE_ERR(msg_size))
814903 return -EINVAL;
....@@ -823,22 +912,9 @@
823912 req.encap_resp_cmpl_ring = encap_resp_cpr;
824913 memcpy(req.encap_resp, encap_resp, msg_size);
825914
826
- mutex_lock(&bp->hwrm_cmd_lock);
827
- rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
828
-
829
- if (rc) {
915
+ rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
916
+ if (rc)
830917 netdev_err(bp->dev, "hwrm_fwd_resp failed. rc:%d\n", rc);
831
- goto fwd_resp_exit;
832
- }
833
-
834
- if (resp->error_code) {
835
- netdev_err(bp->dev, "hwrm_fwd_resp error %d\n",
836
- resp->error_code);
837
- rc = -1;
838
- }
839
-
840
-fwd_resp_exit:
841
- mutex_unlock(&bp->hwrm_cmd_lock);
842918 return rc;
843919 }
844920
....@@ -847,7 +923,6 @@
847923 {
848924 int rc = 0;
849925 struct hwrm_reject_fwd_resp_input req = {0};
850
- struct hwrm_reject_fwd_resp_output *resp = bp->hwrm_cmd_resp_addr;
851926
852927 if (BNXT_REJ_FWD_RESP_SIZE_ERR(msg_size))
853928 return -EINVAL;
....@@ -858,22 +933,9 @@
858933 req.encap_resp_target_id = cpu_to_le16(vf->fw_fid);
859934 memcpy(req.encap_request, vf->hwrm_cmd_req_addr, msg_size);
860935
861
- mutex_lock(&bp->hwrm_cmd_lock);
862
- rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
863
-
864
- if (rc) {
936
+ rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
937
+ if (rc)
865938 netdev_err(bp->dev, "hwrm_fwd_err_resp failed. rc:%d\n", rc);
866
- goto fwd_err_resp_exit;
867
- }
868
-
869
- if (resp->error_code) {
870
- netdev_err(bp->dev, "hwrm_fwd_err_resp error %d\n",
871
- resp->error_code);
872
- rc = -1;
873
- }
874
-
875
-fwd_err_resp_exit:
876
- mutex_unlock(&bp->hwrm_cmd_lock);
877939 return rc;
878940 }
879941
....@@ -882,7 +944,6 @@
882944 {
883945 int rc = 0;
884946 struct hwrm_exec_fwd_resp_input req = {0};
885
- struct hwrm_exec_fwd_resp_output *resp = bp->hwrm_cmd_resp_addr;
886947
887948 if (BNXT_EXEC_FWD_RESP_SIZE_ERR(msg_size))
888949 return -EINVAL;
....@@ -893,22 +954,9 @@
893954 req.encap_resp_target_id = cpu_to_le16(vf->fw_fid);
894955 memcpy(req.encap_request, vf->hwrm_cmd_req_addr, msg_size);
895956
896
- mutex_lock(&bp->hwrm_cmd_lock);
897
- rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
898
-
899
- if (rc) {
957
+ rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
958
+ if (rc)
900959 netdev_err(bp->dev, "hwrm_exec_fw_resp failed. rc:%d\n", rc);
901
- goto exec_fwd_resp_exit;
902
- }
903
-
904
- if (resp->error_code) {
905
- netdev_err(bp->dev, "hwrm_exec_fw_resp error %d\n",
906
- resp->error_code);
907
- rc = -1;
908
- }
909
-
910
-exec_fwd_resp_exit:
911
- mutex_unlock(&bp->hwrm_cmd_lock);
912960 return rc;
913961 }
914962
....@@ -922,9 +970,10 @@
922970 * if the PF assigned MAC address is zero
923971 */
924972 if (req->enables & cpu_to_le32(FUNC_VF_CFG_REQ_ENABLES_DFLT_MAC_ADDR)) {
973
+ bool trust = bnxt_is_trusted_vf(bp, vf);
974
+
925975 if (is_valid_ether_addr(req->dflt_mac_addr) &&
926
- ((vf->flags & BNXT_VF_TRUST) ||
927
- !is_valid_ether_addr(vf->mac_addr) ||
976
+ (trust || !is_valid_ether_addr(vf->mac_addr) ||
928977 ether_addr_equal(req->dflt_mac_addr, vf->mac_addr))) {
929978 ether_addr_copy(vf->vf_mac_addr, req->dflt_mac_addr);
930979 return bnxt_hwrm_exec_fwd_resp(bp, vf, msg_size);
....@@ -949,7 +998,7 @@
949998 * Otherwise, it must match the VF MAC address if firmware spec >=
950999 * 1.2.2
9511000 */
952
- if (vf->flags & BNXT_VF_TRUST) {
1001
+ if (bnxt_is_trusted_vf(bp, vf)) {
9531002 mac_ok = true;
9541003 } else if (is_valid_ether_addr(vf->mac_addr)) {
9551004 if (ether_addr_equal((const u8 *)req->l2_addr, vf->mac_addr))
....@@ -980,7 +1029,7 @@
9801029 rc = bnxt_hwrm_exec_fwd_resp(
9811030 bp, vf, sizeof(struct hwrm_port_phy_qcfg_input));
9821031 } else {
983
- struct hwrm_port_phy_qcfg_output phy_qcfg_resp;
1032
+ struct hwrm_port_phy_qcfg_output phy_qcfg_resp = {0};
9841033 struct hwrm_port_phy_qcfg_input *phy_qcfg_req;
9851034
9861035 phy_qcfg_req =
....@@ -1127,6 +1176,13 @@
11271176 }
11281177 #else
11291178
1179
+int bnxt_cfg_hw_sriov(struct bnxt *bp, int *num_vfs, bool reset)
1180
+{
1181
+ if (*num_vfs)
1182
+ return -EOPNOTSUPP;
1183
+ return 0;
1184
+}
1185
+
11301186 void bnxt_sriov_disable(struct bnxt *bp)
11311187 {
11321188 }