From: "Kok, Auke" <auke-jan.h.kok@intel.com>
To: Milind Arun Choudhary <milindchoudhary@gmail.com>
Cc: kernel-janitors@lists.osdl.org,
e1000-devel@lists.sourceforge.net, linux.nics@intel.com,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
cramerj@intel.com, john.ronciak@intel.com,
jesse.brandeburg@intel.com, jeffrey.t.kirsher@intel.com
Subject: Re: [KJ] [PATCH] ROUND_UP macro cleanup in drivers/net/e1000
Date: Sun, 01 Apr 2007 23:20:44 +0000 [thread overview]
Message-ID: <46103E4C.2060604@intel.com> (raw)
In-Reply-To: <20070401183144.GA10566@arun.site>
Milind Arun Choudhary wrote:
> E1000_ROUNDUP macro cleanup, use ALIGN
>
> Signed-off-by: Milind Arun Choudhary <milindchoudhary@gmail.com>
we were actually looking at this last week. I'll take it for a spin and if it's
good I'll push it through upstream.
Thanks!
Auke
> ---
>
> e1000.h | 3 ---
> e1000_ethtool.c | 6 +++---
> e1000_main.c | 10 +++++-----
> e1000_param.c | 4 ++--
> 4 files changed, 10 insertions(+), 13 deletions(-)
>
>
> diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
> index dd4b728..a9ea67e 100644
> --- a/drivers/net/e1000/e1000.h
> +++ b/drivers/net/e1000/e1000.h
> @@ -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 {
> diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
> index 6777887..0fbd873 100644
> --- a/drivers/net/e1000/e1000_ethtool.c
> +++ b/drivers/net/e1000/e1000_ethtool.c
> @@ -686,12 +686,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;
> @@ -1068,7 +1068,7 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter)
> memset(txdr->buffer_info, 0, size);
>
> 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;
> goto err_nomem;
> diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
> index 1d08e93..d0af100 100644
> --- a/drivers/net/e1000/e1000_main.c
> +++ b/drivers/net/e1000/e1000_main.c
> @@ -750,9 +750,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,
> @@ -1545,7 +1545,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) {
> @@ -1788,7 +1788,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);
>
> @@ -3162,7 +3162,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;
> diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c
> index f8862e2..f485874 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)
> 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;
>
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
WARNING: multiple messages have this Message-ID (diff)
From: "Kok, Auke" <auke-jan.h.kok@intel.com>
To: Milind Arun Choudhary <milindchoudhary@gmail.com>
Cc: kernel-janitors@lists.osdl.org,
e1000-devel@lists.sourceforge.net, linux.nics@intel.com,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
cramerj@intel.com, john.ronciak@intel.com,
jesse.brandeburg@intel.com, jeffrey.t.kirsher@intel.com
Subject: Re: [KJ][PATCH] ROUND_UP macro cleanup in drivers/net/e1000
Date: Sun, 01 Apr 2007 16:20:44 -0700 [thread overview]
Message-ID: <46103E4C.2060604@intel.com> (raw)
In-Reply-To: <20070401183144.GA10566@arun.site>
Milind Arun Choudhary wrote:
> E1000_ROUNDUP macro cleanup, use ALIGN
>
> Signed-off-by: Milind Arun Choudhary <milindchoudhary@gmail.com>
we were actually looking at this last week. I'll take it for a spin and if it's
good I'll push it through upstream.
Thanks!
Auke
> ---
>
> e1000.h | 3 ---
> e1000_ethtool.c | 6 +++---
> e1000_main.c | 10 +++++-----
> e1000_param.c | 4 ++--
> 4 files changed, 10 insertions(+), 13 deletions(-)
>
>
> diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
> index dd4b728..a9ea67e 100644
> --- a/drivers/net/e1000/e1000.h
> +++ b/drivers/net/e1000/e1000.h
> @@ -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 {
> diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
> index 6777887..0fbd873 100644
> --- a/drivers/net/e1000/e1000_ethtool.c
> +++ b/drivers/net/e1000/e1000_ethtool.c
> @@ -686,12 +686,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;
> @@ -1068,7 +1068,7 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter)
> memset(txdr->buffer_info, 0, size);
>
> 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;
> goto err_nomem;
> diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
> index 1d08e93..d0af100 100644
> --- a/drivers/net/e1000/e1000_main.c
> +++ b/drivers/net/e1000/e1000_main.c
> @@ -750,9 +750,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,
> @@ -1545,7 +1545,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) {
> @@ -1788,7 +1788,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);
>
> @@ -3162,7 +3162,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;
> diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c
> index f8862e2..f485874 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)
> 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;
>
next prev parent reply other threads:[~2007-04-01 23:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-01 18:31 [KJ][PATCH] ROUND_UP macro cleanup in drivers/net/e1000 Milind Arun Choudhary
2007-04-01 18:43 ` [KJ] [PATCH] " Milind Arun Choudhary
2007-04-01 23:20 ` Kok, Auke [this message]
2007-04-01 23:20 ` [KJ][PATCH] " Kok, Auke
-- strict thread matches above, loose matches on Subject: below --
2007-04-01 11:14 [KJ][PATCH] ROUND_UP macro cleanup in drivers/pci Milind Arun Choudhary
2007-04-01 11:26 ` [KJ] [PATCH] " Milind Arun Choudhary
2007-04-04 17:59 ` Scott Murray
2007-04-04 17:59 ` [KJ][PATCH] " Scott Murray
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46103E4C.2060604@intel.com \
--to=auke-jan.h.kok@intel.com \
--cc=akpm@linux-foundation.org \
--cc=cramerj@intel.com \
--cc=e1000-devel@lists.sourceforge.net \
--cc=jeffrey.t.kirsher@intel.com \
--cc=jesse.brandeburg@intel.com \
--cc=john.ronciak@intel.com \
--cc=kernel-janitors@lists.osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux.nics@intel.com \
--cc=milindchoudhary@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.