Skip to content

Commit 379a80a

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Fix compile errors when CONFIG_BNXT_SRIOV is not set.
struct bnxt_pf_info needs to be always defined. Move bnxt_update_vf_mac() to bnxt_sriov.c and add some missing #ifdef CONFIG_BNXT_SRIOV. Reported-by: Jim Hull <[email protected]> Tested-by: Jim Hull <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent bf79586 commit 379a80a

File tree

4 files changed

+40
-28
lines changed

4 files changed

+40
-28
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3645,6 +3645,7 @@ static int bnxt_hwrm_func_qcaps(struct bnxt *bp)
36453645
pf->max_rx_em_flows = le32_to_cpu(resp->max_rx_em_flows);
36463646
pf->max_rx_wm_flows = le32_to_cpu(resp->max_rx_wm_flows);
36473647
} else {
3648+
#ifdef CONFIG_BNXT_SRIOV
36483649
struct bnxt_vf_info *vf = &bp->vf;
36493650

36503651
vf->fw_fid = le16_to_cpu(resp->fid);
@@ -3659,6 +3660,7 @@ static int bnxt_hwrm_func_qcaps(struct bnxt *bp)
36593660
vf->max_l2_ctxs = le16_to_cpu(resp->max_l2_ctxs);
36603661
vf->max_vnics = le16_to_cpu(resp->max_vnics);
36613662
vf->max_stat_ctxs = le16_to_cpu(resp->max_stat_ctx);
3663+
#endif
36623664
}
36633665

36643666
bp->tx_push_thresh = 0;
@@ -3880,30 +3882,6 @@ static int bnxt_alloc_rfs_vnics(struct bnxt *bp)
38803882
#endif
38813883
}
38823884

