]> err.no Git - linux-2.6/commitdiff
e1000: ROUND_UP macro cleanup in drivers/net/e1000
authorMilind Arun Choudhary <milindchoudhary@gmail.com>
Fri, 27 Apr 2007 20:55:29 +0000 (13:55 -0700)
committerJeff Garzik <jeff@garzik.org>
Sat, 28 Apr 2007 15:01:07 +0000 (11:01 -0400)
E1000_ROUNDUP macro cleanup, use ALIGN

Signed-off-by: Milind Arun Choudhary <milindchoudhary@gmail.com>
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/e1000/e1000.h
drivers/net/e1000/e1000_ethtool.c
drivers/net/e1000/e1000_main.c
drivers/net/e1000/e1000_param.c

index dd4b728ac4b58712ceb88658c1fa82807fccda39..a9ea67e75c1b322f1bfd03b0543ce982535ee7d0 100644 (file)
@@ -155,9 +155,6 @@ struct e1000_adapter;
 /* Number of packet split data buffers (not including the header buffer) */
 #define PS_PAGE_BUFFERS MAX_PS_BUFFERS-1
 
-/* only works for sizes that are powers of 2 */
-#define E1000_ROUNDUP(i, size) ((i) = (((i) + (size) - 1) & ~((size) - 1)))
-
 /* wrapper around a pointer to a socket buffer,
  * so a DMA handle can be stored along with the buffer */
 struct e1000_buffer {
index 2881da1c6fe3a8f1ad5bcf52b4cfd74a4dccd157..bb08375b5f13f73629320bc874653c0fa7cfba01 100644 (file)
@@ -683,12 +683,12 @@ e1000_set_ringparam(struct net_device *netdev,
        rxdr->count = max(ring->rx_pending,(uint32_t)E1000_MIN_RXD);
        rxdr->count = min(rxdr->count,(uint32_t)(mac_type < e1000_82544 ?
                E1000_MAX_RXD : E1000_MAX_82544_RXD));
-       E1000_ROUNDUP(rxdr->count, REQ_RX_DESCRIPTOR_MULTIPLE);
+       rxdr->count = ALIGN(rxdr->count, REQ_RX_DESCRIPTOR_MULTIPLE);
 
        txdr->count = max(ring->tx_pending,(uint32_t)E1000_MIN_TXD);
        txdr->count = min(txdr->count,(uint32_t)(mac_type < e1000_82544 ?
                E1000_MAX_TXD : E1000_MAX_82544_TXD));
-       E1000_ROUNDUP(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE);
+       txdr->count = ALIGN(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE);
 
        for (i = 0; i < adapter->num_tx_queues; i++)
                txdr[i].count = txdr->count;
@@ -1065,7 +1065,7 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter)
        }
 
        txdr->size = txdr->count * sizeof(struct e1000_tx_desc);
-       E1000_ROUNDUP(txdr->size, 4096);
+       txdr->size = ALIGN(txdr->size, 4096);
        if (!(txdr->desc = pci_alloc_consistent(pdev, txdr->size,
                                                &txdr->dma))) {
                ret_val = 2;
index 7b124840bbcced550ec6e9d231bb0107348b9df6..3a03a74c0609b89172941ccb9e6a9586005bbf31 100644 (file)
@@ -748,9 +748,9 @@ e1000_reset(struct e1000_adapter *adapter)
                               VLAN_TAG_SIZE;
                min_tx_space = min_rx_space;
                min_tx_space *= 2;
-               E1000_ROUNDUP(min_tx_space, 1024);
+               min_tx_space = ALIGN(min_tx_space, 1024);
                min_tx_space >>= 10;
-               E1000_ROUNDUP(min_rx_space, 1024);
+               min_rx_space = ALIGN(min_rx_space, 1024);
                min_rx_space >>= 10;
 
                /* If current Tx allocation is less than the min Tx FIFO size,
@@ -1556,7 +1556,7 @@ e1000_setup_tx_resources(struct e1000_adapter *adapter,
        /* round up to nearest 4K */
 
        txdr->size = txdr->count * sizeof(struct e1000_tx_desc);
-       E1000_ROUNDUP(txdr->size, 4096);
+       txdr->size = ALIGN(txdr->size, 4096);
 
        txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma);
        if (!txdr->desc) {
@@ -1798,7 +1798,7 @@ e1000_setup_rx_resources(struct e1000_adapter *adapter,
        /* Round up to nearest 4K */
 
        rxdr->size = rxdr->count * desc_len;
-       E1000_ROUNDUP(rxdr->size, 4096);
+       rxdr->size = ALIGN(rxdr->size, 4096);
 
        rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma);
 
@@ -3170,7 +3170,7 @@ e1000_82547_fifo_workaround(struct e1000_adapter *adapter, struct sk_buff *skb)
        uint32_t fifo_space = adapter->tx_fifo_size - adapter->tx_fifo_head;
        uint32_t skb_fifo_len = skb->len + E1000_FIFO_HDR;
 
-       E1000_ROUNDUP(skb_fifo_len, E1000_FIFO_HDR);
+       skb_fifo_len = ALIGN(skb_fifo_len, E1000_FIFO_HDR);
 
        if (adapter->link_duplex != HALF_DUPLEX)
                goto no_fifo_stall_required;
index f8862e203ac9f9f4d76ba4ef026040cbf308d15b..f485874a63f56f6d5b0eaee18e3813cf3aa75c7a 100644 (file)
@@ -305,7 +305,7 @@ e1000_check_options(struct e1000_adapter *adapter)
                if (num_TxDescriptors > bd) {
                        tx_ring->count = TxDescriptors[bd];
                        e1000_validate_option(&tx_ring->count, &opt, adapter);
-                       E1000_ROUNDUP(tx_ring->count,
+                       tx_ring->count = ALIGN(tx_ring->count,
                                                REQ_TX_DESCRIPTOR_MULTIPLE);
                } else {
                        tx_ring->count = opt.def;
@@ -331,7 +331,7 @@ e1000_check_options(struct e1000_adapter *adapter)
                if (num_RxDescriptors > bd) {
                        rx_ring->count = RxDescriptors[bd];
                        e1000_validate_option(&rx_ring->count, &opt, adapter);
-                       E1000_ROUNDUP(rx_ring->count,
+                       rx_ring->count = ALIGN(rx_ring->count,
                                                REQ_RX_DESCRIPTOR_MULTIPLE);
                } else {
                        rx_ring->count = opt.def;