New upstream version 16.11.8
[deb_dpdk.git] / drivers / net / bnxt / bnxt_ethdev.c
index 359a95d..44bf6ba 100644 (file)
@@ -137,6 +137,7 @@ static struct rte_pci_id bnxt_pci_id_map[] = {
        ETH_RSS_NONFRAG_IPV6_UDP)
 
 static void bnxt_print_link_info(struct rte_eth_dev *eth_dev);
+static int bnxt_dev_uninit(struct rte_eth_dev *eth_dev);
 
 /***********************/
 
@@ -222,6 +223,17 @@ static int bnxt_init_chip(struct bnxt *bp)
        /* VNIC configuration */
        for (i = 0; i < bp->nr_vnics; i++) {
                struct bnxt_vnic_info *vnic = &bp->vnic_info[i];
+               uint32_t size = sizeof(*vnic->fw_grp_ids) * bp->max_ring_grps;
+
+               vnic->fw_grp_ids = rte_zmalloc("vnic_fw_grp_ids", size, 0);
+               if (!vnic->fw_grp_ids) {
+                       RTE_LOG(ERR, PMD,
+                                   "Failed to alloc %d bytes for group ids\n",
+                                   size);
+                       rc = -ENOMEM;
+                       goto err_out;
+               }
+               memset(vnic->fw_grp_ids, -1, size);
 
                rc = bnxt_hwrm_vnic_alloc(bp, vnic);
                if (rc) {
@@ -347,12 +359,12 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
                dev_info->max_rx_queues = bp->pf.max_rx_rings;
                dev_info->max_tx_queues = bp->pf.max_tx_rings;
                dev_info->max_vfs = bp->pf.active_vfs;
-               dev_info->reta_size = bp->pf.max_rsscos_ctx;
+               dev_info->reta_size = HW_HASH_INDEX_SIZE;
                max_vnics = bp->pf.max_vnics;
        } else {
                dev_info->max_rx_queues = bp->vf.max_rx_rings;
                dev_info->max_tx_queues = bp->vf.max_tx_rings;
-               dev_info->reta_size = bp->vf.max_rsscos_ctx;
+               dev_info->reta_size = HW_HASH_INDEX_SIZE;
                max_vnics = bp->vf.max_vnics;
        }
 
@@ -379,7 +391,8 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
                        .wthresh = 0,
                },
                .rx_free_thresh = 32,
-               .rx_drop_en = 0,
+               /* If no descriptors available, pkts are dropped by default */
+               .rx_drop_en = 1,
        };
 
        dev_info->default_txconf = (struct rte_eth_txconf) {
@@ -552,6 +565,8 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
        bnxt_set_hwrm_link_config(bp, false);
        bnxt_disable_int(bp);
        bnxt_free_int(bp);
+       bnxt_free_tx_mbufs(bp);
+       bnxt_free_rx_mbufs(bp);
        bnxt_shutdown_nic(bp);
        bp->dev_stopped = 1;
 }
@@ -563,8 +578,6 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
        if (bp->dev_stopped == 0)
                bnxt_dev_stop_op(eth_dev);
 
-       bnxt_free_tx_mbufs(bp);
-       bnxt_free_rx_mbufs(bp);
        bnxt_free_mem(bp);
        if (eth_dev->data->mac_addrs != NULL) {
                rte_free(eth_dev->data->mac_addrs);
@@ -574,6 +587,8 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
                rte_free(bp->grp_info);
                bp->grp_info = NULL;
        }
+
+       bnxt_dev_uninit(eth_dev);
 }
 
 static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev,