vhiz wrote: > Hi, > > Can someone please explain how network packets are mapped to mblks. > And how the mblk chains are formed. I have googled quite a bit, but nothing > concrete comes up. Any links would also be great!
There are a few different code paths involved, but in general: For output data, the stream head copies the user's data into mblks that it allocates, and then sends those blocks downstream to the modules and drivers that modify them into packets to be sent. For input data, the driver itself allocates mblks, and attaches them to the hardware receive descriptors for DMA. As the descriptors are filled, the driver removes them, and sends the received packets (inside the mblks [or really dblks] that received them) upstream. Chains are formed in many cases. A common one is when some module or driver decides that instead of copying the data around to paste a few bytes at the beginning or end of a buffer, it'd be easier to allocate a new mblk and chain that on with b_cont. In short, read the code. Look for allocb() and uses of b_cont -- at least to start. (If you've got a more specific question, or a particular problem you're trying to solve, then it'd be good to hear the overall details of that rather than this one narrow question. I fear something was lost in translation.) -- James Carlson 42.703N 71.076W <[email protected]> _______________________________________________ networking-discuss mailing list [email protected]
