ethdev: improve API comments of close and detach functions
[dpdk.git] / lib / librte_ether / rte_ethdev.h
index 7d7fc2e..ec4a882 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -470,10 +470,11 @@ struct rte_eth_rss_conf {
 /** Maximum nb. of vlan per mirror rule */
 #define ETH_MIRROR_MAX_VLANS       64
 
-#define ETH_VMDQ_POOL_MIRROR    0x0001 /**< Virtual Pool Mirroring. */
-#define ETH_VMDQ_UPLINK_MIRROR  0x0002 /**< Uplink Port Mirroring. */
-#define ETH_VMDQ_DOWNLIN_MIRROR 0x0004 /**< Downlink Port Mirroring. */
-#define ETH_VMDQ_VLAN_MIRROR    0x0008 /**< VLAN Mirroring. */
+#define ETH_MIRROR_VIRTUAL_POOL_UP     0x01  /**< Virtual Pool uplink Mirroring. */
+#define ETH_MIRROR_UPLINK_PORT         0x02  /**< Uplink Port Mirroring. */
+#define ETH_MIRROR_DOWNLINK_PORT       0x04  /**< Downlink Port Mirroring. */
+#define ETH_MIRROR_VLAN                0x08  /**< VLAN Mirroring. */
+#define ETH_MIRROR_VIRTUAL_POOL_DOWN   0x10  /**< Virtual Pool downlink Mirroring. */
 
 /**
  * A structure used to configure VLAN traffic mirror of an Ethernet port.
@@ -488,7 +489,7 @@ struct rte_eth_vlan_mirror {
  * A structure used to configure traffic mirror of an Ethernet port.
  */
 struct rte_eth_mirror_conf {
-       uint8_t rule_type_mask; /**< Mirroring rule type mask we want to set */
+       uint8_t rule_type; /**< Mirroring rule type */
        uint8_t dst_pool;  /**< Destination pool for this mirror rule. */
        uint64_t pool_mask; /**< Bitmap of pool for pool mirroring */
        /** VLAN ID setting for VLAN mirroring. */
@@ -923,6 +924,7 @@ struct rte_eth_dev_info {
        uint32_t tx_offload_capa; /**< Device TX offload capabilities. */
        uint16_t reta_size;
        /**< Device redirection table size, the total number of entries. */
+       uint8_t hash_key_size; /**< Hash key size in bytes */
        /** Bit mask of RSS offloads, the bit offset also means flow type */
        uint64_t flow_type_rss_offloads;
        struct rte_eth_rxconf default_rxconf; /**< Default RX configuration */
@@ -1238,6 +1240,21 @@ typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev,
                                      uint32_t nb_mc_addr);
 /**< @internal set the list of multicast addresses on an Ethernet device */
 
+typedef int (*eth_timesync_enable_t)(struct rte_eth_dev *dev);
+/**< @internal Function used to enable IEEE1588/802.1AS timestamping. */
+
+typedef int (*eth_timesync_disable_t)(struct rte_eth_dev *dev);
+/**< @internal Function used to disable IEEE1588/802.1AS timestamping. */
+
+typedef int (*eth_timesync_read_rx_timestamp_t)(struct rte_eth_dev *dev,
+                                               struct timespec *timestamp,
+                                               uint32_t flags);
+/**< @internal Function used to read an RX IEEE1588/802.1AS timestamp. */
+
+typedef int (*eth_timesync_read_tx_timestamp_t)(struct rte_eth_dev *dev,
+                                               struct timespec *timestamp);
+/**< @internal Function used to read a TX IEEE1588/802.1AS timestamp. */
+
 #ifdef RTE_NIC_BYPASS
 
 enum {
@@ -1396,6 +1413,15 @@ struct eth_dev_ops {
        rss_hash_conf_get_t rss_hash_conf_get;
        eth_filter_ctrl_t              filter_ctrl;          /**< common filter control*/
        eth_set_mc_addr_list_t set_mc_addr_list; /**< set list of mcast addrs */
+
+       /** Turn IEEE1588/802.1AS timestamping on. */
+       eth_timesync_enable_t timesync_enable;
+       /** Turn IEEE1588/802.1AS timestamping off. */
+       eth_timesync_disable_t timesync_disable;
+       /** Read the IEEE1588/802.1AS RX timestamp. */
+       eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp;
+       /** Read the IEEE1588/802.1AS TX timestamp. */
+       eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp;
 };
 
 /**
@@ -1631,6 +1657,8 @@ int rte_eth_dev_attach(const char *devargs, uint8_t *port_id);
 
 /**
  * Detach a Ethernet device specified by port identifier.
+ * This function must be called when the device is in the
+ * closed state.
  *
  * @param port_id
  *   The port identifier of the device to detach.
@@ -1984,7 +2012,9 @@ extern int rte_eth_dev_set_link_up(uint8_t port_id);
 extern int rte_eth_dev_set_link_down(uint8_t port_id);
 
 /**
- * Close an Ethernet device. The device cannot be restarted!
+ * Close a stopped Ethernet device. The device cannot be restarted!
+ * The function frees all resources except for needed by the
+ * closed state. To free these resources, call rte_eth_dev_detach().
  *
  * @param port_id
  *   The port identifier of the Ethernet device.
@@ -3645,4 +3675,68 @@ int rte_eth_dev_set_mc_addr_list(uint8_t port_id,
                                 struct ether_addr *mc_addr_set,
                                 uint32_t nb_mc_addr);
 
+
+/**
+ * Enable IEEE1588/802.1AS timestamping for an Ethernet device.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ *
+ * @return
+ *   - 0: Success.
+ *   - -ENODEV: The port ID is invalid.
+ *   - -ENOTSUP: The function is not supported by the Ethernet driver.
+ */
+extern int rte_eth_timesync_enable(uint8_t port_id);
+
+/**
+ * Disable IEEE1588/802.1AS timestamping for an Ethernet device.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ *
+ * @return
+ *   - 0: Success.
+ *   - -ENODEV: The port ID is invalid.
+ *   - -ENOTSUP: The function is not supported by the Ethernet driver.
+ */
+extern int rte_eth_timesync_disable(uint8_t port_id);
+
+/**
+ * Read an IEEE1588/802.1AS RX timestamp from an Ethernet device.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param timestamp
+ *   Pointer to the timestamp struct.
+ * @param flags
+ *   Device specific flags. Used to pass the RX timesync register index to
+ *   i40e. Unused in igb/ixgbe, pass 0 instead.
+ *
+ * @return
+ *   - 0: Success.
+ *   - -EINVAL: No timestamp is available.
+ *   - -ENODEV: The port ID is invalid.
+ *   - -ENOTSUP: The function is not supported by the Ethernet driver.
+ */
+extern int rte_eth_timesync_read_rx_timestamp(uint8_t port_id,
+                                             struct timespec *timestamp,
+                                             uint32_t flags);
+
+/**
+ * Read an IEEE1588/802.1AS TX timestamp from an Ethernet device.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param timestamp
+ *   Pointer to the timestamp struct.
+ *
+ * @return
+ *   - 0: Success.
+ *   - -EINVAL: No timestamp is available.
+ *   - -ENODEV: The port ID is invalid.
+ *   - -ENOTSUP: The function is not supported by the Ethernet driver.
+ */
+extern int rte_eth_timesync_read_tx_timestamp(uint8_t port_id,
+                                             struct timespec *timestamp);
 #endif /* _RTE_ETHDEV_H_ */