net/qede: update PMD version to 2.8.0.1
[dpdk.git] / lib / librte_ether / rte_ethdev.h
index d097e52..5e13dca 100644 (file)
@@ -146,6 +146,7 @@ extern "C" {
 /* Use this macro to check if LRO API is supported */
 #define RTE_ETHDEV_HAS_LRO_SUPPORT
 
+#include <rte_compat.h>
 #include <rte_log.h>
 #include <rte_interrupts.h>
 #include <rte_dev.h>
@@ -1116,14 +1117,8 @@ struct rte_eth_dcb_info {
 #define RTE_ETH_QUEUE_STATE_STOPPED 0
 #define RTE_ETH_QUEUE_STATE_STARTED 1
 
-struct rte_eth_dev;
-
 #define RTE_ETH_ALL RTE_MAX_ETHPORTS
 
-struct rte_eth_dev_callback;
-/** @internal Structure to keep track of registered callbacks */
-TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
-
 /* Macros to check for valid port */
 #define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
        if (!rte_eth_dev_is_valid_port(port_id)) { \
@@ -1158,7 +1153,7 @@ TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
  * The callback function is called on RX with a burst of packets that have
  * been received on the given port and queue.
  *
- * @param port
+ * @param port_id
  *   The Ethernet port on which RX is being performed.
  * @param queue
  *   The queue on the Ethernet port which is being used to receive the packets.
@@ -1174,7 +1169,7 @@ TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
  * @return
  *   The number of packets returned to the user.
  */
-typedef uint16_t (*rte_rx_callback_fn)(uint16_t port, uint16_t queue,
+typedef uint16_t (*rte_rx_callback_fn)(uint16_t port_id, uint16_t queue,
        struct rte_mbuf *pkts[], uint16_t nb_pkts, uint16_t max_pkts,
        void *user_param);
 
@@ -1184,7 +1179,7 @@ typedef uint16_t (*rte_rx_callback_fn)(uint16_t port, uint16_t queue,
  * 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
+ * @param port_id
  *   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.
@@ -1198,7 +1193,7 @@ typedef uint16_t (*rte_rx_callback_fn)(uint16_t port, uint16_t queue,
  * @return
  *   The number of packets to be written to the NIC.
  */
-typedef uint16_t (*rte_tx_callback_fn)(uint16_t port, uint16_t queue,
+typedef uint16_t (*rte_tx_callback_fn)(uint16_t port_id, uint16_t queue,
        struct rte_mbuf *pkts[], uint16_t nb_pkts, void *user_param);
 
 /**
@@ -1221,6 +1216,15 @@ struct rte_eth_dev_sriov {
 
 #define RTE_ETH_NAME_MAX_LEN RTE_DEV_NAME_MAX_LEN
 
+#define RTE_ETH_DEV_NO_OWNER 0
+
+#define RTE_ETH_MAX_OWNER_NAME_LEN 64
+
+struct rte_eth_dev_owner {
+       uint64_t id; /**< The owner unique identifier. */
+       char name[RTE_ETH_MAX_OWNER_NAME_LEN]; /**< The owner name. */
+};
+
 /** Device supports link state interrupt */
 #define RTE_ETH_DEV_INTR_LSC     0x0002
 /** Device is a bonded slave */
@@ -1228,6 +1232,31 @@ struct rte_eth_dev_sriov {
 /** Device supports device removal interrupt */
 #define RTE_ETH_DEV_INTR_RMV     0x0008
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Iterates over valid ethdev ports owned by a specific owner.
+ *
+ * @param port_id
+ *   The id of the next possible valid owned port.
+ * @param      owner_id
+ *  The owner identifier.
+ *  RTE_ETH_DEV_NO_OWNER means iterate over all valid ownerless ports.
+ * @return
+ *   Next valid port id owned by owner_id, RTE_MAX_ETHPORTS if there is none.
+ */
+uint64_t __rte_experimental rte_eth_find_next_owned_by(uint16_t port_id,
+               const uint64_t owner_id);
+
+/**
+ * Macro to iterate over all enabled ethdev ports owned by a specific owner.
+ */
+#define RTE_ETH_FOREACH_DEV_OWNED_BY(p, o) \
+       for (p = rte_eth_find_next_owned_by(0, o); \
+            (unsigned int)p < (unsigned int)RTE_MAX_ETHPORTS; \
+            p = rte_eth_find_next_owned_by(p + 1, o))
+
 /**
  * Iterates over valid ethdev ports.
  *
@@ -1239,12 +1268,85 @@ struct rte_eth_dev_sriov {
 uint16_t rte_eth_find_next(uint16_t port_id);
 
 /**
- * Macro to iterate over all enabled ethdev ports.
+ * Macro to iterate over all enabled and ownerless ethdev ports.
+ */
+#define RTE_ETH_FOREACH_DEV(p) \
+       RTE_ETH_FOREACH_DEV_OWNED_BY(p, RTE_ETH_DEV_NO_OWNER)
+
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Get a new unique owner identifier.
+ * An owner identifier is used to owns Ethernet devices by only one DPDK entity
+ * to avoid multiple management of device by different entities.
+ *
+ * @param      owner_id
+ *   Owner identifier pointer.
+ * @return
+ *   Negative errno value on error, 0 on success.
+ */
+int __rte_experimental rte_eth_dev_owner_new(uint64_t *owner_id);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Set an Ethernet device owner.
+ *
+ * @param      port_id
+ *  The identifier of the port to own.
+ * @param      owner
+ *  The owner pointer.
+ * @return
+ *  Negative errno value on error, 0 on success.
+ */
+int __rte_experimental rte_eth_dev_owner_set(const uint16_t port_id,
+               const struct rte_eth_dev_owner *owner);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Unset Ethernet device owner to make the device ownerless.
+ *
+ * @param      port_id
+ *  The identifier of port to make ownerless.
+ * @param      owner_id
+ *  The owner identifier.
+ * @return
+ *  0 on success, negative errno value on error.
+ */
+int __rte_experimental rte_eth_dev_owner_unset(const uint16_t port_id,
+               const uint64_t owner_id);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Remove owner from all Ethernet devices owned by a specific owner.
+ *
+ * @param      owner_id
+ *  The owner identifier.
+ */
+void __rte_experimental rte_eth_dev_owner_delete(const uint64_t owner_id);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Get the owner of an Ethernet device.
+ *
+ * @param      port_id
+ *  The port identifier.
+ * @param      owner
+ *  The owner structure pointer to fill.
+ * @return
+ *  0 on success, negative errno value on error..
  */
-#define RTE_ETH_FOREACH_DEV(p)                                 \
-       for (p = rte_eth_find_next(0);                          \
-            (unsigned int)p < (unsigned int)RTE_MAX_ETHPORTS;  \
-            p = rte_eth_find_next(p + 1))
+int __rte_experimental rte_eth_dev_owner_get(const uint16_t port_id,
+               struct rte_eth_dev_owner *owner);
 
 /**
  * Get the total number of Ethernet devices that have been successfully
@@ -1313,7 +1415,7 @@ uint32_t rte_eth_speed_bitflag(uint32_t speed, int duplex);
  * @return
  *   Offload name or 'UNKNOWN' if the flag cannot be recognised.
  */
-const char *rte_eth_dev_rx_offload_name(uint64_t offload);
+const char * __rte_experimental rte_eth_dev_rx_offload_name(uint64_t offload);
 
 /**
  * @warning
@@ -1326,7 +1428,7 @@ const char *rte_eth_dev_rx_offload_name(uint64_t offload);
  * @return
  *   Offload name or 'UNKNOWN' if the flag cannot be recognised.
  */
-const char *rte_eth_dev_tx_offload_name(uint64_t offload);
+const char * __rte_experimental rte_eth_dev_tx_offload_name(uint64_t offload);
 
 /**
  * Configure an Ethernet device.
@@ -1374,7 +1476,7 @@ int rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_queue,
  * @return
  *   1 when the Ethernet device is removed, otherwise 0.
  */
-int
+int __rte_experimental
 rte_eth_dev_is_removed(uint16_t port_id);
 
 /**
@@ -2571,7 +2673,7 @@ int rte_eth_dev_priority_flow_ctrl_set(uint16_t port_id,
  * Add a MAC address to an internal array of addresses used to enable whitelist
  * filtering to accept packets only if the destination MAC address matches.
  *
- * @param port
+ * @param port_id
  *   The port identifier of the Ethernet device.
  * @param mac_addr
  *   The MAC address to add.
@@ -2579,20 +2681,20 @@ int rte_eth_dev_priority_flow_ctrl_set(uint16_t port_id,
  *   VMDq pool index to associate address with (if VMDq is enabled). If VMDq is
  *   not enabled, this should be set to 0.
  * @return
- *   - (0) if successfully added or *mac_addr" was already added.
+ *   - (0) if successfully added or *mac_addr* was already added.
  *   - (-ENOTSUP) if hardware doesn't support this feature.
  *   - (-ENODEV) if *port* is invalid.
  *   - (-EIO) if device is removed.
  *   - (-ENOSPC) if no more MAC addresses can be added.
  *   - (-EINVAL) if MAC address is invalid.
  */
-int rte_eth_dev_mac_addr_add(uint16_t port, struct ether_addr *mac_addr,
+int rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *mac_addr,
                                uint32_t pool);
 
 /**
  * Remove a MAC address from the internal array of addresses.
  *
- * @param port
+ * @param port_id
  *   The port identifier of the Ethernet device.
  * @param mac_addr
  *   MAC address to remove.
@@ -2602,12 +2704,12 @@ int rte_eth_dev_mac_addr_add(uint16_t port, struct ether_addr *mac_addr,
  *   - (-ENODEV) if *port* invalid.
  *   - (-EADDRINUSE) if attempting to remove the default MAC address
  */
-int rte_eth_dev_mac_addr_remove(uint16_t port, struct ether_addr *mac_addr);
+int rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *mac_addr);
 
 /**
  * Set the default MAC address.
  *
- * @param port
+ * @param port_id
  *   The port identifier of the Ethernet device.
  * @param mac_addr
  *   New default MAC address.
@@ -2617,13 +2719,13 @@ int rte_eth_dev_mac_addr_remove(uint16_t port, struct ether_addr *mac_addr);
  *   - (-ENODEV) if *port* invalid.
  *   - (-EINVAL) if MAC address is invalid.
  */
-int rte_eth_dev_default_mac_addr_set(uint16_t port,
+int rte_eth_dev_default_mac_addr_set(uint16_t port_id,
                struct ether_addr *mac_addr);
 
 /**
  * Update Redirection Table(RETA) of Receive Side Scaling of Ethernet device.
  *
- * @param port
+ * @param port_id
  *   The port identifier of the Ethernet device.
  * @param reta_conf
  *   RETA to update.
@@ -2636,14 +2738,14 @@ int rte_eth_dev_default_mac_addr_set(uint16_t port,
  *   - (-EINVAL) if bad parameter.
  *   - (-EIO) if device is removed.
  */
-int rte_eth_dev_rss_reta_update(uint16_t port,
+int rte_eth_dev_rss_reta_update(uint16_t port_id,
                                struct rte_eth_rss_reta_entry64 *reta_conf,
                                uint16_t reta_size);
 
  /**
  * Query Redirection Table(RETA) of Receive Side Scaling of Ethernet device.
  *
- * @param port
+ * @param port_id
  *   The port identifier of the Ethernet device.
  * @param reta_conf
  *   RETA to query.
@@ -2656,7 +2758,7 @@ int rte_eth_dev_rss_reta_update(uint16_t port,
  *   - (-EINVAL) if bad parameter.
  *   - (-EIO) if device is removed.
  */
-int rte_eth_dev_rss_reta_query(uint16_t port,
+int rte_eth_dev_rss_reta_query(uint16_t port_id,
                               struct rte_eth_rss_reta_entry64 *reta_conf,
                               uint16_t reta_size);
 
@@ -2665,7 +2767,7 @@ int rte_eth_dev_rss_reta_query(uint16_t port,
  * MAC address, and the packet is routed to all VFs for which the RX mode is
  * accept packets that match the unicast hash table.
  *
- * @param port
+ * @param port_id
  *   The port identifier of the Ethernet device.
  * @param addr
  *   Unicast MAC address.
@@ -2679,7 +2781,7 @@ int rte_eth_dev_rss_reta_query(uint16_t port,
  *   - (-EIO) if device is removed.
  *   - (-EINVAL) if bad parameter.
  */
-int rte_eth_dev_uc_hash_table_set(uint16_t port, struct ether_addr *addr,
+int rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct ether_addr *addr,
                                  uint8_t on);
 
  /**
@@ -2687,7 +2789,7 @@ int rte_eth_dev_uc_hash_table_set(uint16_t port, struct ether_addr *addr,
  * Ethernet MAC addresses,the packet is routed to all VFs for which the RX
  * mode is accept packets that match the unicast hash table.
  *
- * @param port
+ * @param port_id
  *   The port identifier of the Ethernet device.
  * @param on
  *    1 - Set all unicast hash bitmaps for receiving all the Ethernet
@@ -2700,7 +2802,7 @@ int rte_eth_dev_uc_hash_table_set(uint16_t port, struct ether_addr *addr,
  *   - (-EIO) if device is removed.
  *   - (-EINVAL) if bad parameter.
  */
-int rte_eth_dev_uc_all_hash_table_set(uint16_t port, uint8_t on);
+int rte_eth_dev_uc_all_hash_table_set(uint16_t port_id, uint8_t on);
 
 /**
  * Set a traffic mirroring rule on an Ethernet device
@@ -2900,6 +3002,8 @@ int rte_eth_dev_filter_ctrl(uint16_t port_id, enum rte_filter_type filter_type,
 int rte_eth_dev_get_dcb_info(uint16_t port_id,
                             struct rte_eth_dcb_info *dcb_info);
 
+struct rte_eth_rxtx_callback;
+
 /**
  * Add a callback to be called on packet RX on a given port and queue.
  *
@@ -2924,7 +3028,8 @@ int rte_eth_dev_get_dcb_info(uint16_t port_id,
  *   NULL on error.
  *   On success, a pointer value which can later be used to remove the callback.
  */
-void *rte_eth_add_rx_callback(uint16_t port_id, uint16_t queue_id,
+const struct rte_eth_rxtx_callback *
+rte_eth_add_rx_callback(uint16_t port_id, uint16_t queue_id,
                rte_rx_callback_fn fn, void *user_param);
 
 /**
@@ -2952,7 +3057,8 @@ void *rte_eth_add_rx_callback(uint16_t port_id, uint16_t queue_id,
  *   NULL on error.
  *   On success, a pointer value which can later be used to remove the callback.
  */
-void *rte_eth_add_first_rx_callback(uint16_t port_id, uint16_t queue_id,
+const struct rte_eth_rxtx_callback *
+rte_eth_add_first_rx_callback(uint16_t port_id, uint16_t queue_id,
                rte_rx_callback_fn fn, void *user_param);
 
 /**
@@ -2979,11 +3085,10 @@ void *rte_eth_add_first_rx_callback(uint16_t port_id, uint16_t queue_id,
  *   NULL on error.
  *   On success, a pointer value which can later be used to remove the callback.
  */
-void *rte_eth_add_tx_callback(uint16_t port_id, uint16_t queue_id,
+const struct rte_eth_rxtx_callback *
+rte_eth_add_tx_callback(uint16_t port_id, uint16_t queue_id,
                rte_tx_callback_fn fn, void *user_param);
 
-struct rte_eth_rxtx_callback;
-
 /**
  * Remove an RX packet callback from a given port and queue.
  *
@@ -3015,7 +3120,7 @@ struct rte_eth_rxtx_callback;
  *               is NULL or not found for the port/queue.
  */
 int rte_eth_remove_rx_callback(uint16_t port_id, uint16_t queue_id,
-               struct rte_eth_rxtx_callback *user_cb);
+               const struct rte_eth_rxtx_callback *user_cb);
 
 /**
  * Remove a TX packet callback from a given port and queue.
@@ -3048,7 +3153,7 @@ int rte_eth_remove_rx_callback(uint16_t port_id, uint16_t queue_id,
  *               is NULL or not found for the port/queue.
  */
 int rte_eth_remove_tx_callback(uint16_t port_id, uint16_t queue_id,
-               struct rte_eth_rxtx_callback *user_cb);
+               const struct rte_eth_rxtx_callback *user_cb);
 
 /**
  * Retrieve information about given port's RX queue.
@@ -3426,7 +3531,7 @@ rte_eth_dev_pool_ops_supported(uint16_t port_id, const char *pool);
  *   - pointer to security context on success.
  */
 void *
-rte_eth_dev_get_sec_ctx(uint8_t port_id);
+rte_eth_dev_get_sec_ctx(uint16_t port_id);
 
 
 #include <rte_ethdev_core.h>