summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepak S <deepak.s@linux.intel.com>2017-10-17 15:39:56 +0530
committerDeepak S <deepak.s@linux.intel.com>2017-10-17 03:18:10 -0700
commit9d00f69286db5234160d1729c76e437cc24a4f18 (patch)
tree1775a1a93f49d4407a9f67759397070998ec1656
parent55a4eb6880487b04272c6bada82e21b898cbd44e (diff)
Rest API: Fix all the bugs in the HWLB, mask issue, etc
Change-Id: If7cc44f3b57a54aef510f729930e6f79bf83689e Signed-off-by: Deepak S <deepak.s@linux.intel.com>
-rw-r--r--VNFs/vFW/vnf_template.txt5
-rw-r--r--common/vnf_common/config_parse.c2
-rw-r--r--common/vnf_common/rest_api.c74
3 files changed, 47 insertions, 34 deletions
diff --git a/VNFs/vFW/vnf_template.txt b/VNFs/vFW/vnf_template.txt
index ed8253be..b0f482d5 100644
--- a/VNFs/vFW/vnf_template.txt
+++ b/VNFs/vFW/vnf_template.txt
@@ -4,7 +4,7 @@ core = 0
[ARPICMP]
type = ARPICMP
-core = 1
+core = 0
pktq_in = SWQ0
pktq_out = TXQ0.0 TXQ1.0
pktq_in_prv = RXQ0.0
@@ -13,7 +13,7 @@ prv_que_handler = (0)
[TIMER]
type = TIMER
-core = 2
+core = 0
n_flows = 1048576
[TXRX-BEGIN]
@@ -64,7 +64,6 @@ timer_period = 100
max_clients_per_ip = 65535
max_port_per_client = 10
public_ip_port_range = 98103214:(1, 65535)
-vnf_set = (3,4,5)
pkt_type = ipv4
cgnapt_meta_offset = 128
prv_que_handler = (0,)
diff --git a/common/vnf_common/config_parse.c b/common/vnf_common/config_parse.c
index 48921f46..05c54da9 100644
--- a/common/vnf_common/config_parse.c
+++ b/common/vnf_common/config_parse.c
@@ -39,7 +39,7 @@
uint32_t rest_support = 1;
static struct app_params app_params_default = {
- .config_file = "./config/ip_pipeline.cfg",
+ .config_file = "./ip_pipeline.cfg",
.log_level = APP_LOG_LEVEL_HIGH,
.port_mask = 0,
diff --git a/common/vnf_common/rest_api.c b/common/vnf_common/rest_api.c
index 03fbb41d..9cfbe88f 100644
--- a/common/vnf_common/rest_api.c
+++ b/common/vnf_common/rest_api.c
@@ -1487,6 +1487,17 @@ void init_stat_cfg(void)
}
}
+static void set_port_mask(uint64_t num_ports)
+{
+ uint64_t i;
+ uint64_t mask = 0;
+
+ for (i = 0; i < num_ports; i++) {
+ mask |= (0x1 << i);
+ }
+ rapp->port_mask = mask;
+}
+
void bind_the_ports(struct mg_connection *conn, char *pci_white_list)
{
char *token;
@@ -1497,12 +1508,12 @@ void bind_the_ports(struct mg_connection *conn, char *pci_white_list)
while(token != NULL) {
mg_printf(conn, "%s ****\n", token);
- sprintf(buf, "$RTE_SDK/usertools/dpdk-devbind.py -u %s", token);
+ sprintf(buf, "dpdk-devbind -u %s", token);
ret = system(buf);
if (ret)
mg_printf(conn, "wrong parameter sent\n");
- sprintf(buf, "$RTE_SDK/usertools/dpdk-devbind.py -b igb_uio %s", token);
+ sprintf(buf, "dpdk-devbind -b igb_uio %s", token);
ret = system(buf);
if (ret)
mg_printf(conn, "wrong parameter sent\n");
@@ -1512,6 +1523,7 @@ void bind_the_ports(struct mg_connection *conn, char *pci_white_list)
x++;
}
current_cfg.num_ports = x;
+ set_port_mask(x);
}
int static_cfg_handler(struct mg_connection *conn, __rte_unused void *cbdata)
@@ -1592,6 +1604,7 @@ int static_cfg_handler(struct mg_connection *conn, __rte_unused void *cbdata)
if (values) {
memcpy(&current_cfg.ip_range[pub_ip++].value, json_object_get_string(values),
strlen(json_object_get_string(values)));
+ current_cfg.num_workers = atoi(json_object_get_string(values));
}
json_object_object_get_ex(jobj, "pkt_type", &values);
@@ -1744,35 +1757,36 @@ void fix_pipelines_data_types(FILE *f, const char *sect_name, struct rte_cfgfile
}
if (strncmp(entries[i].name, "core", strlen(entries[i].name)) == 0) {
- if ((strncmp(sect_name, "MASTER", strlen(sect_name)) == 0) &&
+ if (((strncmp(sect_name, "MASTER", strlen(sect_name)) == 0) ||
+ (strncmp(sect_name, "TIMER", strlen(sect_name)) == 0) ||
+ (strncmp(sect_name, "ARPICMP", strlen(sect_name)) == 0)) &&
!current_cfg.sock_in) {
- continue;
- }
-
- if ((current_cfg.hyper_thread) && hyper) {
- sprintf(str, "s%dc%dh", current_cfg.sock_in,
+ sprintf(str, "s%dc%d", current_cfg.sock_in,
sock_cpus[current_cfg.sock_in][sock_index]);
memcpy(entries[i].value, &str, 8);
- sock_index++;
hyper = 0;
continue;
}
-
- sprintf(str, "s%dc%d", current_cfg.sock_in,
- sock_cpus[current_cfg.sock_in][sock_index]);
-
- if (!current_cfg.hyper_thread)
- sock_index++;
- else
- hyper = 1;
-
- if (current_cfg.sock_in) {
- if (sock_index == sock1)
- sock_index = 1;
- } else {
- if (sock_index == sock0)
- sock_index = 1;
- }
+
+ if ((strncmp(sect_name, "TXRX-BEGIN", strlen(sect_name)) == 0) || (strncmp(sect_name, "LOADB", strlen(sect_name)) == 0) ||
+ (strncmp(sect_name, "TXRX-END", strlen(sect_name)) == 0)) {
+ sock_index++;
+ sprintf(str, "s%dc%d", current_cfg.sock_in,
+ sock_cpus[current_cfg.sock_in][sock_index]);
+ memcpy(entries[i].value, &str, 8);
+ hyper = 0;
+ continue;
+ } else {
+ if (!hyper) {
+ sock_index++;
+ sprintf(str, "s%dc%d", current_cfg.sock_in, sock_cpus[current_cfg.sock_in][sock_index]);
+ if (current_cfg.hyper_thread)
+ hyper = 1;
+ } else {
+ sprintf(str, "s%dc%dh", current_cfg.sock_in, sock_cpus[current_cfg.sock_in][sock_index]);
+ hyper = 0;
+ }
+ }
memcpy(entries[i].value, &str, 8);
}
}
@@ -2018,7 +2032,7 @@ void fix_pipelines_data_types(FILE *f, const char *sect_name, struct rte_cfgfile
workers = 0;
}
} else {
- if (current_cfg.num_ports > 2) {
+ if (workers == (current_cfg.num_workers/current_cfg.num_lb)) {
tx_start_port += 2;
rx_start_port += 2;
workers = 0;
@@ -2085,7 +2099,7 @@ void build_pipeline(void)
printf("Wrong VNF TYPE\n");
if (vnf_index == VNF_VCGNAPT)
- pipe_arr[i++] = 2;
+ pipe_arr[i++] = 2;
if (!current_cfg.sw_lb) {
for (k = 0; k < current_cfg.num_workers; k++)
@@ -2363,7 +2377,7 @@ rest_api_init(struct app_params *app)
if (ctx == NULL) {
printf("REST server did not start\n");
printf("REST services will not be supported.. Try again ");
- printf("by disabling other webservers\n");
+ printf("by disabling other webservers running on port 80\n");
goto end;
}
@@ -2393,10 +2407,10 @@ rest_api_init(struct app_params *app)
mg_set_request_handler(ctx, "/vnf/quit", cmd_quit_handler, 0);
- printf("Waiting for config input for 30 secs\n");
+ printf("Waiting for config input.... via rest\n");
index = 0;
while(1) {
- if (post_not_received == 0 || (index == 30))
+ if (post_not_received == 0)
break;
sleep(1);
index++;