netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Schmidt <mschmidt@redhat.com>
To: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>,
	Yuval Mintz <Yuval.Mintz@qlogic.com>
Cc: David Miller <davem@davemloft.net>,
	"LinoSanfilippo@gmx.de" <LinoSanfilippo@gmx.de>,
	Ariel Elior <Ariel.Elior@qlogic.com>,
	netdev <netdev@vger.kernel.org>,
	"cascardo@cascardo.eti.br" <cascardo@cascardo.eti.br>,
	"brking@linux.vnet.ibm.com" <brking@linux.vnet.ibm.com>
Subject: Re: [PATCH v4] bnx2x: Alloc 4k fragment for each rx ring buffer element
Date: Wed, 27 May 2015 10:59:45 +0200	[thread overview]
Message-ID: <55658781.8060104@redhat.com> (raw)
In-Reply-To: <87wq02t6ce.fsf_-_@dhcp-9-18-235-171.br.ibm.com>

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

  parent reply	other threads:[~2015-05-27  8:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-24 20:45 [PATCH v2] bnx2x: Alloc 4k fragment for each rx ring buffer element Gabriel Krisman Bertazi
2015-04-24 23:24 ` Lino Sanfilippo
2015-04-29 13:30   ` Gabriel Krisman Bertazi
2015-04-30 11:25     ` Yuval Mintz
2015-04-30 20:05       ` David Miller
2015-05-04 19:32         ` [PATCH v3] " Gabriel Krisman Bertazi
2015-05-04 19:58           ` Yuval Mintz
2015-05-15 20:43             ` Gabriel Krisman Bertazi
2015-05-17  7:14               ` Yuval Mintz
2015-05-21 13:20             ` [PATCH v4] " Gabriel Krisman Bertazi
2015-05-23 10:04               ` Yuval Mintz
2015-05-23 11:14               ` Lino Sanfilippo
2015-05-27  8:59               ` Michal Schmidt [this message]
2015-05-27 16:51                 ` [PATCH] " Gabriel Krisman Bertazi
2015-06-01 22:57                   ` David Miller
2015-05-28  7:24                 ` [PATCH v4] " Yuval Mintz
2015-05-28 13:26                   ` Gabriel Krisman Bertazi

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=55658781.8060104@redhat.com \
    --to=mschmidt@redhat.com \
    --cc=Ariel.Elior@qlogic.com \
    --cc=LinoSanfilippo@gmx.de \
    --cc=Yuval.Mintz@qlogic.com \
    --cc=brking@linux.vnet.ibm.com \
    --cc=cascardo@cascardo.eti.br \
    --cc=davem@davemloft.net \
    --cc=krisman@linux.vnet.ibm.com \
    --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;
as well as URLs for NNTP newsgroup(s).