net/bnxt: fix Rx configuration
[dpdk.git] / drivers / net / bnxt / bnxt_ethdev.c
index 82350a5..181de42 100644 (file)
@@ -786,17 +786,11 @@ skip_cosq_cfg:
                }
        }
 
-       /* default vnic 0 */
-       rc = bnxt_setup_one_vnic(bp, 0);
-       if (rc)
-               goto err_out;
        /* VNIC configuration */
-       if (BNXT_RFS_NEEDS_VNIC(bp)) {
-               for (i = 1; i < bp->nr_vnics; i++) {
-                       rc = bnxt_setup_one_vnic(bp, i);
-                       if (rc)
-                               goto err_out;
-               }
+       for (i = 0; i < bp->nr_vnics; i++) {
+               rc = bnxt_setup_one_vnic(bp, i);
+               if (rc)
+                       goto err_out;
        }
 
        for (j = 0; j < bp->tx_nr_rings; j++) {
@@ -977,16 +971,10 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
        dev_info->min_rx_bufsize = 1;
        dev_info->max_rx_pktlen = BNXT_MAX_PKT_LEN;
 
-       dev_info->rx_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT;
-       if (bp->flags & BNXT_FLAG_PTP_SUPPORTED)
-               dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_TIMESTAMP;
-       if (bp->vnic_cap_flags & BNXT_VNIC_CAP_VLAN_RX_STRIP)
-               dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_VLAN_STRIP;
+       dev_info->rx_offload_capa = bnxt_get_rx_port_offloads(bp);
        dev_info->tx_queue_offload_capa = RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
-       dev_info->tx_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT |
+       dev_info->tx_offload_capa = bnxt_get_tx_port_offloads(bp) |
                                    dev_info->tx_queue_offload_capa;
-       if (bp->fw_cap & BNXT_FW_CAP_VLAN_TX_INSERT)
-               dev_info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_VLAN_INSERT;
        dev_info->flow_type_rss_offloads = BNXT_ETH_RSS_SUPPORT;
 
        dev_info->speed_capa = bnxt_get_speed_capabilities(bp);
@@ -1477,8 +1465,7 @@ static int bnxt_dev_stop(struct rte_eth_dev *eth_dev)
        eth_dev->data->dev_started = 0;
 
        /* Prevent crashes when queues are still in use */
-       eth_dev->rx_pkt_burst = &bnxt_dummy_recv_pkts;
-       eth_dev->tx_pkt_burst = &bnxt_dummy_xmit_pkts;
+       bnxt_stop_rxtx(eth_dev);
 
        bnxt_disable_int(bp);
 
@@ -1537,7 +1524,7 @@ static int bnxt_dev_stop(struct rte_eth_dev *eth_dev)
 }
 
 /* Unload the driver, release resources */
-static int bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
+int bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
 {
        struct bnxt *bp = eth_dev->data->dev_private;
 
@@ -1553,7 +1540,7 @@ static int bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
        return bnxt_dev_stop(eth_dev);
 }
 
-static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
+int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 {
        struct bnxt *bp = eth_dev->data->dev_private;
        uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
@@ -1685,6 +1672,7 @@ static int bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
        rte_eal_alarm_cancel(bnxt_dev_reset_and_resume, (void *)bp);
        rte_eal_alarm_cancel(bnxt_dev_recover, (void *)bp);
        bnxt_cancel_fc_thread(bp);
+       rte_eal_alarm_cancel(bnxt_handle_vf_cfg_change, (void *)bp);
 
        if (eth_dev->data->dev_started)
                ret = bnxt_dev_stop(eth_dev);
@@ -2137,8 +2125,6 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev,
                        return -EINVAL;
        }
 
-       bp->flags |= BNXT_FLAG_UPDATE_HASH;
-
        /* Update the default RSS VNIC(s) */
        vnic = BNXT_GET_DEFAULT_VNIC(bp);
        vnic->hash_type = bnxt_rte_to_hwrm_hash_types(rss_conf->rss_hf);
@@ -4376,16 +4362,16 @@ static void bnxt_dev_recover(void *arg)
                goto err_start;
        }
 
+       rc = bnxt_restore_filters(bp);
+       if (rc)
+               goto err_start;
+
        rte_eth_fp_ops[bp->eth_dev->data->port_id].rx_pkt_burst =
                bp->eth_dev->rx_pkt_burst;
        rte_eth_fp_ops[bp->eth_dev->data->port_id].tx_pkt_burst =
                bp->eth_dev->tx_pkt_burst;
        rte_mb();
 
-       rc = bnxt_restore_filters(bp);
-       if (rc)
-               goto err_start;
-
        PMD_DRV_LOG(INFO, "Port: %u Recovered from FW reset\n",
                    bp->eth_dev->data->port_id);
        pthread_mutex_unlock(&bp->err_recovery_lock);
@@ -4401,7 +4387,8 @@ err:
                                             RTE_ETH_EVENT_INTR_RMV,
                                             NULL);
        pthread_mutex_unlock(&bp->err_recovery_lock);
-       PMD_DRV_LOG(ERR, "Failed to recover from FW reset\n");
+       PMD_DRV_LOG(ERR, "Port %u: Failed to recover from FW reset\n",
+                   bp->eth_dev->data->port_id);
 }
 
 void bnxt_dev_reset_and_resume(void *arg)
@@ -4437,7 +4424,8 @@ void bnxt_dev_reset_and_resume(void *arg)
 
        rc = rte_eal_alarm_set(us, bnxt_dev_recover, (void *)bp);
        if (rc)
-               PMD_DRV_LOG(ERR, "Error setting recovery alarm");
+               PMD_DRV_LOG(ERR, "Port %u: Error setting recovery alarm",
+                           bp->eth_dev->data->port_id);
 }
 
 uint32_t bnxt_read_fw_status_reg(struct bnxt *bp, uint32_t index)
@@ -4561,7 +4549,7 @@ reset:
        bp->flags |= BNXT_FLAG_FATAL_ERROR;
        bp->flags |= BNXT_FLAG_FW_RESET;
 
-       bnxt_stop_rxtx(bp);
+       bnxt_stop_rxtx(bp->eth_dev);
 
        PMD_DRV_LOG(ERR, "Detected FW dead condition\n");
 
@@ -5230,10 +5218,6 @@ static int bnxt_get_config(struct bnxt *bp)
        if (rc)
                return rc;
 
-       rc = bnxt_hwrm_cfa_adv_flow_mgmt_qcaps(bp);
-       if (rc)
-               return rc;
-
        bnxt_hwrm_port_mac_qcfg(bp);
 
        bnxt_hwrm_parent_pf_qcfg(bp);
@@ -5895,8 +5879,7 @@ static void bnxt_free_ctx_mem_buf(struct bnxt_ctx_mem_buf_info *ctx)
        if (!ctx)
                return;
 
-       if (ctx->va)
-               rte_free(ctx->va);
+       rte_free(ctx->va);
 
        ctx->va = NULL;
        ctx->dma = RTE_BAD_IOVA;
@@ -6368,4 +6351,4 @@ bool is_bnxt_supported(struct rte_eth_dev *dev)
 RTE_LOG_REGISTER_SUFFIX(bnxt_logtype_driver, driver, NOTICE);
 RTE_PMD_REGISTER_PCI(net_bnxt, bnxt_rte_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_bnxt, bnxt_pci_id_map);
-
+RTE_PMD_REGISTER_KMOD_DEP(net_bnxt, "* igb_uio | uio_pci_generic | vfio-pci");