net/bnxt: add initial Tx code
[dpdk.git] / drivers / net / bnxt / bnxt_ethdev.c
index a8a9912..4ace543 100644 (file)
 
 #include "bnxt.h"
 #include "bnxt_hwrm.h"
+#include "bnxt_rxq.h"
+#include "bnxt_stats.h"
+#include "bnxt_txq.h"
+#include "bnxt_txr.h"
 
 #define DRV_MODULE_NAME                "bnxt"
 static const char bnxt_version[] =
@@ -154,6 +158,29 @@ found:
        dev_info->vmdq_queue_base = 0;
 }
 
+/* Configure the device based on the configuration provided */
+static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
+{
+       struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+       int rc;
+
+       bp->rx_queues = (void *)eth_dev->data->rx_queues;
+       bp->tx_queues = (void *)eth_dev->data->tx_queues;
+
+       /* Inherit new configurations */
+       bp->rx_nr_rings = eth_dev->data->nb_rx_queues;
+       bp->tx_nr_rings = eth_dev->data->nb_tx_queues;
+       bp->rx_cp_nr_rings = bp->rx_nr_rings;
+       bp->tx_cp_nr_rings = bp->tx_nr_rings;
+
+       if (eth_dev->data->dev_conf.rxmode.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;
+       rc = bnxt_set_hwrm_link_config(bp, true);
+       return rc;
+}
+
 /*
  * Initialization
  */
@@ -161,6 +188,13 @@ found:
 static struct eth_dev_ops bnxt_dev_ops = {
        .dev_infos_get = bnxt_dev_info_get_op,
        .dev_close = bnxt_dev_close_op,
+       .dev_configure = bnxt_dev_configure_op,
+       .stats_get = bnxt_stats_get_op,
+       .stats_reset = bnxt_stats_reset_op,
+       .rx_queue_setup = bnxt_rx_queue_setup_op,
+       .rx_queue_release = bnxt_rx_queue_release_op,
+       .tx_queue_setup = bnxt_tx_queue_setup_op,
+       .tx_queue_release = bnxt_tx_queue_release_op,
 };
 
 static bool bnxt_vf_pciid(uint16_t id)
@@ -236,7 +270,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
        }
        eth_dev->dev_ops = &bnxt_dev_ops;
        /* eth_dev->rx_pkt_burst = &bnxt_recv_pkts; */
-       /* eth_dev->tx_pkt_burst = &bnxt_xmit_pkts; */
+       eth_dev->tx_pkt_burst = &bnxt_xmit_pkts;
 
        rc = bnxt_alloc_hwrm_resources(bp);
        if (rc) {