doc: add Meson coding style to contributors guide
[dpdk.git] / lib / librte_ethdev / rte_ethdev.h
index 1f37895..3b773b6 100644 (file)
@@ -148,6 +148,12 @@ extern "C" {
 /* Use this macro to check if LRO API is supported */
 #define RTE_ETHDEV_HAS_LRO_SUPPORT
 
+/* Alias RTE_LIBRTE_ETHDEV_DEBUG for backward compatibility. */
+#ifdef RTE_LIBRTE_ETHDEV_DEBUG
+#define RTE_ETHDEV_DEBUG_RX
+#define RTE_ETHDEV_DEBUG_TX
+#endif
+
 #include <rte_compat.h>
 #include <rte_log.h>
 #include <rte_interrupts.h>
@@ -1512,6 +1518,8 @@ struct rte_eth_rxseg_capa {
 enum rte_eth_representor_type {
        RTE_ETH_REPRESENTOR_NONE, /**< not a representor. */
        RTE_ETH_REPRESENTOR_VF,   /**< representor of Virtual Function. */
+       RTE_ETH_REPRESENTOR_SF,   /**< representor of Sub Function. */
+       RTE_ETH_REPRESENTOR_PF,   /**< representor of Physical Function. */
 };
 
 /**
@@ -4395,6 +4403,7 @@ int rte_eth_get_monitor_addr(uint16_t port_id, uint16_t queue_id,
  * @return
  *   - (0) if successful.
  *   - (-ENOTSUP) if hardware doesn't support.
+ *   - (-EINVAL) if bad parameter.
  *   - (-ENODEV) if *port_id* invalid.
  *   - (-EIO) if device is removed.
  *   - others depends on the specific operations implementation.
@@ -4426,6 +4435,7 @@ int rte_eth_dev_get_eeprom_length(uint16_t port_id);
  * @return
  *   - (0) if successful.
  *   - (-ENOTSUP) if hardware doesn't support.
+ *   - (-EINVAL) if bad parameter.
  *   - (-ENODEV) if *port_id* invalid.
  *   - (-EIO) if device is removed.
  *   - others depends on the specific operations implementation.
@@ -4444,6 +4454,7 @@ int rte_eth_dev_get_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info);
  *   - (0) if successful.
  *   - (-ENOTSUP) if hardware doesn't support.
  *   - (-ENODEV) if *port_id* invalid.
+ *   - (-EINVAL) if bad parameter.
  *   - (-EIO) if device is removed.
  *   - others depends on the specific operations implementation.
  */
@@ -4463,6 +4474,7 @@ int rte_eth_dev_set_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info);
  *   - (0) if successful.
  *   - (-ENOTSUP) if hardware doesn't support.
  *   - (-ENODEV) if *port_id* invalid.
+ *   - (-EINVAL) if bad parameter.
  *   - (-EIO) if device is removed.
  *   - others depends on the specific operations implementation.
  */
@@ -4485,6 +4497,7 @@ rte_eth_dev_get_module_info(uint16_t port_id,
  * @return
  *   - (0) if successful.
  *   - (-ENOTSUP) if hardware doesn't support.
+ *   - (-EINVAL) if bad parameter.
  *   - (-ENODEV) if *port_id* invalid.
  *   - (-EIO) if device is removed.
  *   - others depends on the specific operations implementation.
@@ -4789,6 +4802,60 @@ __rte_experimental
 int rte_eth_dev_hairpin_capability_get(uint16_t port_id,
                                       struct rte_eth_hairpin_cap *cap);
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice.
+ *
+ * ethernet device representor ID range entry
+ */
+struct rte_eth_representor_range {
+       enum rte_eth_representor_type type; /**< Representor type */
+       int controller; /**< Controller index */
+       int pf; /**< Physical function index */
+       __extension__
+       union {
+               int vf; /**< VF start index */
+               int sf; /**< SF start index */
+       };
+       uint32_t id_base; /**< Representor ID start index */
+       uint32_t id_end;  /**< Representor ID end index */
+       char name[RTE_DEV_NAME_MAX_LEN]; /**< Representor name */
+};
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice.
+ *
+ * Ethernet device representor information
+ */
+struct rte_eth_representor_info {
+       uint16_t controller; /**< Controller ID of caller device. */
+       uint16_t pf; /**< Physical function ID of caller device. */
+       struct rte_eth_representor_range ranges[];/**< Representor ID range. */
+};
+
+/**
+ * Retrieve the representor info of the device.
+ *
+ * Get device representor info to be able to calculate a unique
+ * representor ID. @see rte_eth_representor_id_get helper.
+ *
+ * @param port_id
+ *   The port identifier of the device.
+ * @param info
+ *   A pointer to a representor info structure.
+ *   NULL to return number of range entries and allocate memory
+ *   for next call to store detail.
+ * @return
+ *   - (-ENOTSUP) if operation is not supported.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - (-EIO) if device is removed.
+ *   - (>=0) number of representor range entries supported by device.
+ */
+__rte_experimental
+int rte_eth_representor_info_get(uint16_t port_id,
+                                struct rte_eth_representor_info *info);
+
 #include <rte_ethdev_core.h>
 
 /**
@@ -4885,7 +4952,7 @@ rte_eth_rx_burst(uint16_t port_id, uint16_t queue_id,
        struct rte_eth_dev *dev = &rte_eth_devices[port_id];
        uint16_t nb_rx;
 
-#ifdef RTE_LIBRTE_ETHDEV_DEBUG
+#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);
 
@@ -5019,11 +5086,11 @@ rte_eth_rx_descriptor_status(uint16_t port_id, uint16_t queue_id,
        struct rte_eth_dev *dev;
        void *rxq;
 
-#ifdef RTE_LIBRTE_ETHDEV_DEBUG
+#ifdef RTE_ETHDEV_DEBUG_RX
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 #endif
        dev = &rte_eth_devices[port_id];
-#ifdef RTE_LIBRTE_ETHDEV_DEBUG
+#ifdef RTE_ETHDEV_DEBUG_RX
        if (queue_id >= dev->data->nb_rx_queues)
                return -ENODEV;
 #endif
@@ -5076,11 +5143,11 @@ static inline int rte_eth_tx_descriptor_status(uint16_t port_id,
        struct rte_eth_dev *dev;
        void *txq;
 
-#ifdef RTE_LIBRTE_ETHDEV_DEBUG
+#ifdef RTE_ETHDEV_DEBUG_TX
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 #endif
        dev = &rte_eth_devices[port_id];
-#ifdef RTE_LIBRTE_ETHDEV_DEBUG
+#ifdef RTE_ETHDEV_DEBUG_TX
        if (queue_id >= dev->data->nb_tx_queues)
                return -ENODEV;
 #endif
@@ -5162,7 +5229,7 @@ rte_eth_tx_burst(uint16_t port_id, uint16_t queue_id,
 {
        struct rte_eth_dev *dev = &rte_eth_devices[port_id];
 
-#ifdef RTE_LIBRTE_ETHDEV_DEBUG
+#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);
 
@@ -5260,7 +5327,7 @@ rte_eth_tx_prepare(uint16_t port_id, uint16_t queue_id,
 {
        struct rte_eth_dev *dev;
 
-#ifdef RTE_LIBRTE_ETHDEV_DEBUG
+#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);
                rte_errno = ENODEV;
@@ -5270,7 +5337,7 @@ rte_eth_tx_prepare(uint16_t port_id, uint16_t queue_id,
 
        dev = &rte_eth_devices[port_id];
 
-#ifdef RTE_LIBRTE_ETHDEV_DEBUG
+#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);
                rte_errno = EINVAL;