From patchwork Wed Jul 17 07:45:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Kumar Sharma X-Patchwork-Id: 56577 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 350D82082; Wed, 17 Jul 2019 09:45:37 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 05DEB1D9E for ; Wed, 17 Jul 2019 09:45:34 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x6H7j3Pk030982; Wed, 17 Jul 2019 00:45:33 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0818; bh=lC/AfspDBLzCHk+KqVjs6OirIfCy+sQXxDVLuIdrVNQ=; b=HSjlPg6LpRJmQ8caQdNAIeqXRRwAB/Fhe9+ligOiFe9HGex4L3Jt002Loboacv00/RHb C894NdPpm8uErPb8sDcpYFdssmwo+IKD2CYsa4gwfcxCj59fmID+4pKe2H/GZpWaKSu/ vJ9mFvL5MteUkEuQxOsqGrJGySzM6/f/3Ms+Vlr0X3sDXVRGQmUPeUl8K22UMaVH5fPt KSb+tleU9O6eQjjThvu0YFh8ARbiy03gU4VXNopPGt+xHdMNsYfsy4utD7t9u5MXUnhk SMTC4RBhQWgNPSX+5Efb6iAkTFEq/lH7wtu/5zlNXpB9XWnauB5nf0ipYuulCV1GKmJq XQ== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0a-0016f401.pphosted.com with ESMTP id 2ts07vf8hb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jul 2019 00:45:33 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 17 Jul 2019 00:45:32 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Wed, 17 Jul 2019 00:45:32 -0700 Received: from dell-e5540.caveonetworks.com (unknown [10.29.16.81]) by maili.marvell.com (Postfix) with ESMTP id 7DE513F703F; Wed, 17 Jul 2019 00:45:27 -0700 (PDT) From: To: CC: , Vivek Sharma Date: Wed, 17 Jul 2019 13:15:11 +0530 Message-ID: <1563349511-27968-1-git-send-email-viveksharma@marvell.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:5.22.84,1.0.8 definitions=2019-07-17_02:2019-07-16,2019-07-17 signatures=0 Subject: [dpdk-dev] [PATCH] app/testpmd: support QinQ strip offload X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Vivek Sharma Support QinQ strip RX offload configuration through testpmd command line and boot time arguments. Signed-off-by: Vivek Sharma Acked-by: Bernard Iremonger --- app/test-pmd/cmdline.c | 24 ++++++++++++++----- app/test-pmd/config.c | 36 +++++++++++++++++++++++++++-- app/test-pmd/parameters.c | 6 +++++ app/test-pmd/testpmd.h | 1 + doc/guides/testpmd_app_ug/run_app.rst | 4 ++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 14 ++++++++++- 6 files changed, 76 insertions(+), 9 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 2a92ea1..04d7773 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -802,7 +802,7 @@ static void cmd_help_long_parsed(void *parsed_result, " Set the max packet length.\n\n" "port config all (crc-strip|scatter|rx-cksum|rx-timestamp|hw-vlan|hw-vlan-filter|" - "hw-vlan-strip|hw-vlan-extend|drop-en)" + "hw-vlan-strip|hw-vlan-extend|hw-qinq-strip|drop-en)" " (on|off)\n" " Set crc-strip/scatter/rx-checksum/hardware-vlan/drop_en" " for ports.\n\n" @@ -2133,6 +2133,15 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result, printf("Unknown parameter\n"); return; } + } else if (!strcmp(res->name, "hw-qinq-strip")) { + if (!strcmp(res->value, "on")) + rx_offloads |= DEV_RX_OFFLOAD_QINQ_STRIP; + else if (!strcmp(res->value, "off")) + rx_offloads &= ~DEV_RX_OFFLOAD_QINQ_STRIP; + else { + printf("Unknown parameter\n"); + return; + } } else if (!strcmp(res->name, "drop-en")) { if (!strcmp(res->value, "on")) rx_drop_en = 1; @@ -2164,7 +2173,8 @@ cmdline_parse_token_string_t cmd_config_rx_mode_flag_all = cmdline_parse_token_string_t cmd_config_rx_mode_flag_name = TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, name, "crc-strip#scatter#rx-cksum#rx-timestamp#hw-vlan#" - "hw-vlan-filter#hw-vlan-strip#hw-vlan-extend"); + "hw-vlan-filter#hw-vlan-strip#hw-vlan-extend#" + "hw-qinq-strip"); cmdline_parse_token_string_t cmd_config_rx_mode_flag_value = TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, value, "on#off"); @@ -2173,7 +2183,7 @@ cmdline_parse_inst_t cmd_config_rx_mode_flag = { .f = cmd_config_rx_mode_flag_parsed, .data = NULL, .help_str = "port config all crc-strip|scatter|rx-cksum|rx-timestamp|hw-vlan|" - "hw-vlan-filter|hw-vlan-strip|hw-vlan-extend on|off", + "hw-vlan-filter|hw-vlan-strip|hw-vlan-extend|hw-qinq-strip on|off", .tokens = { (void *)&cmd_config_rx_mode_flag_port, (void *)&cmd_config_rx_mode_flag_keyword, @@ -3926,6 +3936,8 @@ cmd_vlan_offload_parsed(void *parsed_result, } else if (!strcmp(res->what, "filter")) rx_vlan_filter_set(port_id, on); + else if (!strcmp(res->what, "qinq")) + rx_vlan_qinq_strip_set(port_id, on); else vlan_extend_set(port_id, on); @@ -3940,7 +3952,7 @@ cmdline_parse_token_string_t cmd_vlan_offload_set = set, "set"); cmdline_parse_token_string_t cmd_vlan_offload_what = TOKEN_STRING_INITIALIZER(struct cmd_vlan_offload_result, - what, "strip#filter#qinq#stripq"); + what, "strip#filter#extend#qinq#stripq"); cmdline_parse_token_string_t cmd_vlan_offload_on = TOKEN_STRING_INITIALIZER(struct cmd_vlan_offload_result, on, "on#off"); @@ -3951,9 +3963,9 @@ cmdline_parse_token_string_t cmd_vlan_offload_portid = cmdline_parse_inst_t cmd_vlan_offload = { .f = cmd_vlan_offload_parsed, .data = NULL, - .help_str = "vlan set strip|filter|qinq|stripq on|off " + .help_str = "vlan set strip|filter|extend|qinq|stripq on|off " ": " - "Filter/Strip for rx side qinq(extended) for both rx/tx sides", + "Filter/Strip/QinQ strip for rx side extend for both rx/tx sides", .tokens = { (void *)&cmd_vlan_offload_vlan, (void *)&cmd_vlan_offload_set, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index ab458c8..8024584 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -458,9 +458,14 @@ port_infos_display(portid_t port_id) printf(" filter off \n"); if (vlan_offload & ETH_VLAN_EXTEND_OFFLOAD) - printf(" qinq(extend) on \n"); + printf(" extend on\n"); else - printf(" qinq(extend) off \n"); + printf(" extend off\n"); + + if (vlan_offload & ETH_QINQ_STRIP_OFFLOAD) + printf(" qinq strip on\n"); + else + printf(" qinq strip off\n"); } if (dev_info.hash_key_size > 0) @@ -2912,6 +2917,33 @@ rx_vlan_filter_set(portid_t port_id, int on) ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads; } +void +rx_vlan_qinq_strip_set(portid_t port_id, int on) +{ + int diag; + int vlan_offload; + uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads; + + if (port_id_is_invalid(port_id, ENABLED_WARN)) + return; + + vlan_offload = rte_eth_dev_get_vlan_offload(port_id); + + if (on) { + vlan_offload |= ETH_QINQ_STRIP_OFFLOAD; + port_rx_offloads |= DEV_RX_OFFLOAD_QINQ_STRIP; + } else { + vlan_offload &= ~ETH_QINQ_STRIP_OFFLOAD; + port_rx_offloads &= ~DEV_RX_OFFLOAD_QINQ_STRIP; + } + + diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload); + if (diag < 0) + printf("%s(port_pi=%d, on=%d) failed " + "diag=%d\n", __func__, port_id, on, diag); + ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads; +} + int rx_vft_set(portid_t port_id, uint16_t vlan_id, int on) { diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 245b610..214f25c 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -139,6 +139,7 @@ usage(char* progname) printf(" --enable-hw-vlan-filter: enable hardware vlan filter.\n"); printf(" --enable-hw-vlan-strip: enable hardware vlan strip.\n"); printf(" --enable-hw-vlan-extend: enable hardware vlan extend.\n"); + printf(" --enable-hw-qinq-strip: enable hardware qinq strip.\n"); printf(" --enable-drop-en: enable per queue packet drop.\n"); printf(" --disable-rss: disable rss.\n"); printf(" --port-topology=N: set port topology (N: paired (default) or " @@ -611,6 +612,7 @@ launch_args_parse(int argc, char** argv) { "enable-hw-vlan-filter", 0, 0, 0 }, { "enable-hw-vlan-strip", 0, 0, 0 }, { "enable-hw-vlan-extend", 0, 0, 0 }, + { "enable-hw-qinq-strip", 0, 0, 0 }, { "enable-drop-en", 0, 0, 0 }, { "disable-rss", 0, 0, 0 }, { "port-topology", 1, 0, 0 }, @@ -1001,6 +1003,10 @@ launch_args_parse(int argc, char** argv) "enable-hw-vlan-extend")) rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND; + if (!strcmp(lgopts[opt_idx].name, + "enable-hw-qinq-strip")) + rx_offloads |= DEV_RX_OFFLOAD_QINQ_STRIP; + if (!strcmp(lgopts[opt_idx].name, "enable-drop-en")) rx_drop_en = 1; diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index e3a6f7c..ab9e9fd 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -748,6 +748,7 @@ void rx_vlan_strip_set_on_queue(portid_t port_id, uint16_t queue_id, int on); void rx_vlan_filter_set(portid_t port_id, int on); void rx_vlan_all_filter_set(portid_t port_id, int on); +void rx_vlan_qinq_strip_set(portid_t port_id, int on); int rx_vft_set(portid_t port_id, uint16_t vlan_id, int on); void vlan_extend_set(portid_t port_id, int on); void vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type, diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst index e7db520..e6b48f0 100644 --- a/doc/guides/testpmd_app_ug/run_app.rst +++ b/doc/guides/testpmd_app_ug/run_app.rst @@ -198,6 +198,10 @@ The command line options are: Enable hardware VLAN extend. +* ``--enable-hw-qinq-strip`` + + Enable hardware QINQ strip. + * ``--enable-drop-en`` Enable per-queue packet drop for packets with no descriptors. diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index cb83a3c..996cc3a 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -200,7 +200,8 @@ For example: VLAN offload: strip on filter on - qinq(extend) off + extend off + qinq off Redirection table size: 512 Supported flow types: ipv4-frag @@ -2129,6 +2130,17 @@ Hardware VLAN extend is off by default. The ``on`` option is equivalent to the ``--enable-hw-vlan-extend`` command-line option. +port config - QINQ strip +~~~~~~~~~~~~~~~~~~~~~~~~ + +Set hardware QINQ strip on or off for all ports:: + + testpmd> port config all hw-qinq-strip (on|off) + +Hardware QINQ strip is off by default. + +The ``on`` option is equivalent to the ``--enable-hw-qinq-strip`` command-line option. + port config - Drop Packets ~~~~~~~~~~~~~~~~~~~~~~~~~~