[PATCH v4 01/18] mbuf: deprecate GCC marker in rte mbuf struct

fengchengwen fengchengwen at huawei.com
Sun Feb 18 03:28:52 CET 2024


Some minor comments style may need adjust.

With above fixed,
Acked-by: Chengwen Feng <fengchengwen at huawei.com>

On 2024/2/15 14:21, Tyler Retzlaff wrote:
> Provide a macro that allows conditional expansion of RTE_MARKER fields
> to empty to allow rte_mbuf to be used with MSVC. It is proposed that
> we announce the fields to be __rte_deprecated (currently disabled).
> 
> Introduce C11 anonymous unions to permit aliasing of well-known
> offsets by name into the rte_mbuf structure by a *new* name and to
> provide padding for cache alignment.
> 
> Signed-off-by: Tyler Retzlaff <roretzla at linux.microsoft.com>
> ---

...

>  
> -	/* remaining bytes are set on RX when pulling packet from descriptor */
> -	RTE_MARKER rx_descriptor_fields1;
> +			uint64_t ol_flags;        /**< Offload features. */
>  
> -	/*
> -	 * The packet type, which is the combination of outer/inner L2, L3, L4
> -	 * and tunnel types. The packet_type is about data really present in the
> -	 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
> -	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
> -	 * vlan is stripped from the data.
> -	 */
> -	union {
> -		uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
> -		__extension__
> -		struct {
> -			uint8_t l2_type:4;   /**< (Outer) L2 type. */
> -			uint8_t l3_type:4;   /**< (Outer) L3 type. */
> -			uint8_t l4_type:4;   /**< (Outer) L4 type. */
> -			uint8_t tun_type:4;  /**< Tunnel type. */
> +			/* remaining bytes are set on RX when pulling packet from descriptor */
> +			__rte_marker(RTE_MARKER, rx_descriptor_fields1);
>  			union {
> -				uint8_t inner_esp_next_proto;
> -				/**< ESP next protocol type, valid if
> -				 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
> -				 * on both Tx and Rx.
> -				 */
> +				char mbuf_rx_descriptor_fields1[8];
>  				__extension__
>  				struct {
> -					uint8_t inner_l2_type:4;
> -					/**< Inner L2 type. */
> -					uint8_t inner_l3_type:4;
> -					/**< Inner L3 type. */
> +					/*
> +					 * The packet type, which is the combination of outer/inner
> +					 * L2, L3, L4 and tunnel types. The packet_type is about
> +					 * data really present in the mbuf. Example: if vlan
> +					 * stripping is enabled, a received vlan packet would have
> +					 * RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
> +					 * vlan is stripped from the data.
> +					 */
> +					union {
> +						uint32_t packet_type;
> +						/**< L2/L3/L4 and tunnel information. */

According dpdk doxygen guidelines [1], prefer prefix comment in above case.

[1] https://doc.dpdk.org/guides/contributing/documentation.html#doxygen-guidelines

> +						__extension__
> +						struct {
> +							uint8_t l2_type:4;
> +							/**< (Outer) L2 type. */
> +							uint8_t l3_type:4;
> +							/**< (Outer) L3 type. */
> +							uint8_t l4_type:4;
> +							/**< (Outer) L4 type. */
> +							uint8_t tun_type:4;
> +							/**< Tunnel type. */
> +							union {
> +								uint8_t inner_esp_next_proto;
> +								/**< ESP next protocol type, valid
> +								 * if RTE_PTYPE_TUNNEL_ESP tunnel
> +								 * type is set on both Tx and Rx.
> +								 */
> +								__extension__
> +								struct {
> +									uint8_t inner_l2_type:4;
> +									/**< Inner L2 type. */
> +									uint8_t inner_l3_type:4;
> +									/**< Inner L3 type. */
> +								};
> +							};
> +							uint8_t inner_l4_type:4;
> +							/**< Inner L4 type. */
> +						};
> +					};
> +					uint32_t pkt_len;
> +					/**< Total pkt len: sum of all segments. */

The above should also use prefix comment type.

>  				};
>  			};
> -			uint8_t inner_l4_type:4; /**< Inner L4 type. */
> -		};
> -	};
>  

...


More information about the dev mailing list