@@ -7208,6 +7208,72 @@ static int bnxt_alloc_all_ctx_pg_info(struct bnxt *bp, int ctx_max)
7208
7208
return 0 ;
7209
7209
}
7210
7210
7211
+ #define BNXT_CTX_INIT_VALID (flags ) \
7212
+ (!!((flags) & \
7213
+ FUNC_BACKING_STORE_QCAPS_V2_RESP_FLAGS_ENABLE_CTX_KIND_INIT))
7214
+
7215
+ static int bnxt_hwrm_func_backing_store_qcaps_v2 (struct bnxt * bp )
7216
+ {
7217
+ struct hwrm_func_backing_store_qcaps_v2_output * resp ;
7218
+ struct hwrm_func_backing_store_qcaps_v2_input * req ;
7219
+ u16 last_valid_type = BNXT_CTX_INV ;
7220
+ struct bnxt_ctx_mem_info * ctx ;
7221
+ u16 type ;
7222
+ int rc ;
7223
+
7224
+ rc = hwrm_req_init (bp , req , HWRM_FUNC_BACKING_STORE_QCAPS_V2 );
7225
+ if (rc )
7226
+ return rc ;
7227
+
7228
+ ctx = kzalloc (sizeof (* ctx ), GFP_KERNEL );
7229
+ if (!ctx )
7230
+ return - ENOMEM ;
7231
+ bp -> ctx = ctx ;
7232
+
7233
+ resp = hwrm_req_hold (bp , req );
7234
+
7235
+ for (type = 0 ; type < BNXT_CTX_V2_MAX ; ) {
7236
+ struct bnxt_ctx_mem_type * ctxm = & ctx -> ctx_arr [type ];
7237
+ u8 init_val , init_off , i ;
7238
+ __le32 * p ;
7239
+ u32 flags ;
7240
+
7241
+ req -> type = cpu_to_le16 (type );
7242
+ rc = hwrm_req_send (bp , req );
7243
+ if (rc )
7244
+ goto ctx_done ;
7245
+ flags = le32_to_cpu (resp -> flags );
7246
+ type = le16_to_cpu (resp -> next_valid_type );
7247
+ if (!(flags & FUNC_BACKING_STORE_QCAPS_V2_RESP_FLAGS_TYPE_VALID ))
7248
+ continue ;
7249
+
7250
+ ctxm -> type = le16_to_cpu (resp -> type );
7251
+ last_valid_type = ctxm -> type ;
7252
+ ctxm -> entry_size = le16_to_cpu (resp -> entry_size );
7253
+ ctxm -> flags = flags ;
7254
+ ctxm -> instance_bmap = le32_to_cpu (resp -> instance_bit_map );
7255
+ ctxm -> entry_multiple = resp -> entry_multiple ;
7256
+ ctxm -> max_entries = le32_to_cpu (resp -> max_num_entries );
7257
+ ctxm -> min_entries = le32_to_cpu (resp -> min_num_entries );
7258
+ init_val = resp -> ctx_init_value ;
7259
+ init_off = resp -> ctx_init_offset ;
7260
+ bnxt_init_ctx_initializer (ctxm , init_val , init_off ,
7261
+ BNXT_CTX_INIT_VALID (flags ));
7262
+ ctxm -> split_entry_cnt = min_t (u8 , resp -> subtype_valid_cnt ,
7263
+ BNXT_MAX_SPLIT_ENTRY );
7264
+ for (i = 0 , p = & resp -> split_entry_0 ; i < ctxm -> split_entry_cnt ;
7265
+ i ++ , p ++ )
7266
+ ctxm -> split [i ] = le32_to_cpu (* p );
7267
+ }
7268
+ if (last_valid_type < BNXT_CTX_V2_MAX )
7269
+ ctx -> ctx_arr [last_valid_type ].last = true;
7270
+ rc = bnxt_alloc_all_ctx_pg_info (bp , BNXT_CTX_V2_MAX );
7271
+
7272
+ ctx_done :
7273
+ hwrm_req_drop (bp , req );
7274
+ return rc ;
7275
+ }
7276
+
7211
7277
static int bnxt_hwrm_func_backing_store_qcaps (struct bnxt * bp )
7212
7278
{
7213
7279
struct hwrm_func_backing_store_qcaps_output * resp ;
@@ -7217,6 +7283,9 @@ static int bnxt_hwrm_func_backing_store_qcaps(struct bnxt *bp)
7217
7283
if (bp -> hwrm_spec_code < 0x10902 || BNXT_VF (bp ) || bp -> ctx )
7218
7284
return 0 ;
7219
7285
7286
+ if (bp -> fw_cap & BNXT_FW_CAP_BACKING_STORE_V2 )
7287
+ return bnxt_hwrm_func_backing_store_qcaps_v2 (bp );
7288
+
7220
7289
rc = hwrm_req_init (bp , req , HWRM_FUNC_BACKING_STORE_QCAPS );
7221
7290
if (rc )
7222
7291
return rc ;
@@ -7229,13 +7298,15 @@ static int bnxt_hwrm_func_backing_store_qcaps(struct bnxt *bp)
7229
7298
u8 init_val , init_idx = 0 ;
7230
7299
u16 init_mask ;
7231
7300
7232
- ctx = kzalloc ( sizeof ( * ctx ), GFP_KERNEL ) ;
7301
+ ctx = bp -> ctx ;
7233
7302
if (!ctx ) {
7234
- rc = - ENOMEM ;
7235
- goto ctx_err ;
7303
+ ctx = kzalloc (sizeof (* ctx ), GFP_KERNEL );
7304
+ if (!ctx ) {
7305
+ rc = - ENOMEM ;
7306
+ goto ctx_err ;
7307
+ }
7308
+ bp -> ctx = ctx ;
7236
7309
}
7237
- bp -> ctx = ctx ;
7238
-
7239
7310
init_val = resp -> ctx_kind_initializer ;
7240
7311
init_mask = le16_to_cpu (resp -> ctx_init_mask );
7241
7312
@@ -7607,7 +7678,7 @@ void bnxt_free_ctx_mem(struct bnxt *bp)
7607
7678
if (!ctx )
7608
7679
return ;
7609
7680
7610
- for (type = 0 ; type < BNXT_CTX_MAX ; type ++ ) {
7681
+ for (type = 0 ; type < BNXT_CTX_V2_MAX ; type ++ ) {
7611
7682
struct bnxt_ctx_mem_type * ctxm = & ctx -> ctx_arr [type ];
7612
7683
struct bnxt_ctx_pg_info * ctx_pg = ctxm -> pg_info ;
7613
7684
int i , n = 1 ;
@@ -7914,6 +7985,8 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
7914
7985
bp -> fw_cap |= BNXT_FW_CAP_HOT_RESET_IF ;
7915
7986
if (BNXT_PF (bp ) && (flags_ext & FUNC_QCAPS_RESP_FLAGS_EXT_FW_LIVEPATCH_SUPPORTED ))
7916
7987
bp -> fw_cap |= BNXT_FW_CAP_LIVEPATCH ;
7988
+ if (flags_ext & FUNC_QCAPS_RESP_FLAGS_EXT_BS_V2_SUPPORTED )
7989
+ bp -> fw_cap |= BNXT_FW_CAP_BACKING_STORE_V2 ;
7917
7990
7918
7991
flags_ext2 = le32_to_cpu (resp -> flags_ext2 );
7919
7992
if (flags_ext2 & FUNC_QCAPS_RESP_FLAGS_EXT2_RX_ALL_PKTS_TIMESTAMPS_SUPPORTED )
0 commit comments