[dpdk-dev] [PATCH v6 1/6] ethdev: fix max Rx packet length

Xu, Rosen rosen.xu at intel.com
Wed Oct 13 09:08:10 CEST 2021


Hi,

> -----Original Message-----
> From: Yigit, Ferruh <ferruh.yigit at intel.com>
> Sent: Tuesday, October 12, 2021 7:54
> To: Jerin Jacob <jerinj at marvell.com>; Li, Xiaoyun <xiaoyun.li at intel.com>;
> Chas Williams <chas3 at att.com>; Min Hu (Connor) <humin29 at huawei.com>;
> Hemant Agrawal <hemant.agrawal at nxp.com>; Sachin Saxena
> <sachin.saxena at oss.nxp.com>; Zhang, Qi Z <qi.z.zhang at intel.com>; Wang,
> Xiao W <xiao.w.wang at intel.com>; Matan Azrad <matan at nvidia.com>;
> Viacheslav Ovsiienko <viacheslavo at nvidia.com>; Harman Kalra
> <hkalra at marvell.com>; Maciej Czekaj <mczekaj at marvell.com>; Ray Kinsella
> <mdr at ashroe.eu>; Iremonger, Bernard <bernard.iremonger at intel.com>;
> Ananyev, Konstantin <konstantin.ananyev at intel.com>; Kiran Kumar K
> <kirankumark at marvell.com>; Nithin Dabilpuram
> <ndabilpuram at marvell.com>; Hunt, David <david.hunt at intel.com>;
> Mcnamara, John <john.mcnamara at intel.com>; Richardson, Bruce
> <bruce.richardson at intel.com>; Igor Russkikh <irusskikh at marvell.com>;
> Steven Webster <steven.webster at windriver.com>; Peters, Matt
> <matt.peters at windriver.com>; Somalapuram Amaranath
> <asomalap at amd.com>; Rasesh Mody <rmody at marvell.com>; Shahed
> Shaikh <shshaikh at marvell.com>; Ajit Khaparde
> <ajit.khaparde at broadcom.com>; Somnath Kotur
> <somnath.kotur at broadcom.com>; Sunil Kumar Kori <skori at marvell.com>;
> Satha Rao <skoteshwar at marvell.com>; Rahul Lakkireddy
> <rahul.lakkireddy at chelsio.com>; Wang, Haiyue <haiyue.wang at intel.com>;
> Marcin Wojtas <mw at semihalf.com>; Michal Krawczyk <mk at semihalf.com>;
> Shai Brandes <shaibran at amazon.com>; Evgeny Schemeilin
> <evgenys at amazon.com>; Igor Chauskin <igorch at amazon.com>; Gagandeep
> Singh <g.singh at nxp.com>; Daley, John <johndale at cisco.com>; Hyong Youb
> Kim <hyonkim at cisco.com>; Ziyang Xuan <xuanziyang2 at huawei.com>;
> Xiaoyun Wang <cloud.wangxiaoyun at huawei.com>; Guoyang Zhou
> <zhouguoyang at huawei.com>; Yisen Zhuang <yisen.zhuang at huawei.com>;
> Lijun Ou <oulijun at huawei.com>; Xing, Beilei <beilei.xing at intel.com>; Wu,
> Jingjing <jingjing.wu at intel.com>; Yang, Qiming <qiming.yang at intel.com>;
> Andrew Boyer <aboyer at pensando.io>; Xu, Rosen <rosen.xu at intel.com>;
> Shijith Thotton <sthotton at marvell.com>; Srisivasubramanian Srinivasan
> <srinivasan at marvell.com>; Zyta Szpak <zr at semihalf.com>; Liron Himi
> <lironh at marvell.com>; Heinrich Kuhn <heinrich.kuhn at corigine.com>;
> Devendra Singh Rawat <dsinghrawat at marvell.com>; Andrew Rybchenko
> <andrew.rybchenko at oktetlabs.ru>; Wiles, Keith <keith.wiles at intel.com>;
> Jiawen Wu <jiawenwu at trustnetic.com>; Jian Wang
> <jianwang at trustnetic.com>; Maxime Coquelin
> <maxime.coquelin at redhat.com>; Xia, Chenbo <chenbo.xia at intel.com>;
> Chautru, Nicolas <nicolas.chautru at intel.com>; Van Haaren, Harry
> <harry.van.haaren at intel.com>; Dumitrescu, Cristian
> <cristian.dumitrescu at intel.com>; Nicolau, Radu <radu.nicolau at intel.com>;
> Akhil Goyal <gakhil at marvell.com>; Kantecki, Tomasz
> <tomasz.kantecki at intel.com>; Doherty, Declan <declan.doherty at intel.com>;
> Pavan Nikhilesh <pbhagavatula at marvell.com>; Rybalchenko, Kirill
> <kirill.rybalchenko at intel.com>; Singh, Jasvinder
> <jasvinder.singh at intel.com>; Thomas Monjalon <thomas at monjalon.net>
> Cc: Yigit, Ferruh <ferruh.yigit at intel.com>; dev at dpdk.org; Huisong Li
> <lihuisong at huawei.com>
> Subject: [PATCH v6 1/6] 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 at intel.com>
> Acked-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
> Acked-by: Somnath Kotur <somnath.kotur at broadcom.com>
> Acked-by: Huisong Li <lihuisong at huawei.com>
> ---
> Cc: Min Hu (Connor) <humin29 at huawei.com>
> 
> v2:
> * Converted to explicit checks for zero/non-zero
> * fixed hns3 checks
> * fixed some sample app rxmode.mtu value
> * fixed some sample app max-pkt-len argument and updated doc for it
> 
> v3:
> * rebased
> 
> v4:
> * fix typos in commit logs
> 
> v5:
> * fix testpmd '--max-pkt-len=###' parameter for DTS jumbo frame test
> 
> v6:
> * uint32_t type used in 'eth_dev_get_overhead_len()' helper function
> ---

Acked-by: Rosen Xu <rosen.xu at intel.com>


More information about the dev mailing list