Skip to content

Commit

Permalink
af_packet: eliminate pgv_to_page on some arches
Browse files Browse the repository at this point in the history
Some arches don't need flush_dcache_page(), and don't implement it, so
we can eliminate pgv_to_page() calls on those arches.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Changli Gao authored and David S. Miller committed Dec 8, 2010
1 parent 15c2d75 commit f6dafa9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/packet/af_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ struct packet_skb_cb {

#define PACKET_SKB_CB(__skb) ((struct packet_skb_cb *)((__skb)->cb))

static inline struct page *pgv_to_page(void *addr)
static inline __pure struct page *pgv_to_page(void *addr)
{
if (is_vmalloc_addr(addr))
return vmalloc_to_page(addr);
Expand Down Expand Up @@ -806,13 +806,15 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,

__packet_set_status(po, h.raw, status);
smp_mb();
#if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE == 1
{
u8 *start, *end;

end = (u8 *)PAGE_ALIGN((unsigned long)h.raw + macoff + snaplen);
for (start = h.raw; start < end; start += PAGE_SIZE)
flush_dcache_page(pgv_to_page(start));
}
#endif

sk->sk_data_ready(sk, 0);

Expand Down

0 comments on commit f6dafa9

Please sign in to comment.