[PATCH v2 01/10] net/ngbe: fix Rx buffer size in configure register

Ferruh Yigit ferruh.yigit at amd.com
Tue Feb 14 10:55:18 CET 2023


On 2/14/2023 8:15 AM, Jiawen Wu wrote:
> On Thursday, February 9, 2023 5:00 PM, Jiawen Wu wrote:
>> On Wednesday, February 8, 2023 6:28 PM, Ferruh Yigit wrote:
>>> On 2/2/2023 9:21 AM, Jiawen Wu wrote:
>>>> When buffer size is less than 1K, round down makes it 0, which is an
>>>> error value.
>>>>
>>>> Fixes: 62fc35e63d0e ("net/ngbe: support Rx queue start/stop")
>>>> Cc: stable at dpdk.org
>>>>
>>>> Signed-off-by: Jiawen Wu <jiawenwu at trustnetic.com>
>>>> ---
>>>>  drivers/net/ngbe/ngbe_rxtx.c | 5 ++++-
>>>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/net/ngbe/ngbe_rxtx.c
>>>> b/drivers/net/ngbe/ngbe_rxtx.c index 9fd24fa444..9a646cb6a7 100644
>>>> --- a/drivers/net/ngbe/ngbe_rxtx.c
>>>> +++ b/drivers/net/ngbe/ngbe_rxtx.c
>>>> @@ -2944,7 +2944,10 @@ ngbe_dev_rx_init(struct rte_eth_dev *dev)
>>>>  		 */
>>>>  		buf_size = (uint16_t)(rte_pktmbuf_data_room_size(rxq->mb_pool) -
>>>>  			RTE_PKTMBUF_HEADROOM);
>>>> -		buf_size = ROUND_DOWN(buf_size, 0x1 << 10);
>>>> +		if (buf_size < 1024)
>>>> +			buf_size = ROUND_UP(buf_size, 0x1 << 10);
>>>
>>> Back to original problem statement in previous version, can't this
>>> cause HW to receive packets exceeding the buffer size?
>>>
>>> If HW accepts buffer size in multiple of 1K, does this mean any buffer
>>> size less than 1K is an error condition for this HW?
>>>
>>
>> After rechecking the code, the minimum buffer size is limited to 1K by the
>> txgbe/ngbe [1].
>> I think v1 patch for txgbe is enough.
>>
>> [1]
>> static int
>> txgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) {
>> 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
>> 	struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
>>
>> 	dev_info->min_rx_bufsize = 1024;
>>
>>
>>>> +		else
>>>> +			buf_size = ROUND_DOWN(buf_size, 0x1 << 10);
>>>>  		srrctl |= NGBE_RXCFG_PKTLEN(buf_size);
>>>>
>>>>  		wr32(hw, NGBE_RXCFG(rxq->reg_idx), srrctl);
>>>
>>>
>>
> 
> Hi Ferruh,
> 
> Is my proposal feasible or do I need to send v3 patch for it?
> 
> 

Sorry Jiawen, I missed your response.

Yes, you are right, 'dev_info->min_rx_bufsize' prevents user to set
buffer size less than 1K, so change in V1 is good.

There were some other changes too, instead of getting this patch from
v1, can you please send a new version with latest updates?


More information about the stable mailing list