[dpdk-dev] [PATCH 1/2] mbuf: fix bitmask of Tx offload flags

Olivier MATZ olivier.matz at 6wind.com
Thu Jan 26 16:05:16 CET 2017


On Thu, 26 Jan 2017 14:58:08 +0000, "Ananyev, Konstantin"
<konstantin.ananyev at intel.com> wrote:
> Hi Jingjng,
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Jingjing Wu
> > Sent: Tuesday, January 24, 2017 11:48 AM
> > To: dev at dpdk.org
> > Cc: Wu, Jingjing <jingjing.wu at intel.com>
> > Subject: [dpdk-dev] [PATCH 1/2] mbuf: fix bitmask of Tx offload
> > flags
> > 
> > Some Tx offload flags are missed in Bitmask of all supported packet
> > Tx offload features flags.
> > This patch fixes it.  
> 
> Not sure what it exactly fixes?
> As I remember these flags don't specify any TX offload for HW to
> perform, But just provide information to the TX function.
> Again, why only i40e code is modified?
> As I remember we have the same code in other PMDs too.
> Konstantin
> 
> > 
> > Fixes: 4fb7e803eb1a ("ethdev: add Tx preparation")
> > Signed-off-by: Jingjing Wu <jingjing.wu at intel.com>
> > ---
> >  lib/librte_mbuf/rte_mbuf.h | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
> > index bfce9f4..e57a4d2 100644
> > --- a/lib/librte_mbuf/rte_mbuf.h
> > +++ b/lib/librte_mbuf/rte_mbuf.h
> > @@ -295,8 +295,12 @@ extern "C" {
> >   */
> >  #define PKT_TX_OFFLOAD_MASK (    \
> >  		PKT_TX_IP_CKSUM |        \
> > +		PKT_TX_IPV4 |            \
> > +		PKT_TX_IPV6 |            \
> >  		PKT_TX_L4_MASK |         \
> >  		PKT_TX_OUTER_IP_CKSUM |  \
> > +		PKT_TX_OUTER_IPV4 |      \
> > +		PKT_TX_OUTER_IPV6 |      \
> >  		PKT_TX_TCP_SEG |         \
> >  		PKT_TX_QINQ_PKT |        \
> >  		PKT_TX_VLAN_PKT |        \
> > --
> > 2.4.11  
> 

Also, it looks like MACSEC is missing. To avoid forgetting flags in
the future, what do you think about doing the following (not tested)?


diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index b3cccfc..aa1dc76 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -182,9 +182,11 @@ extern "C" {
  */
 #define PKT_RX_TIMESTAMP     (1ULL << 17)
 
-/* add new RX flags here */
+/* add new RX flags here, and update __PKT_RX_NEXT */
+#define __PKT_RX_NEXT        (1ULL << 18)
 
-/* add new TX flags here */
+/* add new TX flags here, and update __PKT_TX_NEXT */
+#define __PKT_TX_NEXT        (1ULL << 43)
 
 /**
  * Offload the MACsec. This flag must be set by the application to enable
@@ -295,17 +297,16 @@ extern "C" {
 #define PKT_TX_OUTER_IPV6    (1ULL << 60)
 
 /**
+ * Bitmask of all supported packet Rx offload features flags,
+ * which can be set for packet.
+ */
+#define PKT_RX_OFFLOAD_MASK (__PKT_RX_NEXT - 1)
+
+/**
  * Bitmask of all supported packet Tx offload features flags,
  * which can be set for packet.
  */
-#define PKT_TX_OFFLOAD_MASK (    \
-               PKT_TX_IP_CKSUM |        \
-               PKT_TX_L4_MASK |         \
-               PKT_TX_OUTER_IP_CKSUM |  \
-               PKT_TX_TCP_SEG |         \
-               PKT_TX_QINQ_PKT |        \
-               PKT_TX_VLAN_PKT |        \
-               PKT_TX_TUNNEL_MASK)
+#define PKT_TX_OFFLOAD_MASK ((~(__PKT_TX_NEXT - 1)) & 0x1fffffffffffffff)
 
 #define __RESERVED           (1ULL << 61) /**< reserved for future mbuf use */
 



More information about the dev mailing list