All of lore.kernel.org
 help / color / mirror / Atom feed
* [dpdk-dev] [Question about 'rte_eth_tx_prepare']
@ 2021-02-08  6:29 Chengchang Tang
  2021-02-08  8:07 ` Thomas Monjalon
  0 siblings, 1 reply; 4+ messages in thread
From: Chengchang Tang @ 2021-02-08  6:29 UTC (permalink / raw)
  To: Thomas Monjalon, Ferruh Yigit; +Cc: dev, linuxarm

Hi, Thomas Monjalon and Ferruh Yigit and others.

I have some questions about 'rte_eth_tx_prepare'.

When I use TSO offload in bond mode, the checksum error occurs. It is
because the bond PMD does not implement 'tx_prepare'. So, it will not
invoke the 'tx_prepare' of each PMDs to do prepare for the PMDs. I am
not sure whether to add the 'tx_preapre' implementation for the bond
PMD or put the process of pseudo header in the apps.

And we are now designing the outer UDP cksum offload for HNS3 PMD.
I find that many PMDs process these pseudo headers in 'tx_prepare', but
does not process the pseudo header for outer UDP checksum offload.
Instead, it is processed in csum forward mode of testpmd. Does this mean
that the pseudo header should be completed by the apps and the apps does
not need to call 'tx_prepare' to avoid repeated processing? (it seems
not transplantable) If so, it seems that PMDs need to avoid doing this
in 'tx_prepare'.

Here are two questions:
1. What functions should be included in the 'tx_prepare' for PMDs?
2. Whether an app must invoke 'rte_eth_tx_prepare' or under which
conditions an app must invoke the 'rte_eth_tx_prepare'?

Thanks
Chengchang Tang


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [Question about 'rte_eth_tx_prepare']
  2021-02-08  6:29 [dpdk-dev] [Question about 'rte_eth_tx_prepare'] Chengchang Tang
@ 2021-02-08  8:07 ` Thomas Monjalon
  2021-02-08  8:40   ` Olivier Matz
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Monjalon @ 2021-02-08  8:07 UTC (permalink / raw)
  To: Chengchang Tang
  Cc: Ferruh Yigit, dev, linuxarm, olivier.matz, konstantin.ananyev

08/02/2021 07:29, Chengchang Tang:
> Hi, Thomas Monjalon and Ferruh Yigit and others.
> 
> I have some questions about 'rte_eth_tx_prepare'.
> 
> When I use TSO offload in bond mode, the checksum error occurs. It is
> because the bond PMD does not implement 'tx_prepare'. So, it will not
> invoke the 'tx_prepare' of each PMDs to do prepare for the PMDs. I am
> not sure whether to add the 'tx_preapre' implementation for the bond
> PMD or put the process of pseudo header in the apps.
> 
> And we are now designing the outer UDP cksum offload for HNS3 PMD.
> I find that many PMDs process these pseudo headers in 'tx_prepare', but
> does not process the pseudo header for outer UDP checksum offload.
> Instead, it is processed in csum forward mode of testpmd. Does this mean
> that the pseudo header should be completed by the apps and the apps does
> not need to call 'tx_prepare' to avoid repeated processing? (it seems
> not transplantable) If so, it seems that PMDs need to avoid doing this
> in 'tx_prepare'.
> 
> Here are two questions:
> 1. What functions should be included in the 'tx_prepare' for PMDs?
> 2. Whether an app must invoke 'rte_eth_tx_prepare' or under which
> conditions an app must invoke the 'rte_eth_tx_prepare'?

I would say by default the app should prepare the checksums,
except if there is an explicit offload request (DEV_TX_OFFLOAD_*).
I think the tx_prepare should only prepare the HW Tx offload
if the offload is not entirely done in HW.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [Question about 'rte_eth_tx_prepare']
  2021-02-08  8:07 ` Thomas Monjalon
@ 2021-02-08  8:40   ` Olivier Matz
  2021-02-09  1:13     ` Chengchang Tang
  0 siblings, 1 reply; 4+ messages in thread
From: Olivier Matz @ 2021-02-08  8:40 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Chengchang Tang, Ferruh Yigit, dev, linuxarm, konstantin.ananyev

Hi,

