[PATCH] app/testpmd: fix wrong encap/decap size calculation

Thomas Monjalon thomas at monjalon.net
Thu Mar 16 18:26:29 CET 2023


16/03/2023 18:16, Michael Baum:
> Testpmd app has some functions to create either encap or decap buffer
> for some special cases:
>  - "l2_encap" and "l2_decap"
>  - "mplsogre_encap" and "mplsogre_decap"
>  - "mplsoudp_encap" and "mplsoudp_decap"
> 
> The functions use both "rte_flow_item_eth" and "rte_flow_item_vlan"
> structures to represent the headers and copy them into "raw_encap"
> action. The size of either "raw_encap" or "raw_decap" is capculated as

capculated -> calculated

> sum of headers size.
> 
> However, the both "rte_flow_item_eth" and "rte_flow_item_vlan" contain
> more fields than original headers, so using them cause bad size
> calculation.
> 
> This patch uses "RTE_ETHER_HDR_LEN" and "RTE_VLAN_HLEN" macros in size
> calculation.

Honestly I don't know why we have these *_LEN macros in DPDK.
We would have the same result with the (more explicit)
sizeof(struct rte_ether_hdr) or sizeof(struct rte_vlan_hdr).





More information about the stable mailing list