net/bnxt: cleanup VF representor device operations
[dpdk.git] / drivers / net / bnxt / bnxt.h
index 443d9fe..f4b2a3f 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "tf_core.h"
 #include "bnxt_ulp.h"
+#include "bnxt_tf_common.h"
 
 /* Vendor ID */
 #define PCI_VENDOR_ID_BROADCOM         0x14E4
@@ -182,13 +183,6 @@ struct bnxt_led_cfg {
 #define BNXT_LED_DFLT_ENABLES(x)                        \
        rte_cpu_to_le_32(BNXT_LED_DFLT_ENA << (BNXT_LED_DFLT_ENA_SHIFT * (x)))
 
-enum bnxt_hw_context {
-       HW_CONTEXT_NONE     = 0,
-       HW_CONTEXT_IS_RSS   = 1,
-       HW_CONTEXT_IS_COS   = 2,
-       HW_CONTEXT_IS_LB    = 3,
-};
-
 struct bnxt_vlan_table_entry {
        uint16_t                tpid;
        uint16_t                vid;
@@ -217,6 +211,14 @@ struct bnxt_child_vf_info {
        bool                    persist_stats;
 };
 
+struct bnxt_parent_info {
+#define        BNXT_PF_FID_INVALID     0xFFFF
+       uint16_t                fid;
+       uint16_t                vnic;
+       uint16_t                port_id;
+       uint8_t                 mac_addr[RTE_ETHER_ADDR_LEN];
+};
+
 struct bnxt_pf_info {
 #define BNXT_FIRST_PF_FID      1
 #define BNXT_MAX_VFS(bp)       ((bp)->pf->max_vfs)
@@ -555,6 +557,13 @@ struct bnxt_rep_info {
                                     DEV_RX_OFFLOAD_SCATTER | \
                                     DEV_RX_OFFLOAD_RSS_HASH)
 
+#define  MAX_TABLE_SUPPORT 4
+#define  MAX_DIR_SUPPORT   2
+struct bnxt_dmabuf_info {
+       uint32_t entry_num;
+       int      fd[MAX_DIR_SUPPORT][MAX_TABLE_SUPPORT];
+};
+
 #define BNXT_HWRM_SHORT_REQ_LEN                sizeof(struct hwrm_short_input)
 
 struct bnxt_flow_stat_info {
@@ -629,8 +638,6 @@ struct bnxt {
 #define BNXT_FW_CAP_ADV_FLOW_COUNTERS  BIT(6)
 #define BNXT_FW_CAP_HCOMM_FW_STATUS    BIT(7)
 
-       uint32_t                flow_flags;
-#define BNXT_FLOW_FLAG_L2_HDR_SRC_FILTER_EN    BIT(0)
        pthread_mutex_t         flow_lock;
 
        uint32_t                vnic_cap_flags;
@@ -738,6 +745,8 @@ struct bnxt {
 #define BNXT_OUTER_TPID_BD_SHFT        16
        uint32_t                outer_tpid_bd;
        struct bnxt_pf_info     *pf;
+       struct bnxt_parent_info *parent;
+       uint8_t                 port_cnt;
        uint8_t                 vxlan_port_cnt;
        uint8_t                 geneve_port_cnt;
        uint16_t                vxlan_port;
@@ -770,10 +779,12 @@ struct bnxt {
        uint16_t                port_svif;
 
        struct tf               tfp;
+       struct bnxt_dmabuf_info dmabuf;
        struct bnxt_ulp_context *ulp_ctx;
        struct bnxt_flow_stat_info *flow_stat;
        uint8_t                 flow_xstat;
        uint16_t                max_num_kflows;
+       uint16_t                tx_cfa_action;
 };
 
 #define BNXT_FC_TIMER  1 /* Timer freq in Sec Flow Counters */
@@ -784,8 +795,12 @@ struct bnxt {
 struct bnxt_vf_representor {
        uint16_t                switch_domain_id;
        uint16_t                vf_id;
-       uint16_t                tx_cfa_action;
-       uint16_t                rx_cfa_code;
+       uint16_t                fw_fid;
+       uint16_t                dflt_vnic_id;
+       uint16_t                svif;
+       uint16_t                vfr_tx_cfa_action;
+       uint32_t                rep2vf_flow_id;
+       uint32_t                vf2rep_flow_id;
        /* Private data store of associated PF/Trusted VF */
        struct rte_eth_dev      *parent_dev;
        uint8_t                 mac_addr[RTE_ETHER_ADDR_LEN];
@@ -843,6 +858,9 @@ extern const struct rte_flow_ops bnxt_flow_ops;
        } \
 } while (0)
 
+#define        BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev)    \
+               ((eth_dev)->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
+
 extern int bnxt_logtype_driver;
 #define PMD_DRV_LOG_RAW(level, fmt, args...) \
        rte_log(RTE_LOG_ ## level, bnxt_logtype_driver, "%s(): " fmt, \
@@ -854,14 +872,27 @@ extern int bnxt_logtype_driver;
 extern const struct rte_flow_ops bnxt_ulp_rte_flow_ops;
 int32_t bnxt_ulp_init(struct bnxt *bp);
 void bnxt_ulp_deinit(struct bnxt *bp);
-
-uint16_t bnxt_get_vnic_id(uint16_t port);
-uint16_t bnxt_get_svif(uint16_t port_id, bool func_svif);
-uint16_t bnxt_get_fw_func_id(uint16_t port);
+int32_t bnxt_ulp_create_df_rules(struct bnxt *bp);
+void bnxt_ulp_destroy_df_rules(struct bnxt *bp, bool global);
+
+uint16_t bnxt_get_vnic_id(uint16_t port, enum bnxt_ulp_intf_type type);
+uint16_t bnxt_get_svif(uint16_t port_id, bool func_svif,
+                      enum bnxt_ulp_intf_type type);
+uint16_t bnxt_get_fw_func_id(uint16_t port, enum bnxt_ulp_intf_type type);
+uint16_t bnxt_get_parif(uint16_t port, enum bnxt_ulp_intf_type type);
+uint16_t bnxt_get_phy_port_id(uint16_t port);
+uint16_t bnxt_get_vport(uint16_t port);
+enum bnxt_ulp_intf_type
+bnxt_get_interface_type(uint16_t port);
 
 void bnxt_cancel_fc_thread(struct bnxt *bp);
 void bnxt_flow_cnt_alarm_cb(void *arg);
 int bnxt_flow_stats_req(struct bnxt *bp);
 int bnxt_flow_stats_cnt(struct bnxt *bp);
 uint32_t bnxt_get_speed_capabilities(struct bnxt *bp);
+
+int
+bnxt_filter_ctrl_op(struct rte_eth_dev *dev,
+                   enum rte_filter_type filter_type,
+                   enum rte_filter_op filter_op, void *arg);
 #endif