Skip to content

Commit

Permalink
net/cxgbe: fix jumbo frame flag condition
Browse files Browse the repository at this point in the history
[ upstream commit 5dfbad5 ]

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
If the Ether overhead is larger than 18 when it supports VLAN tag,
that will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will normalize the boundary condition with 'RTE_ETHER_MTU'
and overhead even though current overhead is 18.

Fixes: 4b2eff4 ("cxgbe: enable jumbo frames")
Fixes: 0ec33be ("cxgbe: allow to change mtu")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
  • Loading branch information
Steve Yang authored and bluca committed Feb 4, 2021
1 parent 3d98b60 commit 9326ad3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions drivers/net/cxgbe/cxgbe.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
#define CXGBE_MAX_RX_PKTLEN (9000 + RTE_ETHER_HDR_LEN + \
RTE_ETHER_CRC_LEN) /* max pkt */

/* The max frame size with default MTU */
#define CXGBE_ETH_MAX_LEN (RTE_ETHER_MTU + \
RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN)

/* Max poll time is 100 * 100msec = 10 sec */
#define CXGBE_LINK_STATUS_POLL_MS 100 /* 100ms */
#define CXGBE_LINK_STATUS_POLL_CNT 100 /* Max number of times to poll */
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/cxgbe/cxgbe_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ int cxgbe_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
return -EINVAL;

/* set to jumbo mode if needed */
if (new_mtu > RTE_ETHER_MAX_LEN)
if (new_mtu > CXGBE_ETH_MAX_LEN)
eth_dev->data->dev_conf.rxmode.offloads |=
DEV_RX_OFFLOAD_JUMBO_FRAME;
else
Expand Down Expand Up @@ -669,7 +669,7 @@ int cxgbe_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
rxq->fl.size = temp_nb_desc;

/* Set to jumbo mode if necessary */
if (pkt_len > RTE_ETHER_MAX_LEN)
if (pkt_len > CXGBE_ETH_MAX_LEN)
eth_dev->data->dev_conf.rxmode.offloads |=
DEV_RX_OFFLOAD_JUMBO_FRAME;
else
Expand Down

0 comments on commit 9326ad3

Please sign in to comment.