[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55658781.8060104@redhat.com>
Date: Wed, 27 May 2015 10:59:45 +0200
From: Michal Schmidt <mschmidt@...hat.com>
To: Gabriel Krisman Bertazi <krisman@...ux.vnet.ibm.com>,
Yuval Mintz <Yuval.Mintz@...gic.com>
CC: David Miller <davem@...emloft.net>,
"LinoSanfilippo@....de" <LinoSanfilippo@....de>,
Ariel Elior <Ariel.Elior@...gic.com>,
netdev <netdev@...r.kernel.org>,
"cascardo@...cardo.eti.br" <cascardo@...cardo.eti.br>,
"brking@...ux.vnet.ibm.com" <brking@...ux.vnet.ibm.com>
Subject: Re: [PATCH v4] bnx2x: Alloc 4k fragment for each rx ring buffer element
On 05/21/2015 03:20 PM, Gabriel Krisman Bertazi wrote:
> +#define SGE_PAGE_SHIFT 12
> +#define SGE_PAGE_SIZE (1 << SGE_PAGE_SHIFT)
...
> +struct bnx2x_alloc_pool {
> + struct page *page;
> + dma_addr_t dma;
> + u8 offset;
> + u8 frag_count;
> +};
...
> static int bnx2x_alloc_rx_sge(struct bnx2x *bp, struct bnx2x_fastpath *fp,
> u16 index, gfp_t gfp_mask)
> {
...
> + pool->offset += SGE_PAGE_SIZE;
> + pool->frag_count--;
> +
> return 0;
> }
One SGE_PAGE_SIZE is already bigger than representable by u8, so offset
will overflow.
Isn't storing both 'offset' and 'frag_count' redundant? There is a
simple linear relationship between the two.
Regards,
Michal
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists