net/bnxt: use first completion ring for fwd and async event
[dpdk.git] / drivers / net / bnxt / bnxt_ethdev.c
index df4bed4..0aba9a3 100644 (file)
@@ -168,23 +168,12 @@ static void bnxt_free_mem(struct bnxt *bp)
        bnxt_free_stats(bp);
        bnxt_free_tx_rings(bp);
        bnxt_free_rx_rings(bp);
-       bnxt_free_def_cp_ring(bp);
 }
 
 static int bnxt_alloc_mem(struct bnxt *bp)
 {
        int rc;
 
-       /* Default completion ring */
-       rc = bnxt_init_def_ring_struct(bp, SOCKET_ID_ANY);
-       if (rc)
-               goto alloc_mem_err;
-
-       rc = bnxt_alloc_rings(bp, 0, NULL, NULL,
-                             bp->def_cp_ring, "def_cp");
-       if (rc)
-               goto alloc_mem_err;
-
        rc = bnxt_alloc_vnic_mem(bp);
        if (rc)
                goto alloc_mem_err;
@@ -501,36 +490,19 @@ found:
 static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 {
        struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
-       uint64_t tx_offloads = eth_dev->data->dev_conf.txmode.offloads;
        uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
 
-       if (tx_offloads != (tx_offloads & BNXT_DEV_TX_OFFLOAD_SUPPORT)) {
-               PMD_DRV_LOG
-                       (ERR,
-                        "Tx offloads requested 0x%" PRIx64 " supported 0x%x\n",
-                        tx_offloads, BNXT_DEV_TX_OFFLOAD_SUPPORT);
-               return -ENOTSUP;
-       }
-
-       if (rx_offloads != (rx_offloads & BNXT_DEV_RX_OFFLOAD_SUPPORT)) {
-               PMD_DRV_LOG
-                       (ERR,
-                        "Rx offloads requested 0x%" PRIx64 " supported 0x%x\n",
-                           rx_offloads, BNXT_DEV_RX_OFFLOAD_SUPPORT);
-               return -ENOTSUP;
-       }
-
        bp->rx_queues = (void *)eth_dev->data->rx_queues;
        bp->tx_queues = (void *)eth_dev->data->tx_queues;
 
        /* Inherit new configurations */
        if (eth_dev->data->nb_rx_queues > bp->max_rx_rings ||
            eth_dev->data->nb_tx_queues > bp->max_tx_rings ||
-           eth_dev->data->nb_rx_queues + eth_dev->data->nb_tx_queues + 1 >
+           eth_dev->data->nb_rx_queues + eth_dev->data->nb_tx_queues >
            bp->max_cp_rings ||
            eth_dev->data->nb_rx_queues + eth_dev->data->nb_tx_queues >
            bp->max_stat_ctx ||
-           (uint32_t)(eth_dev->data->nb_rx_queues + 1) > bp->max_ring_grps) {
+           (uint32_t)(eth_dev->data->nb_rx_queues) > bp->max_ring_grps) {
                PMD_DRV_LOG(ERR,
                        "Insufficient resources to support requested config\n");
                PMD_DRV_LOG(ERR,
@@ -552,7 +524,8 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
        if (rx_offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
                eth_dev->data->mtu =
                                eth_dev->data->dev_conf.rxmode.max_rx_pkt_len -
-                               ETHER_HDR_LEN - ETHER_CRC_LEN - VLAN_TAG_SIZE;
+                               ETHER_HDR_LEN - ETHER_CRC_LEN - VLAN_TAG_SIZE *
+                               BNXT_NUM_VLANS;
                bnxt_mtu_set_op(eth_dev, eth_dev->data->mtu);
        }
        return 0;
@@ -647,13 +620,15 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
 {
        struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
 
+       bp->flags &= ~BNXT_FLAG_INIT_DONE;
        if (bp->eth_dev->data->dev_started) {
                /* TBD: STOP HW queues DMA */
                eth_dev->data->dev_link.link_status = 0;
        }
        bnxt_set_hwrm_link_config(bp, false);
        bnxt_hwrm_port_clr_stats(bp);
-       bp->flags &= ~BNXT_FLAG_INIT_DONE;
+       bnxt_free_tx_mbufs(bp);
+       bnxt_free_rx_mbufs(bp);
        bnxt_shutdown_nic(bp);
        bp->dev_stopped = 1;
 }
@@ -665,8 +640,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);
@@ -2448,6 +2421,7 @@ bnxt_fdir_filter(struct rte_eth_dev *dev,
        switch (filter_op) {
        case RTE_ETH_FILTER_ADD:
        case RTE_ETH_FILTER_DELETE:
+               /* FALLTHROUGH */
                filter = bnxt_get_unused_filter(bp);
                if (filter == NULL) {
                        PMD_DRV_LOG(ERR,
@@ -2913,6 +2887,7 @@ static bool bnxt_dir_type_is_ape_bin_format(uint16_t dir_type)
        case BNX_DIR_TYPE_KONG_PATCH:
        case BNX_DIR_TYPE_BONO_FW:
        case BNX_DIR_TYPE_BONO_PATCH:
+               /* FALLTHROUGH */
                return true;
        }
 
@@ -2931,6 +2906,7 @@ static bool bnxt_dir_type_is_other_exec_format(uint16_t dir_type)
        case BNX_DIR_TYPE_ISCSI_BOOT:
        case BNX_DIR_TYPE_ISCSI_BOOT_IPV6:
        case BNX_DIR_TYPE_ISCSI_BOOT_IPV4N6:
+               /* FALLTHROUGH */
                return true;
        }
 
@@ -3164,10 +3140,10 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
        }
 skip_init:
        eth_dev->dev_ops = &bnxt_dev_ops;
-       if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-               return 0;
        eth_dev->rx_pkt_burst = &bnxt_recv_pkts;
        eth_dev->tx_pkt_burst = &bnxt_xmit_pkts;
+       if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+               return 0;
 
        if (BNXT_PF(bp) && pci_dev->id.device_id != BROADCOM_DEV_ID_NS2) {
                snprintf(mz_name, RTE_MEMZONE_NAMESIZE,
@@ -3396,10 +3372,6 @@ skip_init:
        if (rc)
                goto error_free_int;
 
-       rc = bnxt_alloc_def_cp_ring(bp);
-       if (rc)
-               goto error_free_int;
-
        bnxt_enable_int(bp);
        bnxt_init_nic(bp);
 
@@ -3407,7 +3379,6 @@ skip_init:
 
 error_free_int:
        bnxt_disable_int(bp);
-       bnxt_free_def_cp_ring(bp);
        bnxt_hwrm_func_buf_unrgtr(bp);
        bnxt_free_int(bp);
        bnxt_free_mem(bp);