numam-dpdk/examples/ip_pipeline
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
..
examples examples: use separate crypto session mempools 2019-01-10 16:57:22 +01:00
action.c examples/ip_pipeline: support packet decap action 2018-10-12 19:33:36 +02:00
action.h examples/ip_pipeline: support symmetric crypto action 2018-10-12 19:33:15 +02:00
cli.c net: add macro to extract MAC address bytes 2021-09-07 19:08:05 +02:00
cli.h
common.h
conn.c mk: build with _GNU_SOURCE defined by default 2018-10-22 11:28:27 +02:00
conn.h
cryptodev.c cryptodev: rename function to check device validity 2021-09-08 09:21:10 +02:00
cryptodev.h examples: use separate crypto session mempools 2019-01-10 16:57:22 +01:00
kni.c build: replace use of old build macros 2020-10-19 22:15:44 +02:00
kni.h build: replace use of old build macros 2020-10-19 22:15:44 +02:00
link.c ethdev: fix max Rx packet length 2021-10-18 19:20:20 +02:00
link.h examples/ip_pipeline: add link command 2018-07-12 13:48:29 +02:00
main.c eal: rename lcore master and slave 2020-10-20 13:17:08 +02:00
Makefile examples: fix pkg-config override 2021-05-05 22:20:24 +02:00
mempool.c
mempool.h
meson.build examples: reduce indentation in build files 2021-04-21 14:04:09 +02:00
parser.c examples/ip_pipeline: use POSIX network address conversion 2020-10-23 11:01:51 +02:00
parser.h net: add rte prefix to ether structures 2019-05-24 13:34:45 +02:00
pipeline.c build: replace use of old build macros 2020-10-19 22:15:44 +02:00
pipeline.h cryptodev: make xform key pointer constant 2019-07-19 14:15:21 +02:00
swq.c
swq.h
tap.c replace snprintf with strlcpy without adding extra include 2019-04-04 22:45:54 +02:00
tap.h
thread.c eal: rename lcore master and slave 2020-10-20 13:17:08 +02:00
thread.h
tmgr.c examples/ip_pipeline: update subport rate dynamically 2020-10-15 02:14:09 +02:00
tmgr.h examples/ip_pipeline: update subport rate dynamically 2020-10-15 02:14:09 +02:00