net: add eth_addr_inc in etherdevice.h
Subsystems (2)
PATCH 1/2 net: add eth_addr_inc in etherdevice.h
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.
--- include/linux/etherdevice.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)
include/linux/etherdevice.h +13 -0
@@ -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
Signature · 1 line
2.17.1
Quoted 5 lines · Tao Ren
Add
eth_addr_incfunction inetherdevice.hto 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 <[email protected]>
Please squash this patch with the next one, IMHO they form a single logical change together.
Quoted 8 lines
include/linux/etherdevice.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)include/linux/etherdevice.h +0
-0
include/linux/etherdevice.h static inline void eth_addr_dec(u8 *addr) · line 454
Quoted 7 lines
include/linux/etherdevice.h +4
-0@@ -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
Please see: Documentation/doc-guide/kernel-doc.rst
Here we need:
- "()" after function name;
- no extra line between function name and argument description.
Quoted 12 lines
include/linux/etherdevice.h +9
-0+*/ +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
Quoted 9 lines · Jakub Kicinski
Quoted 5 lines · Tao Ren
Add
eth_addr_incfunction inetherdevice.hto 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 <[email protected]>Please squash this patch with the next one, IMHO they form a single logical change together.
Sure. Will send out updated patch soon.
Quoted 18 lines
Quoted 8 lines
include/linux/etherdevice.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)include/linux/etherdevice.h +0
-0include/linux/etherdevice.h static inline void eth_addr_dec(u8 *addr) · line 454
Quoted 7 lines
include/linux/etherdevice.h +4
-0@@ -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 Please see:
Documentation/doc-guide/kernel-doc.rst
Quoted 3 lines
Here we need:
- "()" after function name;
- no extra line between function name and argument description.
Thank you for pointing it out (I didn't know the doc-guide). Given I copied the function comment from eth_addr_dec(), I will also fix the format for eth_addr_eth() then.
BTW, "()" is missing from all the other functions' comment in etherdevice.h, so maybe we should fix that in a separate patch?
Thanks,
- Tao
Quoted 9 lines · Tao Ren
Quoted 5 lines
Please see:
Documentation/doc-guide/kernel-doc.rstHere we need:
- "()" after function name;
- no extra line between function name and argument description.Thank you for pointing it out (I didn't know the doc-guide). Given I copied the function comment from
eth_addr_dec(), I will also fix the format foreth_addr_eth()then.BTW, "()" is missing from all the other functions' comment in
etherdevice.h, so maybe we should fix that in a separate patch?
Possibly, I'm just trying to make sure the new stuff we add follows the official guidelines :) For the old stuff we need to way it with potential merge conflicts and muddied git history so the case is not as clear cut.