From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02140C4CEC5 for ; Fri, 13 Sep 2019 12:15:24 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 8C5572089F for ; Fri, 13 Sep 2019 12:15:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="YId55Zyz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8C5572089F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=marvell.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9DC7F1F02F; Fri, 13 Sep 2019 14:15:22 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 580D01DBE for ; Fri, 13 Sep 2019 14:15:21 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8DC5xnB021856; Fri, 13 Sep 2019 05:15:20 -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=7eqqcDHyrqHQQTiuknF6Lq7qgACbJgOgGMz2HkcsSeM=; b=YId55Zyz4h7BqCXrFMhChhjhgBnRhTfLc7rNzJQt8J/tM1+oN7apHJj2ulafLarMoFFm +gKqt7+yAz8pMgTenPk3nii0ytUa9BSEdv4MlprquL8+sFuomnWobGTBT+uj1Tdnf11n 3nlb4aFMkFIvnBhxtcDWjPkDASUVNpkw+h3TPOXNdUiFGluo1lIs8ntQyBJDSGfxTEgw QZwFZodrBXsJhB15SvwakBy1DxjkORWgE6dq1AHLcQHJPcydbT43ahnhCOD0lMhs1Nv8 YtszbFSIplma3TaVCFj2W/te7Mgit2hH3oXS2V7LXsWPA6YTfw1IoGYHGJ4F/Th/4dh7 Gw== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2uytdfkhhn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 13 Sep 2019 05:15:20 -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; Fri, 13 Sep 2019 05:15:18 -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; Fri, 13 Sep 2019 05:15:18 -0700 Received: from dell-e5540.caveonetworks.com (unknown [10.29.16.81]) by maili.marvell.com (Postfix) with ESMTP id E98073F703F; Fri, 13 Sep 2019 05:15:15 -0700 (PDT) From: To: CC: , , Vivek Sharma Date: Fri, 13 Sep 2019 17:45:12 +0530 Message-ID: <1568376912-9585-1-git-send-email-viveksharma@marvell.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-13_06:2019-09-11,2019-09-13 signatures=0 Subject: [dpdk-dev] [PATCH] app/testpmd: support QinQ offload in VLAN set command 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 Segregate QinQ from Extend Offload and support QinQ offload in vlan set command. Merge all port wise rx vlan offloads in command line help and documentation for a cleaner structure. Signed-off-by: Vivek Sharma --- app/test-pmd/cmdline.c | 19 +++++++------------ app/test-pmd/config.c | 27 +++++++++++++++++++++++++++ app/test-pmd/testpmd.h | 1 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 23 ++++------------------- 4 files changed, 39 insertions(+), 31 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b6bc34b..479a4f2 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -325,9 +325,6 @@ static void cmd_help_long_parsed(void *parsed_result, "set vf broadcast (port_id) (vf_id) (on|off)\n" " Set VF broadcast for a VF from the PF.\n\n" - "vlan set strip (on|off) (port_id)\n" - " Set the VLAN strip on a port.\n\n" - "vlan set stripq (on|off) (port_id,queue_id)\n" " Set the VLAN strip for a queue on a port.\n\n" @@ -358,12 +355,8 @@ static void cmd_help_long_parsed(void *parsed_result, "set tc tx min-bandwidth (port_id) (bw1, bw2, ...)\n" " Set all TCs' min bandwidth(%%) for all PF and VFs.\n\n" - "vlan set filter (on|off) (port_id)\n" - " Set the VLAN filter on a port.\n\n" - - "vlan set qinq (on|off) (port_id)\n" - " Set the VLAN QinQ (extended queue in queue)" - " on a port.\n\n" + "vlan set (strip|filter|qinq|extend) (on|off) (port_id)\n" + " Set the VLAN strip or filter or qinq strip or extend\n\n" "vlan set (inner|outer) tpid (value) (port_id)\n" " Set the VLAN TPID for Packet Filtering on" @@ -3902,6 +3895,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); @@ -3916,7 +3911,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#qinq#extend#stripq"); cmdline_parse_token_string_t cmd_vlan_offload_on = TOKEN_STRING_INITIALIZER(struct cmd_vlan_offload_result, on, "on#off"); @@ -3927,9 +3922,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|qinq|extend|stripq on|off " ": " - "Filter/Strip for rx side qinq(extended) for both rx/tx sides", + "Strip/Filter/QinQ 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 1a5a5c1..372ca54 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2985,6 +2985,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/testpmd.h b/app/test-pmd/testpmd.h index ce13eb8..05c8967 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -752,6 +752,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/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 67f4339..0029865 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -799,13 +799,6 @@ Set broadcast mode for a VF from the PF:: testpmd> set vf broadcast (port_id) (vf_id) (on|off) -vlan set strip -~~~~~~~~~~~~~~ - -Set the VLAN strip on a port:: - - testpmd> vlan set strip (on|off) (port_id) - vlan set stripq ~~~~~~~~~~~~~~~ @@ -841,19 +834,11 @@ Set VLAN antispoof for a VF from the PF:: testpmd> set vf vlan antispoof (port_id) (vf_id) (on|off) -vlan set filter -~~~~~~~~~~~~~~~ - -Set the VLAN filter on a port:: - - testpmd> vlan set filter (on|off) (port_id) - -vlan set qinq -~~~~~~~~~~~~~ - -Set the VLAN QinQ (extended queue in queue) on for a port:: +vlan set (strip|filter|qinq|extend) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Set the VLAN strip/filter/QinQ strip/extend on for a port:: - testpmd> vlan set qinq (on|off) (port_id) + testpmd> vlan set (strip|filter|qinq|extend) (on|off) (port_id) vlan set tpid ~~~~~~~~~~~~~ -- 2.7.4