net/txgbe: support VF promiscuous and allmulticast
[dpdk.git] / drivers / net / txgbe / base / txgbe_vf.c
index 1cf09ad..9105de2 100644 (file)
@@ -33,6 +33,8 @@ s32 txgbe_init_ops_vf(struct txgbe_hw *hw)
        /* RAR, Multicast, VLAN */
        mac->set_rar = txgbe_set_rar_vf;
        mac->set_uc_addr = txgbevf_set_uc_addr_vf;
+       mac->update_xcast_mode = txgbevf_update_xcast_mode;
+       mac->set_vfta = txgbe_set_vfta_vf;
        mac->set_rlpml = txgbevf_rlpml_set_vf;
 
        mac->max_tx_queues = 1;
@@ -256,6 +258,72 @@ s32 txgbe_set_rar_vf(struct txgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
        return ret_val;
 }
 
+/**
+ *  txgbevf_update_xcast_mode - Update Multicast mode
+ *  @hw: pointer to the HW structure
+ *  @xcast_mode: new multicast mode
+ *
+ *  Updates the Multicast Mode of VF.
+ **/
+s32 txgbevf_update_xcast_mode(struct txgbe_hw *hw, int xcast_mode)
+{
+       u32 msgbuf[2];
+       s32 err;
+
+       switch (hw->api_version) {
+       case txgbe_mbox_api_12:
+               /* New modes were introduced in 1.3 version */
+               if (xcast_mode > TXGBEVF_XCAST_MODE_ALLMULTI)
+                       return TXGBE_ERR_FEATURE_NOT_SUPPORTED;
+               /* Fall through */
+       case txgbe_mbox_api_13:
+               break;
+       default:
+               return TXGBE_ERR_FEATURE_NOT_SUPPORTED;
+       }
+
+       msgbuf[0] = TXGBE_VF_UPDATE_XCAST_MODE;
+       msgbuf[1] = xcast_mode;
+
+       err = txgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 2);
+       if (err)
+               return err;
+
+       msgbuf[0] &= ~TXGBE_VT_MSGTYPE_CTS;
+       if (msgbuf[0] == (TXGBE_VF_UPDATE_XCAST_MODE | TXGBE_VT_MSGTYPE_NACK))
+               return TXGBE_ERR_FEATURE_NOT_SUPPORTED;
+       return 0;
+}
+
+/**
+ *  txgbe_set_vfta_vf - Set/Unset vlan filter table address
+ *  @hw: pointer to the HW structure
+ *  @vlan: 12 bit VLAN ID
+ *  @vind: unused by VF drivers
+ *  @vlan_on: if true then set bit, else clear bit
+ *  @vlvf_bypass: boolean flag indicating updating default pool is okay
+ *
+ *  Turn on/off specified VLAN in the VLAN filter table.
+ **/
+s32 txgbe_set_vfta_vf(struct txgbe_hw *hw, u32 vlan, u32 vind,
+                     bool vlan_on, bool vlvf_bypass)
+{
+       u32 msgbuf[2];
+       s32 ret_val;
+       UNREFERENCED_PARAMETER(vind, vlvf_bypass);
+
+       msgbuf[0] = TXGBE_VF_SET_VLAN;
+       msgbuf[1] = vlan;
+       /* Setting the 8 bit field MSG INFO to TRUE indicates "add" */
+       msgbuf[0] |= vlan_on << TXGBE_VT_MSGINFO_SHIFT;
+
+       ret_val = txgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 2);
+       if (!ret_val && (msgbuf[0] & TXGBE_VT_MSGTYPE_ACK))
+               return 0;
+
+       return ret_val | (msgbuf[0] & TXGBE_VT_MSGTYPE_NACK);
+}
+
 /**
  * txgbe_get_mac_addr_vf - Read device MAC address
  * @hw: pointer to the HW structure