Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next...
[linux-2.6-microblaze.git] / drivers / net / ethernet / intel / ice / ice_virtchnl.c
index 4508308..094e3c9 100644 (file)
@@ -999,6 +999,7 @@ static int ice_vc_cfg_promiscuous_mode_msg(struct ice_vf *vf, u8 *msg)
        int mcast_err = 0, ucast_err = 0;
        struct ice_pf *pf = vf->pf;
        struct ice_vsi *vsi;
+       u8 mcast_m, ucast_m;
        struct device *dev;
        int ret = 0;
 
@@ -1045,39 +1046,33 @@ static int ice_vc_cfg_promiscuous_mode_msg(struct ice_vf *vf, u8 *msg)
                goto error_param;
        }
 
+       ice_vf_get_promisc_masks(vf, vsi, &ucast_m, &mcast_m);
+
        if (!test_bit(ICE_FLAG_VF_TRUE_PROMISC_ENA, pf->flags)) {
-               bool set_dflt_vsi = alluni || allmulti;
+               if (alluni) {
+                       /* in this case we're turning on promiscuous mode */
+                       ret = ice_set_dflt_vsi(vsi);
+               } else {
+                       /* in this case we're turning off promiscuous mode */
+                       if (ice_is_dflt_vsi_in_use(vsi->port_info))
+                               ret = ice_clear_dflt_vsi(vsi);
+               }
 
-               if (set_dflt_vsi && !ice_is_dflt_vsi_in_use(pf->first_sw))
-                       /* only attempt to set the default forwarding VSI if
-                        * it's not currently set
-                        */
-                       ret = ice_set_dflt_vsi(pf->first_sw, vsi);
-               else if (!set_dflt_vsi &&
-                        ice_is_vsi_dflt_vsi(pf->first_sw, vsi))
-                       /* only attempt to free the default forwarding VSI if we
-                        * are the owner
-                        */
-                       ret = ice_clear_dflt_vsi(pf->first_sw);
+               /* in this case we're turning on/off only
+                * allmulticast
+                */
+               if (allmulti)
+                       mcast_err = ice_vf_set_vsi_promisc(vf, vsi, mcast_m);
+               else
+                       mcast_err = ice_vf_clear_vsi_promisc(vf, vsi, mcast_m);
 
                if (ret) {
-                       dev_err(dev, "%sable VF %d as the default VSI failed, error %d\n",
-                               set_dflt_vsi ? "en" : "dis", vf->vf_id, ret);
+                       dev_err(dev, "Turning on/off promiscuous mode for VF %d failed, error: %d\n",
+                               vf->vf_id, ret);
                        v_ret = VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR;
                        goto error_param;
                }
        } else {
-               u8 mcast_m, ucast_m;
-
-               if (ice_vf_is_port_vlan_ena(vf) ||
-                   ice_vsi_has_non_zero_vlans(vsi)) {
-                       mcast_m = ICE_MCAST_VLAN_PROMISC_BITS;
-                       ucast_m = ICE_UCAST_VLAN_PROMISC_BITS;
-               } else {
-                       mcast_m = ICE_MCAST_PROMISC_BITS;
-                       ucast_m = ICE_UCAST_PROMISC_BITS;
-               }
-
                if (alluni)
                        ucast_err = ice_vf_set_vsi_promisc(vf, vsi, ucast_m);
                else
@@ -1102,6 +1097,9 @@ static int ice_vc_cfg_promiscuous_mode_msg(struct ice_vf *vf, u8 *msg)
                                            vf->vf_states))
                        dev_info(dev, "VF %u successfully unset multicast promiscuous mode\n",
                                 vf->vf_id);
+       } else {
+               dev_err(dev, "Error while modifying multicast promiscuous mode for VF %u, error: %d\n",
+                       vf->vf_id, mcast_err);
        }
 
        if (!ucast_err) {
@@ -1114,6 +1112,9 @@ static int ice_vc_cfg_promiscuous_mode_msg(struct ice_vf *vf, u8 *msg)
                                            vf->vf_states))
                        dev_info(dev, "VF %u successfully unset unicast promiscuous mode\n",
                                 vf->vf_id);
+       } else {
+               dev_err(dev, "Error while modifying unicast promiscuous mode for VF %u, error: %d\n",
+                       vf->vf_id, ucast_err);
        }
 
 error_param: