ethdev: fix doxygen comment for rte_eth_rx_queue_count
[dpdk.git] / lib / librte_ether / rte_ethdev.h
index d36089c..3509aea 100644 (file)
@@ -247,21 +247,43 @@ struct rte_eth_thresh {
  *  packets to multiple queues.
  */
 enum rte_eth_rx_mq_mode {
-       ETH_RSS     = 0,     /**< Default to RSS mode */
-       ETH_VMDQ_DCB,        /**< Use VMDQ+DCB to route traffic to queues */
-       ETH_DCB_RX           /**< For RX side,only DCB is on. */
+       ETH_MQ_RX_NONE = 0,  /**< None of DCB,RSS or VMDQ mode */
+
+       ETH_MQ_RX_RSS,       /**< For RX side, only RSS is on */
+       ETH_MQ_RX_DCB,       /**< For RX side,only DCB is on. */
+       ETH_MQ_RX_DCB_RSS,   /**< Both DCB and RSS enable */
+
+       ETH_MQ_RX_VMDQ_ONLY, /**< Only VMDQ, no RSS nor DCB */
+       ETH_MQ_RX_VMDQ_RSS,  /**< RSS mode with VMDQ */
+       ETH_MQ_RX_VMDQ_DCB,  /**< Use VMDQ+DCB to route traffic to queues */
+       ETH_MQ_RX_VMDQ_DCB_RSS, /**< Enable both VMDQ and DCB in VMDq */
 };
 
+/**
+ * for rx mq mode backward compatible 
+ */
+#define ETH_RSS                       ETH_MQ_RX_RSS
+#define VMDQ_DCB                      ETH_MQ_RX_VMDQ_DCB
+#define ETH_DCB_RX                    ETH_MQ_RX_DCB
+
 /**
  * A set of values to identify what method is to be used to transmit 
  * packets using multi-TCs.
  */
 enum rte_eth_tx_mq_mode {
-       ETH_DCB_NONE    = 0,    /**< It is not in DCB mode. */
-       ETH_VMDQ_DCB_TX,        /**< For TX side,both DCB and VT is on. */
-       ETH_DCB_TX              /**< For TX side,only DCB is on. */
+       ETH_MQ_TX_NONE    = 0,  /**< It is in neither DCB nor VT mode. */
+       ETH_MQ_TX_DCB,          /**< For TX side,only DCB is on. */
+       ETH_MQ_TX_VMDQ_DCB,     /**< For TX side,both DCB and VT is on. */
+       ETH_MQ_TX_VMDQ_ONLY,    /**< Only VT on, no DCB */
 };
 
+/**
+ * for tx mq mode backward compatible 
+ */
+#define ETH_DCB_NONE                ETH_MQ_TX_NONE
+#define ETH_VMDQ_DCB_TX             ETH_MQ_TX_VMDQ_DCB
+#define ETH_DCB_TX                  ETH_MQ_TX_DCB
+
 /**
  * A structure used to configure the RX features of an Ethernet port.
  */
@@ -306,6 +328,9 @@ struct rte_eth_rss_conf {
 #define ETH_RSS_IPV4_UDP    0x0040 /**< IPv4/UDP packet. */
 #define ETH_RSS_IPV6_UDP    0x0080 /**< IPv6/UDP packet. */
 #define ETH_RSS_IPV6_UDP_EX 0x0100 /**< IPv6/UDP with extension headers. */
+/* Definitions used for redirection table entry size */
+#define ETH_RSS_RETA_NUM_ENTRIES 128
+#define ETH_RSS_RETA_MAX_QUEUE   16  
 
 /* Definitions used for VMDQ and DCB functionality */
 #define ETH_VMDQ_MAX_VLAN_FILTERS   64 /**< Maximum nb. of VMDQ vlan filters. */
@@ -327,6 +352,18 @@ struct rte_eth_rss_conf {
 #define ETH_VLAN_FILTER_MASK  0x0002 /**< VLAN Filter  setting mask*/
 #define ETH_VLAN_EXTEND_MASK  0x0004 /**< VLAN Extend  setting mask*/
 
+/**
+ * A structure used to configure Redirection Table of  the Receive Side
+ * Scaling (RSS) feature of an Ethernet port.
+ */
+struct rte_eth_rss_reta {
+       /** First 64 mask bits indicate which entry(s) need to updated/queried. */
+       uint64_t mask_lo; 
+       /** Second 64 mask bits indicate which entry(s) need to updated/queried. */
+       uint64_t mask_hi; 
+       uint8_t reta[ETH_RSS_RETA_NUM_ENTRIES];  /**< 128 RETA entries*/
+};
+
 /**
  * This enum indicates the possible number of traffic classes
  * in DCB configratioins
@@ -341,8 +378,10 @@ enum rte_eth_nb_tcs {
  * in VMDQ+DCB configurations.
  */
 enum rte_eth_nb_pools {
-       ETH_16_POOLS = 16, /**< 16 pools with DCB. */
-       ETH_32_POOLS = 32  /**< 32 pools with DCB. */
+       ETH_8_POOLS = 8,    /**< 8 VMDq pools. */
+       ETH_16_POOLS = 16,  /**< 16 VMDq pools. */
+       ETH_32_POOLS = 32,  /**< 32 VMDq pools. */
+       ETH_64_POOLS = 64   /**< 64 VMDq pools. */
 };
 
 /* This structure may be extended in future. */
@@ -495,9 +534,9 @@ struct rte_fdir_conf {
        enum rte_fdir_mode mode; /**< Flow Director mode. */
        enum rte_fdir_pballoc_type pballoc; /**< Space for FDIR filters. */
        enum rte_fdir_status_mode status;  /**< How to report FDIR hash. */
-       /* Offset of flexbytes field in RX packets (in 16-bit word units). */
+       /** Offset of flexbytes field in RX packets (in 16-bit word units). */
        uint8_t flexbytes_offset;
-       /* RX queue of packets matching a "drop" filter in perfect mode. */
+       /** RX queue of packets matching a "drop" filter in perfect mode. */
        uint8_t drop_queue;
 };
 
@@ -739,6 +778,10 @@ typedef int (*eth_tx_queue_setup_t)(struct rte_eth_dev *dev,
 typedef void (*eth_queue_release_t)(void *queue);
 /**< @internal Release memory resources allocated by given RX/TX queue. */
 
+typedef uint32_t (*eth_rx_queue_count_t)(struct rte_eth_dev *dev,
+                                        uint16_t rx_queue_id);
+/**< @Get number of available descriptors on a receive queue of an Ethernet device. */
+
 typedef int (*vlan_filter_set_t)(struct rte_eth_dev *dev,
                                  uint16_t vlan_id,
                                  int on);
@@ -813,6 +856,14 @@ typedef int (*priority_flow_ctrl_set_t)(struct rte_eth_dev *dev,
                                struct rte_eth_pfc_conf *pfc_conf);
 /**< @internal Setup priority flow control parameter on an Ethernet device */
 
+typedef int (*reta_update_t)(struct rte_eth_dev *dev,
+                               struct rte_eth_rss_reta *reta_conf);
+/**< @internal Update RSS redirection table on an Ethernet device */
+
+typedef int (*reta_query_t)(struct rte_eth_dev *dev,
+                               struct rte_eth_rss_reta *reta_conf);
+/**< @internal Query RSS redirection table on an Ethernet device */
+
 typedef int (*eth_dev_led_on_t)(struct rte_eth_dev *dev);
 /**< @internal Turn on SW controllable LED on an Ethernet device */
 
@@ -852,6 +903,7 @@ struct eth_dev_ops {
        vlan_offload_set_t         vlan_offload_set; /**< Set VLAN Offload. */
        eth_rx_queue_setup_t       rx_queue_setup;/**< Set up device RX queue.*/
        eth_queue_release_t        rx_queue_release;/**< Release RX queue.*/
+       eth_rx_queue_count_t       rx_queue_count; /**< Get Rx queue count. */
        eth_tx_queue_setup_t       tx_queue_setup;/**< Set up device TX queue.*/
        eth_queue_release_t        tx_queue_release;/**< Release TX queue.*/
        eth_dev_led_on_t           dev_led_on;    /**< Turn on LED. */
@@ -877,6 +929,10 @@ struct eth_dev_ops {
        fdir_remove_perfect_filter_t fdir_remove_perfect_filter;
        /** Setup masks for FDIR filtering. */
        fdir_set_masks_t fdir_set_masks;
+       /** Update redirection table. */
+       reta_update_t reta_update;
+       /** Query redirection table. */
+       reta_query_t reta_query;
 };
 
 /**
@@ -899,6 +955,14 @@ struct rte_eth_dev {
        struct rte_eth_dev_cb_list callbacks; /**< User application callbacks */
 };
 
+struct rte_eth_dev_sriov {
+       uint8_t active;               /**< SRIOV is active with 16, 32 or 64 pools */
+       uint8_t nb_q_per_pool;        /**< rx queue number per pool */
+       uint16_t def_vmdq_idx;        /**< Default pool num used for PF */
+       uint16_t def_pool_q_idx;      /**< Default pool queue start reg index */
+};
+#define RTE_ETH_DEV_SRIOV(dev)         ((dev)->data->sriov)
+
 /**
  * @internal
  * The data part, with no function pointers, associated with each ethernet device.
@@ -911,6 +975,8 @@ struct rte_eth_dev_data {
        void **tx_queues; /**< Array of pointers to TX queues. */
        uint16_t nb_rx_queues; /**< Number of RX queues. */
        uint16_t nb_tx_queues; /**< Number of TX queues. */
+       
+       struct rte_eth_dev_sriov sriov;    /**< SRIOV data */
 
        void *dev_private;              /**< PMD-specific private data */
 
@@ -1234,6 +1300,19 @@ extern int rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id,
                                  uint16_t nb_tx_desc, unsigned int socket_id,
                                  const struct rte_eth_txconf *tx_conf);
 
+/*
+ * Return the NUMA socket to which an Ethernet device is connected
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device
+ * @return
+ *   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.
+ */
+extern int rte_eth_dev_socket_id(uint8_t port_id);
+
+
 /**
  * Start an Ethernet device.
  *
@@ -1632,6 +1711,29 @@ rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id,
 }
 #endif
 
+/**
+ * Get the number of used descriptors in a specific queue
+ *
+ * @param port_id
+ *  The port identifier of the Ethernet device.
+ * @param queue_id
+ *  The queue id on the specific port.
+ * @return
+ *  The number of used descriptors in the specific queue.
+ */
+#ifdef RTE_LIBRTE_ETHDEV_DEBUG
+extern uint32_t rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id);
+#else
+static inline uint32_t
+rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id)
+{
+        struct rte_eth_dev *dev;
+        dev = &rte_eth_devices[port_id];
+        return (*dev->dev_ops->rx_queue_count)(dev, queue_id);
+}
+#endif
+
 /**
  * Send a burst of output packets on a transmit queue of an Ethernet device.
  *
@@ -2093,6 +2195,35 @@ int rte_eth_dev_mac_addr_add(uint8_t port, struct ether_addr *mac_addr,
  */
 int rte_eth_dev_mac_addr_remove(uint8_t port, struct ether_addr *mac_addr);
 
+/**
+ * Update Redirection Table(RETA) of Receive Side Scaling of Ethernet device.
+ * 
+ * @param port
+ *   The port identifier of the Ethernet device.
+ * @param reta_conf 
+ *    RETA to update.
+ * @return
+ *   - (0) if successful. 
+ *   - (-ENOTSUP) if hardware doesn't support.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_eth_dev_rss_reta_update(uint8_t port, 
+                       struct rte_eth_rss_reta *reta_conf);
+
+ /**
+ * Query Redirection Table(RETA) of Receive Side Scaling of Ethernet device.
+ *  
+ * @param port
+ *   The port identifier of the Ethernet device.
+ * @param reta_conf 
+ *   RETA to query.
+ * @return
+ *   - (0) if successful. 
+ *   - (-ENOTSUP) if hardware doesn't support.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_eth_dev_rss_reta_query(uint8_t port, 
+                       struct rte_eth_rss_reta *reta_conf);
 
 #ifdef __cplusplus
 }