diff mbox series

[net-next,3/3] octeontx2-af: Remove redundant functions rvu_npc_exact_mac2u64()

Message ID 20230808114504.4036008-4-lizetao1@huawei.com (mailing list archive)
State Accepted
Commit 47f8dc0938e95fc98bd1a61d49717c892eb5f9f7
Delegated to: Netdev Maintainers
Headers show
Series Remove redundant functions and use generic functions | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 9 this patch: 9
netdev/cc_maintainers success CCed 11 of 11 maintainers
netdev/build_clang success Errors and warnings before: 1353 this patch: 1353
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1353 this patch: 1353
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 38 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

lizetao Aug. 8, 2023, 11:45 a.m. UTC
The rvu_npc_exact_mac2u64() is used to convert an Ethernet MAC address
into a u64 value, as this is exactly what ether_addr_to_u64() does.
Use ether_addr_to_u64() to replace the rvu_npc_exact_mac2u64().

Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
 .../marvell/octeontx2/af/rvu_npc_hash.c       | 20 ++-----------------
 1 file changed, 2 insertions(+), 18 deletions(-)

Comments

Geethasowjanya Akula Aug. 9, 2023, 3:31 a.m. UTC | #1
> -----Original Message-----
> From: Li Zetao <lizetao1@huawei.com>
> Sent: Tuesday, August 8, 2023 5:15 PM
> To: Sunil Kovvuri Goutham <sgoutham@marvell.com>; Linu Cherian
> <lcherian@marvell.com>; Geethasowjanya Akula <gakula@marvell.com>;
> Jerin Jacob Kollanukkaran <jerinj@marvell.com>; Hariprasad Kelam
> <hkelam@marvell.com>; Subbaraya Sundeep Bhatta
> <sbhatta@marvell.com>; davem@davemloft.net; edumazet@google.com;
> kuba@kernel.org; pabeni@redhat.com
> Cc: lizetao1@huawei.com; netdev@vger.kernel.org
> Subject: [EXT] [PATCH net-next 3/3] octeontx2-af: Remove redundant
> functions rvu_npc_exact_mac2u64()
> 
> External Email
> 
> ----------------------------------------------------------------------
> The rvu_npc_exact_mac2u64() is used to convert an Ethernet MAC address
> into a u64 value, as this is exactly what ether_addr_to_u64() does.
> Use ether_addr_to_u64() to replace the rvu_npc_exact_mac2u64().
> 
> Signed-off-by: Li Zetao <lizetao1@huawei.com>
> ---
>  .../marvell/octeontx2/af/rvu_npc_hash.c       | 20 ++-----------------
>  1 file changed, 2 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c
> b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c
> index 7e20282c12d0..d2661e7fabdb 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c
> @@ -390,22 +390,6 @@ int
> rvu_mbox_handler_npc_get_field_hash_info(struct rvu *rvu,
>  	return 0;
>  }
> 
> -/**
> - *	rvu_npc_exact_mac2u64 - utility function to convert mac address to
> u64.
> - *	@mac_addr: MAC address.
> - *	Return: mdata for exact match table.
> - */
> -static u64 rvu_npc_exact_mac2u64(u8 *mac_addr) -{
> -	u64 mac = 0;
> -	int index;
> -
> -	for (index = ETH_ALEN - 1; index >= 0; index--)
> -		mac |= ((u64)*mac_addr++) << (8 * index);
> -
> -	return mac;
> -}
> -
>  /**
>   *	rvu_exact_prepare_mdata - Make mdata for mcam entry
>   *	@mac: MAC address
> @@ -416,7 +400,7 @@ static u64 rvu_npc_exact_mac2u64(u8 *mac_addr)
>   */
>  static u64 rvu_exact_prepare_mdata(u8 *mac, u16 chan, u16 ctype, u64
> mask)  {
> -	u64 ldata = rvu_npc_exact_mac2u64(mac);
> +	u64 ldata = ether_addr_to_u64(mac);
> 
>  	/* Please note that mask is 48bit which excludes chan and ctype.
>  	 * Increase mask bits if we need to include them as well.
> @@ -604,7 +588,7 @@ static u64 rvu_exact_prepare_table_entry(struct rvu
> *rvu, bool enable,
>  					 u8 ctype, u16 chan, u8 *mac_addr)
> 
>  {
> -	u64 ldata = rvu_npc_exact_mac2u64(mac_addr);
> +	u64 ldata = ether_addr_to_u64(mac_addr);
> 
>  	/* Enable or disable */
>  	u64 mdata = FIELD_PREP(GENMASK_ULL(63, 63), enable ? 1 : 0);
> --
> 2.34.1
Ack. Thanks for the patch.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c
index 7e20282c12d0..d2661e7fabdb 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c
@@ -390,22 +390,6 @@  int rvu_mbox_handler_npc_get_field_hash_info(struct rvu *rvu,
 	return 0;
 }
 
-/**
- *	rvu_npc_exact_mac2u64 - utility function to convert mac address to u64.
- *	@mac_addr: MAC address.
- *	Return: mdata for exact match table.
- */
-static u64 rvu_npc_exact_mac2u64(u8 *mac_addr)
-{
-	u64 mac = 0;
-	int index;
-
-	for (index = ETH_ALEN - 1; index >= 0; index--)
-		mac |= ((u64)*mac_addr++) << (8 * index);
-
-	return mac;
-}
-
 /**
  *	rvu_exact_prepare_mdata - Make mdata for mcam entry
  *	@mac: MAC address
@@ -416,7 +400,7 @@  static u64 rvu_npc_exact_mac2u64(u8 *mac_addr)
  */
 static u64 rvu_exact_prepare_mdata(u8 *mac, u16 chan, u16 ctype, u64 mask)
 {
-	u64 ldata = rvu_npc_exact_mac2u64(mac);
+	u64 ldata = ether_addr_to_u64(mac);
 
 	/* Please note that mask is 48bit which excludes chan and ctype.
 	 * Increase mask bits if we need to include them as well.
@@ -604,7 +588,7 @@  static u64 rvu_exact_prepare_table_entry(struct rvu *rvu, bool enable,
 					 u8 ctype, u16 chan, u8 *mac_addr)
 
 {
-	u64 ldata = rvu_npc_exact_mac2u64(mac_addr);
+	u64 ldata = ether_addr_to_u64(mac_addr);
 
 	/* Enable or disable */
 	u64 mdata = FIELD_PREP(GENMASK_ULL(63, 63), enable ? 1 : 0);