static void i40e_handle_reset_warning(struct i40e_pf *pf, bool lock_acquired);
 static int i40e_add_vsi(struct i40e_vsi *vsi);
 static int i40e_add_veb(struct i40e_veb *veb, struct i40e_vsi *vsi);
-static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit);
+static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit, bool lock_acquired);
 static int i40e_setup_misc_vector(struct i40e_pf *pf);
 static void i40e_determine_queue_usage(struct i40e_pf *pf);
 static int i40e_setup_pf_filter_control(struct i40e_pf *pf);
 #endif /* CONFIG_I40E_DCB */
        if (!lock_acquired)
                rtnl_lock();
-       ret = i40e_setup_pf_switch(pf, reinit);
+       ret = i40e_setup_pf_switch(pf, reinit, true);
        if (ret)
                goto end_unlock;
 
  * i40e_setup_pf_switch - Setup the HW switch on startup or after reset
  * @pf: board private structure
  * @reinit: if the Main VSI needs to re-initialized.
+ * @lock_acquired: indicates whether or not the lock has been acquired
  *
  * Returns 0 on success, negative value on failure
  **/
-static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit)
+static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit, bool lock_acquired)
 {
        u16 flags = 0;
        int ret;
 
        i40e_ptp_init(pf);
 
+       if (!lock_acquired)
+               rtnl_lock();
+
        /* repopulate tunnel port filters */
        udp_tunnel_nic_reset_ntf(pf->vsi[pf->lan_vsi]->netdev);
 
+       if (!lock_acquired)
+               rtnl_unlock();
+
        return ret;
 }
 
                        pf->flags |= I40E_FLAG_VEB_MODE_ENABLED;
        }
 #endif
-       err = i40e_setup_pf_switch(pf, false);
+       err = i40e_setup_pf_switch(pf, false, false);
        if (err) {
                dev_info(&pdev->dev, "setup_pf_switch failed: %d\n", err);
                goto err_vsis;