config: enable virtual IOVA by default for DPAA2
[dpdk.git] / drivers / net / ixgbe / ixgbe_pf.c
index 4b33130..c0d86c7 100644 (file)
@@ -61,7 +61,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;
 }
@@ -199,6 +199,7 @@ ixgbe_add_tx_flow_control_drop_filter(struct rte_eth_dev *eth_dev)
                                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) {
@@ -396,15 +397,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);
@@ -498,7 +511,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 =
@@ -670,7 +683,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) {
@@ -689,10 +702,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) {
@@ -701,20 +714,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,
+                                             NULL, &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,
+                                     NULL, &ret_param);
 
-       retval = cb_param.retval;
+       retval = ret_param.retval;
 
        /* check & process VF to PF mailbox message */
        switch ((msgbuf[0] & 0xFFFF)) {