get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/41216/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 41216,
    "url": "http://patches.dpdk.org/api/patches/41216/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180615165224.25004-23-jasvinder.singh@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20180615165224.25004-23-jasvinder.singh@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180615165224.25004-23-jasvinder.singh@intel.com",
    "date": "2018-06-15T16:52:24",
    "name": "[v2,22/22] app/testpmd: rework softnic forward mode",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "a5595e8f9b65475a678da661958492d7babe7612",
    "submitter": {
        "id": 285,
        "url": "http://patches.dpdk.org/api/people/285/?format=api",
        "name": "Jasvinder Singh",
        "email": "jasvinder.singh@intel.com"
    },
    "delegate": {
        "id": 10018,
        "url": "http://patches.dpdk.org/api/users/10018/?format=api",
        "username": "cristian_dumitrescu",
        "first_name": "Cristian",
        "last_name": "Dumitrescu",
        "email": "cristian.dumitrescu@intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20180615165224.25004-23-jasvinder.singh@intel.com/mbox/",
    "series": [
        {
            "id": 147,
            "url": "http://patches.dpdk.org/api/series/147/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=147",
            "date": "2018-06-15T16:52:03",
            "name": "[v2,01/22] net/softnic: restructuring",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/147/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/41216/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/41216/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id D68271C030;\n\tFri, 15 Jun 2018 18:53:26 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 0D9091C02A\n\tfor <dev@dpdk.org>; Fri, 15 Jun 2018 18:52:46 +0200 (CEST)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t15 Jun 2018 09:52:46 -0700",
            "from silpixa00381635.ir.intel.com (HELO\n\tsilpixa00381635.ger.corp.intel.com) ([10.237.222.149])\n\tby fmsmga006.fm.intel.com with ESMTP; 15 Jun 2018 09:52:45 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,227,1526367600\"; d=\"scan'208\";a=\"237791163\"",
        "From": "Jasvinder Singh <jasvinder.singh@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "cristian.dumitrescu@intel.com,\n\tReshma Pattan <reshma.pattan@intel.com>",
        "Date": "Fri, 15 Jun 2018 17:52:24 +0100",
        "Message-Id": "<20180615165224.25004-23-jasvinder.singh@intel.com>",
        "X-Mailer": "git-send-email 2.9.3",
        "In-Reply-To": "<20180615165224.25004-1-jasvinder.singh@intel.com>",
        "References": "<20180608124155.140663-2-jasvinder.singh@intel.com>\n\t<20180615165224.25004-1-jasvinder.singh@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 22/22] app/testpmd: rework softnic forward mode",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Modied the testpmd softnic forwarding mode as per the\nchanges in softnic PMD.\n\nTo run testpmd application with softnic fwd mode, following\ncommand is used;\n\n$ ./testpmd -c 0xc -n 4 --vdev 'net_softnic0,firware=script.cli'\n  -- -i --forward-mode=softnic\n\nSigned-off-by: Jasvinder Singh <jasvinder.singh@intel.com>\nSigned-off-by: Reshma Pattan <reshma.pattan@intel.com>\n---\n app/test-pmd/Makefile               |   4 +-\n app/test-pmd/cmdline.c              |  53 ++++-\n app/test-pmd/config.c               |  55 +++++\n app/test-pmd/{tm.c => softnicfwd.c} | 418 ++++++++++++------------------------\n app/test-pmd/testpmd.c              |  27 ++-\n app/test-pmd/testpmd.h              |  44 +---\n 6 files changed, 256 insertions(+), 345 deletions(-)\n rename app/test-pmd/{tm.c => softnicfwd.c} (61%)",
    "diff": "diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile\nindex a5a827b..f788078 100644\n--- a/app/test-pmd/Makefile\n+++ b/app/test-pmd/Makefile\n@@ -35,8 +35,8 @@ SRCS-y += icmpecho.c\n SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c\n SRCS-$(CONFIG_RTE_LIBRTE_BPF) += bpf_cmd.c\n \n-ifeq ($(CONFIG_RTE_LIBRTE_PMD_SOFTNIC)$(CONFIG_RTE_LIBRTE_SCHED),yy)\n-SRCS-y += tm.c\n+ifeq ($(CONFIG_RTE_LIBRTE_PMD_SOFTNIC), y)\n+SRCS-y += softnicfwd.c\n endif\n \n ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)\ndiff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex 27e2aa8..2ff6fa2 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -69,6 +69,9 @@\n #ifdef RTE_LIBRTE_I40E_PMD\n #include <rte_pmd_i40e.h>\n #endif\n+#ifdef RTE_LIBRTE_PMD_SOFTNIC\n+#include <rte_eth_softnic.h>\n+#endif\n #ifdef RTE_LIBRTE_BNXT_PMD\n #include <rte_pmd_bnxt.h>\n #endif\n@@ -14806,20 +14809,14 @@ static void cmd_set_port_tm_hierarchy_default_parsed(void *parsed_result,\n \n \tp = &ports[port_id];\n \n-\t/* Port tm flag */\n-\tif (p->softport.tm_flag == 0) {\n-\t\tprintf(\"  tm not enabled on port %u (error)\\n\", port_id);\n-\t\treturn;\n-\t}\n-\n \t/* Forward mode: tm */\n-\tif (strcmp(cur_fwd_config.fwd_eng->fwd_mode_name, \"tm\")) {\n-\t\tprintf(\"  tm mode not enabled(error)\\n\");\n+\tif (strcmp(cur_fwd_config.fwd_eng->fwd_mode_name, \"softnicfwd\")) {\n+\t\tprintf(\"  softnicfwd mode not enabled(error)\\n\");\n \t\treturn;\n \t}\n \n \t/* Set the default tm hierarchy */\n-\tp->softport.tm.default_hierarchy_enable = 1;\n+\tp->softport.default_tm_hierarchy_enable = 1;\n }\n \n cmdline_parse_inst_t cmd_set_port_tm_hierarchy_default = {\n@@ -17543,15 +17540,49 @@ cmdline_read_from_file(const char *filename)\n void\n prompt(void)\n {\n+\tportid_t pid;\n+\tstruct rte_port *port;\n+\tint status;\n+\n \t/* initialize non-constant commands */\n \tcmd_set_fwd_mode_init();\n \tcmd_set_fwd_retry_mode_init();\n \n+#if defined RTE_LIBRTE_PMD_SOFTNIC\n+\tportid_t softnic_portid;\n+\tuint8_t softnic_enable = 0;\n+\tif (strcmp(cur_fwd_eng->fwd_mode_name, \"softnic\") == 0) {\n+\t\tRTE_ETH_FOREACH_DEV(pid) {\n+\t\t\tport = &ports[pid];\n+\t\t\tif (strcmp(port->dev_info.driver_name, \"net_softnic\") == 0) {\n+\t\t\t\tsoftnic_portid = pid;\n+\t\t\t\tsoftnic_enable = 1;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\t}\n+#endif\n+\n \ttestpmd_cl = cmdline_stdin_new(main_ctx, \"testpmd> \");\n \tif (testpmd_cl == NULL)\n \t\treturn;\n-\tcmdline_interact(testpmd_cl);\n-\tcmdline_stdin_exit(testpmd_cl);\n+\n+\tfor (;;) {\n+\t\tstatus = cmdline_poll(testpmd_cl);\n+\t\tif (status < 0)\n+\t\t\trte_panic(\"CLI poll error (%\" PRId32 \")\\n\", status);\n+\t\telse if (status == RDLINE_EXITED) {\n+\t\t\tcmdline_stdin_exit(testpmd_cl);\n+\t\t\trte_exit(0, \"\\n\");\n+\t\t}\n+\n+#if defined RTE_LIBRTE_PMD_SOFTNIC\n+\n+\tif ((softnic_enable == 1) &&\n+\t\t(strcmp(cur_fwd_eng->fwd_mode_name, \"softnic\") == 0))\n+\t\trte_pmd_softnic_manage(softnic_portid);\n+#endif\n+\t}\n }\n \n void\ndiff --git a/app/test-pmd/config.c b/app/test-pmd/config.c\nindex 97020fb..5b089c3 100644\n--- a/app/test-pmd/config.c\n+++ b/app/test-pmd/config.c\n@@ -2332,6 +2332,53 @@ icmp_echo_config_setup(void)\n \t}\n }\n \n+#if defined RTE_LIBRTE_PMD_SOFTNIC\n+static void\n+softnic_fwd_config_setup(void)\n+{\n+\tstruct rte_port *port;\n+\tportid_t pid, softnic_portid;\n+\tqueueid_t i;\n+\tuint8_t softnic_enable = 0;\n+\n+\tRTE_ETH_FOREACH_DEV(pid) {\n+\t\t\tport = &ports[pid];\n+\t\t\tif (strcmp(port->dev_info.driver_name, \"net_softnic\") == 0) {\n+\t\t\t\tsoftnic_portid = pid;\n+\t\t\t\tsoftnic_enable =1;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t}\n+\n+\tif (softnic_enable == 0) {\n+\t\tprintf(\"Softnicfwd mode configuration not complete(%s)!\\n\", __func__);\n+\t\treturn;\n+\t}\n+\n+\tcur_fwd_config.nb_fwd_ports = 1;\n+\tcur_fwd_config.nb_fwd_streams = (streamid_t) nb_rxq;\n+\n+\t/* Re-initialize forwarding streams */\n+\tinit_fwd_streams();\n+\n+\t/*\n+\t * In the softnic forwarding test, the number of forwarding cores\n+\t * is set to one and remaining are used for softnic packet processing.\n+\t */\n+\tcur_fwd_config.nb_fwd_lcores = 1;\n+\tsetup_fwd_config_of_each_lcore(&cur_fwd_config);\n+\n+\tfor (i = 0; i < cur_fwd_config.nb_fwd_streams; i++) {\n+\t\tfwd_streams[i]->rx_port   = softnic_portid;\n+\t\tfwd_streams[i]->rx_queue  = i;\n+\t\tfwd_streams[i]->tx_port   = softnic_portid;\n+\t\tfwd_streams[i]->tx_queue  = i;\n+\t\tfwd_streams[i]->peer_addr = fwd_streams[i]->tx_port;\n+\t\tfwd_streams[i]->retry_enabled = retry_enabled;\n+\t}\n+}\n+#endif\n+\n void\n fwd_config_setup(void)\n {\n@@ -2340,6 +2387,14 @@ fwd_config_setup(void)\n \t\ticmp_echo_config_setup();\n \t\treturn;\n \t}\n+\n+#if defined RTE_LIBRTE_PMD_SOFTNIC\n+\tif(strcmp(cur_fwd_eng->fwd_mode_name, \"softnic\") == 0) {\n+\t\tsoftnic_fwd_config_setup();\n+\t\treturn;\n+\t}\n+#endif\n+\n \tif ((nb_rxq > 1) && (nb_txq > 1)){\n \t\tif (dcb_config)\n \t\t\tdcb_fwd_config_setup();\ndiff --git a/app/test-pmd/tm.c b/app/test-pmd/softnicfwd.c\nsimilarity index 61%\nrename from app/test-pmd/tm.c\nrename to app/test-pmd/softnicfwd.c\nindex 7231552..775beb8 100644\n--- a/app/test-pmd/tm.c\n+++ b/app/test-pmd/softnicfwd.c\n@@ -6,6 +6,7 @@\n \n #include <rte_cycles.h>\n #include <rte_mbuf.h>\n+#include <rte_malloc.h>\n #include <rte_ethdev.h>\n #include <rte_flow.h>\n #include <rte_meter.h>\n@@ -71,170 +72,17 @@ struct tm_hierarchy {\n \tuint32_t n_shapers;\n };\n \n-#define BITFIELD(byte_array, slab_pos, slab_mask, slab_shr)\t\\\n-({\t\t\t\t\t\t\t\t\\\n-\tuint64_t slab = *((uint64_t *) &byte_array[slab_pos]);\t\\\n-\tuint64_t val =\t\t\t\t\\\n-\t\t(rte_be_to_cpu_64(slab) & slab_mask) >> slab_shr;\t\\\n-\tval;\t\t\t\t\t\t\\\n-})\n-\n-#define RTE_SCHED_PORT_HIERARCHY(subport, pipe,           \\\n-\ttraffic_class, queue, color)                          \\\n-\t((((uint64_t) (queue)) & 0x3) |                       \\\n-\t((((uint64_t) (traffic_class)) & 0x3) << 2) |         \\\n-\t((((uint64_t) (color)) & 0x3) << 4) |                 \\\n-\t((((uint64_t) (subport)) & 0xFFFF) << 16) |           \\\n-\t((((uint64_t) (pipe)) & 0xFFFFFFFF) << 32))\n-\n-\n-static void\n-pkt_metadata_set(struct rte_port *p, struct rte_mbuf **pkts,\n-\tuint32_t n_pkts)\n-{\n-\tstruct softnic_port_tm *tm = &p->softport.tm;\n-\tuint32_t i;\n-\n-\tfor (i = 0; i < (n_pkts & (~0x3)); i += 4) {\n-\t\tstruct rte_mbuf *pkt0 = pkts[i];\n-\t\tstruct rte_mbuf *pkt1 = pkts[i + 1];\n-\t\tstruct rte_mbuf *pkt2 = pkts[i + 2];\n-\t\tstruct rte_mbuf *pkt3 = pkts[i + 3];\n-\n-\t\tuint8_t *pkt0_data = rte_pktmbuf_mtod(pkt0, uint8_t *);\n-\t\tuint8_t *pkt1_data = rte_pktmbuf_mtod(pkt1, uint8_t *);\n-\t\tuint8_t *pkt2_data = rte_pktmbuf_mtod(pkt2, uint8_t *);\n-\t\tuint8_t *pkt3_data = rte_pktmbuf_mtod(pkt3, uint8_t *);\n-\n-\t\tuint64_t pkt0_subport = BITFIELD(pkt0_data,\n-\t\t\t\t\ttm->tm_pktfield0_slabpos,\n-\t\t\t\t\ttm->tm_pktfield0_slabmask,\n-\t\t\t\t\ttm->tm_pktfield0_slabshr);\n-\t\tuint64_t pkt0_pipe = BITFIELD(pkt0_data,\n-\t\t\t\t\ttm->tm_pktfield1_slabpos,\n-\t\t\t\t\ttm->tm_pktfield1_slabmask,\n-\t\t\t\t\ttm->tm_pktfield1_slabshr);\n-\t\tuint64_t pkt0_dscp = BITFIELD(pkt0_data,\n-\t\t\t\t\ttm->tm_pktfield2_slabpos,\n-\t\t\t\t\ttm->tm_pktfield2_slabmask,\n-\t\t\t\t\ttm->tm_pktfield2_slabshr);\n-\t\tuint32_t pkt0_tc = tm->tm_tc_table[pkt0_dscp & 0x3F] >> 2;\n-\t\tuint32_t pkt0_tc_q = tm->tm_tc_table[pkt0_dscp & 0x3F] & 0x3;\n-\t\tuint64_t pkt1_subport = BITFIELD(pkt1_data,\n-\t\t\t\t\ttm->tm_pktfield0_slabpos,\n-\t\t\t\t\ttm->tm_pktfield0_slabmask,\n-\t\t\t\t\ttm->tm_pktfield0_slabshr);\n-\t\tuint64_t pkt1_pipe = BITFIELD(pkt1_data,\n-\t\t\t\t\ttm->tm_pktfield1_slabpos,\n-\t\t\t\t\ttm->tm_pktfield1_slabmask,\n-\t\t\t\t\ttm->tm_pktfield1_slabshr);\n-\t\tuint64_t pkt1_dscp = BITFIELD(pkt1_data,\n-\t\t\t\t\ttm->tm_pktfield2_slabpos,\n-\t\t\t\t\ttm->tm_pktfield2_slabmask,\n-\t\t\t\t\ttm->tm_pktfield2_slabshr);\n-\t\tuint32_t pkt1_tc = tm->tm_tc_table[pkt1_dscp & 0x3F] >> 2;\n-\t\tuint32_t pkt1_tc_q = tm->tm_tc_table[pkt1_dscp & 0x3F] & 0x3;\n-\n-\t\tuint64_t pkt2_subport = BITFIELD(pkt2_data,\n-\t\t\t\t\ttm->tm_pktfield0_slabpos,\n-\t\t\t\t\ttm->tm_pktfield0_slabmask,\n-\t\t\t\t\ttm->tm_pktfield0_slabshr);\n-\t\tuint64_t pkt2_pipe = BITFIELD(pkt2_data,\n-\t\t\t\t\ttm->tm_pktfield1_slabpos,\n-\t\t\t\t\ttm->tm_pktfield1_slabmask,\n-\t\t\t\t\ttm->tm_pktfield1_slabshr);\n-\t\tuint64_t pkt2_dscp = BITFIELD(pkt2_data,\n-\t\t\t\t\ttm->tm_pktfield2_slabpos,\n-\t\t\t\t\ttm->tm_pktfield2_slabmask,\n-\t\t\t\t\ttm->tm_pktfield2_slabshr);\n-\t\tuint32_t pkt2_tc = tm->tm_tc_table[pkt2_dscp & 0x3F] >> 2;\n-\t\tuint32_t pkt2_tc_q = tm->tm_tc_table[pkt2_dscp & 0x3F] & 0x3;\n-\n-\t\tuint64_t pkt3_subport = BITFIELD(pkt3_data,\n-\t\t\t\t\ttm->tm_pktfield0_slabpos,\n-\t\t\t\t\ttm->tm_pktfield0_slabmask,\n-\t\t\t\t\ttm->tm_pktfield0_slabshr);\n-\t\tuint64_t pkt3_pipe = BITFIELD(pkt3_data,\n-\t\t\t\t\ttm->tm_pktfield1_slabpos,\n-\t\t\t\t\ttm->tm_pktfield1_slabmask,\n-\t\t\t\t\ttm->tm_pktfield1_slabshr);\n-\t\tuint64_t pkt3_dscp = BITFIELD(pkt3_data,\n-\t\t\t\t\ttm->tm_pktfield2_slabpos,\n-\t\t\t\t\ttm->tm_pktfield2_slabmask,\n-\t\t\t\t\ttm->tm_pktfield2_slabshr);\n-\t\tuint32_t pkt3_tc = tm->tm_tc_table[pkt3_dscp & 0x3F] >> 2;\n-\t\tuint32_t pkt3_tc_q = tm->tm_tc_table[pkt3_dscp & 0x3F] & 0x3;\n-\n-\t\tuint64_t pkt0_sched = RTE_SCHED_PORT_HIERARCHY(pkt0_subport,\n-\t\t\t\t\t\tpkt0_pipe,\n-\t\t\t\t\t\tpkt0_tc,\n-\t\t\t\t\t\tpkt0_tc_q,\n-\t\t\t\t\t\t0);\n-\t\tuint64_t pkt1_sched = RTE_SCHED_PORT_HIERARCHY(pkt1_subport,\n-\t\t\t\t\t\tpkt1_pipe,\n-\t\t\t\t\t\tpkt1_tc,\n-\t\t\t\t\t\tpkt1_tc_q,\n-\t\t\t\t\t\t0);\n-\t\tuint64_t pkt2_sched = RTE_SCHED_PORT_HIERARCHY(pkt2_subport,\n-\t\t\t\t\t\tpkt2_pipe,\n-\t\t\t\t\t\tpkt2_tc,\n-\t\t\t\t\t\tpkt2_tc_q,\n-\t\t\t\t\t\t0);\n-\t\tuint64_t pkt3_sched = RTE_SCHED_PORT_HIERARCHY(pkt3_subport,\n-\t\t\t\t\t\tpkt3_pipe,\n-\t\t\t\t\t\tpkt3_tc,\n-\t\t\t\t\t\tpkt3_tc_q,\n-\t\t\t\t\t\t0);\n-\n-\t\tpkt0->hash.sched.lo = pkt0_sched & 0xFFFFFFFF;\n-\t\tpkt0->hash.sched.hi = pkt0_sched >> 32;\n-\t\tpkt1->hash.sched.lo = pkt1_sched & 0xFFFFFFFF;\n-\t\tpkt1->hash.sched.hi = pkt1_sched >> 32;\n-\t\tpkt2->hash.sched.lo = pkt2_sched & 0xFFFFFFFF;\n-\t\tpkt2->hash.sched.hi = pkt2_sched >> 32;\n-\t\tpkt3->hash.sched.lo = pkt3_sched & 0xFFFFFFFF;\n-\t\tpkt3->hash.sched.hi = pkt3_sched >> 32;\n-\t}\n-\n-\tfor (; i < n_pkts; i++)\t{\n-\t\tstruct rte_mbuf *pkt = pkts[i];\n-\n-\t\tuint8_t *pkt_data = rte_pktmbuf_mtod(pkt, uint8_t *);\n-\n-\t\tuint64_t pkt_subport = BITFIELD(pkt_data,\n-\t\t\t\t\ttm->tm_pktfield0_slabpos,\n-\t\t\t\t\ttm->tm_pktfield0_slabmask,\n-\t\t\t\t\ttm->tm_pktfield0_slabshr);\n-\t\tuint64_t pkt_pipe = BITFIELD(pkt_data,\n-\t\t\t\t\ttm->tm_pktfield1_slabpos,\n-\t\t\t\t\ttm->tm_pktfield1_slabmask,\n-\t\t\t\t\ttm->tm_pktfield1_slabshr);\n-\t\tuint64_t pkt_dscp = BITFIELD(pkt_data,\n-\t\t\t\t\ttm->tm_pktfield2_slabpos,\n-\t\t\t\t\ttm->tm_pktfield2_slabmask,\n-\t\t\t\t\ttm->tm_pktfield2_slabshr);\n-\t\tuint32_t pkt_tc = tm->tm_tc_table[pkt_dscp & 0x3F] >> 2;\n-\t\tuint32_t pkt_tc_q = tm->tm_tc_table[pkt_dscp & 0x3F] & 0x3;\n-\n-\t\tuint64_t pkt_sched = RTE_SCHED_PORT_HIERARCHY(pkt_subport,\n-\t\t\t\t\t\tpkt_pipe,\n-\t\t\t\t\t\tpkt_tc,\n-\t\t\t\t\t\tpkt_tc_q,\n-\t\t\t\t\t\t0);\n-\n-\t\tpkt->hash.sched.lo = pkt_sched & 0xFFFFFFFF;\n-\t\tpkt->hash.sched.hi = pkt_sched >> 32;\n-\t}\n-}\n+static struct fwd_lcore *softnic_fwd_lcore;\n+static uint16_t softnic_port_id;\n+struct fwd_engine softnic_fwd_engine;\n \n /*\n- * Soft port packet forward\n+ * Softnic packet forward\n  */\n static void\n-softport_packet_fwd(struct fwd_stream *fs)\n+softnic_fwd(struct fwd_stream *fs)\n {\n \tstruct rte_mbuf *pkts_burst[MAX_PKT_BURST];\n-\tstruct rte_port *rte_tx_port = &ports[fs->tx_port];\n \tuint16_t nb_rx;\n \tuint16_t nb_tx;\n \tuint32_t retry;\n@@ -258,14 +106,6 @@ softport_packet_fwd(struct fwd_stream *fs)\n \tfs->rx_burst_stats.pkt_burst_spread[nb_rx]++;\n #endif\n \n-\tif (rte_tx_port->softnic_enable) {\n-\t\t/* Set packet metadata if tm flag enabled */\n-\t\tif (rte_tx_port->softport.tm_flag)\n-\t\t\tpkt_metadata_set(rte_tx_port, pkts_burst, nb_rx);\n-\n-\t\t/* Softport run */\n-\t\trte_pmd_softnic_run(fs->tx_port);\n-\t}\n \tnb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue,\n \t\t\tpkts_burst, nb_rx);\n \n@@ -298,7 +138,43 @@ softport_packet_fwd(struct fwd_stream *fs)\n }\n \n static void\n-set_tm_hiearchy_nodes_shaper_rate(portid_t port_id, struct tm_hierarchy *h)\n+softnic_fwd_run(struct fwd_stream *fs)\n+{\n+\trte_pmd_softnic_run(softnic_port_id);\n+\tsoftnic_fwd(fs);\n+}\n+\n+static void\n+softnic_fwd_core_sync(void)\n+{\n+\tfor(;;) {\n+\t\trte_delay_us(1);\n+\n+\t\tif (!softnic_fwd_lcore->stopped)\n+\t\t\tbreak;\n+\t}\n+\n+\treturn;\n+}\n+/**\n+ * Softnic init\n+ */\n+static int\n+softnic_begin(void *arg __rte_unused) {\n+\n+\tsoftnic_fwd_core_sync();\n+\tdo {\n+\t\t/* Run softnic */\n+\t\trte_pmd_softnic_run(softnic_port_id);\n+\t} while(!softnic_fwd_lcore->stopped);\n+\n+\treturn 0;\n+}\n+\n+\n+static void\n+set_tm_hiearchy_nodes_shaper_rate(portid_t port_id,\n+\tstruct tm_hierarchy *h)\n {\n \tstruct rte_eth_link link_params;\n \tuint64_t tm_port_rate;\n@@ -374,7 +250,8 @@ softport_tm_root_node_add(portid_t port_id, struct tm_hierarchy *h,\n }\n \n static int\n-softport_tm_subport_node_add(portid_t port_id, struct tm_hierarchy *h,\n+softport_tm_subport_node_add(portid_t port_id,\n+\tstruct tm_hierarchy *h,\n \tstruct rte_tm_error *error)\n {\n \tuint32_t subport_parent_node_id, subport_node_id = 0;\n@@ -442,7 +319,8 @@ softport_tm_subport_node_add(portid_t port_id, struct tm_hierarchy *h,\n }\n \n static int\n-softport_tm_pipe_node_add(portid_t port_id, struct tm_hierarchy *h,\n+softport_tm_pipe_node_add(portid_t port_id,\n+\tstruct tm_hierarchy *h,\n \tstruct rte_tm_error *error)\n {\n \tuint32_t pipe_parent_node_id;\n@@ -511,7 +389,8 @@ softport_tm_pipe_node_add(portid_t port_id, struct tm_hierarchy *h,\n }\n \n static int\n-softport_tm_tc_node_add(portid_t port_id, struct tm_hierarchy *h,\n+softport_tm_tc_node_add(portid_t port_id,\n+\tstruct tm_hierarchy *h,\n \tstruct rte_tm_error *error)\n {\n \tuint32_t tc_parent_node_id;\n@@ -674,63 +553,9 @@ softport_tm_queue_node_add(portid_t port_id, struct tm_hierarchy *h,\n \treturn 0;\n }\n \n-/*\n- * TM Packet Field Setup\n- */\n-static void\n-softport_tm_pktfield_setup(portid_t port_id)\n-{\n-\tstruct rte_port *p = &ports[port_id];\n-\tuint64_t pktfield0_mask = 0;\n-\tuint64_t pktfield1_mask = 0x0000000FFF000000LLU;\n-\tuint64_t pktfield2_mask = 0x00000000000000FCLLU;\n-\n-\tp->softport.tm = (struct softnic_port_tm) {\n-\t\t.n_subports_per_port = SUBPORT_NODES_PER_PORT,\n-\t\t.n_pipes_per_subport = PIPE_NODES_PER_SUBPORT,\n-\n-\t\t/* Packet field to identify subport\n-\t\t *\n-\t\t * Default configuration assumes only one subport, thus\n-\t\t * the subport ID is hardcoded to 0\n-\t\t */\n-\t\t.tm_pktfield0_slabpos = 0,\n-\t\t.tm_pktfield0_slabmask = pktfield0_mask,\n-\t\t.tm_pktfield0_slabshr =\n-\t\t\t__builtin_ctzll(pktfield0_mask),\n-\n-\t\t/* Packet field to identify pipe.\n-\t\t *\n-\t\t * Default value assumes Ethernet/IPv4/UDP packets,\n-\t\t * UDP payload bits 12 .. 23\n-\t\t */\n-\t\t.tm_pktfield1_slabpos = 40,\n-\t\t.tm_pktfield1_slabmask = pktfield1_mask,\n-\t\t.tm_pktfield1_slabshr =\n-\t\t\t__builtin_ctzll(pktfield1_mask),\n-\n-\t\t/* Packet field used as index into TC translation table\n-\t\t * to identify the traffic class and queue.\n-\t\t *\n-\t\t * Default value assumes Ethernet/IPv4 packets, IPv4\n-\t\t * DSCP field\n-\t\t */\n-\t\t.tm_pktfield2_slabpos = 8,\n-\t\t.tm_pktfield2_slabmask = pktfield2_mask,\n-\t\t.tm_pktfield2_slabshr =\n-\t\t\t__builtin_ctzll(pktfield2_mask),\n-\n-\t\t.tm_tc_table = {\n-\t\t\t0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n-\t\t\t0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n-\t\t\t0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n-\t\t\t0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n-\t\t}, /**< TC translation table */\n-\t};\n-}\n-\n static int\n-softport_tm_hierarchy_specify(portid_t port_id, struct rte_tm_error *error)\n+softport_tm_hierarchy_specify(portid_t port_id,\n+\tstruct rte_tm_error *error)\n {\n \n \tstruct tm_hierarchy h;\n@@ -766,75 +591,100 @@ softport_tm_hierarchy_specify(portid_t port_id, struct rte_tm_error *error)\n \tif (status)\n \t\treturn status;\n \n-\t/* TM packet fields setup */\n-\tsoftport_tm_pktfield_setup(port_id);\n-\n \treturn 0;\n }\n \n /*\n- * Soft port Init\n+ * Softnic TM default configuration\n  */\n static void\n-softport_tm_begin(portid_t pi)\n+softnic_tm_default_config(portid_t pi)\n {\n \tstruct rte_port *port = &ports[pi];\n+\tstruct rte_tm_error error;\n+\tint status;\n \n-\t/* Soft port TM flag */\n-\tif (port->softport.tm_flag == 1) {\n-\t\tprintf(\"\\n\\n  TM feature available on port %u\\n\", pi);\n-\n-\t\t/* Soft port TM hierarchy configuration */\n-\t\tif ((port->softport.tm.hierarchy_config == 0) &&\n-\t\t\t(port->softport.tm.default_hierarchy_enable == 1)) {\n-\t\t\tstruct rte_tm_error error;\n-\t\t\tint status;\n-\n-\t\t\t/* Stop port */\n-\t\t\trte_eth_dev_stop(pi);\n-\n-\t\t\t/* TM hierarchy specification */\n-\t\t\tstatus = softport_tm_hierarchy_specify(pi, &error);\n-\t\t\tif (status) {\n-\t\t\t\tprintf(\"  TM Hierarchy built error(%d) - %s\\n\",\n-\t\t\t\t\terror.type, error.message);\n-\t\t\t\treturn;\n-\t\t\t}\n-\t\t\tprintf(\"\\n  TM Hierarchy Specified!\\n\\v\");\n-\n-\t\t\t/* TM hierarchy commit */\n-\t\t\tstatus = rte_tm_hierarchy_commit(pi, 0, &error);\n-\t\t\tif (status) {\n-\t\t\t\tprintf(\"  Hierarchy commit error(%d) - %s\\n\",\n-\t\t\t\t\terror.type, error.message);\n-\t\t\t\treturn;\n-\t\t\t}\n-\t\t\tprintf(\"  Hierarchy Committed (port %u)!\", pi);\n-\t\t\tport->softport.tm.hierarchy_config = 1;\n-\n-\t\t\t/* Start port */\n-\t\t\tstatus = rte_eth_dev_start(pi);\n-\t\t\tif (status) {\n-\t\t\t\tprintf(\"\\n  Port %u start error!\\n\", pi);\n-\t\t\t\treturn;\n-\t\t\t}\n-\t\t\tprintf(\"\\n  Port %u started!\\n\", pi);\n-\t\t\treturn;\n-\t\t}\n+\t/* Stop port */\n+\trte_eth_dev_stop(pi);\n+\n+\t/* TM hierarchy specification */\n+\tstatus = softport_tm_hierarchy_specify(pi, &error);\n+\tif (status) {\n+\t\tprintf(\"  TM Hierarchy built error(%d) - %s\\n\",\n+\t\t\terror.type, error.message);\n+\t\treturn;\n+\t}\n+\tprintf(\"\\n  TM Hierarchy Specified!\\n\\v\");\n+\n+\t/* TM hierarchy commit */\n+\tstatus = rte_tm_hierarchy_commit(pi, 0, &error);\n+\tif (status) {\n+\t\tprintf(\"  Hierarchy commit error(%d) - %s\\n\",\n+\t\t\terror.type, error.message);\n+\t\treturn;\n \t}\n-\tprintf(\"\\n  TM feature not available on port %u\", pi);\n+\tprintf(\"  Hierarchy Committed (port %u)!\", pi);\n+\n+\t/* Start port */\n+\tstatus = rte_eth_dev_start(pi);\n+\tif (status) {\n+\t\tprintf(\"\\n  Port %u start error!\\n\", pi);\n+\t\treturn;\n+\t}\n+\n+\t/* Reset the default hierarchy flag */\n+\tport->softport.default_tm_hierarchy_enable = 0;\n+\n+\treturn;\n }\n \n-struct fwd_engine softnic_tm_engine = {\n-\t.fwd_mode_name  = \"tm\",\n-\t.port_fwd_begin = softport_tm_begin,\n-\t.port_fwd_end   = NULL,\n-\t.packet_fwd     = softport_packet_fwd,\n-};\n+/*\n+ * Softnic forwarding init\n+ */\n+static void\n+softnic_fwd_begin(portid_t pi)\n+{\n+\tstruct rte_port *port = &ports[pi];\n+\tuint32_t lcore, fwd_core_present = 0, softnic_run_launch = 0;\n+\tint\tstatus;\n+\n+\tsoftnic_fwd_lcore = port->softport.fwd_lcore_arg[0];\n+\tsoftnic_port_id = pi;\n+\n+\t/* Launch softnic_run function on lcores */\n+\tfor (lcore = 0; lcore < RTE_MAX_LCORE; lcore++) {\n+\t\tif (!rte_lcore_is_enabled(lcore))\n+\t\t\tcontinue;\n+\n+\t\tif (lcore == rte_get_master_lcore())\n+\t\t\tcontinue;\n+\n+\t\tif (fwd_core_present == 0) {\n+\t\t\tfwd_core_present++;\n+\t\t\tcontinue;\n+\t\t}\n \n-struct fwd_engine softnic_tm_bypass_engine = {\n-\t.fwd_mode_name  = \"tm-bypass\",\n-\t.port_fwd_begin = NULL,\n+\t\tstatus = rte_eal_remote_launch(softnic_begin, NULL, lcore);\n+\t\tif (status)\n+\t\t\tprintf(\"softnic launch on lcore %u failed (%d)\\n\",\n+\t\t\t\t       lcore, status);\n+\n+\t\tsoftnic_run_launch = 1;\n+\t}\n+\n+\tif (!softnic_run_launch)\n+\t\tsoftnic_fwd_engine.packet_fwd = softnic_fwd_run;\n+\n+\t/* Softnic TM default configuration */\n+\tif (port->softport.default_tm_hierarchy_enable == 1)\n+\t\tsoftnic_tm_default_config(pi);\n+\n+\treturn;\n+}\n+\n+struct fwd_engine softnic_fwd_engine = {\n+\t.fwd_mode_name  = \"softnic\",\n+\t.port_fwd_begin = softnic_fwd_begin,\n \t.port_fwd_end   = NULL,\n-\t.packet_fwd     = softport_packet_fwd,\n-};\n+\t.packet_fwd     = softnic_fwd,\n+};\n\\ No newline at end of file\ndiff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\nindex 35cf266..de5afd7 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -155,9 +155,8 @@ struct fwd_engine * fwd_engines[] = {\n \t&tx_only_engine,\n \t&csum_fwd_engine,\n \t&icmp_echo_engine,\n-#if defined RTE_LIBRTE_PMD_SOFTNIC && defined RTE_LIBRTE_SCHED\n-\t&softnic_tm_engine,\n-\t&softnic_tm_bypass_engine,\n+#if defined RTE_LIBRTE_PMD_SOFTNIC\n+\t&softnic_fwd_engine,\n #endif\n #ifdef RTE_LIBRTE_IEEE1588\n \t&ieee1588_fwd_engine,\n@@ -816,6 +815,17 @@ init_config(void)\n \t\t\t\t\t\"rte_gro_ctx_create() failed\\n\");\n \t\t}\n \t}\n+\n+#if defined RTE_LIBRTE_PMD_SOFTNIC\n+\tif (strcmp(cur_fwd_eng->fwd_mode_name, \"softnic\") == 0) {\n+\t\tRTE_ETH_FOREACH_DEV(pid) {\n+\t\t\tport = &ports[pid];\n+\t\t\tif (strcmp(port->dev_info.driver_name, \"net_softnic\") == 0)\n+\t\t\t\tport->softport.fwd_lcore_arg = fwd_lcores;\n+\t\t}\n+\t}\n+#endif\n+\n }\n \n \n@@ -2394,17 +2404,6 @@ init_port_config(void)\n \t\t    (rte_eth_devices[pid].data->dev_flags &\n \t\t     RTE_ETH_DEV_INTR_RMV))\n \t\t\tport->dev_conf.intr_conf.rmv = 1;\n-\n-#if defined RTE_LIBRTE_PMD_SOFTNIC && defined RTE_LIBRTE_SCHED\n-\t\t/* Detect softnic port */\n-\t\tif (!strcmp(port->dev_info.driver_name, \"net_softnic\")) {\n-\t\t\tport->softnic_enable = 1;\n-\t\t\tmemset(&port->softport, 0, sizeof(struct softnic_port));\n-\n-\t\t\tif (!strcmp(cur_fwd_eng->fwd_mode_name, \"tm\"))\n-\t\t\t\tport->softport.tm_flag = 1;\n-\t\t}\n-#endif\n \t}\n }\n \ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex f51cd9d..4fc30a8 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -57,10 +57,10 @@ typedef uint16_t streamid_t;\n \n #define MAX_QUEUE_ID ((1 << (sizeof(queueid_t) * 8)) - 1)\n \n-#if defined RTE_LIBRTE_PMD_SOFTNIC && defined RTE_LIBRTE_SCHED\n-#define TM_MODE\t\t\t1\n+#if defined RTE_LIBRTE_PMD_SOFTNIC\n+#define SOFTNIC\t\t\t1\n #else\n-#define TM_MODE\t\t\t0\n+#define SOFTNIC\t\t\t0\n #endif\n \n enum {\n@@ -135,35 +135,13 @@ struct port_flow {\n \tuint8_t data[]; /**< Storage for pattern/actions. */\n };\n \n-#ifdef TM_MODE\n-/**\n- * Soft port tm related parameters\n- */\n-struct softnic_port_tm {\n-\tuint32_t default_hierarchy_enable; /**< def hierarchy enable flag */\n-\tuint32_t hierarchy_config;  /**< set to 1 if hierarchy configured */\n-\n-\tuint32_t n_subports_per_port;  /**< Num of subport nodes per port */\n-\tuint32_t n_pipes_per_subport;  /**< Num of pipe nodes per subport */\n-\n-\tuint64_t tm_pktfield0_slabpos;\t/**< Pkt field position for subport */\n-\tuint64_t tm_pktfield0_slabmask; /**< Pkt field mask for the subport */\n-\tuint64_t tm_pktfield0_slabshr;\n-\tuint64_t tm_pktfield1_slabpos; /**< Pkt field position for the pipe */\n-\tuint64_t tm_pktfield1_slabmask; /**< Pkt field mask for the pipe */\n-\tuint64_t tm_pktfield1_slabshr;\n-\tuint64_t tm_pktfield2_slabpos; /**< Pkt field position table index */\n-\tuint64_t tm_pktfield2_slabmask;\t/**< Pkt field mask for tc table idx */\n-\tuint64_t tm_pktfield2_slabshr;\n-\tuint64_t tm_tc_table[64];  /**< TC translation table */\n-};\n-\n+#ifdef SOFTNIC\n /**\n  * The data structure associate with softnic port\n  */\n struct softnic_port {\n-\tunsigned int tm_flag;\t/**< set to 1 if tm feature is enabled */\n-\tstruct softnic_port_tm tm;\t/**< softnic port tm parameters */\n+\tuint32_t default_tm_hierarchy_enable; /**< default tm hierarchy */\n+\tstruct fwd_lcore **fwd_lcore_arg; /**< softnic fwd core parameters */\n };\n #endif\n \n@@ -202,9 +180,8 @@ struct rte_port {\n \tuint32_t                mc_addr_nb; /**< nb. of addr. in mc_addr_pool */\n \tuint8_t                 slave_flag; /**< bonding slave port */\n \tstruct port_flow        *flow_list; /**< Associated flows. */\n-#ifdef TM_MODE\n-\tunsigned int\t\t\tsoftnic_enable;\t/**< softnic flag */\n-\tstruct softnic_port     softport;  /**< softnic port params */\n+#ifdef SOFTNIC\n+\tstruct softnic_port     softport;  /**< softnic params */\n #endif\n };\n \n@@ -266,9 +243,8 @@ extern struct fwd_engine rx_only_engine;\n extern struct fwd_engine tx_only_engine;\n extern struct fwd_engine csum_fwd_engine;\n extern struct fwd_engine icmp_echo_engine;\n-#ifdef TM_MODE\n-extern struct fwd_engine softnic_tm_engine;\n-extern struct fwd_engine softnic_tm_bypass_engine;\n+#ifdef SOFTNIC\n+extern struct fwd_engine softnic_fwd_engine;\n #endif\n #ifdef RTE_LIBRTE_IEEE1588\n extern struct fwd_engine ieee1588_fwd_engine;\n",
    "prefixes": [
        "v2",
        "22/22"
    ]
}