diff options
-rw-r--r-- | drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c index 26290403f38f..38f635cf8408 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | |||
@@ -64,6 +64,31 @@ static int hwrm_cfa_vfr_free(struct bnxt *bp, u16 vf_idx) | |||
64 | return rc; | 64 | return rc; |
65 | } | 65 | } |
66 | 66 | ||
67 | static int bnxt_hwrm_vfr_qcfg(struct bnxt *bp, struct bnxt_vf_rep *vf_rep, | ||
68 | u16 *max_mtu) | ||
69 | { | ||
70 | struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr; | ||
71 | struct hwrm_func_qcfg_input req = {0}; | ||
72 | u16 mtu; | ||
73 | int rc; | ||
74 | |||
75 | bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_QCFG, -1, -1); | ||
76 | req.fid = cpu_to_le16(bp->pf.vf[vf_rep->vf_idx].fw_fid); | ||
77 | |||
78 | mutex_lock(&bp->hwrm_cmd_lock); | ||
79 | |||
80 | rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT); | ||
81 | if (!rc) { | ||
82 | mtu = le16_to_cpu(resp->max_mtu_configured); | ||
83 | if (!mtu) | ||
84 | *max_mtu = BNXT_MAX_MTU; | ||
85 | else | ||
86 | *max_mtu = mtu; | ||
87 | } | ||
88 | mutex_unlock(&bp->hwrm_cmd_lock); | ||
89 | return rc; | ||
90 | } | ||
91 | |||
67 | static int bnxt_vf_rep_open(struct net_device *dev) | 92 | static int bnxt_vf_rep_open(struct net_device *dev) |
68 | { | 93 | { |
69 | struct bnxt_vf_rep *vf_rep = netdev_priv(dev); | 94 | struct bnxt_vf_rep *vf_rep = netdev_priv(dev); |
@@ -365,6 +390,7 @@ static void bnxt_vf_rep_netdev_init(struct bnxt *bp, struct bnxt_vf_rep *vf_rep, | |||
365 | struct net_device *dev) | 390 | struct net_device *dev) |
366 | { | 391 | { |
367 | struct net_device *pf_dev = bp->dev; | 392 | struct net_device *pf_dev = bp->dev; |
393 | u16 max_mtu; | ||
368 | 394 | ||
369 | dev->netdev_ops = &bnxt_vf_rep_netdev_ops; | 395 | dev->netdev_ops = &bnxt_vf_rep_netdev_ops; |
370 | dev->ethtool_ops = &bnxt_vf_rep_ethtool_ops; | 396 | dev->ethtool_ops = &bnxt_vf_rep_ethtool_ops; |
@@ -380,6 +406,10 @@ static void bnxt_vf_rep_netdev_init(struct bnxt *bp, struct bnxt_vf_rep *vf_rep, | |||
380 | bnxt_vf_rep_eth_addr_gen(bp->pf.mac_addr, vf_rep->vf_idx, | 406 | bnxt_vf_rep_eth_addr_gen(bp->pf.mac_addr, vf_rep->vf_idx, |
381 | dev->perm_addr); | 407 | dev->perm_addr); |
382 | ether_addr_copy(dev->dev_addr, dev->perm_addr); | 408 | ether_addr_copy(dev->dev_addr, dev->perm_addr); |
409 | /* Set VF-Rep's max-mtu to the corresponding VF's max-mtu */ | ||
410 | if (!bnxt_hwrm_vfr_qcfg(bp, vf_rep, &max_mtu)) | ||
411 | dev->max_mtu = max_mtu; | ||
412 | dev->min_mtu = ETH_ZLEN; | ||
383 | } | 413 | } |
384 | 414 | ||
385 | static int bnxt_pcie_dsn_get(struct bnxt *bp, u8 dsn[]) | 415 | static int bnxt_pcie_dsn_get(struct bnxt *bp, u8 dsn[]) |