sfc: Update version, copyright dates, authors
[pandora-kernel.git] / drivers / net / sfc / rx.c
index a60c718..a97c923 100644 (file)
@@ -1,7 +1,7 @@
 /****************************************************************************
  * Driver for Solarflare Solarstorm network controllers and boards
  * Copyright 2005-2006 Fen Systems Ltd.
- * Copyright 2005-2008 Solarflare Communications Inc.
+ * Copyright 2005-2009 Solarflare Communications Inc.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 as published
@@ -16,9 +16,8 @@
 #include <net/ip.h>
 #include <net/checksum.h>
 #include "net_driver.h"
-#include "rx.h"
 #include "efx.h"
-#include "falcon.h"
+#include "nic.h"
 #include "selftest.h"
 #include "workarounds.h"
 
@@ -342,7 +341,7 @@ static int __efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue,
 
  out:
        /* Send write pointer to card. */
-       falcon_notify_rx_desc(rx_queue);
+       efx_nic_notify_rx_desc(rx_queue);
 
        /* If the fast fill is running inside from the refill tasklet, then
         * for SMP systems it may be running on a different CPU to
@@ -449,15 +448,19 @@ static void efx_rx_packet_lro(struct efx_channel *channel,
 
        /* Pass the skb/page into the LRO engine */
        if (rx_buf->page) {
-               struct sk_buff *skb = napi_get_frags(napi);
+               struct page *page = rx_buf->page;
+               struct sk_buff *skb;
 
+               EFX_BUG_ON_PARANOID(rx_buf->skb);
+               rx_buf->page = NULL;
+
+               skb = napi_get_frags(napi);
                if (!skb) {
-                       put_page(rx_buf->page);
-                       gro_result = GRO_DROP;
-                       goto out;
+                       put_page(page);
+                       return;
                }
 
-               skb_shinfo(skb)->frags[0].page = rx_buf->page;
+               skb_shinfo(skb)->frags[0].page = page;
                skb_shinfo(skb)->frags[0].page_offset =
                        efx_rx_buf_offset(rx_buf);
                skb_shinfo(skb)->frags[0].size = rx_buf->len;
@@ -469,17 +472,17 @@ static void efx_rx_packet_lro(struct efx_channel *channel,
                skb->ip_summed =
                        checksummed ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE;
 
-               gro_result = napi_gro_frags(napi);
+               skb_record_rx_queue(skb, channel->channel);
 
-out:
-               EFX_BUG_ON_PARANOID(rx_buf->skb);
-               rx_buf->page = NULL;
+               gro_result = napi_gro_frags(napi);
        } else {
-               EFX_BUG_ON_PARANOID(!rx_buf->skb);
-               EFX_BUG_ON_PARANOID(!checksummed);
+               struct sk_buff *skb = rx_buf->skb;
 
-               gro_result = napi_gro_receive(napi, rx_buf->skb);
+               EFX_BUG_ON_PARANOID(!skb);
+               EFX_BUG_ON_PARANOID(!checksummed);
                rx_buf->skb = NULL;
+
+               gro_result = napi_gro_receive(napi, skb);
        }
 
        if (gro_result == GRO_NORMAL) {
@@ -564,7 +567,7 @@ void __efx_rx_packet(struct efx_channel *channel,
        if (unlikely(efx->loopback_selftest)) {
                efx_loopback_rx_packet(efx, rx_buf->data, rx_buf->len);
                efx_free_rx_buffer(efx, rx_buf);
-               goto done;
+               return;
        }
 
        if (rx_buf->skb) {
@@ -576,34 +579,28 @@ void __efx_rx_packet(struct efx_channel *channel,
                 * at the ethernet header */
                rx_buf->skb->protocol = eth_type_trans(rx_buf->skb,
                                                       efx->net_dev);
+
+               skb_record_rx_queue(rx_buf->skb, channel->channel);
        }
 
        if (likely(checksummed || rx_buf->page)) {
                efx_rx_packet_lro(channel, rx_buf, checksummed);
-               goto done;
+               return;
        }
 
        /* We now own the SKB */
        skb = rx_buf->skb;
        rx_buf->skb = NULL;
-
-       EFX_BUG_ON_PARANOID(rx_buf->page);
-       EFX_BUG_ON_PARANOID(rx_buf->skb);
        EFX_BUG_ON_PARANOID(!skb);
 
        /* Set the SKB flags */
        skb->ip_summed = CHECKSUM_NONE;
 
-       skb_record_rx_queue(skb, channel->channel);
-
        /* Pass the packet up */
        netif_receive_skb(skb);
 
        /* Update allocation strategy method */
        channel->rx_alloc_level += RX_ALLOC_FACTOR_SKB;
-
-done:
-       ;
 }
 
 void efx_rx_strategy(struct efx_channel *channel)
@@ -643,7 +640,7 @@ int efx_probe_rx_queue(struct efx_rx_queue *rx_queue)
        if (!rx_queue->buffer)
                return -ENOMEM;
 
-       rc = falcon_probe_rx(rx_queue);
+       rc = efx_nic_probe_rx(rx_queue);
        if (rc) {
                kfree(rx_queue->buffer);
                rx_queue->buffer = NULL;
@@ -674,7 +671,7 @@ void efx_init_rx_queue(struct efx_rx_queue *rx_queue)
        rx_queue->fast_fill_limit = limit;
 
        /* Set up RX descriptor ring */
-       falcon_init_rx(rx_queue);
+       efx_nic_init_rx(rx_queue);
 }
 
 void efx_fini_rx_queue(struct efx_rx_queue *rx_queue)
@@ -684,7 +681,7 @@ void efx_fini_rx_queue(struct efx_rx_queue *rx_queue)
 
        EFX_LOG(rx_queue->efx, "shutting down RX queue %d\n", rx_queue->queue);
 
-       falcon_fini_rx(rx_queue);
+       efx_nic_fini_rx(rx_queue);
 
        /* Release RX buffers NB start at index 0 not current HW ptr */
        if (rx_queue->buffer) {
@@ -709,7 +706,7 @@ void efx_remove_rx_queue(struct efx_rx_queue *rx_queue)
 {
        EFX_LOG(rx_queue->efx, "destroying RX queue %d\n", rx_queue->queue);
 
-       falcon_remove_rx(rx_queue);
+       efx_nic_remove_rx(rx_queue);
 
        kfree(rx_queue->buffer);
        rx_queue->buffer = NULL;