[dpdk-dev] [PATCH RFC 11/11] ixgbe/mbuf: add TSO support

Ananyev, Konstantin konstantin.ananyev at intel.com
Thu May 15 18:30:15 CEST 2014


Hi Oliver,

With the current DPDK implementation the upper code would still be different for TCP checksum (without segmentation) and TCP segmentation:
different flags in mbuf, with TSO you need to setup l4_len and mss fields inside mbuf, with just checksum - you don't.
Plus, as I said, it is a bit confusing to calculate PSD csum once in the stack and then re-calculate in PMD.
Again - unnecessary slowdown.
So why not just have get_ipv4_psd_sum() and get_ipv4_psd_tso_sum() inside testpmd/csumonly.c and call them accordingly?

About potential future problem with NICs that implement TX checksum/segmentation offloads in a different manner - yeh that's true...
I think at the final point all that logic could be hidden inside some function at rte_ethdev level, something like:  rte_eth_dev_prep_tx(portid, mbuf[], num).
So,  based on mbuf TX offload flags and device type, it would do necessary modifications inside the packet.       
But that's future discussion, I suppose.
For now, I still think we need to keep pseudo checksum calculations out of PMD code.

Konstantin

-----Original Message-----
From: Olivier MATZ [mailto:olivier.matz at 6wind.com] 
Sent: Thursday, May 15, 2014 4:40 PM
To: Ananyev, Konstantin; dev at dpdk.org
Subject: Re: [dpdk-dev] [PATCH RFC 11/11] ixgbe/mbuf: add TSO support

Hi Konstantin,

On 05/15/2014 05:09 PM, Ananyev, Konstantin wrote:
> By design PMD not supposed to touch (or even look) into actual packet's data.

I agree on the principle, we should avoid that as much as possible.

> That is one of the reason why we put l2/l3/l4_len fields into the mbuf itself.
> Also it seems a bit strange to calculate one pseudo-header checksum in the upper layer and then
> Recalculate it again inside testpmd/
> So I wonder is it possible to move fix_tcp_phdr_cksum() logic into the upper layer
> (testpmd pkt_burst_checksum_forward())?

The reason why I did this is to define a generic PMD API for TSO:

Today, if you want to want to offload checksum calculation on tx, the
network stack has to calculate the pseudo header checksum. Even if
it could be calculated by the hardware, it's not a problem to
calculate it by software.

Now, because of the hardware, if you do TCP segmentation offload, you
have to calculate the pseudo-header checksum without including the
ip len. It seems to me that it adds some complexity because, depending
on the hardware configuration, the stack has to behave differently.

It seemed more logical to me that the network code that generates TCP
packets has to be identical whatever the driver options. Moreover, if
tomorrow we add another PMD that needs the pseudo-header with ip_len in
all case (TSO or not), we would have to do the same kind function than
fix_tcp_phdr_cksum().

So, I tried to define the API in order to simplify the work of the
network stack developper, even if it does not map the hardware
behavior. Nevertheless, I'm open to discuss it.

Regards,
Olivier



More information about the dev mailing list