DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Michael Pfeiffer <michael.pfeiffer@tu-ilmenau.de>,
	Keith Wiles <keith.wiles@intel.com>,
	Olivier Matz <olivier.matz@6wind.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] net/tap: Allow all-zero checksum for UDP over IPv4
Date: Wed, 11 Nov 2020 09:31:56 +0000	[thread overview]
Message-ID: <40d63e07-f179-b3a8-ee7a-ff37e87c1008@intel.com> (raw)
In-Reply-To: <23c6f497eb31840f0a2260bb3b5521fba8c7ec3b.camel@tu-ilmenau.de>

On 11/11/2020 7:23 AM, Michael Pfeiffer wrote:
> Hi,
> 
> On Tue, 2020-11-10 at 15:59 +0000, Ferruh Yigit wrote:
>> On 11/9/2020 2:22 PM, Michael Pfeiffer wrote:
>>> Unlike TCP, UDP checksums are optional and may be zero to indicate "not
>>> set" [RFC 768] (except for IPv6, where this prohibited [RFC 8200]). Add
>>> this special case to the checksum offload emulation in net/tap.
>>>
>>> Signed-off-by: Michael Pfeiffer <michael.pfeiffer@tu-ilmenau.de>
>>> ---
>>>    drivers/net/tap/rte_eth_tap.c | 13 +++++++++++--
>>>    1 file changed, 11 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
>>> index 2f8abb12c..e486b41c5 100644
>>> --- a/drivers/net/tap/rte_eth_tap.c
>>> +++ b/drivers/net/tap/rte_eth_tap.c
>>> @@ -303,6 +303,7 @@ tap_verify_csum(struct rte_mbuf *mbuf)
>>>          uint16_t cksum = 0;
>>>          void *l3_hdr;
>>>          void *l4_hdr;
>>> +       struct rte_udp_hdr *udp_hdr;
>>>    
>>>          if (l2 == RTE_PTYPE_L2_ETHER_VLAN)
>>>                  l2_len += 4;
>>> @@ -349,10 +350,18 @@ tap_verify_csum(struct rte_mbuf *mbuf)
>>>                  /* Don't verify checksum for multi-segment packets. */
>>>                  if (mbuf->nb_segs > 1)
>>>                          return;
>>> -               if (l3 == RTE_PTYPE_L3_IPV4)
>>> +               if (l3 == RTE_PTYPE_L3_IPV4) {
>>> +                       if (l4 == RTE_PTYPE_L4_UDP) {
>>> +                               udp_hdr = (struct rte_udp_hdr *)l4_hdr;
>>> +                               if (udp_hdr->dgram_cksum == 0) {
>>
>> Overall patch looks good to me, but can you please add a comment on top of
>> above
>> check to describe why checksum can be zero, as done in the commit log.
> 
> Sure, I will update the patch. I am also not completely sure whether
> PKT_RX_L4_CKSUM_NONE is the right flag for this case (rather than _UNKNOWN).
>  From rte_core_mbuf.h:
> 
>   * - PKT_RX_L4_CKSUM_UNKNOWN: no information about the RX L4 checksum
>   * - PKT_RX_L4_CKSUM_NONE: the L4 checksum is not correct in the packet
>   *   data, but the integrity of the L4 data is verified.
> 
> The second part after the "but" is not really the case here. I don't know how
> relevant the distinction is, as most application side code will probably only
> do something like
> 
> if ((mbuf->ol_flags & PKT_RX_L4_CKSUM_MASK) == PKT_RX_L4_CKSUM_BAD)
> 	rte_pktmbuf_free(mbuf);
> 
> anyway. Do you have any opinions on that?
> 

I also checked for that and wasn't sure about it :) cc'ed Olivier too for comment.

I think it is NOT 'PKT_RX_L4_CKSUM_UNKNOWN', since we know that checksum value 
is 0x0000 which means it is not provided.

'PKT_RX_L4_CKSUM_NONE' suits better but not sure about the expectation on 
"integrity of the L4 data is verified" part, I assume that explanation is just 
to differentiate between 'CKSUM_BAD'.

  reply	other threads:[~2020-11-11  9:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-09 14:22 Michael Pfeiffer
2020-11-10 14:46 ` Ferruh Yigit
2020-11-10 15:56   ` Ferruh Yigit
2020-11-10 16:01   ` Morten Brørup
2020-11-10 17:42     ` Ferruh Yigit
2020-11-11  7:06       ` Morten Brørup
2020-11-10 15:59 ` Ferruh Yigit
2020-11-11  7:23   ` Michael Pfeiffer
2020-11-11  9:31     ` Ferruh Yigit [this message]
2020-11-13 13:02       ` Ferruh Yigit
2020-11-13 14:03         ` [dpdk-dev] [PATCH v2] " Michael Pfeiffer
2020-11-13 14:49           ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40d63e07-f179-b3a8-ee7a-ff37e87c1008@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=keith.wiles@intel.com \
    --cc=michael.pfeiffer@tu-ilmenau.de \
    --cc=olivier.matz@6wind.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).