Re: [PATCH V3 for-next 1/5] RDMA/hns: Eliminate the warnings by sparse checking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Lijun,

I love your patch! Perhaps something to improve:

[auto build test WARNING on rdma/for-next]
[also build test WARNING on v4.18-rc3 next-20180706]
[cannot apply to linus/master linux-sof-driver/master]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Lijun-Ou/Four-cmd-queues-support-and-sparse-checking/20180706-143224
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1222:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1222:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1230:9: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1230:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1230:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1230:9: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1230:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1230:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1238:9: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1238:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1238:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1238:9: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1238:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1238:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1242:9: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1242:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1242:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1242:9: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1242:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1242:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1243:9: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1243:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1243:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1243:9: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1243:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1243:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1247:9: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1247:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1247:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1247:9: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1247:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1247:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1254:9: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1254:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1254:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1254:9: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1254:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1254:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1286:17: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1286:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1286:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1286:17: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1286:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1286:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1293:17: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1293:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1293:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1293:17: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1293:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1293:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1524:29: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1525:34: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1527:34: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1529:39: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1583:36: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2452:17: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2452:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2452:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2452:17: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2452:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2452:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2457:17: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2457:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2457:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2457:17: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2457:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2457:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2462:17: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2462:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2462:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2462:17: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2462:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2462:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2472:9: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2472:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2472:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2472:9: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2472:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2472:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2474:9: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2474:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2474:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2474:9: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2474:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2474:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2475:9: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2475:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2475:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2475:9: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2475:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2475:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2497:9: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2497:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2497:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2497:9: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2497:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2497:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2499:28: sparse: incorrect type in argument 1 (different base types) @@    expected restricted __le32 [usertype] *val @@    got 2 [usertype] *val @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2499:28:    expected restricted __le32 [usertype] *val
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2499:28:    got unsigned int *<noident>
>> drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2626:37: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] sq_rq_bt_l @@    got unsignrestricted __le32 [usertype] sq_rq_bt_l @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2626:37:    expected restricted __le32 [usertype] sq_rq_bt_l
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2626:37:    got unsigned int [unsigned] [usertype] <noident>
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2636:17: sparse: cast from restricted __le32
>> drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2652:42: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] cur_rq_wqe_ba_l @@    got unsignrestricted __le32 [usertype] cur_rq_wqe_ba_l @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2652:42:    expected restricted __le32 [usertype] cur_rq_wqe_ba_l
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2652:42:    got unsigned int [unsigned] [usertype] <noident>
>> drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2671:43: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] cur_sq_wqe_ba_l @@    got unsignrestricted __le32 [usertype] cur_sq_wqe_ba_l @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2671:43:    expected restricted __le32 [usertype] cur_sq_wqe_ba_l
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2671:43:    got unsigned int [unsigned] [usertype] <noident>
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2686:31: sparse: incorrect type in argument 1 (different base types) @@    expected unsigned int [unsigned] val @@    got restrunsigned int [unsigned] val @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2686:31:    expected unsigned int [unsigned] val
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2686:31:    got restricted __le32 [usertype] qp1c_bytes_4
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2687:31: sparse: incorrect type in argument 1 (different base types) @@    expected unsigned int [unsigned] val @@    got restrunsigned int [unsigned] val @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2687:31:    expected unsigned int [unsigned] val
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2687:31:    got restricted __le32 [usertype] sq_rq_bt_l
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2688:31: sparse: incorrect type in argument 1 (different base types) @@    expected unsigned int [unsigned] val @@    got restrunsigned int [unsigned] val @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2688:31:    expected unsigned int [unsigned] val
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2688:31:    got restricted __le32 [usertype] qp1c_bytes_12
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2689:31: sparse: incorrect type in argument 1 (different base types) @@    expected unsigned int [unsigned] val @@    got restrunsigned int [unsigned] val @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2689:31:    expected unsigned int [unsigned] val
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2689:31:    got restricted __le32 [usertype] qp1c_bytes_16
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2690:31: sparse: incorrect type in argument 1 (different base types) @@    expected unsigned int [unsigned] val @@    got restrunsigned int [unsigned] val @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2690:31:    expected unsigned int [unsigned] val
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2690:31:    got restricted __le32 [usertype] qp1c_bytes_20
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2691:31: sparse: incorrect type in argument 1 (different base types) @@    expected unsigned int [unsigned] val @@    got restrunsigned int [unsigned] val @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2691:31:    expected unsigned int [unsigned] val
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2691:31:    got restricted __le32 [usertype] cur_rq_wqe_ba_l
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2692:31: sparse: incorrect type in argument 1 (different base types) @@    expected unsigned int [unsigned] val @@    got restrunsigned int [unsigned] val @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2692:31:    expected unsigned int [unsigned] val
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2692:31:    got restricted __le32 [usertype] qp1c_bytes_28
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2693:31: sparse: incorrect type in argument 1 (different base types) @@    expected unsigned int [unsigned] val @@    got restrunsigned int [unsigned] val @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2693:31:    expected unsigned int [unsigned] val
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2693:31:    got restricted __le32 [usertype] qp1c_bytes_32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2694:31: sparse: incorrect type in argument 1 (different base types) @@    expected unsigned int [unsigned] val @@    got restrunsigned int [unsigned] val @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2694:31:    expected unsigned int [unsigned] val
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2694:31:    got restricted __le32 [usertype] cur_sq_wqe_ba_l
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2695:31: sparse: incorrect type in argument 1 (different base types) @@    expected unsigned int [unsigned] val @@    got restrunsigned int [unsigned] val @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2695:31:    expected unsigned int [unsigned] val
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2695:31:    got restricted __le32 [usertype] qp1c_bytes_40
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2701:9: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2701:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2701:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2701:9: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2701:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2701:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2915:37: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] sq_rq_bt_l @@    got unsignrestricted __le32 [usertype] sq_rq_bt_l @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2915:37:    expected restricted __le32 [usertype] sq_rq_bt_l
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2915:37:    got unsigned int [unsigned] [usertype] <noident>
>> drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2927:36: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] irrl_ba_l @@    got unsignrestricted __le32 [usertype] irrl_ba_l @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2927:36:    expected restricted __le32 [usertype] irrl_ba_l
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2927:36:    got unsigned int [unsigned] [usertype] <noident>
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2939:17: sparse: cast from restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3019:42: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] cur_rq_wqe_ba_l @@    got unsignrestricted __le32 [usertype] cur_rq_wqe_ba_l @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3019:42:    expected restricted __le32 [usertype] cur_rq_wqe_ba_l
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3019:42:    got unsigned int [unsigned] [usertype] <noident>
>> drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3099:45: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] rx_cur_sq_wqe_ba_l @@    got unsignrestricted __le32 [usertype] rx_cur_sq_wqe_ba_l @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3099:45:    expected restricted __le32 [usertype] rx_cur_sq_wqe_ba_l
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3099:45:    got unsigned int [unsigned] [usertype] <noident>
>> drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3247:45: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] tx_cur_sq_wqe_ba_l @@    got unsignrestricted __le32 [usertype] tx_cur_sq_wqe_ba_l @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3247:45:    expected restricted __le32 [usertype] tx_cur_sq_wqe_ba_l
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3247:45:    got unsigned int [unsigned] [usertype] <noident>
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3294:17: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3294:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3294:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3294:17: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3294:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3294:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3296:17: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3296:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3296:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3296:17: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3296:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3296:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3298:17: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3298:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3298:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3298:17: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3298:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3298:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3300:17: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3300:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3300:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3300:17: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3300:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3300:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3308:36: sparse: incorrect type in argument 1 (different base types) @@    expected restricted __le32 [usertype] *val @@    got 2 [usertype] *val @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3308:36:    expected restricted __le32 [usertype] *val
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3308:36:    got unsigned int *<noident>
>> drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3414:30: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] qp1c_bytes_4 @@    got  [usertype] qp1c_bytes_4 @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3414:30:    expected restricted __le32 [usertype] qp1c_bytes_4
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3414:30:    got unsigned int
>> drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3415:28: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] sq_rq_bt_l @@    got  [usertype] sq_rq_bt_l @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3415:28:    expected restricted __le32 [usertype] sq_rq_bt_l
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3415:28:    got unsigned int
>> drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3416:31: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] qp1c_bytes_12 @@    got  [usertype] qp1c_bytes_12 @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3416:31:    expected restricted __le32 [usertype] qp1c_bytes_12
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3416:31:    got unsigned int
>> drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3417:31: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] qp1c_bytes_16 @@    got  [usertype] qp1c_bytes_16 @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3417:31:    expected restricted __le32 [usertype] qp1c_bytes_16
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3417:31:    got unsigned int
>> drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3418:31: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] qp1c_bytes_20 @@    got  [usertype] qp1c_bytes_20 @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3418:31:    expected restricted __le32 [usertype] qp1c_bytes_20
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3418:31:    got unsigned int
>> drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3419:33: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] cur_rq_wqe_ba_l @@    got  [usertype] cur_rq_wqe_ba_l @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3419:33:    expected restricted __le32 [usertype] cur_rq_wqe_ba_l
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3419:33:    got unsigned int
>> drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3420:31: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] qp1c_bytes_28 @@    got  [usertype] qp1c_bytes_28 @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3420:31:    expected restricted __le32 [usertype] qp1c_bytes_28
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3420:31:    got unsigned int
>> drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3421:31: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] qp1c_bytes_32 @@    got  [usertype] qp1c_bytes_32 @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3421:31:    expected restricted __le32 [usertype] qp1c_bytes_32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3421:31:    got unsigned int
>> drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3422:33: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] cur_sq_wqe_ba_l @@    got  [usertype] cur_sq_wqe_ba_l @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3422:33:    expected restricted __le32 [usertype] cur_sq_wqe_ba_l
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3422:33:    got unsigned int
>> drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3423:31: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] qp1c_bytes_40 @@    got  [usertype] qp1c_bytes_40 @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3423:31:    expected restricted __le32 [usertype] qp1c_bytes_40
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3423:31:    got unsigned int
>> drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3585:28: sparse: incorrect type in assignment (different base types) @@    expected unsigned char [unsigned] [usertype] rnr_retry @@    got d char [unsigned] [usertype] rnr_retry @@
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3585:28:    expected unsigned char [unsigned] [usertype] rnr_retry
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3585:28:    got restricted __le32 [usertype] rnr_retry
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3630:19: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3633:19: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3636:14: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3637:27: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3640:27: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3646:27: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3652:36: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3655:36: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3658:25: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3658:25:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3658:25:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3658:25: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3658:25:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3658:25:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3707:21: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3710:21: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:3718:37: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:4025:17: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:4060:17: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:4096:15: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v1.c:4099:20: sparse: too many warnings
   include/linux/slab.h:631:13: sparse: undefined identifier '__builtin_mul_overflow'
   include/linux/slab.h:631:13: sparse: not a function <noident>
   include/linux/slab.h:631:13: sparse: not a function <noident>

