diff options
author | Vishwesh M Rudramuni <vishwesh.m.rudramuni@intel.com> | 2017-09-25 03:36:02 +0530 |
---|---|---|
committer | Deepak S <deepak.s@linux.intel.com> | 2017-10-04 14:31:39 -0700 |
commit | c65d2e761955affbdb76fc31ebb188ac492c31ca (patch) | |
tree | 35224c83fa80c0f6dd297c9cee52f5894ade3c56 /common/VIL | |
parent | 74c5414a1fc7bc2e72c8b727dea974643f3c1bbe (diff) |
REST_API: rest api client implementation
JIRA: SAMPLEVNF-78
This patch implements rest api's for VNF clients. This
comprises of
* vnf api's for common functionality
* vnf api's for CGNAPT
* vnf api's for VFW
Change-Id: I56d22c64bf3ee5b0a2e536da8169ac7583499041
Signed-off-by: Vishwesh M Rudramuni <vishwesh.m.rudramuni@intel.com>
Diffstat (limited to 'common/VIL')
-rw-r--r-- | common/VIL/l2l3_stack/lib_arp.c | 19 | ||||
-rw-r--r-- | common/VIL/l2l3_stack/lib_arp.h | 20 | ||||
-rw-r--r-- | common/VIL/l2l3_stack/tsx.h | 6 | ||||
-rw-r--r-- | common/VIL/pipeline_arpicmp/pipeline_arpicmp.c | 17 | ||||
-rw-r--r-- | common/VIL/pipeline_common/pipeline_common_fe.c | 4 | ||||
-rw-r--r-- | common/VIL/pipeline_master/pipeline_master_be.c | 4 |
6 files changed, 56 insertions, 14 deletions
diff --git a/common/VIL/l2l3_stack/lib_arp.c b/common/VIL/l2l3_stack/lib_arp.c index e2f755f2..b8976d3a 100644 --- a/common/VIL/l2l3_stack/lib_arp.c +++ b/common/VIL/l2l3_stack/lib_arp.c @@ -71,7 +71,7 @@ uint32_t nd_buffer = ARP_BUF_DEFAULT; #define IN6ADDRSZ 16 #define MAX_PORTS 32 -static int my_inet_pton_ipv6(int af, const char *src, void *dst); +int my_inet_pton_ipv6(int af, const char *src, void *dst); static int inet_pton_ipv6(const char *src, unsigned char *dst); static int inet_pton_ipv4(const char *src, unsigned char *dst); static void local_arp_cache_init(void); @@ -983,10 +983,13 @@ void remove_arp_entry(struct arp_entry_data *ret_arp_data, void *arg) struct arp_timer_key *arp_key = (struct arp_timer_key *)arg; lib_arp_delete_called++; - rte_timer_stop(ret_arp_data->timer); - rte_free(ret_arp_data->timer_key); - rte_free(ret_arp_data->buf_pkts); - ret_arp_data->buf_pkts = NULL; + if (ret_arp_data->timer) { + rte_timer_stop(ret_arp_data->timer); + rte_free(ret_arp_data->timer_key); + rte_free(ret_arp_data->buf_pkts); + ret_arp_data->buf_pkts = NULL; + } + if (ARPICMP_DEBUG) { RTE_LOG(INFO, LIBARP, "ARP Entry Deleted for IP :%d.%d.%d.%d , port %d\n", @@ -1164,7 +1167,7 @@ populate_arp_entry(const struct ether_addr *hw_addr, uint32_t ipaddr, if (new_arp_data->status == STALE) { new_arp_data->status = PROBE; if (ifm_chk_port_ipv4_enabled - (new_arp_data->port)) { + (new_arp_data->port) != IFM_FAILURE) { request_arp(new_arp_data->port, new_arp_data->ip); } else { @@ -1894,7 +1897,7 @@ void process_arpicmp_pkt(struct rte_mbuf *pkt, l2_phy_interface_t *port) * author: * Paul Vixie, 1996. */ -static int my_inet_pton_ipv6(int af, const char *src, void *dst) +int my_inet_pton_ipv6(int af, const char *src, void *dst) { switch (af) { case AF_INET: @@ -2618,7 +2621,7 @@ void arp_timer_callback(struct rte_timer *timer, void *arg) } if (ifm_chk_port_ipv4_enabled - (ret_arp_data->port)) { + (ret_arp_data->port) != IFM_FAILURE) { request_arp(ret_arp_data->port, ret_arp_data->ip); } else { diff --git a/common/VIL/l2l3_stack/lib_arp.h b/common/VIL/l2l3_stack/lib_arp.h index 49b35f3d..c635c94c 100644 --- a/common/VIL/l2l3_stack/lib_arp.h +++ b/common/VIL/l2l3_stack/lib_arp.h @@ -58,6 +58,26 @@ extern void prefetch(void); extern void update_nhip_access(uint8_t); uint32_t get_arp_buf(void); uint32_t get_nd_buf(void); +extern int my_inet_pton_ipv6(int af, const char *src, void *dst); +extern struct rte_hash *arp_hash_handle; +extern struct rte_hash *nd_hash_handle; +extern uint32_t lib_arp_get_mac_req; +extern uint32_t lib_arp_nh_found; +extern uint32_t lib_arp_no_nh_found; +extern uint32_t lib_arp_arp_entry_found; +extern uint32_t lib_arp_no_arp_entry_found; +extern uint32_t lib_arp_populate_called; +extern uint32_t lib_arp_delete_called; +extern uint32_t lib_arp_duplicate_found; +extern uint32_t arp_route_tbl_index; +extern uint32_t lib_nd_get_mac_req; +extern uint32_t lib_nd_nh_found; +extern uint32_t lib_nd_no_nh_found; +extern uint32_t lib_nd_nd_entry_found; +extern uint32_t lib_nd_no_arp_entry_found; +extern uint32_t lib_nd_populate_called; +extern uint32_t lib_nd_delete_called; +extern uint32_t lib_nd_duplicate_found; enum { ARP_FOUND, diff --git a/common/VIL/l2l3_stack/tsx.h b/common/VIL/l2l3_stack/tsx.h index 8b748165..01bde702 100644 --- a/common/VIL/l2l3_stack/tsx.h +++ b/common/VIL/l2l3_stack/tsx.h @@ -16,8 +16,14 @@ #ifndef _TSX_H_ #define _RSX_H_ #include <rte_atomic.h> + +#ifndef TRUE #define TRUE 1 +#endif + +#ifndef FALSE #define FALSE 0 +#endif volatile int mutex_val; diff --git a/common/VIL/pipeline_arpicmp/pipeline_arpicmp.c b/common/VIL/pipeline_arpicmp/pipeline_arpicmp.c index 6b42ad77..607d13d1 100644 --- a/common/VIL/pipeline_arpicmp/pipeline_arpicmp.c +++ b/common/VIL/pipeline_arpicmp/pipeline_arpicmp.c @@ -70,6 +70,14 @@ struct cmd_arp_add_result { }; +uint16_t str2flowtype(char *string); +int parse_flexbytes(const char *q_arg, uint8_t *flexbytes, + uint16_t max_num); +enum rte_eth_input_set_field str2inset(char *string); +int app_pipeline_arpicmp_entry_dbg(struct app_params *app, + uint32_t pipeline_id, uint8_t *msg); + + static void cmd_arp_add_parsed(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data) @@ -952,8 +960,7 @@ cmdline_parse_inst_t cmd_set_fwd_mode = { #if 1 -static uint16_t -str2flowtype(char *string) +uint16_t str2flowtype(char *string) { uint8_t i = 0; static const struct { @@ -983,7 +990,7 @@ str2flowtype(char *string) return RTE_ETH_FLOW_UNKNOWN; } -static inline int +int parse_flexbytes(const char *q_arg, uint8_t *flexbytes, uint16_t max_num) { char s[256]; @@ -1442,7 +1449,7 @@ struct cmd_set_hash_input_set_result { cmdline_fixed_string_t select; }; -static enum rte_eth_input_set_field +enum rte_eth_input_set_field str2inset(char *string) { uint16_t i; @@ -1966,7 +1973,7 @@ cmdline_parse_inst_t cmd_set_sym_hash_ena_per_port = { }; #endif -static int +int app_pipeline_arpicmp_entry_dbg(struct app_params *app, uint32_t pipeline_id, uint8_t *msg) { diff --git a/common/VIL/pipeline_common/pipeline_common_fe.c b/common/VIL/pipeline_common/pipeline_common_fe.c index 957f5df1..6fc6109c 100644 --- a/common/VIL/pipeline_common/pipeline_common_fe.c +++ b/common/VIL/pipeline_common/pipeline_common_fe.c @@ -35,6 +35,8 @@ #include "lib_arp.h" #include "gateway.h" +void app_run_file(cmdline_parse_ctx_t *ctx, const char *file_name); + int app_pipeline_ping(struct app_params *app, uint32_t pipeline_id) @@ -1577,7 +1579,7 @@ static cmdline_parse_inst_t cmd_quit = { * run */ -static void +void app_run_file( cmdline_parse_ctx_t *ctx, const char *file_name) diff --git a/common/VIL/pipeline_master/pipeline_master_be.c b/common/VIL/pipeline_master/pipeline_master_be.c index 425e2334..cc50497e 100644 --- a/common/VIL/pipeline_master/pipeline_master_be.c +++ b/common/VIL/pipeline_master/pipeline_master_be.c @@ -28,6 +28,8 @@ #include "app.h" #include "pipeline_master_be.h" +struct cmdline *pipe_cl; + struct pipeline_master { struct app_params *app; struct cmdline *cl; @@ -59,6 +61,7 @@ pipeline_init(__rte_unused struct pipeline_params *params, void *arg) rte_free(p); return NULL; } + pipe_cl = p->cl; p->script_file_done = 0; if (app->script_file == NULL) @@ -85,6 +88,7 @@ static int pipeline_run(void *pipeline) { struct pipeline_master *p = (struct pipeline_master *) pipeline; + int status; if (p->script_file_done == 0) { |