numam-dpdk/lib/ethdev/rte_ethdev_trace.h
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

96 lines
2.7 KiB
C

/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(C) 2020 Marvell International Ltd.
*/
#ifndef _RTE_ETHDEV_TRACE_H_
#define _RTE_ETHDEV_TRACE_H_
/**
* @file
*
* API for ethdev trace support
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <rte_trace_point.h>
#include "rte_ethdev.h"
RTE_TRACE_POINT(
rte_ethdev_trace_configure,
RTE_TRACE_POINT_ARGS(uint16_t port_id, uint16_t nb_rx_q,
uint16_t nb_tx_q, const struct rte_eth_conf *dev_conf, int rc),
rte_trace_point_emit_u16(port_id);
rte_trace_point_emit_u16(nb_rx_q);
rte_trace_point_emit_u16(nb_tx_q);
rte_trace_point_emit_u32(dev_conf->link_speeds);
rte_trace_point_emit_u32(dev_conf->rxmode.mq_mode);
rte_trace_point_emit_u32(dev_conf->rxmode.mtu);
rte_trace_point_emit_u64(dev_conf->rxmode.offloads);
rte_trace_point_emit_u32(dev_conf->txmode.mq_mode);
rte_trace_point_emit_u64(dev_conf->txmode.offloads);
rte_trace_point_emit_u32(dev_conf->lpbk_mode);
rte_trace_point_emit_int(rc);
)
RTE_TRACE_POINT(
rte_ethdev_trace_rxq_setup,
RTE_TRACE_POINT_ARGS(uint16_t port_id, uint16_t rx_queue_id,
uint16_t nb_rx_desc, void *mp,
const struct rte_eth_rxconf *rx_conf, int rc),
rte_trace_point_emit_u16(port_id);
rte_trace_point_emit_u16(rx_queue_id);
rte_trace_point_emit_u16(nb_rx_desc);
rte_trace_point_emit_ptr(mp);
rte_trace_point_emit_u8(rx_conf->rx_thresh.pthresh);
rte_trace_point_emit_u8(rx_conf->rx_thresh.hthresh);
rte_trace_point_emit_u8(rx_conf->rx_thresh.wthresh);
rte_trace_point_emit_u8(rx_conf->rx_drop_en);
rte_trace_point_emit_u8(rx_conf->rx_deferred_start);
rte_trace_point_emit_u64(rx_conf->offloads);
rte_trace_point_emit_int(rc);
)
RTE_TRACE_POINT(
rte_ethdev_trace_txq_setup,
RTE_TRACE_POINT_ARGS(uint16_t port_id, uint16_t tx_queue_id,
uint16_t nb_tx_desc, const struct rte_eth_txconf *tx_conf),
rte_trace_point_emit_u16(port_id);
rte_trace_point_emit_u16(tx_queue_id);
rte_trace_point_emit_u16(nb_tx_desc);
rte_trace_point_emit_u8(tx_conf->tx_thresh.pthresh);
rte_trace_point_emit_u8(tx_conf->tx_thresh.hthresh);
rte_trace_point_emit_u8(tx_conf->tx_thresh.wthresh);
rte_trace_point_emit_u8(tx_conf->tx_deferred_start);
rte_trace_point_emit_u16(tx_conf->tx_free_thresh);
rte_trace_point_emit_u64(tx_conf->offloads);
)
RTE_TRACE_POINT(
rte_ethdev_trace_start,
RTE_TRACE_POINT_ARGS(uint16_t port_id),
rte_trace_point_emit_u16(port_id);
)
RTE_TRACE_POINT(
rte_ethdev_trace_stop,
RTE_TRACE_POINT_ARGS(uint16_t port_id, int ret),
rte_trace_point_emit_u16(port_id);
rte_trace_point_emit_int(ret);
)
RTE_TRACE_POINT(
rte_ethdev_trace_close,
RTE_TRACE_POINT_ARGS(uint16_t port_id),
rte_trace_point_emit_u16(port_id);
)
#ifdef __cplusplus
}
#endif
#endif /* _RTE_ETHDEV_TRACE_H_ */