Skip to contentSkip to conversation

net: fix checksum API documentation

PATCH Superseded Lance Richardson 4 participants 9 messages Sep 16, 2021 – Oct 7, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: fix checksum API documentation

Minor corrections and improvements to documentation for checksum APIs.

Fixes 6006818cfb26 ("net: new checksum functions")
Fixes 45a08ef55e44 ("net: introduce functions to verify L4 checksums")
---
 lib/net/rte_ip.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
lib/net/rte_ip.h +4 -4
index 05948b69b7..fd08ea31b2 100644
@@ -488,7 +488,7 @@ rte_ipv6_phdr_cksum(const struct rte_ipv6_hdr *ipv6_hdr, uint64_t ol_flags)
 }
 
 /**
- * @internal Calculate the non-complemented IPv4 L4 checksum
+ * @internal Calculate the non-complemented IPv6 L4 checksum
  */
 static inline uint16_t
 __rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr)
@@ -509,15 +509,15 @@ __rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr)
 /**
  * Process the IPv6 UDP or TCP checksum.
  *
- * The IPv4 header should not contains options. The layer 4 checksum
- * must be set to 0 in the packet by the caller.
+ * The IPv6 header must not be followed by extension headers. The layer 4
+ * checksum must be set to 0 in the L4 header by the caller.
  *
  * @param ipv6_hdr
  *   The pointer to the contiguous IPv6 header.
  * @param l4_hdr
  *   The pointer to the beginning of the L4 header.
  * @return
- *   The complemented checksum to set in the IP packet.
+ *   The complemented checksum to set in the L4 header.
  */
 static inline uint16_t
 rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr)
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 45 lines

From: Lance Richardson [mailto:[email protected]]
Sent: Thursday, 16 September 2021 18.11

Minor corrections and improvements to documentation for checksum APIs.

Fixes 6006818cfb26 ("net: new checksum functions")
Fixes 45a08ef55e44 ("net: introduce functions to verify L4 checksums")
---
 lib/net/rte_ip.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
lib/net/rte_ip.h +1 -1
index 05948b69b7..fd08ea31b2 100644
@@ -488,7 +488,7 @@ rte_ipv6_phdr_cksum(const struct rte_ipv6_hdr
 *ipv6_hdr, uint64_t ol_flags)
 }
 
 /**
- * @internal Calculate the non-complemented IPv4 L4 checksum
+ * @internal Calculate the non-complemented IPv6 L4 checksum
  */
 static inline uint16_t

__rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const
void *l4_hdr)

lib/net/rte_ip.h +1 -2
@@ -509,15 +509,15 @@ __rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr
 *ipv6_hdr, const void *l4_hdr)
 /**
  * Process the IPv6 UDP or TCP checksum.
  *
- * The IPv4 header should not contains options. The layer 4 checksum
- * must be set to 0 in the packet by the caller.
+ * The IPv6 header must not be followed by extension headers. The

layer 4
+ * checksum must be set to 0 in the L4 header by the caller. *
* @param ipv6_hdr
* The pointer to the contiguous IPv6 header.
* @param l4_hdr
* The pointer to the beginning of the L4 header.
* @return

Quoted 8 lines

- * The complemented checksum to set in the IP packet.
+ * The complemented checksum to set in the L4 header.
*/
static inline uint16_t
rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void
*l4_hdr)
--
2.25.1

#2 lore raw
Quoted 39 lines · Morten Brørup
Quoted 39 lines

From: Lance Richardson [mailto:[email protected]]
Sent: Thursday, 16 September 2021 18.11

Minor corrections and improvements to documentation for checksum APIs.

Fixes 6006818cfb26 ("net: new checksum functions")
Fixes 45a08ef55e44 ("net: introduce functions to verify L4 checksums")
---
 lib/net/rte_ip.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
