Skip to content

Commit

Permalink
net/bnxt: fix ping with MTU change
Browse files Browse the repository at this point in the history
[ upstream commit 7d4e9e2 ]

Driver was setting maximum receive unit differently in bnxt_mtu_set_op
and bnxt_hwrm_vnic_alloc. Moreover firmware adds the 4 bytes for FCS.
Fixed it by setting correct maximum receive unit value.

Fixes: daef48e ("net/bnxt: support set MTU")

Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
  • Loading branch information
Santoshkumar Karanappa Rastapur authored and kevintraynor committed Dec 10, 2019
1 parent f537973 commit 5326842
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
3 changes: 3 additions & 0 deletions drivers/net/bnxt/bnxt.h
Expand Up @@ -22,6 +22,9 @@

#define BNXT_MAX_MTU 9574
#define VLAN_TAG_SIZE 4
/* FW adds extra 4 bytes for FCS */
#define BNXT_VNIC_MRU(mtu)\
((mtu) + ETHER_HDR_LEN + VLAN_TAG_SIZE * BNXT_NUM_VLANS)
#define BNXT_VF_RSV_NUM_RSS_CTX 1
#define BNXT_VF_RSV_NUM_L2_CTX 4
/* TODO: For now, do not support VMDq/RFS on VFs. */
Expand Down
3 changes: 1 addition & 2 deletions drivers/net/bnxt/bnxt_ethdev.c
Expand Up @@ -1691,8 +1691,7 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
struct bnxt_vnic_info *vnic = &bp->vnic_info[i];
uint16_t size = 0;

vnic->mru = bp->eth_dev->data->mtu + ETHER_HDR_LEN +
ETHER_CRC_LEN + VLAN_TAG_SIZE * 2;
vnic->mru = BNXT_VNIC_MRU(new_mtu);
rc = bnxt_hwrm_vnic_cfg(bp, vnic);
if (rc)
break;
Expand Down
11 changes: 3 additions & 8 deletions drivers/net/bnxt/bnxt_hwrm.c
Expand Up @@ -1332,8 +1332,7 @@ int bnxt_hwrm_vnic_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic)
vnic->rss_rule = (uint16_t)HWRM_NA_SIGNATURE;
vnic->cos_rule = (uint16_t)HWRM_NA_SIGNATURE;
vnic->lb_rule = (uint16_t)HWRM_NA_SIGNATURE;
vnic->mru = bp->eth_dev->data->mtu + ETHER_HDR_LEN +
ETHER_CRC_LEN + VLAN_TAG_SIZE;
vnic->mru = BNXT_VNIC_MRU(bp->eth_dev->data->mtu);
HWRM_PREP(req, VNIC_ALLOC, BNXT_USE_CHIMP_MB);

if (vnic->func_default)
Expand Down Expand Up @@ -2527,9 +2526,7 @@ static int bnxt_hwrm_pf_func_cfg(struct bnxt *bp, int tx_rings)
HWRM_FUNC_CFG_INPUT_ENABLES_NUM_HW_RING_GRPS);
req.flags = rte_cpu_to_le_32(bp->pf.func_cfg_flags);
req.mtu = rte_cpu_to_le_16(BNXT_MAX_MTU);
req.mru = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN +
ETHER_CRC_LEN + VLAN_TAG_SIZE *
BNXT_NUM_VLANS);
req.mru = rte_cpu_to_le_16(BNXT_VNIC_MRU(bp->eth_dev->data->mtu));
req.num_rsscos_ctxs = rte_cpu_to_le_16(bp->max_rsscos_ctx);
req.num_stat_ctxs = rte_cpu_to_le_16(bp->max_stat_ctx);
req.num_cmpl_rings = rte_cpu_to_le_16(bp->max_cp_rings);
Expand Down Expand Up @@ -2568,9 +2565,7 @@ static void populate_vf_func_cfg_req(struct bnxt *bp,
req->mtu = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN +
ETHER_CRC_LEN + VLAN_TAG_SIZE *
BNXT_NUM_VLANS);
req->mru = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN +
ETHER_CRC_LEN + VLAN_TAG_SIZE *
BNXT_NUM_VLANS);
req->mru = rte_cpu_to_le_16(BNXT_VNIC_MRU(bp->eth_dev->data->mtu));
req->num_rsscos_ctxs = rte_cpu_to_le_16(bp->max_rsscos_ctx /
(num_vfs + 1));
req->num_stat_ctxs = rte_cpu_to_le_16(bp->max_stat_ctx / (num_vfs + 1));
Expand Down

0 comments on commit 5326842

Please sign in to comment.