Skip to content

Commit af42088

Browse files
rkannoth1davem330
authored andcommitted
octeontx2-af: Promisc enable/disable through mbox
In legacy silicon, promiscuous mode is only modified through CGX mbox messages. In CN10KB silicon, it is modified from CGX mbox and NIX. This breaks legacy application behaviour. Fix this by removing call from NIX. Fixes: d6c9784 ("octeontx2-af: Invoke exact match functions if supported") Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Reviewed-by: Michal Kubiak <michal.kubiak@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent b61aac0 commit af42088

2 files changed

Lines changed: 23 additions & 11 deletions

File tree

drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4069,21 +4069,14 @@ int rvu_mbox_handler_nix_set_rx_mode(struct rvu *rvu, struct nix_rx_mode *req,
40694069
}
40704070

40714071
/* install/uninstall promisc entry */
4072-
if (promisc) {
4072+
if (promisc)
40734073
rvu_npc_install_promisc_entry(rvu, pcifunc, nixlf,
40744074
pfvf->rx_chan_base,
40754075
pfvf->rx_chan_cnt);
4076-
4077-
if (rvu_npc_exact_has_match_table(rvu))
4078-
rvu_npc_exact_promisc_enable(rvu, pcifunc);
4079-
} else {
4076+
else
40804077
if (!nix_rx_multicast)
40814078
rvu_npc_enable_promisc_entry(rvu, pcifunc, nixlf, false);
40824079

4083-
if (rvu_npc_exact_has_match_table(rvu))
4084-
rvu_npc_exact_promisc_disable(rvu, pcifunc);
4085-
}
4086-
40874080
return 0;
40884081
}
40894082

drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,8 +1164,10 @@ static u16 __rvu_npc_exact_cmd_rules_cnt_update(struct rvu *rvu, int drop_mcam_i
11641164
{
11651165
struct npc_exact_table *table;
11661166
u16 *cnt, old_cnt;
1167+
bool promisc;
11671168

11681169
table = rvu->hw->table;
1170+
promisc = table->promisc_mode[drop_mcam_idx];
11691171

11701172
cnt = &table->cnt_cmd_rules[drop_mcam_idx];
11711173
old_cnt = *cnt;
@@ -1177,13 +1179,18 @@ static u16 __rvu_npc_exact_cmd_rules_cnt_update(struct rvu *rvu, int drop_mcam_i
11771179

11781180
*enable_or_disable_cam = false;
11791181

1180-
/* If all rules are deleted, disable cam */
1182+
if (promisc)
1183+
goto done;
1184+
1185+
/* If all rules are deleted and not already in promisc mode;
1186+
* disable cam
1187+
*/
11811188
if (!*cnt && val < 0) {
11821189
*enable_or_disable_cam = true;
11831190
goto done;
11841191
}
11851192

1186-
/* If rule got added, enable cam */
1193+
/* If rule got added and not already in promisc mode; enable cam */
11871194
if (!old_cnt && val > 0) {
11881195
*enable_or_disable_cam = true;
11891196
goto done;
@@ -1462,6 +1469,12 @@ int rvu_npc_exact_promisc_disable(struct rvu *rvu, u16 pcifunc)
14621469
*promisc = false;
14631470
mutex_unlock(&table->lock);
14641471

1472+
/* Enable drop rule */
1473+
rvu_npc_enable_mcam_by_entry_index(rvu, drop_mcam_idx, NIX_INTF_RX,
1474+
true);
1475+
1476+
dev_dbg(rvu->dev, "%s: disabled promisc mode (cgx=%d lmac=%d)\n",
1477+
__func__, cgx_id, lmac_id);
14651478
return 0;
14661479
}
14671480

@@ -1503,6 +1516,12 @@ int rvu_npc_exact_promisc_enable(struct rvu *rvu, u16 pcifunc)
15031516
*promisc = true;
15041517
mutex_unlock(&table->lock);
15051518

1519+
/* disable drop rule */
1520+
rvu_npc_enable_mcam_by_entry_index(rvu, drop_mcam_idx, NIX_INTF_RX,
1521+
false);
1522+
1523+
dev_dbg(rvu->dev, "%s: Enabled promisc mode (cgx=%d lmac=%d)\n",
1524+
__func__, cgx_id, lmac_id);
15061525
return 0;
15071526
}
15081527

0 commit comments

Comments
 (0)