[dpdk-dev,v4,1/4] ethdev: introduce generic IP/UDP tunnel checksum and TSO
Checks
Commit Message
This patch introduce new TX offload flags for device that supports
IP or UDP tunneled packet L3/L4 checksum and TSO offload.
The support from the device is for inner and outer checksums on
IPV4/TCP/UDP and TSO for *any packet with the following format*:
<some headers> / [optional IPv4/IPv6] / [optional TCP/UDP] / <some
headers> / [optional inner IPv4/IPv6] / [optional TCP/UDP]
For example the following packets can use this feature:
1. eth / ipv4 / udp / VXLAN / ip / tcp
2. eth / ipv4 / GRE / MPLS / ipv4 / udp
Please note that tunnel headers that contain payload length, sequence id
or checksum will not be updated.
Signed-off-by: Xueming Li <xuemingl@mellanox.com>
---
lib/librte_ether/rte_ethdev.h | 4 ++++
lib/librte_mbuf/rte_mbuf.c | 6 ++++++
lib/librte_mbuf/rte_mbuf.h | 2 ++
3 files changed, 12 insertions(+)
Comments
08/04/2018 14:32, Xueming Li:
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -210,6 +210,8 @@ extern "C" {
> #define PKT_TX_TUNNEL_GENEVE (0x4ULL << 45)
> /**< TX packet with MPLS-in-UDP RFC 7510 header. */
> #define PKT_TX_TUNNEL_MPLSINUDP (0x5ULL << 45)
> +#define PKT_TX_TUNNEL_IP (0xDULL << 45) /**< Tx IP tunneled packet. */
> +#define PKT_TX_TUNNEL_UDP (0xEULL << 45) /**< Tx UDP tunneled packet. */
I think you need to explain in details, in the comments,
what we can expect when using these flags.
Please write the doxygen comment on the lines before the flag.
Any reason for using 0xD and 0xE values?
Because they are more generic than the first ones?
> /* add new TX TUNNEL type here */
> #define PKT_TX_TUNNEL_MASK (0xFULL << 45)
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Tuesday, April 17, 2018 6:43 AM
> To: Xueming(Steven) Li <xuemingl@mellanox.com>
> Cc: dev@dpdk.org; Wenzhuo Lu <wenzhuo.lu@intel.com>; Jingjing Wu <jingjing.wu@intel.com>; Yongseok Koh
> <yskoh@mellanox.com>; Olivier MATZ <olivier.matz@6wind.com>; Shahaf Shuler <shahafs@mellanox.com>;
> Ferruh Yigit <ferruh.yigit@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v4 1/4] ethdev: introduce generic IP/UDP tunnel checksum and TSO
>
> 08/04/2018 14:32, Xueming Li:
> > --- a/lib/librte_mbuf/rte_mbuf.h
> > +++ b/lib/librte_mbuf/rte_mbuf.h
> > @@ -210,6 +210,8 @@ extern "C" {
> > #define PKT_TX_TUNNEL_GENEVE (0x4ULL << 45) /**< TX packet with
> > MPLS-in-UDP RFC 7510 header. */ #define PKT_TX_TUNNEL_MPLSINUDP
> > (0x5ULL << 45)
> > +#define PKT_TX_TUNNEL_IP (0xDULL << 45) /**< Tx IP tunneled packet.
> > +*/ #define PKT_TX_TUNNEL_UDP (0xEULL << 45) /**< Tx UDP tunneled
> > +packet. */
>
> I think you need to explain in details, in the comments, what we can expect when using these flags.
> Please write the doxygen comment on the lines before the flag.
Got it.
>
> Any reason for using 0xD and 0xE values?
> Because they are more generic than the first ones?
Yes, do you think it better to continue with previous ones?
>
> > /* add new TX TUNNEL type here */
> > #define PKT_TX_TUNNEL_MASK (0xFULL << 45)
>
>
17/04/2018 09:53, Xueming(Steven) Li:
> From: Thomas Monjalon <thomas@monjalon.net>
> > 08/04/2018 14:32, Xueming Li:
> > > --- a/lib/librte_mbuf/rte_mbuf.h
> > > +++ b/lib/librte_mbuf/rte_mbuf.h
> > > @@ -210,6 +210,8 @@ extern "C" {
> > > #define PKT_TX_TUNNEL_GENEVE (0x4ULL << 45) /**< TX packet with
> > > MPLS-in-UDP RFC 7510 header. */ #define PKT_TX_TUNNEL_MPLSINUDP
> > > (0x5ULL << 45)
> > > +#define PKT_TX_TUNNEL_IP (0xDULL << 45) /**< Tx IP tunneled packet.
> > > +*/ #define PKT_TX_TUNNEL_UDP (0xEULL << 45) /**< Tx UDP tunneled
> > > +packet. */
> >
> > I think you need to explain in details, in the comments, what we can expect when using these flags.
> > Please write the doxygen comment on the lines before the flag.
>
> Got it.
>
> >
> > Any reason for using 0xD and 0xE values?
> > Because they are more generic than the first ones?
>
> Yes, do you think it better to continue with previous ones?
No strong opinion.
Olivier?
@@ -980,6 +980,10 @@ struct rte_eth_conf {
* the same mempool and has refcnt = 1.
*/
#define DEV_TX_OFFLOAD_SECURITY 0x00020000
+/**< Device supports UDP tunneled packet TSO */
+#define DEV_TX_OFFLOAD_UDP_TNL_TSO 0x00040000
+/**< Device supports IP based tunnel packet TSO */
+#define DEV_TX_OFFLOAD_IP_TNL_TSO 0x00080000
/*
* If new Tx offload capabilities are defined, they also must be
@@ -405,6 +405,8 @@ const char *rte_get_tx_ol_flag_name(uint64_t mask)
case PKT_TX_TUNNEL_IPIP: return "PKT_TX_TUNNEL_IPIP";
case PKT_TX_TUNNEL_GENEVE: return "PKT_TX_TUNNEL_GENEVE";
case PKT_TX_TUNNEL_MPLSINUDP: return "PKT_TX_TUNNEL_MPLSINUDP";
+ case PKT_TX_TUNNEL_IP: return "PKT_TX_TUNNEL_IP";
+ case PKT_TX_TUNNEL_UDP: return "PKT_TX_TUNNEL_UDP";
case PKT_TX_MACSEC: return "PKT_TX_MACSEC";
case PKT_TX_SEC_OFFLOAD: return "PKT_TX_SEC_OFFLOAD";
default: return NULL;
@@ -439,6 +441,10 @@ rte_get_tx_ol_flag_list(uint64_t mask, char *buf, size_t buflen)
"PKT_TX_TUNNEL_NONE" },
{ PKT_TX_TUNNEL_MPLSINUDP, PKT_TX_TUNNEL_MASK,
"PKT_TX_TUNNEL_NONE" },
+ { PKT_TX_TUNNEL_IP, PKT_TX_TUNNEL_MASK,
+ "PKT_TX_TUNNEL_NONE" },
+ { PKT_TX_TUNNEL_UDP, PKT_TX_TUNNEL_MASK,
+ "PKT_TX_TUNNEL_NONE" },
{ PKT_TX_MACSEC, PKT_TX_MACSEC, NULL },
{ PKT_TX_SEC_OFFLOAD, PKT_TX_SEC_OFFLOAD, NULL },
};
@@ -210,6 +210,8 @@ extern "C" {
#define PKT_TX_TUNNEL_GENEVE (0x4ULL << 45)
/**< TX packet with MPLS-in-UDP RFC 7510 header. */
#define PKT_TX_TUNNEL_MPLSINUDP (0x5ULL << 45)
+#define PKT_TX_TUNNEL_IP (0xDULL << 45) /**< Tx IP tunneled packet. */
+#define PKT_TX_TUNNEL_UDP (0xEULL << 45) /**< Tx UDP tunneled packet. */
/* add new TX TUNNEL type here */
#define PKT_TX_TUNNEL_MASK (0xFULL << 45)