All of lore.kernel.org
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/3] app/testpmd: fixes for testpmd application
@ 2020-01-21 11:44 Wei Hu (Xavier)
  2020-01-21 11:44 ` [dpdk-dev] [PATCH 1/3] app/testpmd: update Rx offload after setting MTU sccessfully Wei Hu (Xavier)
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Wei Hu (Xavier) @ 2020-01-21 11:44 UTC (permalink / raw)
  To: dev

These patchset are fixes for testpmd application.

Wei Hu (Xavier) (3):
  app/testpmd: update Rx offload after setting MTU sccessfully
  app/testpmd: fix the initial value when setting PFC
  app/testpmd: fix uninitialized members when setting PFC

 app/test-pmd/cmdline.c |  3 ++-
 app/test-pmd/config.c  | 18 +++++++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)

-- 
2.23.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [dpdk-dev] [PATCH 1/3] app/testpmd: update Rx offload after setting MTU sccessfully
  2020-01-21 11:44 [dpdk-dev] [PATCH 0/3] app/testpmd: fixes for testpmd application Wei Hu (Xavier)
@ 2020-01-21 11:44 ` Wei Hu (Xavier)
  2020-01-28 11:27   ` Ferruh Yigit
  2020-01-21 11:44 ` [dpdk-dev] [PATCH 2/3] app/testpmd: fix the initial value when setting PFC Wei Hu (Xavier)
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 12+ messages in thread
From: Wei Hu (Xavier) @ 2020-01-21 11:44 UTC (permalink / raw)
  To: dev

From: "Wei Hu (Xavier)" <xavier.huwei@huawei.com>

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 <port_id> <value>' 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 <lihuisong@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 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);
 }
 
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [dpdk-dev] [PATCH 2/3] app/testpmd: fix the initial value when setting PFC
  2020-01-21 11:44 [dpdk-dev] [PATCH 0/3] app/testpmd: fixes for testpmd application Wei Hu (Xavier)
  2020-01-21 11:44 ` [dpdk-dev] [PATCH 1/3] app/testpmd: update Rx offload after setting MTU sccessfully Wei Hu (Xavier)
@ 2020-01-21 11:44 ` Wei Hu (Xavier)
  2020-01-28 11:21   ` Ferruh Yigit
  2020-01-21 11:44 ` [dpdk-dev] [PATCH 3/3] app/testpmd: fix uninitialized members " Wei Hu (Xavier)
  2020-02-04 18:24 ` [dpdk-dev] [PATCH 0/3] app/testpmd: fixes for testpmd application Ferruh Yigit
  3 siblings, 1 reply; 12+ messages in thread
From: Wei Hu (Xavier) @ 2020-01-21 11:44 UTC (permalink / raw)
  To: dev

From: "Wei Hu (Xavier)" <xavier.huwei@huawei.com>

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 <lihuisong@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Xuan Li <lixuan47@hisilicon.com>
---
 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;
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [dpdk-dev] [PATCH 3/3] app/testpmd: fix uninitialized members when setting PFC
  2020-01-21 11:44 [dpdk-dev] [PATCH 0/3] app/testpmd: fixes for testpmd application Wei Hu (Xavier)
  2020-01-21 11:44 ` [dpdk-dev] [PATCH 1/3] app/testpmd: update Rx offload after setting MTU sccessfully Wei Hu (Xavier)
  2020-01-21 11:44 ` [dpdk-dev] [PATCH 2/3] app/testpmd: fix the initial value when setting PFC Wei Hu (Xavier)
@ 2020-01-21 11:44 ` Wei Hu (Xavier)
  2020-01-28 11:21   ` Ferruh Yigit
  2020-02-04 18:24 ` [dpdk-dev] [PATCH 0/3] app/testpmd: fixes for testpmd application Ferruh Yigit
  3 siblings, 1 reply; 12+ messages in thread
From: Wei Hu (Xavier) @ 2020-01-21 11:44 UTC (permalink / raw)
  To: dev

