Commit 9ce4fa54 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

nfp: flower: restore RTNL locking around representor updates

When we moved to updating representors from a workqueue grabbing
the RTNL somehow got lost in the process.  Restore it, and make
sure RCU lock is not held while we are grabbing the RTNL.  RCU
protects the representor table, so since we will be under RTNL
we can drop RCU lock as soon as we find the netdev pointer.
RTNL is needed for the dev_set_mtu() call.

Fixes: 2dff1962 ("nfp: process MTU updates from firmware flower app")
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: default avatarSimon Horman <simon.horman@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7c8a2d8b
...@@ -141,12 +141,14 @@ nfp_flower_cmsg_portmod_rx(struct nfp_app *app, struct sk_buff *skb) ...@@ -141,12 +141,14 @@ nfp_flower_cmsg_portmod_rx(struct nfp_app *app, struct sk_buff *skb)
msg = nfp_flower_cmsg_get_data(skb); msg = nfp_flower_cmsg_get_data(skb);
link = msg->info & NFP_FLOWER_CMSG_PORTMOD_INFO_LINK; link = msg->info & NFP_FLOWER_CMSG_PORTMOD_INFO_LINK;
rtnl_lock();
rcu_read_lock(); rcu_read_lock();
netdev = nfp_app_repr_get(app, be32_to_cpu(msg->portnum)); netdev = nfp_app_repr_get(app, be32_to_cpu(msg->portnum));
rcu_read_unlock();
if (!netdev) { if (!netdev) {
nfp_flower_cmsg_warn(app, "ctrl msg for unknown port 0x%08x\n", nfp_flower_cmsg_warn(app, "ctrl msg for unknown port 0x%08x\n",
be32_to_cpu(msg->portnum)); be32_to_cpu(msg->portnum));
rcu_read_unlock(); rtnl_unlock();
return; return;
} }
...@@ -161,7 +163,7 @@ nfp_flower_cmsg_portmod_rx(struct nfp_app *app, struct sk_buff *skb) ...@@ -161,7 +163,7 @@ nfp_flower_cmsg_portmod_rx(struct nfp_app *app, struct sk_buff *skb)
} else { } else {
netif_carrier_off(netdev); netif_carrier_off(netdev);
} }
rcu_read_unlock(); rtnl_unlock();
} }
static void static void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment