ethdev: introduce shared Rx queue
[dpdk.git] / lib / ethdev / rte_ethdev.h
index 497217f..8c1b5e0 100644 (file)
@@ -83,7 +83,7 @@
  *     - MTU
  *     - flow control settings
  *     - receive mode configuration (promiscuous mode, all-multicast mode,
- *       hardware checksum mode, RSS/VMDQ settings etc.)
+ *       hardware checksum mode, RSS/VMDq settings etc.)
  *     - VLAN filtering configuration
  *     - default MAC address
  *     - MAC addresses supplied to MAC address array
@@ -198,7 +198,7 @@ int rte_eth_iterator_init(struct rte_dev_iterator *iter, const char *devargs);
  * Iterates on devices with devargs filter.
  * The ownership is not checked.
  *
- * The next port id is returned, and the iterator is updated.
+ * The next port ID is returned, and the iterator is updated.
  *
  * @param iter
  *   Device iterator handle initialized by rte_eth_iterator_init().
@@ -206,7 +206,7 @@ int rte_eth_iterator_init(struct rte_dev_iterator *iter, const char *devargs);
  *   by calling rte_eth_iterator_cleanup().
  *
  * @return
- *   A port id if found, RTE_MAX_ETHPORTS otherwise.
+ *   A port ID if found, RTE_MAX_ETHPORTS otherwise.
  */
 uint16_t rte_eth_iterator_next(struct rte_dev_iterator *iter);
 
@@ -231,7 +231,7 @@ void rte_eth_iterator_cleanup(struct rte_dev_iterator *iter);
  * the function rte_eth_iterator_cleanup() must be called.
  *
  * @param id
- *   Iterated port id of type uint16_t.
+ *   Iterated port ID of type uint16_t.
  * @param devargs
  *   Device parameters input as string of type char*.
  * @param iter
