netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yuval Shaia <yuval.shaia@oracle.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: benve@cisco.com, dgoodell@cisco.com, dledford@redhat.com,
	sean.hefty@intel.com, hal.rosenstock@gmail.com,
	monis@mellanox.com, davem@davemloft.net,
	linux-rdma@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH v2] {net,IB}/{rxe,usnic}: Utilize generic mac to eui32 function
Date: Tue, 7 Mar 2017 20:37:10 +0200	[thread overview]
Message-ID: <20170307183709.GA9094@yuval-lap> (raw)
In-Reply-To: <20170307142711.GS14379@mtr-leonro.local>

On Tue, Mar 07, 2017 at 04:27:11PM +0200, Leon Romanovsky wrote:
> On Mon, Mar 06, 2017 at 08:54:06PM +0200, Yuval Shaia wrote:
> > This logic seems to be duplicated in (at least) three separate files.
> > Move it to one place so code can be re-use.
> >
> > Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
> > ---
> > v0 -> v1:
> > 	* Add missing #include
> > 	* Rename to genaddrconf_ifid_eui48
> > v1 -> v2:
> > 	* Reset eui[0] to default if dev_id is used
> > ---
> >  drivers/infiniband/hw/usnic/usnic_common_util.h | 11 +++--------
> >  drivers/infiniband/sw/rxe/rxe_net.c             | 11 ++---------
> >  include/net/addrconf.h                          | 19 +++++++++++++------
> >  3 files changed, 18 insertions(+), 23 deletions(-)
> >
> >  	 * scope according to RFC2373.
> >  	 */
> >  	if (dev->dev_id) {
> > +		eui[0] = dev->dev_addr[0];
> >  		eui[3] = (dev->dev_id >> 8) & 0xFF;
> >  		eui[4] = dev->dev_id & 0xFF;
> > -	} else {
> > -		eui[3] = 0xFF;
> > -		eui[4] = 0xFE;
> > -		eui[0] ^= 2;
> >  	}
> > +
> >  	return 0;
> >  }
> 
> Technically, the code is correct now, but it doesn't look right
> to set the value and restore it right after that.

Agree.
I will soon send v3 that offers an alternative by adding new helper
function so this re-assignment can be avoid.

> 
> Thanks
> 
> >
> > --
> > 2.7.4
> >

      reply	other threads:[~2017-03-07 19:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-06 18:54 [PATCH v2] {net,IB}/{rxe,usnic}: Utilize generic mac to eui32 function Yuval Shaia
2017-03-07 14:27 ` Leon Romanovsky
2017-03-07 18:37   ` Yuval Shaia [this message]

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=20170307183709.GA9094@yuval-lap \
    --to=yuval.shaia@oracle.com \
    --cc=benve@cisco.com \
    --cc=davem@davemloft.net \
    --cc=dgoodell@cisco.com \
    --cc=dledford@redhat.com \
    --cc=hal.rosenstock@gmail.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=monis@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=sean.hefty@intel.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).