[RFC 2/5] net: fix eCPRI remote reset message header size

Mattias Rönnblom <[email protected]>
Newsgroups org.dpdk.dev
Message-ID <[email protected]>
From: Mattias Rönnblom <[email protected]>

The Remote Reset message header (type #6) is 3 bytes on the wire, but
padding made struct rte_ecpri_msg_remote_reset 4 bytes, so code using
sizeof() to step over the header skipped one byte too many.

Pack the struct, leaving the field offsets unchanged. Its size thus
goes from 4 to 3 bytes. struct rte_ecpri_combined_msg_hdr is
unaffected, since the One-Way Delay Measurement header is larger.

Fixes: d164c609e70b ("ethdev: add eCPRI key fields to flow API")

Signed-off-by: Mattias Rönnblom <[email protected]>
---
 doc/guides/rel_notes/release_26_11.rst | 3 +++
 lib/net/rte_ecpri.h                    | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/guides/rel_notes/release_26_11.rst b/doc/guides/rel_notes/release_26_11.rst
index dca75000b7..c52092b987 100644
--- a/doc/guides/rel_notes/release_26_11.rst
+++ b/doc/guides/rel_notes/release_26_11.rst
@@ -114,6 +114,9 @@ ABI Changes
   ``struct rte_ecpri_combined_msg_hdr``, and hence
   ``struct rte_flow_item_ecpri``, grew from 16 to 24 bytes.
 
+* net: Packed ``struct rte_ecpri_msg_remote_reset``, so that its size matches
+  the 3-byte message header on the wire. It shrank from 4 to 3 bytes.
+
 
 Known Issues
 ------------
diff --git a/lib/net/rte_ecpri.h b/lib/net/rte_ecpri.h
index 6f6762ffb2..6bacdbecc2 100644
--- a/lib/net/rte_ecpri.h
+++ b/lib/net/rte_ecpri.h
@@ -150,10 +150,10 @@ struct __rte_packed_begin rte_ecpri_msg_delay_measure {
 /**
  * eCPRI Message Header of Type #6: Remote Reset
  */
-struct rte_ecpri_msg_remote_reset {
+struct __rte_packed_begin rte_ecpri_msg_remote_reset {
 	rte_be16_t rst_id;		/**< Reset ID */
 	uint8_t rst_op;			/**< Reset Code Op */
-};
+} __rte_packed_end;
 
 /**
  * eCPRI Message Header of Type #7: Event Indication
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.