[RFC,10/29] net/qdma: add net PMD ops template

Message ID 20220706075219.517046-11-aman.kumar@vvdntech.in (mailing list archive)
State Changes Requested, archived
Delegated to: Thomas Monjalon
Headers
Series cover letter for net/qdma PMD |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Aman Kumar July 6, 2022, 7:52 a.m. UTC
  define dpdk pmd ops function for the device.
routines are added as dummy calls.

Signed-off-by: Aman Kumar <aman.kumar@vvdntech.in>
---
 drivers/net/qdma/meson.build    |   5 +-
 drivers/net/qdma/qdma.h         |   1 +
 drivers/net/qdma/qdma_devops.c  | 464 ++++++++++++++++++++++++++++++
 drivers/net/qdma/qdma_devops.h  | 486 ++++++++++++++++++++++++++++++++
 drivers/net/qdma/qdma_ethdev.c  |  11 +-
 drivers/net/qdma/rte_pmd_qdma.h |   8 +-
 6 files changed, 970 insertions(+), 5 deletions(-)
 create mode 100644 drivers/net/qdma/qdma_devops.c
 create mode 100644 drivers/net/qdma/qdma_devops.h
  

Patch

diff --git a/drivers/net/qdma/meson.build b/drivers/net/qdma/meson.build
index 99076e1ebf..858d981002 100644
--- a/drivers/net/qdma/meson.build
+++ b/drivers/net/qdma/meson.build
@@ -17,9 +17,12 @@  includes += include_directories('qdma_access/qdma_soft_access')
 includes += include_directories('qdma_access/eqdma_soft_access')
 includes += include_directories('qdma_access/qdma_s80_hard_access')
 
