[v2] mbuf: outer offsets are undefined for non-tunnel packets

Message ID 20190624160206.21014-1-ivan.malov@oktetlabs.ru (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] mbuf: outer offsets are undefined for non-tunnel packets |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/Intel-compilation fail Compilation issues

Commit Message

Ivan Malov June 24, 2019, 4:02 p.m. UTC
  The default policy for offload-specific fields is that
they are undefined unless the corresponding offloads are
requested in mbuf ol_flags. This is also the case for outer
L2 and L3 length fields which must not be assumed to contain
zeros for non-tunnel packets. The patch clarifies this behaviour
in the comments. PMDs which mistakenly assume these fields
to be zero for non-tunnel packets are expected to comply
with the clarified comment and have dedicated fixes.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
---
 lib/librte_mbuf/rte_mbuf.h | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
  

Comments

Ananyev, Konstantin June 27, 2019, 1:09 p.m. UTC | #1
> The default policy for offload-specific fields is that
> they are undefined unless the corresponding offloads are
> requested in mbuf ol_flags. This is also the case for outer
> L2 and L3 length fields which must not be assumed to contain
> zeros for non-tunnel packets. The patch clarifies this behaviour
> in the comments. PMDs which mistakenly assume these fields
> to be zero for non-tunnel packets are expected to comply
> with the clarified comment and have dedicated fixes.
> 
> Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
> ---
>  lib/librte_mbuf/rte_mbuf.h | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
> index 0d9fef0..26a0b14 100644
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -702,7 +702,18 @@ struct rte_mbuf {
>  			uint64_t tso_segsz:RTE_MBUF_TSO_SEGSZ_BITS;
>  			/**< TCP TSO segment size */
> 
> -			/* fields for TX offloading of tunnels */
> +			/*
> +			 * Fields for Tx offloading of tunnels.
> +			 * These are undefined for packets which don't request
> +			 * any tunnel offloads (outer IP or UDP checksum,
> +			 * tunnel TSO).
> +			 *
> +			 * PMDs are advised not to use these fields
> +			 * unconditionally when calculating offsets.

I'd use something stronger then 'are advised not to'.
Might be something like: 'should not use'.
BTW, from the previous discussion, right now we do
have some misbehaving PMDs that need to be fixed, correct?
Apart from that:
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> 

> +			 *
> +			 * Applications are expected to set appropriate tunnel
> +			 * offload flags when they fill in these fields.
> +			 */
>  			uint64_t outer_l3_len:RTE_MBUF_OUTL3_LEN_BITS;
>  			/**< Outer L3 (IP) Hdr Length. */
>  			uint64_t outer_l2_len:RTE_MBUF_OUTL2_LEN_BITS;
> --
> 1.8.3.1
  

Patch

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 0d9fef0..26a0b14 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -702,7 +702,18 @@  struct rte_mbuf {
 			uint64_t tso_segsz:RTE_MBUF_TSO_SEGSZ_BITS;
 			/**< TCP TSO segment size */
 
-			/* fields for TX offloading of tunnels */
+			/*
+			 * Fields for Tx offloading of tunnels.
+			 * These are undefined for packets which don't request
+			 * any tunnel offloads (outer IP or UDP checksum,
+			 * tunnel TSO).
+			 *
+			 * PMDs are advised not to use these fields
+			 * unconditionally when calculating offsets.
+			 *
+			 * Applications are expected to set appropriate tunnel
+			 * offload flags when they fill in these fields.
+			 */
 			uint64_t outer_l3_len:RTE_MBUF_OUTL3_LEN_BITS;
 			/**< Outer L3 (IP) Hdr Length. */
 			uint64_t outer_l2_len:RTE_MBUF_OUTL2_LEN_BITS;