diff mbox

[dpdk-dev,v6,09/22] mbuf: extend fdir field

Message ID AAC06825A3B29643AF5372F5E0DDF0533503494E@IRSMSX106.ger.corp.intel.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Chilikin, Andrey Nov. 21, 2014, 5:03 p.m. UTC
This patch adds extra 32bits to rte_mbuf::hash - so 'uint32_t usr' will move to the second cache line?

Regards,
Andrey

-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jingjing Wu
Sent: Friday, November 21, 2014 12:47 AM
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v6 09/22] mbuf: extend fdir field

fdir field in rte_mbuf is extened to support flex bytes reported when fdir match.
8 flex bytes can be reported in maximum.
The reported flex bytes are part of flexible payload.

Signed-off-by: jingjing.wu <jingjing.wu@intel.com>
---
 lib/librte_mbuf/rte_mbuf.h | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

 #define PKT_TX_IP_CKSUM      (1ULL << 54) /**< IP cksum of TX pkt. computed by NIC. */
@@ -181,8 +183,17 @@ struct rte_mbuf {
 	union {
 		uint32_t rss;     /**< RSS hash result if RSS enabled */
 		struct {
-			uint16_t hash;
-			uint16_t id;
+			union {
+				struct {
+					uint16_t hash;
+					uint16_t id;
+				};
+				uint32_t lo;
+				/**< Second 4 flexible bytes */
+			};
+			uint32_t hi;
+			/**< First 4 flexible bytes or FD ID, dependent on
+			     PKT_RX_FDIR_* flag in ol_flags. */
 		} fdir;           /**< Filter identifier if FDIR enabled */
 		uint32_t sched;   /**< Hierarchical scheduler */
 		uint32_t usr;	  /**< User defined tags. See @rte_distributor_process */
--
1.8.1.4

Comments

Konstantin Ananyev Nov. 21, 2014, 7:34 p.m. UTC | #1
Hi Andrey,

> -----Original Message-----
> From: Chilikin, Andrey
> Sent: Friday, November 21, 2014 5:03 PM
> To: Wu, Jingjing; dev@dpdk.org
> Cc: Ananyev, Konstantin
> Subject: RE: [dpdk-dev] [PATCH v6 09/22] mbuf: extend fdir field
> 
> This patch adds extra 32bits to rte_mbuf::hash 

Yes.

>- so 'uint32_t usr' will move to the second cache line?
>

Why is that?
hash is a union, so:
offsetof(struct rte_mbuf, hash.rss) == offsetof(struct rte_mbuf, hash.usr) == 44
before and after patch.

As there still exists free space before rte_mbuf::userdata, whole rte_mbuf::hash stays on the first cache line.
Konstantin
    
 
> Regards,
> Andrey
> 
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jingjing Wu
> Sent: Friday, November 21, 2014 12:47 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v6 09/22] mbuf: extend fdir field
> 
> fdir field in rte_mbuf is extened to support flex bytes reported when fdir match.
> 8 flex bytes can be reported in maximum.
> The reported flex bytes are part of flexible payload.
> 
> Signed-off-by: jingjing.wu <jingjing.wu@intel.com>
> ---
>  lib/librte_mbuf/rte_mbuf.h | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index f5f8658..5899e5c 100644
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -77,7 +77,7 @@ extern "C" {
>   */
>  #define PKT_RX_VLAN_PKT      (1ULL << 0)  /**< RX packet is a 802.1q VLAN packet. */
>  #define PKT_RX_RSS_HASH      (1ULL << 1)  /**< RX packet with RSS hash result. */
> -#define PKT_RX_FDIR          (1ULL << 2)  /**< RX packet with FDIR infos. */
> +#define PKT_RX_FDIR          (1ULL << 2)  /**< RX packet with FDIR match indicate. */
>  #define PKT_RX_L4_CKSUM_BAD  (1ULL << 3)  /**< L4 cksum of RX pkt. is not OK. */  #define PKT_RX_IP_CKSUM_BAD  (1ULL << 4)
> /**< IP cksum of RX pkt. is not OK. */  #define PKT_RX_EIP_CKSUM_BAD (0ULL << 0)  /**< External IP header checksum error. */ @@
> -93,6 +93,8 @@ extern "C" {  #define PKT_RX_IEEE1588_TMST (1ULL << 10) /**< RX IEEE1588 L2/L4 timestamped packet.*/  #define
> PKT_RX_TUNNEL_IPV4_HDR (1ULL << 11) /**< RX tunnel packet with IPv4 header.*/  #define PKT_RX_TUNNEL_IPV6_HDR (1ULL <<
> 12) /**< RX tunnel packet with IPv6 header. */
> +#define PKT_RX_FDIR_ID       (1ULL << 13) /**< FD id reported if FDIR match. */
> +#define PKT_RX_FDIR_FLX      (1ULL << 14) /**< Flexible bytes reported if FDIR match. */
> 
>  #define PKT_TX_VLAN_PKT      (1ULL << 55) /**< TX packet is a 802.1q VLAN packet. */
>  #define PKT_TX_IP_CKSUM      (1ULL << 54) /**< IP cksum of TX pkt. computed by NIC. */
> @@ -181,8 +183,17 @@ struct rte_mbuf {
>  	union {
>  		uint32_t rss;     /**< RSS hash result if RSS enabled */
>  		struct {
> -			uint16_t hash;
> -			uint16_t id;
> +			union {
> +				struct {
> +					uint16_t hash;
> +					uint16_t id;
> +				};
> +				uint32_t lo;
> +				/**< Second 4 flexible bytes */
> +			};
> +			uint32_t hi;
> +			/**< First 4 flexible bytes or FD ID, dependent on
> +			     PKT_RX_FDIR_* flag in ol_flags. */
>  		} fdir;           /**< Filter identifier if FDIR enabled */
>  		uint32_t sched;   /**< Hierarchical scheduler */
>  		uint32_t usr;	  /**< User defined tags. See @rte_distributor_process */
> --
> 1.8.1.4
Chilikin, Andrey Nov. 21, 2014, 7:37 p.m. UTC | #2
Me bad, missed wrapping union  :)

Thanks,
Andrey

-----Original Message-----
From: Ananyev, Konstantin 
Sent: Friday, November 21, 2014 7:35 PM
To: Chilikin, Andrey; Wu, Jingjing; dev@dpdk.org
Subject: RE: [dpdk-dev] [PATCH v6 09/22] mbuf: extend fdir field

Hi Andrey,

> -----Original Message-----
> From: Chilikin, Andrey
> Sent: Friday, November 21, 2014 5:03 PM
> To: Wu, Jingjing; dev@dpdk.org
> Cc: Ananyev, Konstantin
> Subject: RE: [dpdk-dev] [PATCH v6 09/22] mbuf: extend fdir field
> 
> This patch adds extra 32bits to rte_mbuf::hash

Yes.

>- so 'uint32_t usr' will move to the second cache line?
>

Why is that?
hash is a union, so:
offsetof(struct rte_mbuf, hash.rss) == offsetof(struct rte_mbuf, hash.usr) == 44 before and after patch.

As there still exists free space before rte_mbuf::userdata, whole rte_mbuf::hash stays on the first cache line.
Konstantin
    
 
> Regards,
> Andrey
> 
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jingjing Wu
> Sent: Friday, November 21, 2014 12:47 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v6 09/22] mbuf: extend fdir field
> 
> fdir field in rte_mbuf is extened to support flex bytes reported when fdir match.
> 8 flex bytes can be reported in maximum.
> The reported flex bytes are part of flexible payload.
> 
> Signed-off-by: jingjing.wu <jingjing.wu@intel.com>
> ---
>  lib/librte_mbuf/rte_mbuf.h | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h 
> index f5f8658..5899e5c 100644
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -77,7 +77,7 @@ extern "C" {
>   */
>  #define PKT_RX_VLAN_PKT      (1ULL << 0)  /**< RX packet is a 802.1q VLAN packet. */
>  #define PKT_RX_RSS_HASH      (1ULL << 1)  /**< RX packet with RSS hash result. */
> -#define PKT_RX_FDIR          (1ULL << 2)  /**< RX packet with FDIR infos. */
> +#define PKT_RX_FDIR          (1ULL << 2)  /**< RX packet with FDIR match indicate. */
>  #define PKT_RX_L4_CKSUM_BAD  (1ULL << 3)  /**< L4 cksum of RX pkt. is 
> not OK. */  #define PKT_RX_IP_CKSUM_BAD  (1ULL << 4) /**< IP cksum of 
> RX pkt. is not OK. */  #define PKT_RX_EIP_CKSUM_BAD (0ULL << 0)  /**< 
> External IP header checksum error. */ @@
> -93,6 +93,8 @@ extern "C" {  #define PKT_RX_IEEE1588_TMST (1ULL << 10) 
> /**< RX IEEE1588 L2/L4 timestamped packet.*/  #define 
> PKT_RX_TUNNEL_IPV4_HDR (1ULL << 11) /**< RX tunnel packet with IPv4 
> header.*/  #define PKT_RX_TUNNEL_IPV6_HDR (1ULL <<
> 12) /**< RX tunnel packet with IPv6 header. */
> +#define PKT_RX_FDIR_ID       (1ULL << 13) /**< FD id reported if FDIR match. */
> +#define PKT_RX_FDIR_FLX      (1ULL << 14) /**< Flexible bytes reported if FDIR match. */
> 
>  #define PKT_TX_VLAN_PKT      (1ULL << 55) /**< TX packet is a 802.1q VLAN packet. */
>  #define PKT_TX_IP_CKSUM      (1ULL << 54) /**< IP cksum of TX pkt. computed by NIC. */
> @@ -181,8 +183,17 @@ struct rte_mbuf {
>  	union {
>  		uint32_t rss;     /**< RSS hash result if RSS enabled */
>  		struct {
> -			uint16_t hash;
> -			uint16_t id;
> +			union {
> +				struct {
> +					uint16_t hash;
> +					uint16_t id;
> +				};
> +				uint32_t lo;
> +				/**< Second 4 flexible bytes */
> +			};
> +			uint32_t hi;
> +			/**< First 4 flexible bytes or FD ID, dependent on
> +			     PKT_RX_FDIR_* flag in ol_flags. */
>  		} fdir;           /**< Filter identifier if FDIR enabled */
>  		uint32_t sched;   /**< Hierarchical scheduler */
>  		uint32_t usr;	  /**< User defined tags. See @rte_distributor_process */
> --
> 1.8.1.4
diff mbox

Patch

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index f5f8658..5899e5c 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -77,7 +77,7 @@  extern "C" {
  */
 #define PKT_RX_VLAN_PKT      (1ULL << 0)  /**< RX packet is a 802.1q VLAN packet. */
 #define PKT_RX_RSS_HASH      (1ULL << 1)  /**< RX packet with RSS hash result. */
-#define PKT_RX_FDIR          (1ULL << 2)  /**< RX packet with FDIR infos. */
+#define PKT_RX_FDIR          (1ULL << 2)  /**< RX packet with FDIR match indicate. */
 #define PKT_RX_L4_CKSUM_BAD  (1ULL << 3)  /**< L4 cksum of RX pkt. is not OK. */  #define PKT_RX_IP_CKSUM_BAD  (1ULL << 4)  /**< IP cksum of RX pkt. is not OK. */  #define PKT_RX_EIP_CKSUM_BAD (0ULL << 0)  /**< External IP header checksum error. */ @@ -93,6 +93,8 @@ extern "C" {  #define PKT_RX_IEEE1588_TMST (1ULL << 10) /**< RX IEEE1588 L2/L4 timestamped packet.*/  #define PKT_RX_TUNNEL_IPV4_HDR (1ULL << 11) /**< RX tunnel packet with IPv4 header.*/  #define PKT_RX_TUNNEL_IPV6_HDR (1ULL << 12) /**< RX tunnel packet with IPv6 header. */
+#define PKT_RX_FDIR_ID       (1ULL << 13) /**< FD id reported if FDIR match. */
+#define PKT_RX_FDIR_FLX      (1ULL << 14) /**< Flexible bytes reported if FDIR match. */
 
 #define PKT_TX_VLAN_PKT      (1ULL << 55) /**< TX packet is a 802.1q VLAN packet. */