From: "Wei Hu (Xavier)" <xavier.huwei@huawei.com>

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 <lihuisong@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Xuan Li <lixuan47@hisilicon.com>
---
 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];
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH 2/3] app/testpmd: fix the initial value when setting PFC
  2020-01-21 11:44 ` [dpdk-dev] [PATCH 2/3] app/testpmd: fix the initial value when setting PFC Wei Hu (Xavier)
@ 2020-01-28 11:21   ` Ferruh Yigit
  2020-02-04 18:25     ` Ferruh Yigit
  0 siblings, 1 reply; 12+ messages in thread
From: Ferruh Yigit @ 2020-01-28 11:21 UTC (permalink / raw)
  To: Wei Hu (Xavier), dev

On 1/21/2020 11:44 AM, Wei Hu (Xavier) wrote:
> From: "Wei Hu (Xavier)" <xavier.huwei@huawei.com>
> 
> 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 <lihuisong@huawei.com>
> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
> Signed-off-by: Xuan Li <lixuan47@hisilicon.com>

Not tested but looks reasonable from the code, it would be nice if someone can
test it.

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH 3/3] app/testpmd: fix uninitialized members when setting PFC
  2020-01-21 11:44 ` [dpdk-dev] [PATCH 3/3] app/testpmd: fix uninitialized members " Wei Hu (Xavier)
@ 2020-01-28 11:21   ` Ferruh Yigit
  2020-02-04 18:25     ` Ferruh Yigit
  0 siblings, 1 reply; 12+ messages in thread
From: Ferruh Yigit @ 2020-01-28 11:21 UTC (permalink / raw)
  To: Wei Hu (Xavier), dev

On 1/21/2020 11:44 AM, Wei Hu (Xavier) wrote:
> From: "Wei Hu (Xavier)" <xavier.huwei@huawei.com>
> 
> 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 <lihuisong@huawei.com>
> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
> Signed-off-by: Xuan Li <lixuan47@hisilicon.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH 1/3] app/testpmd: update Rx offload after setting MTU sccessfully
  2020-01-21 11:44 ` [dpdk-dev] [PATCH 1/3] app/testpmd: update Rx offload after setting MTU sccessfully Wei Hu (Xavier)
@ 2020-01-28 11:27   ` Ferruh Yigit
  2020-02-12  0:25     ` Wei Hu (Xavier)
  0 siblings, 1 reply; 12+ messages in thread
From: Ferruh Yigit @ 2020-01-28 11:27 UTC (permalink / raw)
  To: Wei Hu (Xavier), dev; +Cc: Andrew Rybchenko, Thomas Monjalon, Matan Azrad

On 1/21/2020 11:44 AM, Wei Hu (Xavier) wrote:
> From: "Wei Hu (Xavier)" <xavier.huwei@huawei.com>
> 
> 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 <port_id> <value>' 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 <lihuisong@huawei.com>
> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
> ---
>  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;

If the jumbo frame capability supported or not should be tested before setting it.

> +		rte_port->dev_conf.rxmode.max_rx_pkt_len = mtu + eth_overhead;

May need to check against 'dev_info.max_rx_pktlen', if the 'max_rx_pkt_len' is
bigger than this, it will fail in next configure.

Also some divers already does this in PMD code, should we clean that code or not
is a question.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH 0/3] app/testpmd: fixes for testpmd application
  2020-01-21 11:44 [dpdk-dev] [PATCH 0/3] app/testpmd: fixes for testpmd application Wei Hu (Xavier)
                   ` (2 preceding siblings ...)
  2020-01-21 11:44 ` [dpdk-dev] [PATCH 3/3] app/testpmd: fix uninitialized members " Wei Hu (Xavier)
@ 2020-02-04 18:24 ` Ferruh Yigit
  3 siblings, 0 replies; 12+ messages in thread
From: Ferruh Yigit @ 2020-02-04 18:24 UTC (permalink / raw)
  To: Wei Hu (Xavier), dev

On 1/21/2020 11:44 AM, Wei Hu (Xavier) wrote:
> These patchset are fixes for testpmd application.
> 
> Wei Hu (Xavier) (3):
>   app/testpmd: update Rx offload after setting MTU sccessfully
>   app/testpmd: fix the initial value when setting PFC
>   app/testpmd: fix uninitialized members when setting PFC
> 

