ixgbe/base: get host interface command status
[dpdk.git] / lib / librte_ether / rte_ethdev.h
index 21aa359..4648290 100644 (file)
@@ -172,6 +172,9 @@ extern "C" {
 
 #include <stdint.h>
 
+/* Use this macro to check if LRO API is supported */
+#define RTE_ETHDEV_HAS_LRO_SUPPORT
+
 #include <rte_log.h>
 #include <rte_interrupts.h>
 #include <rte_pci.h>
@@ -320,14 +323,15 @@ struct rte_eth_rxmode {
        enum rte_eth_rx_mq_mode mq_mode;
        uint32_t max_rx_pkt_len;  /**< Only used if jumbo_frame enabled. */
        uint16_t split_hdr_size;  /**< hdr buf size (header_split enabled).*/
-       uint8_t header_split : 1, /**< Header Split enable. */
+       uint16_t header_split : 1, /**< Header Split enable. */
                hw_ip_checksum   : 1, /**< IP/UDP/TCP checksum offload enable. */
                hw_vlan_filter   : 1, /**< VLAN filter enable. */
                hw_vlan_strip    : 1, /**< VLAN strip enable. */
                hw_vlan_extend   : 1, /**< Extended VLAN enable. */
                jumbo_frame      : 1, /**< Jumbo Frame Receipt enable. */
                hw_strip_crc     : 1, /**< Enable CRC stripping by hardware. */
-               enable_scatter   : 1; /**< Enable scatter packets rx handler */
+               enable_scatter   : 1, /**< Enable scatter packets rx handler */
+               enable_lro       : 1; /**< Enable LRO */
 };
 
 /**
@@ -1384,33 +1388,52 @@ struct eth_dev_ops {
 };
 
 /**
- * Function type used for callbacks for processing packets on RX and TX
+ * Function type used for RX packet processing packet callbacks.
  *
- * If configured for RX, it is called with a burst of packets that have just
- * been received on the given port and queue. On TX, it is called with a burst
- * of packets immediately before those packets are put onto the hardware queue
- * for transmission.
+ * The callback function is called on RX with a burst of packets that have
+ * been received on the given port and queue.
  *
  * @param port
- *   The ethernet port on which rx or tx is being performed
+ *   The Ethernet port on which RX is being performed.
  * @param queue
- *   The queue on the ethernet port which is being used to receive or transmit
- *   the packets.
+ *   The queue on the Ethernet port which is being used to receive the packets.
  * @param pkts
- *   The burst of packets on which processing is to be done. On RX, these
- *   packets have just been received. On TX, they are about to be transmitted.
+ *   The burst of packets that have just been received.
  * @param nb_pkts
- *   The number of packets in the burst pointed to by "pkts"
+ *   The number of packets in the burst pointed to by "pkts".
+ * @param max_pkts
+ *   The max number of packets that can be stored in the "pkts" array.
  * @param user_param
  *   The arbitrary user parameter passed in by the application when the callback
  *   was originally configured.
  * @return
- *   The number of packets remaining in pkts are processing.
- *     * On RX, this will be returned to the user as the return value from
- *       rte_eth_rx_burst.
- *     * On TX, this will be the number of packets actually written to the NIC.
+ *   The number of packets returned to the user.
  */
-typedef uint16_t (*rte_rxtx_callback_fn)(uint8_t port, uint16_t queue,
+typedef uint16_t (*rte_rx_callback_fn)(uint8_t port, uint16_t queue,
+       struct rte_mbuf *pkts[], uint16_t nb_pkts, uint16_t max_pkts,
+       void *user_param);
+
+/**
+ * Function type used for TX packet processing packet callbacks.
+ *
+ * The callback function is called on TX with a burst of packets immediately
+ * before the packets are put onto the hardware queue for transmission.
+ *
+ * @param port
+ *   The Ethernet port on which TX is being performed.
+ * @param queue
+ *   The queue on the Ethernet port which is being used to transmit the packets.
+ * @param pkts
+ *   The burst of packets that are about to be transmitted.
+ * @param nb_pkts
+ *   The number of packets in the burst pointed to by "pkts".
+ * @param user_param
+ *   The arbitrary user parameter passed in by the application when the callback
+ *   was originally configured.
+ * @return
+ *   The number of packets to be written to the NIC.
+ */
+typedef uint16_t (*rte_tx_callback_fn)(uint8_t port, uint16_t queue,
        struct rte_mbuf *pkts[], uint16_t nb_pkts, void *user_param);
 
 /**
@@ -1420,7 +1443,10 @@ typedef uint16_t (*rte_rxtx_callback_fn)(uint8_t port, uint16_t queue,
  */
 struct rte_eth_rxtx_callback {
        struct rte_eth_rxtx_callback *next;
-       rte_rxtx_callback_fn fn;
+       union{
+               rte_rx_callback_fn rx;
+               rte_tx_callback_fn tx;
+       } fn;
        void *param;
 };
 
@@ -1450,7 +1476,7 @@ struct rte_eth_dev {
        eth_tx_burst_t tx_pkt_burst; /**< Pointer to PMD transmit function. */
        struct rte_eth_dev_data *data;  /**< Pointer to device data */
        const struct eth_driver *driver;/**< Driver for this device */
-       struct eth_dev_ops *dev_ops;    /**< Functions exported by PMD */
+       const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */
        struct rte_pci_device *pci_dev; /**< PCI info. supplied by probing */
        /** User application callbacks for NIC interrupts */
        struct rte_eth_dev_cb_list link_intr_cbs;
@@ -1458,12 +1484,12 @@ struct rte_eth_dev {
         * User-supplied functions called from rx_burst to post-process
         * received packets before passing them to the user
         */
-       struct rte_eth_rxtx_callback **post_rx_burst_cbs;
+       struct rte_eth_rxtx_callback *post_rx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
        /**
         * User-supplied functions called from tx_burst to pre-process
         * received packets before passing them to the driver for transmission.
         */
-       struct rte_eth_rxtx_callback **pre_tx_burst_cbs;
+       struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
        uint8_t attached; /**< Flag indicating the port is attached */
        enum rte_eth_dev_type dev_type; /**< Flag indicating the device type */
 };
@@ -1515,6 +1541,7 @@ struct rte_eth_dev_data {
        uint8_t port_id;           /**< Device [external] port identifier. */
        uint8_t promiscuous   : 1, /**< RX promiscuous mode ON(1) / OFF(0). */
                scattered_rx : 1,  /**< RX of scattered packets is ON(1) / OFF(0) */
+               lro          : 1,  /**< RX LRO is ON(1) / OFF(0) */
                all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */
                dev_started : 1;   /**< Device state: STARTED(1) / STOPPED(0). */
 };
@@ -2386,28 +2413,28 @@ extern uint16_t rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id,
 #else
 static inline uint16_t
 rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id,
-                struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
+                struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
 {
        struct rte_eth_dev *dev;
 
        dev = &rte_eth_devices[port_id];
 
-       nb_pkts = (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id], rx_pkts,
-                       nb_pkts);
+       int16_t 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 = dev->post_rx_burst_cbs[queue_id];
 
        if (unlikely(cb != NULL)) {
                do {
-                       nb_pkts = cb->fn(port_id, queue_id, rx_pkts, nb_pkts,
-                                       cb->param);
+                       nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
+                                               nb_pkts, cb->param);
                        cb = cb->next;
                } while (cb != NULL);
        }
 #endif
 
-       return nb_pkts;
+       return nb_rx;
 }
 #endif
 
@@ -2540,7 +2567,7 @@ rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
 
        if (unlikely(cb != NULL)) {
                do {
-                       nb_pkts = cb->fn(port_id, queue_id, tx_pkts, nb_pkts,
+                       nb_pkts = cb->fn.tx(port_id, queue_id, tx_pkts, nb_pkts,
                                        cb->param);
                        cb = cb->next;
                } while (cb != NULL);
@@ -3490,7 +3517,7 @@ int rte_eth_dev_filter_ctrl(uint8_t port_id, enum rte_filter_type filter_type,
  *   On success, a pointer value which can later be used to remove the callback.
  */
 void *rte_eth_add_rx_callback(uint8_t port_id, uint16_t queue_id,
-               rte_rxtx_callback_fn fn, void *user_param);
+               rte_rx_callback_fn fn, void *user_param);
 
 /**
  * Add a callback to be called on packet TX on a given port and queue.
@@ -3515,7 +3542,7 @@ void *rte_eth_add_rx_callback(uint8_t port_id, uint16_t queue_id,
  *   On success, a pointer value which can later be used to remove the callback.
  */
 void *rte_eth_add_tx_callback(uint8_t port_id, uint16_t queue_id,
-               rte_rxtx_callback_fn fn, void *user_param);
+               rte_tx_callback_fn fn, void *user_param);
 
 /**
  * Remove an RX packet callback from a given port and queue.