Commit 2d166c30 authored by Mitch Williams's avatar Mitch Williams Committed by Jeff Kirsher

i40e: change log messages and error returns

When VFs are being reset, there is a brief window of time when they
cannot be configured because they don't have a VSI to configure. If
a script is quick, it can fall through that window. To avoid
defenestration, log a useful error message and return -EAGAIN.
Signed-off-by: default avatarMitch Williams <mitch.a.williams@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 24759daa
...@@ -2078,9 +2078,9 @@ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac) ...@@ -2078,9 +2078,9 @@ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
vf = &(pf->vf[vf_id]); vf = &(pf->vf[vf_id]);
vsi = pf->vsi[vf->lan_vsi_idx]; vsi = pf->vsi[vf->lan_vsi_idx];
if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states)) { if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states)) {
dev_err(&pf->pdev->dev, dev_err(&pf->pdev->dev, "VF %d still in reset. Try again.\n",
"Uninitialized VF %d\n", vf_id); vf_id);
ret = -EINVAL; ret = -EAGAIN;
goto error_param; goto error_param;
} }
...@@ -2162,8 +2162,9 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, ...@@ -2162,8 +2162,9 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev,
vf = &(pf->vf[vf_id]); vf = &(pf->vf[vf_id]);
vsi = pf->vsi[vf->lan_vsi_idx]; vsi = pf->vsi[vf->lan_vsi_idx];
if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states)) { if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states)) {
dev_err(&pf->pdev->dev, "Uninitialized VF %d\n", vf_id); dev_err(&pf->pdev->dev, "VF %d still in reset. Try again.\n",
ret = -EINVAL; vf_id);
ret = -EAGAIN;
goto error_pvid; goto error_pvid;
} }
...@@ -2282,8 +2283,9 @@ int i40e_ndo_set_vf_bw(struct net_device *netdev, int vf_id, int min_tx_rate, ...@@ -2282,8 +2283,9 @@ int i40e_ndo_set_vf_bw(struct net_device *netdev, int vf_id, int min_tx_rate,
vf = &(pf->vf[vf_id]); vf = &(pf->vf[vf_id]);
vsi = pf->vsi[vf->lan_vsi_idx]; vsi = pf->vsi[vf->lan_vsi_idx];
if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states)) { if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states)) {
dev_err(&pf->pdev->dev, "Uninitialized VF %d.\n", vf_id); dev_err(&pf->pdev->dev, "VF %d still in reset. Try again.\n",
ret = -EINVAL; vf_id);
ret = -EAGAIN;
goto error; goto error;
} }
...@@ -2356,8 +2358,9 @@ int i40e_ndo_get_vf_config(struct net_device *netdev, ...@@ -2356,8 +2358,9 @@ int i40e_ndo_get_vf_config(struct net_device *netdev,
/* first vsi is always the LAN vsi */ /* first vsi is always the LAN vsi */
vsi = pf->vsi[vf->lan_vsi_idx]; vsi = pf->vsi[vf->lan_vsi_idx];
if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states)) { if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states)) {
dev_err(&pf->pdev->dev, "Uninitialized VF %d\n", vf_id); dev_err(&pf->pdev->dev, "VF %d still in reset. Try again.\n",
ret = -EINVAL; vf_id);
ret = -EAGAIN;
goto error_param; goto error_param;
} }
...@@ -2472,6 +2475,12 @@ int i40e_ndo_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool enable) ...@@ -2472,6 +2475,12 @@ int i40e_ndo_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool enable)
} }
vf = &(pf->vf[vf_id]); vf = &(pf->vf[vf_id]);
if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states)) {
dev_err(&pf->pdev->dev, "VF %d still in reset. Try again.\n",
vf_id);
ret = -EAGAIN;
goto out;
}
if (enable == vf->spoofchk) if (enable == vf->spoofchk)
goto out; goto out;
......
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