From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: Olivier Matz <olivier.matz@6wind.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
"Ananyev, Konstantin" <konstantin.ananyev@intel.com>,
Yuanhan Liu <yuanhan.liu@linux.intel.com>,
"Richardson, Bruce" <bruce.richardson@intel.com>
Subject: Re: [dpdk-dev] about rx checksum flags
Date: Mon, 30 May 2016 18:07:03 +0200 [thread overview]
Message-ID: <20160530160703.GH1428@6wind.com> (raw)
In-Reply-To: <574C5B9D.4080006@6wind.com>
On Mon, May 30, 2016 at 05:26:21PM +0200, Olivier Matz wrote:
> Hi,
>
> I'm planning to add the support for offloads in virtio-net pmd.
> It appears that the current rx flags in mbuf are not sufficient to
> describe the state of a packet received from a virtual driver.
> I think we need a way to say "the checksum in the packet data is
> not calculated, but the integrity of the data is verified".
>
> Currently, we have one flag for L4 (same for IP):
>
> PKT_RX_L4_CKSUM_BAD: L4 cksum of RX pkt. is not OK.
>
> This has also another problem that has already been discussed [1]:
> if no flag is set, it is expected that the checksum is verified by
> hw, but there is no way to say "the hw does not know if the cksum
> is correct".
>
> I would like to extend this flag to a 4-state value (2 bits):
>
> PKT_RX_L4_CKSUM_UNKNOWN: no information about the RX L4 checksum
> -> the application should verify the checksum by sw
>
> PKT_RX_L4_CKSUM_BAD: the L4 checksum in the packet is wrong
> -> the application can drop the packet without additional check
>
> PKT_RX_L4_CKSUM_GOOD: the L4 checksum in the packet is valid
> -> the application can accept the packet without verifying the
> checksum by sw
>
> PKT_RX_L4_CKSUM_NONE: the L4 checksum is not correct in the packet
> data, but the integrity of the L4 header is verified.
> -> the application can process the packet but must not verify the
> checksum by sw. It has to take care to recalculate the cksum
> if the packet is transmitted (either by sw or using tx offload)
This API makes and lot of sense for both mlx4 and mlx5 PMDs as well, for
which hardware only returns information about "good" headers ("unknown"
should be assumed otherwise). It does not map well with the current API that
only provides info about bad checksums.
For instance, non-IP packets do not have valid L3/L4 checksums and thus are
not returned as "good" by hardware. These PMDs perform the "not good means
bad" conversion for DPDK which is wrong in such cases. Same for unknown
packet types.
> To keep the compatibility with application, the old flag is kept at the
> same value, and a new flag is added. It is assumed that the behavior
> of applications was:
>
> PKT_RX_L4_CKSUM_BAD = 0 -> packet is accepted
> PKT_RX_L4_CKSUM_BAD = 1 -> packet is dropped
>
> The new checksum states for L4 (same for IP) would be:
>
> old flag new flag meaning
> 0 0 PKT_RX_L4_CKSUM_UNKNOWN
> 1 0 PKT_RX_L4_CKSUM_BAD
> 0 1 PKT_RX_L4_CKSUM_GOOD
> 1 1 PKT_RX_L4_CKSUM_NONE
>
> With this, an old application that only checks the old flag, and
> running using a dpdk having this modification would accept GOOD and
> UNKNOWN packets (like today), drop BAD packets (like today) and
> drop NONE packets (this is a new feature that has to be explicitly
> enabled by the application).
>
>
> Any comment?
Considering mlx4 and mlx5 can only return "good" or "unknown" checksums, I'm
all for updating the API as suggested.
> Olivier
>
>
> [1] http://dpdk.org/ml/archives/dev/2015-January/011550.html
--
Adrien Mazarguil
6WIND
next prev parent reply other threads:[~2016-05-30 16:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-30 15:26 Olivier Matz
2016-05-30 16:07 ` Adrien Mazarguil [this message]
2016-05-31 2:43 ` Tan, Jianfeng
2016-05-31 10:08 ` Adrien Mazarguil
2016-05-31 19:11 ` Olivier MATZ
2016-05-31 8:09 ` Yuanhan Liu
2016-05-31 19:11 ` Olivier MATZ
2016-05-31 20:28 ` Stephen Hemminger
2016-05-31 20:58 ` Olivier MATZ
2016-05-31 22:02 ` Stephen Hemminger
2016-06-01 9:06 ` Ananyev, Konstantin
2016-06-02 7:42 ` Chandran, Sugesh
2016-06-03 12:43 ` Olivier Matz
2016-06-08 8:22 ` Chandran, Sugesh
2016-06-08 13:02 ` Olivier Matz
2016-06-10 16:15 ` Chandran, Sugesh
2016-07-06 12:52 ` Chandran, Sugesh
2016-07-06 13:18 ` Olivier MATZ
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=20160530160703.GH1428@6wind.com \
--to=adrien.mazarguil@6wind.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=konstantin.ananyev@intel.com \
--cc=olivier.matz@6wind.com \
--cc=yuanhan.liu@linux.intel.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).