<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-size: 11pt;">On 5/03/2022 9:05 PM, Ferruh Yigit wrote:</span><br>
<font size="2"><span style="font-size:11pt">> On 4/20/2022 2:46 PM, Walter Heymans wrote:<br>
<font size="2"><span style="font-size:11pt">> </span></font>> The 'max_rx_pktlen' value was previously read from hardware, which was<br>
<font size="2"><span style="font-size:11pt">> </span></font>> set by the running firmware. This caused confusion due to different<br>
<font size="2"><span style="font-size:11pt">> </span></font>> meanings of 'MAX_MTU'. This patch updates the 'max_rx_pktlen' to the<br>
<font size="2"><span style="font-size:11pt">> </span></font>> maximum value that the NFP NIC can support. The 'max_mtu' value that is<br>
<font size="2"><span style="font-size:11pt">> </span></font>> read from hardware, is assigned to the 'dev_info->max_mtu' variable.<br>
<font size="2"><span style="font-size:11pt">> </span></font>> <br>
<font size="2"><span style="font-size:11pt">> </span></font>> If more layer 2 metadata must be used, the firmware can be updated to<br>
<font size="2"><span style="font-size:11pt">> </span></font>> report a smaller 'max_mtu' value.<br>
<font size="2"><span style="font-size:11pt">> </span></font>> <br>
<font size="2"><span style="font-size:11pt">> </span></font>> The constant defined for NFP_FRAME_SIZE_MAX is derived for the maximum<br>
<font size="2"><span style="font-size:11pt">> </span></font>> supported buffer size of 10240, minus 136 bytes that is reserved by the<br>
<font size="2"><span style="font-size:11pt">> </span></font>> hardware and another 56 bytes reserved for expansion in firmware. This<br>
<font size="2"><span style="font-size:11pt">> </span></font>> results in a usable maximum packet length of 10048 bytes.<br>
<font size="2"><span style="font-size:11pt">> </span></font>> <br>
<font size="2"><span style="font-size:11pt">> </span></font>> Signed-off-by: Walter Heymans <walter.heymans@corigine.com><br>
> <font size="2"><span style="font-size:11pt">> </span></font>Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com><br>
<font size="2"><span style="font-size:11pt">> </span></font>> Reviewed-by: Louis Peens <louis.peens@corigine.com><br>
<font size="2"><span style="font-size:11pt">> </span></font>> Reviewed-by: Chaoyong He <chaoyong.he@corigine.com><br>
<font size="2"><span style="font-size:11pt">> </span></font>> Reviewed-by: Richard Donkin <richard.donkin@corigine.com><br>
<font size="2"><span style="font-size:11pt">> </span></font>> ---<br>
<font size="2"><span style="font-size:11pt">> </span></font>> drivers/net/nfp/nfp_common.c | 11 ++++++++++-<br>
<font size="2"><span style="font-size:11pt">> </span></font>> drivers/net/nfp/nfp_common.h | 3 +++<br>
<font size="2"><span style="font-size:11pt">> </span></font>> 2 files changed, 13 insertions(+), 1 deletion(-)<br>
<font size="2"><span style="font-size:11pt">> </span></font>> <br>
<font size="2"><span style="font-size:11pt">> </span></font>> diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c<br>
<font size="2"><span style="font-size:11pt">> </span></font>> index b26770dbfb..52fbda1a79 100644<br>
<font size="2"><span style="font-size:11pt">> </span></font>> --- a/drivers/net/nfp/nfp_common.c<br>
<font size="2"><span style="font-size:11pt">> </span></font>> +++ b/drivers/net/nfp/nfp_common.c<br>
<font size="2"><span style="font-size:11pt">> </span></font>> @@ -692,7 +692,16 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)<br>
<font size="2"><span style="font-size:11pt">> </span></font>> dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;<br>
<font size="2"><span style="font-size:11pt">> </span></font>> dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues;<br>
<font size="2"><span style="font-size:11pt">> </span></font>> dev_info->min_rx_bufsize = RTE_ETHER_MIN_MTU;<br>
<font size="2"><span style="font-size:11pt">> </span></font>> - dev_info->max_rx_pktlen = hw->max_mtu;<br>
<font size="2"><span style="font-size:11pt">> </span></font>> + /*<br>
<font size="2"><span style="font-size:11pt">> </span></font>> + * The maximum rx packet length (max_rx_pktlen) is set to the<br>
<font size="2"><span style="font-size:11pt">> </span></font>> + * maximum supported frame size that the NFP can handle. This<br>
<font size="2"><span style="font-size:11pt">> </span></font>> + * includes layer 2 headers, CRC and other metadata that can<br>
<font size="2"><span style="font-size:11pt">> </span></font>> + * optionally be used.<br>
<font size="2"><span style="font-size:11pt">> </span></font>> + * The maximum layer 3 MTU (max_mtu) is read from hardware,<br>
<font size="2"><span style="font-size:11pt">> </span></font>> + * which was set by the firmware loaded onto the card.<br>
<font size="2"><span style="font-size:11pt">> </span></font>> + */<br>
<font size="2"><span style="font-size:11pt">> </span></font>> + dev_info->max_rx_pktlen = NFP_FRAME_SIZE_MAX;<br>
<font size="2"><span style="font-size:11pt">> </span></font>> + dev_info->max_mtu = hw->max_mtu;<br>
<font size="2"><span style="font-size:11pt">> </span></font><br>
<font size="2"><span style="font-size:11pt">> </span></font>Hi Walter,<br>
<font size="2"><span style="font-size:11pt">> </span></font><br>
<font size="2"><span style="font-size:11pt">> </span></font>ethdev uses 'max_mtu' and 'max_rx_pktlen' to calculate the frame
<br>
<font size="2"><span style="font-size:11pt">> </span></font>overhead, like:<br>
<font size="2"><span style="font-size:11pt">> </span></font>'overhead_len = max_rx_pktlen - max_mtu;'<br>
<font size="2"><span style="font-size:11pt">> </span></font><br>
<font size="2"><span style="font-size:11pt">> </span></font>In above change 'max_rx_pktlen' is hardcoded but 'max_mtu' is 'hw'
<br>
<font size="2"><span style="font-size:11pt">> </span></font>depended, can you confirm 'hw->max_mtu' will always have the frame<br>
<font size="2"><span style="font-size:11pt">> </span></font>overhead as according above calculation?</span></font></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-size: 11pt;">Hi Ferruh,</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-size: 11pt;"></span><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-size: 11pt;">The 'max_rx_pktlen' is hardcoded to the maximum packet length that
<br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-size: 11pt;">the hardware can support. The 'hw->max_mtu' is read from hardware,</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-size: 11pt;">but it is a variable value, depending on the firmware running on the
</span><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-size: 11pt;">card. The firmware sets this value to account for the maximum overhead</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-size: 11pt;">required. To answer you question, yes, this value should always be</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-size: 11pt;">available.</span><br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Ferruh Yigit <ferruh.yigit@xilinx.com><br>
<b>Sent:</b> 03 May 2022 21:04<br>
<b>To:</b> Walter Heymans <walter.heymans@corigine.com>; dev@dpdk.org <dev@dpdk.org><br>
<b>Cc:</b> Niklas Soderlund <niklas.soderlund@corigine.com>; Louis Peens <louis.peens@corigine.com>; Chaoyong He <chaoyong.he@corigine.com>; Richard Donkin <richard.donkin@corigine.com><br>
<b>Subject:</b> Re: [PATCH v2] net/nfp: update how MAX MTU is read</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On 4/20/2022 2:46 PM, Walter Heymans wrote:<br>
> The 'max_rx_pktlen' value was previously read from hardware, which was<br>
> set by the running firmware. This caused confusion due to different<br>
> meanings of 'MAX_MTU'. This patch updates the 'max_rx_pktlen' to the<br>
> maximum value that the NFP NIC can support. The 'max_mtu' value that is<br>
> read from hardware, is assigned to the 'dev_info->max_mtu' variable.<br>
> <br>
> If more layer 2 metadata must be used, the firmware can be updated to<br>
> report a smaller 'max_mtu' value.<br>
> <br>
> The constant defined for NFP_FRAME_SIZE_MAX is derived for the maximum<br>
> supported buffer size of 10240, minus 136 bytes that is reserved by the<br>
> hardware and another 56 bytes reserved for expansion in firmware. This<br>
> results in a usable maximum packet length of 10048 bytes.<br>
> <br>
> Signed-off-by: Walter Heymans <walter.heymans@corigine.com><br>
> Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com><br>
> Reviewed-by: Louis Peens <louis.peens@corigine.com><br>
> Reviewed-by: Chaoyong He <chaoyong.he@corigine.com><br>
> Reviewed-by: Richard Donkin <richard.donkin@corigine.com><br>
> ---<br>
> drivers/net/nfp/nfp_common.c | 11 ++++++++++-<br>
> drivers/net/nfp/nfp_common.h | 3 +++<br>
> 2 files changed, 13 insertions(+), 1 deletion(-)<br>
> <br>
> diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c<br>
> index b26770dbfb..52fbda1a79 100644<br>
> --- a/drivers/net/nfp/nfp_common.c<br>
> +++ b/drivers/net/nfp/nfp_common.c<br>
> @@ -692,7 +692,16 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)<br>
> dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;<br>
> dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues;<br>
> dev_info->min_rx_bufsize = RTE_ETHER_MIN_MTU;<br>
> - dev_info->max_rx_pktlen = hw->max_mtu;<br>
> + /*<br>
> + * The maximum rx packet length (max_rx_pktlen) is set to the<br>
> + * maximum supported frame size that the NFP can handle. This<br>
> + * includes layer 2 headers, CRC and other metadata that can<br>
> + * optionally be used.<br>
> + * The maximum layer 3 MTU (max_mtu) is read from hardware,<br>
> + * which was set by the firmware loaded onto the card.<br>
> + */<br>
> + dev_info->max_rx_pktlen = NFP_FRAME_SIZE_MAX;<br>
> + dev_info->max_mtu = hw->max_mtu;<br>
<br>
Hi Walter,<br>
<br>
ethdev uses 'max_mtu' and 'max_rx_pktlen' to calculate the frame <br>
overhead, like:<br>
'overhead_len = max_rx_pktlen - max_mtu;'<br>
<br>
In above change 'max_rx_pktlen' is hardcoded but 'max_mtu' is 'hw' <br>
depended, can you confirm 'hw->max_mtu' will always have the frame <br>
overhead as according above calculation?<br>
<br>
<br>
> /* Next should change when PF support is implemented */<br>
> dev_info->max_mac_addrs = 1;<br>
> <br>
> diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h<br>
> index 8b35fa119c..8db5ec23f8 100644<br>
> --- a/drivers/net/nfp/nfp_common.h<br>
> +++ b/drivers/net/nfp/nfp_common.h<br>
> @@ -98,6 +98,9 @@ struct nfp_net_adapter;<br>
> /* Number of supported physical ports */<br>
> #define NFP_MAX_PHYPORTS 12<br>
> <br>
> +/* Maximum supported NFP frame size (MTU + layer 2 headers) */<br>
> +#define NFP_FRAME_SIZE_MAX 10048<br>
> +<br>
> #include <linux/types.h><br>
> #include <rte_io.h><br>
> <br>
<br>
</div>
</span></font></div>
</body>
</html>