DPDK usage discussions
 help / color / mirror / Atom feed
From: fwefew 4t4tg <7532yahoo@gmail.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: "jiangheng (H)" <jiangheng12@huawei.com>,
	"users@dpdk.org" <users@dpdk.org>
Subject: Re: [dpdk-users] DPDK RX TCP checksum failed
Date: Sun, 27 Mar 2022 23:11:53 -0400
Message-ID: <CA+Tq66XbcjN2Pp+uionU6HSoGpyqfeBV52+nBdKBCZXCr4XxQA@mail.gmail.com> (raw)
In-Reply-To: <20220326115923.715473aa@hermes.local>

[-- Attachment #1: Type: text/plain, Size: 2570 bytes --]

https://github.com/rodgarrison/reinvent
demonstrates ether/UDP chec-kum offload running on AWS which uses virtio. I
don't think TCP offload
is substantially different. Look here:

https://github.com/rodgarrison/reinvent/blob/main/integration_tests/reinvent_dpdk_udp/reinvent_dpdk_udp_integration_test.cpp#L345

for where the mbuf needs to be setup.

But I kind of agree with Stephan, although I haven't tested it, avoiding
more sets into mbuf which might involve cache misses it might be faster to
do by hand since the data is already in cache.

On Sat, Mar 26, 2022 at 2:59 PM Stephen Hemminger <
stephen@networkplumber.org> wrote:

> On Sat, 26 Mar 2022 08:13:21 +0000
> "jiangheng (H)" <jiangheng12@huawei.com> wrote:
>
> > Hi all,
> >
> > I tried using the checksum offloads feature in DPDK and it did not see
> working under virtual machine.
> >
> > Port only support TCP checksum and do not support IP checksum:
> > rx_offload_capa = DEV_RX_OFFLOAD_TCP_CKSUM
> > tx_offload_capa = DEV_TX_OFFLOAD_TCP_CKSUM
> >
> > so I config rxmode.offload txmode.offloads as below:
> > rxmode.offloads = DEV_RX_OFFLOAD_TCP_CKSUM
> > txmode.offloads = DEV_TX_OFFLOAD_TCP_CKSUM
> >
> > For TX, I set the following parameters, it works good.
> > mbuf->l2_len = sizeof(*ethhdr)
> > mbuf->l3_len = ip header len
> > mbuf-ol_flags = RTE_MBUF_F_TX_IPV4 | RTE_MBUF_F_TX_TCP_CKSUM
>
>
> Virtio does not support IP checksum offload.  Because Virtio passes
> packets to Linux kernel, and Linux kernel does not do IP checksum offload.
> The IP checksum is so trivial it is faster for most things to just
> do it in software; the header is only 20 bytes and it will be in cache.
>
> You should always check device capability before enabling an offload.
>
>
> > For RX, It will execute the following code:
> > In drivers/net/virtio/virtio_rxtx.c  virtio_rx_offload function :
> >     if (hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) {
> >         hdrlen = hdr_lens.l2_len + hdr_lens.l3_len + hdr_lens.l4_len;
> >         if (hdr->csum_start <= hdrlen && l4_supported) {
> >             m->ol_flags |= RTE_MBUF_F_RX_L4_CKSUM_NONE;
> >         } else {
> >
> > m->ol_flags set to RTE_MBUF_F_RX_L4_CKSUM_NONE, causing the TCP RX
> checksum failed.
> > How do I avoid the above code going into this branch?
> >
>
> If you want TCP checksum offload you have to set
> RTE_ETH_RX_OFFLOAD_TCP_CKSUM
> in the rxmode when port is configured.  This will tell virtio to ask the
> host to do rx offload. Again, virtio does not do IP checksum offload and
> you should always query device capability first.
>
>

[-- Attachment #2: Type: text/html, Size: 3456 bytes --]

  parent reply	other threads:[~2022-03-28  3:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-26  8:13 jiangheng (H)
2022-03-26 18:59 ` Stephen Hemminger
2022-03-28  1:50   ` 答复: " jiangheng (H)
2022-03-28  2:15     ` Harold Huang
2022-04-07 12:50       ` 答复: " jiangheng (H)
2022-03-28  3:11   ` fwefew 4t4tg [this message]
2022-04-07 13:42     ` jiangheng (H)

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=CA+Tq66XbcjN2Pp+uionU6HSoGpyqfeBV52+nBdKBCZXCr4XxQA@mail.gmail.com \
    --to=7532yahoo@gmail.com \
    --cc=jiangheng12@huawei.com \
    --cc=stephen@networkplumber.org \
    --cc=users@dpdk.org \
    /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

DPDK usage discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/users/0 users/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 users users/ http://inbox.dpdk.org/users \
		users@dpdk.org
	public-inbox-index users

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.users


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git