From: ogawa.yasufumi@lab.ntt.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com, x-fn-spp@sl.ntt-tx.co.jp
Cc: Hiroyuki Nakamura <nakamura.hioryuki@po.ntt-tx.co.jp>,
Naoki Takada <takada.naoki@lab.ntt.co.jp>
Subject: [spp] [PATCH 06/28] doc: add config section
Date: Tue, 23 Jan 2018 09:28:51 +0900 [thread overview]
Message-ID: <20180123002854.28345-6-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <20180123002854.28345-1-ogawa.yasufumi@lab.ntt.co.jp>
From: Hiroyuki Nakamura <nakamura.hioryuki@po.ntt-tx.co.jp>
Add description for importing json config to explain about
how it load config using jansson library.
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
docs/spp_vf/spp_vf.md | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+)
diff --git a/docs/spp_vf/spp_vf.md b/docs/spp_vf/spp_vf.md
index b9ce299..2d06e2e 100644
--- a/docs/spp_vf/spp_vf.md
+++ b/docs/spp_vf/spp_vf.md
@@ -41,6 +41,78 @@ The following sections provide some explanation of the code.
### Configuration
+The config file is imported after rte_eal_init() and initialization
+of the application.
+spp_config_load_file() is defined in spp_config.c and default file
+path SPP_CONFIG_FILE_PATH is defined in its header file..
+
+ ```c:spp_vf.c
+ /* set default config file path */
+ strcpy(config_file_path, SPP_CONFIG_FILE_PATH);
+
+ unsigned int main_lcore_id = 0xffffffff;
+ while(1) {
+ /* Parse dpdk parameters */
+ int ret_parse = parse_dpdk_args(argc, argv);
+ if (unlikely(ret_parse != 0)) {
+ break;
+ }
+
+ /* DPDK initialize */
+ int ret_dpdk = rte_eal_init(argc, argv);
+ if (unlikely(ret_dpdk < 0)) {
+ break;
+ }
+
+ /* Skip dpdk parameters */
+ argc -= ret_dpdk;
+ argv += ret_dpdk;
+
+ /* Set log level */
+ rte_log_set_global_level(RTE_LOG_LEVEL);
+
+ /* Parse application parameters */
+ ret_parse = parse_app_args(argc, argv);
+ if (unlikely(ret_parse != 0)) {
+ break;
+ }
+
+ RTE_LOG(INFO, APP, "Load config file(%s)\n", config_file_path);
+
+ /* Load config */
+ int ret_config = spp_config_load_file(config_file_path, 0, &g_config);
+ if (unlikely(ret_config != 0)) {
+ break;
+ }
+
+ /* Get core id. */
+ main_lcore_id = rte_lcore_id();
+ ```
+
+spp_config_load_file() uses [jansson]() for parsing JSON.
+json_load_file() is a function of jansson to parse raw JSON
+file and return json_t object as a result.
+In spp_config_load_file(), configuration of classifier table and
+resource assignment of threads are loaded into config of spp.
+
+After importing config, each of threads are launched.
+
+ ```c:spp_vf.c
+ /* Start thread */
+ unsigned int lcore_id = 0;
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+ if (g_core_info[lcore_id].type == SPP_CONFIG_CLASSIFIER_MAC) {
+ rte_eal_remote_launch(spp_classifier_mac_do,
+ (void *)&g_core_info[lcore_id],
+ lcore_id);
+ } else {
+ rte_eal_remote_launch(spp_forward,
+ (void *)&g_core_info[lcore_id],
+ lcore_id);
+ }
+ }
+ ```
+
### Forwarding
### Packet Cloning
--
2.13.1
next prev parent reply other threads:[~2018-01-23 0:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-23 0:28 [spp] [PATCH 01/28] doc: add setup guide ogawa.yasufumi
2018-01-23 0:28 ` [spp] [PATCH 02/28] doc: add how_to_use.md ogawa.yasufumi
2018-01-23 0:28 ` [spp] [PATCH 03/28] doc: add config_manual.md ogawa.yasufumi
2018-01-23 0:28 ` [spp] [PATCH 04/28] doc: add spp_vf.md ogawa.yasufumi
2018-01-23 0:28 ` [spp] [PATCH 05/28] doc: revise spp_vf.md ogawa.yasufumi
2018-01-23 0:28 ` ogawa.yasufumi [this message]
2018-01-23 0:28 ` [spp] [PATCH 07/28] doc: update jp setup manual ogawa.yasufumi
2018-01-23 0:28 ` [spp] [PATCH 08/28] doc: modify figure in spp_vf_overview ogawa.yasufumi
2018-01-23 0:28 ` [spp] [PATCH 09/28] doc: add sample usage ogawa.yasufumi
2018-02-01 11:57 ` [spp] [PATCH 01/28] doc: add setup guide Ferruh Yigit
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=20180123002854.28345-6-ogawa.yasufumi@lab.ntt.co.jp \
--to=ogawa.yasufumi@lab.ntt.co.jp \
--cc=ferruh.yigit@intel.com \
--cc=nakamura.hioryuki@po.ntt-tx.co.jp \
--cc=spp@dpdk.org \
--cc=takada.naoki@lab.ntt.co.jp \
--cc=x-fn-spp@sl.ntt-tx.co.jp \
/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).