From: x-fn-spp@sl.ntt-tx.co.jp
To: ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Cc: spp@dpdk.org
Subject: [spp] [PATCH 1/1] spp_vf: return secondary process type
Date: Wed, 21 Nov 2018 10:36:29 +0900 [thread overview]
Message-ID: <201811210136.wAL1aUGj009819@imss03.silk.ntt-tx.co.jp> (raw)
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
next reply other threads:[~2018-11-21 1:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-21 1:36 x-fn-spp [this message]
2018-11-28 2:48 ` Yasufumi Ogawa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201811210136.wAL1aUGj009819@imss03.silk.ntt-tx.co.jp \
--to=x-fn-spp@sl.ntt-tx.co.jp \
--cc=ferruh.yigit@intel.com \
--cc=ogawa.yasufumi@lab.ntt.co.jp \
--cc=spp@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).