net: Update API for VF vlan protocol 802.1ad support
[cascardo/linux.git] / drivers / net / ethernet / broadcom / bnx2x / bnx2x_sriov.c
index 632daff..3f77d08 100644 (file)
@@ -573,17 +573,6 @@ int bnx2x_vf_mcast(struct bnx2x *bp, struct bnx2x_virtf *vf,
                }
        }
 
-       /* clear existing mcasts */
-       mcast.mcast_list_len = vf->mcast_list_len;
-       vf->mcast_list_len = mc_num;
-       rc = bnx2x_config_mcast(bp, &mcast, BNX2X_MCAST_CMD_DEL);
-       if (rc) {
-               BNX2X_ERR("Failed to remove multicasts\n");
-               kfree(mc);
-               return rc;
-       }
-
-       /* update mcast list on the ramrod params */
        if (mc_num) {
                INIT_LIST_HEAD(&mcast.mcast_list);
                for (i = 0; i < mc_num; i++) {
@@ -594,12 +583,18 @@ int bnx2x_vf_mcast(struct bnx2x *bp, struct bnx2x_virtf *vf,
 
                /* add new mcasts */
                mcast.mcast_list_len = mc_num;
-               rc = bnx2x_config_mcast(bp, &mcast, BNX2X_MCAST_CMD_ADD);
+               rc = bnx2x_config_mcast(bp, &mcast, BNX2X_MCAST_CMD_SET);
                if (rc)
-                       BNX2X_ERR("Faled to add multicasts\n");
-               kfree(mc);
+                       BNX2X_ERR("Faled to set multicasts\n");
+       } else {
+               /* clear existing mcasts */
+               rc = bnx2x_config_mcast(bp, &mcast, BNX2X_MCAST_CMD_DEL);
+               if (rc)
+                       BNX2X_ERR("Failed to remove multicasts\n");
        }
 
+       kfree(mc);
+
        return rc;
 }
 
@@ -1583,7 +1578,6 @@ int bnx2x_iov_nic_init(struct bnx2x *bp)
                 *  It needs to be initialized here so that it can be safely
                 *  handled by a subsequent FLR flow.
                 */
-               vf->mcast_list_len = 0;
                bnx2x_init_mcast_obj(bp, &vf->mcast_obj, 0xFF,
                                     0xFF, 0xFF, 0xFF,
                                     bnx2x_vf_sp(bp, vf, mcast_rdata),
@@ -2527,7 +2521,8 @@ void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp)
        for_each_vf(bp, vfidx) {
                bulletin = BP_VF_BULLETIN(bp, vfidx);
                if (bulletin->valid_bitmap & (1 << VLAN_VALID))
-                       bnx2x_set_vf_vlan(bp->dev, vfidx, bulletin->vlan, 0);
+                       bnx2x_set_vf_vlan(bp->dev, vfidx, bulletin->vlan, 0,
+                                         htons(ETH_P_8021Q));
        }
 }
 
@@ -2787,7 +2782,8 @@ static int bnx2x_set_vf_vlan_filter(struct bnx2x *bp, struct bnx2x_virtf *vf,
        return 0;
 }
 
-int bnx2x_set_vf_vlan(struct net_device *dev, int vfidx, u16 vlan, u8 qos)
+int bnx2x_set_vf_vlan(struct net_device *dev, int vfidx, u16 vlan, u8 qos,
+                     __be16 vlan_proto)
 {
        struct pf_vf_bulletin_content *bulletin = NULL;
        struct bnx2x *bp = netdev_priv(dev);
@@ -2802,6 +2798,9 @@ int bnx2x_set_vf_vlan(struct net_device *dev, int vfidx, u16 vlan, u8 qos)
                return -EINVAL;
        }
 
+       if (vlan_proto != htons(ETH_P_8021Q))
+               return -EPROTONOSUPPORT;
+
        DP(BNX2X_MSG_IOV, "configuring VF %d with VLAN %d qos %d\n",
           vfidx, vlan, 0);