vim +2626 drivers/infiniband/hw/hns/hns_roce_hw_v1.c

9a443537 oulijun         2016-07-21  2436  
d61d6de0 Bart Van Assche 2017-10-11  2437  static int hns_roce_v1_clear_hem(struct hns_roce_dev *hr_dev,
d61d6de0 Bart Van Assche 2017-10-11  2438  				 struct hns_roce_hem_table *table, int obj,
d61d6de0 Bart Van Assche 2017-10-11  2439  				 int step_idx)
97f0e39f Wei Hu (Xavier  2016-09-20  2440) {
97f0e39f Wei Hu (Xavier  2016-09-20  2441) 	struct device *dev = &hr_dev->pdev->dev;
97f0e39f Wei Hu (Xavier  2016-09-20  2442) 	struct hns_roce_v1_priv *priv;
97f0e39f Wei Hu (Xavier  2016-09-20  2443) 	unsigned long end = 0, flags = 0;
97f0e39f Wei Hu (Xavier  2016-09-20  2444) 	uint32_t bt_cmd_val[2] = {0};
97f0e39f Wei Hu (Xavier  2016-09-20  2445) 	void __iomem *bt_cmd;
97f0e39f Wei Hu (Xavier  2016-09-20  2446) 	u64 bt_ba = 0;
97f0e39f Wei Hu (Xavier  2016-09-20  2447) 
016a0059 Wei Hu(Xavier   2017-08-30  2448) 	priv = (struct hns_roce_v1_priv *)hr_dev->priv;
97f0e39f Wei Hu (Xavier  2016-09-20  2449) 
97f0e39f Wei Hu (Xavier  2016-09-20  2450) 	switch (table->type) {
97f0e39f Wei Hu (Xavier  2016-09-20  2451) 	case HEM_TYPE_QPC:
97f0e39f Wei Hu (Xavier  2016-09-20  2452) 		roce_set_field(bt_cmd_val[1], ROCEE_BT_CMD_H_ROCEE_BT_CMD_MDF_M,
97f0e39f Wei Hu (Xavier  2016-09-20  2453) 			ROCEE_BT_CMD_H_ROCEE_BT_CMD_MDF_S, HEM_TYPE_QPC);
97f0e39f Wei Hu (Xavier  2016-09-20  2454) 		bt_ba = priv->bt_table.qpc_buf.map >> 12;
97f0e39f Wei Hu (Xavier  2016-09-20  2455) 		break;
97f0e39f Wei Hu (Xavier  2016-09-20  2456) 	case HEM_TYPE_MTPT:
97f0e39f Wei Hu (Xavier  2016-09-20  2457) 		roce_set_field(bt_cmd_val[1], ROCEE_BT_CMD_H_ROCEE_BT_CMD_MDF_M,
97f0e39f Wei Hu (Xavier  2016-09-20  2458) 			ROCEE_BT_CMD_H_ROCEE_BT_CMD_MDF_S, HEM_TYPE_MTPT);
97f0e39f Wei Hu (Xavier  2016-09-20  2459) 		bt_ba = priv->bt_table.mtpt_buf.map >> 12;
97f0e39f Wei Hu (Xavier  2016-09-20  2460) 		break;
97f0e39f Wei Hu (Xavier  2016-09-20  2461) 	case HEM_TYPE_CQC:
97f0e39f Wei Hu (Xavier  2016-09-20  2462) 		roce_set_field(bt_cmd_val[1], ROCEE_BT_CMD_H_ROCEE_BT_CMD_MDF_M,
97f0e39f Wei Hu (Xavier  2016-09-20  2463) 			ROCEE_BT_CMD_H_ROCEE_BT_CMD_MDF_S, HEM_TYPE_CQC);
97f0e39f Wei Hu (Xavier  2016-09-20  2464) 		bt_ba = priv->bt_table.cqc_buf.map >> 12;
97f0e39f Wei Hu (Xavier  2016-09-20  2465) 		break;
97f0e39f Wei Hu (Xavier  2016-09-20  2466) 	case HEM_TYPE_SRQC:
97f0e39f Wei Hu (Xavier  2016-09-20  2467) 		dev_dbg(dev, "HEM_TYPE_SRQC not support.\n");
97f0e39f Wei Hu (Xavier  2016-09-20  2468) 		return -EINVAL;
97f0e39f Wei Hu (Xavier  2016-09-20  2469) 	default:
97f0e39f Wei Hu (Xavier  2016-09-20  2470) 		return 0;
97f0e39f Wei Hu (Xavier  2016-09-20  2471) 	}
97f0e39f Wei Hu (Xavier  2016-09-20  2472) 	roce_set_field(bt_cmd_val[1], ROCEE_BT_CMD_H_ROCEE_BT_CMD_IN_MDF_M,
97f0e39f Wei Hu (Xavier  2016-09-20  2473) 		ROCEE_BT_CMD_H_ROCEE_BT_CMD_IN_MDF_S, obj);
97f0e39f Wei Hu (Xavier  2016-09-20  2474) 	roce_set_bit(bt_cmd_val[1], ROCEE_BT_CMD_H_ROCEE_BT_CMD_S, 0);
97f0e39f Wei Hu (Xavier  2016-09-20  2475) 	roce_set_bit(bt_cmd_val[1], ROCEE_BT_CMD_H_ROCEE_BT_CMD_HW_SYNS_S, 1);
97f0e39f Wei Hu (Xavier  2016-09-20  2476) 
97f0e39f Wei Hu (Xavier  2016-09-20  2477) 	spin_lock_irqsave(&hr_dev->bt_cmd_lock, flags);
97f0e39f Wei Hu (Xavier  2016-09-20  2478) 
97f0e39f Wei Hu (Xavier  2016-09-20  2479) 	bt_cmd = hr_dev->reg_base + ROCEE_BT_CMD_H_REG;
97f0e39f Wei Hu (Xavier  2016-09-20  2480) 
97f0e39f Wei Hu (Xavier  2016-09-20  2481) 	end = msecs_to_jiffies(HW_SYNC_TIMEOUT_MSECS) + jiffies;
97f0e39f Wei Hu (Xavier  2016-09-20  2482) 	while (1) {
97f0e39f Wei Hu (Xavier  2016-09-20  2483) 		if (readl(bt_cmd) >> BT_CMD_SYNC_SHIFT) {
97f0e39f Wei Hu (Xavier  2016-09-20  2484) 			if (!(time_before(jiffies, end))) {
97f0e39f Wei Hu (Xavier  2016-09-20  2485) 				dev_err(dev, "Write bt_cmd err,hw_sync is not zero.\n");
97f0e39f Wei Hu (Xavier  2016-09-20  2486) 				spin_unlock_irqrestore(&hr_dev->bt_cmd_lock,
97f0e39f Wei Hu (Xavier  2016-09-20  2487) 					flags);
97f0e39f Wei Hu (Xavier  2016-09-20  2488) 				return -EBUSY;
97f0e39f Wei Hu (Xavier  2016-09-20  2489) 			}
97f0e39f Wei Hu (Xavier  2016-09-20  2490) 		} else {
97f0e39f Wei Hu (Xavier  2016-09-20  2491) 			break;
97f0e39f Wei Hu (Xavier  2016-09-20  2492) 		}
97f0e39f Wei Hu (Xavier  2016-09-20  2493) 		msleep(HW_SYNC_SLEEP_TIME_INTERVAL);
97f0e39f Wei Hu (Xavier  2016-09-20  2494) 	}
97f0e39f Wei Hu (Xavier  2016-09-20  2495) 
97f0e39f Wei Hu (Xavier  2016-09-20  2496) 	bt_cmd_val[0] = (uint32_t)bt_ba;
97f0e39f Wei Hu (Xavier  2016-09-20 @2497) 	roce_set_field(bt_cmd_val[1], ROCEE_BT_CMD_H_ROCEE_BT_CMD_BA_H_M,
97f0e39f Wei Hu (Xavier  2016-09-20  2498) 		ROCEE_BT_CMD_H_ROCEE_BT_CMD_BA_H_S, bt_ba >> 32);
97f0e39f Wei Hu (Xavier  2016-09-20 @2499) 	hns_roce_write64_k(bt_cmd_val, hr_dev->reg_base + ROCEE_BT_CMD_L_REG);
97f0e39f Wei Hu (Xavier  2016-09-20  2500) 
97f0e39f Wei Hu (Xavier  2016-09-20  2501) 	spin_unlock_irqrestore(&hr_dev->bt_cmd_lock, flags);
97f0e39f Wei Hu (Xavier  2016-09-20  2502) 
97f0e39f Wei Hu (Xavier  2016-09-20  2503) 	return 0;
97f0e39f Wei Hu (Xavier  2016-09-20  2504) }
97f0e39f Wei Hu (Xavier  2016-09-20  2505) 
9a443537 oulijun         2016-07-21  2506  static int hns_roce_v1_qp_modify(struct hns_roce_dev *hr_dev,
9a443537 oulijun         2016-07-21  2507  				 struct hns_roce_mtt *mtt,
9a443537 oulijun         2016-07-21  2508  				 enum hns_roce_qp_state cur_state,
9a443537 oulijun         2016-07-21  2509  				 enum hns_roce_qp_state new_state,
9a443537 oulijun         2016-07-21  2510  				 struct hns_roce_qp_context *context,
9a443537 oulijun         2016-07-21  2511  				 struct hns_roce_qp *hr_qp)
9a443537 oulijun         2016-07-21  2512  {
9a443537 oulijun         2016-07-21  2513  	static const u16
9a443537 oulijun         2016-07-21  2514  	op[HNS_ROCE_QP_NUM_STATE][HNS_ROCE_QP_NUM_STATE] = {
9a443537 oulijun         2016-07-21  2515  		[HNS_ROCE_QP_STATE_RST] = {
9a443537 oulijun         2016-07-21  2516  		[HNS_ROCE_QP_STATE_RST] = HNS_ROCE_CMD_2RST_QP,
9a443537 oulijun         2016-07-21  2517  		[HNS_ROCE_QP_STATE_ERR] = HNS_ROCE_CMD_2ERR_QP,
9a443537 oulijun         2016-07-21  2518  		[HNS_ROCE_QP_STATE_INIT] = HNS_ROCE_CMD_RST2INIT_QP,
9a443537 oulijun         2016-07-21  2519  		},
9a443537 oulijun         2016-07-21  2520  		[HNS_ROCE_QP_STATE_INIT] = {
9a443537 oulijun         2016-07-21  2521  		[HNS_ROCE_QP_STATE_RST] = HNS_ROCE_CMD_2RST_QP,
9a443537 oulijun         2016-07-21  2522  		[HNS_ROCE_QP_STATE_ERR] = HNS_ROCE_CMD_2ERR_QP,
9a443537 oulijun         2016-07-21  2523  		/* Note: In v1 engine, HW doesn't support RST2INIT.
9a443537 oulijun         2016-07-21  2524  		 * We use RST2INIT cmd instead of INIT2INIT.
9a443537 oulijun         2016-07-21  2525  		 */
9a443537 oulijun         2016-07-21  2526  		[HNS_ROCE_QP_STATE_INIT] = HNS_ROCE_CMD_RST2INIT_QP,
9a443537 oulijun         2016-07-21  2527  		[HNS_ROCE_QP_STATE_RTR] = HNS_ROCE_CMD_INIT2RTR_QP,
9a443537 oulijun         2016-07-21  2528  		},
9a443537 oulijun         2016-07-21  2529  		[HNS_ROCE_QP_STATE_RTR] = {
9a443537 oulijun         2016-07-21  2530  		[HNS_ROCE_QP_STATE_RST] = HNS_ROCE_CMD_2RST_QP,
9a443537 oulijun         2016-07-21  2531  		[HNS_ROCE_QP_STATE_ERR] = HNS_ROCE_CMD_2ERR_QP,
9a443537 oulijun         2016-07-21  2532  		[HNS_ROCE_QP_STATE_RTS] = HNS_ROCE_CMD_RTR2RTS_QP,
9a443537 oulijun         2016-07-21  2533  		},
9a443537 oulijun         2016-07-21  2534  		[HNS_ROCE_QP_STATE_RTS] = {
9a443537 oulijun         2016-07-21  2535  		[HNS_ROCE_QP_STATE_RST] = HNS_ROCE_CMD_2RST_QP,
9a443537 oulijun         2016-07-21  2536  		[HNS_ROCE_QP_STATE_ERR] = HNS_ROCE_CMD_2ERR_QP,
9a443537 oulijun         2016-07-21  2537  		[HNS_ROCE_QP_STATE_RTS] = HNS_ROCE_CMD_RTS2RTS_QP,
9a443537 oulijun         2016-07-21  2538  		[HNS_ROCE_QP_STATE_SQD] = HNS_ROCE_CMD_RTS2SQD_QP,
9a443537 oulijun         2016-07-21  2539  		},
9a443537 oulijun         2016-07-21  2540  		[HNS_ROCE_QP_STATE_SQD] = {
9a443537 oulijun         2016-07-21  2541  		[HNS_ROCE_QP_STATE_RST] = HNS_ROCE_CMD_2RST_QP,
9a443537 oulijun         2016-07-21  2542  		[HNS_ROCE_QP_STATE_ERR] = HNS_ROCE_CMD_2ERR_QP,
9a443537 oulijun         2016-07-21  2543  		[HNS_ROCE_QP_STATE_RTS] = HNS_ROCE_CMD_SQD2RTS_QP,
9a443537 oulijun         2016-07-21  2544  		[HNS_ROCE_QP_STATE_SQD] = HNS_ROCE_CMD_SQD2SQD_QP,
9a443537 oulijun         2016-07-21  2545  		},
9a443537 oulijun         2016-07-21  2546  		[HNS_ROCE_QP_STATE_ERR] = {
9a443537 oulijun         2016-07-21  2547  		[HNS_ROCE_QP_STATE_RST] = HNS_ROCE_CMD_2RST_QP,
9a443537 oulijun         2016-07-21  2548  		[HNS_ROCE_QP_STATE_ERR] = HNS_ROCE_CMD_2ERR_QP,
9a443537 oulijun         2016-07-21  2549  		}
9a443537 oulijun         2016-07-21  2550  	};
9a443537 oulijun         2016-07-21  2551  
9a443537 oulijun         2016-07-21  2552  	struct hns_roce_cmd_mailbox *mailbox;
9a443537 oulijun         2016-07-21  2553  	struct device *dev = &hr_dev->pdev->dev;
9a443537 oulijun         2016-07-21  2554  	int ret = 0;
9a443537 oulijun         2016-07-21  2555  
9a443537 oulijun         2016-07-21  2556  	if (cur_state >= HNS_ROCE_QP_NUM_STATE ||
9a443537 oulijun         2016-07-21  2557  	    new_state >= HNS_ROCE_QP_NUM_STATE ||
9a443537 oulijun         2016-07-21  2558  	    !op[cur_state][new_state]) {
9a443537 oulijun         2016-07-21  2559  		dev_err(dev, "[modify_qp]not support state %d to %d\n",
9a443537 oulijun         2016-07-21  2560  			cur_state, new_state);
9a443537 oulijun         2016-07-21  2561  		return -EINVAL;
9a443537 oulijun         2016-07-21  2562  	}
9a443537 oulijun         2016-07-21  2563  
9a443537 oulijun         2016-07-21  2564  	if (op[cur_state][new_state] == HNS_ROCE_CMD_2RST_QP)
9a443537 oulijun         2016-07-21  2565  		return hns_roce_cmd_mbox(hr_dev, 0, 0, hr_qp->qpn, 2,
9a443537 oulijun         2016-07-21  2566  					 HNS_ROCE_CMD_2RST_QP,
6b877c32 Wei Hu (Xavier  2016-11-23  2567) 					 HNS_ROCE_CMD_TIMEOUT_MSECS);
9a443537 oulijun         2016-07-21  2568  
9a443537 oulijun         2016-07-21  2569  	if (op[cur_state][new_state] == HNS_ROCE_CMD_2ERR_QP)
9a443537 oulijun         2016-07-21  2570  		return hns_roce_cmd_mbox(hr_dev, 0, 0, hr_qp->qpn, 2,
9a443537 oulijun         2016-07-21  2571  					 HNS_ROCE_CMD_2ERR_QP,
6b877c32 Wei Hu (Xavier  2016-11-23  2572) 					 HNS_ROCE_CMD_TIMEOUT_MSECS);
9a443537 oulijun         2016-07-21  2573  
9a443537 oulijun         2016-07-21  2574  	mailbox = hns_roce_alloc_cmd_mailbox(hr_dev);
9a443537 oulijun         2016-07-21  2575  	if (IS_ERR(mailbox))
9a443537 oulijun         2016-07-21  2576  		return PTR_ERR(mailbox);
9a443537 oulijun         2016-07-21  2577  
9a443537 oulijun         2016-07-21  2578  	memcpy(mailbox->buf, context, sizeof(*context));
9a443537 oulijun         2016-07-21  2579  
9a443537 oulijun         2016-07-21  2580  	ret = hns_roce_cmd_mbox(hr_dev, mailbox->dma, 0, hr_qp->qpn, 0,
9a443537 oulijun         2016-07-21  2581  				op[cur_state][new_state],
6b877c32 Wei Hu (Xavier  2016-11-23  2582) 				HNS_ROCE_CMD_TIMEOUT_MSECS);
9a443537 oulijun         2016-07-21  2583  
9a443537 oulijun         2016-07-21  2584  	hns_roce_free_cmd_mailbox(hr_dev, mailbox);
9a443537 oulijun         2016-07-21  2585  	return ret;
9a443537 oulijun         2016-07-21  2586  }
9a443537 oulijun         2016-07-21  2587  
9a443537 oulijun         2016-07-21  2588  static int hns_roce_v1_m_sqp(struct ib_qp *ibqp, const struct ib_qp_attr *attr,
9a443537 oulijun         2016-07-21  2589  			     int attr_mask, enum ib_qp_state cur_state,
9a443537 oulijun         2016-07-21  2590  			     enum ib_qp_state new_state)
9a443537 oulijun         2016-07-21  2591  {
9a443537 oulijun         2016-07-21  2592  	struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device);
9a443537 oulijun         2016-07-21  2593  	struct hns_roce_qp *hr_qp = to_hr_qp(ibqp);
9a443537 oulijun         2016-07-21  2594  	struct hns_roce_sqp_context *context;
9a443537 oulijun         2016-07-21  2595  	struct device *dev = &hr_dev->pdev->dev;
9a443537 oulijun         2016-07-21  2596  	dma_addr_t dma_handle = 0;
9a443537 oulijun         2016-07-21  2597  	int rq_pa_start;
9a443537 oulijun         2016-07-21  2598  	u32 reg_val;
9a443537 oulijun         2016-07-21  2599  	u64 *mtts;
cc4ed08b Bart Van Assche 2017-10-11  2600  	u32 __iomem *addr;
9a443537 oulijun         2016-07-21  2601  
9a443537 oulijun         2016-07-21  2602  	context = kzalloc(sizeof(*context), GFP_KERNEL);
9a443537 oulijun         2016-07-21  2603  	if (!context)
9a443537 oulijun         2016-07-21  2604  		return -ENOMEM;
9a443537 oulijun         2016-07-21  2605  
9a443537 oulijun         2016-07-21  2606  	/* Search QP buf's MTTs */
6a93c77a Shaobo Xu       2017-08-30  2607  	mtts = hns_roce_table_find(hr_dev, &hr_dev->mr_table.mtt_table,
9a443537 oulijun         2016-07-21  2608  				   hr_qp->mtt.first_seg, &dma_handle);
9a443537 oulijun         2016-07-21  2609  	if (!mtts) {
9a443537 oulijun         2016-07-21  2610  		dev_err(dev, "qp buf pa find failed\n");
9a443537 oulijun         2016-07-21  2611  		goto out;
9a443537 oulijun         2016-07-21  2612  	}
9a443537 oulijun         2016-07-21  2613  
9a443537 oulijun         2016-07-21  2614  	if (cur_state == IB_QPS_RESET && new_state == IB_QPS_INIT) {
9a443537 oulijun         2016-07-21  2615  		roce_set_field(context->qp1c_bytes_4,
9a443537 oulijun         2016-07-21  2616  			       QP1C_BYTES_4_SQ_WQE_SHIFT_M,
9a443537 oulijun         2016-07-21  2617  			       QP1C_BYTES_4_SQ_WQE_SHIFT_S,
9a443537 oulijun         2016-07-21  2618  			       ilog2((unsigned int)hr_qp->sq.wqe_cnt));
9a443537 oulijun         2016-07-21  2619  		roce_set_field(context->qp1c_bytes_4,
9a443537 oulijun         2016-07-21  2620  			       QP1C_BYTES_4_RQ_WQE_SHIFT_M,
9a443537 oulijun         2016-07-21  2621  			       QP1C_BYTES_4_RQ_WQE_SHIFT_S,
9a443537 oulijun         2016-07-21  2622  			       ilog2((unsigned int)hr_qp->rq.wqe_cnt));
9a443537 oulijun         2016-07-21  2623  		roce_set_field(context->qp1c_bytes_4, QP1C_BYTES_4_PD_M,
9a443537 oulijun         2016-07-21  2624  			       QP1C_BYTES_4_PD_S, to_hr_pd(ibqp->pd)->pdn);
9a443537 oulijun         2016-07-21  2625  
9a443537 oulijun         2016-07-21 @2626  		context->sq_rq_bt_l = (u32)(dma_handle);
9a443537 oulijun         2016-07-21  2627  		roce_set_field(context->qp1c_bytes_12,
9a443537 oulijun         2016-07-21  2628  			       QP1C_BYTES_12_SQ_RQ_BT_H_M,
9a443537 oulijun         2016-07-21  2629  			       QP1C_BYTES_12_SQ_RQ_BT_H_S,
9a443537 oulijun         2016-07-21  2630  			       ((u32)(dma_handle >> 32)));
9a443537 oulijun         2016-07-21  2631  
9a443537 oulijun         2016-07-21  2632  		roce_set_field(context->qp1c_bytes_16, QP1C_BYTES_16_RQ_HEAD_M,
9a443537 oulijun         2016-07-21  2633  			       QP1C_BYTES_16_RQ_HEAD_S, hr_qp->rq.head);
9a443537 oulijun         2016-07-21  2634  		roce_set_field(context->qp1c_bytes_16, QP1C_BYTES_16_PORT_NUM_M,
7716809e Lijun Ou        2016-09-15  2635  			       QP1C_BYTES_16_PORT_NUM_S, hr_qp->phy_port);
9a443537 oulijun         2016-07-21  2636  		roce_set_bit(context->qp1c_bytes_16,
9a443537 oulijun         2016-07-21  2637  			     QP1C_BYTES_16_SIGNALING_TYPE_S,
9a443537 oulijun         2016-07-21  2638  			     hr_qp->sq_signal_bits);
9a443537 oulijun         2016-07-21  2639  		roce_set_bit(context->qp1c_bytes_16, QP1C_BYTES_16_RQ_BA_FLG_S,
9a443537 oulijun         2016-07-21  2640  			     1);
9a443537 oulijun         2016-07-21  2641  		roce_set_bit(context->qp1c_bytes_16, QP1C_BYTES_16_SQ_BA_FLG_S,
9a443537 oulijun         2016-07-21  2642  			     1);
9a443537 oulijun         2016-07-21  2643  		roce_set_bit(context->qp1c_bytes_16, QP1C_BYTES_16_QP1_ERR_S,
9a443537 oulijun         2016-07-21  2644  			     0);
9a443537 oulijun         2016-07-21  2645  
9a443537 oulijun         2016-07-21  2646  		roce_set_field(context->qp1c_bytes_20, QP1C_BYTES_20_SQ_HEAD_M,
9a443537 oulijun         2016-07-21  2647  			       QP1C_BYTES_20_SQ_HEAD_S, hr_qp->sq.head);
9a443537 oulijun         2016-07-21  2648  		roce_set_field(context->qp1c_bytes_20, QP1C_BYTES_20_PKEY_IDX_M,
9a443537 oulijun         2016-07-21  2649  			       QP1C_BYTES_20_PKEY_IDX_S, attr->pkey_index);
9a443537 oulijun         2016-07-21  2650  
9a443537 oulijun         2016-07-21  2651  		rq_pa_start = (u32)hr_qp->rq.offset / PAGE_SIZE;
9a443537 oulijun         2016-07-21 @2652  		context->cur_rq_wqe_ba_l = (u32)(mtts[rq_pa_start]);
9a443537 oulijun         2016-07-21  2653  
9a443537 oulijun         2016-07-21  2654  		roce_set_field(context->qp1c_bytes_28,
9a443537 oulijun         2016-07-21  2655  			       QP1C_BYTES_28_CUR_RQ_WQE_BA_H_M,
9a443537 oulijun         2016-07-21  2656  			       QP1C_BYTES_28_CUR_RQ_WQE_BA_H_S,
9a443537 oulijun         2016-07-21  2657  			       (mtts[rq_pa_start]) >> 32);
9a443537 oulijun         2016-07-21  2658  		roce_set_field(context->qp1c_bytes_28,
9a443537 oulijun         2016-07-21  2659  			       QP1C_BYTES_28_RQ_CUR_IDX_M,
9a443537 oulijun         2016-07-21  2660  			       QP1C_BYTES_28_RQ_CUR_IDX_S, 0);
9a443537 oulijun         2016-07-21  2661  
9a443537 oulijun         2016-07-21  2662  		roce_set_field(context->qp1c_bytes_32,
9a443537 oulijun         2016-07-21  2663  			       QP1C_BYTES_32_RX_CQ_NUM_M,
9a443537 oulijun         2016-07-21  2664  			       QP1C_BYTES_32_RX_CQ_NUM_S,
9a443537 oulijun         2016-07-21  2665  			       to_hr_cq(ibqp->recv_cq)->cqn);
9a443537 oulijun         2016-07-21  2666  		roce_set_field(context->qp1c_bytes_32,
9a443537 oulijun         2016-07-21  2667  			       QP1C_BYTES_32_TX_CQ_NUM_M,
9a443537 oulijun         2016-07-21  2668  			       QP1C_BYTES_32_TX_CQ_NUM_S,
9a443537 oulijun         2016-07-21  2669  			       to_hr_cq(ibqp->send_cq)->cqn);
9a443537 oulijun         2016-07-21  2670  
9a443537 oulijun         2016-07-21 @2671  		context->cur_sq_wqe_ba_l  = (u32)mtts[0];
9a443537 oulijun         2016-07-21  2672  
9a443537 oulijun         2016-07-21  2673  		roce_set_field(context->qp1c_bytes_40,
9a443537 oulijun         2016-07-21  2674  			       QP1C_BYTES_40_CUR_SQ_WQE_BA_H_M,
9a443537 oulijun         2016-07-21  2675  			       QP1C_BYTES_40_CUR_SQ_WQE_BA_H_S,
9a443537 oulijun         2016-07-21  2676  			       (mtts[0]) >> 32);
9a443537 oulijun         2016-07-21  2677  		roce_set_field(context->qp1c_bytes_40,
9a443537 oulijun         2016-07-21  2678  			       QP1C_BYTES_40_SQ_CUR_IDX_M,
9a443537 oulijun         2016-07-21  2679  			       QP1C_BYTES_40_SQ_CUR_IDX_S, 0);
9a443537 oulijun         2016-07-21  2680  
9a443537 oulijun         2016-07-21  2681  		/* Copy context to QP1C register */
cc4ed08b Bart Van Assche 2017-10-11  2682  		addr = (u32 __iomem *)(hr_dev->reg_base +
cc4ed08b Bart Van Assche 2017-10-11  2683  				       ROCEE_QP1C_CFG0_0_REG +
7716809e Lijun Ou        2016-09-15  2684  				       hr_qp->phy_port * sizeof(*context));
9a443537 oulijun         2016-07-21  2685  
9a443537 oulijun         2016-07-21  2686  		writel(context->qp1c_bytes_4, addr);
9a443537 oulijun         2016-07-21  2687  		writel(context->sq_rq_bt_l, addr + 1);
9a443537 oulijun         2016-07-21  2688  		writel(context->qp1c_bytes_12, addr + 2);
9a443537 oulijun         2016-07-21  2689  		writel(context->qp1c_bytes_16, addr + 3);
9a443537 oulijun         2016-07-21  2690  		writel(context->qp1c_bytes_20, addr + 4);
9a443537 oulijun         2016-07-21  2691  		writel(context->cur_rq_wqe_ba_l, addr + 5);
9a443537 oulijun         2016-07-21  2692  		writel(context->qp1c_bytes_28, addr + 6);
9a443537 oulijun         2016-07-21  2693  		writel(context->qp1c_bytes_32, addr + 7);
9a443537 oulijun         2016-07-21  2694  		writel(context->cur_sq_wqe_ba_l, addr + 8);
c24bf895 Lijun Ou        2016-09-15  2695  		writel(context->qp1c_bytes_40, addr + 9);
9a443537 oulijun         2016-07-21  2696  	}
9a443537 oulijun         2016-07-21  2697  
9a443537 oulijun         2016-07-21  2698  	/* Modify QP1C status */
9a443537 oulijun         2016-07-21  2699  	reg_val = roce_read(hr_dev, ROCEE_QP1C_CFG0_0_REG +
7716809e Lijun Ou        2016-09-15  2700  			    hr_qp->phy_port * sizeof(*context));
9a443537 oulijun         2016-07-21 @2701  	roce_set_field(reg_val, ROCEE_QP1C_CFG0_0_ROCEE_QP1C_QP_ST_M,
9a443537 oulijun         2016-07-21  2702  		       ROCEE_QP1C_CFG0_0_ROCEE_QP1C_QP_ST_S, new_state);
9a443537 oulijun         2016-07-21  2703  	roce_write(hr_dev, ROCEE_QP1C_CFG0_0_REG +
7716809e Lijun Ou        2016-09-15  2704  		    hr_qp->phy_port * sizeof(*context), reg_val);
9a443537 oulijun         2016-07-21  2705  
9a443537 oulijun         2016-07-21  2706  	hr_qp->state = new_state;
9a443537 oulijun         2016-07-21  2707  	if (new_state == IB_QPS_RESET) {
9a443537 oulijun         2016-07-21  2708  		hns_roce_v1_cq_clean(to_hr_cq(ibqp->recv_cq), hr_qp->qpn,
9a443537 oulijun         2016-07-21  2709  				     ibqp->srq ? to_hr_srq(ibqp->srq) : NULL);
9a443537 oulijun         2016-07-21  2710  		if (ibqp->send_cq != ibqp->recv_cq)
9a443537 oulijun         2016-07-21  2711  			hns_roce_v1_cq_clean(to_hr_cq(ibqp->send_cq),
9a443537 oulijun         2016-07-21  2712  					     hr_qp->qpn, NULL);
9a443537 oulijun         2016-07-21  2713  
9a443537 oulijun         2016-07-21  2714  		hr_qp->rq.head = 0;
9a443537 oulijun         2016-07-21  2715  		hr_qp->rq.tail = 0;
9a443537 oulijun         2016-07-21  2716  		hr_qp->sq.head = 0;
9a443537 oulijun         2016-07-21  2717  		hr_qp->sq.tail = 0;
9a443537 oulijun         2016-07-21  2718  		hr_qp->sq_next_wqe = 0;
9a443537 oulijun         2016-07-21  2719  	}
9a443537 oulijun         2016-07-21  2720  
9a443537 oulijun         2016-07-21  2721  	kfree(context);
9a443537 oulijun         2016-07-21  2722  	return 0;
9a443537 oulijun         2016-07-21  2723  
9a443537 oulijun         2016-07-21  2724  out:
9a443537 oulijun         2016-07-21  2725  	kfree(context);
9a443537 oulijun         2016-07-21  2726  	return -EINVAL;
9a443537 oulijun         2016-07-21  2727  }
9a443537 oulijun         2016-07-21  2728  

:::::: The code at line 2626 was first introduced by commit
:::::: 9a4435375cd151e07c0c38fa601b00115986091b IB/hns: Add driver files for hns RoCE driver

:::::: TO: oulijun <oulijun@xxxxxxxxxx>
:::::: CC: Doug Ledford <dledford@xxxxxxxxxx>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux