Message ID | 20220825214423.903672-2-michael@walle.cc (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | nvmem: core: introduce NVMEM layouts | expand |
Hi netdev maintainers, Am 2022-08-25 23:44, schrieb Michael Walle: > Add a helper to add an offset to a ethernet address. This comes in > handy > if you have a base ethernet address for multiple interfaces. > > Signed-off-by: Michael Walle <michael@walle.cc> Would it be possible to get an Ack for this patch, so I don't have to repost this large (and still growing) series to netdev every time? I guess it would be ok to have this go through another tree? -michael
On Thu, Sep 01, 2022 at 06:26:39PM +0200, Michael Walle wrote: > Hi netdev maintainers, > > Am 2022-08-25 23:44, schrieb Michael Walle: > > Add a helper to add an offset to a ethernet address. This comes in handy > > if you have a base ethernet address for multiple interfaces. > > > > Signed-off-by: Michael Walle <michael@walle.cc> > > Would it be possible to get an Ack for this patch, so I don't have > to repost this large (and still growing) series to netdev every time? Looks O.K. to me Reviewed-by: Andrew Lunn <andrew@lunn.ch>
On Thu, 01 Sep 2022 18:26:39 +0200 Michael Walle wrote: > Am 2022-08-25 23:44, schrieb Michael Walle: > > Add a helper to add an offset to a ethernet address. This comes in > > handy > > if you have a base ethernet address for multiple interfaces. > > > > Signed-off-by: Michael Walle <michael@walle.cc> > > Would it be possible to get an Ack for this patch, so I don't have > to repost this large (and still growing) series to netdev every time? > > I guess it would be ok to have this go through another tree? Andrew's ack is strong enough, but in case there's any doubt: Acked-by: Jakub Kicinski <kuba@kernel.org>
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index 92b10e67d5f8..d1be5ca4d5cb 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h @@ -485,6 +485,20 @@ static inline void eth_addr_inc(u8 *addr) u64_to_ether_addr(u, addr); } +/** + * eth_addr_add() - Add (or subtract) and offset to/from the given MAC address. + * + * @offset: Offset to add. + * @addr: Pointer to a six-byte array containing Ethernet address to increment. + */ +static inline void eth_addr_add(u8 *addr, long offset) +{ + u64 u = ether_addr_to_u64(addr); + + u += offset; + u64_to_ether_addr(u, addr); +} + /** * is_etherdev_addr - Tell if given Ethernet address belongs to the device. * @dev: Pointer to a device structure
Add a helper to add an offset to a ethernet address. This comes in handy if you have a base ethernet address for multiple interfaces. Signed-off-by: Michael Walle <michael@walle.cc> --- include/linux/etherdevice.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)