On 10/12/2021 8:03 AM, Matan Azrad wrote:
Hi Ferruh

From: Ferruh Yigit
On 10/10/2021 7:30 AM, Matan Azrad wrote:

Hi Ferruh

From: Ferruh Yigit
There is a confusion on setting max Rx packet length, this patch aims
to clarify it.

'rte_eth_dev_configure()' API accepts max Rx packet size via
'uint32_t max_rx_pkt_len' field of the config struct 'struct
rte_eth_conf'.

Also 'rte_eth_dev_set_mtu()' API can be used to set the MTU, and
result stored into '(struct rte_eth_dev)->data->mtu'.

These two APIs are related but they work in a disconnected way, they
store the set values in different variables which makes hard to
figure out which one to use, also having two different method for a
related functionality is confusing for the users.

Other issues causing confusion is:
* maximum transmission unit (MTU) is payload of the Ethernet frame.
And
    'max_rx_pkt_len' is the size of the Ethernet frame. Difference is
    Ethernet frame overhead, and this overhead may be different from
    device to device based on what device supports, like VLAN and QinQ.
* 'max_rx_pkt_len' is only valid when application requested jumbo frame,
    which adds additional confusion and some APIs and PMDs already
    discards this documented behavior.
* For the jumbo frame enabled case, 'max_rx_pkt_len' is an mandatory
    field, this adds configuration complexity for application.

As solution, both APIs gets MTU as parameter, and both saves the
result in same variable '(struct rte_eth_dev)->data->mtu'. For this
'max_rx_pkt_len' updated as 'mtu', and it is always valid independent
from jumbo frame.

For 'rte_eth_dev_configure()', 'dev->data->dev_conf.rxmode.mtu' is
user request and it should be used only within configure function and
result should be stored to '(struct rte_eth_dev)->data->mtu'. After
that point both application and PMD uses MTU from this variable.

When application doesn't provide an MTU during
'rte_eth_dev_configure()'
default 'RTE_ETHER_MTU' value is used.

Additional clarification done on scattered Rx configuration, in
relation to MTU and Rx buffer size.
MTU is used to configure the device for physical Rx/Tx size
limitation, Rx buffer is where to store Rx packets, many PMDs use
mbuf data buffer size as Rx buffer size.
PMDs compare MTU against Rx buffer size to decide enabling scattered
Rx or not. If scattered Rx is not supported by device, MTU bigger
than Rx buffer size should fail.

Should it be compared also against max_lro_pkt_size for the SCATTER
enabling by the PMD?


I kept the LRO related code same, the Rx packet length change patch already
become complex, LRO related changes can be done later instead of making
this set more confusing.
It would be great if you and Dekel can work on it as you introduced the
'max_lro_pkt_size' in ethdev.

'max_lro_pkt_size' is not like MTU (the LRO is done after the PHY received the 
packet in MTU size.),
I just asked regarding the SCATTER comparison for this case; I think it should 
be the same comparison as MTU.

What do you think about enabling SCATTER by the API instead of making
the comparison in each PMD?


Not sure if we can do that, as far as I can see there is no enforcement on the
Rx buffer size but PMDs select it.

Yes, it looks like currently, it is the PMD decision.
And we can take scattering later(we all the time say that 😊).


These details being not clear cause drivers implement slightly different,
which makes later hard to decide which one is correct design and update those
various implementations.
'max_rx_pkt_len' was one of those nuisances that took some time to address.

For the others, agree to address them, just not in this set, what you have
mentioned is:
1) 'max_lro_pkt_size'
2) Scattered Rx configuration

Can you please make a patch to update deprecation notice for them? At least
documenting them prevents us to forget (or postpone) them.
Later we can find an owner, start a discussion thread and fix them for v22.11.
Does it sound reasonable?

Acked-by: Matan Azrad <ma...@nvidia.com>

Maybe, it is good to report the device's max Rx buffer length to let the 
application have more information to configure the most efficient mbuf size and 
whether it may get scattered packets or not.
Also, it will help do all the validations in ethdev layer.


<snip, same discussion>


Reply via email to