From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 57A85A0547; Wed, 21 Apr 2021 13:13:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1D20641A72; Wed, 21 Apr 2021 13:13:03 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id 4C55F419EC for ; Wed, 21 Apr 2021 13:13:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619003580; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uf/r2tpPUXGjgODzpNWOsTBr9mkkIHAtgYJWvUR00vg=; b=I9sgZK9Z+V/NYpwh/6wxEZ5FXOm+fKz9WOFg0gCuKXQGfkISheV70ZWeBT3xS/fYjXCEHN Gg+OI0aCyB9DMpZ/6jlNuUAQAn6RNQXoYFbuG4vFGhaEDIPMGrFHWFc6jJCXh80Da/nPOr hvkrPkn619RgdA4TIRNHAVNr/K2B56w= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-33-oiGiiudPNhagBBT8qHV7gw-1; Wed, 21 Apr 2021 07:12:56 -0400 X-MC-Unique: oiGiiudPNhagBBT8qHV7gw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7FBB2BBEE3; Wed, 21 Apr 2021 11:12:55 +0000 (UTC) Received: from [10.36.112.162] (ovpn-112-162.ams2.redhat.com [10.36.112.162]) by smtp.corp.redhat.com (Postfix) with ESMTP id 32EEA60C05; Wed, 21 Apr 2021 11:12:53 +0000 (UTC) To: "Min Hu (Connor)" , dev@dpdk.org Cc: ferruh.yigit@intel.com, xiaoyun.li@intel.com References: <1618469214-35316-1-git-send-email-humin29@huawei.com> <1618998091-36162-1-git-send-email-humin29@huawei.com> From: Kevin Traynor Message-ID: <691afaf8-1f6d-416a-d377-382cae600200@redhat.com> Date: Wed, 21 Apr 2021 12:12:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <1618998091-36162-1-git-send-email-humin29@huawei.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v3] app/testpmd: support the query of link flow ctrl info X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" On 21/04/2021 10:41, Min Hu (Connor) wrote: > From: Huisong Li > > This patch supports the query of the link flow control parameter > on a port. > > The command format is as follows: > show port flow_ctrl > Thanks Connor, Acked-by: Kevin Traynor > Signed-off-by: Huisong Li > Signed-off-by: Min Hu (Connor) > --- > v3: > * fixed the print format of link flow ctrl, and removes redundant > port number verification. > > v2: > * fixed logging. > --- > app/test-pmd/cmdline.c | 78 +++++++++++++++++++++++++++++ > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ > 2 files changed, 85 insertions(+) > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c > index d282c7c..08da2b1 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -258,6 +258,9 @@ static void cmd_help_long_parsed(void *parsed_result, > > "show port (port_id) fec_mode" > " Show fec mode of a port.\n\n" > + > + "show port flow_ctrl" > + " Show flow control info of a port.\n\n" > ); > } > > @@ -6863,6 +6866,80 @@ cmdline_parse_inst_t cmd_set_allmulti_mode_one = { > }, > }; > > +/* *** GET CURRENT ETHERNET LINK FLOW CONTROL *** */ > +struct cmd_link_flow_ctrl_show { > + cmdline_fixed_string_t show; > + cmdline_fixed_string_t port; > + portid_t port_id; > + cmdline_fixed_string_t flow_ctrl; > +}; > + > +cmdline_parse_token_string_t cmd_lfc_show_show = > + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, > + show, "show"); > +cmdline_parse_token_string_t cmd_lfc_show_port = > + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, > + port, "port"); > +cmdline_parse_token_num_t cmd_lfc_show_portid = > + TOKEN_NUM_INITIALIZER(struct cmd_link_flow_ctrl_show, > + port_id, RTE_UINT16); > +cmdline_parse_token_string_t cmd_lfc_show_flow_ctrl = > + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, > + flow_ctrl, "flow_ctrl"); > + > +static void > +cmd_link_flow_ctrl_show_parsed(void *parsed_result, > + __rte_unused struct cmdline *cl, > + __rte_unused void *data) > +{ > + struct cmd_link_flow_ctrl_show *res = parsed_result; > + static const char *info_border = "*********************"; > + struct rte_eth_fc_conf fc_conf; > + bool rx_fc_en = false; > + bool tx_fc_en = false; > + int ret; > + > + ret = rte_eth_dev_flow_ctrl_get(res->port_id, &fc_conf); > + if (ret != 0) { > + printf("Failed to get current flow ctrl information: err = %d\n", > + ret); > + return; > + } > + > + if (fc_conf.mode == RTE_FC_RX_PAUSE || fc_conf.mode == RTE_FC_FULL) > + rx_fc_en = true; > + if (fc_conf.mode == RTE_FC_TX_PAUSE || fc_conf.mode == RTE_FC_FULL) > + tx_fc_en = true; > + > + printf("\n%s Flow control infos for port %-2d %s\n", > + info_border, res->port_id, info_border); > + printf("FC mode:\n"); > + printf(" Rx pause: %s\n", rx_fc_en ? "on" : "off"); > + printf(" Tx pause: %s\n", tx_fc_en ? "on" : "off"); > + printf("Autoneg: %s\n", fc_conf.autoneg ? "on" : "off"); > + printf("Pause time: 0x%x\n", fc_conf.pause_time); > + printf("High waterline: 0x%x\n", fc_conf.high_water); > + printf("Low waterline: 0x%x\n", fc_conf.low_water); > + printf("Send XON: %s\n", fc_conf.send_xon ? "on" : "off"); > + printf("Forward MAC control frames: %s\n", > + fc_conf.mac_ctrl_frame_fwd ? "on" : "off"); > + printf("\n%s************** End ***********%s\n", > + info_border, info_border); > +} > + > +cmdline_parse_inst_t cmd_link_flow_control_show = { > + .f = cmd_link_flow_ctrl_show_parsed, > + .data = NULL, > + .help_str = "show port flow_ctrl", > + .tokens = { > + (void *)&cmd_lfc_show_show, > + (void *)&cmd_lfc_show_port, > + (void *)&cmd_lfc_show_portid, > + (void *)&cmd_lfc_show_flow_ctrl, > + NULL, > + }, > +}; > + > /* *** SETUP ETHERNET LINK FLOW CONTROL *** */ > struct cmd_link_flow_ctrl_set_result { > cmdline_fixed_string_t set; > @@ -17354,6 +17431,7 @@ cmdline_parse_ctx_t main_ctx[] = { > (cmdline_parse_inst_t *)&cmd_link_flow_control_set_xon, > (cmdline_parse_inst_t *)&cmd_link_flow_control_set_macfwd, > (cmdline_parse_inst_t *)&cmd_link_flow_control_set_autoneg, > + (cmdline_parse_inst_t *)&cmd_link_flow_control_show, > (cmdline_parse_inst_t *)&cmd_priority_flow_control_set, > (cmdline_parse_inst_t *)&cmd_config_dcb, > (cmdline_parse_inst_t *)&cmd_read_reg, > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > index c0cbc40..5dd98c2 100644 > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > @@ -1524,6 +1524,13 @@ Where: > > * ``autoneg``: Change the auto-negotiation parameter. > > +show flow ctrl > +~~~~~~~~~~~~~~ > + > +show the link flow control parameter on a port:: > + > + testpmd> show port flow_ctrl > + > set pfc_ctrl rx > ~~~~~~~~~~~~~~~ > >