Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Feb 2013 11:41:32 -0800
From:      Lino Sanfilippo <lsanfil@marvell.com>
To:        Jacques Fourie <jacques.fourie@gmail.com>, John Baldwin <jhb@freebsd.org>
Cc:        Hackers freeBSD <freebsd-hackers@freebsd.org>, Axel Fischer <afischer@marvell.com>, Ralf Assmann <rassmann@marvell.com>, Markus Althoff <malthoff@marvell.com>
Subject:   RE: Mbuf memory handling
Message-ID:  <175CCF5F49938B4D99B2E3EF7F558EBE1C73F4038E@SC-VEXCH4.marvell.com>
In-Reply-To: <CALX0vxCKqMm2PdK_5t1SdOO91LjpZ1bHz-oDskx6pEj5FPhvtg@mail.gmail.com>
References:  <175CCF5F49938B4D99B2E3EF7F558EBE1C73F401F3@SC-VEXCH4.marvell.com> <201302060836.55404.jhb@freebsd.org> <CALX0vxADMfWe1-_mOYnx0C-9cRxf-ETv6wOPn=%2B34NATNUbbKA@mail.gmail.com> <201302061137.35651.jhb@freebsd.org> <CALX0vxCKqMm2PdK_5t1SdOO91LjpZ1bHz-oDskx6pEj5FPhvtg@mail.gmail.com>

index | next in thread | previous in thread | raw e-mail

John, Jacques,

thank you very much for your help. An mbuf cluster seems to be the right direction.
So I would have to do something like

mbuf = m_getjcl(how, MT_DATA, M_PKTHDR, MJUMPAGESIZE);
left_for_next_rcv = m_split(mbuf, chunksize);
if_input(ifp, mbuf);

right?

>I agree that read-only buffers may be ok in this case but would like to point out that the M_WRITABLE() macro will evaluate to 0 if the refcount on the cluster is >1

The fact that the resulting mbufs returned by m_split() are not writeable any more is indeed a problem:
What I would like to do is keep the 'left_for_next_rcv' mbuf until the next packet arrives and
then fill it with the next packets data only up to 'chunksize', split it again to pass the new mbuf to
the protocol stack and so on until 'left_for_next_rcv' becomes too small to be splitted further.
Only then I would want to allocate a new "fresh" jumbo sized mbuf. Is it possible to
realize this with cluster mbufs?

Thx,
Lino




help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?175CCF5F49938B4D99B2E3EF7F558EBE1C73F4038E>