linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] octeontx2-af: Fix compiler warnings.
@ 2022-07-06 13:02 Ratheesh Kannoth
  2022-07-07  1:24 ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Ratheesh Kannoth @ 2022-07-06 13:02 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: sgoutham, davem, edumazet, kuba, pabeni, kbuild-all,
	Ratheesh Kannoth, kernel test robot

Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c:388:5: warning: no previous prototype for 'rvu_exact_calculate_hash' [-Wmissing-prototypes]
388 | u32 rvu_exact_calculate_hash(struct rvu *rvu, u16 chan, u16 ctype, u8 *mac,
|     ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c: In function 'rvu_npc_exact_get_drop_rule_info':
>> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c:1080:14: warning: variable 'rc' set but not used [-Wunused-but-set-variable]
1080 |         bool rc;
|              ^~
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c: At top level:
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c:1248:5: warning: no previous prototype for 'rvu_npc_exact_add_table_entry' [-Wmissing-prototypes]
1248 | int rvu_npc_exact_add_table_entry(struct rvu *rvu, u8 cgx_id, u8 lmac_id, u8 *mac,
|     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c: In function 'rvu_npc_exact_add_table_entry':
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c:1254:33: warning: variable 'table' set but not used [-Wunused-but-set-variable]
1254 |         struct npc_exact_table *table;
|                                 ^~~~~
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c: At top level:
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c:1320:5: warning: no previous prototype for 'rvu_npc_exact_update_table_entry' [-Wmissing-prototypes]
1320 | int rvu_npc_exact_update_table_entry(struct rvu *rvu, u8 cgx_id, u8 lmac_id,
|     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
---
 .../marvell/octeontx2/af/rvu_npc_hash.c       | 29 ++++++++++---------
 1 file changed, 15 insertions(+), 14 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 d3e6f7887ded..61881a437783 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c
@@ -340,7 +340,7 @@ int rvu_mbox_handler_npc_get_secret_key(struct rvu *rvu,
 
 /**
  *	rvu_npc_exact_mac2u64 - utility function to convert mac address to u64.
- *	@macaddr: MAC address.
+ *	@mac_addr: MAC address.
  *	Returns mdata for exact match table.
  */
 static u64 rvu_npc_exact_mac2u64(u8 *mac_addr)
@@ -385,8 +385,8 @@ static u64 rvu_exact_prepare_mdata(u8 *mac, u16 chan, u16 ctype, u64 mask)
  *	@mask: HASH mask.
  *	@table_depth: Depth of table.
  */
-u32 rvu_exact_calculate_hash(struct rvu *rvu, u16 chan, u16 ctype, u8 *mac,
-			     u64 mask, u32 table_depth)
+static u32 rvu_exact_calculate_hash(struct rvu *rvu, u16 chan, u16 ctype, u8 *mac,
+				    u64 mask, u32 table_depth)
 {
 	struct npc_exact_table *table = rvu->hw->table;
 	u64 hash_key[2];
@@ -419,6 +419,7 @@ u32 rvu_exact_calculate_hash(struct rvu *rvu, u16 chan, u16 ctype, u8 *mac,
  *      @rvu: resource virtualization unit.
  *	@way: Indicate way to table.
  *	@index: Hash index to 4 way table.
+ *	@hash: Hash value.
  *
  *	Searches 4 way table using hash index. Returns 0 on success.
  */
@@ -565,6 +566,7 @@ static u64 rvu_exact_prepare_table_entry(struct rvu *rvu, bool enable,
 
 /**
  *	rvu_exact_config_secret_key - Configure secret key.
+ *	@rvu: Resource virtualization unit.
  *	Returns mdata for exact match table.
  */
 static void rvu_exact_config_secret_key(struct rvu *rvu)
@@ -584,6 +586,7 @@ static void rvu_exact_config_secret_key(struct rvu *rvu)
 
 /**
  *	rvu_exact_config_search_key - Configure search key
+ *	@rvu: Resource virtualization unit.
  *	Returns mdata for exact match table.
  */
 static void rvu_exact_config_search_key(struct rvu *rvu)
@@ -727,7 +730,7 @@ __rvu_npc_exact_find_entry_by_seq_id(struct rvu *rvu, u32 seq_id)
  *	@ways: MEM table ways.
  *	@index: Index in MEM/CAM table.
  *	@cgx_id: CGX identifier.
- *	@lamc_id: LMAC identifier.
+ *	@lmac_id: LMAC identifier.
  *	@mac_addr: MAC address.
  *	@chan: Channel number.
  *	@ctype: Channel Type.
@@ -933,8 +936,8 @@ static int rvu_npc_exact_alloc_table_entry(struct rvu *rvu,  char *mac, u16 chan
 	table = rvu->hw->table;
 
 	/* Check in 4-ways mem entry for free slote */
-	hash =  rvu_exact_calculate_hash(rvu, chan, ctype, mac, table->mem_table.mask,
-					 table->mem_table.depth);
+	hash = rvu_exact_calculate_hash(rvu, chan, ctype, mac, table->mem_table.mask,
+					table->mem_table.depth);
 	err = rvu_npc_exact_alloc_mem_table_entry(rvu, ways, index, hash);
 	if (!err) {
 		*opc_type = NPC_EXACT_OPC_MEM;
@@ -1089,6 +1092,8 @@ static bool rvu_npc_exact_get_drop_rule_info(struct rvu *rvu, u8 intf_type, u8 c
 
 	rc = rvu_npc_exact_calc_drop_rule_chan_and_mask(rvu, intf_type, cgx_id,
 							lmac_id, &chan_val, &chan_mask);
+	if (!rc)
+		return false;
 
 	for (i = 0; i < NPC_MCAM_DROP_RULE_MAX; i++) {
 		if (!table->drop_rule_map[i].valid)
@@ -1254,7 +1259,6 @@ static int rvu_npc_exact_add_table_entry(struct rvu *rvu, u8 cgx_id, u8 lmac_id,
 {
 	int blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NPC, 0);
 	enum npc_exact_opc_type opc_type;
-	struct npc_exact_table *table;
 	u32 drop_mcam_idx;
 	bool enable_cam;
 	u32 index;
@@ -1262,8 +1266,6 @@ static int rvu_npc_exact_add_table_entry(struct rvu *rvu, u8 cgx_id, u8 lmac_id,
 	int err;
 	u8 ways;
 
-	table = rvu->hw->table;
-
 	ctype = 0;
 
 	err = rvu_npc_exact_alloc_table_entry(rvu, mac, chan, ctype, &index, &ways, &opc_type);
@@ -1312,7 +1314,7 @@ static int rvu_npc_exact_add_table_entry(struct rvu *rvu, u8 cgx_id, u8 lmac_id,
  *      rvu_npc_exact_update_table_entry - Update exact match table.
  *      @rvu: resource virtualization unit.
  *	@cgx_id: CGX identifier.
- *	@lamc_id: LMAC identifier.
+ *	@lmac_id: LMAC identifier.
  *	@old_mac: Existing MAC address entry.
  *	@new_mac: New MAC address entry.
  *	@seq_id: Sequence identifier of the entry.
@@ -1347,9 +1349,9 @@ static int rvu_npc_exact_update_table_entry(struct rvu *rvu, u8 cgx_id, u8 lmac_
 	 * hash index, we cannot update the entry. Fail in these scenarios.
 	 */
 	if (entry->opc_type == NPC_EXACT_OPC_MEM) {
-		hash_index =  rvu_exact_calculate_hash(rvu, entry->chan, entry->ctype,
-						       new_mac, table->mem_table.mask,
-						       table->mem_table.depth);
+		hash_index = rvu_exact_calculate_hash(rvu, entry->chan, entry->ctype,
+						      new_mac, table->mem_table.mask,
+						      table->mem_table.depth);
 		if (hash_index != entry->index) {
 			dev_dbg(rvu->dev,
 				"%s: Update failed due to index mismatch(new=0x%x, old=%x)\n",
@@ -1771,7 +1773,6 @@ void rvu_npc_exact_reset(struct rvu *rvu, u16 pcifunc)
  *      @rvu: resource virtualization unit.
  *
  *	Initialize HW and SW resources to manage 4way-2K table and fully
-	u8 cgx_id, lmac_id;
  *	associative 32-entry mcam table.
  */
 int rvu_npc_exact_init(struct rvu *rvu)
-- 
2.25.1


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

* Re: [PATCH] octeontx2-af: Fix compiler warnings.
  2022-07-06 13:02 [PATCH] octeontx2-af: Fix compiler warnings Ratheesh Kannoth
@ 2022-07-07  1:24 ` Jakub Kicinski
  2022-07-07  4:51   ` [EXT] " Ratheesh Kannoth
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2022-07-07  1:24 UTC (permalink / raw)
  To: Ratheesh Kannoth
  Cc: netdev, linux-kernel, sgoutham, davem, edumazet, pabeni,
	kbuild-all, kernel test robot

On Wed, 6 Jul 2022 18:32:41 +0530 Ratheesh Kannoth wrote:
> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c:388:5: warning: no previous prototype for 'rvu_exact_calculate_hash' [-Wmissing-prototypes]
> 388 | u32 rvu_exact_calculate_hash(struct rvu *rvu, u16 chan, u16 ctype, u8 *mac,
> |     ^~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c: In function 'rvu_npc_exact_get_drop_rule_info':
> >> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c:1080:14: warning: variable 'rc' set but not used [-Wunused-but-set-variable]  
> 1080 |         bool rc;
> |              ^~
> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c: At top level:
> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c:1248:5: warning: no previous prototype for 'rvu_npc_exact_add_table_entry' [-Wmissing-prototypes]
> 1248 | int rvu_npc_exact_add_table_entry(struct rvu *rvu, u8 cgx_id, u8 lmac_id, u8 *mac,
> |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c: In function 'rvu_npc_exact_add_table_entry':
> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c:1254:33: warning: variable 'table' set but not used [-Wunused-but-set-variable]
> 1254 |         struct npc_exact_table *table;
> |                                 ^~~~~
> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c: At top level:
> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c:1320:5: warning: no previous prototype for 'rvu_npc_exact_update_table_entry' [-Wmissing-prototypes]
> 1320 | int rvu_npc_exact_update_table_entry(struct rvu *rvu, u8 cgx_id, u8 lmac_id,
> |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

There are also these warnings not fixed by the follow up:

In file included from ../drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c:14:
../drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h:15120:28: error: ‘npc_mkex_default’ defined but not used [-Werror=unused-variable]
15120 | static struct npc_mcam_kex npc_mkex_default = {
      |                            ^~~~~~~~~~~~~~~~
../drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h:15000:30: error: ‘npc_lt_defaults’ defined but not used [-Werror=unused-variable]
15000 | static struct npc_lt_def_cfg npc_lt_defaults = {
      |                              ^~~~~~~~~~~~~~~
../drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h:14901:31: error: ‘npc_kpu_profiles’ defined but not used [-Werror=unused-variable]
14901 | static struct npc_kpu_profile npc_kpu_profiles[] = {
      |                               ^~~~~~~~~~~~~~~~
../drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h:483:38: error: ‘ikpu_action_entries’ defined but not used [-Werror=unused-variable]
  483 | static struct npc_kpu_profile_action ikpu_action_entries[] = {
      |                                      ^~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Annoyingly kernel defaults to -Werror now so they break the build for
me, and I'm not immediately sure how to fix those for you. So I think
I'll revert the v2 and you can repost v3 as if v2 wasn't applied. SG?

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

* RE: [EXT] Re: [PATCH] octeontx2-af: Fix compiler warnings.
  2022-07-07  1:24 ` Jakub Kicinski
@ 2022-07-07  4:51   ` Ratheesh Kannoth
  0 siblings, 0 replies; 3+ messages in thread
From: Ratheesh Kannoth @ 2022-07-07  4:51 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: netdev, linux-kernel, Sunil Kovvuri Goutham, davem, edumazet,
	pabeni, kbuild-all, kernel test robot

-----Original Message-----
From: Jakub Kicinski <kuba@kernel.org> 
Sent: Thursday, July 7, 2022 6:55 AM
To: Ratheesh Kannoth <rkannoth@marvell.com>
Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Sunil Kovvuri Goutham <sgoutham@marvell.com>; davem@davemloft.net; edumazet@google.com; pabeni@redhat.com; kbuild-all@lists.01.org; kernel test robot <lkp@intel.com>
Subject: [EXT] Re: [PATCH] octeontx2-af: Fix compiler warnings.

External Email

----------------------------------------------------------------------
On Wed, 6 Jul 2022 18:32:41 +0530 Ratheesh Kannoth wrote:
> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c:388:5: 
> warning: no previous prototype for 'rvu_exact_calculate_hash' 
> [-Wmissing-prototypes]
> 388 | u32 rvu_exact_calculate_hash(struct rvu *rvu, u16 chan, u16 
> ctype, u8 *mac,
> |     ^~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c: In function 'rvu_npc_exact_get_drop_rule_info':
> >> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c:1080:14: 
> >> warning: variable 'rc' set but not used [-Wunused-but-set-variable]
> 1080 |         bool rc;
> |              ^~
> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c: At top level:
> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c:1248:5: 
> warning: no previous prototype for 'rvu_npc_exact_add_table_entry' 
> [-Wmissing-prototypes]
> 1248 | int rvu_npc_exact_add_table_entry(struct rvu *rvu, u8 cgx_id, 
> u8 lmac_id, u8 *mac,
> |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c: In function 'rvu_npc_exact_add_table_entry':
> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c:1254:33: warning: variable 'table' set but not used [-Wunused-but-set-variable]
> 1254 |         struct npc_exact_table *table;
> |                                 ^~~~~
> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c: At top level:
> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c:1320:5: 
> warning: no previous prototype for 'rvu_npc_exact_update_table_entry' 
> [-Wmissing-prototypes]
> 1320 | int rvu_npc_exact_update_table_entry(struct rvu *rvu, u8 
> cgx_id, u8 lmac_id,
> |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

>There are also these warnings not fixed by the follow up:

>In file included from ../drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c:14:
>../drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h:15120:28: error: ‘npc_mkex_default’ defined but not used [-Werror=unused-variable]
>15120 | static struct npc_mcam_kex npc_mkex_default = {
      |                            ^~~~~~~~~~~~~~~~
>../drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h:15000:30: error: ‘npc_lt_defaults’ defined but not used [-Werror=unused-variable]
>15000 | static struct npc_lt_def_cfg npc_lt_defaults = {
 >     |                              ^~~~~~~~~~~~~~~
>../drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h:14901:31: error: ‘npc_kpu_profiles’ defined but not used [-Werror=unused-variable]
>14901 | static struct npc_kpu_profile npc_kpu_profiles[] = {
 >     |                               ^~~~~~~~~~~~~~~~
>../drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h:483:38: error: ‘ikpu_action_entries’ defined but not used [-Werror=unused-variable]
 > 483 | static struct npc_kpu_profile_action ikpu_action_entries[] = {
  >    |                                      ^~~~~~~~~~~~~~~~~~~
>cc1: all warnings being treated as errors

>Annoyingly kernel defaults to -Werror now so they break the build for me, and I'm not immediately sure how to fix those for you. So I think I'll revert the v2 and you can repost v3 as if v2 >wasn't applied. SG?

Sorry for the trouble. Cleanly compiled patches and reposted patches.  Please review.

Thanks,
Ratheesh


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

end of thread, other threads:[~2022-07-07  4:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-06 13:02 [PATCH] octeontx2-af: Fix compiler warnings Ratheesh Kannoth
2022-07-07  1:24 ` Jakub Kicinski
2022-07-07  4:51   ` [EXT] " Ratheesh Kannoth

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).