DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/3] Adjust mbuf flag definitions
@ 2014-10-03 15:36 Bruce Richardson
  2014-10-03 15:36 ` [dpdk-dev] [PATCH 1/3] mbuf: move TX flags to group them near end of field Bruce Richardson
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Bruce Richardson @ 2014-10-03 15:36 UTC (permalink / raw)
  To: dev

This patchset does some cleanup work on the mbuf flag definitions. It is 
based off the ideas discussed in the previous RFC patch. 
[Ref: http://thread.gmane.org/gmane.comp.networking.dpdk.devel/6155]

Summary of changes:
* Adjust TX flags to start at bit 55 in flags field and work downwards,
  leaving bits 56 upward reserved for generic mbuf flags, i.e. non-offload
  flags.
* Update the existing RX flags to be in a similar format to the newly
  redefined TX flags for clarity.
* Finally we add a comment for the ctrl mbuf flag to ensure all flags are
  properly documented.

Bruce Richardson (3):
  mbuf: move TX flags to group them near end of field
  mbuf: RX flag format update
  mbuf: add comment for ctrl mbuf flag

 lib/librte_mbuf/rte_mbuf.h | 65 +++++++++++++++++++++++++---------------------
 1 file changed, 36 insertions(+), 29 deletions(-)

-- 
1.9.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 1/3] mbuf: move TX flags to group them near end of field
  2014-10-03 15:36 [dpdk-dev] [PATCH 0/3] Adjust mbuf flag definitions Bruce Richardson
@ 2014-10-03 15:36 ` Bruce Richardson
  2014-10-03 15:36 ` [dpdk-dev] [PATCH 2/3] mbuf: RX flag format update Bruce Richardson
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Bruce Richardson @ 2014-10-03 15:36 UTC (permalink / raw)
  To: dev

This patch takes the existing TX flags defined for the mbuf and shifts
each uniquely defined one left so that additional RX flags can be
defined without having RX and TX flags mixed together. Under the new
scheme, RX flags start at bit 0 and work left, TX flags start at bit 55
and work right, and bits 56-63 are reserved for generic mbuf use, not
for offloads.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 lib/librte_mbuf/rte_mbuf.h | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 1c6e115..7aa507e 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -68,6 +68,12 @@ extern "C" {
 /*
  * Packet Offload Features Flags. It also carry packet type information.
  * Critical resources. Both rx/tx shared these bits. Be cautious on any change
+ *
+ * - RX flags start at bit position zero, and get added to the left of previous
+ *   flags.
+ * - The most-significant 8 bits are reserved for generic mbuf flags
+ * - TX flags therefore start at bit position 55 (i.e. 63-8), and new flags get
+ *   added to the right of the previously defined flags
  */
 #define PKT_RX_VLAN_PKT      0x0001 /**< RX packet is a 802.1q VLAN packet. */
 #define PKT_RX_RSS_HASH      0x0002 /**< RX packet with RSS hash result. */
@@ -86,26 +92,27 @@ extern "C" {
 #define PKT_RX_IEEE1588_PTP  0x0200 /**< RX IEEE1588 L2 Ethernet PT Packet. */
 #define PKT_RX_IEEE1588_TMST 0x0400 /**< RX IEEE1588 L2/L4 timestamped packet.*/
 
-#define PKT_TX_VLAN_PKT      0x0800 /**< TX packet is a 802.1q VLAN packet. */
-#define PKT_TX_IP_CKSUM      0x1000 /**< IP cksum of TX pkt. computed by NIC. */
-#define PKT_TX_IPV4_CSUM     0x1000 /**< Alias of PKT_TX_IP_CKSUM. */
+#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. */
+#define PKT_TX_IPV4_CSUM     PKT_TX_IP_CKSUM /**< Alias of PKT_TX_IP_CKSUM. */
 #define PKT_TX_IPV4          PKT_RX_IPV4_HDR /**< IPv4 with no IP checksum offload. */
 #define PKT_TX_IPV6          PKT_RX_IPV6_HDR /**< IPv6 packet */
 
 /*
- * Bit 14~13 used for L4 packet type with checksum enabled.
+ * Bits 52+53 used for L4 packet type with checksum enabled.
  *     00: Reserved
  *     01: TCP checksum
  *     10: SCTP checksum
  *     11: UDP checksum
  */
-#define PKT_TX_L4_MASK       0x6000 /**< Mask bits for L4 checksum offload request. */
-#define PKT_TX_L4_NO_CKSUM   0x0000 /**< Disable L4 cksum of TX pkt. */
-#define PKT_TX_TCP_CKSUM     0x2000 /**< TCP cksum of TX pkt. computed by NIC. */
-#define PKT_TX_SCTP_CKSUM    0x4000 /**< SCTP cksum of TX pkt. computed by NIC. */
-#define PKT_TX_UDP_CKSUM     0x6000 /**< UDP cksum of TX pkt. computed by NIC. */
-/* Bit 15 */
-#define PKT_TX_IEEE1588_TMST 0x8000 /**< TX IEEE1588 packet to timestamp. */
+#define PKT_TX_L4_NO_CKSUM   (0ULL << 52) /**< Disable L4 cksum of TX pkt. */
+#define PKT_TX_TCP_CKSUM     (1ULL << 52) /**< TCP cksum of TX pkt. computed by NIC. */
+#define PKT_TX_SCTP_CKSUM    (2ULL << 52) /**< SCTP cksum of TX pkt. computed by NIC. */
+#define PKT_TX_UDP_CKSUM     (3ULL << 52) /**< UDP cksum of TX pkt. computed by NIC. */
+#define PKT_TX_L4_MASK       (3ULL << 52) /**< Mask for L4 cksum offload request. */
+
+/* Bit 51 - IEEE1588*/
+#define PKT_TX_IEEE1588_TMST (1ULL << 51) /**< TX IEEE1588 packet to timestamp. */
 
 /* Use final bit of flags to indicate a control mbuf */
 #define CTRL_MBUF_FLAG       (1ULL << 63)
-- 
1.9.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 2/3] mbuf: RX flag format update
  2014-10-03 15:36 [dpdk-dev] [PATCH 0/3] Adjust mbuf flag definitions Bruce Richardson
  2014-10-03 15:36 ` [dpdk-dev] [PATCH 1/3] mbuf: move TX flags to group them near end of field Bruce Richardson
