ethdev: fix RSS update when RSS is disabled
[dpdk.git] / lib / ethdev / rte_ethdev.h
index 147cc1c..04cff8e 100644 (file)
@@ -651,6 +651,8 @@ struct rte_eth_rss_conf {
 #define RTE_ETH_RSS_L4_CHKSUM          RTE_BIT64(35)
 #define ETH_RSS_L4_CHKSUM RTE_DEPRECATED(ETH_RSS_L4_CHKSUM) RTE_ETH_RSS_L4_CHKSUM
 
+#define RTE_ETH_RSS_L2TPV2             RTE_BIT64(36)
+
 /*
  * We use the following macros to combine with above RTE_ETH_RSS_* for
  * more specific input set selection. These bits are defined starting
@@ -1408,6 +1410,59 @@ struct rte_eth_pfc_conf {
        uint8_t priority;          /**< VLAN User Priority. */
 };
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ * A structure used to retrieve information of queue based PFC.
+ */
+struct rte_eth_pfc_queue_info {
+       /**
+        * Maximum supported traffic class as per PFC (802.1Qbb) specification.
+        */
+       uint8_t tc_max;
+       /** PFC queue mode capabilities. */
+       enum rte_eth_fc_mode mode_capa;
+};
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ * A structure used to configure Ethernet priority flow control parameters for
+ * ethdev queues.
+ *
+ * rte_eth_pfc_queue_conf::rx_pause structure shall be used to configure given
+ * tx_qid with corresponding tc. When ethdev device receives PFC frame with
+ * rte_eth_pfc_queue_conf::rx_pause::tc, traffic will be paused on
+ * rte_eth_pfc_queue_conf::rx_pause::tx_qid for that tc.
+ *
+ * rte_eth_pfc_queue_conf::tx_pause structure shall be used to configure given
+ * rx_qid. When rx_qid is congested, PFC frames are generated with
+ * rte_eth_pfc_queue_conf::rx_pause::tc and
+ * rte_eth_pfc_queue_conf::rx_pause::pause_time to the peer.
+ */
+struct rte_eth_pfc_queue_conf {
+       enum rte_eth_fc_mode mode; /**< Link flow control mode */
+
+       struct {
+               uint16_t tx_qid; /**< Tx queue ID */
+               /** Traffic class as per PFC (802.1Qbb) spec. The value must be
+                * in the range [0, rte_eth_pfc_queue_info::tx_max - 1]
+                */
+               uint8_t tc;
+       } rx_pause; /* Valid when (mode == FC_RX_PAUSE || mode == FC_FULL) */
+
+       struct {
+               uint16_t pause_time; /**< Pause quota in the Pause frame */
+               uint16_t rx_qid;     /**< Rx queue ID */
+               /** Traffic class as per PFC (802.1Qbb) spec. The value must be
+                * in the range [0, rte_eth_pfc_queue_info::tx_max - 1]
+                */
+               uint8_t tc;
+       } tx_pause; /* Valid when (mode == FC_TX_PAUSE || mode == FC_FULL) */
+};
+
 /**
  * Tunnel type for device-specific classifier configuration.
  * @see rte_eth_udp_tunnel
@@ -1800,7 +1855,7 @@ enum rte_eth_representor_type {
  * device, etc...
  */
 struct rte_eth_dev_info {
-       struct rte_device *device; /** Generic device information */
+       struct rte_device *device; /**< Generic device information */
        const char *driver_name; /**< Device Driver name. */
        unsigned int if_index; /**< Index to bound host interface, or 0 if none.
                Use if_indextoname() to translate into an interface name. */
@@ -1814,8 +1869,8 @@ struct rte_eth_dev_info {
        uint16_t max_rx_queues; /**< Maximum number of Rx queues. */
        uint16_t max_tx_queues; /**< Maximum number of Tx queues. */
        uint32_t max_mac_addrs; /**< Maximum number of MAC addresses. */
-       uint32_t max_hash_mac_addrs;
        /** Maximum number of hash MAC addresses for MTA and UTA. */
+       uint32_t max_hash_mac_addrs;
        uint16_t max_vfs; /**< Maximum number of VFs. */
        uint16_t max_vmdq_pools; /**< Maximum number of VMDq pools. */
        struct rte_eth_rxseg_capa rx_seg_capa; /**< Segmentation capability.*/
@@ -4158,6 +4213,54 @@ int rte_eth_dev_priority_flow_ctrl_set(uint16_t port_id,
 int rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *mac_addr,
                                uint32_t pool);
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Retrieve the information for queue based PFC.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param pfc_queue_info
+ *   A pointer to a structure of type *rte_eth_pfc_queue_info* to be filled with
+ *   the information about queue based PFC.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if support for priority_flow_ctrl_queue_info_get does not exist.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+__rte_experimental
+int rte_eth_dev_priority_flow_ctrl_queue_info_get(uint16_t port_id,
+               struct rte_eth_pfc_queue_info *pfc_queue_info);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Configure the queue based priority flow control for a given queue
+ * for Ethernet device.
+ *
+ * @note When an ethdev port switches to queue based PFC mode, the
+ * unconfigured queues shall be configured by the driver with
+ * default values such as lower priority value for TC etc.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param pfc_queue_conf
+ *   The pointer to the structure of the priority flow control parameters
+ *   for the queue.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if hardware doesn't support queue based PFC mode.
+ *   - (-ENODEV)  if *port_id* invalid.
+ *   - (-EINVAL)  if bad parameter
+ *   - (-EIO)     if flow control setup queue failure
+ */
+__rte_experimental
+int rte_eth_dev_priority_flow_ctrl_queue_configure(uint16_t port_id,
+               struct rte_eth_pfc_queue_conf *pfc_queue_conf);
+
 /**
  * Remove a MAC address from the internal array of addresses.
  *
@@ -5202,6 +5305,153 @@ int rte_eth_representor_info_get(uint16_t port_id,
 __rte_experimental
 int rte_eth_rx_metadata_negotiate(uint16_t port_id, uint64_t *features);
 
+/** Flag to offload IP reassembly for IPv4 packets. */
+#define RTE_ETH_DEV_REASSEMBLY_F_IPV4 (RTE_BIT32(0))
+/** Flag to offload IP reassembly for IPv6 packets. */
+#define RTE_ETH_DEV_REASSEMBLY_F_IPV6 (RTE_BIT32(1))
+
+/**
+ * A structure used to get/set IP reassembly configuration. It is also used
+ * to get the maximum capability values that a PMD can support.
+ *
+ * If rte_eth_ip_reassembly_capability_get() returns 0, IP reassembly can be
+ * enabled using rte_eth_ip_reassembly_conf_set() and params values lower than
+ * capability params can be set in the PMD.
+ */
+struct rte_eth_ip_reassembly_params {
+       /** Maximum time in ms which PMD can wait for other fragments. */
+       uint32_t timeout_ms;
+       /** Maximum number of fragments that can be reassembled. */
+       uint16_t max_frags;
+       /**
+        * Flags to enable reassembly of packet types -
+        * RTE_ETH_DEV_REASSEMBLY_F_xxx.
+        */
+       uint16_t flags;
+};
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Get IP reassembly capabilities supported by the PMD. This is the first API
+ * to be called for enabling the IP reassembly offload feature. PMD will return
+ * the maximum values of parameters that PMD can support and user can call
+ * rte_eth_ip_reassembly_conf_set() with param values lower than capability.
+ *
+ * @param port_id
+ *   The port identifier of the device.
+ * @param capa
+ *   A pointer to rte_eth_ip_reassembly_params structure.
+ * @return
+ *   - (-ENOTSUP) if offload configuration is not supported by device.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - (-EIO) if device is removed.
+ *   - (-EINVAL) if device is not configured or *capa* passed is NULL.
+ *   - (0) on success.
+ */
+__rte_experimental
+int rte_eth_ip_reassembly_capability_get(uint16_t port_id,
+               struct rte_eth_ip_reassembly_params *capa);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Get IP reassembly configuration parameters currently set in PMD.
+ * The API will return error if the configuration is not already
+ * set using rte_eth_ip_reassembly_conf_set() before calling this API or if
+ * the device is not configured.
+ *
+ * @param port_id
+ *   The port identifier of the device.
+ * @param conf
+ *   A pointer to rte_eth_ip_reassembly_params structure.
+ * @return
+ *   - (-ENOTSUP) if offload configuration is not supported by device.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - (-EIO) if device is removed.
+ *   - (-EINVAL) if device is not configured or if *conf* passed is NULL or if
+ *              configuration is not set using rte_eth_ip_reassembly_conf_set().
+ *   - (0) on success.
+ */
+__rte_experimental
+int rte_eth_ip_reassembly_conf_get(uint16_t port_id,
+               struct rte_eth_ip_reassembly_params *conf);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Set IP reassembly configuration parameters if the PMD supports IP reassembly
+ * offload. User should first call rte_eth_ip_reassembly_capability_get() to
+ * check the maximum values supported by the PMD before setting the
+ * configuration. The use of this API is mandatory to enable this feature and
+ * should be called before rte_eth_dev_start().
+ *
+ * In datapath, PMD cannot guarantee that IP reassembly is always successful.
+ * Hence, PMD shall register mbuf dynamic field and dynamic flag using
+ * rte_eth_ip_reassembly_dynfield_register() to denote incomplete IP reassembly.
+ * If dynfield is not successfully registered, error will be returned and
+ * IP reassembly offload cannot be used.
+ *
+ * @param port_id
+ *   The port identifier of the device.
+ * @param conf
+ *   A pointer to rte_eth_ip_reassembly_params structure.
+ * @return
+ *   - (-ENOTSUP) if offload configuration is not supported by device.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - (-EIO) if device is removed.
+ *   - (-EINVAL) if device is not configured or if device is already started or
+ *               if *conf* passed is NULL or if mbuf dynfield is not registered
+ *               successfully by the PMD.
+ *   - (0) on success.
+ */
+__rte_experimental
+int rte_eth_ip_reassembly_conf_set(uint16_t port_id,
+               const struct rte_eth_ip_reassembly_params *conf);
+
+/**
+ * In case of IP reassembly offload failure, packet will be updated with
+ * dynamic flag - RTE_MBUF_DYNFLAG_IP_REASSEMBLY_INCOMPLETE_NAME and packets
+ * will be returned without alteration.
+ * The application can retrieve the attached fragments using mbuf dynamic field
+ * RTE_MBUF_DYNFIELD_IP_REASSEMBLY_NAME.
+ */
+typedef struct {
+       /**
+        * Next fragment packet. Application should fetch dynamic field of
+        * each fragment until a NULL is received and nb_frags is 0.
+        */
+       struct rte_mbuf *next_frag;
+       /** Time spent(in ms) by HW in waiting for further fragments. */
+       uint16_t time_spent;
+       /** Number of more fragments attached in mbuf dynamic fields. */
+       uint16_t nb_frags;
+} rte_eth_ip_reassembly_dynfield_t;
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ * Dump private info from device to a file. Provided data and the order depends
+ * on the PMD.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param file
+ *   A pointer to a file for output.
+ * @return
+ *   - (0) on success.
+ *   - (-ENODEV) if *port_id* is invalid.
+ *   - (-EINVAL) if null file.
+ *   - (-ENOTSUP) if the device does not support this function.
+ *   - (-EIO) if device is removed.
+ */
+__rte_experimental
+int rte_eth_dev_priv_dump(uint16_t port_id, FILE *file);
+
 #include <rte_ethdev_core.h>
 
 /**