[dpdk-dev] [RFC] net: make eCPRI header host network order

Bing Zhao bingz at nvidia.com
Sat Nov 28 04:18:25 CET 2020


Hi Ferruh & Haiyue,
Have you checked other headers? Like:
rte_ipv4_hdr
rte_ipv6_hdr
rte_tcp_hdr
...

Also
	[ITEM_UDP_SRC] = {
		.name = "src",
		.help = "UDP source port",
		.next = NEXT(item_udp, NEXT_ENTRY(UNSIGNED), item_param),
		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_udp,
					     hdr.src_port)),
	},
	[ITEM_UDP_DST] = {
		.name = "dst",
		.help = "UDP destination port",
		.next = NEXT(item_udp, NEXT_ENTRY(UNSIGNED), item_param),
		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_udp,
					     hdr.dst_port)),
	},

Or did I get sth. wrong?

BR. Bing

> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit at intel.com>
> Sent: Saturday, November 28, 2020 3:09 AM
> To: Olivier Matz <olivier.matz at 6wind.com>
> Cc: Ferruh Yigit <ferruh.yigit at intel.com>; dev at dpdk.org; Haiyue Wang
> <haiyue.wang at intel.com>; Stephen Hemminger
> <stephen at networkplumber.org>; Bing Zhao <bingz at nvidia.com>
> Subject: [RFC] net: make eCPRI header host network order
> 
> External email: Use caution opening links or attachments
> 
> 
> Other protocol structs are in the host byte order, having eCPRI in
> network byte order is insistent and error prone.
> 
> Making eCPRI protocol header host byte order.
> 
> Signed-off-by: Haiyue Wang <haiyue.wang at intel.com>
> Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>
> ---
> Cc: Stephen Hemminger <stephen at networkplumber.org>
> Cc: Bing Zhao <bingz at nvidia.com>
> Cc: Olivier Matz <olivier.matz at 6wind.com>
> ---
>  lib/librte_net/rte_ecpri.h | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/librte_net/rte_ecpri.h b/lib/librte_net/rte_ecpri.h
> index 1cbd6d813363..67bf9186ff6f 100644
> --- a/lib/librte_net/rte_ecpri.h
> +++ b/lib/librte_net/rte_ecpri.h
> @@ -60,21 +60,20 @@ extern "C" {
>  RTE_STD_C11
>  struct rte_ecpri_common_hdr {
>         union {
> -               rte_be32_t u32;                 /**< 4B common
> header in BE */
> +               uint32_t u32;                   /**< 4B common
> header in host byte order */
>                 struct {
>  #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
> -                       uint32_t size:16;       /**< Payload Size */
> -                       uint32_t type:8;        /**< Message Type */
>                         uint32_t c:1;           /**< Concatenation
> Indicator */
>                         uint32_t res:3;         /**< Reserved */
>                         uint32_t revision:4;    /**< Protocol
> Revision */
> +                       uint32_t type:8;        /**< Message Type */
>  #elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
>                         uint32_t revision:4;    /**< Protocol
> Revision */
>                         uint32_t res:3;         /**< Reserved */
>                         uint32_t c:1;           /**< Concatenation
> Indicator */
>                         uint32_t type:8;        /**< Message Type */
> -                       uint32_t size:16;       /**< Payload Size */
>  #endif
> +                       uint32_t size:16;       /**< Payload Size */
>                 };
>         };
>  };
> --
> 2.26.2



More information about the dev mailing list