.. | .. |
---|
1022 | 1022 | } |
---|
1023 | 1023 | |
---|
1024 | 1024 | /** |
---|
| 1025 | + * i40iw_sc_query_rdma_features_done - poll cqp for query features done |
---|
| 1026 | + * @cqp: struct for cqp hw |
---|
| 1027 | + */ |
---|
| 1028 | +static enum i40iw_status_code |
---|
| 1029 | +i40iw_sc_query_rdma_features_done(struct i40iw_sc_cqp *cqp) |
---|
| 1030 | +{ |
---|
| 1031 | + return i40iw_sc_poll_for_cqp_op_done( |
---|
| 1032 | + cqp, I40IW_CQP_OP_QUERY_RDMA_FEATURES, NULL); |
---|
| 1033 | +} |
---|
| 1034 | + |
---|
| 1035 | +/** |
---|
| 1036 | + * i40iw_sc_query_rdma_features - query rdma features |
---|
| 1037 | + * @cqp: struct for cqp hw |
---|
| 1038 | + * @feat_mem: holds PA for HW to use |
---|
| 1039 | + * @scratch: u64 saved to be used during cqp completion |
---|
| 1040 | + */ |
---|
| 1041 | +static enum i40iw_status_code |
---|
| 1042 | +i40iw_sc_query_rdma_features(struct i40iw_sc_cqp *cqp, |
---|
| 1043 | + struct i40iw_dma_mem *feat_mem, u64 scratch) |
---|
| 1044 | +{ |
---|
| 1045 | + u64 *wqe; |
---|
| 1046 | + u64 header; |
---|
| 1047 | + |
---|
| 1048 | + wqe = i40iw_sc_cqp_get_next_send_wqe(cqp, scratch); |
---|
| 1049 | + if (!wqe) |
---|
| 1050 | + return I40IW_ERR_RING_FULL; |
---|
| 1051 | + |
---|
| 1052 | + set_64bit_val(wqe, 32, feat_mem->pa); |
---|
| 1053 | + |
---|
| 1054 | + header = LS_64(I40IW_CQP_OP_QUERY_RDMA_FEATURES, I40IW_CQPSQ_OPCODE) | |
---|
| 1055 | + LS_64(cqp->polarity, I40IW_CQPSQ_WQEVALID) | feat_mem->size; |
---|
| 1056 | + |
---|
| 1057 | + i40iw_insert_wqe_hdr(wqe, header); |
---|
| 1058 | + |
---|
| 1059 | + i40iw_debug_buf(cqp->dev, I40IW_DEBUG_WQE, "QUERY RDMA FEATURES WQE", |
---|
| 1060 | + wqe, I40IW_CQP_WQE_SIZE * 8); |
---|
| 1061 | + |
---|
| 1062 | + i40iw_sc_cqp_post_sq(cqp); |
---|
| 1063 | + |
---|
| 1064 | + return 0; |
---|
| 1065 | +} |
---|
| 1066 | + |
---|
| 1067 | +/** |
---|
| 1068 | + * i40iw_get_rdma_features - get RDMA features |
---|
| 1069 | + * @dev - sc device struct |
---|
| 1070 | + */ |
---|
| 1071 | +enum i40iw_status_code i40iw_get_rdma_features(struct i40iw_sc_dev *dev) |
---|
| 1072 | +{ |
---|
| 1073 | + enum i40iw_status_code ret_code; |
---|
| 1074 | + struct i40iw_dma_mem feat_buf; |
---|
| 1075 | + u64 temp; |
---|
| 1076 | + u16 byte_idx, feat_type, feat_cnt; |
---|
| 1077 | + |
---|
| 1078 | + ret_code = i40iw_allocate_dma_mem(dev->hw, &feat_buf, |
---|
| 1079 | + I40IW_FEATURE_BUF_SIZE, |
---|
| 1080 | + I40IW_FEATURE_BUF_ALIGNMENT); |
---|
| 1081 | + |
---|
| 1082 | + if (ret_code) |
---|
| 1083 | + return I40IW_ERR_NO_MEMORY; |
---|
| 1084 | + |
---|
| 1085 | + ret_code = i40iw_sc_query_rdma_features(dev->cqp, &feat_buf, 0); |
---|
| 1086 | + if (!ret_code) |
---|
| 1087 | + ret_code = i40iw_sc_query_rdma_features_done(dev->cqp); |
---|
| 1088 | + |
---|
| 1089 | + if (ret_code) |
---|
| 1090 | + goto exit; |
---|
| 1091 | + |
---|
| 1092 | + get_64bit_val(feat_buf.va, 0, &temp); |
---|
| 1093 | + feat_cnt = RS_64(temp, I40IW_FEATURE_CNT); |
---|
| 1094 | + if (feat_cnt < I40IW_MAX_FEATURES) { |
---|
| 1095 | + ret_code = I40IW_ERR_INVALID_FEAT_CNT; |
---|
| 1096 | + goto exit; |
---|
| 1097 | + } else if (feat_cnt > I40IW_MAX_FEATURES) { |
---|
| 1098 | + i40iw_debug(dev, I40IW_DEBUG_CQP, |
---|
| 1099 | + "features buf size insufficient\n"); |
---|
| 1100 | + } |
---|
| 1101 | + |
---|
| 1102 | + for (byte_idx = 0, feat_type = 0; feat_type < I40IW_MAX_FEATURES; |
---|
| 1103 | + feat_type++, byte_idx += 8) { |
---|
| 1104 | + get_64bit_val((u64 *)feat_buf.va, byte_idx, &temp); |
---|
| 1105 | + dev->feature_info[feat_type] = RS_64(temp, I40IW_FEATURE_INFO); |
---|
| 1106 | + } |
---|
| 1107 | +exit: |
---|
| 1108 | + i40iw_free_dma_mem(dev->hw, &feat_buf); |
---|
| 1109 | + |
---|
| 1110 | + return ret_code; |
---|
| 1111 | +} |
---|
| 1112 | + |
---|
| 1113 | +/** |
---|
1025 | 1114 | * i40iw_sc_query_fpm_values_done - poll for cqp wqe completion for query fpm |
---|
1026 | 1115 | * @cqp: struct for cqp hw |
---|
1027 | 1116 | */ |
---|
.. | .. |
---|
1875 | 1964 | info->out_rdrsp = true; |
---|
1876 | 1965 | break; |
---|
1877 | 1966 | case I40IW_AE_SOURCE_RSVD: |
---|
1878 | | - /* fallthrough */ |
---|
1879 | 1967 | default: |
---|
1880 | 1968 | break; |
---|
1881 | 1969 | } |
---|
.. | .. |
---|
3673 | 3761 | LS_64(1, I40IW_CQPSQ_UPESD_ENTRY_VALID))); |
---|
3674 | 3762 | |
---|
3675 | 3763 | set_64bit_val(wqe, 56, info->entry[2].data); |
---|
3676 | | - /* fallthrough */ |
---|
| 3764 | + fallthrough; |
---|
3677 | 3765 | case 2: |
---|
3678 | 3766 | set_64bit_val(wqe, 32, |
---|
3679 | 3767 | (LS_64(info->entry[1].cmd, I40IW_CQPSQ_UPESD_SDCMD) | |
---|
3680 | 3768 | LS_64(1, I40IW_CQPSQ_UPESD_ENTRY_VALID))); |
---|
3681 | 3769 | |
---|
3682 | 3770 | set_64bit_val(wqe, 40, info->entry[1].data); |
---|
3683 | | - /* fallthrough */ |
---|
| 3771 | + fallthrough; |
---|
3684 | 3772 | case 1: |
---|
3685 | 3773 | set_64bit_val(wqe, 0, |
---|
3686 | 3774 | LS_64(info->entry[0].cmd, I40IW_CQPSQ_UPESD_SDCMD)); |
---|
.. | .. |
---|
4265 | 4353 | true, |
---|
4266 | 4354 | I40IW_CQP_WAIT_EVENT); |
---|
4267 | 4355 | break; |
---|
| 4356 | + case OP_QUERY_RDMA_FEATURES: |
---|
| 4357 | + values_mem.pa = pcmdinfo->in.u.query_rdma_features.cap_pa; |
---|
| 4358 | + values_mem.va = pcmdinfo->in.u.query_rdma_features.cap_va; |
---|
| 4359 | + status = i40iw_sc_query_rdma_features( |
---|
| 4360 | + pcmdinfo->in.u.query_rdma_features.cqp, &values_mem, |
---|
| 4361 | + pcmdinfo->in.u.query_rdma_features.scratch); |
---|
| 4362 | + break; |
---|
4268 | 4363 | default: |
---|
4269 | 4364 | status = I40IW_NOT_SUPPORTED; |
---|
4270 | 4365 | break; |
---|