ethdev: move inline device operations
[dpdk.git] / lib / librte_ethdev / rte_ethdev.h
index d1a593a..b6f26a5 100644 (file)
@@ -158,6 +158,7 @@ extern "C" {
 #include <rte_config.h>
 #include <rte_ether.h>
 
+#include "rte_ethdev_trace_fp.h"
 #include "rte_dev_info.h"
 
 extern int rte_eth_dev_logtype;
@@ -283,6 +284,7 @@ struct rte_eth_stats {
 #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 */
 
 /**
  * Ethernet numeric link speeds in Mbps
@@ -300,6 +302,8 @@ struct rte_eth_stats {
 #define ETH_SPEED_NUM_50G      50000 /**<  50 Gbps */
 #define ETH_SPEED_NUM_56G      56000 /**<  56 Gbps */
 #define ETH_SPEED_NUM_100G    100000 /**< 100 Gbps */
+#define ETH_SPEED_NUM_200G    200000 /**< 200 Gbps */
+#define ETH_SPEED_NUM_UNKNOWN UINT32_MAX /**< Unknown */
 
 /**
  * A structure used to retrieve link-level information of an Ethernet port.
@@ -310,7 +314,7 @@ struct rte_eth_link {
        uint16_t link_duplex  : 1;  /**< ETH_LINK_[HALF/FULL]_DUPLEX */
        uint16_t link_autoneg : 1;  /**< ETH_LINK_[AUTONEG/FIXED] */
        uint16_t link_status  : 1;  /**< ETH_LINK_[DOWN/UP] */
-} __attribute__((aligned(8)));      /**< aligned for atomic64 read/write */
+} __rte_aligned(8);      /**< aligned for atomic64 read/write */
 
 /* Utility constants */
 #define ETH_LINK_HALF_DUPLEX 0 /**< Half-duplex connection (see link_duplex). */
