[PATCH v2] examples/l3fwd: support setting the data size of mbuf
Stephen Hemminger
stephen at networkplumber.org
Mon Oct 21 19:07:06 CEST 2024
On Mon, 21 Oct 2024 02:00:55 +0000
Chaoyong He <chaoyong.he at corigine.com> wrote:
> > On Fri, 18 Oct 2024 05:50:20 +0000
> > Chaoyong He <chaoyong.he at corigine.com> wrote:
> >
> > > > On Fri, 18 Oct 2024 03:21:28 +0000
> > > > Chaoyong He <chaoyong.he at corigine.com> wrote:
> > > >
> > > > > > RTE_PKTMBUF_HEADROOM); }
> > > > > > > +
> > > > > >
> > > > > > Not sure why this is needed? What is the problem with the original
> > code?
> > > > > > Are you trying to force packets to be segmented?
> > > > >
> > > > > Actually, we are trying to force packets *not* segmented by making
> > > > > the
> > > > mbuf size large enough to hold the packets.
> > > > >
> > > > > In our user case, we start l3fwd app with parameter '--max-pkt-len
> > > > > 4000',
> > > > and obviously the original logic with RTE_MBUF_DEFAULT_DATAROOM
> > mbuf
> > > > size will cause the packets to be segmented.
> > > > > Which is not what we want, so we add this new '--mbuf-size=4096'
> > > > parameter, the mbuf size will large enough to hold even the largest packet.
> > > > >
> > > > > Do you think this make sense?
> > > >
> > > > Maybe query the driver, and use the max_rx_pkt_len as input to
> > > > deciding the right mbuf size.
> > >
> > > Sorry, I am not quite understanding here.
> > > I can't find 'max_rx_pkt_len' in l3fwd app, instead it's exist testpmd app.
> > > Could you please explain a little more about the advice?
> >
> > In rte_eth_dev_info, I meant the field max_rx_bufsize and there is also
> > max_rx_pktlen.
> >
> > >
> > > > If max-pkt-len was 4000 and driver can only take 2K buffers, then
> > > > use 2K mbuf size.
> > > > If max-pkt-len was 1500 then use mtu + headroom and round up
>
> Oh, I understand what you mean now, thanks for the clarification.
> But the solution you suppose is not flexible enough, thus can't satisfy our needs.
>
> Follow your example and consider this situation:
> If max-pkt-len was 4000 and driver can only take 2K buffers, then
> use 2K mbuf size.
>
> But we want to measure the performance when the mbuf size is 1024 and 512.
>
> Then there is no way to do this in your solution, I suppose?
>
> But with our '--mbuf-size' parameter, we can easily do that.
> Thanks for your hint, we realized our solution also has a little problem, which not
> consider the 'max_rx_bufsize' of rte_eth_dev_info, and we will fix that in the next version patch.
It would be best if the default was to choose mbuf size automatically,
but since this is a test program having an override is also useful.
In general l3fwd is target at usability (less options) and test-pmd is focused on testing (lots of options).
There is a tradeoff here. l3fwd should not get as complex as test-pmd or there is no point.
More information about the dev
mailing list