ethdev: change promiscuous callbacks to return status
[dpdk.git] / lib / librte_ethdev / rte_ethdev_core.h
index 16300b1..552da38 100644 (file)
@@ -52,11 +52,55 @@ typedef int (*eth_dev_reset_t)(struct rte_eth_dev *dev);
 typedef int (*eth_is_removed_t)(struct rte_eth_dev *dev);
 /**< @internal Function used to detect an Ethernet device removal. */
 
-typedef void (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
-/**< @internal Function used to enable the RX promiscuous mode of an Ethernet device. */
+/**
+ * @internal
+ * Function used to enable the Rx promiscuous mode of an Ethernet device.
+ *
+ * @param dev
+ *   ethdev handle of port.
+ *
+ * @return
+ *   Negative errno value on error, 0 on success.
+ *
+ * @retval 0
+ *   Success, promiscuous mode is enabled.
+ * @retval -ENOTSUP
+ *   Promiscuous mode is not supported.
+ * @retval -ENODEV
+ *   Device is gone.
+ * @retval -E_RTE_SECONDARY
+ *   Function was called from a secondary process instance and not supported.
+ * @retval -ETIMEDOUT
+ *   Attempt to enable promiscuos mode failed because of timeout.
+ * @retval -EAGAIN
+ *   Failed to enable promiscuous mode.
+ */
+typedef int (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
 
-typedef void (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
-/**< @internal Function used to disable the RX promiscuous mode of an Ethernet device. */
+/**
+ * @internal
+ * Function used to disable the Rx promiscuous mode of an Ethernet device.
+ *
+ * @param dev
+ *   ethdev handle of port.
+ *
+ * @return
+ *   Negative errno value on error, 0 on success.
+ *
+ * @retval 0
+ *   Success, promiscuous mode is disabled.
+ * @retval -ENOTSUP
+ *   Promiscuous mode disabling is not supported.
+ * @retval -ENODEV
+ *   Device is gone.
+ * @retval -E_RTE_SECONDARY
+ *   Function was called from a secondary process instance and not supported.
+ * @retval -ETIMEDOUT
+ *   Attempt to disable promiscuos mode failed because of timeout.
+ * @retval -EAGAIN
+ *   Failed to disable promiscuous mode.
+ */
+typedef int (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
 
 typedef void (*eth_allmulticast_enable_t)(struct rte_eth_dev *dev);
 /**< @internal Enable the receipt of all multicast packets by an Ethernet device. */
@@ -103,8 +147,8 @@ typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev,
                                             uint8_t is_rx);
 /**< @internal Set a queue statistics mapping for a tx/rx queue of an Ethernet device. */
 
-typedef void (*eth_dev_infos_get_t)(struct rte_eth_dev *dev,
-                                   struct rte_eth_dev_info *dev_info);
+typedef int (*eth_dev_infos_get_t)(struct rte_eth_dev *dev,
+                                  struct rte_eth_dev_info *dev_info);
 /**< @internal Get specific information of an Ethernet device. */
 
 typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(struct rte_eth_dev *dev);
@@ -250,17 +294,17 @@ typedef void (*eth_mac_addr_remove_t)(struct rte_eth_dev *dev, uint32_t index);
 /**< @internal Remove MAC address from receive address register */
 
 typedef int (*eth_mac_addr_add_t)(struct rte_eth_dev *dev,
-                                 struct ether_addr *mac_addr,
+                                 struct rte_ether_addr *mac_addr,
                                  uint32_t index,
                                  uint32_t vmdq);
 /**< @internal Set a MAC address into Receive Address Address Register */
 
 typedef int (*eth_mac_addr_set_t)(struct rte_eth_dev *dev,
-                                 struct ether_addr *mac_addr);
+                                 struct rte_ether_addr *mac_addr);
 /**< @internal Set a MAC address into Receive Address Address Register */
 
 typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev,
-                                 struct ether_addr *mac_addr,
+                                 struct rte_ether_addr *mac_addr,
                                  uint8_t on);
 /**< @internal Set a Unicast Hash bitmap */
 
@@ -292,7 +336,7 @@ typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev,
 /**< @internal Delete tunneling UDP port */
 
 typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev,
-                                     struct ether_addr *mc_addr_set,
+                                     struct rte_ether_addr *mc_addr_set,
                                      uint32_t nb_mc_addr);
 /**< @internal set the list of multicast addresses on an Ethernet device */
 
@@ -322,6 +366,10 @@ typedef int (*eth_timesync_write_time)(struct rte_eth_dev *dev,
                                       const struct timespec *timestamp);
 /**< @internal Function used to get time from the device clock */
 
+typedef int (*eth_read_clock)(struct rte_eth_dev *dev,
+                                     uint64_t *timestamp);
+/**< @internal Function used to get the current value of the device clock. */
+
 typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev,
                                struct rte_dev_reg_info *info);
 /**< @internal Retrieve registers  */
@@ -496,6 +544,8 @@ struct eth_dev_ops {
        eth_timesync_read_time     timesync_read_time; /** Get the device clock time. */
        eth_timesync_write_time    timesync_write_time; /** Set the device clock time. */
 
+       eth_read_clock             read_clock;
+
        eth_xstats_get_by_id_t     xstats_get_by_id;
        /**< Get extended device statistic values by ID. */
        eth_xstats_get_names_by_id_t xstats_get_names_by_id;
@@ -597,13 +647,13 @@ struct rte_eth_dev_data {
                        /**< Common RX buffer size handled by all queues. */
 
        uint64_t rx_mbuf_alloc_failed; /**< RX ring mbuf allocation failures. */
-       struct ether_addr *mac_addrs;
+       struct rte_ether_addr *mac_addrs;
                        /**< Device Ethernet link address.
                         *   @see rte_eth_dev_release_port()
                         */
        uint64_t mac_pool_sel[ETH_NUM_RECEIVE_MAC_ADDR];
                        /**< Bitmap associating MAC addresses to pools. */
-       struct ether_addr *hash_mac_addrs;
+       struct rte_ether_addr *hash_mac_addrs;
                        /**< Device Ethernet MAC addresses of hash filtering.
                         *   @see rte_eth_dev_release_port()
                         */