net: add rte prefix to ether defines
[dpdk.git] / drivers / net / ixgbe / ixgbe_pf.c
index cb10265..c88d56e 100644 (file)
@@ -1,34 +1,5 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
- *   All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in
- *       the documentation and/or other materials provided with the
- *       distribution.
- *     * Neither the name of Intel Corporation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2016 Intel Corporation
  */
 
 #include <stdio.h>
@@ -44,7 +15,7 @@
 #include <rte_debug.h>
 #include <rte_eal.h>
 #include <rte_ether.h>
-#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
 #include <rte_memcpy.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
@@ -61,7 +32,7 @@
 static inline uint16_t
 dev_num_vf(struct rte_eth_dev *eth_dev)
 {
-       struct rte_pci_device *pci_dev = IXGBE_DEV_TO_PCI(eth_dev);
+       struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
 
        return pci_dev->max_vfs;
 }
@@ -69,16 +40,16 @@ dev_num_vf(struct rte_eth_dev *eth_dev)
 static inline
 int ixgbe_vf_perm_addr_gen(struct rte_eth_dev *dev, uint16_t vf_num)
 {
-       unsigned char vf_mac_addr[ETHER_ADDR_LEN];
+       unsigned char vf_mac_addr[RTE_ETHER_ADDR_LEN];
        struct ixgbe_vf_info *vfinfo =
                *IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private);
        uint16_t vfn;
 
        for (vfn = 0; vfn < vf_num; vfn++) {
-               eth_random_addr(vf_mac_addr);
+               rte_eth_random_addr(vf_mac_addr);
                /* keep the random address as default */
                memcpy(vfinfo[vfn].vf_mac_addresses, vf_mac_addr,
-                          ETHER_ADDR_LEN);
+                          RTE_ETHER_ADDR_LEN);
        }
 
        return 0;
@@ -119,6 +90,8 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev)
        if (*vfinfo == NULL)
                rte_panic("Cannot allocate memory for private VF data\n");
 
+       rte_eth_switch_domain_alloc(&(*vfinfo)->switch_domain_id);
+
        memset(mirror_info, 0, sizeof(struct ixgbe_mirror_info));
        memset(uta_info, 0, sizeof(struct ixgbe_uta_info));
        hw->mac.mc_filter_type = 0;
@@ -151,11 +124,10 @@ void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev)
 {
        struct ixgbe_vf_info **vfinfo;
        uint16_t vf_num;
+       int ret;
 
        PMD_INIT_FUNC_TRACE();
 
-       vfinfo = IXGBE_DEV_PRIVATE_TO_P_VFDATA(eth_dev->data->dev_private);
-
        RTE_ETH_DEV_SRIOV(eth_dev).active = 0;
        RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = 0;
        RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx = 0;
@@ -165,6 +137,14 @@ void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev)
        if (vf_num == 0)
                return;
 
+       vfinfo = IXGBE_DEV_PRIVATE_TO_P_VFDATA(eth_dev->data->dev_private);
+       if (*vfinfo == NULL)
+               return;
+
+       ret = rte_eth_switch_domain_free((*vfinfo)->switch_domain_id);
+       if (ret)
+               PMD_INIT_LOG(WARNING, "failed to free switch domain: %d", ret);
+
        rte_free(*vfinfo);
        *vfinfo = NULL;
 }
@@ -178,6 +158,7 @@ ixgbe_add_tx_flow_control_drop_filter(struct rte_eth_dev *eth_dev)
                IXGBE_DEV_PRIVATE_TO_FILTER_INFO(eth_dev->data->dev_private);
        uint16_t vf_num;
        int i;
