ethdev: replace bit shifts with macros
[dpdk.git] / lib / ethdev / rte_ethdev.h
index 6d80514..014270d 100644 (file)
@@ -159,6 +159,7 @@ extern "C" {
 #include <rte_interrupts.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
+#include <rte_bitops.h>
 #include <rte_errno.h>
 #include <rte_common.h>
 #include <rte_config.h>
@@ -279,23 +280,23 @@ struct rte_eth_stats {
 /**@{@name Link speed capabilities
  * Device supported speeds bitmap flags
  */
-#define ETH_LINK_SPEED_AUTONEG  (0 <<  0)  /**< Autonegotiate (all speeds) */
-#define ETH_LINK_SPEED_FIXED    (1 <<  0)  /**< Disable autoneg (fixed speed) */
-#define ETH_LINK_SPEED_10M_HD   (1 <<  1)  /**<  10 Mbps half-duplex */
-#define ETH_LINK_SPEED_10M      (1 <<  2)  /**<  10 Mbps full-duplex */
-#define ETH_LINK_SPEED_100M_HD  (1 <<  3)  /**< 100 Mbps half-duplex */
-#define ETH_LINK_SPEED_100M     (1 <<  4)  /**< 100 Mbps full-duplex */
-#define ETH_LINK_SPEED_1G       (1 <<  5)  /**<   1 Gbps */
-#define ETH_LINK_SPEED_2_5G     (1 <<  6)  /**< 2.5 Gbps */
-#define ETH_LINK_SPEED_5G       (1 <<  7)  /**<   5 Gbps */
-#define ETH_LINK_SPEED_10G      (1 <<  8)  /**<  10 Gbps */
-#define ETH_LINK_SPEED_20G      (1 <<  9)  /**<  20 Gbps */
-#define ETH_LINK_SPEED_25G      (1 << 10)  /**<  25 Gbps */
-#define ETH_LINK_SPEED_40G      (1 << 11)  /**<  40 Gbps */
-#define ETH_LINK_SPEED_50G      (1 << 12)  /**<  50 Gbps */
-#define ETH_LINK_SPEED_56G      (1 << 13)  /**<  56 Gbps */
-#define ETH_LINK_SPEED_100G     (1 << 14)  /**< 100 Gbps */
-#define ETH_LINK_SPEED_200G     (1 << 15)  /**< 200 Gbps */
+#define ETH_LINK_SPEED_AUTONEG 0             /**< Autonegotiate (all speeds) */
+#define ETH_LINK_SPEED_FIXED   RTE_BIT32(0)  /**< Disable autoneg (fixed speed) */
+#define ETH_LINK_SPEED_10M_HD  RTE_BIT32(1)  /**<  10 Mbps half-duplex */
+#define ETH_LINK_SPEED_10M     RTE_BIT32(2)  /**<  10 Mbps full-duplex */
+#define ETH_LINK_SPEED_100M_HD RTE_BIT32(3)  /**< 100 Mbps half-duplex */
+#define ETH_LINK_SPEED_100M    RTE_BIT32(4)  /**< 100 Mbps full-duplex */
+#define ETH_LINK_SPEED_1G      RTE_BIT32(5)  /**<   1 Gbps */
+#define ETH_LINK_SPEED_2_5G    RTE_BIT32(6)  /**< 2.5 Gbps */
+#define ETH_LINK_SPEED_5G      RTE_BIT32(7)  /**<   5 Gbps */
+#define ETH_LINK_SPEED_10G     RTE_BIT32(8)  /**<  10 Gbps */
+#define ETH_LINK_SPEED_20G     RTE_BIT32(9)  /**<  20 Gbps */
+#define ETH_LINK_SPEED_25G     RTE_BIT32(10) /**<  25 Gbps */
+#define ETH_LINK_SPEED_40G     RTE_BIT32(11) /**<  40 Gbps */
+#define ETH_LINK_SPEED_50G     RTE_BIT32(12) /**<  50 Gbps */
+#define ETH_LINK_SPEED_56G     RTE_BIT32(13) /**<  56 Gbps */
+#define ETH_LINK_SPEED_100G    RTE_BIT32(14) /**< 100 Gbps */
+#define ETH_LINK_SPEED_200G    RTE_BIT32(15) /**< 200 Gbps */
 /**@}*/
 
 /**@{@name Link speed
@@ -416,7 +417,7 @@ enum rte_eth_tx_mq_mode {
 struct rte_eth_rxmode {
        /** The multi-queue packet distribution mode to be used, e.g. RSS. */
        enum rte_eth_rx_mq_mode mq_mode;
-       uint32_t max_rx_pkt_len;  /**< Only used if JUMBO_FRAME enabled. */
+       uint32_t mtu;  /**< Requested MTU. */
        /** Maximum allowed size of LRO aggregated packet. */
        uint32_t max_lro_pkt_size;
        uint16_t split_hdr_size;  /**< hdr buf size (header_split enabled).*/
@@ -512,38 +513,38 @@ struct rte_eth_rss_conf {
  * Below macros are defined for RSS offload types, they can be used to
  * fill rte_eth_rss_conf.rss_hf or rte_flow_action_rss.types.
  */
-#define ETH_RSS_IPV4               (1ULL << 2)
-#define ETH_RSS_FRAG_IPV4          (1ULL << 3)
-#define ETH_RSS_NONFRAG_IPV4_TCP   (1ULL << 4)
-#define ETH_RSS_NONFRAG_IPV4_UDP   (1ULL << 5)
-#define ETH_RSS_NONFRAG_IPV4_SCTP  (1ULL << 6)
-#define ETH_RSS_NONFRAG_IPV4_OTHER (1ULL << 7)
-#define ETH_RSS_IPV6               (1ULL << 8)
-#define ETH_RSS_FRAG_IPV6          (1ULL << 9)
-#define ETH_RSS_NONFRAG_IPV6_TCP   (1ULL << 10)
-#define ETH_RSS_NONFRAG_IPV6_UDP   (1ULL << 11)
-#define ETH_RSS_NONFRAG_IPV6_SCTP  (1ULL << 12)
-#define ETH_RSS_NONFRAG_IPV6_OTHER (1ULL << 13)
-#define ETH_RSS_L2_PAYLOAD         (1ULL << 14)
-#define ETH_RSS_IPV6_EX            (1ULL << 15)
-#define ETH_RSS_IPV6_TCP_EX        (1ULL << 16)
-#define ETH_RSS_IPV6_UDP_EX        (1ULL << 17)
-#define ETH_RSS_PORT               (1ULL << 18)
-#define ETH_RSS_VXLAN              (1ULL << 19)
-#define ETH_RSS_GENEVE             (1ULL << 20)
-#define ETH_RSS_NVGRE              (1ULL << 21)
-#define ETH_RSS_GTPU               (1ULL << 23)
-#define ETH_RSS_ETH                (1ULL << 24)
-#define ETH_RSS_S_VLAN             (1ULL << 25)
-#define ETH_RSS_C_VLAN             (1ULL << 26)
-#define ETH_RSS_ESP                (1ULL << 27)
-#define ETH_RSS_AH                 (1ULL << 28)
-#define ETH_RSS_L2TPV3             (1ULL << 29)
-#define ETH_RSS_PFCP               (1ULL << 30)
-#define ETH_RSS_PPPOE             (1ULL << 31)
-#define ETH_RSS_ECPRI             (1ULL << 32)
-#define ETH_RSS_MPLS              (1ULL << 33)
-#define ETH_RSS_IPV4_CHKSUM       (1ULL << 34)
+#define ETH_RSS_IPV4               RTE_BIT64(2)
+#define ETH_RSS_FRAG_IPV4          RTE_BIT64(3)
+#define ETH_RSS_NONFRAG_IPV4_TCP   RTE_BIT64(4)
+#define ETH_RSS_NONFRAG_IPV4_UDP   RTE_BIT64(5)
+#define ETH_RSS_NONFRAG_IPV4_SCTP  RTE_BIT64(6)
+#define ETH_RSS_NONFRAG_IPV4_OTHER RTE_BIT64(7)
+#define ETH_RSS_IPV6               RTE_BIT64(8)
+#define ETH_RSS_FRAG_IPV6          RTE_BIT64(9)
+#define ETH_RSS_NONFRAG_IPV6_TCP   RTE_BIT64(10)
+#define ETH_RSS_NONFRAG_IPV6_UDP   RTE_BIT64(11)
+#define ETH_RSS_NONFRAG_IPV6_SCTP  RTE_BIT64(12)
+#define ETH_RSS_NONFRAG_IPV6_OTHER RTE_BIT64(13)
+#define ETH_RSS_L2_PAYLOAD         RTE_BIT64(14)
+#define ETH_RSS_IPV6_EX            RTE_BIT64(15)
+#define ETH_RSS_IPV6_TCP_EX        RTE_BIT64(16)
+#define ETH_RSS_IPV6_UDP_EX        RTE_BIT64(17)
+#define ETH_RSS_PORT               RTE_BIT64(18)
+#define ETH_RSS_VXLAN              RTE_BIT64(19)
+#define ETH_RSS_GENEVE             RTE_BIT64(20)
+#define ETH_RSS_NVGRE              RTE_BIT64(21)
+#define ETH_RSS_GTPU               RTE_BIT64(23)
+#define ETH_RSS_ETH                RTE_BIT64(24)
+#define ETH_RSS_S_VLAN             RTE_BIT64(25)
+#define ETH_RSS_C_VLAN             RTE_BIT64(26)
+#define ETH_RSS_ESP                RTE_BIT64(27)
+#define ETH_RSS_AH                 RTE_BIT64(28)
+#define ETH_RSS_L2TPV3             RTE_BIT64(29)
+#define ETH_RSS_PFCP               RTE_BIT64(30)
+#define ETH_RSS_PPPOE              RTE_BIT64(31)
+#define ETH_RSS_ECPRI              RTE_BIT64(32)
+#define ETH_RSS_MPLS               RTE_BIT64(33)
+#define ETH_RSS_IPV4_CHKSUM        RTE_BIT64(34)
 
 /**
  * The ETH_RSS_L4_CHKSUM works on checksum field of any L4 header.
@@ -557,7 +558,7 @@ struct rte_eth_rss_conf {
  * For the case that checksum is not used in an UDP header,
  * it takes the reserved value 0 as input for the hash function.
  */
-#define ETH_RSS_L4_CHKSUM          (1ULL << 35)
+#define ETH_RSS_L4_CHKSUM          RTE_BIT64(35)
 
 /*
  * We use the following macros to combine with above ETH_RSS_* for
@@ -568,12 +569,12 @@ struct rte_eth_rss_conf {
  * the same level are used simultaneously, it is the same case as none of
  * them are added.
  */
-#define ETH_RSS_L3_SRC_ONLY        (1ULL << 63)
-#define ETH_RSS_L3_DST_ONLY        (1ULL << 62)
-#define ETH_RSS_L4_SRC_ONLY        (1ULL << 61)
-#define ETH_RSS_L4_DST_ONLY        (1ULL << 60)
-#define ETH_RSS_L2_SRC_ONLY        (1ULL << 59)
-#define ETH_RSS_L2_DST_ONLY        (1ULL << 58)
+#define ETH_RSS_L3_SRC_ONLY        RTE_BIT64(63)
+#define ETH_RSS_L3_DST_ONLY        RTE_BIT64(62)
+#define ETH_RSS_L4_SRC_ONLY        RTE_BIT64(61)
+#define ETH_RSS_L4_DST_ONLY        RTE_BIT64(60)
+#define ETH_RSS_L2_SRC_ONLY        RTE_BIT64(59)
+#define ETH_RSS_L2_DST_ONLY        RTE_BIT64(58)
 
 /*
  * Only select IPV6 address prefix as RSS input set according to
@@ -581,12 +582,12 @@ struct rte_eth_rss_conf {
  * Must be combined with ETH_RSS_IPV6, ETH_RSS_NONFRAG_IPV6_UDP,
  * ETH_RSS_NONFRAG_IPV6_TCP, ETH_RSS_NONFRAG_IPV6_SCTP.
  */
-#define RTE_ETH_RSS_L3_PRE32      (1ULL << 57)
-#define RTE_ETH_RSS_L3_PRE40      (1ULL << 56)
-#define RTE_ETH_RSS_L3_PRE48      (1ULL << 55)
-#define RTE_ETH_RSS_L3_PRE56      (1ULL << 54)
-#define RTE_ETH_RSS_L3_PRE64      (1ULL << 53)
-#define RTE_ETH_RSS_L3_PRE96      (1ULL << 52)
+#define RTE_ETH_RSS_L3_PRE32      RTE_BIT64(57)
+#define RTE_ETH_RSS_L3_PRE40      RTE_BIT64(56)
+#define RTE_ETH_RSS_L3_PRE48      RTE_BIT64(55)
+#define RTE_ETH_RSS_L3_PRE56      RTE_BIT64(54)
+#define RTE_ETH_RSS_L3_PRE64      RTE_BIT64(53)
+#define RTE_ETH_RSS_L3_PRE96      RTE_BIT64(52)
 
 /*
  * Use the following macros to combine with the above layers
@@ -1356,7 +1357,6 @@ struct rte_eth_conf {
 #define DEV_RX_OFFLOAD_HEADER_SPLIT    0x00000100
 #define DEV_RX_OFFLOAD_VLAN_FILTER     0x00000200
 #define DEV_RX_OFFLOAD_VLAN_EXTEND     0x00000400
-#define DEV_RX_OFFLOAD_JUMBO_FRAME     0x00000800
 #define DEV_RX_OFFLOAD_SCATTER         0x00002000
 /**
  * Timestamp is set by the driver in RTE_MBUF_DYNFIELD_TIMESTAMP_NAME
@@ -1620,7 +1620,7 @@ struct rte_eth_txq_info {
  * by PMD, then the application can iterate to retrieve burst description for
  * all other queues.
  */
-#define RTE_ETH_BURST_FLAG_PER_QUEUE     (1ULL << 0)
+#define RTE_ETH_BURST_FLAG_PER_QUEUE RTE_BIT64(0)
 
 /**
  * Ethernet device RX/TX queue packet burst mode information structure.
@@ -1712,10 +1712,10 @@ enum rte_eth_fec_mode {
 };
 
 /* Translate from FEC mode to FEC capa */
-#define RTE_ETH_FEC_MODE_TO_CAPA(x)    (1U << (x))
+#define RTE_ETH_FEC_MODE_TO_CAPA(x) RTE_BIT32(x)
 
 /* This macro indicates FEC capa mask */
-#define RTE_ETH_FEC_MODE_CAPA_MASK(x)  (1U << (RTE_ETH_FEC_ ## x))
+#define RTE_ETH_FEC_MODE_CAPA_MASK(x) RTE_BIT32(RTE_ETH_FEC_ ## x)
 
 /* A structure used to get capabilities per link speed */
 struct rte_eth_fec_capa {
@@ -3007,6 +3007,30 @@ int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
  */
 int rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr);
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Retrieve the Ethernet addresses of an Ethernet device.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param ma
+ *   A pointer to an array of structures of type *ether_addr* to be filled with
+ *   the Ethernet addresses of the Ethernet device.
+ * @param num
+ *   Number of elements in the @p ma array.
+ *   Note that  rte_eth_dev_info::max_mac_addrs can be used to retrieve
+ *   max number of Ethernet addresses for given port.
+ * @return
+ *   - number of retrieved addresses if successful
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+__rte_experimental
+int rte_eth_macaddrs_get(uint16_t port_id, struct rte_ether_addr *ma,
+       unsigned int num);
+
 /**
  * Retrieve the contextual information of an Ethernet device.
  *
@@ -3027,7 +3051,7 @@ int rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr);
  *  };
  *
  * device = dev->device
- * min_mtu = RTE_ETHER_MIN_MTU
+ * min_mtu = RTE_ETHER_MIN_LEN - RTE_ETHER_HDR_LEN - RTE_ETHER_CRC_LEN
  * max_mtu = UINT16_MAX
  *
  * The following fields will be populated if support for dev_infos_get()
@@ -3052,6 +3076,24 @@ int rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr);
  */
 int rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info);
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Retrieve the configuration of an Ethernet device.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param dev_conf
+ *   Location for Ethernet device configuration to be filled in.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+__rte_experimental
+int rte_eth_dev_conf_get(uint16_t port_id, struct rte_eth_conf *dev_conf);
+
 /**
  * Retrieve the firmware version of a device.
  *
@@ -4828,8 +4870,89 @@ __rte_experimental
 int rte_eth_representor_info_get(uint16_t port_id,
                                 struct rte_eth_representor_info *info);
 
+/** The NIC is able to deliver flag (if set) with packets to the PMD. */
+#define RTE_ETH_RX_METADATA_USER_FLAG RTE_BIT64(0)
+
+/** The NIC is able to deliver mark ID with packets to the PMD. */
+#define RTE_ETH_RX_METADATA_USER_MARK RTE_BIT64(1)
+
+/** The NIC is able to deliver tunnel ID with packets to the PMD. */
+#define RTE_ETH_RX_METADATA_TUNNEL_ID RTE_BIT64(2)
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Negotiate the NIC's ability to deliver specific kinds of metadata to the PMD.
+ *
+ * Invoke this API before the first rte_eth_dev_configure() invocation
+ * to let the PMD make preparations that are inconvenient to do later.
+ *
+ * The negotiation process is as follows:
+ *
+ * - the application requests features intending to use at least some of them;
+ * - the PMD responds with the guaranteed subset of the requested feature set;
+ * - the application can retry negotiation with another set of features;
+ * - the application can pass zero to clear the negotiation result;
+ * - the last negotiated result takes effect upon
+ *   the ethdev configure and start.
+ *
+ * @note
+ *   The PMD is supposed to first consider enabling the requested feature set
+ *   in its entirety. Only if it fails to do so, does it have the right to
+ *   respond with a smaller set of the originally requested features.
+ *
+ * @note
+ *   Return code (-ENOTSUP) does not necessarily mean that the requested
+ *   features are unsupported. In this case, the application should just
+ *   assume that these features can be used without prior negotiations.
+ *
+ * @param port_id
+ *   Port (ethdev) identifier
+ *
+ * @param[inout] features
+ *   Feature selection buffer
+ *
+ * @return
+ *   - (-EBUSY) if the port can't handle this in its current state;
+ *   - (-ENOTSUP) if the method itself is not supported by the PMD;
+ *   - (-ENODEV) if *port_id* is invalid;
+ *   - (-EINVAL) if *features* is NULL;
+ *   - (-EIO) if the device is removed;
+ *   - (0) on success
+ */
+__rte_experimental
+int rte_eth_rx_metadata_negotiate(uint16_t port_id, uint64_t *features);
+
 #include <rte_ethdev_core.h>
 
+/**
+ * @internal
+ * Helper routine for rte_eth_rx_burst().
+ * Should be called at exit from PMD's rte_eth_rx_bulk implementation.
+ * Does necessary post-processing - invokes Rx callbacks if any, etc.
+ *
+ * @param port_id
+ *  The port identifier of the Ethernet device.
+ * @param queue_id
+ *  The index of the receive queue from which to retrieve input packets.
+ * @param rx_pkts
+ *   The address of an array of pointers to *rte_mbuf* structures that
+ *   have been retrieved from the device.
+ * @param nb_rx
+ *   The number of packets that were retrieved from the device.
+ * @param nb_pkts
+ *   The number of elements in @p rx_pkts array.
+ * @param opaque
+ *   Opaque pointer of Rx queue callback related data.
+ *
+ * @return
+ *  The number of packets effectively supplied to the @p rx_pkts array.
+ */
+uint16_t rte_eth_call_rx_callbacks(uint16_t port_id, uint16_t queue_id,
+               struct rte_mbuf **rx_pkts, uint16_t nb_rx, uint16_t nb_pkts,
+               void *opaque);
+
 /**
  *
  * Retrieve a burst of input packets from a receive queue of an Ethernet
@@ -4921,39 +5044,51 @@ static inline uint16_t
 rte_eth_rx_burst(uint16_t port_id, uint16_t queue_id,
                 struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
 {
-       struct rte_eth_dev *dev = &rte_eth_devices[port_id];
        uint16_t nb_rx;
+       struct rte_eth_fp_ops *p;
+       void *qd;
+
+#ifdef RTE_ETHDEV_DEBUG_RX
+       if (port_id >= RTE_MAX_ETHPORTS ||
+                       queue_id >= RTE_MAX_QUEUES_PER_PORT) {
+               RTE_ETHDEV_LOG(ERR,
+                       "Invalid port_id=%u or queue_id=%u\n",
+                       port_id, queue_id);
+               return 0;
+       }
+#endif
+
+       /* fetch pointer to queue data */
+       p = &rte_eth_fp_ops[port_id];
+       qd = p->rxq.data[queue_id];
 
 #ifdef RTE_ETHDEV_DEBUG_RX
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
-       RTE_FUNC_PTR_OR_ERR_RET(*dev->rx_pkt_burst, 0);
 
-       if (queue_id >= dev->data->nb_rx_queues) {
-               RTE_ETHDEV_LOG(ERR, "Invalid RX queue_id=%u\n", queue_id);
+       if (qd == NULL) {
+               RTE_ETHDEV_LOG(ERR, "Invalid RX queue_id=%u for port_id=%u\n",
+                       queue_id, port_id);
                return 0;
        }
 #endif
-       nb_rx = (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id],
-                                    rx_pkts, nb_pkts);
 
-#ifdef RTE_ETHDEV_RXTX_CALLBACKS
-       struct rte_eth_rxtx_callback *cb;
+       nb_rx = p->rx_pkt_burst(qd, rx_pkts, nb_pkts);
 
-       /* __ATOMIC_RELEASE memory order was used when the
-        * call back was inserted into the list.
-        * Since there is a clear dependency between loading
-        * cb and cb->fn/cb->next, __ATOMIC_ACQUIRE memory order is
-        * not required.
-        */
-       cb = __atomic_load_n(&dev->post_rx_burst_cbs[queue_id],
+#ifdef RTE_ETHDEV_RXTX_CALLBACKS
+       {
+               void *cb;
+
+               /* __ATOMIC_RELEASE memory order was used when the
+                * call back was inserted into the list.
+                * Since there is a clear dependency between loading
+                * cb and cb->fn/cb->next, __ATOMIC_ACQUIRE memory order is
+                * not required.
+                */
+               cb = __atomic_load_n((void **)&p->rxq.clbk[queue_id],
                                __ATOMIC_RELAXED);
-
-       if (unlikely(cb != NULL)) {
-               do {
-                       nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
-                                               nb_pkts, cb->param);
-                       cb = cb->next;
-               } while (cb != NULL);
+               if (unlikely(cb != NULL))
+                       nb_rx = rte_eth_call_rx_callbacks(port_id, queue_id,
+                                       rx_pkts, nb_rx, nb_pkts, cb);
        }
 #endif
 
@@ -4977,41 +5112,27 @@ rte_eth_rx_burst(uint16_t port_id, uint16_t queue_id,
 static inline int
 rte_eth_rx_queue_count(uint16_t port_id, uint16_t queue_id)
 {
-       struct rte_eth_dev *dev;
-
-       RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-       dev = &rte_eth_devices[port_id];
-       RTE_FUNC_PTR_OR_ERR_RET(*dev->rx_queue_count, -ENOTSUP);
-       if (queue_id >= dev->data->nb_rx_queues ||
-           dev->data->rx_queues[queue_id] == NULL)
+       struct rte_eth_fp_ops *p;
+       void *qd;
+
+       if (port_id >= RTE_MAX_ETHPORTS ||
+                       queue_id >= RTE_MAX_QUEUES_PER_PORT) {
+               RTE_ETHDEV_LOG(ERR,
+                       "Invalid port_id=%u or queue_id=%u\n",
+                       port_id, queue_id);
                return -EINVAL;
+       }
 
-       return (int)(*dev->rx_queue_count)(dev, queue_id);
-}
+       /* fetch pointer to queue data */
+       p = &rte_eth_fp_ops[port_id];
+       qd = p->rxq.data[queue_id];
 
-/**
- * Check if the DD bit of the specific RX descriptor in the queue has been set
- *
- * @param port_id
- *  The port identifier of the Ethernet device.
- * @param queue_id
- *  The queue id on the specific port.
- * @param offset
- *  The offset of the descriptor ID from tail.
- * @return
- *  - (1) if the specific DD bit is set.
- *  - (0) if the specific DD bit is not set.
- *  - (-ENODEV) if *port_id* invalid.
- *  - (-ENOTSUP) if the device does not support this function
- */
-__rte_deprecated
-static inline int
-rte_eth_rx_descriptor_done(uint16_t port_id, uint16_t queue_id, uint16_t offset)
-{
-       struct rte_eth_dev *dev = &rte_eth_devices[port_id];
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-       RTE_FUNC_PTR_OR_ERR_RET(*dev->rx_descriptor_done, -ENOTSUP);
-       return (*dev->rx_descriptor_done)(dev->data->rx_queues[queue_id], offset);
+       RTE_FUNC_PTR_OR_ERR_RET(*p->rx_queue_count, -ENOTSUP);
+       if (qd == NULL)
+               return -EINVAL;
+
+       return (int)(*p->rx_queue_count)(qd);
 }
 
 /**@{@name Rx hardware descriptor states
@@ -5059,21 +5180,30 @@ static inline int
 rte_eth_rx_descriptor_status(uint16_t port_id, uint16_t queue_id,
        uint16_t offset)
 {
-       struct rte_eth_dev *dev;
-       void *rxq;
+       struct rte_eth_fp_ops *p;
+       void *qd;
 
 #ifdef RTE_ETHDEV_DEBUG_RX
-       RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+       if (port_id >= RTE_MAX_ETHPORTS ||
+                       queue_id >= RTE_MAX_QUEUES_PER_PORT) {
+               RTE_ETHDEV_LOG(ERR,
+                       "Invalid port_id=%u or queue_id=%u\n",
+                       port_id, queue_id);
+               return -EINVAL;
+       }
 #endif
-       dev = &rte_eth_devices[port_id];
+
+       /* fetch pointer to queue data */
+       p = &rte_eth_fp_ops[port_id];
+       qd = p->rxq.data[queue_id];
+
 #ifdef RTE_ETHDEV_DEBUG_RX
-       if (queue_id >= dev->data->nb_rx_queues)
+       RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+       if (qd == NULL)
                return -ENODEV;
 #endif
-       RTE_FUNC_PTR_OR_ERR_RET(*dev->rx_descriptor_status, -ENOTSUP);
-       rxq = dev->data->rx_queues[queue_id];
-
-       return (*dev->rx_descriptor_status)(rxq, offset);
+       RTE_FUNC_PTR_OR_ERR_RET(*p->rx_descriptor_status, -ENOTSUP);
+       return (*p->rx_descriptor_status)(qd, offset);
 }
 
 /**@{@name Tx hardware descriptor states
@@ -5120,23 +5250,54 @@ rte_eth_rx_descriptor_status(uint16_t port_id, uint16_t queue_id,
 static inline int rte_eth_tx_descriptor_status(uint16_t port_id,
        uint16_t queue_id, uint16_t offset)
 {
-       struct rte_eth_dev *dev;
-       void *txq;
+       struct rte_eth_fp_ops *p;
+       void *qd;
 
 #ifdef RTE_ETHDEV_DEBUG_TX
-       RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+       if (port_id >= RTE_MAX_ETHPORTS ||
+                       queue_id >= RTE_MAX_QUEUES_PER_PORT) {
+               RTE_ETHDEV_LOG(ERR,
+                       "Invalid port_id=%u or queue_id=%u\n",
+                       port_id, queue_id);
+               return -EINVAL;
+       }
 #endif
-       dev = &rte_eth_devices[port_id];
+
+       /* fetch pointer to queue data */
+       p = &rte_eth_fp_ops[port_id];
+       qd = p->txq.data[queue_id];
+
 #ifdef RTE_ETHDEV_DEBUG_TX
-       if (queue_id >= dev->data->nb_tx_queues)
+       RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+       if (qd == NULL)
                return -ENODEV;
 #endif
-       RTE_FUNC_PTR_OR_ERR_RET(*dev->tx_descriptor_status, -ENOTSUP);
-       txq = dev->data->tx_queues[queue_id];
-
-       return (*dev->tx_descriptor_status)(txq, offset);
+       RTE_FUNC_PTR_OR_ERR_RET(*p->tx_descriptor_status, -ENOTSUP);
+       return (*p->tx_descriptor_status)(qd, offset);
 }
 
+/**
+ * @internal
+ * Helper routine for rte_eth_tx_burst().
+ * Should be called before entry PMD's rte_eth_tx_bulk implementation.
+ * Does necessary pre-processing - invokes Tx callbacks if any, etc.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param queue_id
+ *   The index of the transmit queue through which output packets must be
+ *   sent.
+ * @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
+ *   The number of output packets to transmit.
+ */
+uint16_t rte_eth_call_tx_callbacks(uint16_t port_id, uint16_t queue_id,
+       struct rte_mbuf **tx_pkts, uint16_t nb_pkts, void *opaque);
+
 /**
  * Send a burst of output packets on a transmit queue of an Ethernet device.
  *
@@ -5207,42 +5368,55 @@ static inline uint16_t
 rte_eth_tx_burst(uint16_t port_id, uint16_t queue_id,
                 struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
-       struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+       struct rte_eth_fp_ops *p;
+       void *qd;
+
+#ifdef RTE_ETHDEV_DEBUG_TX
+       if (port_id >= RTE_MAX_ETHPORTS ||
+                       queue_id >= RTE_MAX_QUEUES_PER_PORT) {
+               RTE_ETHDEV_LOG(ERR,
+                       "Invalid port_id=%u or queue_id=%u\n",
+                       port_id, queue_id);
+               return 0;
+       }
+#endif
+
+       /* fetch pointer to queue data */
+       p = &rte_eth_fp_ops[port_id];
+       qd = p->txq.data[queue_id];
 
 #ifdef RTE_ETHDEV_DEBUG_TX
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
-       RTE_FUNC_PTR_OR_ERR_RET(*dev->tx_pkt_burst, 0);
 
-       if (queue_id >= dev->data->nb_tx_queues) {
-               RTE_ETHDEV_LOG(ERR, "Invalid TX queue_id=%u\n", queue_id);
+       if (qd == NULL) {
+               RTE_ETHDEV_LOG(ERR, "Invalid TX queue_id=%u for port_id=%u\n",
+                       queue_id, port_id);
                return 0;
        }
 #endif
 
 #ifdef RTE_ETHDEV_RXTX_CALLBACKS
-       struct rte_eth_rxtx_callback *cb;
-
-       /* __ATOMIC_RELEASE memory order was used when the
-        * call back was inserted into the list.
-        * Since there is a clear dependency between loading
-        * cb and cb->fn/cb->next, __ATOMIC_ACQUIRE memory order is
-        * not required.
-        */
-       cb = __atomic_load_n(&dev->pre_tx_burst_cbs[queue_id],
+       {
+               void *cb;
+
+               /* __ATOMIC_RELEASE memory order was used when the
+                * call back was inserted into the list.
+                * Since there is a clear dependency between loading
+                * cb and cb->fn/cb->next, __ATOMIC_ACQUIRE memory order is
+                * not required.
+                */
+               cb = __atomic_load_n((void **)&p->txq.clbk[queue_id],
                                __ATOMIC_RELAXED);
-
-       if (unlikely(cb != NULL)) {
-               do {
-                       nb_pkts = cb->fn.tx(port_id, queue_id, tx_pkts, nb_pkts,
-                                       cb->param);
-                       cb = cb->next;
-               } while (cb != NULL);
+               if (unlikely(cb != NULL))
+                       nb_pkts = rte_eth_call_tx_callbacks(port_id, queue_id,
+                                       tx_pkts, nb_pkts, cb);
        }
 #endif
 
-       rte_ethdev_trace_tx_burst(port_id, queue_id, (void **)tx_pkts,
-               nb_pkts);
-       return (*dev->tx_pkt_burst)(dev->data->tx_queues[queue_id], tx_pkts, nb_pkts);
+       nb_pkts = p->tx_pkt_burst(qd, tx_pkts, nb_pkts);
+
+       rte_ethdev_trace_tx_burst(port_id, queue_id, (void **)tx_pkts, nb_pkts);
+       return nb_pkts;
 }
 
 /**
@@ -5305,31 +5479,42 @@ static inline uint16_t
 rte_eth_tx_prepare(uint16_t port_id, uint16_t queue_id,
                struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
-       struct rte_eth_dev *dev;
+       struct rte_eth_fp_ops *p;
+       void *qd;
 
 #ifdef RTE_ETHDEV_DEBUG_TX
-       if (!rte_eth_dev_is_valid_port(port_id)) {
-               RTE_ETHDEV_LOG(ERR, "Invalid TX port_id=%u\n", port_id);
+       if (port_id >= RTE_MAX_ETHPORTS ||
+                       queue_id >= RTE_MAX_QUEUES_PER_PORT) {
+               RTE_ETHDEV_LOG(ERR,
+                       "Invalid port_id=%u or queue_id=%u\n",
+                       port_id, queue_id);
                rte_errno = ENODEV;
                return 0;
        }
 #endif
 
-       dev = &rte_eth_devices[port_id];
+       /* fetch pointer to queue data */
+       p = &rte_eth_fp_ops[port_id];
+       qd = p->txq.data[queue_id];
 
 #ifdef RTE_ETHDEV_DEBUG_TX
-       if (queue_id >= dev->data->nb_tx_queues) {
-               RTE_ETHDEV_LOG(ERR, "Invalid TX queue_id=%u\n", queue_id);
+       if (!rte_eth_dev_is_valid_port(port_id)) {
+               RTE_ETHDEV_LOG(ERR, "Invalid TX port_id=%u\n", port_id);
+               rte_errno = ENODEV;
+               return 0;
+       }
+       if (qd == NULL) {
+               RTE_ETHDEV_LOG(ERR, "Invalid TX queue_id=%u for port_id=%u\n",
+                       queue_id, port_id);
                rte_errno = EINVAL;
                return 0;
        }
 #endif
 
-       if (!dev->tx_pkt_prepare)
+       if (!p->tx_pkt_prepare)
                return nb_pkts;
 
-       return (*dev->tx_pkt_prepare)(dev->data->tx_queues[queue_id],
-                       tx_pkts, nb_pkts);
+       return p->tx_pkt_prepare(qd, tx_pkts, nb_pkts);
 }
 
 #else