3883-
static void bnxt_update_vf_mac(struct bnxt *bp)
3884-
{
3885-
struct hwrm_func_qcaps_input req = {0};
3886-
struct hwrm_func_qcaps_output *resp = bp->hwrm_cmd_resp_addr;
3887-
3888-
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_QCAPS, -1, -1);
3889-
req.fid = cpu_to_le16(0xffff);
3890-
3891-
mutex_lock(&bp->hwrm_cmd_lock);
3892-
if (_hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT))
3893-
goto update_vf_mac_exit;
3894-
3895-
if (!is_valid_ether_addr(resp->perm_mac_address))
3896-
goto update_vf_mac_exit;
3897-
3898-
if (ether_addr_equal(resp->perm_mac_address, bp->vf.mac_addr))
3899-
goto update_vf_mac_exit;
3900-
3901-
memcpy(bp->vf.mac_addr, resp->perm_mac_address, ETH_ALEN);
3902-
memcpy(bp->dev->dev_addr, bp->vf.mac_addr, ETH_ALEN);
3903-
update_vf_mac_exit:
3904-
mutex_unlock(&bp->hwrm_cmd_lock);
3905-
}
3906-
39073885
static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init)
39083886
{
39093887
int rc = 0;
@@ -5581,18 +5559,20 @@ static int bnxt_get_max_irq(struct pci_dev *pdev)
55815559

55825560
void bnxt_get_max_rings(struct bnxt *bp, int *max_rx, int *max_tx)
55835561
{
5584-
int max_rings;
5562+
int max_rings = 0;
55855563

55865564
if (BNXT_PF(bp)) {
55875565
*max_tx = bp->pf.max_pf_tx_rings;
55885566
*max_rx = bp->pf.max_pf_rx_rings;
55895567
max_rings = min_t(int, bp->pf.max_irqs, bp->pf.max_cp_rings);
55905568
max_rings = min_t(int, max_rings, bp->pf.max_stat_ctxs);
55915569
} else {
5570+
#ifdef CONFIG_BNXT_SRIOV
55925571
*max_tx = bp->vf.max_tx_rings;
55935572
*max_rx = bp->vf.max_rx_rings;
55945573
max_rings = min_t(int, bp->vf.max_irqs, bp->vf.max_cp_rings);
55955574
max_rings = min_t(int, max_rings, bp->vf.max_stat_ctxs);
5575+
#endif
55965576
}
55975577
if (bp->flags & BNXT_FLAG_AGG_RINGS)
55985578
*max_rx >>= 1;
@@ -5696,8 +5676,10 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
56965676
memcpy(dev->dev_addr, bp->pf.mac_addr, ETH_ALEN);
56975677
bp->pf.max_irqs = max_irqs;
56985678
} else {
5679+
#if defined(CONFIG_BNXT_SRIOV)
56995680
memcpy(dev->dev_addr, bp->vf.mac_addr, ETH_ALEN);
57005681
bp->vf.max_irqs = max_irqs;
5682+
#endif
57015683
}
57025684
bnxt_get_max_rings(bp, &max_rx_rings, &max_tx_rings);
57035685
bp->rx_nr_rings = min_t(int, dflt_rings, max_rx_rings);

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,7 @@ struct bnxt_vf_info {
709709
void *hwrm_cmd_req_addr;
710710
dma_addr_t hwrm_cmd_req_dma_addr;
711711
};
712+
#endif
712713

713714
struct bnxt_pf_info {
714715
#define BNXT_FIRST_PF_FID 1
@@ -741,7 +742,6 @@ struct bnxt_pf_info {
741742
dma_addr_t hwrm_cmd_req_dma_addr[4];
742743
struct bnxt_vf_info *vf;
743744
};
744-
#endif
745745

746746
struct bnxt_ntuple_filter {
747747
struct hlist_node hash;
@@ -960,9 +960,9 @@ struct bnxt {
960960
#define BNXT_RESET_TASK_SP_EVENT 32
961961
#define BNXT_RST_RING_SP_EVENT 64
962962

963+
struct bnxt_pf_info pf;
963964
#ifdef CONFIG_BNXT_SRIOV
964965
int nr_vfs;
965-
struct bnxt_pf_info pf;
966966
struct bnxt_vf_info vf;
967967
wait_queue_head_t sriov_cfg_wait;
968968
bool sriov_cfg;

drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,31 @@ void bnxt_hwrm_exec_fwd_req(struct bnxt *bp)
774774
i = vf_id + 1;
775775
}
776776
}
777+
778+
void bnxt_update_vf_mac(struct bnxt *bp)
779+
{
780+
struct hwrm_func_qcaps_input req = {0};
781+
struct hwrm_func_qcaps_output *resp = bp->hwrm_cmd_resp_addr;
782+
783+
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_QCAPS, -1, -1);
784+
req.fid = cpu_to_le16(0xffff);
785+
786+
mutex_lock(&bp->hwrm_cmd_lock);
787+
if (_hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT))
788+
goto update_vf_mac_exit;
789+
790+
if (!is_valid_ether_addr(resp->perm_mac_address))
791+
goto update_vf_mac_exit;
792+
793+
if (ether_addr_equal(resp->perm_mac_address, bp->vf.mac_addr))
794+
goto update_vf_mac_exit;
795+
796+
memcpy(bp->vf.mac_addr, resp->perm_mac_address, ETH_ALEN);
797+
memcpy(bp->dev->dev_addr, bp->vf.mac_addr, ETH_ALEN);
798+
update_vf_mac_exit:
799+
mutex_unlock(&bp->hwrm_cmd_lock);
800+
}
801+
777802
#else
778803

779804
void bnxt_sriov_disable(struct bnxt *bp)
@@ -782,6 +807,10 @@ void bnxt_sriov_disable(struct bnxt *bp)
782807

783808
void bnxt_hwrm_exec_fwd_req(struct bnxt *bp)
784809
{
785-
netdev_err(dev, "Invalid VF message received when SRIOV is not enable\n");
810+
netdev_err(bp->dev, "Invalid VF message received when SRIOV is not enable\n");
811+
}
812+
813+
void bnxt_update_vf_mac(struct bnxt *bp)
814+
{
786815
}
787816
#endif

drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ int bnxt_set_vf_spoofchk(struct net_device *, int, bool);
1919
int bnxt_sriov_configure(struct pci_dev *pdev, int num_vfs);
2020
void bnxt_sriov_disable(struct bnxt *);
2121
void bnxt_hwrm_exec_fwd_req(struct bnxt *);
22+
void bnxt_update_vf_mac(struct bnxt *);
2223
#endif

0 commit comments

Comments
 (0)