@ 2014-10-03 15:36 ` Bruce Richardson
  2014-10-03 15:36 ` [dpdk-dev] [PATCH 3/3] mbuf: add comment for ctrl mbuf flag Bruce Richardson
  2014-10-08 12:50 ` [dpdk-dev] [PATCH 0/3] Adjust mbuf flag definitions Thomas Monjalon
  3 siblings, 0 replies; 5+ messages in thread
From: Bruce Richardson @ 2014-10-03 15:36 UTC (permalink / raw)
  To: dev

Update the format of the RX flags to match that of the TX flags. In
general the flags are now specified as "1ULL << X", with a few
exceptions.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 lib/librte_mbuf/rte_mbuf.h | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 7aa507e..a4487bb 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -75,22 +75,22 @@ extern "C" {
  * - TX flags therefore start at bit position 55 (i.e. 63-8), and new flags get
  *   added to the right of the previously defined flags
  */
-#define PKT_RX_VLAN_PKT      0x0001 /**< RX packet is a 802.1q VLAN packet. */
-#define PKT_RX_RSS_HASH      0x0002 /**< RX packet with RSS hash result. */
-#define PKT_RX_FDIR          0x0004 /**< RX packet with FDIR infos. */
-#define PKT_RX_L4_CKSUM_BAD  0x0008 /**< L4 cksum of RX pkt. is not OK. */
-#define PKT_RX_IP_CKSUM_BAD  0x0010 /**< IP cksum of RX pkt. is not OK. */
-#define PKT_RX_EIP_CKSUM_BAD 0x0000 /**< External IP header checksum error. */
-#define PKT_RX_OVERSIZE      0x0000 /**< Num of desc of an RX pkt oversize. */
-#define PKT_RX_HBUF_OVERFLOW 0x0000 /**< Header buffer overflow. */
-#define PKT_RX_RECIP_ERR     0x0000 /**< Hardware processing error. */
-#define PKT_RX_MAC_ERR       0x0000 /**< MAC error. */
-#define PKT_RX_IPV4_HDR      0x0020 /**< RX packet with IPv4 header. */
-#define PKT_RX_IPV4_HDR_EXT  0x0040 /**< RX packet with extended IPv4 header. */
-#define PKT_RX_IPV6_HDR      0x0080 /**< RX packet with IPv6 header. */
-#define PKT_RX_IPV6_HDR_EXT  0x0100 /**< RX packet with extended IPv6 header. */
-#define PKT_RX_IEEE1588_PTP  0x0200 /**< RX IEEE1588 L2 Ethernet PT Packet. */
-#define PKT_RX_IEEE1588_TMST 0x0400 /**< RX IEEE1588 L2/L4 timestamped packet.*/
+#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_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. */
+#define PKT_RX_OVERSIZE      (0ULL << 0)  /**< Num of desc of an RX pkt oversize. */
+#define PKT_RX_HBUF_OVERFLOW (0ULL << 0)  /**< Header buffer overflow. */
+#define PKT_RX_RECIP_ERR     (0ULL << 0)  /**< Hardware processing error. */
+#define PKT_RX_MAC_ERR       (0ULL << 0)  /**< MAC error. */
+#define PKT_RX_IPV4_HDR      (1ULL << 5)  /**< RX packet with IPv4 header. */
+#define PKT_RX_IPV4_HDR_EXT  (1ULL << 6)  /**< RX packet with extended IPv4 header. */
+#define PKT_RX_IPV6_HDR      (1ULL << 7)  /**< RX packet with IPv6 header. */
+#define PKT_RX_IPV6_HDR_EXT  (1ULL << 8)  /**< RX packet with extended IPv6 header. */
+#define PKT_RX_IEEE1588_PTP  (1ULL << 9)  /**< RX IEEE1588 L2 Ethernet PT Packet. */
+#define PKT_RX_IEEE1588_TMST (1ULL << 10) /**< RX IEEE1588 L2/L4 timestamped packet.*/
 
 #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. */
-- 
1.9.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 3/3] mbuf: add comment for ctrl mbuf flag
  2014-10-03 15:36 [dpdk-dev] [PATCH 0/3] Adjust mbuf flag definitions Bruce Richardson
  2014-10-03 15:36 ` [dpdk-dev] [PATCH 1/3] mbuf: move TX flags to group them near end of field Bruce Richardson
  2014-10-03 15:36 ` [dpdk-dev] [PATCH 2/3] mbuf: RX flag format update Bruce Richardson
@ 2014-10-03 15:36 ` Bruce Richardson
  2014-10-08 12:50 ` [dpdk-dev] [PATCH 0/3] Adjust mbuf flag definitions Thomas Monjalon
  3 siblings, 0 replies; 5+ messages in thread
From: Bruce Richardson @ 2014-10-03 15:36 UTC (permalink / raw)
  To: dev

Add in a doxygen comment for the ctrl mbuf flag definition.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 lib/librte_mbuf/rte_mbuf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index a4487bb..8581e15 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -115,7 +115,7 @@ extern "C" {
 #define PKT_TX_IEEE1588_TMST (1ULL << 51) /**< TX IEEE1588 packet to timestamp. */
 
 /* Use final bit of flags to indicate a control mbuf */
-#define CTRL_MBUF_FLAG       (1ULL << 63)
+#define CTRL_MBUF_FLAG       (1ULL << 63) /**< Mbuf contains control data */
 
 /**
  * Bit Mask to indicate what bits required for building TX context
-- 
1.9.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH 0/3] Adjust mbuf flag definitions
  2014-10-03 15:36 [dpdk-dev] [PATCH 0/3] Adjust mbuf flag definitions Bruce Richardson
                   ` (2 preceding siblings ...)
  2014-10-03 15:36 ` [dpdk-dev] [PATCH 3/3] mbuf: add comment for ctrl mbuf flag Bruce Richardson
@ 2014-10-08 12:50 ` Thomas Monjalon
  3 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2014-10-08 12:50 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev

