From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Rapoport Date: Wed, 08 Aug 2007 08:35:55 +0300 Subject: [U-Boot-Users] [PATCH] Add ability to take MAC address from the environment to DM9000 driver In-Reply-To: <46B898D3.40107@qstreams.com> References: <46B84A47.3030908@compulab.co.il> <46B898D3.40107@qstreams.com> Message-ID: <46B9563B.1010807@compulab.co.il> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Ben Warren wrote: > Hi Mike, > > Mike Rapoport wrote: >> + s = getenv ("ethaddr"); >> > Could this ever be other than the first Ethernet controller on a board? > If so, 'ethaddr' won't cut it. If a board has more than one DM9000, the driver in its current state does not support it anyway. >> + for (i = 0; i < 6; ++i) { >> + } >> > While this is probably fine, it looks scary to me. My little brain is > going to need a few more passes... >> + >> printf("MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", bd->bi_enetaddr[0], >> bd->bi_enetaddr[1], bd->bi_enetaddr[2], bd->bi_enetaddr[3], >> bd->bi_enetaddr[4], bd->bi_enetaddr[5]); >> +/** >> + * 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(const u8 *addr) >> +{ >> > Please choose a better name for this function. While multicast addresses > are poor choices for source, they're perfectly fine for destination. What about 'is_valid_ether_src_addr'? > thanks, > Ben > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > U-Boot-Users mailing list > U-Boot-Users at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/u-boot-users > -- Sincerely yours, Mike.