mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/3] introduce helper to generate mac address with OUI
Date: Fri, 20 Sep 2013 09:44:12 +0200	[thread overview]
Message-ID: <20130920074412.GE1137@ns203013.ovh.net> (raw)
In-Reply-To: <20130920070436.GD30088@pengutronix.de>

On 09:04 Fri 20 Sep     , Sascha Hauer wrote:
> On Fri, Sep 20, 2013 at 07:47:43AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > use random mac address with fixed OUI provided
> > 
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> >  include/local_mac_address.h | 40 ++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 40 insertions(+)
> >  create mode 100644 include/local_mac_address.h
> > 
> > diff --git a/include/local_mac_address.h b/include/local_mac_address.h
> > new file mode 100644
> > index 0000000..3920334
> > --- /dev/null
> > +++ b/include/local_mac_address.h
> > @@ -0,0 +1,40 @@
> > +/*
> > + * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com>
> > + *
> > + * Under GPLv2 only
> > + */
> > +
> > +#ifndef __LOCAL_MAC_ADDRESS_H__
> > +#define __LOCAL_MAC_ADDRESS_H__
> > +
> > +/**
> > + * local_mac_address_register - use random number with fix
> > + * OUI provided device to provide an Ethernet address
> > + * @ethid: ethernet device id
> > + * @oui: Ethernet OUI (3 bytes)
> > + *
> > + * Generate a local Ethernet address (MAC) that is not multicast using a 1-wire id.
> > + */
> > +static inline int local_mac_address_register(int ethid, char * oui)
> > +{
> > +	char addr[6];
> > +	int nb_oui = 3;
> > +	int i;
> > +
> > +	if (!oui)
> > +		return -EINVAL;
> > +
> > +	random_ether_addr(addr);
> > +
> > +	for (i = 0; i < nb_oui; i++)
> > +		addr[i] = oui[i];
> 
> Shouldn't you rather use bytes 1-3 instead of 0-2?
> 
> > +
> > +	addr[0] &= 0xfe;	/* clear multicast bit */
> > +	addr[0] |= 0x02;	/* set local assignment bit (IEEE802) */
> 
> Otherwise the 'smf' you pass in becomes 'qmf' here.
yes it's righth and the same way when you use the 1-wire version

so can we keep it as is

Best Regards,
J.
> 
> Sascha
> 
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2013-09-20  7:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-20  5:46 [PATCH 0/3 v2] Animeo IP: macb support improvement Jean-Christophe PLAGNIOL-VILLARD
2013-09-20  5:47 ` [PATCH 1/3] introduce helper to generate mac address with OUI Jean-Christophe PLAGNIOL-VILLARD
2013-09-20  5:47   ` [PATCH 2/3] animeo_ip: ensure the phy is reset correctly Jean-Christophe PLAGNIOL-VILLARD
2013-09-23  4:38     ` Jean-Christophe PLAGNIOL-VILLARD
2013-09-23  6:42       ` Sascha Hauer
2013-09-20  5:47   ` [PATCH 3/3] animeo_ip: retrieve the mac from the macb and set private mac to asix Jean-Christophe PLAGNIOL-VILLARD
2013-09-20  7:04   ` [PATCH 1/3] introduce helper to generate mac address with OUI Sascha Hauer
2013-09-20  7:44     ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2013-09-22 18:28   ` Sascha Hauer
  -- strict thread matches above, loose matches on Subject: below --
2013-09-20  5:39 [PATCH 0/3] Animeo IP: macb support improvement Jean-Christophe PLAGNIOL-VILLARD
2013-09-20  5:40 ` [PATCH 1/3] introduce helper to generate mac address with OUI Jean-Christophe PLAGNIOL-VILLARD

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=20130920074412.GE1137@ns203013.ovh.net \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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