@@ -366,7 +366,7 @@ struct rte_eth_thresh {
  *  packets to multiple queues.
  */
 enum rte_eth_rx_mq_mode {
-       /** None of DCB,RSS or VMDQ mode */
+       /** None of DCB, RSS or VMDq mode */
        ETH_MQ_RX_NONE = 0,
 
        /** For Rx side, only RSS is on */
@@ -376,13 +376,13 @@ enum rte_eth_rx_mq_mode {
        /** Both DCB and RSS enable */
        ETH_MQ_RX_DCB_RSS = ETH_MQ_RX_RSS_FLAG | ETH_MQ_RX_DCB_FLAG,
 
-       /** Only VMDQ, no RSS nor DCB */
+       /** Only VMDq, no RSS nor DCB */
        ETH_MQ_RX_VMDQ_ONLY = ETH_MQ_RX_VMDQ_FLAG,
-       /** RSS mode with VMDQ */
+       /** RSS mode with VMDq */
        ETH_MQ_RX_VMDQ_RSS = ETH_MQ_RX_RSS_FLAG | ETH_MQ_RX_VMDQ_FLAG,
-       /** Use VMDQ+DCB to route traffic to queues */
+       /** Use VMDq+DCB to route traffic to queues */
        ETH_MQ_RX_VMDQ_DCB = ETH_MQ_RX_VMDQ_FLAG | ETH_MQ_RX_DCB_FLAG,
-       /** Enable both VMDQ and DCB in VMDq */
+       /** Enable both VMDq and DCB in VMDq */
        ETH_MQ_RX_VMDQ_DCB_RSS = ETH_MQ_RX_RSS_FLAG | ETH_MQ_RX_DCB_FLAG |
                                 ETH_MQ_RX_VMDQ_FLAG,
 };
@@ -445,7 +445,7 @@ enum rte_vlan_type {
 };
 
 /**
- * A structure used to describe a vlan filter.
+ * A structure used to describe a VLAN filter.
  * If the bit corresponding to a VID is set, such VID is on.
  */
 struct rte_vlan_filter_conf {
@@ -806,9 +806,9 @@ rte_eth_rss_hf_refine(uint64_t rss_hf)
 #define RTE_RETA_GROUP_SIZE   64
 
 /**@{@name VMDq and DCB maximums */
-#define ETH_VMDQ_MAX_VLAN_FILTERS   64 /**< Maximum nb. of VMDQ vlan filters. */
+#define ETH_VMDQ_MAX_VLAN_FILTERS   64 /**< Maximum nb. of VMDq VLAN filters. */
 #define ETH_DCB_NUM_USER_PRIORITIES 8  /**< Maximum nb. of DCB priorities. */
-#define ETH_VMDQ_DCB_NUM_QUEUES     128 /**< Maximum nb. of VMDQ DCB queues. */
+#define ETH_VMDQ_DCB_NUM_QUEUES     128 /**< Maximum nb. of VMDq DCB queues. */
 #define ETH_DCB_NUM_QUEUES          128 /**< Maximum nb. of DCB queues. */
 /**@}*/
 
@@ -870,7 +870,7 @@ enum rte_eth_nb_tcs {
 
 /**
  * This enum indicates the possible number of queue pools
- * in VMDQ configurations.
+ * in VMDq configurations.
  */
 enum rte_eth_nb_pools {
        ETH_8_POOLS = 8,    /**< 8 VMDq pools. */
@@ -903,15 +903,15 @@ struct rte_eth_vmdq_tx_conf {
 };
 
 /**
- * A structure used to configure the VMDQ+DCB feature
+ * A structure used to configure the VMDq+DCB feature
  * of an Ethernet port.
  *
  * Using this feature, packets are routed to a pool of queues, based
- * on the vlan id in the vlan tag, and then to a specific queue within
- * that pool, using the user priority vlan tag field.
+ * on the VLAN ID in the VLAN tag, and then to a specific queue within
+ * that pool, using the user priority VLAN tag field.
  *
  * A default pool may be used, if desired, to route all traffic which
- * does not match the vlan filter rules.
+ * does not match the VLAN filter rules.
  */
 struct rte_eth_vmdq_dcb_conf {
        enum rte_eth_nb_pools nb_queue_pools; /**< With DCB, 16 or 32 pools */
@@ -919,30 +919,30 @@ struct rte_eth_vmdq_dcb_conf {
        uint8_t default_pool; /**< The default pool, if applicable */
        uint8_t nb_pool_maps; /**< We can have up to 64 filters/mappings */
        struct {
-               uint16_t vlan_id; /**< The vlan id of the received frame */
+               uint16_t vlan_id; /**< The VLAN ID of the received frame */
                uint64_t pools;   /**< Bitmask of pools for packet Rx */
-       } pool_map[ETH_VMDQ_MAX_VLAN_FILTERS]; /**< VMDq vlan pool maps. */
+       } pool_map[ETH_VMDQ_MAX_VLAN_FILTERS]; /**< VMDq VLAN pool maps. */
        /** Selects a queue in a pool */
        uint8_t dcb_tc[ETH_DCB_NUM_USER_PRIORITIES];
 };
 
 /**
- * A structure used to configure the VMDQ feature of an Ethernet port when
+ * A structure used to configure the VMDq feature of an Ethernet port when
  * not combined with the DCB feature.
  *
  * Using this feature, packets are routed to a pool of queues. By default,
- * the pool selection is based on the MAC address, the vlan id in the
- * vlan tag as specified in the pool_map array.
+ * the pool selection is based on the MAC address, the VLAN ID in the
+ * VLAN tag as specified in the pool_map array.
  * Passing the ETH_VMDQ_ACCEPT_UNTAG in the rx_mode field allows pool
  * selection using only the MAC address. MAC address to pool mapping is done
  * using the rte_eth_dev_mac_addr_add function, with the pool parameter
- * corresponding to the pool id.
+ * corresponding to the pool ID.
  *
  * Queue selection within the selected pool will be done using RSS when
  * it is enabled or revert to the first queue of the pool if not.
  *
  * A default pool may be used, if desired, to route all traffic which
- * does not match the vlan filter rules or any pool MAC address.
+ * does not match the VLAN filter rules or any pool MAC address.
  */
 struct rte_eth_vmdq_rx_conf {
        enum rte_eth_nb_pools nb_queue_pools; /**< VMDq only mode, 8 or 64 pools */
@@ -952,9 +952,9 @@ struct rte_eth_vmdq_rx_conf {
        uint8_t nb_pool_maps; /**< We can have up to 64 filters/mappings */
        uint32_t rx_mode; /**< Flags from ETH_VMDQ_ACCEPT_* */
        struct {
-               uint16_t vlan_id; /**< The vlan id of the received frame */
+               uint16_t vlan_id; /**< The VLAN ID of the received frame */
                uint64_t pools;   /**< Bitmask of pools for packet Rx */
-       } pool_map[ETH_VMDQ_MAX_VLAN_FILTERS]; /**< VMDq vlan pool maps. */
+       } pool_map[ETH_VMDQ_MAX_VLAN_FILTERS]; /**< VMDq VLAN pool maps. */
 };
 
 /**
@@ -1046,6 +1046,14 @@ struct rte_eth_rxconf {
        uint8_t rx_drop_en; /**< Drop packets if no descriptors are available. */
        uint8_t rx_deferred_start; /**< Do not start queue with rte_eth_dev_start(). */
        uint16_t rx_nseg; /**< Number of descriptions in rx_seg array. */
+       /**
+        * Share group index in Rx domain and switch domain.
+        * Non-zero value to enable Rx queue share, zero value disable share.
+        * PMD is responsible for Rx queue consistency checks to avoid member
+        * port's configuration contradict to each other.
+        */
+       uint16_t share_group;
+       uint16_t share_qid; /**< Shared Rx queue ID in group */
        /**
         * Per-queue Rx offloads to be set using DEV_RX_OFFLOAD_* flags.
         * Only offloads set on rx_queue_offload_capa or rx_offload_capa
@@ -1322,19 +1330,19 @@ struct rte_eth_conf {
                                 are defined in implementation of each driver. */
        struct {
                struct rte_eth_rss_conf rss_conf; /**< Port RSS configuration */
-               /** Port vmdq+dcb configuration. */
+               /** Port VMDq+DCB configuration. */
                struct rte_eth_vmdq_dcb_conf vmdq_dcb_conf;
-               /** Port dcb Rx configuration. */
+               /** Port DCB Rx configuration. */
                struct rte_eth_dcb_rx_conf dcb_rx_conf;
-               /** Port vmdq Rx configuration. */
+               /** Port VMDq Rx configuration. */
                struct rte_eth_vmdq_rx_conf vmdq_rx_conf;
        } rx_adv_conf; /**< Port Rx filtering configuration. */
        union {
-               /** Port vmdq+dcb Tx configuration. */
+               /** Port VMDq+DCB Tx configuration. */
                struct rte_eth_vmdq_dcb_tx_conf vmdq_dcb_tx_conf;
-               /** Port dcb Tx configuration. */
+               /** Port DCB Tx configuration. */
                struct rte_eth_dcb_tx_conf dcb_tx_conf;
-               /** Port vmdq Tx configuration. */
+               /** Port VMDq Tx configuration. */
                struct rte_eth_vmdq_tx_conf vmdq_tx_conf;
        } tx_adv_conf; /**< Port Tx DCB configuration (union). */
        /** Currently,Priority Flow Control(PFC) are supported,if DCB with PFC
@@ -1448,6 +1456,16 @@ struct rte_eth_conf {
 #define RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP 0x00000001
 /** Device supports Tx queue setup after device started. */
 #define RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP 0x00000002
+/**
+ * Device supports shared Rx queue among ports within Rx domain and
+ * switch domain. Mbufs are consumed by shared Rx queue instead of
+ * each queue. Multiple groups are supported by share_group of Rx
+ * queue configuration. Shared Rx queue is identified by PMD using
+ * share_qid of Rx queue configuration. Polling any port in the group
+ * receive packets of all member ports, source port identified by
+ * mbuf->port field.
+ */
+#define RTE_ETH_DEV_CAPA_RXQ_SHARE              RTE_BIT64(2)
 /**@}*/
 
 /*
@@ -1472,7 +1490,7 @@ struct rte_eth_dev_portconf {
 };
 
 /**
- * Default values for switch domain id when ethdev does not support switch
+ * Default values for switch domain ID when ethdev does not support switch
  * domain definitions.
  */
 #define RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID   (UINT16_MAX)
@@ -1482,7 +1500,7 @@ struct rte_eth_dev_portconf {
  */
 struct rte_eth_switch_info {
        const char *name;       /**< switch name */
-       uint16_t domain_id;     /**< switch domain id */
+       uint16_t domain_id;     /**< switch domain ID */
        /**
         * Mapping to the devices physical switch port as enumerated from the
         * perspective of the embedded interconnect/switch. For SR-IOV enabled
@@ -1491,6 +1509,12 @@ struct rte_eth_switch_info {
         * port identifier to that physical interconnect/switch
         */
        uint16_t port_id;
+       /**
+        * Shared Rx queue sub-domain boundary. Only ports in same Rx domain
+        * and switch domain can share Rx queue. Valid only if device advertised
+        * RTE_ETH_DEV_CAPA_RXQ_SHARE capability.
+        */
+       uint16_t rx_domain;
 };
 
 /**
@@ -1562,9 +1586,9 @@ struct rte_eth_dev_info {
        uint64_t flow_type_rss_offloads;
        struct rte_eth_rxconf default_rxconf; /**< Default Rx configuration */
        struct rte_eth_txconf default_txconf; /**< Default Tx configuration */
-       uint16_t vmdq_queue_base; /**< First queue ID for VMDQ pools. */
-       uint16_t vmdq_queue_num;  /**< Queue number for VMDQ pools. */
-       uint16_t vmdq_pool_base;  /**< First ID of VMDQ pools. */
+       uint16_t vmdq_queue_base; /**< First queue ID for VMDq pools. */
+       uint16_t vmdq_queue_num;  /**< Queue number for VMDq pools. */
+       uint16_t vmdq_pool_base;  /**< First ID of VMDq pools. */
        struct rte_eth_desc_lim rx_desc_lim;  /**< Rx descriptors limits */
        struct rte_eth_desc_lim tx_desc_lim;  /**< Tx descriptors limits */
        uint32_t speed_capa;  /**< Supported speeds bitmap (ETH_LINK_SPEED_). */
@@ -1645,7 +1669,7 @@ struct rte_eth_burst_mode {
  * This structure is used by rte_eth_xstats_get() to provide
  * statistics that are not provided in the generic *rte_eth_stats*
  * structure.
- * It maps a name id, corresponding to an index in the array returned
+ * It maps a name ID, corresponding to an index in the array returned
  * by rte_eth_xstats_get_names(), to a statistic value.
  */
 struct rte_eth_xstat {
@@ -1861,12 +1885,12 @@ struct rte_eth_dev_owner {
  * Iterates over valid ethdev ports owned by a specific owner.
  *
  * @param port_id
- *   The id of the next possible valid owned port.
+ *   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.
+ *   Next valid port ID owned by owner_id, RTE_MAX_ETHPORTS if there is none.
  */
 uint64_t rte_eth_find_next_owned_by(uint16_t port_id,
                const uint64_t owner_id);
@@ -1883,9 +1907,9 @@ uint64_t rte_eth_find_next_owned_by(uint16_t port_id,
  * Iterates over valid ethdev ports.
  *
  * @param port_id
- *   The id of the next possible valid port.
+ *   The ID of the next possible valid port.
  * @return
- *   Next valid port id, RTE_MAX_ETHPORTS if there is none.
+ *   Next valid port ID, RTE_MAX_ETHPORTS if there is none.
  */
 uint16_t rte_eth_find_next(uint16_t port_id);
 
@@ -1899,11 +1923,11 @@ uint16_t rte_eth_find_next(uint16_t port_id);
  * Iterates over ethdev ports of a specified device.
  *
  * @param port_id_start
- *   The id of the next possible valid port.
+ *   The ID of the next possible valid port.
  * @param parent
  *   The generic device behind the ports to iterate.
  * @return
- *   Next port id of the device, possibly port_id_start,
+ *   Next port ID of the device, possibly port_id_start,
  *   RTE_MAX_ETHPORTS if there is none.
  */
 uint16_t
@@ -1914,7 +1938,7 @@ rte_eth_find_next_of(uint16_t port_id_start,
  * Macro to iterate over all ethdev ports of a specified device.
  *
  * @param port_id
- *   The id of the matching port being iterated.
+ *   The ID of the matching port being iterated.
  * @param parent
  *   The rte_device pointer matching the iterated ports.
  */
@@ -1927,11 +1951,11 @@ rte_eth_find_next_of(uint16_t port_id_start,
  * Iterates over sibling ethdev ports (i.e. sharing the same rte_device).
  *
  * @param port_id_start
- *   The id of the next possible valid sibling port.
+ *   The ID of the next possible valid sibling port.
  * @param ref_port_id
- *   The id of a reference port to compare rte_device with.
+ *   The ID of a reference port to compare rte_device with.
  * @return
- *   Next sibling port id, possibly port_id_start or ref_port_id itself,
+ *   Next sibling port ID, possibly port_id_start or ref_port_id itself,
  *   RTE_MAX_ETHPORTS if there is none.
  */
 uint16_t
@@ -1943,9 +1967,9 @@ rte_eth_find_next_sibling(uint16_t port_id_start, uint16_t ref_port_id);
  * Note: the specified reference port is part of the loop iterations.
  *
  * @param port_id
- *   The id of the matching port being iterated.
+ *   The ID of the matching port being iterated.
  * @param ref_port_id
- *   The id of the port being compared.
+ *   The ID of the port being compared.
  */
 #define RTE_ETH_FOREACH_DEV_SIBLING(port_id, ref_port_id) \
        for (port_id = rte_eth_find_next_sibling(0, ref_port_id); \
@@ -2414,7 +2438,7 @@ int rte_eth_hairpin_unbind(uint16_t tx_port, uint16_t rx_port);
  * @param port_id
  *   The port identifier of the Ethernet device
  * @return
- *   The NUMA socket id to which the Ethernet device is connected or
+ *   The NUMA socket ID to which the Ethernet device is connected or
  *   a default of zero if the socket could not be determined.
  *   -1 is returned is the port_id value is out of range.
  */
@@ -2576,7 +2600,7 @@ int rte_eth_dev_set_link_down(uint16_t port_id);
 int rte_eth_dev_close(uint16_t port_id);
 
 /**
- * Reset a Ethernet device and keep its port id.
+ * Reset a Ethernet device and keep its port ID.
  *
  * When a port has to be reset passively, the DPDK application can invoke
  * this function. For example when a PF is reset, all its VFs should also
@@ -2587,7 +2611,7 @@ int rte_eth_dev_close(uint16_t port_id);
  * When this function is called, it first stops the port and then calls the
  * PMD specific dev_uninit( ) and dev_init( ) to return the port to initial
  * state, in which no Tx and Rx queues are setup, as if the port has been
- * reset and not started. The port keeps the port id it had before the
+ * reset and not started. The port keeps the port ID it had before the
  * function call.
  *
  * After calling rte_eth_dev_reset( ), the application should use
@@ -2822,7 +2846,7 @@ int rte_eth_stats_reset(uint16_t port_id);
  *     is too small. The return value corresponds to the size that should
  *     be given to succeed. The entries in the table are not valid and
  *     shall not be used by the caller.
- *   - A negative value on error (invalid port id).
+ *   - A negative value on error (invalid port ID).
  */
 int rte_eth_xstats_get_names(uint16_t port_id,
                struct rte_eth_xstat_name *xstats_names,
@@ -2855,7 +2879,7 @@ int rte_eth_xstats_get_names(uint16_t port_id,
  *     is too small. The return value corresponds to the size that should
  *     be given to succeed. The entries in the table are not valid and
  *     shall not be used by the caller.
- *   - A negative value on error (invalid port id).
+ *   - A negative value on error (invalid port ID).
  */
 int rte_eth_xstats_get(uint16_t port_id, struct rte_eth_xstat *xstats,
                unsigned int n);
@@ -3128,9 +3152,9 @@ int rte_eth_dev_fw_version_get(uint16_t port_id,
  * and RTE_PTYPE_L3_IPV4 are announced, the PMD must return the following
  * packet types for these packets:
  * - Ether/IPv4              -> RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4
- * - Ether/Vlan/IPv4         -> RTE_PTYPE_L2_ETHER_VLAN | RTE_PTYPE_L3_IPV4
+ * - Ether/VLAN/IPv4         -> RTE_PTYPE_L2_ETHER_VLAN | RTE_PTYPE_L3_IPV4
  * - Ether/[anything else]   -> RTE_PTYPE_L2_ETHER
- * - Ether/Vlan/[anything else] -> RTE_PTYPE_L2_ETHER_VLAN
+ * - Ether/VLAN/[anything else] -> RTE_PTYPE_L2_ETHER_VLAN
  *
  * When a packet is received by a PMD, the most precise type must be
  * returned among the ones supported. However a PMD is allowed to set
@@ -3276,7 +3300,7 @@ int rte_eth_dev_set_vlan_strip_on_queue(uint16_t port_id, uint16_t rx_queue_id,
  * @param port_id
  *   The port identifier of the Ethernet device.
  * @param vlan_type
- *   The vlan type.
+ *   The VLAN type.
  * @param tag_type
  *   The Tag Protocol ID
  * @return
@@ -3555,7 +3579,7 @@ typedef int (*rte_eth_dev_cb_fn)(uint16_t port_id,
  * Register a callback function for port event.
  *
  * @param port_id
- *  Port id.
+ *  Port ID.
  *  RTE_ETH_ALL means register the event for all port ids.
  * @param event
  *  Event interested.
@@ -3576,7 +3600,7 @@ int rte_eth_dev_callback_register(uint16_t port_id,
  * Unregister a callback function for port event.
  *
  * @param port_id
- *  Port id.
+ *  Port ID.
  *  RTE_ETH_ALL means unregister the event for all port ids.
  * @param event
  *  Event interested.
@@ -4008,7 +4032,7 @@ int rte_eth_dev_uc_all_hash_table_set(uint16_t port_id, uint8_t on);
  * @param port_id
  *   The port identifier of the Ethernet device.
  * @param queue_idx
- *   The queue id.
+ *   The queue ID.
  * @param tx_rate
  *   The Tx rate in Mbps. Allocated from the total port link speed.
  * @return
@@ -4114,7 +4138,7 @@ rte_eth_dev_udp_tunnel_port_delete(uint16_t port_id,
  * @param port_id
  *   The port identifier of the Ethernet device.
  * @param dcb_info
- *   dcb information.
+ *   DCB information.
  * @return
  *   - (0) if successful.
  *   - (-ENODEV) if port identifier is invalid.
@@ -4710,7 +4734,7 @@ int
 rte_eth_read_clock(uint16_t port_id, uint64_t *clock);
 
 /**
-* Get the port id from device name. The device name should be specified
+* Get the port ID from device name. The device name should be specified
 * as below:
 * - PCIe address (Domain:Bus:Device.Function), for example- 0000:2:00.0
 * - SoC device name, for example- fsl-gmac0
@@ -4728,7 +4752,7 @@ int
 rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id);
 
 /**
-* Get the device name from port id. The device name is specified as below:
+* Get the device name from port ID. The device name is specified as below:
 * - PCIe address (Domain:Bus:Device.Function), for example- 0000:02:00.0
 * - SoC device name, for example- fsl-gmac0
 * - vdev dpdk name, for example- net_[pcap0|null0|tun0|tap0]
@@ -5106,7 +5130,7 @@ rte_eth_rx_burst(uint16_t port_id, uint16_t queue_id,
  * @param port_id
  *  The port identifier of the Ethernet device.
  * @param queue_id
- *  The queue id on the specific port.
+ *  The queue ID on the specific port.
  * @return
  *  The number of used descriptors in the specific queue, or:
  *   - (-ENODEV) if *port_id* is invalid.
@@ -5456,7 +5480,7 @@ rte_eth_tx_burst(uint16_t port_id, uint16_t queue_id,
  *
  * @param port_id
  *   The port identifier of the Ethernet device.
- *   The value must be a valid port id.
+ *   The value must be a valid port ID.
  * @param queue_id
  *   The index of the transmit queue through which output packets must be
  *   sent.