/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
uint32_t key_offset;
uint32_t hash_offset;
uint8_t key_mask[PIPELINE_FC_FLOW_KEY_MAX_SIZE];
+ uint32_t key_mask_present;
uint32_t flow_id_offset;
} __rte_cache_aligned;
uint32_t flow_id_offset_present = 0;
uint32_t i;
- char key_mask_str[PIPELINE_FC_FLOW_KEY_MAX_SIZE * 2];
+ char key_mask_str[PIPELINE_FC_FLOW_KEY_MAX_SIZE * 2 + 1];
p->hash_offset = 0;
params->name, arg_name);
key_mask_present = 1;
- PIPELINE_ARG_CHECK((mask_str_len <
+ PIPELINE_ARG_CHECK((mask_str_len <=
(PIPELINE_FC_FLOW_KEY_MAX_SIZE * 2)),
"Parse error in section \"%s\": entry "
"\"%s\" is too long", params->name,
arg_name);
- snprintf(key_mask_str, mask_str_len, "%s",
+ snprintf(key_mask_str, mask_str_len + 1, "%s",
arg_value);
continue;
uint32_t key_size = p->key_size;
int status;
+ PIPELINE_ARG_CHECK(((key_size == 8) || (key_size == 16)),
+ "Parse error in section \"%s\": entry key_mask "
+ "only allowed for key_size of 8 or 16 bytes",
+ params->name);
+
PIPELINE_ARG_CHECK((strlen(key_mask_str) ==
(key_size * 2)), "Parse error in section "
"\"%s\": key_mask should have exactly %u hex "
"digits", params->name, (key_size * 2));
+ PIPELINE_ARG_CHECK((hash_offset_present == 0), "Parse "
+ "error in section \"%s\": entry hash_offset only "
+ "allowed when key_mask is not present",
+ params->name);
+
status = parse_hex_string(key_mask_str, p->key_mask,
&p->key_size);
"key_mask", key_mask_str);
}
+ p->key_mask_present = key_mask_present;
+
return 0;
}
.arg_create = pipeline_port_out_params_convert(
¶ms->port_out[i]),
.f_action = NULL,
- .f_action_bulk = NULL,
.arg_ah = NULL,
};
.signature_offset = p_fc->hash_offset,
.key_offset = p_fc->key_offset,
.f_hash = hash_func[(p_fc->key_size / 8) - 1],
- .key_mask = p_fc->key_mask,
+ .key_mask = (p_fc->key_mask_present) ?
+ p_fc->key_mask : NULL,
.seed = 0,
};
.signature_offset = p_fc->hash_offset,
.key_offset = p_fc->key_offset,
.f_hash = hash_func[(p_fc->key_size / 8) - 1],
- .key_mask = p_fc->key_mask,
+ .key_mask = (p_fc->key_mask_present) ?
+ p_fc->key_mask : NULL,
.seed = 0,
};
return 0;
}
-static int
-pipeline_fc_track(void *pipeline,
- __rte_unused uint32_t port_in,
- uint32_t *port_out)
-{
- struct pipeline *p = (struct pipeline *) pipeline;
-
- /* Check input arguments */
- if ((p == NULL) ||
- (port_in >= p->n_ports_in) ||
- (port_out == NULL))
- return -1;
-
- if (p->n_ports_in == 1) {
- *port_out = 0;
- return 0;
- }
-
- return -1;
-}
-
static int
pipeline_fc_timer(void *pipeline)
{
.f_free = pipeline_fc_free,
.f_run = NULL,
.f_timer = pipeline_fc_timer,
- .f_track = pipeline_fc_track,
};