@@ -1074,6 +1074,10 @@ static int ixgbe_set_vf_mc_promisc(struct ixgbe_adapter *adapter,
if (adapter->vfinfo[vf].mc_promisc == enable)
return 0;
+ /* Don't enable MC promisc unless VF is trusted */
+ if (enable && !adapter->vfinfo[vf].trusted)
+ return -1;
+
adapter->vfinfo[vf].mc_promisc = enable;
if (enable)
@@ -1513,10 +1517,7 @@ int ixgbe_ndo_set_vf_trust(struct net_device *netdev, int vf, bool setting)
adapter->vfinfo[vf].trusted = setting;
- /* Reconfigure features which are only allowed for trusted VF */
- /* VF multicast promiscuous mode */
- if (adapter->vfinfo[vf].mc_promisc)
- ixgbe_enable_vf_mc_promisc(adapter, vf);
+ /* TODO: reset to reconfigure features */
return 0;
}
@@ -430,6 +430,7 @@ static s32 ixgbevf_request_mc_promisc_vf(struct ixgbe_hw *hw)
{
struct ixgbevf_adapter *adapter = hw->back;
u32 msgbuf[IXGBE_VFMAILBOX_SIZE];
+ int err;
dev_info(&adapter->pdev->dev, "Request MC PROMISC\n");
@@ -439,7 +440,17 @@ static s32 ixgbevf_request_mc_promisc_vf(struct ixgbe_hw *hw)
msgbuf[0] = IXGBE_VF_SET_MC_PROMISC;
msgbuf[1] = 1;
- ixgbevf_write_msg_read_ack(hw, msgbuf, 2);
+ err = hw->mbx.ops.write_posted(hw, msgbuf, 2);
+ if (err)
+ return err;
+ err = hw->mbx.ops.read_posted(hw, msgbuf, 2);
+ if (err)
+ return err;
+
+ msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
+
+ if (msgbuf[0] == (IXGBE_VF_SET_MC_PROMISC | IXGBE_VT_MSGTYPE_NACK))
+ return -EPERM;
return 0;
}
@@ -474,11 +485,13 @@ static s32 ixgbevf_update_mc_addr_list_vf(struct ixgbe_hw *hw,
* mode, turn it on.
*/
if (hw->api_version == ixgbe_mbox_api_12) {
- if (!hw->mac.mc_promisc) {
- ixgbevf_request_mc_promisc_vf(hw);
+ if (!hw->mac.mc_promisc &&
+ !ixgbevf_request_mc_promisc_vf(hw)) {
hw->mac.mc_promisc = true;
}
- return 0;
+ /* If we are in MC promisc, return here */
+ if (hw->mac.mc_promisc)
+ return 0;
}
cnt = 30;
}