lib/net/rte_ip.h +1 -1
index 05948b69b7..fd08ea31b2 100644
@@ -488,7 +488,7 @@ rte_ipv6_phdr_cksum(const struct rte_ipv6_hdr
 *ipv6_hdr, uint64_t ol_flags)
 }
 
 /**
- * @internal Calculate the non-complemented IPv4 L4 checksum
+ * @internal Calculate the non-complemented IPv6 L4 checksum
  */
 static inline uint16_t

__rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const
void *l4_hdr)

lib/net/rte_ip.h +1 -2
@@ -509,15 +509,15 @@ __rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr
 *ipv6_hdr, const void *l4_hdr)
 /**
  * Process the IPv6 UDP or TCP checksum.
  *
- * The IPv4 header should not contains options. The layer 4 checksum
- * must be set to 0 in the packet by the caller.
+ * The IPv6 header must not be followed by extension headers. The

layer 4
+ * checksum must be set to 0 in the L4 header by the caller.

Quoted 8 lines
Quoted 8 lines

*
* @param ipv6_hdr
* The pointer to the contiguous IPv6 header.
* @param l4_hdr
* The pointer to the beginning of the L4 header.
* @return
- * The complemented checksum to set in the IP packet.
+ * The complemented checksum to set in the L4 header.

Isn't this wrong for 'rte_ipv4_udptcp_cksum()' too? Since you are touching this, can you fix that one too?

Quoted 9 lines
Quoted 6 lines

*/
static inline uint16_t
rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void
*l4_hdr)
--
2.25.1

#3 lore raw
Quoted 55 lines

From: dev [mailto:[email protected]] On Behalf Of Ferruh Yigit
Sent: Tuesday, 21 September 2021 11.28

Quoted 8 lines · Morten Brørup
Quoted 8 lines

From: Lance Richardson [mailto:[email protected]]
Sent: Thursday, 16 September 2021 18.11

Minor corrections and improvements to documentation for checksum APIs.

Fixes 6006818cfb26 ("net: new checksum functions")
Fixes 45a08ef55e44 ("net: introduce functions to verify L4

checksums")

Quoted 14 lines
Quoted 14 lines
---
 lib/net/rte_ip.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
lib/net/rte_ip.h +0 -0
index 05948b69b7..fd08ea31b2 100644
@@ -488,7 +488,7 @@ rte_ipv6_phdr_cksum(const struct rte_ipv6_hdr
 *ipv6_hdr, uint64_t ol_flags)
 }
 
Quoted 8 lines

lib/net/rte_ip.h __rte_ipv6_udptcp_cksum(const struct

Quoted 8 lines
lib/net/rte_ip.h +1 -1
 /**
- * @internal Calculate the non-complemented IPv4 L4 checksum
+ * @internal Calculate the non-complemented IPv6 L4 checksum
  */
 static inline uint16_t

__rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const
void *l4_hdr)

lib/net/rte_ip.h +0 -0
@@ -509,15 +509,15 @@ __rte_ipv6_udptcp_cksum(const struct

rte_ipv6_hdr

Quoted 5 lines

lib/net/rte_ip.h __rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr)

Quoted 5 lines
lib/net/rte_ip.h +0 -1
 *ipv6_hdr, const void *l4_hdr)
 /**
  * Process the IPv6 UDP or TCP checksum.
  *
- * The IPv4 header should not contains options. The layer 4

checksum

Quoted 4 lines
Quoted 4 lines
lib/net/rte_ip.h +1 -1
- * must be set to 0 in the packet by the caller.
+ * The IPv6 header must not be followed by extension headers. The

layer 4
+ * checksum must be set to 0 in the L4 header by the caller.

Quoted 8 lines
Quoted 8 lines

*
* @param ipv6_hdr
* The pointer to the contiguous IPv6 header.
* @param l4_hdr
* The pointer to the beginning of the L4 header.
* @return
- * The complemented checksum to set in the IP packet.
+ * The complemented checksum to set in the L4 header.

Quoted 4 lines

Isn't this wrong for 'rte_ipv4_udptcp_cksum()' too? Since you are touching this,
can you fix that one too?

Ferruh, the description of the return value is technically correct; it mentions the IP packet, not the IP header. So this change is a clarification only.

However, I agree that the same clarification would also benefit 'rte_ipv4_udptcp_cksum()'.

Quoted 11 lines
Quoted 3 lines
Quoted 3 lines

*/
static inline uint16_t
rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const

