octeontx2-af: Fix compiler warnings.
Ratheesh Kannoth
maintainerPATCH 1/1 octeontx2-af: Fix compiler warnings.
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':
Quoted 1 line
Quoted 1 line
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,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- .../marvell/octeontx2/af/rvu_npc_hash.c | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c +15 -14
@@ -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)
Signature · 1 line
2.25.1
Jakub Kicinski
maintainerQuoted 5 lines · 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':Quoted 1 line
Quoted 1 line
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c:1080:14: warning: variable 'rc' set but not used [-Wunused-but-set-variable]
Quoted 14 lines
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, u8cgx_id, u8lmac_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 | structnpc_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, u8cgx_id, u8lmac_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?
Ratheesh Kannoth
maintainer-----Original Message-----
From: Jakub Kicinski <[email protected]>
Sent: Thursday, July 7, 2022 6:55 AM
To: Ratheesh Kannoth <[email protected]>
Cc: netdev(a)vger.kernel.org; linux-kernel(a)vger.kernel.org; Sunil Kovvuri Goutham <[email protected]>; davem(a)davemloft.net; edumazet(a)google.com; pabeni(a)redhat.com; kbuild-all(a)lists.01.org; kernel test robot <[email protected]>
Subject: [EXT] Re: [PATCH] octeontx2-af: Fix compiler warnings.
External Email
----------------------------------------------------------------------
Quoted 30 lines · 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':Quoted 2 lines
Quoted 2 lines
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, u8cgx_id,
u8lmac_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 | structnpc_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, u8cgx_id, u8lmac_id,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 5 lines
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 structnpc_mcam_kexnpc_mkex_default= {
| ^~~~~~~~~~~~~~~~
Quoted 9 lines
../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[] = { | ^~~~~~~~~~~~~~~~~~~
Quoted 3 lines
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