[v7,1/1] app/testpmd: fix max rx packet length for VLAN packets
Checks
Commit Message
When the max rx packet length is smaller than the sum of mtu size and
ether overhead size, it should be enlarged, otherwise the VLAN packets
will be dropped.
Fixes: 35b2d13fd6fd ("net: add rte prefix to ether defines")
Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
app/test-pmd/testpmd.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
Comments
On 10/28/2020 3:03 AM, SteveX Yang wrote:
> When the max rx packet length is smaller than the sum of mtu size and
> ether overhead size, it should be enlarged, otherwise the VLAN packets
> will be dropped.
>
> Fixes: 35b2d13fd6fd ("net: add rte prefix to ether defines")
>
> Signed-off-by: SteveX Yang <stevex.yang@intel.com>
> ---
> app/test-pmd/testpmd.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 33fc0fddf..754066950 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -1421,6 +1421,7 @@ init_config(void)
> struct rte_gro_param gro_param;
> uint32_t gso_types;
> uint16_t data_size;
> + uint16_t overhead_len;
> bool warning = 0;
> int k;
> int ret;
> @@ -1457,6 +1458,25 @@ init_config(void)
> rte_exit(EXIT_FAILURE,
> "rte_eth_dev_info_get() failed\n");
>
> + /* Update the max_rx_pkt_len to have MTU as RTE_ETHER_MTU */
> + if (port->dev_info.max_rx_pktlen && port->dev_info.max_mtu)
> + overhead_len = port->dev_info.max_rx_pktlen -
> + port->dev_info.max_mtu;
> + else
> + overhead_len = RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
> +
> + port->dev_conf.rxmode.max_rx_pkt_len =
> + RTE_ETHER_MTU + overhead_len;
> +
> + /*
> + * Workaround: only adapt to RTE_ETHER_MAX_LEN as
> + * jumbo frame condition.
> + */
> + if (port->dev_conf.rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN) {
> + port->dev_conf.rxmode.offloads |=
> + DEV_RX_OFFLOAD_JUMBO_FRAME;
> + }
I think this jumbo frame set can be dropped, above just set the frame size as
"RTE_ETHER_MTU + overhead_len", so it can't be jumbo frame, right?
@@ -1421,6 +1421,7 @@ init_config(void)
struct rte_gro_param gro_param;
uint32_t gso_types;
uint16_t data_size;
+ uint16_t overhead_len;
bool warning = 0;
int k;
int ret;
@@ -1457,6 +1458,25 @@ init_config(void)
rte_exit(EXIT_FAILURE,
"rte_eth_dev_info_get() failed\n");
+ /* Update the max_rx_pkt_len to have MTU as RTE_ETHER_MTU */
+ if (port->dev_info.max_rx_pktlen && port->dev_info.max_mtu)
+ overhead_len = port->dev_info.max_rx_pktlen -
+ port->dev_info.max_mtu;
+ else
+ overhead_len = RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
+
+ port->dev_conf.rxmode.max_rx_pkt_len =
+ RTE_ETHER_MTU + overhead_len;
+
+ /*
+ * Workaround: only adapt to RTE_ETHER_MAX_LEN as
+ * jumbo frame condition.
+ */
+ if (port->dev_conf.rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN) {
+ port->dev_conf.rxmode.offloads |=
+ DEV_RX_OFFLOAD_JUMBO_FRAME;
+ }
+
if (!(port->dev_info.tx_offload_capa &
DEV_TX_OFFLOAD_MBUF_FAST_FREE))
port->dev_conf.txmode.offloads &=