void

Quoted 6 lines
Quoted 3 lines

*l4_hdr)
--
2.25.1

#4 lore raw
Quoted 5 lines · Morten Brørup

Ferruh, the description of the return value is technically correct; it mentions the IP packet, not the IP header. So this change is a clarification only.

However, I agree that the same clarification would also benefit 'rte_ipv4_udptcp_cksum()'.

Sure, will fix in v2.

Also for rte_ipv4_udptcp_cksum(), a comment says "The IP and layer 4 checksum must be set to zero", but only the layer 4 checksum actually needs to be set to zero. I'll fix that at the same time.

Thanks,
Lance

#5 lore raw

PATCH v2 1/1 net: fix checksum API documentation

In reply to Lance Richardson

Minor corrections and improvements to documentation for checksum APIs.

Fixes 6006818cfb26 ("net: new checksum functions")
Fixes 45a08ef55e44 ("net: introduce functions to verify L4 checksums")

---
v2:
- Updates for rte_ipv4_udptcp_cksum()

 lib/net/rte_ip.h | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
lib/net/rte_ip.h +6 -7
index 05948b69b7..bc3dd44a4c 100644
@@ -371,15 +371,14 @@ __rte_ipv4_udptcp_cksum(const struct rte_ipv4_hdr *ipv4_hdr, const void *l4_hdr)
 /**
  * Process the IPv4 UDP or TCP checksum.
  *
- * The IP and layer 4 checksum must be set to 0 in the packet by
- * the caller.
+ * The layer 4 checksum must be set to 0 in the L4 header by the caller.
  *
  * @param ipv4_hdr
  *   The pointer to the contiguous IPv4 header.
  * @param l4_hdr
  *   The pointer to the beginning of the L4 header.
  * @return
- *   The complemented checksum to set in the IP packet.
+ *   The complemented checksum to set in the L4 header.
  */
 static inline uint16_t
 rte_ipv4_udptcp_cksum(const struct rte_ipv4_hdr *ipv4_hdr, const void *l4_hdr)
@@ -488,7 +487,7 @@ rte_ipv6_phdr_cksum(const struct rte_ipv6_hdr *ipv6_hdr, uint64_t ol_flags)
 }
 
 /**
- * @internal Calculate the non-complemented IPv4 L4 checksum
+ * @internal Calculate the non-complemented IPv6 L4 checksum
  */
 static inline uint16_t
 __rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr)
@@ -509,15 +508,15 @@ __rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr)
 /**
  * Process the IPv6 UDP or TCP checksum.
  *
- * The IPv4 header should not contains options. The layer 4 checksum
- * must be set to 0 in the packet by the caller.
+ * The IPv6 header must not be followed by extension headers. The layer 4
+ * checksum must be set to 0 in the L4 header by the caller.
  *
  * @param ipv6_hdr
  *   The pointer to the contiguous IPv6 header.
  * @param l4_hdr
  *   The pointer to the beginning of the L4 header.
  * @return
- *   The complemented checksum to set in the IP packet.
+ *   The complemented checksum to set in the L4 header.
  */
 static inline uint16_t
 rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr)
Signature · 1 line
2.25.1
Applied
#8 lore raw
Quoted 10 lines · Olivier Matz
Quoted 9 lines · Ferruh Yigit
Quoted 7 lines · Lance Richardson

Minor corrections and improvements to documentation for checksum APIs.

Fixes 6006818cfb26 ("net: new checksum functions")
Fixes 45a08ef55e44 ("net: introduce functions to verify L4 checksums")
Quoted 5 lines
Quoted 2 lines

Applied to dpdk-next-net/main, thanks.