public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: Michael Chan <mchan@broadcom.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Eddie Wai <eddie.wai@broadcom.com>
Subject: Re: [PATCH 3/5 net-next] cnic: Randomize initial TCP port for iSCSI connections
Date: Fri, 10 Jun 2011 06:39:27 +0200	[thread overview]
Message-ID: <1307680767.3210.5.camel@edumazet-laptop> (raw)
In-Reply-To: <20110609210157.6a1f016b@nehalam.ftrdhcpuser.net>

Le jeudi 09 juin 2011 à 21:01 -0700, Stephen Hemminger a écrit :
> On Thu, 9 Jun 2011 18:08:00 -0700
> "Michael Chan" <mchan@broadcom.com> wrote:
> 
> > 
> > On Thu, 2011-06-09 at 08:27 -0700, Stephen Hemminger wrote:
> > > On Wed, 8 Jun 2011 22:29:34 -0700
> > > "Michael Chan" <mchan@broadcom.com> wrote:
> > > 
> > > >  static int cnic_cm_alloc_mem(struct cnic_dev *dev)
> > > >  {
> > > >  	struct cnic_local *cp = dev->cnic_priv;
> > > > +	u32 port_id;
> > > >  
> > > >  	cp->csk_tbl = kzalloc(sizeof(struct cnic_sock) * MAX_CM_SK_TBL_SZ,
> > > >  			      GFP_KERNEL);
> > > >  	if (!cp->csk_tbl)
> > > >  		return -ENOMEM;
> > > >  
> > > > +	get_random_bytes(&port_id, sizeof(port_id));
> > > 
> > > I think random32() or it's alias net_random() would be sufficient
> > > for your needs here.
> > > 
> > 
> > random32() is pseudo random so we can get the same number after reboot,
> > right?  One scenario is that we may be booting from an iSCSI target, but
> > due to some failure, the user may be rebooting multiple times rapidly.
> > We want to use a different port during each boot.
> 
> random32 is seeded off get_random_bytes at boot.

cnic_cm_alloc_mem() is apparently called one time per boot, it seems OK
to call get_random_bytes() in this case ?




  reply	other threads:[~2011-06-10  4:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-09  5:29 [PATCH 1/5 net-next] cnic: Fix interrupt logic Michael Chan
2011-06-09  5:29 ` [PATCH 2/5 net-next] cnic: Fix race conditions with firmware Michael Chan
2011-06-09  5:29   ` [PATCH 3/5 net-next] cnic: Randomize initial TCP port for iSCSI connections Michael Chan
2011-06-09  5:29     ` [PATCH 4/5 net-next] cnic: Improve NETDEV_UP event handling Michael Chan
2011-06-09  5:29       ` [PATCH 5/5 net-next] cnic, bnx2: Check iSCSI support early in bnx2_init_one() Michael Chan
2011-06-09  6:53         ` David Miller
2011-06-09 10:42         ` Neil Horman
2011-06-10  0:37           ` Michael Chan
2011-06-09  6:53       ` [PATCH 4/5 net-next] cnic: Improve NETDEV_UP event handling David Miller
2011-06-09  6:53     ` [PATCH 3/5 net-next] cnic: Randomize initial TCP port for iSCSI connections David Miller
2011-06-09 15:27     ` Stephen Hemminger
2011-06-10  1:08       ` Michael Chan
2011-06-10  4:01         ` Stephen Hemminger
2011-06-10  4:39           ` Eric Dumazet [this message]
2011-06-10  6:25           ` Michael Chan
2011-06-09  6:53   ` [PATCH 2/5 net-next] cnic: Fix race conditions with firmware David Miller
2011-06-09  6:52 ` [PATCH 1/5 net-next] cnic: Fix interrupt logic 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=1307680767.3210.5.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=eddie.wai@broadcom.com \
    --cc=mchan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox