hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/infiniband/hw/i40iw/i40iw_ctrl.c
....@@ -1022,6 +1022,95 @@
10221022 }
10231023
10241024 /**
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
+/**
10251114 * i40iw_sc_query_fpm_values_done - poll for cqp wqe completion for query fpm
10261115 * @cqp: struct for cqp hw
10271116 */
....@@ -1875,7 +1964,6 @@
18751964 info->out_rdrsp = true;
18761965 break;
18771966 case I40IW_AE_SOURCE_RSVD:
1878
- /* fallthrough */
18791967 default:
18801968 break;
18811969 }
....@@ -3673,14 +3761,14 @@
36733761 LS_64(1, I40IW_CQPSQ_UPESD_ENTRY_VALID)));
36743762
36753763 set_64bit_val(wqe, 56, info->entry[2].data);
3676
- /* fallthrough */
3764
+ fallthrough;
36773765 case 2:
36783766 set_64bit_val(wqe, 32,
36793767 (LS_64(info->entry[1].cmd, I40IW_CQPSQ_UPESD_SDCMD) |
36803768 LS_64(1, I40IW_CQPSQ_UPESD_ENTRY_VALID)));
36813769
36823770 set_64bit_val(wqe, 40, info->entry[1].data);
3683
- /* fallthrough */
3771
+ fallthrough;
36843772 case 1:
36853773 set_64bit_val(wqe, 0,
36863774 LS_64(info->entry[0].cmd, I40IW_CQPSQ_UPESD_SDCMD));
....@@ -4265,6 +4353,13 @@
42654353 true,
42664354 I40IW_CQP_WAIT_EVENT);
42674355 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;
42684363 default:
42694364 status = I40IW_NOT_SUPPORTED;
42704365 break;