* [PATCH net-next] ethernet: s2io: Use ether_addr_to_u64() to convert ethernet address
@ 2023-08-08 11:38 Li Zetao
2023-08-09 14:54 ` Simon Horman
2023-08-09 22:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Li Zetao @ 2023-08-08 11:38 UTC (permalink / raw)
To: jdmason, davem, edumazet, kuba, pabeni; +Cc: lizetao1, netdev
Use ether_addr_to_u64() to convert an Ethernet address into a u64 value,
instead of directly calculating, as this is exactly what
this function does.
Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
drivers/net/ethernet/neterion/s2io.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c
index 700c05fb05b9..61d8bfd12d5f 100644
--- a/drivers/net/ethernet/neterion/s2io.c
+++ b/drivers/net/ethernet/neterion/s2io.c
@@ -5091,13 +5091,10 @@ static void do_s2io_restore_unicast_mc(struct s2io_nic *sp)
static int do_s2io_add_mc(struct s2io_nic *sp, u8 *addr)
{
int i;
- u64 mac_addr = 0;
+ u64 mac_addr;
struct config_param *config = &sp->config;
- for (i = 0; i < ETH_ALEN; i++) {
- mac_addr <<= 8;
- mac_addr |= addr[i];
- }
+ mac_addr = ether_addr_to_u64(addr);
if ((0ULL == mac_addr) || (mac_addr == S2IO_DISABLE_MAC_ENTRY))
return SUCCESS;
@@ -5220,7 +5217,7 @@ static int s2io_set_mac_addr(struct net_device *dev, void *p)
static int do_s2io_prog_unicast(struct net_device *dev, const u8 *addr)
{
struct s2io_nic *sp = netdev_priv(dev);
- register u64 mac_addr = 0, perm_addr = 0;
+ register u64 mac_addr, perm_addr;
int i;
u64 tmp64;
struct config_param *config = &sp->config;
@@ -5230,12 +5227,8 @@ static int do_s2io_prog_unicast(struct net_device *dev, const u8 *addr)
* change on the device address registered with the OS. It will be
* at offset 0.
*/
- for (i = 0; i < ETH_ALEN; i++) {
- mac_addr <<= 8;
- mac_addr |= addr[i];
- perm_addr <<= 8;
- perm_addr |= sp->def_mac_addr[0].mac_addr[i];
- }
+ mac_addr = ether_addr_to_u64(addr);
+ perm_addr = ether_addr_to_u64(sp->def_mac_addr[0].mac_addr);
/* check if the dev_addr is different than perm_addr */
if (mac_addr == perm_addr)
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] ethernet: s2io: Use ether_addr_to_u64() to convert ethernet address
2023-08-08 11:38 [PATCH net-next] ethernet: s2io: Use ether_addr_to_u64() to convert ethernet address Li Zetao
@ 2023-08-09 14:54 ` Simon Horman
2023-08-09 22:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2023-08-09 14:54 UTC (permalink / raw)
To: Li Zetao; +Cc: jdmason, davem, edumazet, kuba, pabeni, netdev
On Tue, Aug 08, 2023 at 07:38:49PM +0800, Li Zetao wrote:
> Use ether_addr_to_u64() to convert an Ethernet address into a u64 value,
> instead of directly calculating, as this is exactly what
> this function does.
>
> Signed-off-by: Li Zetao <lizetao1@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] ethernet: s2io: Use ether_addr_to_u64() to convert ethernet address
2023-08-08 11:38 [PATCH net-next] ethernet: s2io: Use ether_addr_to_u64() to convert ethernet address Li Zetao
2023-08-09 14:54 ` Simon Horman
@ 2023-08-09 22:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-08-09 22:40 UTC (permalink / raw)
To: Li Zetao; +Cc: jdmason, davem, edumazet, kuba, pabeni, netdev
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 8 Aug 2023 19:38:49 +0800 you wrote:
> Use ether_addr_to_u64() to convert an Ethernet address into a u64 value,
> instead of directly calculating, as this is exactly what
> this function does.
>
> Signed-off-by: Li Zetao <lizetao1@huawei.com>
> ---
> drivers/net/ethernet/neterion/s2io.c | 17 +++++------------
> 1 file changed, 5 insertions(+), 12 deletions(-)
Here is the summary with links:
- [net-next] ethernet: s2io: Use ether_addr_to_u64() to convert ethernet address
https://git.kernel.org/netdev/net-next/c/b77049f04ed1
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-09 22:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-08 11:38 [PATCH net-next] ethernet: s2io: Use ether_addr_to_u64() to convert ethernet address Li Zetao
2023-08-09 14:54 ` Simon Horman
2023-08-09 22:40 ` patchwork-bot+netdevbpf
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).