All of lore.kernel.org
 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; 7+ messages in thread
From: Tao Ren @ 2019-04-23 22:41 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] 7+ messages in thread

* Re: [PATCH net 1/2] net: add eth_addr_inc in etherdevice.h
  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
  0 siblings, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2019-04-23 23:15 UTC (permalink / raw)
  To: Tao Ren
  Cc: David S . Miller, Maxim Mikityanskiy, Bartosz Golaszewski,
	netdev, linux-kernel, Samuel Mendoza-Jonas, Joel Stanley,
	Andrew Jeffery, openbmc

On Tue, 23 Apr 2019 22:41:56 +0000, Tao Ren wrote:
> 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>

Please squash this patch with the next one, IMHO they form a single
logical change together.

>  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

Please see:  Documentation/doc-guide/kernel-doc.rst

Here we need:
 - "()" after function name;
 - no extra line between function name and argument description.

> + */
> +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


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

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

On Tue, 23 Apr 2019 22:41:56 +0000, Tao Ren wrote:
> 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>

Please squash this patch with the next one, IMHO they form a single
logical change together.

>  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

Please see:  Documentation/doc-guide/kernel-doc.rst

Here we need:
 - "()" after function name;
 - no extra line between function name and argument description.

> + */
> +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

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

* Re: [PATCH net 1/2] net: add eth_addr_inc in etherdevice.h
  2019-04-23 23:15   ` Jakub Kicinski
  (?)
@ 2019-04-24  0:59   ` Tao Ren
  2019-04-24  1:25       ` Jakub Kicinski
  -1 siblings, 1 reply; 7+ messages in thread
From: Tao Ren @ 2019-04-24  0:59 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: David S . Miller, Maxim Mikityanskiy, Bartosz Golaszewski,
	netdev, linux-kernel, Samuel Mendoza-Jonas, Joel Stanley,
	Andrew Jeffery, openbmc

On 4/23/19 4:15 PM, Jakub Kicinski wrote:
> On Tue, 23 Apr 2019 22:41:56 +0000, Tao Ren wrote:
>> 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>
> 
> Please squash this patch with the next one, IMHO they form a single
> logical change together.

Sure. Will send out updated patch soon.

>>  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
> 
> Please see:  Documentation/doc-guide/kernel-doc.rst
> 
> 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

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

* Re: [PATCH net 1/2] net: add eth_addr_inc in etherdevice.h
  2019-04-24  0:59   ` Tao Ren
@ 2019-04-24  1:25       ` Jakub Kicinski
  0 siblings, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2019-04-24  1:24 UTC (permalink / raw)
  To: Tao Ren
  Cc: David S . Miller, Maxim Mikityanskiy, Bartosz Golaszewski,
	netdev, linux-kernel, Samuel Mendoza-Jonas, Joel Stanley,
	Andrew Jeffery, openbmc

On Wed, 24 Apr 2019 00:59:52 +0000, Tao Ren wrote:
> > Please see:  Documentation/doc-guide/kernel-doc.rst
> > 
> > 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?

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.

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

* Re: [PATCH net 1/2] net: add eth_addr_inc in etherdevice.h
@ 2019-04-24  1:25       ` Jakub Kicinski
  0 siblings, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2019-04-24  1:25 UTC (permalink / raw)
  To: Tao Ren
  Cc: David S . Miller, Maxim Mikityanskiy, Bartosz Golaszewski,
	netdev, linux-kernel, Samuel Mendoza-Jonas, Joel Stanley,
	Andrew Jeffery, openbmc

On Wed, 24 Apr 2019 00:59:52 +0000, Tao Ren wrote:
> > Please see:  Documentation/doc-guide/kernel-doc.rst
> > 
> > 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?

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.

^ permalink raw reply	[flat|nested] 7+ 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; 7+ 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] 7+ messages in thread

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

Thread overview: 7+ 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-23 23:15   ` Jakub Kicinski
2019-04-24  0:59   ` Tao Ren
2019-04-24  1:24     ` Jakub Kicinski
2019-04-24  1:25       ` Jakub Kicinski
  -- strict thread matches above, loose matches on Subject: below --
2019-04-23 21:20 Tao Ren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.