From: Tao Ren <taoren@fb.com>
To: "David S . Miller" <davem@davemloft.net>,
Maxim Mikityanskiy <maximmi@mellanox.com>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Jakub Kicinski <jakub.kicinski@netronome.com>,
Samuel Mendoza-Jonas <sam@mendozajonas.com>,
Joel Stanley <joel@jms.id.au>, Andrew Jeffery <andrew@aj.id.au>,
"openbmc@lists.ozlabs.org" <openbmc@lists.ozlabs.org>
Cc: Tao Ren <taoren@fb.com>
Subject: [PATCH net 1/2] net: add eth_addr_inc in etherdevice.h
Date: Tue, 23 Apr 2019 22:41:56 +0000 [thread overview]
Message-ID: <20190423224138.1295-1-taoren@fb.com> (raw)
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
next reply other threads:[~2019-04-23 22:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-23 22:41 Tao Ren [this message]
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
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=20190423224138.1295-1-taoren@fb.com \
--to=taoren@fb.com \
--cc=andrew@aj.id.au \
--cc=bgolaszewski@baylibre.com \
--cc=davem@davemloft.net \
--cc=jakub.kicinski@netronome.com \
--cc=joel@jms.id.au \
--cc=linux-kernel@vger.kernel.org \
--cc=maximmi@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=openbmc@lists.ozlabs.org \
--cc=sam@mendozajonas.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®