+static int
+ice_hash_parse_raw_pattern(struct ice_adapter *ad,
+ const struct rte_flow_item *item,
+ struct ice_rss_meta *meta)
+{
+ const struct rte_flow_item_raw *raw_spec, *raw_mask;
+ struct ice_parser_profile prof;
+ struct ice_parser_result rslt;
+ uint8_t *pkt_buf, *msk_buf;
+ uint8_t spec_len, pkt_len;
+ uint8_t tmp_val = 0;
+ uint8_t tmp_c = 0;
+ int i, j;
+
+ if (ad->psr == NULL)
+ return -rte_errno;
+
+ raw_spec = item->spec;
+ raw_mask = item->mask;
+
+ spec_len = strlen((char *)(uintptr_t)raw_spec->pattern);
+ if (strlen((char *)(uintptr_t)raw_mask->pattern) !=
+ spec_len)
+ return -rte_errno;
+
+ pkt_len = spec_len / 2;
+
+ pkt_buf = rte_zmalloc(NULL, pkt_len, 0);
+ if (!pkt_buf)
+ return -ENOMEM;
+
+ msk_buf = rte_zmalloc(NULL, pkt_len, 0);
+ if (!msk_buf)
+ return -ENOMEM;
+
+ /* convert string to int array */
+ for (i = 0, j = 0; i < spec_len; i += 2, j++) {
+ tmp_c = raw_spec->pattern[i];
+ if (tmp_c >= 'a' && tmp_c <= 'f')
+ tmp_val = tmp_c - 'a' + 10;
+ if (tmp_c >= 'A' && tmp_c <= 'F')
+ tmp_val = tmp_c - 'A' + 10;
+ if (tmp_c >= '0' && tmp_c <= '9')
+ tmp_val = tmp_c - '0';
+
+ tmp_c = raw_spec->pattern[i + 1];
+ if (tmp_c >= 'a' && tmp_c <= 'f')
+ pkt_buf[j] = tmp_val * 16 + tmp_c - 'a' + 10;
+ if (tmp_c >= 'A' && tmp_c <= 'F')
+ pkt_buf[j] = tmp_val * 16 + tmp_c - 'A' + 10;
+ if (tmp_c >= '0' && tmp_c <= '9')
+ pkt_buf[j] = tmp_val * 16 + tmp_c - '0';
+
+ tmp_c = raw_mask->pattern[i];
+ if (tmp_c >= 'a' && tmp_c <= 'f')
+ tmp_val = tmp_c - 0x57;
+ if (tmp_c >= 'A' && tmp_c <= 'F')
+ tmp_val = tmp_c - 0x37;
+ if (tmp_c >= '0' && tmp_c <= '9')
+ tmp_val = tmp_c - '0';
+
+ tmp_c = raw_mask->pattern[i + 1];
+ if (tmp_c >= 'a' && tmp_c <= 'f')
+ msk_buf[j] = tmp_val * 16 + tmp_c - 'a' + 10;
+ if (tmp_c >= 'A' && tmp_c <= 'F')
+ msk_buf[j] = tmp_val * 16 + tmp_c - 'A' + 10;
+ if (tmp_c >= '0' && tmp_c <= '9')
+ msk_buf[j] = tmp_val * 16 + tmp_c - '0';
+ }
+
+ if (ice_parser_run(ad->psr, pkt_buf, pkt_len, &rslt))
+ return -rte_errno;
+
+ if (ice_parser_profile_init(&rslt, pkt_buf, msk_buf,
+ pkt_len, ICE_BLK_RSS, true, &prof))
+ return -rte_errno;
+
+ rte_memcpy(&meta->raw.prof, &prof, sizeof(prof));
+
+ rte_free(pkt_buf);
+ rte_free(msk_buf);
+ return 0;
+}
+