rt2x00: Properly clean up beacon skbs.
[safe/jmp/linux-2.6] / drivers / net / sfc / rx.c
index f15d332..601b001 100644 (file)
@@ -86,16 +86,12 @@ static unsigned int rx_refill_limit = 95;
  */
 #define EFX_RXD_HEAD_ROOM 2
 
-static inline unsigned int efx_page_offset(void *p)
-{
-       return (__force unsigned int)p & (PAGE_SIZE - 1);
-}
 static inline unsigned int efx_rx_buf_offset(struct efx_rx_buffer *buf)
 {
        /* Offset is always within one page, so we don't need to consider
         * the page order.
         */
-       return efx_page_offset(buf->data);
+       return (__force unsigned long) buf->data & (PAGE_SIZE - 1);
 }
 static inline unsigned int efx_rx_buf_size(struct efx_nic *efx)
 {
@@ -113,7 +109,7 @@ static inline unsigned int efx_rx_buf_size(struct efx_nic *efx)
 static int efx_lro_get_skb_hdr(struct sk_buff *skb, void **ip_hdr,
                               void **tcpudp_hdr, u64 *hdr_flags, void *priv)
 {
-       struct efx_channel *channel = (struct efx_channel *)priv;
+       struct efx_channel *channel = priv;
        struct iphdr *iph;
        struct tcphdr *th;
 
@@ -138,12 +134,12 @@ static int efx_get_frag_hdr(struct skb_frag_struct *frag, void **mac_hdr,
                            void **ip_hdr, void **tcpudp_hdr, u64 *hdr_flags,
                            void *priv)
 {
-       struct efx_channel *channel = (struct efx_channel *)priv;
+       struct efx_channel *channel = priv;
        struct ethhdr *eh;
        struct iphdr *iph;
 
        /* We support EtherII and VLAN encapsulated IPv4 */
-       eh = (struct ethhdr *)(page_address(frag->page) + frag->page_offset);
+       eh = page_address(frag->page) + frag->page_offset;
        *mac_hdr = eh;
 
        if (eh->h_proto == htons(ETH_P_IP)) {
@@ -287,14 +283,14 @@ static inline int efx_init_rx_buffer_page(struct efx_rx_queue *rx_queue,
 
                rx_queue->buf_page = rx_buf->page;
                rx_queue->buf_dma_addr = dma_addr;
-               rx_queue->buf_data = ((char *) page_address(rx_buf->page) +
+               rx_queue->buf_data = (page_address(rx_buf->page) +
                                      EFX_PAGE_IP_ALIGN);
        }
 
-       offset = efx_page_offset(rx_queue->buf_data);
        rx_buf->len = bytes;
-       rx_buf->dma_addr = rx_queue->buf_dma_addr + offset;
        rx_buf->data = rx_queue->buf_data;
+       offset = efx_rx_buf_offset(rx_buf);
+       rx_buf->dma_addr = rx_queue->buf_dma_addr + offset;
 
        /* Try to pack multiple buffers per page */
        if (efx->rx_buffer_order == 0) {