+headers += files('rte_pmd_qdma.h')
+
 sources = files(
-        'qdma_ethdev.c',
         'qdma_common.c',
+        'qdma_devops.c',
+        'qdma_ethdev.c',
         'qdma_access/eqdma_soft_access/eqdma_soft_access.c',
         'qdma_access/eqdma_soft_access/eqdma_soft_reg_dump.c',
         'qdma_access/qdma_s80_hard_access/qdma_s80_hard_access.c',
diff --git a/drivers/net/qdma/qdma.h b/drivers/net/qdma/qdma.h
index 7c2d3b34e0..f4155380f9 100644
--- a/drivers/net/qdma/qdma.h
+++ b/drivers/net/qdma/qdma.h
@@ -248,6 +248,7 @@  struct qdma_pci_dev {
 	int16_t rx_qid_statid_map[RTE_ETHDEV_QUEUE_STAT_CNTRS];
 };
 
+void qdma_dev_ops_init(struct rte_eth_dev *dev);
 int qdma_identify_bars(struct rte_eth_dev *dev);
 int qdma_get_hw_version(struct rte_eth_dev *dev);
 
diff --git a/drivers/net/qdma/qdma_devops.c b/drivers/net/qdma/qdma_devops.c
new file mode 100644
index 0000000000..cf3ef6de34
--- /dev/null
+++ b/drivers/net/qdma/qdma_devops.c
@@ -0,0 +1,464 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2017-2022 Xilinx, Inc. All rights reserved.
+ * Copyright(c) 2022 VVDN Technologies Private Limited. All rights reserved.
+ */
+
+#include <stdint.h>
+#include <sys/mman.h>
+#include <sys/fcntl.h>
+#include <rte_memzone.h>
+#include <rte_string_fns.h>
+#include <ethdev_pci.h>
+#include <rte_malloc.h>
+#include <rte_dev.h>
+#include <rte_pci.h>
+#include <rte_ether.h>
+#include <rte_ethdev.h>
+#include <rte_alarm.h>
+#include <rte_cycles.h>
+#include <rte_atomic.h>
+#include <unistd.h>
+#include <string.h>
+
+#include "qdma.h"
+#include "qdma_access_common.h"
+#include "qdma_reg_dump.h"
+#include "qdma_platform.h"
+#include "qdma_devops.h"
+
+/**
+ * DPDK callback to configure a RX queue.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ * @param rx_queue_id
+ *   RX queue index.
+ * @param nb_rx_desc
+ *   Number of descriptors to configure in queue.
+ * @param socket_id
+ *   NUMA socket on which memory must be allocated.
+ * @param[in] rx_conf
+ *   Thresholds parameters.
+ * @param mp_pool
+ *   Memory pool for buffer allocations.
+ *
+ * @return
+ *   0 on success,
+ *   -ENOMEM when memory allocation fails
+ *   -ENOTSUP when HW doesn't support the required configuration
+ *   -EINVAL on other failure.
+ */
+int qdma_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
+			    uint16_t nb_rx_desc, unsigned int socket_id,
+			    const struct rte_eth_rxconf *rx_conf,
+			    struct rte_mempool *mb_pool)
+{
+	(void)dev;
+	(void)rx_queue_id;
+	(void)nb_rx_desc;
+	(void)socket_id;
+	(void)rx_conf;
+	(void)mb_pool;
+
+	return 0;
+}
+
+/**
+ * DPDK callback to configure a TX queue.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ * @param tx_queue_id
+ *   TX queue index.
+ * @param nb_tx_desc
+ *   Number of descriptors to configure in queue.
+ * @param socket_id
+ *   NUMA socket on which memory must be allocated.
+ * @param[in] tx_conf
+ *   Thresholds parameters.
+ *
+ * @return
+ *   0 on success
+ *   -ENOMEM when memory allocation fails
+ *   -EINVAL on other failure.
+ */
+int qdma_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
+			    uint16_t nb_tx_desc, unsigned int socket_id,
+			    const struct rte_eth_txconf *tx_conf)
+{
+	(void)dev;
+	(void)tx_queue_id;
+	(void)nb_tx_desc;
+	(void)socket_id;
+	(void)tx_conf;
+
+	return 0;
+}
+
+void qdma_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t q_id)
+{
+	(void)dev;
+	(void)q_id;
+}
+
+void qdma_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t q_id)
+{
+	(void)dev;
+	(void)q_id;
+}
+
+/**
+ * DPDK callback to start the device.
+ *
+ * Start the device by configuring the Rx/Tx descriptor and device registers.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, negative errno value on failure.
+ */
+int qdma_dev_start(struct rte_eth_dev *dev)
+{
+	(void)dev;
+
+	return 0;
+}
+
+/**
+ * DPDK callback to retrieve the physical link information.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ * @param wait_to_complete
+ *   wait_to_complete field is ignored.
+ */
+int qdma_dev_link_update(struct rte_eth_dev *dev,
+				__rte_unused int wait_to_complete)
+{
+	dev->data->dev_link.link_status = RTE_ETH_LINK_UP;
+	dev->data->dev_link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
+	dev->data->dev_link.link_speed = RTE_ETH_SPEED_NUM_25G;
+	PMD_DRV_LOG(INFO, "Link update done\n");
+	return 0;
+}
+
+/**
+ * DPDK callback to get information about the device.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ * @param[out] dev_info
+ *   Device information structure output buffer.
+ */
+int qdma_dev_infos_get(struct rte_eth_dev *dev,
+		       struct rte_eth_dev_info *dev_info)
+{
+	struct qdma_pci_dev *qdma_dev = dev->data->dev_private;
+
+	dev_info->max_rx_queues = qdma_dev->dev_cap.num_qs;
+	dev_info->max_tx_queues = qdma_dev->dev_cap.num_qs;
+
+	dev_info->min_rx_bufsize = 256;
+	dev_info->max_rx_pktlen = DMA_BRAM_SIZE;
+	dev_info->max_mac_addrs = 1;
+
+	return 0;
+}
+
+/**
+ * DPDK callback to stop the device.
+ *
+ * Stop the device by clearing all configured Rx/Tx queue
+ * descriptors and registers.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ */
+int qdma_dev_stop(struct rte_eth_dev *dev)
+{
+	(void)dev;
+
+	return 0;
+}
+
+/**
+ * DPDK callback to close the device.
+ *
+ * Destroy all queues and objects, free memory.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ */
+int qdma_dev_close(struct rte_eth_dev *dev)
+{
+	(void)dev;
+
+	return 0;
+}
+
+/**
+ * DPDK callback to reset the device.
+ *
+ * Uninitialze PF device after waiting for all its VFs to shutdown.
+ * Initialize back PF device and then send Reset done mailbox
+ * message to all its VFs to come online again.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, negative errno value on failure.
+ */
+int qdma_dev_reset(struct rte_eth_dev *dev)
+{
+	(void)dev;
+
+	return 0;
+}
+
+/**
+ * DPDK callback for Ethernet device configuration.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, negative errno value on failure.
+ */
+int qdma_dev_configure(struct rte_eth_dev *dev)
+{
+	(void)dev;
+
+	return 0;
+}
+
+int qdma_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t qid)
+{
+	(void)dev;
+	(void)qid;
+
+	return 0;
+}
+
+
+int qdma_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t qid)
+{
+	(void)dev;
+	(void)qid;
+
+	return 0;
+}
+
+int qdma_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t qid)
+{
+	(void)dev;
+	(void)qid;
+
+	return 0;
+}
+
+int qdma_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qid)
+{
+	(void)dev;
+	(void)qid;
+
+	return 0;
+}
+
+/**
+ * DPDK callback to retrieve device registers and
+ * register attributes (number of registers and register size)
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ * @param regs
+ *   Pointer to rte_dev_reg_info structure to fill in. If regs->data is
+ *   NULL the function fills in the width and length fields. If non-NULL
+ *   the registers are put into the buffer pointed at by the data field.
+ *
+ * @return
+ *   0 on success, -ENOTSUP on failure.
+ */
+int
+qdma_dev_get_regs(struct rte_eth_dev *dev,
+	      struct rte_dev_reg_info *regs)
+{
+	(void)dev;
+	(void)regs;
+
+	return -ENOTSUP;
+}
+
+/**
+ * DPDK callback to set a queue statistics mapping for
+ * a tx/rx queue of an Ethernet device.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ * @param queue_id
+ *   Index of the queue for which a queue stats mapping is required.
+ * @param stat_idx
+ *   The per-queue packet statistics functionality number that
+ *   the queue_id is to be assigned.
+ * @param is_rx
+ *   Whether queue is a Rx or a Tx queue.
+ *
+ * @return
+ *   0 on success, -EINVAL on failure.
+ */
+int qdma_dev_queue_stats_mapping(struct rte_eth_dev *dev,
+				 uint16_t queue_id,
+				 uint8_t stat_idx,
+				 uint8_t is_rx)
+{
+	(void)dev;
+	(void)queue_id;
+	(void)stat_idx;
+	(void)is_rx;
+
+	return 0;
+}
+
+/**
+ * DPDK callback for retrieving Port statistics.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ * @param eth_stats
+ *   Pointer to structure containing statistics.
+ *
+ * @return
+ *   Returns 0 i.e. success
+ */
+int qdma_dev_stats_get(struct rte_eth_dev *dev,
+			      struct rte_eth_stats *eth_stats)
+{
+	(void)dev;
+	(void)eth_stats;
+
+	return 0;
+}
+
+/**
+ * DPDK callback to reset Port statistics.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ *
+ */
+int qdma_dev_stats_reset(struct rte_eth_dev *dev)
+{
+	(void)dev;
+
+	return 0;
+}
+
+/**
+ * DPDK callback to get Rx Queue info of an Ethernet device.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ * @param rx_queue_id
+ *   The RX queue on the Ethernet device for which information will be
+ *   retrieved
+ * @param qinfo
+ *   A pointer to a structure of type rte_eth_rxq_info_info to be filled with
+ *   the information of given Rx queue.
+ */
+void
+qdma_dev_rxq_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id,
+		     struct rte_eth_rxq_info *qinfo)
+{
+	(void)dev;
+	(void)rx_queue_id;
+	(void)qinfo;
+}
+
+/**
+ * DPDK callback to get Tx Queue info of an Ethernet device.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ * @param tx_queue_id
+ *   The TX queue on the Ethernet device for which information will be
+ *   retrieved
+ * @param qinfo
+ *   A pointer to a structure of type rte_eth_txq_info_info to be filled with
+ *   the information of given Tx queue.
+ */
+void
+qdma_dev_txq_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id,
+		      struct rte_eth_txq_info *qinfo)
+{
+	struct qdma_tx_queue *txq = NULL;
+
+	if (!qinfo)
+		return;
+
+	txq = dev->data->tx_queues[tx_queue_id];
+	qinfo->conf.offloads = txq->offloads;
+	qinfo->conf.tx_deferred_start = txq->tx_deferred_start;
+	qinfo->conf.tx_rs_thresh = 0;
+	qinfo->nb_desc = txq->nb_tx_desc - 1;
+}
+
+int qdma_dev_tx_done_cleanup(void *tx_queue, uint32_t free_cnt)
+{
+	(void)tx_queue;
+	(void)free_cnt;
+
+	return 0;
+}
+
+static struct eth_dev_ops qdma_eth_dev_ops = {
+	.dev_configure            = qdma_dev_configure,
+	.dev_infos_get            = qdma_dev_infos_get,
+	.dev_start                = qdma_dev_start,
+	.dev_stop                 = qdma_dev_stop,
+	.dev_close                = qdma_dev_close,
+	.dev_reset                = qdma_dev_reset,
+	.link_update              = qdma_dev_link_update,
+	.rx_queue_setup           = qdma_dev_rx_queue_setup,
+	.tx_queue_setup           = qdma_dev_tx_queue_setup,
+	.rx_queue_release         = qdma_dev_rx_queue_release,
+	.tx_queue_release         = qdma_dev_tx_queue_release,
+	.rx_queue_start           = qdma_dev_rx_queue_start,
+	.rx_queue_stop            = qdma_dev_rx_queue_stop,
+	.tx_queue_start           = qdma_dev_tx_queue_start,
+	.tx_queue_stop            = qdma_dev_tx_queue_stop,
+	.tx_done_cleanup          = qdma_dev_tx_done_cleanup,
+	.queue_stats_mapping_set  = qdma_dev_queue_stats_mapping,
+	.get_reg                  = qdma_dev_get_regs,
+	.stats_get                = qdma_dev_stats_get,
+	.stats_reset              = qdma_dev_stats_reset,
+	.rxq_info_get             = qdma_dev_rxq_info_get,
+	.txq_info_get             = qdma_dev_txq_info_get,
+};
+
+uint16_t qdma_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
+			uint16_t nb_pkts)
+{
+	(void)rx_queue;
+	(void)rx_pkts;
+	(void)nb_pkts;
+
+	return 0;
+}
+
+uint16_t qdma_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+			uint16_t nb_pkts)
+{
+	(void)tx_queue;
+	(void)tx_pkts;
+	(void)nb_pkts;
+
+	return 0;
+}
+
+void qdma_dev_ops_init(struct rte_eth_dev *dev)
+{
+	dev->dev_ops = &qdma_eth_dev_ops;
+	dev->rx_pkt_burst = &qdma_recv_pkts;
+	dev->tx_pkt_burst = &qdma_xmit_pkts;
+}
diff --git a/drivers/net/qdma/qdma_devops.h b/drivers/net/qdma/qdma_devops.h
new file mode 100644
index 0000000000..240fa6b60c
--- /dev/null
+++ b/drivers/net/qdma/qdma_devops.h
@@ -0,0 +1,486 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2017-2022 Xilinx, Inc. All rights reserved.
+ * Copyright(c) 2022 VVDN Technologies Private Limited. All rights reserved.
+ */
+
+#ifndef __QDMA_DEVOPS_H__
+#define __QDMA_DEVOPS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup dpdk_devops_func Functions
+ */
+
+/**
+ * DPDK callback for Ethernet device configuration.
+ *
+ * This API requests the queue base from Queue Resource Manager and programs
+ * the queue base and queue count in function map (FMAP)
+ *
+ * @param dev Pointer to Ethernet device structure
+ *
+ * @return 0 on success, < 0 on failure
+ * @ingroup dpdk_devops_func
+ *
+ */
+int qdma_dev_configure(struct rte_eth_dev *dev);
+
+/**
+ * DPDK callback to get information about the device
+ *
+ * @param dev Pointer to Ethernet device structure
+ * @param dev_info: Pointer to Device information structure
+ *
+ * @ingroup dpdk_devops_func
+ */
+int qdma_dev_infos_get(struct rte_eth_dev *dev,
+				struct rte_eth_dev_info *dev_info);
+
+/**
+ * DPDK callback to retrieve the physical link information
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure
+ * @param wait_to_complete
+ *   wait_to_complete field is ignored
+ *
+ * @ingroup dpdk_devops_func
+ */
+int qdma_dev_link_update(struct rte_eth_dev *dev,
+				__rte_unused int wait_to_complete);
+
+/**
+ * DPDK callback to configure a RX queue.
+ *
+ * This API validates queue parameters and allocates C2H ring and
+ * Streaming CMPT ring from the DPDK reserved hugepage memory zones
+ *
+ * @param dev Pointer to Ethernet device structure.
+ * @param rx_queue_id RX queue index relative to the PCIe function
+ *                    pointed by dev
+ * @param nb_rx_desc Number of C2H descriptors to configure for this queue
+ * @param socket_id NUMA socket on which memory must be allocated
+ * @param rx_conf Rx queue configuration parameters
+ * @param mb_pool Memory pool to use for buffer allocations on this queue
+ *
+ * @return 0 on success, < 0 on failure
+ * @ingroup dpdk_devops_func
+ *
+ */
+int qdma_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
+				uint16_t nb_rx_desc, unsigned int socket_id,
+				const struct rte_eth_rxconf *rx_conf,
+				struct rte_mempool *mb_pool);
+
+/**
+ * DPDK callback to configure a TX queue.
+ *
+ * This API validates queue parameters and allocates H2C ring from the
+ * DPDK reserved hugepage memory zone
+ *
+ * @param dev Pointer to Ethernet device structure
+ * @param tx_queue_id TX queue index
+ * @param nb_tx_desc Number of descriptors to configure in queue
+ * @param socket_id NUMA socket on which memory must be allocated
+ * @param tx_conf Tx queue configuration parameters
+ *
+ * @return 0 on success, < 0 on failure
+ * @ingroup dpdk_devops_func
+ *
+ */
+int qdma_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
+			    uint16_t nb_tx_desc, unsigned int socket_id,
+			    const struct rte_eth_txconf *tx_conf);
+
+/**
+ * DPDK callback to get Rx queue info of an Ethernet device
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure
+ * @param rx_queue_id
+ *   The RX queue on the Ethernet device for which information will be
+ *   retrieved
+ * @param qinfo
+ *   A pointer to a structure of type rte_eth_rxq_info_info to be filled with
+ *   the information of given Rx queue
+ *
+ * @ingroup dpdk_devops_func
+ */
+void
+qdma_dev_rxq_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id,
+		     struct rte_eth_rxq_info *qinfo);
+
+/**
+ * DPDK callback to get Tx queue info of an Ethernet device
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure
+ * @param tx_queue_id
+ *   The TX queue on the Ethernet device for which information will be
+ *   retrieved
+ * @param qinfo
+ *   A pointer to a structure of type rte_eth_txq_info_info to be filled with
+ *   the information of given Tx queue
+ *
+ * @ingroup dpdk_devops_func
+ */
+void
+qdma_dev_txq_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id,
+		      struct rte_eth_txq_info *qinfo);
+
+/**
+ * DPDK callback to start the device.
+ *
+ * This API starts the Ethernet device by initializing Rx, Tx descriptors
+ * and device registers. For the Port queues whose start is not deferred,
+ * it calls qdma_dev_tx_queue_start and qdma_dev_rx_queue_start to start
+ * the queues for packet processing.
+ *
+ * @param dev Pointer to Ethernet device structure
+ *
+ * @return 0 on success, < 0 on failure
+ * @ingroup dpdk_devops_func
+ *
+ */
+int qdma_dev_start(struct rte_eth_dev *dev);
+
+/**
+ * DPDK callback to start a C2H queue which has been deferred start.
+ *
+ * This API clears and then programs the Software, Prefetch and
+ * Completion context of the C2H queue
+ *
+ * @param dev Pointer to Ethernet device structure
+ * @param qid Rx queue index
+ *
+ * @return 0 on success, < 0 on failure
+ * @ingroup dpdk_devops_func
+ *
+ */
+int qdma_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t qid);
+
+/**
+ * DPDK callback to start a H2C queue which has been deferred start.
+ *
+ * This API clears and then programs the Software context of the H2C queue
+ *
+ * @param dev Pointer to Ethernet device structure
+ * @param qid Tx queue index
+ *
+ * @return 0 on success, < 0 on failure
+ * @ingroup dpdk_devops_func
+ *
+ */
+int qdma_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t qid);
+
+/**
+ * DPDK callback for receiving packets in burst.
+ *
+ * This API does following operations:
+ *	- Process the Completion ring to determine and store packet information
+ *	- Update CMPT CIDX
+ *	- Process C2H ring to retrieve rte_mbuf pointers corresponding to
+ *    received packets and store in rx_pkts array.
+ *	- Populate C2H ring with new pointers for packet buffers
+ *	- Update C2H ring PIDX
+ *
+ * @param rx_queue Generic pointer to Rx queue structure
+ * @param rx_pkts The address of an array of pointers to rte_mbuf structures
+ *                 that must be large enough to store nb_pkts pointers in it
+ * @param nb_pkts Maximum number of packets to retrieve
+ *
+ * @return Number of packets successfully received (<= nb_pkts)
+ * @ingroup dpdk_devops_func
+ *
+ */
+uint16_t qdma_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
+			uint16_t nb_pkts);
+
+/**
+ * DPDK callback for transmitting packets in burst.
+ *
+ * This API does following operations:
+ *	- Free rte_mbuf pointers to previous transmitted packets,
+ *    back to the memory pool
+ *	- Retrieve packet buffer pointer from tx_pkts and populate H2C ring
+ *    with pointers to new packet buffers.
+ *	- Update H2C ring PIDX
+ *
+ * @param tx_queue Generic pointer to Tx queue structure
+ * @param tx_pkts The address of an array of nb_pkts pointers to
+ *                rte_mbuf structures which contain the output packets
+ * @param nb_pkts The maximum number of packets to transmit
+ *
+ * @return Number of packets successfully transmitted (<= nb_pkts)
+ * @ingroup dpdk_devops_func
+ *
+ */
+uint16_t qdma_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+			uint16_t nb_pkts);
+
+/**
+ * DPDK callback for retrieving Port statistics.
+ *
+ * This API updates Port statistics in rte_eth_stats structure parameters
+ *
+ * @param dev Pointer to Ethernet device structure
+ * @param eth_stats Pointer to structure containing statistics
+ *
+ * @return 0 on success, < 0 on failure
+ * @ingroup dpdk_devops_func
+ *
+ */
+int qdma_dev_stats_get(struct rte_eth_dev *dev,
+			      struct rte_eth_stats *eth_stats);
+
+/**
+ * DPDK callback to reset Port statistics.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ *
+ * @ingroup dpdk_devops_func
+ */
+int qdma_dev_stats_reset(struct rte_eth_dev *dev);
+
+/**
+ * DPDK callback to set a queue statistics mapping for
+ * a tx/rx queue of an Ethernet device.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure
+ * @param queue_id
+ *   Index of the queue for which a queue stats mapping is required
+ * @param stat_idx
+ *   The per-queue packet statistics functionality number that
+ *   the queue_id is to be assigned
+ * @param is_rx
+ *   Whether queue is a Rx or a Tx queue
+ *
+ * @return
+ *   0 on success, -EINVAL on failure
+ * @ingroup dpdk_devops_func
+ */
+int qdma_dev_queue_stats_mapping(struct rte_eth_dev *dev,
+					     uint16_t queue_id,
+					     uint8_t stat_idx,
+					     uint8_t is_rx);
+
+/**
+ * DPDK callback to get the number of used descriptors of a rx queue
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure
+ * @param rx_queue_id
+ *   The RX queue on the Ethernet device for which information will be
+ *   retrieved
+ *
+ * @return
+ *   The number of used descriptors in the specific queue
+ * @ingroup dpdk_devops_func
+ */
+uint32_t
+qdma_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+
+/**
+ * DPDK callback to check the status of a Rx descriptor in the queue
+ *
+ * @param rx_queue
+ *   Pointer to Rx queue specific data structure
+ * @param offset
+ *   The offset of the descriptor starting from tail (0 is the next
+ *   packet to be received by the driver)
+ *
+ * @return
+ *  - (RTE_ETH_RX_DESC_AVAIL): Descriptor is available for the hardware to
+ *    receive a packet.
+ *  - (RTE_ETH_RX_DESC_DONE): Descriptor is done, it is filled by hw, but
+ *    not yet processed by the driver (i.e. in the receive queue).
+ *  - (RTE_ETH_RX_DESC_UNAVAIL): Descriptor is unavailable, either hold by
+ *    the driver and not yet returned to hw, or reserved by the hw.
+ *  - (-EINVAL) bad descriptor offset.
+ * @ingroup dpdk_devops_func
+ */
+int
+qdma_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
+
+/**
+ * DPDK callback to check the status of a Tx descriptor in the queue
+ *
+ * @param tx_queue
+ *   Pointer to Tx queue specific data structure
+ * @param offset
+ *   The offset of the descriptor starting from tail (0 is the place where
+ *   the next packet will be send)
+ *
+ * @return
+ *  - (RTE_ETH_TX_DESC_FULL) Descriptor is being processed by the hw, i.e.
+ *    in the transmit queue.
+ *  - (RTE_ETH_TX_DESC_DONE) Hardware is done with this descriptor, it can
+ *    be reused by the driver.
+ *  - (RTE_ETH_TX_DESC_UNAVAIL): Descriptor is unavailable, reserved by the
+ *    driver or the hardware.
+ *  - (-EINVAL) bad descriptor offset.
+ * @ingroup dpdk_devops_func
+ */
+int
+qdma_dev_tx_descriptor_status(void *tx_queue, uint16_t offset);
+
+/**
+ * DPDK callback to request the driver to free mbufs
+ * currently cached by the driver
+ *
+ * @param tx_queue
+ *   Pointer to Tx queue specific data structure
+ * @param free_cnt
+ *   Maximum number of packets to free. Use 0 to indicate all possible packets
+ *   should be freed. Note that a packet may be using multiple mbufs.
+ *
+ * @return
+ *   - Failure: < 0
+ *   - Success: >= 0
+ *     0-n: Number of packets freed. More packets may still remain in ring that
+ *     are in use.
+ * @ingroup dpdk_devops_func
+ */
+int
+qdma_dev_tx_done_cleanup(void *tx_queue, uint32_t free_cnt);
+
+/**
+ * DPDK callback to retrieve device registers and
+ * register attributes (number of registers and register size)
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure
+ * @param regs
+ *   Pointer to rte_dev_reg_info structure to fill in. If regs->data is
+ *   NULL the function fills in the width and length fields. If non-NULL
+ *   the registers are put into the buffer pointed at by the data field.
+ *
+ * @return
+ *   0 on success, -ENOTSUP on failure
+ * @ingroup dpdk_devops_func
+ */
+int
+qdma_dev_get_regs(struct rte_eth_dev *dev,
+	      struct rte_dev_reg_info *regs);
+
+/**
+ * DPDK callback to stop a C2H queue
+ *
+ * This API invalidates Hardware, Software, Prefetch and completion contexts
+ * of C2H queue. It also free the rte_mbuf pointers assigned to descriptors
+ * prepared for packet reception.
+ *
+ * @param dev Pointer to Ethernet device structure
+ * @param qid Rx queue index
+ *
+ * @return 0 on success, < 0 on failure
+ * @ingroup dpdk_devops_func
+ *
+ */
+int qdma_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t qid);
+
+/**
+ * qdma_dev_tx_queue_stop() - DPDK callback to stop a queue in H2C direction
+ *
+ * This API invalidates Hardware, Software contexts of H2C queue. It also free
+ * the rte_mbuf pointers assigned to descriptors that are pending transmission.
+ *
+ * @param dev Pointer to Ethernet device structure
+ * @param qid TX queue index
+ *
+ * @return 0 on success, < 0 on failure
+ * @ingroup dpdk_devops_func
+ *
+ */
+int qdma_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qid);
+
+
+/**
+ * DPDK callback to stop the device.
+ *
+ * This API stops the device by invalidating all the contexts of all the queues
+ * belonging to the port by calling qdma_dev_tx_queue_stop() and
+ * qdma_dev_rx_queue_stop() for all the queues of the port.
+ *
+ * @param dev Pointer to Ethernet device structure
+ *
+ * @ingroup dpdk_devops_func
+ *
+ */
+int qdma_dev_stop(struct rte_eth_dev *dev);
+
+/**
+ * DPDK callback to release a Rx queue.
+ *
+ * This API releases the descriptor rings and any additional memory allocated
+ * for given C2H queue
+ *
+ * @param dev Pointer to Ethernet device structure
+ * @param q_id: Rx queue id
+ *
+ * @ingroup dpdk_devops_func
+ */
+void qdma_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t q_id);
+
+/**
+ * DPDK callback to release a Tx queue.
+ *
+ * This API releases the descriptor rings and any additional memory allocated
+ * for given H2C queue
+ *
+ * @param dev Pointer to Ethernet device structure
+ * @param q_id: Tx queue id
+ *
+ * @ingroup dpdk_devops_func
+ */
+void qdma_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t q_id);
+
+/**
+ * DPDK callback to close the device.
+ *
+ * This API frees the descriptor rings and objects beonging to all the queues
+ * of the given port. It also clears the FMAP.
+ *
+ * @param dev Pointer to Ethernet device structure
+ *
+ * @ingroup dpdk_devops_func
+ */
+int qdma_dev_close(struct rte_eth_dev *dev);
+
+/**
+ * DPDK callback to close the VF device.
+ *
+ * This API frees the descriptor rings and objects beonging to all the queues
+ * of the given port. It also clears the FMAP.
+ *
+ * @param dev Pointer to Ethernet device structure
+ *
+ * @ingroup dpdk_devops_func
+ */
+int qdma_vf_dev_close(struct rte_eth_dev *dev);
+
+/**
+ * DPDK callback to reset the device.
+ *
+ * This callback is invoked when applcation calls rte_eth_dev_reset() API
+ * to reset a device. This callback uninitialzes PF device after waiting for
+ * all its VFs to shutdown. It initialize back PF device and then send
+ * Reset done mailbox message to all its VFs to come online again.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure
+ *
+ * @return
+ *   0 on success, negative errno value on failure
+ * @ingroup dpdk_devops_func
+ */
+int qdma_dev_reset(struct rte_eth_dev *dev);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* ifndef __QDMA_DEVOPS_H__ */
diff --git a/drivers/net/qdma/qdma_ethdev.c b/drivers/net/qdma/qdma_ethdev.c
index 54776c637d..79aac4aa60 100644
--- a/drivers/net/qdma/qdma_ethdev.c
+++ b/drivers/net/qdma/qdma_ethdev.c
@@ -25,6 +25,7 @@ 
 #include "qdma_version.h"
 #include "qdma_access_common.h"
 #include "qdma_access_export.h"
