]> Pileus Git - ~andy/linux/blobdiff - drivers/net/sfc/efx.c
sfc: Simplified efx_rx_calc_buffer_size() using get_order()
[~andy/linux] / drivers / net / sfc / efx.c
index 59edcf793c19253c4be6d5bceeae730327d87c78..1a065fcadc50e70a32836d1d6007d5adf62e6a7e 100644 (file)
@@ -265,7 +265,7 @@ void efx_process_channel_now(struct efx_channel *channel)
        napi_disable(&channel->napi_str);
 
        /* Poll the channel */
-       (void) efx_process_channel(channel, efx->type->evq_size);
+       efx_process_channel(channel, efx->type->evq_size);
 
        /* Ack the eventq. This may cause an interrupt to be generated
         * when they are reenabled */
@@ -317,26 +317,6 @@ static void efx_remove_eventq(struct efx_channel *channel)
  *
  *************************************************************************/
 
-/* Setup per-NIC RX buffer parameters.
- * Calculate the rx buffer allocation parameters required to support
- * the current MTU, including padding for header alignment and overruns.
- */
-static void efx_calc_rx_buffer_params(struct efx_nic *efx)
-{
-       unsigned int order, len;
-
-       len = (max(EFX_PAGE_IP_ALIGN, NET_IP_ALIGN) +
-              EFX_MAX_FRAME_LEN(efx->net_dev->mtu) +
-              efx->type->rx_buffer_padding);
-
-       /* Calculate page-order */
-       for (order = 0; ((1u << order) * PAGE_SIZE) < len; ++order)
-               ;
-
-       efx->rx_buffer_len = len;
-       efx->rx_buffer_order = order;
-}
-
 static int efx_probe_channel(struct efx_channel *channel)
 {
        struct efx_tx_queue *tx_queue;
@@ -387,7 +367,14 @@ static int efx_init_channels(struct efx_nic *efx)
        struct efx_channel *channel;
        int rc = 0;
 
-       efx_calc_rx_buffer_params(efx);
+       /* Calculate the rx buffer allocation parameters required to
+        * support the current MTU, including padding for header
+        * alignment and overruns.
+        */
+       efx->rx_buffer_len = (max(EFX_PAGE_IP_ALIGN, NET_IP_ALIGN) +
+                             EFX_MAX_FRAME_LEN(efx->net_dev->mtu) +
+                             efx->type->rx_buffer_padding);
+       efx->rx_buffer_order = get_order(efx->rx_buffer_len);
 
        /* Initialise the channels */
        efx_for_each_channel(channel, efx) {
@@ -1688,7 +1675,7 @@ static int efx_reset(struct efx_nic *efx)
        if (method == RESET_TYPE_DISABLE) {
                /* Reinitialise the device anyway so the driver unload sequence
                 * can talk to the external SRAM */
-               (void) falcon_init_nic(efx);
+               falcon_init_nic(efx);
                rc = -EIO;
                goto fail4;
        }
@@ -1873,6 +1860,7 @@ static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type,
                tx_queue->queue = i;
                tx_queue->buffer = NULL;
                tx_queue->channel = &efx->channel[0]; /* for safety */
+               tx_queue->tso_headers_free = NULL;
        }
        for (i = 0; i < EFX_MAX_RX_QUEUES; i++) {
                rx_queue = &efx->rx_queue[i];
@@ -2071,7 +2059,8 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev,
        net_dev = alloc_etherdev(sizeof(*efx));
        if (!net_dev)
                return -ENOMEM;
-       net_dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_HIGHDMA;
+       net_dev->features |= (NETIF_F_IP_CSUM | NETIF_F_SG |
+                             NETIF_F_HIGHDMA | NETIF_F_TSO);
        if (lro)
                net_dev->features |= NETIF_F_LRO;
        efx = net_dev->priv;