net/i40e: support updating pctype mapping table
[dpdk.git] / drivers / net / i40e / rte_pmd_i40e.h
index 356fa89..ed41465 100644 (file)
@@ -88,6 +88,12 @@ enum rte_pmd_i40e_package_info {
        RTE_PMD_I40E_PKG_INFO_HEADER,
        RTE_PMD_I40E_PKG_INFO_DEVID_NUM,
        RTE_PMD_I40E_PKG_INFO_DEVID_LIST,
+       RTE_PMD_I40E_PKG_INFO_PROTOCOL_NUM,
+       RTE_PMD_I40E_PKG_INFO_PROTOCOL_LIST,
+       RTE_PMD_I40E_PKG_INFO_PCTYPE_NUM,
+       RTE_PMD_I40E_PKG_INFO_PCTYPE_LIST,
+       RTE_PMD_I40E_PKG_INFO_PTYPE_NUM,
+       RTE_PMD_I40E_PKG_INFO_PTYPE_LIST,
        RTE_PMD_I40E_PKG_INFO_MAX = 0xFFFFFFFF
 };
 
@@ -133,6 +139,25 @@ struct rte_pmd_i40e_profile_list {
        struct rte_pmd_i40e_profile_info p_info[1];
 };
 
+#define RTE_PMD_I40E_PROTO_NUM 6
+#define RTE_PMD_I40E_PROTO_UNUSED 0xFF
+
+/**
+ * Protocols information stored in profile
+ */
+struct rte_pmd_i40e_proto_info {
+       uint8_t proto_id;
+       char name[RTE_PMD_I40E_DDP_NAME_SIZE];
+};
+
+/**
+ * Packet classification/ packet type information stored in profile
+ */
+struct rte_pmd_i40e_ptype_info {
+       uint8_t ptype_id;
+       uint8_t protocols[RTE_PMD_I40E_PROTO_NUM];
+};
+
 /**
  * ptype mapping table only accept RTE_PTYPE_XXX or "user defined" ptype.
  * A ptype with MSB set will be regarded as a user defined ptype.
@@ -637,4 +662,79 @@ int rte_pmd_i40e_ptype_mapping_replace(uint8_t port,
                                       uint8_t mask,
                                       uint32_t pkt_type);
 
+/**
+ * Add a VF MAC address.
+ *
+ * Add more MAC address for VF. The existing MAC addresses
+ * are still effective.
+ *
+ * @param port
+ *   The port identifier of the Ethernet device.
+ * @param vf_id
+ *   VF id.
+ * @param mac_addr
+ *   VF MAC address.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if *vf* or *mac_addr* is invalid.
+ */
+int rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,
+                                struct ether_addr *mac_addr);
+
+#define RTE_PMD_I40E_PCTYPE_MAX                64
+#define RTE_PMD_I40E_FLOW_TYPE_MAX     64
+
+struct rte_pmd_i40e_flow_type_mapping {
+       uint16_t flow_type; /**< software defined flow type*/
+       uint64_t pctype;    /**< hardware defined pctype */
+};
+
+/**
+ * Update hardware defined pctype to software defined flow type
+ * mapping table.
+ *
+ * @param port
+ *    pointer to port identifier of the device.
+ * @param mapping_items
+ *    the base address of the mapping items array.
+ * @param count
+ *    number of mapping items.
+ * @param exclusive
+ *    the flag indicate different pctype mapping update method.
+ *    -(0) only overwrite referred PCTYPE mapping,
+ *     keep other PCTYPEs mapping unchanged.
+ *    -(!0) overwrite referred PCTYPE mapping,
+ *     set other PCTYPEs maps to PCTYPE_INVALID.
+ */
+int rte_pmd_i40e_flow_type_mapping_update(
+                       uint8_t port,
+                       struct rte_pmd_i40e_flow_type_mapping *mapping_items,
+                       uint16_t count,
+                       uint8_t exclusive);
+
+/**
+ * Get software defined flow type to hardware defined pctype
+ * mapping items.
+ *
+ * @param port
+ *    pointer to port identifier of the device.
+ * @param mapping_items
+ *    the base address of the array to store returned items.
+ *    array should be allocated by caller with minimum size of
+ *    RTE_PMD_I40E_FLOW_TYPE_MAX items
+ */
+int rte_pmd_i40e_flow_type_mapping_get(
+                       uint8_t port,
+                       struct rte_pmd_i40e_flow_type_mapping *mapping_items);
+
+/**
+ * Reset hardware defined pctype to software defined flow type
+ * mapping table to default.
+ *
+ * @param port
+ *    pointer to port identifier of the device
+ */
+int rte_pmd_i40e_flow_type_mapping_reset(uint8_t port);
+
 #endif /* _PMD_I40E_H_ */