[PATCH v3 0/3] introduce maximum Rx buffer size

Stephen Hemminger stephen at networkplumber.org
Mon Oct 30 19:48:50 CET 2023


On Mon, 30 Oct 2023 09:25:34 +0800
"lihuisong (C)" <lihuisong at huawei.com> wrote:

> >  
> >> The "min_rx_bufsize" in struct rte_eth_dev_info stands for the
> >> minimum Rx buffer size supported by hardware. Actually, some
> >> engines also have the maximum Rx buffer specification, like, hns3.
> >>
> >> If mbuf data room size in mempool is greater then the maximum Rx
> >> buffer size supported by HW, the data size application used in
> >> each mbuf is just as much as the maximum Rx buffer size supported
> >> by HW instead of the whole data room size.
> >>
> >> So introduce maximum Rx buffer size which is not enforced just to
> >> report user to avoid memory waste.  
> > I am not convinced this is really necessary.
> > Your device will use up to 4K of buffer size, not sure why an
> > application would want to use much larger than that because it
> > would be wasting a lot of buffer space (most packets are smaller)
> > anyway.
> >
> > The only case where it might be useful is if application is using
> > jumbo frames (9K) and the application was not able to handle multi
> > segment packets.  
> Yeah, it is useful if user want a large packet (like, 6K) is in a
> mbuf. But, in current layer, user don't know what the maximum buffer
> size per descriptor supported by HW is.
> > Not handling multi segment packets in SW is just programmer
> > laziness.  
> User do decide their implement based on their cases in project.
> May it be a point for this that user don't want to do memcpy for
> multi segment packets and just use the first mbuf memory.
> 
> Now that there is the "min_rx_bufsize" to report in ethdev layer.
> Anyway, DPDK is indeed the lack of the way to report the maximum Rx 
> buffer size per hw descriptor.

My concern is that you are creating a special case for one driver.
And other drivers probably have similar upper bound.

Could the warning be better handled in the driver specific configure
routine rather than updating the ethdev API.  Something like:

   if (multi-segment-flag off) {
       if (mtu > driver max buf size) {
               return error;
   } else {
       if (mtu > driver max buf size && 
           mtu < mempool_buf_size(mp)) {
         warn that packet maybe segmented ??
       }
   }



More information about the dev mailing list