Since they are not dependent to each other, applied 2/3 and 3/3.

I would like to get more input for 1/3.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH 2/3] app/testpmd: fix the initial value when setting PFC
  2020-01-28 11:21   ` Ferruh Yigit
@ 2020-02-04 18:25     ` Ferruh Yigit
  0 siblings, 0 replies; 12+ messages in thread
From: Ferruh Yigit @ 2020-02-04 18:25 UTC (permalink / raw)
  To: Wei Hu (Xavier), dev

On 1/28/2020 11:21 AM, Ferruh Yigit wrote:
> On 1/21/2020 11:44 AM, Wei Hu (Xavier) wrote:
>> From: "Wei Hu (Xavier)" <xavier.huwei@huawei.com>
>>
>> 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 <lihuisong@huawei.com>
>> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
>> Signed-off-by: Xuan Li <lixuan47@hisilicon.com>
> 
> Not tested but looks reasonable from the code, it would be nice if someone can
> test it.
> 
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
> 

Applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH 3/3] app/testpmd: fix uninitialized members when setting PFC
  2020-01-28 11:21   ` Ferruh Yigit
@ 2020-02-04 18:25     ` Ferruh Yigit
  0 siblings, 0 replies; 12+ messages in thread
From: Ferruh Yigit @ 2020-02-04 18:25 UTC (permalink / raw)
  To: Wei Hu (Xavier), dev

On 1/28/2020 11:21 AM, Ferruh Yigit wrote:
> On 1/21/2020 11:44 AM, Wei Hu (Xavier) wrote:
>> From: "Wei Hu (Xavier)" <xavier.huwei@huawei.com>
>>
>> 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 <lihuisong@huawei.com>
>> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
>> Signed-off-by: Xuan Li <lixuan47@hisilicon.com>
> 
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
> 

Applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH 1/3] app/testpmd: update Rx offload after setting MTU sccessfully
  2020-01-28 11:27   ` Ferruh Yigit
@ 2020-02-12  0:25     ` Wei Hu (Xavier)
  2020-02-13  1:52       ` Wei Hu (Xavier)
  0 siblings, 1 reply; 12+ messages in thread
From: Wei Hu (Xavier) @ 2020-02-12  0:25 UTC (permalink / raw)
  To: Ferruh Yigit, dev
  Cc: Wei Hu (Xavier), Andrew Rybchenko, Thomas Monjalon, Matan Azrad

Hi, Ferruh Yigit

On 2020/1/28 19:27, Ferruh Yigit wrote:
> On 1/21/2020 11:44 AM, Wei Hu (Xavier) wrote:
>> From: "Wei Hu (Xavier)" <xavier.huwei@huawei.com>
>>
>> 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 <port_id> <value>' 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 <lihuisong@huawei.com>
>> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
>> ---
>>   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;
> 
> If the jumbo frame capability supported or not should be tested before setting it.
> 
>> +		rte_port->dev_conf.rxmode.max_rx_pkt_len = mtu + eth_overhead;
> 
> May need to check against 'dev_info.max_rx_pktlen', if the 'max_rx_pkt_len' is
> bigger than this, it will fail in next configure.
> 
> Also some divers already does this in PMD code, should we clean that code or not
> is a question.
> 
The snippset is adjusted as follows:

if (mtu > RTE_ETHER_MAX_LEN - eth_overhead && dev_info.rx_offload_capa & 
DEV_RX_OFFLOAD_JUMBO_FRAME) {
	rte_port->dev_conf.rxmode.offloads |= 			
                                          DEV_RX_OFFLOAD_JUMBO_FRAME;
	rte_port->dev_conf.rxmode.max_rx_pkt_len = mtu + eth_overhead;
} else
	rte_port->dev_conf.rxmode.offloads &=
					~DEV_RX_OFFLOAD_JUMBO_FRAME;

We only modifies the internal variables of testpmd, don't impact on the 
implementation of the driver.

Thanks for more suggestions.

Xavier

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH 1/3] app/testpmd: update Rx offload after setting MTU sccessfully
  2020-02-12  0:25     ` Wei Hu (Xavier)
