aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000
diff options
context:
space:
mode:
authorMilind Arun Choudhary <milindchoudhary@gmail.com>2007-04-27 16:55:29 -0400
committerJeff Garzik <jeff@garzik.org>2007-04-28 11:01:07 -0400
commit9099cfb9170f352f08207dfa099717a904cff71f (patch)
tree6b2c08422851d5e36c866fc4397ce0bc43a4319f /drivers/net/e1000
parentabf17ffda7b7b6c83a29d7ccea91d46065c6ca3e (diff)
e1000: ROUND_UP macro cleanup in drivers/net/e1000
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>
Diffstat (limited to 'drivers/net/e1000')
-rw-r--r--drivers/net/e1000/e1000.h3
-rw-r--r--drivers/net/e1000/e1000_ethtool.c6
-rw-r--r--drivers/net/e1000/e1000_main.c10
-rw-r--r--drivers/net/e1000/e1000_param.c4
4 files changed, 10 insertions, 13 deletions
diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index dd4b728ac4b5..a9ea67e75c1b 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -155,9 +155,6 @@ struct e1000_adapter;
155/* Number of packet split data buffers (not including the header buffer) */ 155/* Number of packet split data buffers (not including the header buffer) */
156#define PS_PAGE_BUFFERS MAX_PS_BUFFERS-1 156#define PS_PAGE_BUFFERS MAX_PS_BUFFERS-1
157 157
158/* only works for sizes that are powers of 2 */
159#define E1000_ROUNDUP(i, size) ((i) = (((i) + (size) - 1) & ~((size) - 1)))
160
161/* wrapper around a pointer to a socket buffer, 158/* wrapper around a pointer to a socket buffer,
162 * so a DMA handle can be stored along with the buffer */ 159 * so a DMA handle can be stored along with the buffer */
163struct e1000_buffer { 160struct e1000_buffer {
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index 2881da1c6fe3..bb08375b5f13 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -683,12 +683,12 @@ e1000_set_ringparam(struct net_device *netdev,
683 rxdr->count = max(ring->rx_pending,(uint32_t)E1000_MIN_RXD); 683 rxdr->count = max(ring->rx_pending,(uint32_t)E1000_MIN_RXD);
684 rxdr->count = min(rxdr->count,(uint32_t)(mac_type < e1000_82544 ? 684 rxdr->count = min(rxdr->count,(uint32_t)(mac_type < e1000_82544 ?
685 E1000_MAX_RXD : E1000_MAX_82544_RXD)); 685 E1000_MAX_RXD : E1000_MAX_82544_RXD));
686 E1000_ROUNDUP(rxdr->count, REQ_RX_DESCRIPTOR_MULTIPLE); 686 rxdr->count = ALIGN(rxdr->count, REQ_RX_DESCRIPTOR_MULTIPLE);
687 687
688 txdr->count = max(ring->tx_pending,(uint32_t)E1000_MIN_TXD); 688 txdr->count = max(ring->tx_pending,(uint32_t)E1000_MIN_TXD);
689 txdr->count = min(txdr->count,(uint32_t)(mac_type < e1000_82544 ? 689 txdr->count = min(txdr->count,(uint32_t)(mac_type < e1000_82544 ?
690 E1000_MAX_TXD : E1000_MAX_82544_TXD)); 690 E1000_MAX_TXD : E1000_MAX_82544_TXD));
691 E1000_ROUNDUP(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE); 691 txdr->count = ALIGN(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE);
692 692
693 for (i = 0; i < adapter->num_tx_queues; i++) 693 for (i = 0; i < adapter->num_tx_queues; i++)
694 txdr[i].count = txdr->count; 694 txdr[i].count = txdr->count;
@@ -1065,7 +1065,7 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter)
1065 } 1065 }
1066 1066
1067 txdr->size = txdr->count * sizeof(struct e1000_tx_desc); 1067 txdr->size = txdr->count * sizeof(struct e1000_tx_desc);
1068 E1000_ROUNDUP(txdr->size, 4096); 1068 txdr->size = ALIGN(txdr->size, 4096);
1069 if (!(txdr->desc = pci_alloc_consistent(pdev, txdr->size, 1069 if (!(txdr->desc = pci_alloc_consistent(pdev, txdr->size,
1070 &txdr->dma))) { 1070 &txdr->dma))) {
1071 ret_val = 2; 1071 ret_val = 2;
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 7b124840bbcc..3a03a74c0609 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -748,9 +748,9 @@ e1000_reset(struct e1000_adapter *adapter)
748 VLAN_TAG_SIZE; 748 VLAN_TAG_SIZE;
749 min_tx_space = min_rx_space; 749 min_tx_space = min_rx_space;
750 min_tx_space *= 2; 750 min_tx_space *= 2;
751 E1000_ROUNDUP(min_tx_space, 1024); 751 min_tx_space = ALIGN(min_tx_space, 1024);
752 min_tx_space >>= 10; 752 min_tx_space >>= 10;
753 E1000_ROUNDUP(min_rx_space, 1024); 753 min_rx_space = ALIGN(min_rx_space, 1024);
754 min_rx_space >>= 10; 754 min_rx_space >>= 10;
755 755
756 /* If current Tx allocation is less than the min Tx FIFO size, 756 /* If current Tx allocation is less than the min Tx FIFO size,
@@ -1556,7 +1556,7 @@ e1000_setup_tx_resources(struct e1000_adapter *adapter,
1556 /* round up to nearest 4K */ 1556 /* round up to nearest 4K */
1557 1557
1558 txdr->size = txdr->count * sizeof(struct e1000_tx_desc); 1558 txdr->size = txdr->count * sizeof(struct e1000_tx_desc);
1559 E1000_ROUNDUP(txdr->size, 4096); 1559 txdr->size = ALIGN(txdr->size, 4096);
1560 1560
1561 txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma); 1561 txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma);
1562 if (!txdr->desc) { 1562 if (!txdr->desc) {
@@ -1798,7 +1798,7 @@ e1000_setup_rx_resources(struct e1000_adapter *adapter,
1798 /* Round up to nearest 4K */ 1798 /* Round up to nearest 4K */
1799 1799
1800 rxdr->size = rxdr->count * desc_len; 1800 rxdr->size = rxdr->count * desc_len;
1801 E1000_ROUNDUP(rxdr->size, 4096); 1801 rxdr->size = ALIGN(rxdr->size, 4096);
1802 1802
1803 rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma); 1803 rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma);
1804 1804
@@ -3170,7 +3170,7 @@ e1000_82547_fifo_workaround(struct e1000_adapter *adapter, struct sk_buff *skb)
3170 uint32_t fifo_space = adapter->tx_fifo_size - adapter->tx_fifo_head; 3170 uint32_t fifo_space = adapter->tx_fifo_size - adapter->tx_fifo_head;
3171 uint32_t skb_fifo_len = skb->len + E1000_FIFO_HDR; 3171 uint32_t skb_fifo_len = skb->len + E1000_FIFO_HDR;
3172 3172
3173 E1000_ROUNDUP(skb_fifo_len, E1000_FIFO_HDR); 3173 skb_fifo_len = ALIGN(skb_fifo_len, E1000_FIFO_HDR);
3174 3174
3175 if (adapter->link_duplex != HALF_DUPLEX) 3175 if (adapter->link_duplex != HALF_DUPLEX)
3176 goto no_fifo_stall_required; 3176 goto no_fifo_stall_required;
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c
index f8862e203ac9..f485874a63f5 100644
--- a/drivers/net/e1000/e1000_param.c
+++ b/drivers/net/e1000/e1000_param.c
@@ -305,7 +305,7 @@ e1000_check_options(struct e1000_adapter *adapter)
305 if (num_TxDescriptors > bd) { 305 if (num_TxDescriptors > bd) {
306 tx_ring->count = TxDescriptors[bd]; 306 tx_ring->count = TxDescriptors[bd];
307 e1000_validate_option(&tx_ring->count, &opt, adapter); 307 e1000_validate_option(&tx_ring->count, &opt, adapter);
308 E1000_ROUNDUP(tx_ring->count, 308 tx_ring->count = ALIGN(tx_ring->count,
309 REQ_TX_DESCRIPTOR_MULTIPLE); 309 REQ_TX_DESCRIPTOR_MULTIPLE);
310 } else { 310 } else {
311 tx_ring->count = opt.def; 311 tx_ring->count = opt.def;
@@ -331,7 +331,7 @@ e1000_check_options(struct e1000_adapter *adapter)
331 if (num_RxDescriptors > bd) { 331 if (num_RxDescriptors > bd) {
332 rx_ring->count = RxDescriptors[bd]; 332 rx_ring->count = RxDescriptors[bd];
333 e1000_validate_option(&rx_ring->count, &opt, adapter); 333 e1000_validate_option(&rx_ring->count, &opt, adapter);
334 E1000_ROUNDUP(rx_ring->count, 334 rx_ring->count = ALIGN(rx_ring->count,
335 REQ_RX_DESCRIPTOR_MULTIPLE); 335 REQ_RX_DESCRIPTOR_MULTIPLE);
336 } else { 336 } else {
337 rx_ring->count = opt.def; 337 rx_ring->count = opt.def;