netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Chan" <mchan@broadcom.com>
To: "Stephen Hemminger" <shemminger@vyatta.com>
Cc: "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: Thu, 9 Jun 2011 18:08:00 -0700	[thread overview]
Message-ID: <1307668080.14980.13.camel@HP1> (raw)
In-Reply-To: <20110609082722.492b46b5@nehalam.ftrdhcpuser.net>


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.



  reply	other threads:[~2011-06-10  1:14 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 [this message]
2011-06-10  4:01         ` Stephen Hemminger
2011-06-10  4:39           ` Eric Dumazet
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=1307668080.14980.13.camel@HP1 \
    --to=mchan@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=eddie.wai@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;
as well as URLs for NNTP newsgroup(s).