2014-10-03 16:36, Bruce Richardson:
> This patchset does some cleanup work on the mbuf flag definitions. It is 
> based off the ideas discussed in the previous RFC patch. 
> [Ref: http://thread.gmane.org/gmane.comp.networking.dpdk.devel/6155]
> 
> Summary of changes:
> * Adjust TX flags to start at bit 55 in flags field and work downwards,
>   leaving bits 56 upward reserved for generic mbuf flags, i.e. non-offload
>   flags.
> * Update the existing RX flags to be in a similar format to the newly
>   redefined TX flags for clarity.
> * Finally we add a comment for the ctrl mbuf flag to ensure all flags are
>   properly documented.
> 
> Bruce Richardson (3):
>   mbuf: move TX flags to group them near end of field
>   mbuf: RX flag format update
>   mbuf: add comment for ctrl mbuf flag

Acked and applied

Thanks
-- 
Thomas

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-10-08 12:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-03 15:36 [dpdk-dev] [PATCH 0/3] Adjust mbuf flag definitions Bruce Richardson
2014-10-03 15:36 ` [dpdk-dev] [PATCH 1/3] mbuf: move TX flags to group them near end of field Bruce Richardson
2014-10-03 15:36 ` [dpdk-dev] [PATCH 2/3] mbuf: RX flag format update Bruce Richardson
2014-10-03 15:36 ` [dpdk-dev] [PATCH 3/3] mbuf: add comment for ctrl mbuf flag Bruce Richardson
2014-10-08 12:50 ` [dpdk-dev] [PATCH 0/3] Adjust mbuf flag definitions Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).