lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20080522181401.GA14056@2ka.mipt.ru>
Date:	Thu, 22 May 2008 22:14:01 +0400
From:	Evgeniy Polyakov <johnpol@....mipt.ru>
To:	Keyur Chudgar <kchudgar@...c.com>
Cc:	Keyur Chudgar <kchudgar.linux@...il.com>, netdev@...r.kernel.org
Subject: Re: Single packet receiving in multiple ring buffers

On Thu, May 22, 2008 at 11:00:23AM -0700, Keyur Chudgar (kchudgar@...c.com) wrote:
> Hi,
> 
> Following is what I would like to understand.  I am working with an
> ethernet MAC that is capable of chaining multiple buffers (fixed size)
> together to form a single packet.  For example, a packet size of 2k
> would fit into 1k size hardware buffers.  So, at initialization time, I
> configure the MAC buffer descriptor in the following way.  I allocate 2
> skb's (ie. dev_alloc_skb(1024)) and pass the skb.data pointers to the

A nitpick: hope it is not NIC initialization time, since skb can live
very long time in stack and if you statically bind single skb to
hardware descriptor during NIC init time you will be very short on skbs.

> mac buffer descriptors as shown in the diagram below.
> 
> 	-------------	-------------------
> 	| skb1->data |--->| First part of   |
> 	--------------	| Packet in buf1	|
> 				|------------------
> 
> 	-------------	-------------------
> 	| skb2->data |--->| Second part of  |
> 	--------------	| same packet in	|
> 				| buf2		|
> 				|------------------
> 
> So, when a packet is received by the MAC, it will give me (rx portion of
> the driver) the two descriptors associated with that single packet size
> of 2k.  Here, I would like to avoid copying.  To this end, what options
> do I have available to me at the driver level so that stack gets a
> single skb with multiple chained buffers.  In short, I would like to
> represent a single packet comprised of multiple SKB's.  So, when the
> stack free's this packet, it will have to have a way of freeing all of
> the underlying SKB's.
>  
> Will your previous suggestion apply for the above scenerio?  If not, do
> I have any other options than to do memcpy on Rx, in the driver.  

You have to chain second skb into frag_list of the first one.
But it is not preferred solution, better attach a page to each hardware
descriptor and put pages from each part into single skb via skb_fill_page_desc().
Or you can play with parts of the pages for DMA if your hardware does
not allow to DMA big portions from single descriptor (like in your
example above where each HW descriptor is limited to 1k).

-- 
	Evgeniy Polyakov
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