On Mon, Feb 08, 2021 at 09:07:39AM +0100, Thomas Monjalon wrote:
> 08/02/2021 07:29, Chengchang Tang:
> > Hi, Thomas Monjalon and Ferruh Yigit and others.
> > 
> > I have some questions about 'rte_eth_tx_prepare'.
> > 
> > When I use TSO offload in bond mode, the checksum error occurs. It is
> > because the bond PMD does not implement 'tx_prepare'. So, it will not
> > invoke the 'tx_prepare' of each PMDs to do prepare for the PMDs. I am
> > not sure whether to add the 'tx_preapre' implementation for the bond
> > PMD or put the process of pseudo header in the apps.
> > 
> > And we are now designing the outer UDP cksum offload for HNS3 PMD.
> > I find that many PMDs process these pseudo headers in 'tx_prepare', but
> > does not process the pseudo header for outer UDP checksum offload.
> > Instead, it is processed in csum forward mode of testpmd. Does this mean
> > that the pseudo header should be completed by the apps and the apps does
> > not need to call 'tx_prepare' to avoid repeated processing? (it seems
> > not transplantable) If so, it seems that PMDs need to avoid doing this
> > in 'tx_prepare'.
> > 
> > Here are two questions:
> > 1. What functions should be included in the 'tx_prepare' for PMDs?
> > 2. Whether an app must invoke 'rte_eth_tx_prepare' or under which
> > conditions an app must invoke the 'rte_eth_tx_prepare'?
> 
> I would say by default the app should prepare the checksums,
> except if there is an explicit offload request (DEV_TX_OFFLOAD_*).
> I think the tx_prepare should only prepare the HW Tx offload
> if the offload is not entirely done in HW.

On our side, we call tx_prepare() on a tx bulk if:

1/ a Tx offload is enabled on the port (DEV_TX_OFFLOAD_*)
2/ at least one mbuf in the bulk has an offload flag among
   PKT_TX_OFFLOAD_MASK

The purpose of tx_prepare() is to check that offload can be done in hw,
and to prepare the packet data for the hw. For instance, niantics NICs
require that the L4 checksum in the packet is set to the pseudo-header
checksum.

This could have be done in the tx() function, but it is a separated
function for 2 reasons:
- the application does not need to call it if it does not do hw tx offload
- the tx_prepare() function may modify packet data, which should not be the
  case for tx(). In a pipeline model, these 2 functions may be called on
  different cores.

In my opinion, the tx_prepare() function should deal with outer checksums
preparation as well.

Olivier

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [Question about 'rte_eth_tx_prepare']
  2021-02-08  8:40   ` Olivier Matz
@ 2021-02-09  1:13     ` Chengchang Tang
  0 siblings, 0 replies; 4+ messages in thread
From: Chengchang Tang @ 2021-02-09  1:13 UTC (permalink / raw)
  To: Olivier Matz, Thomas Monjalon
  Cc: Ferruh Yigit, dev, linuxarm, konstantin.ananyev

On 2021/2/8 16:40, Olivier Matz wrote:
> Hi,
> 
> On Mon, Feb 08, 2021 at 09:07:39AM +0100, Thomas Monjalon wrote:
>> 08/02/2021 07:29, Chengchang Tang:
>>> Hi, Thomas Monjalon and Ferruh Yigit and others.
>>>
>>> Here are two questions:
>>> 1. What functions should be included in the 'tx_prepare' for PMDs?
>>> 2. Whether an app must invoke 'rte_eth_tx_prepare' or under which
>>> conditions an app must invoke the 'rte_eth_tx_prepare'?
>>
>> I would say by default the app should prepare the checksums,
>> except if there is an explicit offload request (DEV_TX_OFFLOAD_*).
>> I think the tx_prepare should only prepare the HW Tx offload
>> if the offload is not entirely done in HW.
> 
> On our side, we call tx_prepare() on a tx bulk if:
> 
> 1/ a Tx offload is enabled on the port (DEV_TX_OFFLOAD_*)
> 2/ at least one mbuf in the bulk has an offload flag among
>    PKT_TX_OFFLOAD_MASK
> 
> The purpose of tx_prepare() is to check that offload can be done in hw,
> and to prepare the packet data for the hw. For instance, niantics NICs
> require that the L4 checksum in the packet is set to the pseudo-header
> checksum.
> 
> This could have be done in the tx() function, but it is a separated
> function for 2 reasons:
> - the application does not need to call it if it does not do hw tx offload
> - the tx_prepare() function may modify packet data, which should not be the
>   case for tx(). In a pipeline model, these 2 functions may be called on
>   different cores.
> 
> In my opinion, the tx_prepare() function should deal with outer checksums
> preparation as well.
> 
> Olivier
> 
> .

Thank you, Thomas and Olivier. It's really helpful.

Chengchang



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-09  1:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-08  6:29 [dpdk-dev] [Question about 'rte_eth_tx_prepare'] Chengchang Tang
2021-02-08  8:07 ` Thomas Monjalon
2021-02-08  8:40   ` Olivier Matz
2021-02-09  1:13     ` Chengchang Tang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.