ethdev: get rid of device type
[dpdk.git] / lib / librte_ether / rte_ethdev.h
index da7902f..2b5f371 100644 (file)
@@ -255,6 +255,7 @@ struct rte_eth_stats {
 /**
  * A structure used to retrieve link-level information of an Ethernet port.
  */
+__extension__
 struct rte_eth_link {
        uint32_t link_speed;        /**< ETH_SPEED_NUM_ */
        uint16_t link_duplex  : 1;  /**< ETH_LINK_[HALF/FULL]_DUPLEX */
@@ -346,6 +347,7 @@ struct rte_eth_rxmode {
        enum rte_eth_rx_mq_mode mq_mode;
        uint32_t max_rx_pkt_len;  /**< Only used if jumbo_frame enabled. */
        uint16_t split_hdr_size;  /**< hdr buf size (header_split enabled).*/
+       __extension__
        uint16_t header_split : 1, /**< Header Split enable. */
                hw_ip_checksum   : 1, /**< IP/UDP/TCP checksum offload enable. */
                hw_vlan_filter   : 1, /**< VLAN filter enable. */
@@ -645,6 +647,7 @@ struct rte_eth_txmode {
 
        /* For i40e specifically */
        uint16_t pvid;
+       __extension__
        uint8_t hw_vlan_reject_tagged : 1,
                /**< If set, reject sending out tagged pkts */
                hw_vlan_reject_untagged : 1,
@@ -1321,9 +1324,6 @@ 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_get_reg_length_t)(struct rte_eth_dev *dev);
-/**< @internal Retrieve device register count  */
-
 typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev,
                                struct rte_dev_reg_info *info);
 /**< @internal Retrieve registers  */
@@ -1487,8 +1487,6 @@ struct eth_dev_ops {
        /** Query redirection table. */
        reta_query_t reta_query;
 
-       eth_get_reg_length_t get_reg_length;
-       /**< Get # of registers */
        eth_get_reg_t get_reg;
        /**< Get registers */
        eth_get_eeprom_length_t get_eeprom_length;
@@ -1607,17 +1605,6 @@ struct rte_eth_rxtx_callback {
        void *param;
 };
 
-/**
- * The eth device type.
- */
-enum rte_eth_dev_type {
-       RTE_ETH_DEV_UNKNOWN,    /**< unknown device type */
-       RTE_ETH_DEV_PCI,
-               /**< Physical function and Virtual function of PCI devices */
-       RTE_ETH_DEV_VIRTUAL,    /**< non hardware device */
-       RTE_ETH_DEV_MAX         /**< max value of this enum */
-};
-
 /**
  * @internal
  * The generic data structure associated with each ethernet device.
@@ -1648,7 +1635,6 @@ struct rte_eth_dev {
         */
        struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
        uint8_t attached; /**< Flag indicating the port is attached */
-       enum rte_eth_dev_type dev_type; /**< Flag indicating the device type */
 } __rte_cache_aligned;
 
 struct rte_eth_dev_sriov {
@@ -1696,6 +1682,7 @@ struct rte_eth_dev_data {
        struct ether_addr* hash_mac_addrs;
        /** Device Ethernet MAC addresses of hash filtering. */
        uint8_t port_id;           /**< Device [external] port identifier. */
+       __extension__
        uint8_t promiscuous   : 1, /**< RX promiscuous mode ON(1) / OFF(0). */
                scattered_rx : 1,  /**< RX of scattered packets is ON(1) / OFF(0) */
                all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */
@@ -1761,8 +1748,7 @@ struct rte_eth_dev *rte_eth_dev_allocated(const char *name);
  * @return
  *   - Slot in the rte_dev_devices array for a new device;
  */
-struct rte_eth_dev *rte_eth_dev_allocate(const char *name,
-               enum rte_eth_dev_type type);
+struct rte_eth_dev *rte_eth_dev_allocate(const char *name);
 
 /**
  * @internal
@@ -1875,18 +1861,6 @@ struct eth_driver {
        unsigned int dev_private_size;    /**< Size of device private data. */
 };
 
-/**
- * @internal
- * A function invoked by the initialization function of an Ethernet driver
- * to simultaneously register itself as a PCI driver and as an Ethernet
- * Poll Mode Driver (PMD).
- *
- * @param eth_drv
- *   The pointer to the *eth_driver* structure associated with
- *   the Ethernet driver.
- */
-void rte_eth_driver_register(struct eth_driver *eth_drv);
-
 /**
  * Convert a numerical speed in Mbps to a bitmap flag that can be used in
  * the bitmap link_speeds of the struct rte_eth_conf
@@ -2047,9 +2021,8 @@ int rte_eth_dev_socket_id(uint8_t port_id);
 int rte_eth_dev_is_valid_port(uint8_t port_id);
 
 /**
- * Allocate mbuf from mempool, setup the DMA physical address
- * and then start RX for specified queue of a port. It is used
- * when rx_deferred_start flag of the specified queue is true.
+ * Start specified RX queue of a port. It is used when rx_deferred_start
+ * flag of the specified queue is true.
  *
  * @param port_id
  *   The port identifier of the Ethernet device
@@ -2058,7 +2031,7 @@ int rte_eth_dev_is_valid_port(uint8_t port_id);
  *   The value must be in the range [0, nb_rx_queue - 1] previously supplied
  *   to rte_eth_dev_configure().
  * @return
- *   - 0: Success, the transmit queue is correctly set up.
+ *   - 0: Success, the receive queue is started.
  *   - -EINVAL: The port_id or the queue_id out of range.
  *   - -ENOTSUP: The function not supported in PMD driver.
  */
@@ -2074,7 +2047,7 @@ int rte_eth_dev_rx_queue_start(uint8_t port_id, uint16_t rx_queue_id);
  *   The value must be in the range [0, nb_rx_queue - 1] previously supplied
  *   to rte_eth_dev_configure().
  * @return
- *   - 0: Success, the transmit queue is correctly set up.
+ *   - 0: Success, the receive queue is stopped.
  *   - -EINVAL: The port_id or the queue_id out of range.
  *   - -ENOTSUP: The function not supported in PMD driver.
  */
@@ -2091,7 +2064,7 @@ int rte_eth_dev_rx_queue_stop(uint8_t port_id, uint16_t rx_queue_id);
  *   The value must be in the range [0, nb_tx_queue - 1] previously supplied
  *   to rte_eth_dev_configure().
  * @return
- *   - 0: Success, the transmit queue is correctly set up.
+ *   - 0: Success, the transmit queue is started.
  *   - -EINVAL: The port_id or the queue_id out of range.
  *   - -ENOTSUP: The function not supported in PMD driver.
  */
@@ -2107,7 +2080,7 @@ int rte_eth_dev_tx_queue_start(uint8_t port_id, uint16_t tx_queue_id);
  *   The value must be in the range [0, nb_tx_queue - 1] previously supplied
  *   to rte_eth_dev_configure().
  * @return
- *   - 0: Success, the transmit queue is correctly set up.
+ *   - 0: Success, the transmit queue is stopped.
  *   - -EINVAL: The port_id or the queue_id out of range.
  *   - -ENOTSUP: The function not supported in PMD driver.
  */
@@ -2407,6 +2380,21 @@ void rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info);
 /**
  * Retrieve the supported packet types of an Ethernet device.
  *
+ * When a packet type is announced as supported, it *must* be recognized by
+ * the PMD. For instance, if RTE_PTYPE_L2_ETHER, RTE_PTYPE_L2_ETHER_VLAN
+ * 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/[anything else]   -> RTE_PTYPE_L2_ETHER
+ * - 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
+ * packet type that is not in the supported list, at the condition that it
+ * is more precise. Therefore, a PMD announcing no supported packet types
+ * can still set a matching packet type in a received packet.
+ *
  * @note
  *   Better to invoke this API after the device is already started or rx burst
  *   function is decided, to obtain correct supported ptypes.
@@ -4046,25 +4034,15 @@ int rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
        struct rte_eth_txq_info *qinfo);
 
 /**
- * Retrieve number of available registers for access
- *
- * @param port_id
- *   The port identifier of the Ethernet device.
- * @return
- *   - (>=0) number of registers if successful.
- *   - (-ENOTSUP) if hardware doesn't support.
- *   - (-ENODEV) if *port_id* invalid.
- *   - others depends on the specific operations implementation.
- */
-int rte_eth_dev_get_reg_length(uint8_t port_id);
-
-/**
- * Retrieve device registers and register attributes
+ * Retrieve device registers and register attributes (number of registers and
+ * register size)
  *
  * @param port_id
  *   The port identifier of the Ethernet device.
  * @param info
- *   The template includes buffer for register data and attribute to be filled.
+ *   Pointer to rte_dev_reg_info structure to fill in. If info->data is
+ *   NULL the function fills in the width and length fields. If non-NULL
+ *   the registers are put into the buffer pointed at by the data field.
  * @return
  *   - (0) if successful.
  *   - (-ENOTSUP) if hardware doesn't support.
@@ -4369,6 +4347,21 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id);
 int
 rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);
 
+/**
+ * @internal
+ * Wrapper for use by pci drivers as a .probe function to attach to a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
+                         struct rte_pci_device *pci_dev);
+
+/**
+ * @internal
+ * Wrapper for use by pci drivers as a .remove function to detach a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
+
 #ifdef __cplusplus
 }
 #endif