[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <99737F4847ED0A48AECC9F4A1974A4B80F871A817A@MNEXMB2.qlogic.org>
Date: Tue, 26 Oct 2010 05:04:18 -0500
From: Amit Salecha <amit.salecha@...gic.com>
To: Eric Dumazet <eric.dumazet@...il.com>
CC: "davem@...emloft.net" <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Ameen Rahman <ameen.rahman@...gic.com>,
Anirban Chakraborty <anirban.chakraborty@...gic.com>
Subject: RE: [PATCH] qlcnic: dma address align check
> -----Original Message-----
> From: Eric Dumazet [mailto:eric.dumazet@...il.com]
> Sent: Tuesday, October 26, 2010 3:25 PM
> To: Amit Salecha
> Cc: davem@...emloft.net; netdev@...r.kernel.org; Ameen Rahman; Anirban
> Chakraborty
> Subject: Re: [PATCH] qlcnic: dma address align check
>
> 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@...gic.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.
>
Is it ? I am not aware about such calculation.
Is pci_alloc_consistent guarantee to give PAGE align dma address ?
-Amit
Powered by blists - more mailing lists