netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 1/2] net: add eth_addr_inc in etherdevice.h
@ 2019-04-23 22:41 Tao Ren
  2019-04-23 23:15 ` Jakub Kicinski
  0 siblings, 1 reply; 5+ messages in thread
From: Tao Ren @ 2019-04-23 22:41 UTC (permalink / raw)
  To: David S . Miller, Maxim Mikityanskiy, Bartosz Golaszewski,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jakub Kicinski, Samuel Mendoza-Jonas, Joel Stanley,
	Andrew Jeffery, openbmc@lists.ozlabs.org
  Cc: Tao Ren

Add eth_addr_inc function in etherdevice.h to increment MAC address. One
of the use cases is in ncsi stack, where the host's MAC address needs to
be incremented to get BMC's MAC address.

Signed-off-by: Tao Ren <taoren@fb.com>
---
 include/linux/etherdevice.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index e2f3b21cd72a..d48e3a724c54 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -448,6 +448,19 @@ static inline void eth_addr_dec(u8 *addr)
 	u64_to_ether_addr(u, addr);
 }
 
+/**
+ * eth_addr_inc - Increment the given MAC address
+ *
+ * @addr: Pointer to a six-byte array containing Ethernet address to increment
+ */
+static inline void eth_addr_inc(u8 *addr)
+{
+	u64 u = ether_addr_to_u64(addr);
+
+	u++;
+	u64_to_ether_addr(u, addr);
+}
+
 /**
  * is_etherdev_addr - Tell if given Ethernet address belongs to the device.
  * @dev: Pointer to a device structure
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH net 1/2] net: add eth_addr_inc in etherdevice.h
@ 2019-04-23 21:20 Tao Ren
  0 siblings, 0 replies; 5+ messages in thread
From: Tao Ren @ 2019-04-23 21:20 UTC (permalink / raw)
  To: David S . Miller, Maxim Mikityanskiy, Bartosz Golaszewski, netdev,
	linux-kernel, Jakub Kicinski, Samuel Mendoza-Jonas, Joel Stanley,
	Andrew Jeffery, openbmc
  Cc: Tao Ren

Add eth_addr_inc function in etherdevice.h to increment MAC address. One
of the use cases is in ncsi stack, where the host's MAC address needs to
be incremented to get BMC's MAC address.

Signed-off-by: Tao Ren <taoren@fb.com>
---
 include/linux/etherdevice.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index e2f3b21cd72a..d48e3a724c54 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -448,6 +448,19 @@ static inline void eth_addr_dec(u8 *addr)
 	u64_to_ether_addr(u, addr);
 }
 
+/**
+ * eth_addr_inc - Increment the given MAC address
+ *
+ * @addr: Pointer to a six-byte array containing Ethernet address to increment
+ */
+static inline void eth_addr_inc(u8 *addr)
+{
+	u64 u = ether_addr_to_u64(addr);
+
+	u++;
+	u64_to_ether_addr(u, addr);
+}
+
 /**
  * is_etherdev_addr - Tell if given Ethernet address belongs to the device.
  * @dev: Pointer to a device structure
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-04-24  8:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-23 22:41 [PATCH net 1/2] net: add eth_addr_inc in etherdevice.h Tao Ren
2019-04-23 23:15 ` Jakub Kicinski
2019-04-24  0:59   ` Tao Ren
2019-04-24  1:24     ` Jakub Kicinski
  -- strict thread matches above, loose matches on Subject: below --
2019-04-23 21:20 Tao Ren

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).