The design purpose of NET_BUF is to meet the buffer management requirement for 
different network modules. For example, IP module supports reassemble and 
fragment packets; NET_BUF provides the capability to wrap a list of buffers 
into one buffer to avoid data copy in different layers.

Best Regards,
Ye Ting

From: Thomas Rognon [mailto:tcrog...@gmail.com]
Sent: Monday, May 12, 2014 10:48 PM
To: edk2-devel
Subject: Re: [edk2] How do I use NET_BUF?


Yes I see NetbufAlloc(), NetbufAllocSpace(), NetbufBuildExt(), etc. I guess I'm 
looking for more of a conceptual overview of the NET_BUF struct, particularly 
in relation to the two scenarios I mentioned. The documentation in the code 
describes the details, but doesn't really give an overview or describe how to 
use it.

I've been reading a lot of the code that uses it, such as the iScsi driver, and 
am having difficulty grasping its general purpose and usage. For something 
simple like sending a buffer to a socket or receiving data from a socket into a 
buffer, it seems to wrap it in a lot of complexity. I'm sure there's an 
advantage, but I'm just not getting it.
On May 12, 2014 12:47 AM, "Ye, Ting" 
<ting...@intel.com<mailto:ting...@intel.com>> wrote:
You may use NetbufAlloc() in your cases. Please check DxeNetLib in MdeModulePkg 
for more NET_BUF operation APIs.

Best Regards,
Ye Ting

From: Thomas Rognon [mailto:tcrog...@gmail.com<mailto:tcrog...@gmail.com>]
Sent: Monday, May 12, 2014 8:27 AM
To: edk2-devel
Subject: [edk2] How do I use NET_BUF?

Experts,

I'd like to use the TcpIoLib and UdpIoLib, but I spend way too much time 
dealing with the NET_BUF struct. I must be doing things the hard way.

What is the best way to set up a NET_BUF for the following two scenarios? Is it 
different for asynchronous vs. synchronous? Are there any other considerations?

Scenario 1)
I have UINTN DataSize and UINT8 *Data and would like to send Data using 
TcpIoTransmit() or UdpIoSendDatagram().

Scenario 2)
I have UINT8 Stream[STREAM_SIZE] and would like to receive things into Stream 
using TcpIoReceive() or UdpIoRecvDatagram().

I've resorted to just having my TcpIoLib/UdpIoLib that takes Data directly and 
dumps into Stream directly, thereby avoiding NET_BUF. This works just fine, but 
I would rather use what's already out there. NET_BUF is giving me a headache, 
though.

Thank you for any help!

Thomas


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to