All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [S87 v5 1/7] i40e: Fix attach VF to VM issue
@ 2018-03-08 22:52 Jeff Kirsher
  2018-03-08 22:52 ` [Intel-wired-lan] [S87 v5 2/7] i40e: Cleanup i40e_vlan_rx_register Jeff Kirsher
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Jeff Kirsher @ 2018-03-08 22:52 UTC (permalink / raw)
  To: intel-wired-lan

From: Pawe? Jab?o?ski <pawel.jablonski@intel.com>

Fix for "Resource temporarily unavailable" problem when virsh is
trying to attach a device to VM. When the VF driver is loaded on
host and virsh is trying to attach it to the VM and set a MAC
address, it ends with a race condition between i40e_reset_vf and
i40e_ndo_set_vf_mac functions. The bug is fixed by adding polling
in i40e_ndo_set_vf_mac function For when the VF is in Reset mode.

Signed-off-by: Pawe? Jab?o?ski <pawel.jablonski@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 6049a5640f26..8559c099525d 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -3742,6 +3742,7 @@ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
 	int ret = 0;
 	struct hlist_node *h;
 	int bkt;
+	u8 i;
 
 	/* validate the request */
 	if (vf_id >= pf->num_alloc_vfs) {
@@ -3753,6 +3754,16 @@ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
 
 	vf = &(pf->vf[vf_id]);
 	vsi = pf->vsi[vf->lan_vsi_idx];
+
+	/* When the VF is resetting wait until it is done.
+	 * It can take up to 200 milliseconds,
+	 * but wait for up to 300 milliseconds to be safe.
+	 */
+	for (i = 0; i < 15; i++) {
+		if (test_bit(I40E_VF_STATE_INIT, &vf->vf_states))
+			break;
+		msleep(20);
+	}
 	if (!test_bit(I40E_VF_STATE_INIT, &vf->vf_states)) {
 		dev_err(&pf->pdev->dev, "VF %d still in reset. Try again.\n",
 			vf_id);
-- 
2.14.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2018-03-12 21:22 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-08 22:52 [Intel-wired-lan] [S87 v5 1/7] i40e: Fix attach VF to VM issue Jeff Kirsher
2018-03-08 22:52 ` [Intel-wired-lan] [S87 v5 2/7] i40e: Cleanup i40e_vlan_rx_register Jeff Kirsher
2018-03-09  0:28   ` Shannon Nelson
2018-03-12 19:29   ` Bowers, AndrewX
2018-03-08 22:52 ` [Intel-wired-lan] [S87 v5 3/7] i40e: Fix permission check for VF MAC filters Jeff Kirsher
2018-03-12 21:09   ` Bowers, AndrewX
2018-03-08 22:52 ` [Intel-wired-lan] [S87 v5 4/7] i40e: track filter type statistics when deleting invalid filters Jeff Kirsher
2018-03-12 21:20   ` Bowers, AndrewX
2018-03-08 22:52 ` [Intel-wired-lan] [S87 v5 5/7] i40e: factor out re-enable functions for ATR and SB Jeff Kirsher
2018-03-12 21:21   ` Bowers, AndrewX
2018-03-08 22:52 ` [Intel-wired-lan] [S87 v5 6/7] i40e: fix for wrong partition id calculation on OCP mezz cards Jeff Kirsher
2018-03-12 21:21   ` Bowers, AndrewX
2018-03-08 22:52 ` [Intel-wired-lan] [S87 v5 7/7] i40e: restore TCPv4 input set when re-enabling ATR Jeff Kirsher
2018-03-12 21:22   ` Bowers, AndrewX
2018-03-12 19:29 ` [Intel-wired-lan] [S87 v5 1/7] i40e: Fix attach VF to VM issue Bowers, AndrewX

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.