From patchwork Tue Jan 21 11:44:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wei Hu (Xavier)" X-Patchwork-Id: 65007 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 61CE9A04DD; Tue, 21 Jan 2020 12:44:58 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 55DC0397D; Tue, 21 Jan 2020 12:44:52 +0100 (CET) Received: from incedge.chinasoftinc.com (unknown [114.113.233.8]) by dpdk.org (Postfix) with ESMTP id 8E866F94 for ; Tue, 21 Jan 2020 12:44:48 +0100 (CET) X-ASG-Debug-ID: 1579607080-0a3dd173f383950002-TfluYd Received: from mail.chinasoftinc.com (inccas002.ito.icss [10.168.0.52]) by incedge.chinasoftinc.com with ESMTP id dqmzLRbbnIKmTIKd (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 21 Jan 2020 19:44:41 +0800 (CST) X-Barracuda-Envelope-From: huwei013@chinasoftinc.com X-Barracuda-RBL-Trusted-Forwarder: 10.168.0.52 X-ASG-Whitelist: Client Received: from localhost.localdomain (114.119.4.74) by INCCAS002.ito.icss (10.168.0.60) with Microsoft SMTP Server id 14.3.439.0; Tue, 21 Jan 2020 19:44:40 +0800 From: "Wei Hu (Xavier)" X-Barracuda-RBL-Trusted-Forwarder: 10.168.0.60 To: Date: Tue, 21 Jan 2020 19:44:31 +0800 X-ASG-Orig-Subj: [PATCH 1/3] app/testpmd: update Rx offload after setting MTU sccessfully Message-ID: <20200121114433.57543-2-huwei013@chinasoftinc.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200121114433.57543-1-huwei013@chinasoftinc.com> References: <20200121114433.57543-1-huwei013@chinasoftinc.com> MIME-Version: 1.0 X-Originating-IP: [114.119.4.74] X-Barracuda-Connect: inccas002.ito.icss[10.168.0.52] X-Barracuda-Start-Time: 1579607080 X-Barracuda-Encrypted: ECDHE-RSA-AES256-SHA X-Barracuda-URL: https://spam.chinasoftinc.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at chinasoftinc.com X-Barracuda-Scan-Msg-Size: 1961 Subject: [dpdk-dev] [PATCH 1/3] app/testpmd: update Rx offload after setting MTU sccessfully 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: "Wei Hu (Xavier)" Currently, Rx offload capabilities and max_rx_pkt_len in the struct variable named rte_port are not updated after setting mtu successfully in port_mtu_set function by 'port config mtu ' command. This may lead to reconfig mtu to the initial value in the driver when recalling rte_eth_dev_configure API interface. This patch updates Rx offload capabilities and max_rx_pkt_len after setting mtu successfully when configuring mtu. Fixes: ae03d0d18adf ("app/testpmd: command to configure MTU") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Wei Hu (Xavier) --- app/test-pmd/config.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 9669cbd4c..09a1579f5 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1216,7 +1216,9 @@ void port_mtu_set(portid_t port_id, uint16_t mtu) { int diag; + struct rte_port *rte_port = &ports[port_id]; struct rte_eth_dev_info dev_info; + uint16_t eth_overhead; int ret; if (port_id_is_invalid(port_id, ENABLED_WARN)) @@ -1232,8 +1234,22 @@ port_mtu_set(portid_t port_id, uint16_t mtu) return; } diag = rte_eth_dev_set_mtu(port_id, mtu); - if (diag == 0) + if (diag == 0) { + /* + * Ether overhead in driver is equal to the difference of + * max_rx_pktlen and max_mtu in rte_eth_dev_info. + */ + eth_overhead = dev_info.max_rx_pktlen - dev_info.max_mtu; + if (mtu > RTE_ETHER_MAX_LEN - eth_overhead) + rte_port->dev_conf.rxmode.offloads |= + DEV_RX_OFFLOAD_JUMBO_FRAME; + else + rte_port->dev_conf.rxmode.offloads &= + ~DEV_RX_OFFLOAD_JUMBO_FRAME; + rte_port->dev_conf.rxmode.max_rx_pkt_len = mtu + eth_overhead; + return; + } printf("Set MTU failed. diag=%d\n", diag); } From patchwork Tue Jan 21 11:44:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wei Hu (Xavier)" X-Patchwork-Id: 65009 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1915AA04DD; Tue, 21 Jan 2020 12:45:17 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2B0EB1B203; Tue, 21 Jan 2020 12:44:56 +0100 (CET) Received: from incedge.chinasoftinc.com (unknown [114.113.233.8]) by dpdk.org (Postfix) with ESMTP id 627F53977 for ; Tue, 21 Jan 2020 12:44:51 +0100 (CET) X-ASG-Debug-ID: 1579607080-0a3dd173f383950003-TfluYd Received: from mail.chinasoftinc.com (inccas002.ito.icss [10.168.0.52]) by incedge.chinasoftinc.com with ESMTP id YHyirkPJ8IZGCkKD (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 21 Jan 2020 19:44:43 +0800 (CST) X-Barracuda-Envelope-From: huwei013@chinasoftinc.com X-Barracuda-RBL-Trusted-Forwarder: 10.168.0.52 X-ASG-Whitelist: Client Received: from localhost.localdomain (114.119.4.74) by INCCAS002.ito.icss (10.168.0.60) with Microsoft SMTP Server id 14.3.439.0; Tue, 21 Jan 2020 19:44:40 +0800 From: "Wei Hu (Xavier)" X-Barracuda-RBL-Trusted-Forwarder: 10.168.0.60 To: Date: Tue, 21 Jan 2020 19:44:32 +0800 X-ASG-Orig-Subj: [PATCH 2/3] app/testpmd: fix the initial value when setting PFC Message-ID: <20200121114433.57543-3-huwei013@chinasoftinc.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200121114433.57543-1-huwei013@chinasoftinc.com> References: <20200121114433.57543-1-huwei013@chinasoftinc.com> MIME-Version: 1.0 X-Originating-IP: [114.119.4.74] X-Barracuda-Connect: inccas002.ito.icss[10.168.0.52] X-Barracuda-Start-Time: 1579607081 X-Barracuda-Encrypted: ECDHE-RSA-AES256-SHA X-Barracuda-URL: https://spam.chinasoftinc.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at chinasoftinc.com X-Barracuda-Scan-Msg-Size: 2403 Subject: [dpdk-dev] [PATCH 2/3] app/testpmd: fix the initial value when setting PFC 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: "Wei Hu (Xavier)" Currently, the initial values of the local structure variable named rx_tx_onoff_2_lfc_mode and rx_tx_onoff_2_pfc_mode are different in the similar part of these two following functions: cmd_link_flow_ctrl_set_parsed cmd_priority_flow_ctrl_set_parsed 1) The code snippset in cmd_link_flow_ctrl_set_parsed function: static enum rte_eth_fc_mode rx_tx_onoff_2_lfc_mode[2][2] = { {RTE_FC_NONE, RTE_FC_TX_PAUSE}, {RTE_FC_RX_PAUSE, RTE_FC_FULL} }; if (!cmd || cmd == &cmd_link_flow_control_set_rx) rx_fc_en = (!strcmp(res->rx_lfc_mode, "on")) ? 1 : 0; if (!cmd || cmd == &cmd_link_flow_control_set_tx) tx_fc_en = (!strcmp(res->tx_lfc_mode, "on")) ? 1 : 0; fc_conf.mode = rx_tx_onoff_2_lfc_mode[rx_fc_en][tx_fc_en]; <...> ret = rte_eth_dev_flow_ctrl_set(res->port_id, &fc_conf); <...> 2) The code snippset in cmd_priority_flow_ctrl_set_parsed function: static enum rte_eth_fc_mode rx_tx_onoff_2_pfc_mode[2][2] = { {RTE_FC_NONE, RTE_FC_RX_PAUSE}, {RTE_FC_TX_PAUSE, RTE_FC_FULL} }; rx_fc_enable = (!strncmp(res->rx_pfc_mode, "on",2)) ? 1 : 0; tx_fc_enable = (!strncmp(res->tx_pfc_mode, "on",2)) ? 1 : 0; pfc_conf.fc.mode = rx_tx_onoff_2_pfc_mode[rx_fc_enable][tx_fc_enable]; <...> ret = rte_eth_dev_priority_flow_ctrl_set(res->port_id, &pfc_conf); <...> The initial value of rx_tx_onoff_2_pfc_mode is wrong, it should be the same as rx_tx_onoff_2_lfc_mode. Fixes: 9b53e542e9e1 ("app/testpmd: add priority flow control") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Wei Hu (Xavier) Signed-off-by: Xuan Li Reviewed-by: Ferruh Yigit --- app/test-pmd/cmdline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index dab22bc4d..a09cb87e1 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -7087,7 +7087,7 @@ cmd_priority_flow_ctrl_set_parsed(void *parsed_result, * the RTE_FC_RX_PAUSE, Respond to the pause frame at the Tx side. */ static enum rte_eth_fc_mode rx_tx_onoff_2_pfc_mode[2][2] = { - {RTE_FC_NONE, RTE_FC_RX_PAUSE}, {RTE_FC_TX_PAUSE, RTE_FC_FULL} + {RTE_FC_NONE, RTE_FC_TX_PAUSE}, {RTE_FC_RX_PAUSE, RTE_FC_FULL} }; rx_fc_enable = (!strncmp(res->rx_pfc_mode, "on",2)) ? 1 : 0; From patchwork Tue Jan 21 11:44:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wei Hu (Xavier)" X-Patchwork-Id: 65008 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B466CA04DD; Tue, 21 Jan 2020 12:45:06 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0C0AD4C7B; Tue, 21 Jan 2020 12:44:54 +0100 (CET) Received: from incedge.chinasoftinc.com (unknown [114.113.233.8]) by dpdk.org (Postfix) with ESMTP id EFC3B322C for ; Tue, 21 Jan 2020 12:44:48 +0100 (CET) X-ASG-Debug-ID: 1579607080-0a3dd173f383950004-TfluYd Received: from mail.chinasoftinc.com (inccas002.ito.icss [10.168.0.52]) by incedge.chinasoftinc.com with ESMTP id 21fXzHlG4oF4UzdN (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 21 Jan 2020 19:44:46 +0800 (CST) X-Barracuda-Envelope-From: huwei013@chinasoftinc.com X-Barracuda-RBL-Trusted-Forwarder: 10.168.0.52 X-ASG-Whitelist: Client Received: from localhost.localdomain (114.119.4.74) by INCCAS002.ito.icss (10.168.0.60) with Microsoft SMTP Server id 14.3.439.0; Tue, 21 Jan 2020 19:44:40 +0800 From: "Wei Hu (Xavier)" X-Barracuda-RBL-Trusted-Forwarder: 10.168.0.60 To: Date: Tue, 21 Jan 2020 19:44:33 +0800 X-ASG-Orig-Subj: [PATCH 3/3] app/testpmd: fix uninitialized members when setting PFC Message-ID: <20200121114433.57543-4-huwei013@chinasoftinc.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200121114433.57543-1-huwei013@chinasoftinc.com> References: <20200121114433.57543-1-huwei013@chinasoftinc.com> MIME-Version: 1.0 X-Originating-IP: [114.119.4.74] X-Barracuda-Connect: inccas002.ito.icss[10.168.0.52] X-Barracuda-Start-Time: 1579607084 X-Barracuda-Encrypted: ECDHE-RSA-AES256-SHA X-Barracuda-URL: https://spam.chinasoftinc.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at chinasoftinc.com X-Barracuda-Scan-Msg-Size: 1384 Subject: [dpdk-dev] [PATCH 3/3] app/testpmd: fix uninitialized members when setting PFC 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: "Wei Hu (Xavier)" Only a part of members in the local structure variable named pfc_conf are initialized in the function named cmd_priority_flow_ctrl_set_parsed when typing "set pfc_ctrl..." command, and others are random values. However, those uninitialized members may cause failure. This patch adds clearing zero operation before calling the API named rte_eth_dev_priority_flow_ctrl_set API with pfc_conf as the input parameter. Fixes: 9b53e542e9e1 ("app/testpmd: add priority flow control") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Wei Hu (Xavier) Signed-off-by: Xuan Li Reviewed-by: Ferruh Yigit --- app/test-pmd/cmdline.c | 1 + 1 file changed, 1 insertion(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index a09cb87e1..b6d8ef0f0 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -7090,6 +7090,7 @@ cmd_priority_flow_ctrl_set_parsed(void *parsed_result, {RTE_FC_NONE, RTE_FC_TX_PAUSE}, {RTE_FC_RX_PAUSE, RTE_FC_FULL} }; + memset(&pfc_conf, 0, sizeof(struct rte_eth_pfc_conf)); rx_fc_enable = (!strncmp(res->rx_pfc_mode, "on",2)) ? 1 : 0; tx_fc_enable = (!strncmp(res->tx_pfc_mode, "on",2)) ? 1 : 0; pfc_conf.fc.mode = rx_tx_onoff_2_pfc_mode[rx_fc_enable][tx_fc_enable];