numam-dpdk/drivers/net/ionic
Ferruh Yigit 1bb4a528c4 ethdev: fix max Rx packet length
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.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Somnath Kotur <somnath.kotur@broadcom.com>
Acked-by: Huisong Li <lihuisong@huawei.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
Acked-by: Hyong Youb Kim <hyonkim@cisco.com>
2021-10-18 19:20:20 +02:00
..
ionic_dev.c net/ionic: break up queue post function 2021-02-25 16:58:56 +01:00
ionic_dev.h net/ionic: break up queue post function 2021-02-25 16:58:56 +01:00
ionic_ethdev.c ethdev: fix max Rx packet length 2021-10-18 19:20:20 +02:00
ionic_ethdev.h net/ionic: improve link state handling 2021-01-13 18:51:58 +01:00
ionic_if.h net/ionic: update interface file 2021-01-08 16:03:04 +01:00
ionic_lif.c ethdev: change queue release callback 2021-10-06 19:16:03 +02:00
ionic_lif.h net/ionic: store Tx fragment limit in queue 2021-02-25 16:58:56 +01:00
ionic_logs.h net/ionic: add log 2020-01-20 18:02:17 +01:00
ionic_mac_api.c net/ionic: use standard boolean type 2020-03-18 10:21:42 +01:00
ionic_mac_api.h net/ionic: register and initialize adapter 2020-01-20 18:02:17 +01:00
ionic_main.c drivers: replace page size definitions with function 2021-03-23 08:41:05 +01:00
ionic_osdep.h drivers: replace page size definitions with function 2021-03-23 08:41:05 +01:00
ionic_regs.h net/ionic: remove some unused fields 2021-01-08 16:03:04 +01:00
ionic_rx_filter.c net/ionic: consolidate adminq code 2021-02-25 16:58:56 +01:00
ionic_rx_filter.h net/ionic: remove unused filter delete function 2021-02-25 16:58:56 +01:00
ionic_rxtx.c ethdev: fix max Rx packet length 2021-10-18 19:20:20 +02:00
ionic_rxtx.h ethdev: change queue release callback 2021-10-06 19:16:03 +02:00
ionic.h net/ionic: consolidate adminq code 2021-02-25 16:58:56 +01:00
meson.build drivers: change indentation in build files 2021-04-21 14:04:09 +02:00
version.map version: 21.11-rc0 2021-08-17 08:37:52 +02:00