+       struct ixgbe_ethertype_filter ethertype_filter;
 
        if (!hw->mac.ops.set_ethertype_anti_spoofing) {
                RTE_LOG(INFO, PMD, "ether type anti-spoofing is not"
@@ -185,16 +166,23 @@ ixgbe_add_tx_flow_control_drop_filter(struct rte_eth_dev *eth_dev)
                return;
        }
 
-       /* occupy an entity of ether type filter */
-       for (i = 0; i < IXGBE_MAX_ETQF_FILTERS; i++) {
-               if (!(filter_info->ethertype_mask & (1 << i))) {
-                       filter_info->ethertype_mask |= 1 << i;
-                       filter_info->ethertype_filters[i] =
-                               IXGBE_ETHERTYPE_FLOW_CTRL;
-                       break;
-               }
+       i = ixgbe_ethertype_filter_lookup(filter_info,
+                                         IXGBE_ETHERTYPE_FLOW_CTRL);
+       if (i >= 0) {
+               RTE_LOG(ERR, PMD, "A ether type filter"
+                       " entity for flow control already exists!\n");
+               return;
        }
-       if (i == IXGBE_MAX_ETQF_FILTERS) {
+
+       ethertype_filter.ethertype = IXGBE_ETHERTYPE_FLOW_CTRL;
+       ethertype_filter.etqf = IXGBE_ETQF_FILTER_EN |
+                               IXGBE_ETQF_TX_ANTISPOOF |
+                               IXGBE_ETHERTYPE_FLOW_CTRL;
+       ethertype_filter.etqs = 0;
+       ethertype_filter.conf = TRUE;
+       i = ixgbe_ethertype_filter_insert(filter_info,
+                                         &ethertype_filter);
+       if (i < 0) {
                RTE_LOG(ERR, PMD, "Cannot find an unused ether type filter"
                        " entity for flow control.\n");
                return;
@@ -265,7 +253,7 @@ int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev)
 
        gpie = IXGBE_READ_REG(hw, IXGBE_GPIE);
        gpie &= ~IXGBE_GPIE_VTMODE_MASK;
-       gpie |= IXGBE_GPIE_MSIX_MODE;
+       gpie |= IXGBE_GPIE_MSIX_MODE | IXGBE_GPIE_PBA_SUPPORT;
 
        switch (RTE_ETH_DEV_SRIOV(eth_dev).active) {
        case ETH_64_POOLS:
@@ -350,10 +338,7 @@ set_rx_mode(struct rte_eth_dev *dev)
 
        IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl);
 
-       if (dev->data->dev_conf.rxmode.hw_vlan_strip)
-               ixgbe_vlan_hw_strip_enable_all(dev);
-       else
-               ixgbe_vlan_hw_strip_disable_all(dev);
+       ixgbe_vlan_hw_strip_config(dev);
 }
 
 static inline void
@@ -366,7 +351,7 @@ ixgbe_vf_reset_event(struct rte_eth_dev *dev, uint16_t vf)
        int rar_entry = hw->mac.num_rar_entries - (vf + 1);
        uint32_t vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
 
-       vmolr |= (IXGBE_VMOLR_ROPE | IXGBE_VMOLR_ROMPE |
+       vmolr |= (IXGBE_VMOLR_ROPE |
                        IXGBE_VMOLR_BAM | IXGBE_VMOLR_AUPE);
        IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
 
@@ -389,15 +374,27 @@ ixgbe_vf_reset_msg(struct rte_eth_dev *dev, uint16_t vf)
        uint32_t reg_offset, vf_shift;
        const uint8_t VFRE_SHIFT = 5;  /* VFRE 32 bits per slot */
        const uint8_t VFRE_MASK = (uint8_t)((1U << VFRE_SHIFT) - 1);
+       uint8_t  nb_q_per_pool;
+       int i;
 
        vf_shift = vf & VFRE_MASK;
        reg_offset = (vf >> VFRE_SHIFT) > 0 ? 1 : 0;
 
-       /* enable transmit and receive for vf */
+       /* enable transmit for vf */
        reg = IXGBE_READ_REG(hw, IXGBE_VFTE(reg_offset));
        reg |= (reg | (1 << vf_shift));
        IXGBE_WRITE_REG(hw, IXGBE_VFTE(reg_offset), reg);
 
+       /* enable all queue drop for IOV */
+       nb_q_per_pool = RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool;
+       for (i = vf * nb_q_per_pool; i < (vf + 1) * nb_q_per_pool; i++) {
+               IXGBE_WRITE_FLUSH(hw);
+               reg = IXGBE_QDE_ENABLE | IXGBE_QDE_WRITE;
+               reg |= i << IXGBE_QDE_IDX_SHIFT;
+               IXGBE_WRITE_REG(hw, IXGBE_QDE, reg);
+       }
+
+       /* enable receive for vf */
        reg = IXGBE_READ_REG(hw, IXGBE_VFRE(reg_offset));
        reg |= (reg | (1 << vf_shift));
        IXGBE_WRITE_REG(hw, IXGBE_VFRE(reg_offset), reg);
@@ -410,23 +407,6 @@ ixgbe_vf_reset_msg(struct rte_eth_dev *dev, uint16_t vf)
        ixgbe_vf_reset_event(dev, vf);
 }
 
-static int
-ixgbe_enable_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf)
-{
-       struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-       uint32_t vmolr;
-
-       vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
-
-       RTE_LOG(INFO, PMD, "VF %u: enabling multicast promiscuous\n", vf);
-
-       vmolr |= IXGBE_VMOLR_MPE;
-
-       IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
-
-       return 0;
-}
-
 static int
 ixgbe_disable_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf)
 {
@@ -463,7 +443,7 @@ ixgbe_vf_reset(struct rte_eth_dev *dev, uint16_t vf, uint32_t *msgbuf)
 
        /* reply to reset with ack and vf mac address */
        msgbuf[0] = IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_ACK;
-       rte_memcpy(new_mac, vf_mac, ETHER_ADDR_LEN);
+       rte_memcpy(new_mac, vf_mac, RTE_ETHER_ADDR_LEN);
        /*
         * Piggyback the multicast filter type so VF can compute the
         * correct vectors
@@ -483,7 +463,8 @@ ixgbe_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
        int rar_entry = hw->mac.num_rar_entries - (vf + 1);
        uint8_t *new_mac = (uint8_t *)(&msgbuf[1]);
 
-       if (is_valid_assigned_ether_addr((struct ether_addr *)new_mac)) {
+       if (rte_is_valid_assigned_ether_addr(
+                       (struct rte_ether_addr *)new_mac)) {
                rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 6);
                return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, IXGBE_RAH_AV);
        }
@@ -491,7 +472,7 @@ ixgbe_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 }
 
 static int
-ixgbe_vf_set_multicast(struct rte_eth_dev *dev, __rte_unused uint32_t vf, uint32_t *msgbuf)
+ixgbe_vf_set_multicast(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 {
        struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
        struct ixgbe_vf_info *vfinfo =
@@ -506,6 +487,7 @@ ixgbe_vf_set_multicast(struct rte_eth_dev *dev, __rte_unused uint32_t vf, uint32
        const uint32_t IXGBE_MTA_BIT_MASK = (0x1 << IXGBE_MTA_BIT_SHIFT) - 1;
        uint32_t reg_val;
        int i;
+       u32 vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
 
        /* Disable multicast promiscuous first */
        ixgbe_disable_vf_mc_promisc(dev, vf);
@@ -519,6 +501,12 @@ ixgbe_vf_set_multicast(struct rte_eth_dev *dev, __rte_unused uint32_t vf, uint32
                vfinfo->vf_mc_hashes[i] = hash_list[i];
        }
 
+       if (nb_entries == 0) {
+               vmolr &= ~IXGBE_VMOLR_ROMPE;
+               IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
+               return 0;
+       }
+
        for (i = 0; i < vfinfo->num_vf_mc_hashes; i++) {
                mta_idx = (vfinfo->vf_mc_hashes[i] >> IXGBE_MTA_BIT_SHIFT)
                                & IXGBE_MTA_INDEX_MASK;
@@ -528,6 +516,9 @@ ixgbe_vf_set_multicast(struct rte_eth_dev *dev, __rte_unused uint32_t vf, uint32
                IXGBE_WRITE_REG(hw, IXGBE_MTA(mta_idx), reg_val);
        }
 
+       vmolr |= IXGBE_VMOLR_ROMPE;
+       IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
+
        return 0;
 }
 
@@ -556,7 +547,7 @@ ixgbe_set_vf_lpe(struct rte_eth_dev *dev, __rte_unused uint32_t vf, uint32_t *ms
        struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
        uint32_t new_mtu = msgbuf[1];
        uint32_t max_frs;
-       int max_frame = new_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
+       int max_frame = new_mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
 
        /* X540 and X550 support jumbo frames in IOV mode */
        if (hw->mac.type != ixgbe_mac_X540 &&
@@ -565,7 +556,8 @@ ixgbe_set_vf_lpe(struct rte_eth_dev *dev, __rte_unused uint32_t vf, uint32_t *ms
                hw->mac.type != ixgbe_mac_X550EM_a)
                return -1;
 
-       if ((max_frame < ETHER_MIN_LEN) || (max_frame > ETHER_MAX_JUMBO_FRAME_LEN))
+       if (max_frame < RTE_ETHER_MIN_LEN ||
+                       max_frame > RTE_ETHER_MAX_JUMBO_FRAME_LEN)
                return -1;
 
        max_frs = (IXGBE_READ_REG(hw, IXGBE_MAXFRS) &
@@ -589,6 +581,7 @@ ixgbe_negotiate_vf_api(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
        case ixgbe_mbox_api_10:
        case ixgbe_mbox_api_11:
        case ixgbe_mbox_api_12:
+       case ixgbe_mbox_api_13:
                vfinfo[vf].api_version = (uint8_t)api_version;
                return 0;
        default:
@@ -607,6 +600,18 @@ ixgbe_get_vf_queues(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
        struct ixgbe_vf_info *vfinfo =
                *IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private);
        uint32_t default_q = vf * RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool;
+       struct rte_eth_conf *eth_conf;
+       struct rte_eth_vmdq_dcb_tx_conf *vmdq_dcb_tx_conf;
+       u8 num_tcs;
+       struct ixgbe_hw *hw;
+       u32 vmvir;
+#define IXGBE_VMVIR_VLANA_MASK         0xC0000000
+#define IXGBE_VMVIR_VLAN_VID_MASK      0x00000FFF
+#define IXGBE_VMVIR_VLAN_UP_MASK       0x0000E000
+#define VLAN_PRIO_SHIFT                        13
+       u32 vlana;
+       u32 vid;
+       u32 user_priority;
 
        /* Verify if the PF supports the mbox APIs version or not */
        switch (vfinfo[vf].api_version) {
@@ -625,10 +630,51 @@ ixgbe_get_vf_queues(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
        /* Notify VF of default queue */
        msgbuf[IXGBE_VF_DEF_QUEUE] = default_q;
 
-       /*
-        * FIX ME if it needs fill msgbuf[IXGBE_VF_TRANS_VLAN]
-        * for VLAN strip or VMDQ_DCB or VMDQ_DCB_RSS
-        */
+       /* Notify VF of number of DCB traffic classes */
+       eth_conf = &dev->data->dev_conf;
+       switch (eth_conf->txmode.mq_mode) {
+       case ETH_MQ_TX_NONE:
+       case ETH_MQ_TX_DCB:
+               RTE_LOG(ERR, PMD, "PF must work with virtualization for VF %u"
+                       ", but its tx mode = %d\n", vf,
+                       eth_conf->txmode.mq_mode);
+               return -1;
+
+       case ETH_MQ_TX_VMDQ_DCB:
+               vmdq_dcb_tx_conf = &eth_conf->tx_adv_conf.vmdq_dcb_tx_conf;
+               switch (vmdq_dcb_tx_conf->nb_queue_pools) {
+               case ETH_16_POOLS:
+                       num_tcs = ETH_8_TCS;
+                       break;
+               case ETH_32_POOLS:
+                       num_tcs = ETH_4_TCS;
+                       break;
+               default:
+                       return -1;
+               }
+               break;
+
+       /* ETH_MQ_TX_VMDQ_ONLY,  DCB not enabled */
+       case ETH_MQ_TX_VMDQ_ONLY:
+               hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+               vmvir = IXGBE_READ_REG(hw, IXGBE_VMVIR(vf));
+               vlana = vmvir & IXGBE_VMVIR_VLANA_MASK;
+               vid = vmvir & IXGBE_VMVIR_VLAN_VID_MASK;
+               user_priority =
+                       (vmvir & IXGBE_VMVIR_VLAN_UP_MASK) >> VLAN_PRIO_SHIFT;
+               if ((vlana == IXGBE_VMVIR_VLANA_DEFAULT) &&
+                       ((vid !=  0) || (user_priority != 0)))
+                       num_tcs = 1;
+               else
+                       num_tcs = 0;
+               break;
+
+       default:
+               RTE_LOG(ERR, PMD, "PF work with invalid mode = %d\n",
+                       eth_conf->txmode.mq_mode);
+               return -1;
+       }
+       msgbuf[IXGBE_VF_TRANS_VLAN] = num_tcs;
 
        return 0;
 }
@@ -638,19 +684,70 @@ ixgbe_set_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 {
        struct ixgbe_vf_info *vfinfo =
                *(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private));
-       bool enable = !!msgbuf[1];      /* msgbuf contains the flag to enable */
+       struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+       int xcast_mode = msgbuf[1];     /* msgbuf contains the flag to enable */
+       u32 vmolr, fctrl, disable, enable;
 
        switch (vfinfo[vf].api_version) {
        case ixgbe_mbox_api_12:
+               /* promisc introduced in 1.3 version */
+               if (xcast_mode == IXGBEVF_XCAST_MODE_PROMISC)
+                       return -EOPNOTSUPP;
+               break;
+               /* Fall threw */
+       case ixgbe_mbox_api_13:
                break;
        default:
                return -1;
        }
 
-       if (enable)
-               return ixgbe_enable_vf_mc_promisc(dev, vf);
-       else
-               return ixgbe_disable_vf_mc_promisc(dev, vf);
+       if (vfinfo[vf].xcast_mode == xcast_mode)
+               goto out;
+
+       switch (xcast_mode) {
+       case IXGBEVF_XCAST_MODE_NONE:
+               disable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE |
+                         IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
+               enable = 0;
+               break;
+       case IXGBEVF_XCAST_MODE_MULTI:
+               disable = IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
+               enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE;
+               break;
+       case IXGBEVF_XCAST_MODE_ALLMULTI:
+               disable = IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
+               enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE | IXGBE_VMOLR_MPE;
+               break;
+       case IXGBEVF_XCAST_MODE_PROMISC:
+               if (hw->mac.type <= ixgbe_mac_82599EB)
+                       return -1;
+
+               fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
+               if (!(fctrl & IXGBE_FCTRL_UPE)) {
+                       /* VF promisc requires PF in promisc */
+                       RTE_LOG(ERR, PMD,
+                              "Enabling VF promisc requires PF in promisc\n");
+                       return -1;
+               }
+
+               disable = 0;
+               enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE |
+                        IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
+               break;
+       default:
+               return -1;
+       }
+
+       vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
+       vmolr &= ~disable;
+       vmolr |= enable;
+       IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
+       vfinfo[vf].xcast_mode = xcast_mode;
+
+out:
+       msgbuf[1] = xcast_mode;
+
+       return 0;
 }
 
 static int
@@ -663,7 +760,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
        struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
        struct ixgbe_vf_info *vfinfo =
                *IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private);
-       struct rte_pmd_ixgbe_mb_event_param cb_param;
+       struct rte_pmd_ixgbe_mb_event_param ret_param;
 
        retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf);
        if (retval) {
@@ -682,10 +779,10 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
         * initialise structure to send to user application
         * will return response from user in retval field
         */
-       cb_param.retval = RTE_PMD_IXGBE_MB_EVENT_PROCEED;
-       cb_param.vfid = vf;
-       cb_param.msg_type = msgbuf[0] & 0xFFFF;
-       cb_param.msg = (void *)msgbuf;
+       ret_param.retval = RTE_PMD_IXGBE_MB_EVENT_PROCEED;
+       ret_param.vfid = vf;
+       ret_param.msg_type = msgbuf[0] & 0xFFFF;
+       ret_param.msg = (void *)msgbuf;
 
        /* perform VF reset */
        if (msgbuf[0] == IXGBE_VF_RESET) {
@@ -694,20 +791,22 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
                vfinfo[vf].clear_to_send = true;
 
                /* notify application about VF reset */
-               _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, &cb_param);
+               _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX,
+                                             &ret_param);
                return ret;
        }
 
        /**
         * ask user application if we allowed to perform those functions
-        * if we get cb_param.retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED
+        * if we get ret_param.retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED
         * then business as usual,
         * if 0, do nothing and send ACK to VF
-        * if cb_param.retval > 1, do nothing and send NAK to VF
+        * if ret_param.retval > 1, do nothing and send NAK to VF
         */
-       _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, &cb_param);
+       _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX,
+                                     &ret_param);
 
-       retval = cb_param.retval;
+       retval = ret_param.retval;
 
        /* check & process VF to PF mailbox message */
        switch ((msgbuf[0] & 0xFFFF)) {