i40e: add more verbose error messages
[deliverable/linux.git] / drivers / net / ethernet / intel / i40e / i40e_virtchnl_pf.c
index d99c116032f368cb25cd40e1e63bf2ab240780c0..fac8a02ab74e9455b214f06a428cedb4d5d6c00e 100644 (file)
@@ -561,7 +561,7 @@ static int i40e_alloc_vsi_res(struct i40e_vf *vf, enum i40e_vsi_type type)
        }
 
        /* program mac filter */
-       ret = i40e_sync_vsi_filters(vsi);
+       ret = i40e_sync_vsi_filters(vsi, false);
        if (ret)
                dev_err(&pf->pdev->dev, "Unable to program ucast filters\n");
 
@@ -872,6 +872,11 @@ void i40e_free_vfs(struct i40e_pf *pf)
                        i40e_vsi_control_rings(pf->vsi[pf->vf[i].lan_vsi_idx],
                                               false);
 
+       for (i = 0; i < pf->num_alloc_vfs; i++)
+               if (test_bit(I40E_VF_STAT_INIT, &pf->vf[i].vf_states))
+                       i40e_vsi_control_rings(pf->vsi[pf->vf[i].lan_vsi_idx],
+                                              false);
+
        /* Disable IOV before freeing resources. This lets any VF drivers
         * running in the host get themselves cleaned up before we yank
         * the carpet out from underneath their feet.
@@ -993,17 +998,19 @@ static int i40e_pci_sriov_enable(struct pci_dev *pdev, int num_vfs)
                goto err_out;
        }
 
-       dev_info(&pdev->dev, "Allocating %d VFs.\n", num_vfs);
        if (pre_existing_vfs && pre_existing_vfs != num_vfs)
                i40e_free_vfs(pf);
        else if (pre_existing_vfs && pre_existing_vfs == num_vfs)
                goto out;
 
        if (num_vfs > pf->num_req_vfs) {
+               dev_warn(&pdev->dev, "Unable to enable %d VFs. Limited to %d VFs due to device resource constraints.\n",
+                        num_vfs, pf->num_req_vfs);
                err = -EPERM;
                goto err_out;
        }
 
+       dev_info(&pdev->dev, "Allocating %d VFs.\n", num_vfs);
        err = i40e_alloc_vfs(pf, num_vfs);
        if (err) {
                dev_warn(&pdev->dev, "Failed to enable SR-IOV: %d\n", err);
@@ -1605,7 +1612,7 @@ static int i40e_vc_add_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
        }
 
        /* program the updated filter list */
-       if (i40e_sync_vsi_filters(vsi))
+       if (i40e_sync_vsi_filters(vsi, false))
                dev_err(&pf->pdev->dev, "Unable to program VF MAC filters\n");
 
 error_param:
@@ -1656,7 +1663,7 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
                                I40E_VLAN_ANY, true, false);
 
        /* program the updated filter list */
-       if (i40e_sync_vsi_filters(vsi))
+       if (i40e_sync_vsi_filters(vsi, false))
                dev_err(&pf->pdev->dev, "Unable to program VF MAC filters\n");
 
 error_param:
@@ -2062,7 +2069,7 @@ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
 
        dev_info(&pf->pdev->dev, "Setting MAC %pM on VF %d\n", mac, vf_id);
        /* program mac filter */
-       if (i40e_sync_vsi_filters(vsi)) {
+       if (i40e_sync_vsi_filters(vsi, false)) {
                dev_err(&pf->pdev->dev, "Unable to program ucast filters\n");
                ret = -EIO;
                goto error_param;
@@ -2089,6 +2096,7 @@ error_param:
 int i40e_ndo_set_vf_port_vlan(struct net_device *netdev,
                              int vf_id, u16 vlan_id, u8 qos)
 {
+       u16 vlanprio = vlan_id | (qos << I40E_VLAN_PRIORITY_SHIFT);
        struct i40e_netdev_priv *np = netdev_priv(netdev);
        struct i40e_pf *pf = np->vsi->back;
        struct i40e_vsi *vsi;
@@ -2116,8 +2124,7 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev,
                goto error_pvid;
        }
 
-       if (le16_to_cpu(vsi->info.pvid) ==
-           (vlan_id | (qos << I40E_VLAN_PRIORITY_SHIFT)))
+       if (le16_to_cpu(vsi->info.pvid) == vlanprio)
                /* duplicate request, so just return success */
                goto error_pvid;
 
@@ -2141,7 +2148,7 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev,
         * MAC addresses deleted.
         */
        if ((!(vlan_id || qos) ||
-           (vlan_id | qos) != le16_to_cpu(vsi->info.pvid)) &&
+           vlanprio != le16_to_cpu(vsi->info.pvid)) &&
            vsi->info.pvid)
                ret = i40e_vsi_add_vlan(vsi, I40E_VLAN_ANY);
 
@@ -2156,8 +2163,7 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev,
                }
        }
        if (vlan_id || qos)
-               ret = i40e_vsi_add_pvid(vsi,
-                               vlan_id | (qos << I40E_VLAN_PRIORITY_SHIFT));
+               ret = i40e_vsi_add_pvid(vsi, vlanprio);
        else
                i40e_vsi_remove_pvid(vsi);
 
This page took 0.029197 seconds and 5 git commands to generate.