doc: add Meson coding style to contributors guide
[dpdk.git] / lib / librte_ethdev / ethdev_driver.h
index 06ff352..113129d 100644 (file)
@@ -465,34 +465,16 @@ typedef int (*eth_get_module_eeprom_t)(struct rte_eth_dev *dev,
                                       struct rte_dev_eeprom_info *info);
 /**< @internal Retrieve plugin module eeprom data */
 
+struct rte_flow_ops;
 /**
- * Feature filter types
- */
-enum rte_filter_type {
-       RTE_ETH_FILTER_NONE = 0,
-       RTE_ETH_FILTER_ETHERTYPE,
-       RTE_ETH_FILTER_FLEXIBLE,
-       RTE_ETH_FILTER_SYN,
-       RTE_ETH_FILTER_NTUPLE,
-       RTE_ETH_FILTER_TUNNEL,
-       RTE_ETH_FILTER_FDIR,
-       RTE_ETH_FILTER_HASH,
-       RTE_ETH_FILTER_L2_TUNNEL,
-       RTE_ETH_FILTER_GENERIC,
-};
-
-/**
- * Generic operations on filters
+ * @internal
+ * Get flow operations.
+ *
+ * If the flow API is not supported for the specified device,
+ * the driver can return NULL.
  */
-enum rte_filter_op {
-       RTE_ETH_FILTER_GET,      /**< get flow API ops */
-};
-
-typedef int (*eth_filter_ctrl_t)(struct rte_eth_dev *dev,
-                                enum rte_filter_type filter_type,
-                                enum rte_filter_op filter_op,
-                                void *arg);
-/**< @internal Take operations to assigned filter type on an Ethernet device */
+typedef int (*eth_flow_ops_get_t)(struct rte_eth_dev *dev,
+                                 const struct rte_flow_ops **ops);
 
 typedef int (*eth_tm_ops_get_t)(struct rte_eth_dev *dev, void *ops);
 /**< @internal Get Traffic Management (TM) operations on an Ethernet device */
@@ -783,6 +765,30 @@ typedef int (*eth_hairpin_queue_peer_unbind_t)
 typedef int (*eth_get_monitor_addr_t)(void *rxq,
                struct rte_power_monitor_cond *pmc);
 
+/**
+ * @internal
+ * Get representor info to be able to calculate the unique representor ID.
+ *
+ * Caller should pass NULL as pointer of info to get number of entries,
+ * allocate info buffer according to returned entry number, then call
+ * again with buffer to get real info.
+ *
+ * To calculate the representor ID, caller should iterate each entry,
+ * match controller index, pf index, vf or sf start index and range,
+ * then calculate representor ID from offset to vf/sf start index.
+ * @see rte_eth_representor_id_get.
+ *
+ * @param dev
+ *   Ethdev handle of port.
+ * @param [out] info
+ *   Pointer to memory to save device representor info.
+ * @return
+ *   Negative errno value on error, number of info entries otherwise.
+ */
+
+typedef int (*eth_representor_info_get_t)(struct rte_eth_dev *dev,
+       struct rte_eth_representor_info *info);
+
 /**
  * @internal A structure containing the functions exported by an Ethernet driver.
  */
@@ -880,7 +886,7 @@ struct eth_dev_ops {
        eth_get_module_eeprom_t    get_module_eeprom;
        /** Get plugin module eeprom data. */
 
-       eth_filter_ctrl_t          filter_ctrl; /**< common filter control. */
+       eth_flow_ops_get_t         flow_ops_get; /**< Get flow operations. */
 
        eth_get_dcb_info           get_dcb_info; /** Get DCB information. */
 
@@ -940,6 +946,9 @@ struct eth_dev_ops {
 
        eth_get_monitor_addr_t get_monitor_addr;
        /**< Get power monitoring condition for Rx queue. */
+
+       eth_representor_info_get_t representor_info_get;
+       /**< Get representor info. */
 };
 
 /**
@@ -1237,6 +1246,38 @@ struct rte_eth_devargs {
        enum rte_eth_representor_type type; /* type of representor */
 };
 
+/**
+ * PMD helper function to get representor ID from location detail.
+ *
+ * Get representor ID from controller, pf and (sf or vf).
+ * The mapping is retrieved from rte_eth_representor_info_get().
+ *
+ * For backward compatibility, if no representor info, direct
+ * map legacy VF (no controller and pf).
+ *
+ * @param ethdev
+ *  Handle of ethdev port.
+ * @param type
+ *  Representor type.
+ * @param controller
+ *  Controller ID, -1 if unspecified.
+ * @param pf
+ *  PF port ID, -1 if unspecified.
+ * @param representor_port
+ *  VF or SF representor port number, -1 if unspecified.
+ * @param repr_id
+ *  Pointer to output representor ID.
+ *
+ * @return
+ *  Negative errno value on error, 0 on success.
+ */
+__rte_internal
+int
+rte_eth_representor_id_get(const struct rte_eth_dev *ethdev,
+                          enum rte_eth_representor_type type,
+                          int controller, int pf, int representor_port,
+                          uint16_t *repr_id);
+
 /**
  * PMD helper function to parse ethdev arguments
  *
@@ -1386,6 +1427,18 @@ rte_eth_hairpin_queue_peer_unbind(uint16_t cur_port, uint16_t cur_queue,
  * Legacy ethdev API used internally by drivers.
  */
 
+enum rte_filter_type {
+       RTE_ETH_FILTER_NONE = 0,
+       RTE_ETH_FILTER_ETHERTYPE,
+       RTE_ETH_FILTER_FLEXIBLE,
+       RTE_ETH_FILTER_SYN,
+       RTE_ETH_FILTER_NTUPLE,
+       RTE_ETH_FILTER_TUNNEL,
+       RTE_ETH_FILTER_FDIR,
+       RTE_ETH_FILTER_HASH,
+       RTE_ETH_FILTER_L2_TUNNEL,
+};
+
 /**
  * Define all structures for Ethertype Filter type.
  */