};
/** Maximum size for pattern in struct rte_flow_item_raw. */
-#define ITEM_RAW_PATTERN_SIZE 40
+#define ITEM_RAW_PATTERN_SIZE 512
/** Maximum size for GENEVE option data pattern in bytes. */
#define ITEM_GENEVE_OPT_DATA_SIZE 124
},
[COMMON_POLICY_ID] = {
.name = "{policy_id}",
- .type = "POLCIY_ID",
+ .type = "POLICY_ID",
.help = "policy id",
.call = parse_int,
.comp = comp_none,
},
[TUNNEL_DESTROY] = {
.name = "destroy",
- .help = "destroy tunel",
+ .help = "destroy tunnel",
.next = NEXT(NEXT_ENTRY(TUNNEL_DESTROY_ID),
NEXT_ENTRY(COMMON_PORT_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, port)),
},
[TUNNEL_DESTROY_ID] = {
.name = "id",
- .help = "tunnel identifier to testroy",
+ .help = "tunnel identifier to destroy",
.next = NEXT(NEXT_ENTRY(COMMON_UNSIGNED)),
.args = ARGS(ARGS_ENTRY(struct tunnel_ops, id)),
.call = parse_tunnel,
struct rte_flow_item_l2tpv2 *l2tpv2_mask;
struct rte_flow_item *item;
uint32_t data_size;
- uint8_t msg_type = 0;
+ uint16_t msg_type = 0;
struct buffer *out = buf;
const struct arg *arg;
static int
parse_hex_string(const char *src, uint8_t *dst, uint32_t *size)
{
- char *c = NULL;
- uint32_t i, len;
- char tmp[3];
+ const uint8_t *head = dst;
+ uint32_t left;
/* Check input parameters */
if ((src == NULL) ||
(*size == 0))
return -1;
+ left = *size;
+
/* Convert chars to bytes */
- for (i = 0, len = 0; i < *size; i += 2) {
- snprintf(tmp, 3, "%s", src + i);
- dst[len++] = strtoul(tmp, &c, 16);
- if (*c != 0) {
- len--;
- dst[len] = 0;
- *size = len;
+ while (left) {
+ char tmp[3], *end = tmp;
+ uint32_t read_lim = left & 1 ? 1 : 2;
+
+ snprintf(tmp, read_lim + 1, "%s", src);
+ *dst = strtoul(tmp, &end, 16);
+ if (*end) {
+ *dst = 0;
+ *size = (uint32_t)(dst - head);
return -1;
}
+ left -= read_lim;
+ src += read_lim;
+ dst++;
}
- dst[len] = 0;
- *size = len;
-
+ *dst = 0;
+ *size = (uint32_t)(dst - head);
return 0;
}
uint8_t qfi:6;
uint8_t next;
} psc;
- psc.len = sizeof(psc);
+ psc.len = sizeof(psc) / 4;
psc.pdu_type = opt->hdr.type;
psc.qfi = opt->hdr.qfi;
psc.next = 0;