@@ -511,6 +515,14 @@ struct rte_eth_rss_conf {
 #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)
 
 /*
  * We use the following macros to combine with above ETH_RSS_* for
@@ -525,6 +537,21 @@ struct rte_eth_rss_conf {
 #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)
+
+/*
+ * Only select IPV6 address prefix as RSS input set according to
+ * https://tools.ietf.org/html/rfc6052
+ * 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)
 
 /**
  * For input set change of hash filter, if SRC_ONLY and DST_ONLY of
@@ -548,6 +575,102 @@ rte_eth_rss_hf_refine(uint64_t rss_hf)
        return rss_hf;
 }
 
+#define ETH_RSS_IPV6_PRE32 ( \
+               ETH_RSS_IPV6 | \
+               RTE_ETH_RSS_L3_PRE32)
+
+#define ETH_RSS_IPV6_PRE40 ( \
+               ETH_RSS_IPV6 | \
+               RTE_ETH_RSS_L3_PRE40)
+
+#define ETH_RSS_IPV6_PRE48 ( \
+               ETH_RSS_IPV6 | \
+               RTE_ETH_RSS_L3_PRE48)
+
+#define ETH_RSS_IPV6_PRE56 ( \
+               ETH_RSS_IPV6 | \
+               RTE_ETH_RSS_L3_PRE56)
+
+#define ETH_RSS_IPV6_PRE64 ( \
+               ETH_RSS_IPV6 | \
+               RTE_ETH_RSS_L3_PRE64)
+
+#define ETH_RSS_IPV6_PRE96 ( \
+               ETH_RSS_IPV6 | \
+               RTE_ETH_RSS_L3_PRE96)
+
+#define ETH_RSS_IPV6_PRE32_UDP ( \
+               ETH_RSS_NONFRAG_IPV6_UDP | \
+               RTE_ETH_RSS_L3_PRE32)
+
+#define ETH_RSS_IPV6_PRE40_UDP ( \
+               ETH_RSS_NONFRAG_IPV6_UDP | \
+               RTE_ETH_RSS_L3_PRE40)
+
+#define ETH_RSS_IPV6_PRE48_UDP ( \
+               ETH_RSS_NONFRAG_IPV6_UDP | \
+               RTE_ETH_RSS_L3_PRE48)
+
+#define ETH_RSS_IPV6_PRE56_UDP ( \
+               ETH_RSS_NONFRAG_IPV6_UDP | \
+               RTE_ETH_RSS_L3_PRE56)
+
+#define ETH_RSS_IPV6_PRE64_UDP ( \
+               ETH_RSS_NONFRAG_IPV6_UDP | \
+               RTE_ETH_RSS_L3_PRE64)
+
+#define ETH_RSS_IPV6_PRE96_UDP ( \
+               ETH_RSS_NONFRAG_IPV6_UDP | \
+               RTE_ETH_RSS_L3_PRE96)
+
+#define ETH_RSS_IPV6_PRE32_TCP ( \
+               ETH_RSS_NONFRAG_IPV6_TCP | \
+               RTE_ETH_RSS_L3_PRE32)
+
+#define ETH_RSS_IPV6_PRE40_TCP ( \
+               ETH_RSS_NONFRAG_IPV6_TCP | \
+               RTE_ETH_RSS_L3_PRE40)
+
+#define ETH_RSS_IPV6_PRE48_TCP ( \
+               ETH_RSS_NONFRAG_IPV6_TCP | \
+               RTE_ETH_RSS_L3_PRE48)
+
+#define ETH_RSS_IPV6_PRE56_TCP ( \
+               ETH_RSS_NONFRAG_IPV6_TCP | \
+               RTE_ETH_RSS_L3_PRE56)
+
+#define ETH_RSS_IPV6_PRE64_TCP ( \
+               ETH_RSS_NONFRAG_IPV6_TCP | \
+               RTE_ETH_RSS_L3_PRE64)
+
+#define ETH_RSS_IPV6_PRE96_TCP ( \
+               ETH_RSS_NONFRAG_IPV6_TCP | \
+               RTE_ETH_RSS_L3_PRE96)
+
+#define ETH_RSS_IPV6_PRE32_SCTP ( \
+               ETH_RSS_NONFRAG_IPV6_SCTP | \
+               RTE_ETH_RSS_L3_PRE32)
+
+#define ETH_RSS_IPV6_PRE40_SCTP ( \
+               ETH_RSS_NONFRAG_IPV6_SCTP | \
+               RTE_ETH_RSS_L3_PRE40)
+
+#define ETH_RSS_IPV6_PRE48_SCTP ( \
+               ETH_RSS_NONFRAG_IPV6_SCTP | \
+               RTE_ETH_RSS_L3_PRE48)
+
+#define ETH_RSS_IPV6_PRE56_SCTP ( \
+               ETH_RSS_NONFRAG_IPV6_SCTP | \
+               RTE_ETH_RSS_L3_PRE56)
+
+#define ETH_RSS_IPV6_PRE64_SCTP ( \
+               ETH_RSS_NONFRAG_IPV6_SCTP | \
+               RTE_ETH_RSS_L3_PRE64)
+
+#define ETH_RSS_IPV6_PRE96_SCTP ( \
+               ETH_RSS_NONFRAG_IPV6_SCTP | \
+               RTE_ETH_RSS_L3_PRE96)
+
 #define ETH_RSS_IP ( \
        ETH_RSS_IPV4 | \
        ETH_RSS_FRAG_IPV4 | \
@@ -576,6 +699,10 @@ rte_eth_rss_hf_refine(uint64_t rss_hf)
        ETH_RSS_GENEVE | \
        ETH_RSS_NVGRE)
 
+#define ETH_RSS_VLAN ( \
+       ETH_RSS_S_VLAN  | \
+       ETH_RSS_C_VLAN)
+
 /**< Mask of valid RSS hash protocols */
 #define ETH_RSS_PROTO_MASK ( \
        ETH_RSS_IPV4 | \
@@ -798,7 +925,6 @@ struct rte_eth_txmode {
         */
        uint64_t offloads;
 
-       /* For i40e specifically */
        uint16_t pvid;
        __extension__
        uint8_t hw_vlan_reject_tagged : 1,
@@ -1161,6 +1287,10 @@ struct rte_eth_conf {
 /** Device supports outer UDP checksum */
 #define DEV_TX_OFFLOAD_OUTER_UDP_CKSUM  0x00100000
 
+/** Device supports send on timestamp */
+#define DEV_TX_OFFLOAD_SEND_ON_TIMESTAMP 0x00200000
+
+
 #define RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP 0x00000001
 /**< Device supports Rx queue setup after device started*/
 #define RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP 0x00000002
@@ -2245,15 +2375,16 @@ int rte_eth_allmulticast_disable(uint16_t port_id);
 int rte_eth_allmulticast_get(uint16_t port_id);
 
 /**
- * Retrieve the status (ON/OFF), the speed (in Mbps) and the mode (HALF-DUPLEX
- * or FULL-DUPLEX) of the physical link of an Ethernet device. It might need
- * to wait up to 9 seconds in it.
+ * Retrieve the link status (up/down), the duplex mode (half/full),
+ * the negotiation (auto/fixed), and if available, the speed (Mbps).
+ *
+ * It might need to wait up to 9 seconds.
+ * @see rte_eth_link_get_nowait.
  *
  * @param port_id
  *   The port identifier of the Ethernet device.
  * @param link
- *   A pointer to an *rte_eth_link* structure to be filled with
- *   the status, the speed and the mode of the Ethernet device link.
+ *   Link information written back.
  * @return
  *   - (0) if successful.
  *   - (-ENOTSUP) if the function is not supported in PMD driver.
@@ -2262,15 +2393,13 @@ int rte_eth_allmulticast_get(uint16_t port_id);
 int rte_eth_link_get(uint16_t port_id, struct rte_eth_link *link);
 
 /**
- * Retrieve the status (ON/OFF), the speed (in Mbps) and the mode (HALF-DUPLEX
- * or FULL-DUPLEX) of the physical link of an Ethernet device. It is a no-wait
- * version of rte_eth_link_get().
+ * Retrieve the link status (up/down), the duplex mode (half/full),
+ * the negotiation (auto/fixed), and if available, the speed (Mbps).
  *
  * @param port_id
  *   The port identifier of the Ethernet device.
  * @param link
- *   A pointer to an *rte_eth_link* structure to be filled with
- *   the status, the speed and the mode of the Ethernet device link.
+ *   Link information written back.
  * @return
  *   - (0) if successful.
  *   - (-ENOTSUP) if the function is not supported in PMD driver.
@@ -2716,7 +2845,6 @@ int rte_eth_dev_vlan_filter(uint16_t port_id, uint16_t vlan_id, int on);
 
 /**
  * Enable/Disable hardware VLAN Strip by a rx queue of an Ethernet device.
- * 82599/X540/X550 can support VLAN stripping at the rx queue level
  *
  * @param port_id
  *   The port identifier of the Ethernet device.
@@ -2738,8 +2866,7 @@ int rte_eth_dev_set_vlan_strip_on_queue(uint16_t port_id, uint16_t rx_queue_id,
 
 /**
  * Set the Outer VLAN Ether Type by an Ethernet device, it can be inserted to
- * the VLAN Header. This is a register setup available on some Intel NIC, not
- * but all, please check the data sheet for availability.
+ * the VLAN header.
  *
  * @param port_id
  *   The port identifier of the Ethernet device.
@@ -2758,12 +2885,7 @@ int rte_eth_dev_set_vlan_ether_type(uint16_t port_id,
                                    uint16_t tag_type);
 
 /**
- * Set VLAN offload configuration on an Ethernet device
- * Enable/Disable Extended VLAN by an Ethernet device, This is a register setup
- * available on some Intel NIC, not but all, please check the data sheet for
- * availability.
- * Enable/Disable VLAN Strip can be done on rx queue for certain NIC, but here
- * the configuration is applied on the port level.
+ * Set VLAN offload configuration on an Ethernet device.
  *
  * @param port_id
  *   The port identifier of the Ethernet device.
@@ -3015,6 +3137,7 @@ enum rte_eth_event_type {
        RTE_ETH_EVENT_NEW,      /**< port is probed */
        RTE_ETH_EVENT_DESTROY,  /**< port is released */
        RTE_ETH_EVENT_IPSEC,    /**< IPsec offload related event */
+       RTE_ETH_EVENT_FLOW_AGED,/**< New aged-out flows is detected */
        RTE_ETH_EVENT_MAX       /**< max value of this enum */
 };
 
@@ -3256,8 +3379,7 @@ int rte_eth_dev_priority_flow_ctrl_set(uint16_t port_id,
                                struct rte_eth_pfc_conf *pfc_conf);
 
 /**
- * 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.
+ * Add a MAC address to the set used for filtering incoming packets.
  *
  * @param port_id
  *   The port identifier of the Ethernet device.
@@ -4400,6 +4522,7 @@ rte_eth_rx_burst(uint16_t port_id, uint16_t queue_id,
        }
 #endif
 
+       rte_ethdev_trace_rx_burst(port_id, queue_id, (void **)rx_pkts, nb_rx);
        return nb_rx;
 }
 
@@ -4422,11 +4545,11 @@ rte_eth_rx_queue_count(uint16_t port_id, uint16_t queue_id)
 
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
        dev = &rte_eth_devices[port_id];
-       RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, -ENOTSUP);
+       RTE_FUNC_PTR_OR_ERR_RET(*dev->rx_queue_count, -ENOTSUP);
        if (queue_id >= dev->data->nb_rx_queues)
                return -EINVAL;
 
-       return (int)(*dev->dev_ops->rx_queue_count)(dev, queue_id);
+       return (int)(*dev->rx_queue_count)(dev, queue_id);
 }
 
 /**
@@ -4444,14 +4567,14 @@ rte_eth_rx_queue_count(uint16_t port_id, uint16_t queue_id)
  *  - (-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->dev_ops->rx_descriptor_done, -ENOTSUP);
-       return (*dev->dev_ops->rx_descriptor_done)( \
-               dev->data->rx_queues[queue_id], offset);
+       RTE_FUNC_PTR_OR_ERR_RET(*dev->rx_descriptor_done, -ENOTSUP);
+       return (*dev->rx_descriptor_done)(dev->data->rx_queues[queue_id], offset);
 }
 
 #define RTE_ETH_RX_DESC_AVAIL    0 /**< Desc available for hw. */
@@ -4506,10 +4629,10 @@ rte_eth_rx_descriptor_status(uint16_t port_id, uint16_t queue_id,
        if (queue_id >= dev->data->nb_rx_queues)
                return -ENODEV;
 #endif
-       RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_status, -ENOTSUP);
+       RTE_FUNC_PTR_OR_ERR_RET(*dev->rx_descriptor_status, -ENOTSUP);
        rxq = dev->data->rx_queues[queue_id];
 
-       return (*dev->dev_ops->rx_descriptor_status)(rxq, offset);
+       return (*dev->rx_descriptor_status)(rxq, offset);
 }
 
 #define RTE_ETH_TX_DESC_FULL    0 /**< Desc filled for hw, waiting xmit. */
@@ -4563,10 +4686,10 @@ static inline int rte_eth_tx_descriptor_status(uint16_t port_id,
        if (queue_id >= dev->data->nb_tx_queues)
                return -ENODEV;
 #endif
-       RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_descriptor_status, -ENOTSUP);
+       RTE_FUNC_PTR_OR_ERR_RET(*dev->tx_descriptor_status, -ENOTSUP);
        txq = dev->data->tx_queues[queue_id];
 
-       return (*dev->dev_ops->tx_descriptor_status)(txq, offset);
+       return (*dev->tx_descriptor_status)(txq, offset);
 }
 
 /**
@@ -4663,6 +4786,8 @@ rte_eth_tx_burst(uint16_t port_id, uint16_t queue_id,
        }
 #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);
 }