Skip to content

Commit 7db788a

Browse files
louis-peenskuba-moo
authored andcommitted
nfp: flower: fix ida_idx not being released
When looking for a global mac index the extra NFP_TUN_PRE_TUN_IDX_BIT that gets set if nfp_flower_is_supported_bridge is true is not taken into account. Consequently the path that should release the ida_index in cleanup is never triggered, causing messages like: nfp 0000:02:00.0: nfp: Failed to offload MAC on br-ex. nfp 0000:02:00.0: nfp: Failed to offload MAC on br-ex. nfp 0000:02:00.0: nfp: Failed to offload MAC on br-ex. after NFP_MAX_MAC_INDEX number of reconfigs. Ultimately this lead to new tunnel flows not being offloaded. Fix this by unsetting the NFP_TUN_PRE_TUN_IDX_BIT before checking if the port is of type OTHER. Fixes: 2e0bc7f ("nfp: flower: encode mac indexes with pre-tunnel rule check") Signed-off-by: Louis Peens <louis.peens@corigine.com> Signed-off-by: Simon Horman <simon.horman@corigine.com> Link: https://lore.kernel.org/r/20220208101453.321949-1-simon.horman@corigine.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 5611a00 commit 7db788a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,7 @@ nfp_tunnel_del_shared_mac(struct nfp_app *app, struct net_device *netdev,
10111011
struct nfp_flower_repr_priv *repr_priv;
10121012
struct nfp_tun_offloaded_mac *entry;
10131013
struct nfp_repr *repr;
1014+
u16 nfp_mac_idx;
10141015
int ida_idx;
10151016

10161017
entry = nfp_tunnel_lookup_offloaded_macs(app, mac);
@@ -1029,8 +1030,6 @@ nfp_tunnel_del_shared_mac(struct nfp_app *app, struct net_device *netdev,
10291030
entry->bridge_count--;
10301031

10311032
if (!entry->bridge_count && entry->ref_count) {
1032-
u16 nfp_mac_idx;
1033-
10341033
nfp_mac_idx = entry->index & ~NFP_TUN_PRE_TUN_IDX_BIT;
10351034
if (__nfp_tunnel_offload_mac(app, mac, nfp_mac_idx,
10361035
false)) {
@@ -1046,7 +1045,6 @@ nfp_tunnel_del_shared_mac(struct nfp_app *app, struct net_device *netdev,
10461045

10471046
/* If MAC is now used by 1 repr set the offloaded MAC index to port. */
10481047
if (entry->ref_count == 1 && list_is_singular(&entry->repr_list)) {
1049-
u16 nfp_mac_idx;
10501048
int port, err;
10511049

10521050
repr_priv = list_first_entry(&entry->repr_list,
@@ -1074,8 +1072,14 @@ nfp_tunnel_del_shared_mac(struct nfp_app *app, struct net_device *netdev,
10741072
WARN_ON_ONCE(rhashtable_remove_fast(&priv->tun.offloaded_macs,
10751073
&entry->ht_node,
10761074
offloaded_macs_params));
1075+
1076+
if (nfp_flower_is_supported_bridge(netdev))
1077+
nfp_mac_idx = entry->index & ~NFP_TUN_PRE_TUN_IDX_BIT;
1078+
else
1079+
nfp_mac_idx = entry->index;
1080+
10771081
/* If MAC has global ID then extract and free the ida entry. */
1078-
if (nfp_tunnel_is_mac_idx_global(entry->index)) {
1082+
if (nfp_tunnel_is_mac_idx_global(nfp_mac_idx)) {
10791083
ida_idx = nfp_tunnel_get_ida_from_global_mac_idx(entry->index);
10801084
ida_simple_remove(&priv->tun.mac_off_ids, ida_idx);
10811085
}

0 commit comments

Comments
 (0)