Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Jun 2016 10:17:19 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r301264 - stable/10/sys/ofed/include/linux
Message-ID:  <201606031017.u53AHJoG054817@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Fri Jun  3 10:17:19 2016
New Revision: 301264
URL: https://svnweb.freebsd.org/changeset/base/301264

Log:
  MFC r294832:
  Implement ether_addr_equal(), ether_addr_equal_64bits() and
  random_ether_addr() for the LinuxKPI.
  
  Sponsored by:	Mellanox Technologies

Modified:
  stable/10/sys/ofed/include/linux/etherdevice.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ofed/include/linux/etherdevice.h
==============================================================================
--- stable/10/sys/ofed/include/linux/etherdevice.h	Fri Jun  3 10:13:18 2016	(r301263)
+++ stable/10/sys/ofed/include/linux/etherdevice.h	Fri Jun  3 10:17:19 2016	(r301264)
@@ -37,6 +37,9 @@
 
 #include <linux/types.h>
 
+#include <sys/random.h>
+#include <sys/libkern.h>
+
 #define	ETH_MODULE_SFF_8079		1
 #define	ETH_MODULE_SFF_8079_LEN		256
 #define	ETH_MODULE_SFF_8472		2
@@ -113,4 +116,31 @@ static inline void ether_addr_copy(u8 *d
 	memcpy(dst, src, 6);
 }
 
+static inline bool
+ether_addr_equal(const u8 *pa, const u8 *pb)
+{
+	return (memcmp(pa, pb, 6) == 0);
+}
+
+static inline bool
+ether_addr_equal_64bits(const u8 *pa, const u8 *pb)
+{
+	return (memcmp(pa, pb, 6) == 0);
+}
+
+static inline void
+eth_broadcast_addr(u8 *pa)
+{
+	memset(pa, 0xff, 6);
+}
+
+static inline void
+random_ether_addr(u8 * dst)
+{
+	read_random(dst, 6);
+
+	dst[0] &= 0xfe;
+	dst[0] |= 0x02;
+}
+
 #endif /* _LINUX_ETHERDEVICE */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606031017.u53AHJoG054817>