@ 2020-02-13  1:52       ` Wei Hu (Xavier)
  0 siblings, 0 replies; 12+ messages in thread
From: Wei Hu (Xavier) @ 2020-02-13  1:52 UTC (permalink / raw)
  To: Ferruh Yigit, dev; +Cc: Andrew Rybchenko, Thomas Monjalon, Matan Azrad

Hi, Ferruh Yigit

On 2020/2/12 8:25, Wei Hu (Xavier) wrote:
> Hi, Ferruh Yigit
> 
> On 2020/1/28 19:27, Ferruh Yigit wrote:
>> On 1/21/2020 11:44 AM, Wei Hu (Xavier) wrote:
>>> From: "Wei Hu (Xavier)" <xavier.huwei@huawei.com>
>>>
>>> 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 <port_id> <value>' 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 <lihuisong@huawei.com>
>>> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
>>> ---
>>>   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;
>>
>> If the jumbo frame capability supported or not should be tested before 
>> setting it.
>>
>>> +        rte_port->dev_conf.rxmode.max_rx_pkt_len = mtu + eth_overhead;
>>
>> May need to check against 'dev_info.max_rx_pktlen', if the 
>> 'max_rx_pkt_len' is
>> bigger than this, it will fail in next configure.
>>
>> Also some divers already does this in PMD code, should we clean that 
>> code or not
>> is a question.
>>
> The snippset is adjusted as follows:
> 
> if (mtu > RTE_ETHER_MAX_LEN - eth_overhead && dev_info.rx_offload_capa & 
> DEV_RX_OFFLOAD_JUMBO_FRAME) {
>      rte_port->dev_conf.rxmode.offloads |=
>                                           DEV_RX_OFFLOAD_JUMBO_FRAME;
>      rte_port->dev_conf.rxmode.max_rx_pkt_len = mtu + eth_overhead;
> } else
>      rte_port->dev_conf.rxmode.offloads &=
>                      ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> 
> We only modifies the internal variables of testpmd, don't impact on the 
> implementation of the driver.
> 
> Thanks for more suggestions.
> 
> XavierThe code is modified as follows:

diag = rte_eth_dev_set_mtu(port_id, mtu);
if (diag == 0 &&
     dev_info.rx_offload_capa & DEV_RX_OFFLOAD_JUMBO_FRAME) {
          /*
           * Ether overhead in driver is equal to the difference of
           * max_rx_pktlen and max_mtu in rte_eth_dev_info when the
           * device supports jumbo frame.
           */
          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;
                 rte_port->dev_conf.rxmode.max_rx_pkt_len =
                         mtu + eth_overhead;
          } else
                 rte_port->dev_conf.rxmode.offloads &= 

                        ~DEV_RX_OFFLOAD_JUMBO_FRAME;

         return;
}

We will send V2. Thanks

Xavier


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-02-13  1:52 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-21 11:44 [dpdk-dev] [PATCH 0/3] app/testpmd: fixes for testpmd application Wei Hu (Xavier)
2020-01-21 11:44 ` [dpdk-dev] [PATCH 1/3] app/testpmd: update Rx offload after setting MTU sccessfully Wei Hu (Xavier)
2020-01-28 11:27   ` Ferruh Yigit
2020-02-12  0:25     ` Wei Hu (Xavier)
2020-02-13  1:52       ` Wei Hu (Xavier)
2020-01-21 11:44 ` [dpdk-dev] [PATCH 2/3] app/testpmd: fix the initial value when setting PFC Wei Hu (Xavier)
2020-01-28 11:21   ` Ferruh Yigit
2020-02-04 18:25     ` Ferruh Yigit
2020-01-21 11:44 ` [dpdk-dev] [PATCH 3/3] app/testpmd: fix uninitialized members " Wei Hu (Xavier)
2020-01-28 11:21   ` Ferruh Yigit
2020-02-04 18:25     ` Ferruh Yigit
2020-02-04 18:24 ` [dpdk-dev] [PATCH 0/3] app/testpmd: fixes for testpmd application Ferruh Yigit

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.