* [spp] [PATCH 1/1] spp_vf: return secondary process type
@ 2018-11-21 1:36 x-fn-spp
2018-11-28 2:48 ` Yasufumi Ogawa
0 siblings, 1 reply; 2+ messages in thread
From: x-fn-spp @ 2018-11-21 1:36 UTC (permalink / raw)
To: ferruh.yigit, ogawa.yasufumi; +Cc: spp
From: Hideyuki Yamashita <yamashita.hideyuki@po.ntt-tx.co.jp>
spp-ctl requires to be notified ID and type from secondary processes
while registering. This update is to change to return the secondary type
of `none`, `vf` or `mirror`.
Signed-off-by: Hideyuki Yamashita <yamashita.hideyuki@po.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
src/vf/common/command_proc.c | 34 ++++++++++++++++++++++++++++++++++
src/vf/common/spp_proc.h | 9 +++++++++
src/vf/spp_vf.c | 4 +++-
3 files changed, 46 insertions(+), 1 deletion(-)
diff --git a/src/vf/common/command_proc.c b/src/vf/common/command_proc.c
index e6a9fab..cf35ce0 100644
--- a/src/vf/common/command_proc.c
+++ b/src/vf/common/command_proc.c
@@ -66,6 +66,18 @@ struct command_response_list {
int (*func)(const char *name, char **output, void *tmp);
};
+/*
+ * seconary type string list
+ * do it same the order enum secondary_type (spp_proc.h)
+ */
+const char *SECONDARY_PROCESS_TYPE_SRINGS[] = {
+ "none",
+ "vf",
+ "mirror",
+
+ /* termination */ "",
+};
+
/*
* port ability string list
* do it same as the order of enum spp_port_ability_type (spp_vf.h)
@@ -101,6 +113,17 @@ spp_get_client_id(void)
return startup_param->client_id;
}
+/* get process type */
+static int
+spp_get_process_type(void)
+{
+ struct startup_param *startup_param;
+
+ spp_get_mng_data_addr(&startup_param,
+ NULL, NULL, NULL, NULL, NULL, NULL);
+ return startup_param->secondary_type;
+}
+
/* Check if port has been flushed. */
static int
spp_check_flush_port(enum port_type iface_type, int iface_no)
@@ -886,6 +909,15 @@ append_interface_array(char **output, const enum port_type type)
return SPP_RET_OK;
}
+/* append a secondary process type for JSON format */
+static int
+append_process_type_value(const char *name, char **output,
+ void *tmp __attribute__ ((unused)))
+{
+ return append_json_str_value(name, output,
+ SECONDARY_PROCESS_TYPE_SRINGS[spp_get_process_type()]);
+}
+
/* append a list of interface numbers for JSON format */
static int
append_interface_value(const char *name, char **output,
@@ -1465,6 +1497,8 @@ send_command_result_response(int *sock,
"client id response.\n");
return;
}
+ ret = append_process_type_value("process_type",
+ &tmp_buff, NULL);
}
/* append info value */
diff --git a/src/vf/common/spp_proc.h b/src/vf/common/spp_proc.h
index 8bb43ec..4001c21 100644
--- a/src/vf/common/spp_proc.h
+++ b/src/vf/common/spp_proc.h
@@ -148,6 +148,13 @@ enum copy_mng_flg {
COPY_MNG_FLG_ALLCOPY,
};
+/* secondary process type used only from spp_vf and spp_mirror */
+enum secondary_type {
+ SECONDARY_TYPE_NONE,
+ SECONDARY_TYPE_VF,
+ SECONDARY_TYPE_MIRROR,
+};
+
/**
* Interface information structure
*/
@@ -218,6 +225,8 @@ struct startup_param {
/* IP address stiring of spp-ctl */
int server_port; /* Port Number of spp-ctl */
int vhost_client; /* Flag for --vhost-client option */
+ enum secondary_type secondary_type;
+ /* secondary type */
};
/* Manage number of interfaces and port information as global variable */
diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index 7ceb88f..4e4a8e1 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -171,10 +171,12 @@ parse_app_args(int argc, char *argv[])
usage(progname);
return SPP_RET_NG;
}
+ g_startup_param.secondary_type = SECONDARY_TYPE_VF;
RTE_LOG(INFO, APP,
- "app opts (client_id=%d,server=%s:%d,"
+ "app opts (client_id=%d,type=%d,server=%s:%d,"
"vhost_client=%d)\n",
g_startup_param.client_id,
+ g_startup_param.secondary_type,
g_startup_param.server_ip,
g_startup_param.server_port,
g_startup_param.vhost_client);
--
2.18.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [spp] [PATCH 1/1] spp_vf: return secondary process type
2018-11-21 1:36 [spp] [PATCH 1/1] spp_vf: return secondary process type x-fn-spp
@ 2018-11-28 2:48 ` Yasufumi Ogawa
0 siblings, 0 replies; 2+ messages in thread
From: Yasufumi Ogawa @ 2018-11-28 2:48 UTC (permalink / raw)
To: x-fn-spp, spp; +Cc: ferruh.yigit
> spp-ctl requires to be notified ID and type from secondary processes
> while registering. This update is to change to return the secondary type
> of `none`, `vf` or `mirror`.
Thsi patche is applied. Thanks!
Acked-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
>
> Signed-off-by: Hideyuki Yamashita <yamashita.hideyuki@po.ntt-tx.co.jp>
> Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
> ---
> src/vf/common/command_proc.c | 34 ++++++++++++++++++++++++++++++++++
> src/vf/common/spp_proc.h | 9 +++++++++
> src/vf/spp_vf.c | 4 +++-
> 3 files changed, 46 insertions(+), 1 deletion(-)
>
> diff --git a/src/vf/common/command_proc.c b/src/vf/common/command_proc.c
> index e6a9fab..cf35ce0 100644
> --- a/src/vf/common/command_proc.c
> +++ b/src/vf/common/command_proc.c
> @@ -66,6 +66,18 @@ struct command_response_list {
> int (*func)(const char *name, char **output, void *tmp);
> };
>
> +/*
> + * seconary type string list
> + * do it same the order enum secondary_type (spp_proc.h)
> + */
> +const char *SECONDARY_PROCESS_TYPE_SRINGS[] = {
> + "none",
> + "vf",
> + "mirror",
> +
> + /* termination */ "",
> +};
> +
> /*
> * port ability string list
> * do it same as the order of enum spp_port_ability_type (spp_vf.h)
> @@ -101,6 +113,17 @@ spp_get_client_id(void)
> return startup_param->client_id;
> }
>
> +/* get process type */
> +static int
> +spp_get_process_type(void)
> +{
> + struct startup_param *startup_param;
> +
> + spp_get_mng_data_addr(&startup_param,
> + NULL, NULL, NULL, NULL, NULL, NULL);
> + return startup_param->secondary_type;
> +}
> +
> /* Check if port has been flushed. */
> static int
> spp_check_flush_port(enum port_type iface_type, int iface_no)
> @@ -886,6 +909,15 @@ append_interface_array(char **output, const enum port_type type)
> return SPP_RET_OK;
> }
>
> +/* append a secondary process type for JSON format */
> +static int
> +append_process_type_value(const char *name, char **output,
> + void *tmp __attribute__ ((unused)))
> +{
> + return append_json_str_value(name, output,
> + SECONDARY_PROCESS_TYPE_SRINGS[spp_get_process_type()]);
> +}
> +
> /* append a list of interface numbers for JSON format */
> static int
> append_interface_value(const char *name, char **output,
> @@ -1465,6 +1497,8 @@ send_command_result_response(int *sock,
> "client id response.\n");
> return;
> }
> + ret = append_process_type_value("process_type",
> + &tmp_buff, NULL);
> }
>
> /* append info value */
> diff --git a/src/vf/common/spp_proc.h b/src/vf/common/spp_proc.h
> index 8bb43ec..4001c21 100644
> --- a/src/vf/common/spp_proc.h
> +++ b/src/vf/common/spp_proc.h
> @@ -148,6 +148,13 @@ enum copy_mng_flg {
> COPY_MNG_FLG_ALLCOPY,
> };
>
> +/* secondary process type used only from spp_vf and spp_mirror */
> +enum secondary_type {
> + SECONDARY_TYPE_NONE,
> + SECONDARY_TYPE_VF,
> + SECONDARY_TYPE_MIRROR,
> +};
> +
> /**
> * Interface information structure
> */
> @@ -218,6 +225,8 @@ struct startup_param {
> /* IP address stiring of spp-ctl */
> int server_port; /* Port Number of spp-ctl */
> int vhost_client; /* Flag for --vhost-client option */
> + enum secondary_type secondary_type;
> + /* secondary type */
> };
>
> /* Manage number of interfaces and port information as global variable */
> diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
> index 7ceb88f..4e4a8e1 100644
> --- a/src/vf/spp_vf.c
> +++ b/src/vf/spp_vf.c
> @@ -171,10 +171,12 @@ parse_app_args(int argc, char *argv[])
> usage(progname);
> return SPP_RET_NG;
> }
> + g_startup_param.secondary_type = SECONDARY_TYPE_VF;
> RTE_LOG(INFO, APP,
> - "app opts (client_id=%d,server=%s:%d,"
> + "app opts (client_id=%d,type=%d,server=%s:%d,"
> "vhost_client=%d)\n",
> g_startup_param.client_id,
> + g_startup_param.secondary_type,
> g_startup_param.server_ip,
> g_startup_param.server_port,
> g_startup_param.vhost_client);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-11-28 2:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-21 1:36 [spp] [PATCH 1/1] spp_vf: return secondary process type x-fn-spp
2018-11-28 2:48 ` Yasufumi Ogawa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).