ethdev: RSS RETA configuration
[dpdk.git] / lib / librte_ether / rte_ethdev.h
index 1cfb76a..74b3a5b 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  * 
- *   Copyright(c) 2010-2012 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2013 Intel Corporation. All rights reserved.
  *   All rights reserved.
  * 
  *   Redistribution and use in source and binary forms, with or without 
@@ -203,6 +203,14 @@ struct rte_eth_stats {
        /**< Total number of successfully transmitted queue bytes. */
        uint64_t q_errors[RTE_ETHDEV_QUEUE_STAT_CNTRS];
        /**< Total number of queue packets received that are dropped. */
+       uint64_t ilbpackets;
+       /**< Total number of good packets received from loopback,VF Only */
+       uint64_t olbpackets;
+       /**< Total number of good packets transmitted to loopback,VF Only */
+       uint64_t ilbbytes;
+       /**< Total number of good bytes received from loopback,VF Only */
+       uint64_t olbbytes;
+       /**< Total number of good bytes transmitted to loopback,VF Only */
 };
 
 /**
@@ -298,6 +306,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. */
@@ -319,6 +330,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
@@ -439,6 +462,16 @@ struct rte_eth_fc_conf {
        enum rte_eth_fc_mode mode;  /**< Link flow control mode */
 };
 
+/**
+ * A structure used to configure Ethernet priority flow control parameter.
+ * These parameters will be configured into the register of the NIC.
+ * Please refer to the corresponding data sheet for proper value.
+ */
+struct rte_eth_pfc_conf {
+       struct rte_eth_fc_conf fc; /**< General flow control parameter. */
+       uint8_t priority;          /**< VLAN User Priority. */
+};
+
 /**
  *  Flow Director setting modes: none (default), signature or perfect.
  */
@@ -477,9 +510,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;
 };
 
@@ -791,6 +824,18 @@ typedef int (*flow_ctrl_set_t)(struct rte_eth_dev *dev,
                                struct rte_eth_fc_conf *fc_conf);
 /**< @internal Setup flow control parameter on an Ethernet device */
 
+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 */
 
@@ -835,6 +880,7 @@ struct eth_dev_ops {
        eth_dev_led_on_t           dev_led_on;    /**< Turn on LED. */
        eth_dev_led_off_t          dev_led_off;   /**< Turn off LED. */
        flow_ctrl_set_t            flow_ctrl_set; /**< Setup flow control. */
+       priority_flow_ctrl_set_t   priority_flow_ctrl_set; /**< Setup priority flow control.*/
        eth_mac_addr_remove_t      mac_addr_remove; /**< Remove MAC address */
        eth_mac_addr_add_t         mac_addr_add;  /**< Add a MAC address */
 
@@ -854,6 +900,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;
 };
 
 /**
@@ -1211,6 +1261,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.
  *
@@ -2016,6 +2079,24 @@ int  rte_eth_led_off(uint8_t port_id);
 int rte_eth_dev_flow_ctrl_set(uint8_t port_id,
                                struct rte_eth_fc_conf *fc_conf);
 
+/**
+ * Configure the Ethernet priority flow control under DCB environment 
+ * for Ethernet device. 
+ * 
+ * @param port_id
+ * The port identifier of the Ethernet device.
+ * @param pfc_conf
+ * The pointer to the structure of the priority flow control parameters.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if hardware doesn't support priority flow control mode.
+ *   - (-ENODEV)  if *port_id* invalid.
+ *   - (-EINVAL)  if bad parameter
+ *   - (-EIO)     if flow control setup failure
+ */
+int rte_eth_dev_priority_flow_ctrl_set(uint8_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.
@@ -2052,6 +2133,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
 }