+static int
+qat_gen4_reset_ring_pair(struct qat_pci_device *qat_pci_dev)
+{
+ int ret = 0, i;
+ uint8_t data[4];
+ struct qat_pf2vf_msg pf2vf_msg;
+
+ pf2vf_msg.msg_type = ADF_VF2PF_MSGTYPE_RP_RESET;
+ pf2vf_msg.block_hdr = -1;
+ for (i = 0; i < QAT_GEN4_BUNDLE_NUM; i++) {
+ pf2vf_msg.msg_data = i;
+ ret = qat_pf2vf_exch_msg(qat_pci_dev, pf2vf_msg, 1, data);
+ if (ret) {
+ QAT_LOG(ERR, "QAT error when reset bundle no %d",
+ i);
+ return ret;
+ }
+ }
+
+ return 0;
+}
+
+int qat_query_svc(struct qat_pci_device *qat_dev, uint8_t *val)
+{
+ int ret = -(EINVAL);
+ struct qat_pf2vf_msg pf2vf_msg;
+
+ if (qat_dev->qat_dev_gen == QAT_GEN4) {
+ pf2vf_msg.msg_type = ADF_VF2PF_MSGTYPE_GET_SMALL_BLOCK_REQ;
+ pf2vf_msg.block_hdr = ADF_VF2PF_BLOCK_MSG_GET_RING_TO_SVC_REQ;
+ pf2vf_msg.msg_data = 2;
+ ret = qat_pf2vf_exch_msg(qat_dev, pf2vf_msg, 2, val);
+ }
+
+ return ret;
+}
+
+
+static void qat_dev_parse_cmd(const char *str, struct qat_dev_cmd_param
+ *qat_dev_cmd_param)
+{
+ int i = 0;
+ const char *param;
+
+ while (1) {
+ char value_str[4] = { };
+
+ param = qat_dev_cmd_param[i].name;
+ if (param == NULL)
+ return;
+ long value = 0;
+ const char *arg = strstr(str, param);
+ const char *arg2 = NULL;
+
+ if (arg) {
+ arg2 = arg + strlen(param);
+ if (*arg2 != '=') {
+ QAT_LOG(DEBUG, "parsing error '=' sign"
+ " should immediately follow %s",
+ param);
+ arg2 = NULL;
+ } else
+ arg2++;
+ } else {
+ QAT_LOG(DEBUG, "%s not provided", param);
+ }
+ if (arg2) {
+ int iter = 0;
+ while (iter < 2) {
+ if (!isdigit(*(arg2 + iter)))
+ break;
+ iter++;
+ }
+ if (!iter) {
+ QAT_LOG(DEBUG, "parsing error %s"
+ " no number provided",
+ param);
+ } else {
+ memcpy(value_str, arg2, iter);
+ value = strtol(value_str, NULL, 10);
+ if (value > MAX_QP_THRESHOLD_SIZE) {
+ QAT_LOG(DEBUG, "Exceeded max size of"
+ " threshold, setting to %d",
+ MAX_QP_THRESHOLD_SIZE);
+ value = MAX_QP_THRESHOLD_SIZE;
+ }
+ QAT_LOG(DEBUG, "parsing %s = %ld",
+ param, value);
+ }
+ }
+ qat_dev_cmd_param[i].val = value;
+ i++;
+ }
+}
+