+#include "qdma_devops.h"
 
 /* Poll for QDMA errors every 1 second */
 #define QDMA_ERROR_POLL_FRQ (1000000)
@@ -356,8 +357,10 @@  static int qdma_eth_dev_init(struct rte_eth_dev *dev)
 	/* for secondary processes, we don't initialise any further as primary
 	 * has already done this work.
 	 */
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		qdma_dev_ops_init(dev);
 		return 0;
+	}
 
 	/* allocate space for a single Ethernet MAC address */
 	dev->data->mac_addrs = rte_zmalloc("qdma", RTE_ETHER_ADDR_LEN * 1, 0);
@@ -436,6 +439,8 @@  static int qdma_eth_dev_init(struct rte_eth_dev *dev)
 
 	PMD_DRV_LOG(INFO, "QDMA device driver probe:");
 
+	qdma_dev_ops_init(dev);
+
 	/* Getting the device attributes from the Hardware */
 	qdma_device_attributes_get(dev);
 
@@ -580,6 +585,10 @@  static int qdma_eth_dev_uninit(struct rte_eth_dev *dev)
 	/* only uninitialize in the primary process */
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return -EPERM;
+
+	if (qdma_dev->dev_configured)
+		qdma_dev_close(dev);
+
 	/* cancel pending polls */
 	if (qdma_dev->is_master)
 		rte_eal_alarm_cancel(qdma_check_errors, (void *)dev);
diff --git a/drivers/net/qdma/rte_pmd_qdma.h b/drivers/net/qdma/rte_pmd_qdma.h
index f5e3def613..d09ec4a715 100644
--- a/drivers/net/qdma/rte_pmd_qdma.h
+++ b/drivers/net/qdma/rte_pmd_qdma.h
@@ -2,8 +2,8 @@ 
  * Copyright(c) 2017-2022 Xilinx, Inc. All rights reserved.
  */
 
-#ifndef __RTE_PMD_QDMA_EXPORT_H__
-#define __RTE_PMD_QDMA_EXPORT_H__
+#ifndef __RTE_PMD_QDMA_H__
+#define __RTE_PMD_QDMA_H__
 
 #include <rte_dev.h>
 #include <rte_ethdev.h>
@@ -256,7 +256,9 @@  struct rte_pmd_qdma_dev_attributes {
 	enum rte_pmd_qdma_ip_type ip_type;
 };
 
+#define DMA_BRAM_SIZE 524288
+
 #ifdef __cplusplus
 }
 #endif
-#endif /* ifndef __RTE_PMD_QDMA_EXPORT_H__ */
+#endif /* ifndef __RTE_PMD_QDMA_H__ */