Skip to content

Commit 9d96465

Browse files
sbasavapatnadavem330
authored andcommitted
bnxt_en: Support max-mtu with VF-reps
While a VF is configured with a bigger mtu (> 1500), any packets that are punted to the VF-rep (slow-path) get dropped by OVS kernel-datapath with the following message: "dropped over-mtu packet". Fix this by returning the max-mtu value for a VF-rep derived from its corresponding VF. VF-rep's mtu can be changed using 'ip' command as shown in this example: $ ip link set bnxt0_pf0vf0 mtu 9000 Signed-off-by: Sriharsha Basavapatna <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 479ca3b commit 9d96465

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,31 @@ static int hwrm_cfa_vfr_free(struct bnxt *bp, u16 vf_idx)
6464
return rc;
6565
}
6666

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+
6792
static int bnxt_vf_rep_open(struct net_device *dev)
6893
{
6994
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,
365390
struct net_device *dev)
366391
{
367392
struct net_device *pf_dev = bp->dev;
393+
u16 max_mtu;
368394

369395
dev->netdev_ops = &bnxt_vf_rep_netdev_ops;
370396
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,
380406
bnxt_vf_rep_eth_addr_gen(bp->pf.mac_addr, vf_rep->vf_idx,
381407
dev->perm_addr);
382408
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;
383413
}
384414

385415
static int bnxt_pcie_dsn_get(struct bnxt *bp, u8 dsn[])

0 commit comments

Comments
 (0)