All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eli Carter <eli.carter@inet.com>
To: Jeff Garzik <jgarzik@mandrakesoft.com>
Cc: Andrzej Krzysztofowicz <ankry@green.mif.pg.gda.pl>,
	Linus Torvalds <torvalds@transmeta.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] pcnet32 compilation fix for 2.4.3pre6
Date: Thu, 22 Mar 2001 09:10:47 -0600	[thread overview]
Message-ID: <3ABA15F7.6155F0EE@inet.com> (raw)
In-Reply-To: <200103220638.HAA16050@green.mif.pg.gda.pl> <3ABA00BB.A9C2DF1B@mandrakesoft.com> <3ABA0E89.D3D965B7@inet.com> <3ABA103A.CB07012D@mandrakesoft.com>

Jeff Garzik wrote:
> 
> Eli Carter wrote:
> > The "!(addr[0]&1)" part of the test already catches the ff's case, so
> > that is redundant.
> > Using 6 bytes instead of 7 is an improvement.
> 
> oops.  Thanks, updated patch attached.  My patch also adds inline source
> docs, and uses 'static inline' instead of 'static __inline__', two small
> style improvements.

Mmmm.... documentation.  Yummy.  ;)

When I submitted the original patch, someone wanted to add the ff's
check as well... to reduce the number of people who make that
suggestion, perhaps the comment should read:

+ * Check that the Ethernet address (MAC) is not a multicast address or 
+ * FF:FF:FF:FF:FF:FF (by checking addr[0]&1) and is not
00:00:00:00:00:00.
+ *

Does that make it clear that both cases are covered by the one test?

Hmm... I used __inline__ because the other function in the same
headerfile used it...  What is the difference between the two, and is
one depricated now?  (And what about in 2.2.x?)

Eli

>   ------------------------------------------------------------------------
> Index: include/linux/etherdevice.h
> ===================================================================
> RCS file: /cvsroot/gkernel/linux_2_4/include/linux/etherdevice.h,v
> retrieving revision 1.1.1.14.4.2
> diff -u -r1.1.1.14.4.2 etherdevice.h
> --- include/linux/etherdevice.h 2001/03/21 14:10:50     1.1.1.14.4.2
> +++ include/linux/etherdevice.h 2001/03/22 14:44:51
> @@ -46,6 +46,22 @@
>         memcpy (dest->data, src, len);
>  }
> 
> +/**
> + * is_valid_ether_addr - Determine if the given Ethernet address is valid
> + * @addr: Pointer to a six-byte array containing the Ethernet address
> + *
> + * Check that the Ethernet address (MAC) is not 00:00:00:00:00:00, is not
> + * a multicast address, and is not FF:FF:FF:FF:FF:FF.
> + *
> + * Return true if the address is valid.
> + */
> +static inline int is_valid_ether_addr( u8 *addr )
> +{
> +       const char zaddr[6] = {0,};
> +
> +       return !(addr[0]&1) && memcmp( addr, zaddr, 6);
> +}
> +
>  #endif
> 
>  #endif /* _LINUX_ETHERDEVICE_H */
-----------------------.           Rule of Accuracy: When working toward
Eli Carter             |            the solution of a problem, it always 
eli.carter(at)inet.com `------------------ helps if you know the answer.

  reply	other threads:[~2001-03-22 15:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-22  6:38 [PATCH] pcnet32 compilation fix for 2.4.3pre6 Andrzej Krzysztofowicz
2001-03-22 10:43 ` Jeff Garzik
2001-03-22 13:40 ` Jeff Garzik
2001-03-22 14:39   ` Eli Carter
2001-03-22 14:46     ` Jeff Garzik
2001-03-22 15:10       ` Eli Carter [this message]
2001-03-22 16:23         ` Jeff Garzik
2001-03-29 21:09         ` dank
2001-03-29 21:25           ` Ulrich Drepper
2001-03-29 21:29             ` Eli Carter
2001-03-29 22:55             ` Tom Leete
2001-03-30  9:36               ` Jeff Garzik
2001-03-22 14:49   ` Alan Cox

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=3ABA15F7.6155F0EE@inet.com \
    --to=eli.carter@inet.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=ankry@green.mif.pg.gda.pl \
    --cc=jgarzik@mandrakesoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.