ethdev: fix ABI breakage
[dpdk.git] / lib / librte_ether / rte_ethdev.h
index 57ad653..544afe0 100644 (file)
@@ -182,6 +182,7 @@ extern "C" {
 #include <rte_devargs.h>
 #include "rte_ether.h"
 #include "rte_eth_ctrl.h"
+#include "rte_dev_info.h"
 
 struct rte_mbuf;
 
@@ -193,19 +194,29 @@ struct rte_eth_stats {
        uint64_t opackets;  /**< Total number of successfully transmitted packets.*/
        uint64_t ibytes;    /**< Total number of successfully received bytes. */
        uint64_t obytes;    /**< Total number of successfully transmitted bytes. */
-       uint64_t imissed;   /**< Total of RX missed packets (e.g full FIFO). */
-       uint64_t ibadcrc;   /**< Total of RX packets with CRC error. */
-       uint64_t ibadlen;   /**< Total of RX packets with bad length. */
+       uint64_t imissed;
+       /**< Deprecated; Total of RX missed packets (e.g full FIFO). */
+       uint64_t ibadcrc;
+       /**< Deprecated; Total of RX packets with CRC error. */
+       uint64_t ibadlen;
+       /**< Deprecated; Total of RX packets with bad length. */
        uint64_t ierrors;   /**< Total number of erroneous received packets. */
        uint64_t oerrors;   /**< Total number of failed transmitted packets. */
-       uint64_t imcasts;   /**< Total number of multicast received packets. */
+       uint64_t imcasts;
+       /**< Deprecated; Total number of multicast received packets. */
        uint64_t rx_nombuf; /**< Total number of RX mbuf allocation failures. */
-       uint64_t fdirmatch; /**< Total number of RX packets matching a filter. */
-       uint64_t fdirmiss;  /**< Total number of RX packets not matching any filter. */
-       uint64_t tx_pause_xon;  /**< Total nb. of XON pause frame sent. */
-       uint64_t rx_pause_xon;  /**< Total nb. of XON pause frame received. */
-       uint64_t tx_pause_xoff; /**< Total nb. of XOFF pause frame sent. */
-       uint64_t rx_pause_xoff; /**< Total nb. of XOFF pause frame received. */
+       uint64_t fdirmatch;
+       /**< Deprecated; Total number of RX packets matching a filter. */
+       uint64_t fdirmiss;
+       /**< Deprecated; Total number of RX packets not matching any filter. */
+       uint64_t tx_pause_xon;
+        /**< Deprecated; Total nb. of XON pause frame sent. */
+       uint64_t rx_pause_xon;
+       /**< Deprecated; Total nb. of XON pause frame received. */
+       uint64_t tx_pause_xoff;
+       /**< Deprecated; Total nb. of XOFF pause frame sent. */
+       uint64_t rx_pause_xoff;
+       /**< Deprecated; Total nb. of XOFF pause frame received. */
        uint64_t q_ipackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];
        /**< Total number of queue RX packets. */
        uint64_t q_opackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];
