X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fbnxt%2Ftf_ulp%2Fbnxt_ulp.h;h=082ca501b65e7b4d0c727640cd02fd24e4fd6065;hb=45633c460c223a67dd1a7cc084c3eceb5e17687c;hp=a1332842632d163442b610fb72dded3bb986aa1c;hpb=9cf9c8385df7ada0ea77950b9a629d1d017b6512;p=dpdk.git diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h index a133284263..082ca501b6 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2019-2020 Broadcom + * Copyright(c) 2019-2021 Broadcom * All rights reserved. */ @@ -10,9 +10,53 @@ #include #include +#include "rte_version.h" #include "rte_ethdev.h" #include "ulp_template_db_enum.h" +#include "ulp_tun.h" +#include "bnxt_tf_common.h" + +/* NAT defines to reuse existing inner L2 SMAC and DMAC */ +#define BNXT_ULP_NAT_INNER_L2_HEADER_SMAC 0x2000 +#define BNXT_ULP_NAT_OUTER_MOST_L2_HDR_SMAC 0x6000 +#define BNXT_ULP_NAT_OUTER_MOST_L2_VLAN_TAGS 0xc00 +#define BNXT_ULP_NAT_INNER_L2_HEADER_DMAC 0x100 +#define BNXT_ULP_NAT_OUTER_MOST_L2_HDR_DMAC 0x300 +#define BNXT_ULP_NAT_OUTER_MOST_FLAGS (BNXT_ULP_NAT_OUTER_MOST_L2_HDR_SMAC |\ + BNXT_ULP_NAT_OUTER_MOST_L2_VLAN_TAGS |\ + BNXT_ULP_NAT_OUTER_MOST_L2_HDR_DMAC) + +/* defines for the ulp_flags */ +#define BNXT_ULP_VF_REP_ENABLED 0x1 +#define BNXT_ULP_SHARED_SESSION_ENABLED 0x2 +#define BNXT_ULP_APP_DEV_UNSUPPORTED 0x4 +#define BNXT_ULP_HIGH_AVAIL_ENABLED 0x8 +#define BNXT_ULP_APP_UNICAST_ONLY 0x10 +#define ULP_VF_REP_IS_ENABLED(flag) ((flag) & BNXT_ULP_VF_REP_ENABLED) +#define ULP_SHARED_SESSION_IS_ENABLED(flag) ((flag) &\ + BNXT_ULP_SHARED_SESSION_ENABLED) +#define ULP_APP_DEV_UNSUPPORTED_ENABLED(flag) ((flag) &\ + BNXT_ULP_APP_DEV_UNSUPPORTED) +#define ULP_HIGH_AVAIL_IS_ENABLED(flag) ((flag) & BNXT_ULP_HIGH_AVAIL_ENABLED) + +enum bnxt_ulp_flow_mem_type { + BNXT_ULP_FLOW_MEM_TYPE_INT = 0, + BNXT_ULP_FLOW_MEM_TYPE_EXT = 1, + BNXT_ULP_FLOW_MEM_TYPE_BOTH = 2, + BNXT_ULP_FLOW_MEM_TYPE_LAST = 3 +}; + +struct bnxt_ulp_df_rule_info { + uint32_t def_port_flow_id; + uint8_t valid; +}; + +struct bnxt_ulp_vfr_rule_info { + uint32_t vfr_flow_id; + uint16_t parent_port_id; + uint8_t valid; +}; struct bnxt_ulp_data { uint32_t tbl_scope_id; @@ -20,18 +64,27 @@ struct bnxt_ulp_data { uint32_t dev_id; /* Hardware device id */ uint32_t ref_cnt; struct bnxt_ulp_flow_db *flow_db; + pthread_mutex_t flow_db_lock; void *mapper_data; struct bnxt_ulp_port_db *port_db; struct bnxt_ulp_fc_info *fc_info; - uint32_t port_to_app_flow_id; - uint32_t app_to_port_flow_id; - uint32_t tx_cfa_action; + struct bnxt_ulp_ha_mgr_info *ha_info; + uint32_t ulp_flags; + struct bnxt_ulp_df_rule_info df_rule_info[RTE_MAX_ETHPORTS]; + struct bnxt_ulp_vfr_rule_info vfr_rule_info[RTE_MAX_ETHPORTS]; + enum bnxt_ulp_flow_mem_type mem_type; +#define BNXT_ULP_TUN_ENTRY_INVALID -1 +#define BNXT_ULP_MAX_TUN_CACHE_ENTRIES 16 + struct bnxt_tun_cache_entry tun_tbl[BNXT_ULP_MAX_TUN_CACHE_ENTRIES]; + bool accum_stats; + uint8_t app_id; + uint8_t num_shared_clients; }; struct bnxt_ulp_context { struct bnxt_ulp_data *cfg_data; - /* TBD The tfp should be removed once tf_attach is implemented. */ struct tf *g_tfp; + struct tf *g_shared_tfp; }; struct bnxt_ulp_pci_info { @@ -45,8 +98,8 @@ struct bnxt_ulp_session_state { pthread_mutex_t bnxt_ulp_mutex; struct bnxt_ulp_pci_info pci_info; struct bnxt_ulp_data *cfg_data; - /* TBD The tfp should be removed once tf_attach is implemented. */ struct tf *g_tfp; + struct tf g_shared_tfp; uint32_t session_opened; }; @@ -61,15 +114,17 @@ struct ulp_tlv_param { uint8_t value[16]; }; +struct ulp_context_list_entry { + TAILQ_ENTRY(ulp_context_list_entry) next; + struct bnxt_ulp_context *ulp_ctx; +}; + /* * Allow the deletion of context only for the bnxt device that * created the session - * TBD - The implementation of the function should change to - * using the reference count once tf_session_attach functionality - * is fixed. */ bool -ulp_ctx_deinit_allowed(void *bp); +ulp_ctx_deinit_allowed(struct bnxt_ulp_context *ulp_ctx); /* Function to set the device id of the hardware. */ int32_t @@ -79,6 +134,16 @@ bnxt_ulp_cntxt_dev_id_set(struct bnxt_ulp_context *ulp_ctx, uint32_t dev_id); int32_t bnxt_ulp_cntxt_dev_id_get(struct bnxt_ulp_context *ulp_ctx, uint32_t *dev_id); +/* Function to get whether or not ext mem is used for EM */ +int32_t +bnxt_ulp_cntxt_mem_type_get(struct bnxt_ulp_context *ulp_ctx, + enum bnxt_ulp_flow_mem_type *mem_type); + +/* Function to set whether or not ext mem is used for EM */ +int32_t +bnxt_ulp_cntxt_mem_type_set(struct bnxt_ulp_context *ulp_ctx, + enum bnxt_ulp_flow_mem_type mem_type); + /* Function to set the table scope id of the EEM table. */ int32_t bnxt_ulp_cntxt_tbl_scope_id_set(struct bnxt_ulp_context *ulp_ctx, @@ -89,13 +154,22 @@ int32_t bnxt_ulp_cntxt_tbl_scope_id_get(struct bnxt_ulp_context *ulp_ctx, uint32_t *tbl_scope_id); +/* Function to set the tfp session details in the ulp context. */ +int32_t +bnxt_ulp_cntxt_shared_tfp_set(struct bnxt_ulp_context *ulp, struct tf *tfp); + +/* Function to get the tfp session details from ulp context. */ +struct tf * +bnxt_ulp_cntxt_shared_tfp_get(struct bnxt_ulp_context *ulp); + /* Function to set the tfp session details in the ulp context. */ int32_t bnxt_ulp_cntxt_tfp_set(struct bnxt_ulp_context *ulp, struct tf *tfp); /* Function to get the tfp session details from ulp context. */ struct tf * -bnxt_ulp_cntxt_tfp_get(struct bnxt_ulp_context *ulp); +bnxt_ulp_cntxt_tfp_get(struct bnxt_ulp_context *ulp, + enum bnxt_ulp_shared_session shared); /* Get the device table entry based on the device id. */ struct bnxt_ulp_device_params * @@ -117,6 +191,10 @@ bnxt_ulp_cntxt_ptr2_flow_db_set(struct bnxt_ulp_context *ulp_ctx, struct bnxt_ulp_flow_db * bnxt_ulp_cntxt_ptr2_flow_db_get(struct bnxt_ulp_context *ulp_ctx); +/* Function to get the tunnel cache table info from the ulp context. */ +struct bnxt_tun_cache_entry * +bnxt_ulp_cntxt_ptr2_tun_tbl_get(struct bnxt_ulp_context *ulp_ctx); + /* Function to get the ulp context from eth device. */ struct bnxt_ulp_context * bnxt_ulp_eth_dev_ptr2_cntxt_get(struct rte_eth_dev *dev); @@ -162,4 +240,65 @@ bnxt_ulp_cntxt_ptr2_fc_info_set(struct bnxt_ulp_context *ulp_ctx, struct bnxt_ulp_fc_info * bnxt_ulp_cntxt_ptr2_fc_info_get(struct bnxt_ulp_context *ulp_ctx); +int32_t +bnxt_ulp_cntxt_ptr2_ulp_flags_get(struct bnxt_ulp_context *ulp_ctx, + uint32_t *flags); + +int32_t +bnxt_ulp_get_df_rule_info(uint8_t port_id, struct bnxt_ulp_context *ulp_ctx, + struct bnxt_ulp_df_rule_info *info); + +struct bnxt_ulp_vfr_rule_info* +bnxt_ulp_cntxt_ptr2_ulp_vfr_info_get(struct bnxt_ulp_context *ulp_ctx, + uint32_t port_id); + +int32_t +bnxt_ulp_cntxt_acquire_fdb_lock(struct bnxt_ulp_context *ulp_ctx); + +void +bnxt_ulp_cntxt_release_fdb_lock(struct bnxt_ulp_context *ulp_ctx); + +int32_t +ulp_post_process_tun_flow(struct ulp_rte_parser_params *params); + +struct bnxt_ulp_glb_resource_info * +bnxt_ulp_app_glb_resource_info_list_get(uint32_t *num_entries); + +int32_t +bnxt_ulp_cntxt_app_id_set(struct bnxt_ulp_context *ulp_ctx, uint8_t app_id); + +int32_t +bnxt_ulp_cntxt_app_id_get(struct bnxt_ulp_context *ulp_ctx, uint8_t *app_id); + +bool +bnxt_ulp_cntxt_shared_session_enabled(struct bnxt_ulp_context *ulp_ctx); + +struct bnxt_ulp_app_capabilities_info * +bnxt_ulp_app_cap_list_get(uint32_t *num_entries); + +int32_t +bnxt_ulp_cntxt_app_caps_init(struct bnxt_ulp_context *ulp_ctx, + uint8_t app_id, uint32_t dev_id); + +struct bnxt_ulp_resource_resv_info * +bnxt_ulp_resource_resv_list_get(uint32_t *num_entries); + +int32_t +bnxt_ulp_cntxt_ptr2_ha_info_set(struct bnxt_ulp_context *ulp_ctx, + struct bnxt_ulp_ha_mgr_info *ulp_ha_info); + +struct bnxt_ulp_ha_mgr_info * +bnxt_ulp_cntxt_ptr2_ha_info_get(struct bnxt_ulp_context *ulp_ctx); + +bool +bnxt_ulp_cntxt_ha_enabled(struct bnxt_ulp_context *ulp_ctx); + +struct bnxt_ulp_context * +bnxt_ulp_cntxt_entry_acquire(void); + +void +bnxt_ulp_cntxt_entry_release(void); + +uint8_t +bnxt_ulp_cntxt_num_shared_clients_get(struct bnxt_ulp_context *ulp_ctx); #endif /* _BNXT_ULP_H_ */