#define ULP_FLOW_DB_RES_FUNC_BITS 28
#define ULP_FLOW_DB_RES_FUNC_MASK 0x70000000
#define ULP_FLOW_DB_RES_NXT_MASK 0x0FFFFFFF
+#define ULP_FLOW_DB_RES_FUNC_UPPER 5
+#define ULP_FLOW_DB_RES_FUNC_NEED_LOWER 0x80
+#define ULP_FLOW_DB_RES_FUNC_LOWER_MASK 0x1F
/* Macro to copy the nxt_resource_idx */
#define ULP_FLOW_DB_RES_NXT_SET(dst, src) {(dst) |= ((src) &\
* returns none
*/
static void
-ulp_flow_db_res_params_to_info(struct ulp_fdb_resource_info *resource_info,
- struct ulp_flow_db_res_params *params)
+ulp_flow_db_res_params_to_info(struct ulp_fdb_resource_info *resource_info,
+ struct ulp_flow_db_res_params *params)
{
+ uint32_t resource_func;
+
resource_info->nxt_resource_idx |= ((params->direction <<
ULP_FLOW_DB_RES_DIR_BIT) &
ULP_FLOW_DB_RES_DIR_MASK);
- resource_info->nxt_resource_idx |= ((params->resource_func <<
+ resource_func = (params->resource_func >> ULP_FLOW_DB_RES_FUNC_UPPER);
+ resource_info->nxt_resource_idx |= ((resource_func <<
ULP_FLOW_DB_RES_FUNC_BITS) &
ULP_FLOW_DB_RES_FUNC_MASK);
+ if (params->resource_func & ULP_FLOW_DB_RES_FUNC_NEED_LOWER) {
+ /* Break the resource func into two parts */
+ resource_func = (params->resource_func &
+ ULP_FLOW_DB_RES_FUNC_LOWER_MASK);
+ resource_info->resource_func_lower = resource_func;
+ }
+
+ /* Store the handle as 64bit only for EM table entries */
if (params->resource_func != BNXT_ULP_RESOURCE_FUNC_EM_TABLE) {
resource_info->resource_hndl = (uint32_t)params->resource_hndl;
resource_info->resource_type = params->resource_type;
-
+ resource_info->resource_sub_type = params->resource_sub_type;
+ resource_info->reserved = params->reserved;
} else {
resource_info->resource_em_handle = params->resource_hndl;
}
* returns none
*/
static void
-ulp_flow_db_res_info_to_params(struct ulp_fdb_resource_info *resource_info,
- struct ulp_flow_db_res_params *params)
+ulp_flow_db_res_info_to_params(struct ulp_fdb_resource_info *resource_info,
+ struct ulp_flow_db_res_params *params)
{
+ uint8_t resource_func_upper;
+
memset(params, 0, sizeof(struct ulp_flow_db_res_params));
params->direction = ((resource_info->nxt_resource_idx &
ULP_FLOW_DB_RES_DIR_MASK) >>
ULP_FLOW_DB_RES_DIR_BIT);
- params->resource_func = ((resource_info->nxt_resource_idx &
- ULP_FLOW_DB_RES_FUNC_MASK) >>
- ULP_FLOW_DB_RES_FUNC_BITS);
+ resource_func_upper = (((resource_info->nxt_resource_idx &
+ ULP_FLOW_DB_RES_FUNC_MASK) >>
+ ULP_FLOW_DB_RES_FUNC_BITS) <<
+ ULP_FLOW_DB_RES_FUNC_UPPER);
+
+ /* The reource func is split into upper and lower */
+ if (resource_func_upper & ULP_FLOW_DB_RES_FUNC_NEED_LOWER)
+ params->resource_func = (resource_func_upper |
+ resource_info->resource_func_lower);
+ else
+ params->resource_func = resource_func_upper;
- if (params->resource_func != BNXT_ULP_RESOURCE_FUNC_EM_TABLE) {
+ if (params->resource_func == BNXT_ULP_RESOURCE_FUNC_EM_TABLE) {
+ params->resource_hndl = resource_info->resource_em_handle;
+ } else if (params->resource_func & ULP_FLOW_DB_RES_FUNC_NEED_LOWER) {
params->resource_hndl = resource_info->resource_hndl;
params->resource_type = resource_info->resource_type;
- } else {
- params->resource_hndl = resource_info->resource_em_handle;
+ params->resource_sub_type = resource_info->resource_sub_type;
+ params->reserved = resource_info->reserved;
}
}
#define BNXT_FLOW_DB_DEFAULT_NUM_FLOWS 128
#define BNXT_FLOW_DB_DEFAULT_NUM_RESOURCES 5
-/* Structure for the flow database resource information. */
+/*
+ * Structure for the flow database resource information
+ * The below structure is based on the below paritions
+ * nxt_resource_idx = dir[31],resource_func_upper[30:28],nxt_resource_idx[27:0]
+ * If resource_func is EM_TBL then use resource_em_handle.
+ * Else the other part of the union is used and
+ * resource_func is resource_func_upper[30:28] << 5 | resource_func_lower
+ */
struct ulp_fdb_resource_info {
/* Points to next resource in the chained list. */
- uint32_t nxt_resource_idx;
+ uint32_t nxt_resource_idx;
union {
- uint64_t resource_em_handle;
+ uint64_t resource_em_handle;
struct {
- uint32_t resource_type;
+ uint8_t resource_func_lower;
+ uint8_t resource_type;
+ uint8_t resource_sub_type;
+ uint8_t reserved;
uint32_t resource_hndl;
};
};
struct ulp_flow_db_res_params {
enum tf_dir direction;
enum bnxt_ulp_resource_func resource_func;
+ uint8_t resource_type;
+ uint8_t resource_sub_type;
+ uint8_t reserved;
+ uint8_t critical_resource;
uint64_t resource_hndl;
- uint32_t resource_type;
- uint32_t critical_resource;
};
/*
uint16_t tbl_type,
uint16_t tbl_id)
{
- res->resource_type =
- ((uint32_t)tbl_id << ULP_MAPPER_CACHE_RES_TBL_ID_SHFT) |
- ((uint32_t)tbl_type << ULP_MAPPER_CACHE_RES_TBL_TYPE_SHFT);
+ res->resource_type = tbl_type;
+ res->resource_sub_type = tbl_id;
}
/* Extracts the tbl_type and tbl_id from the 32bit resource type. */
uint16_t *tbl_type,
uint16_t *tbl_id)
{
- *tbl_type = (uint16_t)((res->resource_type >>
- ULP_MAPPER_CACHE_RES_TBL_TYPE_SHFT) &
- ULP_MAPPER_CACHE_RES_TBL_MASK);
- *tbl_id = (uint16_t)((res->resource_type >>
- ULP_MAPPER_CACHE_RES_TBL_ID_SHFT) &
- ULP_MAPPER_CACHE_RES_TBL_MASK);
+ *tbl_type = res->resource_type;
+ *tbl_id = res->resource_sub_type;
}
static int32_t
};
enum bnxt_ulp_resource_func {
- BNXT_ULP_RESOURCE_FUNC_INVALID = 0,
- BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE = 1,
- BNXT_ULP_RESOURCE_FUNC_EM_TABLE = 2,
- BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE = 3,
- BNXT_ULP_RESOURCE_FUNC_CACHE_TABLE = 4,
- BNXT_ULP_RESOURCE_FUNC_IDENTIFIER = 5,
- BNXT_ULP_RESOURCE_FUNC_HW_FID = 6,
- BNXT_ULP_RESOURCE_FUNC_LAST = 7
+ BNXT_ULP_RESOURCE_FUNC_INVALID = 0x00,
+ BNXT_ULP_RESOURCE_FUNC_EM_TABLE = 0x20,
+ BNXT_ULP_RESOURCE_FUNC_RSVD1 = 0x40,
+ BNXT_ULP_RESOURCE_FUNC_RSVD2 = 0x60,
+ BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE = 0x80,
+ BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE = 0x81,
+ BNXT_ULP_RESOURCE_FUNC_CACHE_TABLE = 0x82,
+ BNXT_ULP_RESOURCE_FUNC_IDENTIFIER = 0x83,
+ BNXT_ULP_RESOURCE_FUNC_IF_TABLE = 0x84,
+ BNXT_ULP_RESOURCE_FUNC_HW_FID = 0x85
};
enum bnxt_ulp_result_opc {