@@ -834,6 +845,10 @@ struct rte_eth_fdir {
 struct rte_intr_conf {
        /** enable/disable lsc interrupt. 0 (default) - disable, 1 enable */
        uint16_t lsc;
+#ifdef RTE_NEXT_ABI
+       /** enable/disable rxq interrupt. 0 (default) - disable, 1 enable */
+       uint16_t rxq;
+#endif
 };
 
 /**
@@ -1042,6 +1057,14 @@ typedef int (*eth_tx_queue_setup_t)(struct rte_eth_dev *dev,
                                    const struct rte_eth_txconf *tx_conf);
 /**< @internal Setup a transmit queue of an Ethernet device. */
 
+typedef int (*eth_rx_enable_intr_t)(struct rte_eth_dev *dev,
+                                   uint16_t rx_queue_id);
+/**< @internal Enable interrupt of a receive queue of an Ethernet device. */
+
+typedef int (*eth_rx_disable_intr_t)(struct rte_eth_dev *dev,
+                                   uint16_t rx_queue_id);
+/**< @internal Disable interrupt of a receive queue of an Ethernet device. */
+
 typedef void (*eth_queue_release_t)(void *queue);
 /**< @internal Release memory resources allocated by given RX/TX queue. */
 
@@ -1255,6 +1278,24 @@ typedef int (*eth_timesync_read_tx_timestamp_t)(struct rte_eth_dev *dev,
                                                struct timespec *timestamp);
 /**< @internal Function used to read a TX IEEE1588/802.1AS timestamp. */
 
+typedef int (*eth_get_reg_length_t)(struct rte_eth_dev *dev);
+/**< @internal Retrieve device register count  */
+
+typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev,
+                               struct rte_dev_reg_info *info);
+/**< @internal Retrieve registers  */
+
+typedef int (*eth_get_eeprom_length_t)(struct rte_eth_dev *dev);
+/**< @internal Retrieve eeprom size  */
+
+typedef int (*eth_get_eeprom_t)(struct rte_eth_dev *dev,
+                               struct rte_dev_eeprom_info *info);
+/**< @internal Retrieve eeprom data  */
+
+typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev,
+                               struct rte_dev_eeprom_info *info);
+/**< @internal Program eeprom data  */
+
 #ifdef RTE_NIC_BYPASS
 
 enum {
@@ -1351,6 +1392,12 @@ struct eth_dev_ops {
        eth_queue_release_t        rx_queue_release;/**< Release RX queue.*/
        eth_rx_queue_count_t       rx_queue_count; /**< Get Rx queue count. */
        eth_rx_descriptor_done_t   rx_descriptor_done;  /**< Check rxd DD bit */
+#ifdef RTE_NEXT_ABI
+       /**< Enable Rx queue interrupt. */
+       eth_rx_enable_intr_t       rx_queue_intr_enable;
+       /**< Disable Rx queue interrupt.*/
+       eth_rx_disable_intr_t      rx_queue_intr_disable;
+#endif
        eth_tx_queue_setup_t       tx_queue_setup;/**< Set up device TX queue.*/
        eth_queue_release_t        tx_queue_release;/**< Release TX queue.*/
        eth_dev_led_on_t           dev_led_on;    /**< Turn on LED. */
@@ -1394,6 +1441,17 @@ struct eth_dev_ops {
        reta_update_t reta_update;
        /** Query redirection table. */
        reta_query_t reta_query;
+
+       eth_get_reg_length_t get_reg_length;
+       /**< Get # of registers */
+       eth_get_reg_t get_reg;
+       /**< Get registers */
+       eth_get_eeprom_length_t get_eeprom_length;
+       /**< Get eeprom length */
+       eth_get_eeprom_t get_eeprom;
+       /**< Get eeprom data */
+       eth_set_eeprom_t set_eeprom;
+       /**< Set eeprom */
   /* bypass control */
 #ifdef RTE_NIC_BYPASS
   bypass_init_t bypass_init;
@@ -1578,9 +1636,9 @@ 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). */
+               dev_started : 1,   /**< Device state: STARTED(1) / STOPPED(0). */
+               lro         : 1;   /**< RX LRO is ON(1) / OFF(0) */
 };
 
 /**
@@ -1606,8 +1664,9 @@ extern struct rte_eth_dev rte_eth_devices[];
 extern uint8_t rte_eth_dev_count(void);
 
 /**
- * Function for internal use by port hotplug functions.
+ * @internal
  * Returns a ethdev slot specified by the unique identifier name.
+ *
  * @param      name
  *  The pointer to the Unique identifier name for each Ethernet device
  * @return
@@ -1616,8 +1675,7 @@ extern uint8_t rte_eth_dev_count(void);
 extern struct rte_eth_dev *rte_eth_dev_allocated(const char *name);
 
 /**
- * Function for internal use by dummy drivers primarily, e.g. ring-based
- * driver.
+ * @internal
  * Allocates a new ethdev slot for an ethernet device and returns the pointer
  * to that slot for the driver to use.
  *
@@ -1630,8 +1688,7 @@ struct rte_eth_dev *rte_eth_dev_allocate(const char *name,
                enum rte_eth_dev_type type);
 
 /**
- * Function for internal use by dummy drivers primarily, e.g. ring-based
- * driver.
+ * @internal
  * Release the specified ethdev port.
  *
  * @param eth_dev
@@ -1890,6 +1947,17 @@ extern int rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id,
  */
 extern int rte_eth_dev_socket_id(uint8_t port_id);
 
+/*
+ * Check if port_id of device is attached
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device
+ * @return
+ *   - 0 if port is out of range or not attached
+ *   - 1 if device is attached
+ */
+extern int rte_eth_dev_is_valid_port(uint8_t port_id);
+
 /*
  * Allocate mbuf from mempool, setup the DMA physical address
  * and then start RX for specified queue of a port. It is used
@@ -2906,6 +2974,92 @@ int rte_eth_dev_callback_unregister(uint8_t port_id,
 void _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
                                enum rte_eth_event_type event);
 
+/**
+ * When there is no rx packet coming in Rx Queue for a long time, we can
+ * sleep lcore related to RX Queue for power saving, and enable rx interrupt
+ * to be triggered when rx packect arrives.
+ *
+ * The rte_eth_dev_rx_intr_enable() function enables rx queue
+ * interrupt on specific rx queue of a port.
+ *
+ * @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.
+ *   The value must be in the range [0, nb_rx_queue - 1] previously supplied
+ *   to rte_eth_dev_configure().
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if underlying hardware OR driver doesn't support
+ *     that operation.
+ *   - (-ENODEV) if *port_id* invalid.
+ */
+int rte_eth_dev_rx_intr_enable(uint8_t port_id, uint16_t queue_id);
+
+/**
+ * When lcore wakes up from rx interrupt indicating packet coming, disable rx
+ * interrupt and returns to polling mode.
+ *
+ * The rte_eth_dev_rx_intr_disable() function disables rx queue
+ * interrupt on specific rx queue of a port.
+ *
+ * @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.
+ *   The value must be in the range [0, nb_rx_queue - 1] previously supplied
+ *   to rte_eth_dev_configure().
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if underlying hardware OR driver doesn't support
+ *     that operation.
+ *   - (-ENODEV) if *port_id* invalid.
+ */
+int rte_eth_dev_rx_intr_disable(uint8_t port_id, uint16_t queue_id);
+
+/**
+ * RX Interrupt control per port.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param epfd
+ *   Epoll instance fd which the intr vector associated to.
+ *   Using RTE_EPOLL_PER_THREAD allows to use per thread epoll instance.
+ * @param op
+ *   The operation be performed for the vector.
+ *   Operation type of {RTE_INTR_EVENT_ADD, RTE_INTR_EVENT_DEL}.
+ * @param data
+ *   User raw data.
+ * @return
+ *   - On success, zero.
+ *   - On failure, a negative value.
+ */
+int rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data);
+
+/**
+ * RX Interrupt control per queue.
+ *
+ * @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.
+ *   The value must be in the range [0, nb_rx_queue - 1] previously supplied
+ *   to rte_eth_dev_configure().
+ * @param epfd
+ *   Epoll instance fd which the intr vector associated to.
+ *   Using RTE_EPOLL_PER_THREAD allows to use per thread epoll instance.
+ * @param op
+ *   The operation be performed for the vector.
+ *   Operation type of {RTE_INTR_EVENT_ADD, RTE_INTR_EVENT_DEL}.
+ * @param data
+ *   User raw data.
+ * @return
+ *   - On success, zero.
+ *   - On failure, a negative value.
+ */
+int rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id,
+                             int epfd, int op, void *data);
+
 /**
  * Turn on the LED on the Ethernet device.
  * This function turns on the LED on the Ethernet device.
@@ -3670,9 +3824,78 @@ int rte_eth_remove_rx_callback(uint8_t port_id, uint16_t queue_id,
 int rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id,
                struct rte_eth_rxtx_callback *user_cb);
 
-#ifdef __cplusplus
-}
-#endif
+/**
+ * Retrieve number of available registers for access
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @return
+ *   - (>=0) number of registers if successful.
+ *   - (-ENOTSUP) if hardware doesn't support.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - others depends on the specific operations implementation.
+ */
+int rte_eth_dev_get_reg_length(uint8_t port_id);
+
+/**
+ * Retrieve device registers and register attributes
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param info
+ *   The template includes buffer for register data and attribute to be filled.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if hardware doesn't support.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - others depends on the specific operations implementation.
+ */
+int rte_eth_dev_get_reg_info(uint8_t port_id, struct rte_dev_reg_info *info);
+
+/**
+ * Retrieve size of device EEPROM
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @return
+ *   - (>=0) EEPROM size if successful.
+ *   - (-ENOTSUP) if hardware doesn't support.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - others depends on the specific operations implementation.
+ */
+int rte_eth_dev_get_eeprom_length(uint8_t port_id);
+
+/**
+ * Retrieve EEPROM and EEPROM attribute
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param info
+ *   The template includes buffer for return EEPROM data and
+ *   EEPROM attributes to be filled.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if hardware doesn't support.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - others depends on the specific operations implementation.
+ */
+int rte_eth_dev_get_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info);
+
+/**
+ * Program EEPROM with provided data
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param info
+ *   The template includes EEPROM data for programming and
+ *   EEPROM attributes to be filled
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if hardware doesn't support.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - others depends on the specific operations implementation.
+ */
+int rte_eth_dev_set_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info);
 
 /**
  * Set the list of multicast addresses to filter on an Ethernet device.
@@ -3695,7 +3918,6 @@ int rte_eth_dev_set_mc_addr_list(uint8_t port_id,
                                 struct ether_addr *mc_addr_set,
                                 uint32_t nb_mc_addr);
 
-
 /**
  * Enable IEEE1588/802.1AS timestamping for an Ethernet device.
  *
@@ -3759,4 +3981,9 @@ extern int rte_eth_timesync_read_rx_timestamp(uint8_t port_id,
  */
 extern int rte_eth_timesync_read_tx_timestamp(uint8_t port_id,
                                              struct timespec *timestamp);
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_ETHDEV_H_ */