@@ -1483,7 +1483,7 @@ static void __hns_roce_function_clear(struct hns_roce_dev *hr_dev, int vf_id)
1483
1483
if (ret )
1484
1484
continue ;
1485
1485
1486
- if (roce_get_bit (resp -> func_done , FUNC_CLEAR_RST_FUN_DONE_S )) {
1486
+ if (hr_reg_read (resp , FUNC_CLEAR_RST_FUN_DONE )) {
1487
1487
if (vf_id == 0 )
1488
1488
hr_dev -> is_reset = true;
1489
1489
return ;
@@ -2264,87 +2264,39 @@ static int hns_roce_query_pf_caps(struct hns_roce_dev *hr_dev)
2264
2264
ctx_hop_num = resp_b -> ctx_hop_num ;
2265
2265
pbl_hop_num = resp_b -> pbl_hop_num ;
2266
2266
2267
- caps -> num_pds = 1 << roce_get_field (resp_c -> cap_flags_num_pds ,
2268
- V2_QUERY_PF_CAPS_C_NUM_PDS_M ,
2269
- V2_QUERY_PF_CAPS_C_NUM_PDS_S );
2270
- caps -> flags = roce_get_field (resp_c -> cap_flags_num_pds ,
2271
- V2_QUERY_PF_CAPS_C_CAP_FLAGS_M ,
2272
- V2_QUERY_PF_CAPS_C_CAP_FLAGS_S );
2267
+ caps -> num_pds = 1 << hr_reg_read (resp_c , PF_CAPS_C_NUM_PDS );
2268
+
2269
+ caps -> flags = hr_reg_read (resp_c , PF_CAPS_C_CAP_FLAGS );
2273
2270
caps -> flags |= le16_to_cpu (resp_d -> cap_flags_ex ) <<
2274
2271
HNS_ROCE_CAP_FLAGS_EX_SHIFT ;
2275
2272
2276
- caps -> num_cqs = 1 << roce_get_field (resp_c -> max_gid_num_cqs ,
2277
- V2_QUERY_PF_CAPS_C_NUM_CQS_M ,
2278
- V2_QUERY_PF_CAPS_C_NUM_CQS_S );
2279
- caps -> gid_table_len [0 ] = roce_get_field (resp_c -> max_gid_num_cqs ,
2280
- V2_QUERY_PF_CAPS_C_MAX_GID_M ,
2281
- V2_QUERY_PF_CAPS_C_MAX_GID_S );
2282
-
2283
- caps -> max_cqes = 1 << roce_get_field (resp_c -> cq_depth ,
2284
- V2_QUERY_PF_CAPS_C_CQ_DEPTH_M ,
2285
- V2_QUERY_PF_CAPS_C_CQ_DEPTH_S );
2286
- caps -> num_mtpts = 1 << roce_get_field (resp_c -> num_mrws ,
2287
- V2_QUERY_PF_CAPS_C_NUM_MRWS_M ,
2288
- V2_QUERY_PF_CAPS_C_NUM_MRWS_S );
2289
- caps -> num_qps = 1 << roce_get_field (resp_c -> ord_num_qps ,
2290
- V2_QUERY_PF_CAPS_C_NUM_QPS_M ,
2291
- V2_QUERY_PF_CAPS_C_NUM_QPS_S );
2292
- caps -> max_qp_init_rdma = roce_get_field (resp_c -> ord_num_qps ,
2293
- V2_QUERY_PF_CAPS_C_MAX_ORD_M ,
2294
- V2_QUERY_PF_CAPS_C_MAX_ORD_S );
2273
+ caps -> num_cqs = 1 << hr_reg_read (resp_c , PF_CAPS_C_NUM_CQS );
2274
+ caps -> gid_table_len [0 ] = hr_reg_read (resp_c , PF_CAPS_C_MAX_GID );
2275
+ caps -> max_cqes = 1 << hr_reg_read (resp_c , PF_CAPS_C_CQ_DEPTH );
2276
+ caps -> num_mtpts = 1 << hr_reg_read (resp_c , PF_CAPS_C_NUM_MRWS );
2277
+ caps -> num_qps = 1 << hr_reg_read (resp_c , PF_CAPS_C_NUM_QPS );
2278
+ caps -> max_qp_init_rdma = hr_reg_read (resp_c , PF_CAPS_C_MAX_ORD );
2295
2279
caps -> max_qp_dest_rdma = caps -> max_qp_init_rdma ;
2296
2280
caps -> max_wqes = 1 << le16_to_cpu (resp_c -> sq_depth );
2297
- caps -> num_srqs = 1 << roce_get_field (resp_d -> wq_hop_num_max_srqs ,
2298
- V2_QUERY_PF_CAPS_D_NUM_SRQS_M ,
2299
- V2_QUERY_PF_CAPS_D_NUM_SRQS_S );
2300
- caps -> cong_type = roce_get_field (resp_d -> wq_hop_num_max_srqs ,
2301
- V2_QUERY_PF_CAPS_D_CONG_TYPE_M ,
2302
- V2_QUERY_PF_CAPS_D_CONG_TYPE_S );
2303
- caps -> max_srq_wrs = 1 << le16_to_cpu (resp_d -> srq_depth );
2304
2281
2305
- caps -> ceqe_depth = 1 << roce_get_field (resp_d -> num_ceqs_ceq_depth ,
2306
- V2_QUERY_PF_CAPS_D_CEQ_DEPTH_M ,
2307
- V2_QUERY_PF_CAPS_D_CEQ_DEPTH_S );
2308
- caps -> num_comp_vectors = roce_get_field (resp_d -> num_ceqs_ceq_depth ,
2309
- V2_QUERY_PF_CAPS_D_NUM_CEQS_M ,
2310
- V2_QUERY_PF_CAPS_D_NUM_CEQS_S );
2311
-
2312
- caps -> aeqe_depth = 1 << roce_get_field (resp_d -> arm_st_aeq_depth ,
2313
- V2_QUERY_PF_CAPS_D_AEQ_DEPTH_M ,
2314
- V2_QUERY_PF_CAPS_D_AEQ_DEPTH_S );
2315
- caps -> default_aeq_arm_st = roce_get_field (resp_d -> arm_st_aeq_depth ,
2316
- V2_QUERY_PF_CAPS_D_AEQ_ARM_ST_M ,
2317
- V2_QUERY_PF_CAPS_D_AEQ_ARM_ST_S );
2318
- caps -> default_ceq_arm_st = roce_get_field (resp_d -> arm_st_aeq_depth ,
2319
- V2_QUERY_PF_CAPS_D_CEQ_ARM_ST_M ,
2320
- V2_QUERY_PF_CAPS_D_CEQ_ARM_ST_S );
2321
- caps -> reserved_pds = roce_get_field (resp_d -> num_uars_rsv_pds ,
2322
- V2_QUERY_PF_CAPS_D_RSV_PDS_M ,
2323
- V2_QUERY_PF_CAPS_D_RSV_PDS_S );
2324
- caps -> num_uars = 1 << roce_get_field (resp_d -> num_uars_rsv_pds ,
2325
- V2_QUERY_PF_CAPS_D_NUM_UARS_M ,
2326
- V2_QUERY_PF_CAPS_D_NUM_UARS_S );
2327
- caps -> reserved_qps = roce_get_field (resp_d -> rsv_uars_rsv_qps ,
2328
- V2_QUERY_PF_CAPS_D_RSV_QPS_M ,
2329
- V2_QUERY_PF_CAPS_D_RSV_QPS_S );
2330
- caps -> reserved_uars = roce_get_field (resp_d -> rsv_uars_rsv_qps ,
2331
- V2_QUERY_PF_CAPS_D_RSV_UARS_M ,
2332
- V2_QUERY_PF_CAPS_D_RSV_UARS_S );
2333
- caps -> reserved_mrws = roce_get_field (resp_e -> chunk_size_shift_rsv_mrws ,
2334
- V2_QUERY_PF_CAPS_E_RSV_MRWS_M ,
2335
- V2_QUERY_PF_CAPS_E_RSV_MRWS_S );
2336
- caps -> chunk_sz = 1 << roce_get_field (resp_e -> chunk_size_shift_rsv_mrws ,
2337
- V2_QUERY_PF_CAPS_E_CHUNK_SIZE_SHIFT_M ,
2338
- V2_QUERY_PF_CAPS_E_CHUNK_SIZE_SHIFT_S );
2339
- caps -> reserved_cqs = roce_get_field (resp_e -> rsv_cqs ,
2340
- V2_QUERY_PF_CAPS_E_RSV_CQS_M ,
2341
- V2_QUERY_PF_CAPS_E_RSV_CQS_S );
2342
- caps -> reserved_srqs = roce_get_field (resp_e -> rsv_srqs ,
2343
- V2_QUERY_PF_CAPS_E_RSV_SRQS_M ,
2344
- V2_QUERY_PF_CAPS_E_RSV_SRQS_S );
2345
- caps -> reserved_lkey = roce_get_field (resp_e -> rsv_lkey ,
2346
- V2_QUERY_PF_CAPS_E_RSV_LKEYS_M ,
2347
- V2_QUERY_PF_CAPS_E_RSV_LKEYS_S );
2282
+ caps -> num_srqs = 1 << hr_reg_read (resp_d , PF_CAPS_D_NUM_SRQS );
2283
+ caps -> cong_type = hr_reg_read (resp_d , PF_CAPS_D_CONG_TYPE );
2284
+ caps -> max_srq_wrs = 1 << le16_to_cpu (resp_d -> srq_depth );
2285
+ caps -> ceqe_depth = 1 << hr_reg_read (resp_d , PF_CAPS_D_CEQ_DEPTH );
2286
+ caps -> num_comp_vectors = hr_reg_read (resp_d , PF_CAPS_D_NUM_CEQS );
2287
+ caps -> aeqe_depth = 1 << hr_reg_read (resp_d , PF_CAPS_D_AEQ_DEPTH );
2288
+ caps -> default_aeq_arm_st = hr_reg_read (resp_d , PF_CAPS_D_AEQ_ARM_ST );
2289
+ caps -> default_ceq_arm_st = hr_reg_read (resp_d , PF_CAPS_D_CEQ_ARM_ST );
2290
+ caps -> reserved_pds = hr_reg_read (resp_d , PF_CAPS_D_RSV_PDS );
2291
+ caps -> num_uars = 1 << hr_reg_read (resp_d , PF_CAPS_D_NUM_UARS );
2292
+ caps -> reserved_qps = hr_reg_read (resp_d , PF_CAPS_D_RSV_QPS );
2293
+ caps -> reserved_uars = hr_reg_read (resp_d , PF_CAPS_D_RSV_UARS );
2294
+
2295
+ caps -> reserved_mrws = hr_reg_read (resp_e , PF_CAPS_E_RSV_MRWS );
2296
+ caps -> chunk_sz = 1 << hr_reg_read (resp_e , PF_CAPS_E_CHUNK_SIZE_SHIFT );
2297
+ caps -> reserved_cqs = hr_reg_read (resp_e , PF_CAPS_E_RSV_CQS );
2298
+ caps -> reserved_srqs = hr_reg_read (resp_e , PF_CAPS_E_RSV_SRQS );
2299
+ caps -> reserved_lkey = hr_reg_read (resp_e , PF_CAPS_E_RSV_LKEYS );
2348
2300
caps -> default_ceq_max_cnt = le16_to_cpu (resp_e -> ceq_max_cnt );
2349
2301
caps -> default_ceq_period = le16_to_cpu (resp_e -> ceq_period );
2350
2302
caps -> default_aeq_max_cnt = le16_to_cpu (resp_e -> aeq_max_cnt );
@@ -2359,15 +2311,9 @@ static int hns_roce_query_pf_caps(struct hns_roce_dev *hr_dev)
2359
2311
caps -> cqe_hop_num = pbl_hop_num ;
2360
2312
caps -> srqwqe_hop_num = pbl_hop_num ;
2361
2313
caps -> idx_hop_num = pbl_hop_num ;
2362
- caps -> wqe_sq_hop_num = roce_get_field (resp_d -> wq_hop_num_max_srqs ,
2363
- V2_QUERY_PF_CAPS_D_SQWQE_HOP_NUM_M ,
2364
- V2_QUERY_PF_CAPS_D_SQWQE_HOP_NUM_S );
2365
- caps -> wqe_sge_hop_num = roce_get_field (resp_d -> wq_hop_num_max_srqs ,
2366
- V2_QUERY_PF_CAPS_D_EX_SGE_HOP_NUM_M ,
2367
- V2_QUERY_PF_CAPS_D_EX_SGE_HOP_NUM_S );
2368
- caps -> wqe_rq_hop_num = roce_get_field (resp_d -> wq_hop_num_max_srqs ,
2369
- V2_QUERY_PF_CAPS_D_RQWQE_HOP_NUM_M ,
2370
- V2_QUERY_PF_CAPS_D_RQWQE_HOP_NUM_S );
2314
+ caps -> wqe_sq_hop_num = hr_reg_read (resp_d , PF_CAPS_D_SQWQE_HOP_NUM );
2315
+ caps -> wqe_sge_hop_num = hr_reg_read (resp_d , PF_CAPS_D_EX_SGE_HOP_NUM );
2316
+ caps -> wqe_rq_hop_num = hr_reg_read (resp_d , PF_CAPS_D_RQWQE_HOP_NUM );
2371
2317
2372
2318
return 0 ;
2373
2319
}
@@ -5905,7 +5851,7 @@ static struct hns_roce_aeqe *next_aeqe_sw_v2(struct hns_roce_eq *eq)
5905
5851
(eq -> cons_index & (eq -> entries - 1 )) *
5906
5852
eq -> eqe_size );
5907
5853
5908
- return (roce_get_bit (aeqe -> asyn , HNS_ROCE_V2_AEQ_AEQE_OWNER_S ) ^
5854
+ return (hr_reg_read (aeqe , AEQE_OWNER ) ^
5909
5855
!!(eq -> cons_index & eq -> entries )) ? aeqe : NULL ;
5910
5856
}
5911
5857
@@ -5925,15 +5871,9 @@ static int hns_roce_v2_aeq_int(struct hns_roce_dev *hr_dev,
5925
5871
*/
5926
5872
dma_rmb ();
5927
5873
5928
- event_type = roce_get_field (aeqe -> asyn ,
5929
- HNS_ROCE_V2_AEQE_EVENT_TYPE_M ,
5930
- HNS_ROCE_V2_AEQE_EVENT_TYPE_S );
5931
- sub_type = roce_get_field (aeqe -> asyn ,
5932
- HNS_ROCE_V2_AEQE_SUB_TYPE_M ,
5933
- HNS_ROCE_V2_AEQE_SUB_TYPE_S );
5934
- queue_num = roce_get_field (aeqe -> event .queue_event .num ,
5935
- HNS_ROCE_V2_AEQE_EVENT_QUEUE_NUM_M ,
5936
- HNS_ROCE_V2_AEQE_EVENT_QUEUE_NUM_S );
5874
+ event_type = hr_reg_read (aeqe , AEQE_EVENT_TYPE );
5875
+ sub_type = hr_reg_read (aeqe , AEQE_SUB_TYPE );
5876
+ queue_num = hr_reg_read (aeqe , AEQE_EVENT_QUEUE_NUM );
5937
5877
5938
5878
switch (event_type ) {
5939
5879
case HNS_ROCE_EVENT_TYPE_PATH_MIG :
@@ -5993,8 +5933,8 @@ static struct hns_roce_ceqe *next_ceqe_sw_v2(struct hns_roce_eq *eq)
5993
5933
(eq -> cons_index & (eq -> entries - 1 )) *
5994
5934
eq -> eqe_size );
5995
5935
5996
- return (!!( roce_get_bit ( ceqe -> comp , HNS_ROCE_V2_CEQ_CEQE_OWNER_S )) ) ^
5997
- ( !!(eq -> cons_index & eq -> entries )) ? ceqe : NULL ;
5936
+ return (hr_reg_read ( ceqe , CEQE_OWNER ) ^
5937
+ !!(eq -> cons_index & eq -> entries )) ? ceqe : NULL ;
5998
5938
}
5999
5939
6000
5940
static int hns_roce_v2_ceq_int (struct hns_roce_dev * hr_dev ,
@@ -6010,8 +5950,7 @@ static int hns_roce_v2_ceq_int(struct hns_roce_dev *hr_dev,
6010
5950
*/
6011
5951
dma_rmb ();
6012
5952
6013
- cqn = roce_get_field (ceqe -> comp , HNS_ROCE_V2_CEQE_COMP_CQN_M ,
6014
- HNS_ROCE_V2_CEQE_COMP_CQN_S );
5953
+ cqn = hr_reg_read (ceqe , CEQE_CQN );
6015
5954
6016
5955
hns_roce_cq_completion (hr_dev , cqn );
6017
5956
0 commit comments