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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 31 Oct 2008 11:24:51 -0700
From:	"Lovich, Vitali" <vlovich@...lcomm.com>
To:	Johann Baudy <johaahn@...il.com>
CC:	"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH] Packet socket: mmapped IO: PACKET_TX_RING

> -----Original Message-----
> From: netdev-owner@...r.kernel.org [mailto:netdev-
> owner@...r.kernel.org] On Behalf Of Lovich, Vitali
> Sent: October-31-08 10:08 AM
> To: Johann Baudy
> Cc: netdev@...r.kernel.org
> Subject: RE: [PATCH] Packet socket: mmapped IO: PACKET_TX_RING
> 
> 
> 
> > -----Original Message-----
> > From: Johann Baudy [mailto:johaahn@...il.com]
> > Sent: October-31-08 3:58 AM
> > To: Lovich, Vitali
> > Cc: David Miller; netdev@...r.kernel.org
> > Subject: Re: [PATCH] Packet socket: mmapped IO: PACKET_TX_RING
> >
> > Hi Vitali,
> >
> > > There's no need to keep the index (packet_index).  Just store the
> > pointer directly (change it to void *) - saves an extra lookup.
> >
> > Indeed, it will be faster. I'll do the change.
> Actually, I just realized that we don't need to modify the sock_buff
> structure.  We're already filling in the fragments of the skb - just
> take the first fragment and reverse the process to determine the
> starting address of the frame.

Here's the code I came up with to determine the offset - anyone see any problems?

union {
   tpacket2_hdr *t2;
   u8 *raw;
}

struct page *first_frag;
u32 page_offset;

first_frag = skb_shinfo(skb)->frags[0].page;
page_offset = skb_shinfo(skb)->frags[0].page_offset;

page_offset -= (skb_headlen(skb) + sizeof(struct tpacket2_hdr));
if (unlikely(page_offset < 0)) {
	first_frag--;
	page_offset += PAGE_SIZE;
}
frame.raw = page_address(first_frag) + page_offset;

// rest of destructor
--
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