numam-dpdk/lib
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
..
acl lib: remove C++ include guard from private headers 2021-09-22 22:00:17 +02:00
bbdev bbdev: add device info for data endianness 2021-10-18 20:11:16 +02:00
bitratestats bitrate: promote free function to stable 2021-10-01 15:31:47 +02:00
bpf lib: remove C++ include guard from private headers 2021-09-22 22:00:17 +02:00
cfgfile version: 21.11-rc0 2021-08-17 08:37:52 +02:00
cmdline version: 21.11-rc0 2021-08-17 08:37:52 +02:00
compressdev log: register with standardized names 2021-05-11 15:17:55 +02:00
cryptodev cryptodev: fix multi-segment raw vector processing 2021-10-17 19:32:13 +02:00
distributor lib: remove C++ include guard from private headers 2021-09-22 22:00:17 +02:00
dmadev dmadev: add flag for error handling support 2021-10-18 11:19:27 +02:00
eal mcslock: use WFE in lock for aarch64 2021-10-20 08:22:41 +02:00
efd efd: allow more CPU sockets in table creation 2021-10-01 16:33:20 +02:00
ethdev ethdev: fix max Rx packet length 2021-10-18 19:20:20 +02:00
eventdev ethdev: hide internal structures 2021-10-13 22:14:59 +02:00
fib sort symbol maps 2021-10-05 17:03:37 +02:00
flow_classify flow_classify: fix leaking rules on delete 2021-06-24 15:34:45 +02:00
graph eal: save error in string copy 2021-07-05 15:11:30 +02:00
gro net: rename Ethernet header fields 2021-10-08 14:58:11 +02:00
gso version: 21.11-rc0 2021-08-17 08:37:52 +02:00
hash eal: remove sys/queue.h from public headers 2021-10-01 13:09:43 +02:00
ip_frag ip_frag: fix fragmenting IPv4 fragment 2021-10-14 08:52:34 +02:00
ipsec cryptodev: rename field in vector struct 2021-10-17 19:31:15 +02:00
jobstats version: 21.11-rc0 2021-08-17 08:37:52 +02:00
kni version: 21.11-rc0 2021-08-17 08:37:52 +02:00
kvargs kvargs: fix comments style 2021-09-30 17:38:13 +02:00
latencystats version: 21.11-rc0 2021-08-17 08:37:52 +02:00
lpm version: 21.11-rc0 2021-08-17 08:37:52 +02:00
mbuf mbuf: add IPsec ESP tunnel type 2021-10-17 14:07:03 +02:00
member version: 21.11-rc0 2021-08-17 08:37:52 +02:00
mempool mempool: accept user flags only 2021-10-20 10:03:55 +02:00
meter version: 21.11-rc0 2021-08-17 08:37:52 +02:00
metrics ethdev: hide internal structures 2021-10-13 22:14:59 +02:00
net net: fix aliasing in checksum computation 2021-10-18 18:15:58 +02:00
node lib: remove C++ include guard from private headers 2021-09-22 22:00:17 +02:00
pci eal: remove sys/queue.h from public headers 2021-10-01 13:09:43 +02:00
pdump mempool: add namespace to flags 2021-10-20 10:00:16 +02:00
pipeline net: rename Ethernet header fields 2021-10-08 14:58:11 +02:00
port version: 21.11-rc0 2021-08-17 08:37:52 +02:00
power lib: remove C++ include guard from private headers 2021-09-22 22:00:17 +02:00
rawdev version: 21.11-rc0 2021-08-17 08:37:52 +02:00
rcu lib: remove C++ include guard from private headers 2021-09-22 22:00:17 +02:00
regexdev lib: remove librte_ prefix from directory names 2021-04-21 14:04:09 +02:00
reorder version: 21.11-rc0 2021-08-17 08:37:52 +02:00
rib sort symbol maps 2021-10-05 17:03:37 +02:00
ring ring: promote new sync modes and peek to stable 2021-10-05 10:09:15 +02:00
sched sched: get 64-bit greatest common divisor 2021-09-27 17:24:16 +02:00
security security: add reserved bit fields 2021-10-18 20:12:19 +02:00
stack stack: remove unneeded atomic header include 2021-10-19 17:15:10 +02:00
table eal: remove sys/queue.h from public headers 2021-10-01 13:09:43 +02:00
telemetry telemetry: fix socket path conflicts for in-memory mode 2021-10-14 20:31:10 +02:00
timer version: 21.11-rc0 2021-08-17 08:37:52 +02:00
vhost mempool: add namespace to flags 2021-10-20 10:00:16 +02:00
meson.build dmadev: introduce DMA device library 2021-10-17 20:49:57 +02:00