public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Amit Kumar Salecha <amit.salecha@qlogic.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	ameen.rahman@qlogic.com, anirban.chakraborty@qlogic.com
Subject: Re: [PATCH] qlcnic: dma address align check
Date: Tue, 26 Oct 2010 11:54:54 +0200	[thread overview]
Message-ID: <1288086894.3169.53.camel@edumazet-laptop> (raw)
In-Reply-To: <1288085882-11988-5-git-send-email-amit.salecha@qlogic.com>

Le mardi 26 octobre 2010 à 02:38 -0700, Amit Kumar Salecha a écrit :
> Device requires tx_hw_cosnumer to be 64 byte aligned.
> Tx desc size is 64 byte, alloc tx_hw_consumer with tx desc.
> 
> Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
> ---
>  drivers/net/qlcnic/qlcnic_ctx.c |   35 +++++++++++++++--------------------
>  1 files changed, 15 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/net/qlcnic/qlcnic_ctx.c b/drivers/net/qlcnic/qlcnic_ctx.c
> index 1cdc05d..21c9c28 100644
> --- a/drivers/net/qlcnic/qlcnic_ctx.c
> +++ b/drivers/net/qlcnic/qlcnic_ctx.c
> @@ -418,18 +418,9 @@ int qlcnic_alloc_hw_resources(struct qlcnic_adapter *adapter)
>  	recv_ctx = &adapter->recv_ctx;
>  	tx_ring = adapter->tx_ring;
>  
> -	tx_ring->hw_consumer = (__le32 *)pci_alloc_consistent(pdev, sizeof(u32),
> -						&tx_ring->hw_cons_phys_addr);
> -	if (tx_ring->hw_consumer == NULL) {
> -		dev_err(&pdev->dev, "failed to allocate tx consumer\n");
> -		return -ENOMEM;
> -	}
> -	*(tx_ring->hw_consumer) = 0;
> -
>  	/* cmd desc ring */
> -	addr = pci_alloc_consistent(pdev, TX_DESC_RINGSIZE(tx_ring),
> -			&tx_ring->phys_addr);
> -
> +	addr = pci_alloc_consistent(pdev, TX_DESC_RINGSIZE(tx_ring) +
> +			sizeof(u32), &tx_ring->phys_addr);

Wont this use twice memory than before, due to power-of-two
allocations ?

Allocating 65536 + 4 bytes gives you 131072 bytes.



  reply	other threads:[~2010-10-26  9:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-26  9:37 [PATCH 0/4]qlcnic: bug fixes Amit Kumar Salecha
2010-10-26  9:37 ` [PATCH] qlcnic: fix mac learning Amit Kumar Salecha
2010-10-26  9:38 ` [PATCH] qlcnic: reduce RX ring size for nic partition Amit Kumar Salecha
2010-10-26  9:38 ` [PATCH] qlcnic: define valid vlan id range Amit Kumar Salecha
2010-10-26  9:38 ` [PATCH] qlcnic: dma address align check Amit Kumar Salecha
2010-10-26  9:54   ` Eric Dumazet [this message]
2010-10-26 10:04     ` Amit Salecha
2010-10-26 10:30       ` Eric Dumazet
2010-10-26 10:52         ` Amit Salecha
2010-10-26 12:03         ` [PATCH net-next-2.6] tg3: use dma_alloc_coherent() instead of pci_alloc_consistent() Eric Dumazet
2010-10-26 17:04           ` Matt Carlson
2010-10-26 15:37 ` [PATCH 0/4]qlcnic: bug fixes David Miller

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=1288086894.3169.53.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=ameen.rahman@qlogic.com \
    --cc=amit.salecha@qlogic.com \
    --cc=anirban.chakraborty@qlogic.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox