ethdev: fixed device info get issue
PATCH 1/1 ethdev: fixed device info get issue
This patch fixed error function call order in rte_eth_dev_configure. This wrong order makes user can't get correct device informations, and cause DCB configure issue.
--- lib/librte_ethdev/rte_ethdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
lib/librte_ethdev/rte_ethdev.c +3 -3
@@ -1053,6 +1053,9 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->dev_infos_get, -ENOTSUP );RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->dev_configure, -ENOTSUP ); +/* Copy the dev_conf parameter into the dev structure */ +memcpy (&dev->data->dev_conf, &local_conf,sizeof (dev->data->dev_conf)); +rte_eth_dev_info_get (port_id, &dev_info);/* If number of queues specified by application for both Rx and Tx is
@@ -1098,9 +1101,6 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,rte_eth_convert_rx_offload_bitfield ( &dev_conf->rxmode, &local_conf.rxmode.offloads); -/* Copy the dev_conf parameter into the dev structure */ -memcpy (&dev->data->dev_conf, &local_conf,sizeof (dev->data->dev_conf)); -/* * Check that the numbers of RX and TX queues are not greater * than the maximum number of RX and TX queues supported by the
Signature · 1 line
2.9.5
Quoted 26 lines · Qiming Yang
This patch fixed error function call order in
rte_eth_dev_configure. This wrong order makes user can't get correct device informations, and cause DCB configure issue.Fixes 3be82f5cc5e3 ("ethdev: support PMD-tuned Tx/Rx parameters")Signed-off-by Qiming Yang <[email protected]>--- lib/librte_ethdev/rte_ethdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)lib/librte_ethdev/rte_ethdev.c +3
-0@@ -1053,6 +1053,9 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->dev_infos_get, -ENOTSUP );RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->dev_configure, -ENOTSUP ); +/* Copy the dev_conf parameter into the dev structure */ +memcpy (&dev->data->dev_conf, &local_conf,sizeof (dev->data->dev_conf)); +rte_eth_dev_info_get (port_id, &dev_info);/* If number of queues specified by application for both Rx and Tx is
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 1103
Quoted 6 lines
lib/librte_ethdev/rte_ethdev.c +0
-3@@ -1098,9 +1101,6 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,rte_eth_convert_rx_offload_bitfield ( &dev_conf->rxmode, &local_conf.rxmode.offloads); -/* Copy the dev_conf parameter into the dev structure */ -memcpy (&dev->data->dev_conf, &local_conf,sizeof (dev->data->dev_conf)); -
As I understand the goal of this copy is to pickup offloads fill in done three lines above. The patch breaks it.
Quoted 3 lines
lib/librte_ethdev/rte_ethdev.c +0
-0/* * Check that the numbers of RX and TX queues are not greater * than the maximum number of RX and TX queues supported by the
Quoted 30 lines · Andrew Rybchenko
Quoted 29 lines · Qiming Yang
This patch fixed error function call order in
rte_eth_dev_configure. This wrong order makes user can't get correct device informations, and cause DCB configure issue.Fixes 3be82f5cc5e3 ("ethdev: support PMD-tuned Tx/Rx parameters")Signed-off-by Qiming Yang <[email protected]>--- lib/librte_ethdev/rte_ethdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)lib/librte_ethdev/rte_ethdev.c +3
-0@@ -1053,6 +1053,9 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->dev_infos_get, -ENOTSUP );RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->dev_configure, -ENOTSUP ); +/* Copy the dev_conf parameter into the dev structure */ +memcpy (&dev->data->dev_conf, &local_conf,sizeof (dev->data->dev_conf)); +rte_eth_dev_info_get (port_id, &dev_info);/* If number of queues specified by application for both Rx and Tx is @@ -1098,9 +1101,6 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,rte_eth_convert_rx_offload_bitfield ( &dev_conf->rxmode, &local_conf.rxmode.offloads);
Quoted 7 lines
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 1103
Quoted 3 lines
lib/librte_ethdev/rte_ethdev.c +0
-3-/* Copy the dev_conf parameter into the dev structure */ -memcpy (&dev->data->dev_conf, &local_conf,sizeof (dev->data->dev_conf)); -As I understand the goal of this copy is to pickup offloads fill in done three lines
above. The patch breaks it.
It can be possible to copy only local_conf.rxmode.offloads here:dev->data->dev_conf.rxmode.offloads = local_conf.rxmode.offloads;
And this assignment can be done within
"if (dev_conf->rxmode.ignore_offload_bitfield == 0)" block
And can you please add a comment to memcpy that it is required for dev_infos_get() and needs to be called before it.
Also more details into commit log why this is required for DCB configure.
Quoted 5 lines
Quoted 4 lines
lib/librte_ethdev/rte_ethdev.c +0
-0/* * Check that the numbers of RX and TX queues are not greater * than the maximum number of RX and TX queues supported by the
Quoted 50 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, May 15, 2018 7:31 PM
To: Andrew Rybchenko <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] ethdev: fixed device info get issueQuoted 12 lines · Andrew Rybchenko
Quoted 11 lines · Qiming Yang
This patch fixed error function call order in
rte_eth_dev_configure. This wrong order makes user can't get correct device informations, and cause DCB configure issue.Fixes 3be82f5cc5e3 ("ethdev: support PMD-tuned Tx/Rx parameters")Signed-off-by Qiming Yang <[email protected]>--- lib/librte_ethdev/rte_ethdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)Quoted 5 lines
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t
Quoted 5 lines
(quoted diff) +0
-0
b/lib/librte_ethdev/rte_ethdev.cindex b3ed821..97316f3 100644lib/librte_ethdev/rte_ethdev.c +0
-0@@ -1053,6 +1053,9 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t
nb_rx_q,uint16_tnb_tx_q,Quoted 1 line
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t · line 1053
Quoted 1 line
lib/librte_ethdev/rte_ethdev.c +0
-0RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
Quoted 1 line
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t · line 1054
Quoted 1 line
lib/librte_ethdev/rte_ethdev.c +0
-0RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
Quoted 9 lines
Quoted 9 lines
lib/librte_ethdev/rte_ethdev.c +4
-0+/* Copy the dev_conf parameter into the dev structure */ +memcpy (&dev->data->dev_conf, &local_conf, +sizeof (dev->data->dev_conf)); +rte_eth_dev_info_get (port_id, &dev_info);/* If number of queues specified by application for both Rx and Tx is @@ -1098,9 +1101,6 @@ rte_eth_dev_configure(uint16_t
port_id,
uint16_tnb_rx_q,uint16_tnb_tx_q,Quoted 2 lines
Quoted 2 lines
rte_eth_convert_rx_offload_bitfield(
&dev_conf->rxmode,&local_conf.rxmode.offloads);
Quoted 6 lines
lib/librte_ethdev/rte_ethdev.c
Quoted 3 lines
lib/librte_ethdev/rte_ethdev.c +0
-2-/* Copy the dev_conf parameter into the dev structure */ - memcpy(&dev->data->dev_conf, &local_conf, sizeof(dev->data-
dev_conf));Quoted 1 line
-
Quoted 9 lines
Quoted 2 lines
As I understand the goal of this copy is to pickup offloads fill in done three lines above. The patch breaks it.
It can be possible to copy only local_conf.rxmode.offloads here:
dev->data->dev_conf.rxmode.offloads= local_conf.rxmode.offloads;And this assignment can be done within
"if (dev_conf->rxmode.ignore_offload_bitfield== 0)" block
Thanks for the solution.
Quoted 4 lines
And can you please add a comment to memcpy that it is required for
dev_infos_get()and needs to be called before it.
Also more details into commit log why this is required for DCB configure.
Sure, I'll add detail comment.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
/*
* Check that the numbers of RX and TX queues are not greater
* than the maximum number of RX and TX queues supported by the
From: Andrew Rybchenko [mailto:[email protected]]
Sent: Tuesday, May 15, 2018 4:42 PM
To: Yang, Qiming <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH] ethdev: fixed device info get issue
On 05/15/2018 07:10 PM, Qiming Yang wrote:
This patch fixed error function call order in rte_eth_dev_configure.
This wrong order makes user can't get correct device informations,
and cause DCB configure issue.
---
lib/librte_ethdev/rte_ethdev.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
lib/librte_ethdev/rte_ethdev.c +0 -0
index b3ed821..97316f3 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -1053,6 +1053,9 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP); RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+ /* Copy the dev_conf parameter into the dev structure */
+ memcpy(&dev->data->dev_conf, &local_conf, sizeof(dev->data->dev_conf));
+
rte_eth_dev_info_get(port_id, &dev_info);
/* If number of queues specified by application for both Rx and Tx is@@ -1098,9 +1101,6 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
rte_eth_convert_rx_offload_bitfield(
&dev_conf->rxmode, &local_conf.rxmode.offloads);- /* Copy the dev_conf parameter into the dev structure */
- memcpy(&dev->data->dev_conf, &local_conf, sizeof(dev->data->dev_conf));
-
As I understand the goal of this copy is to pickup offloads fill in done three lines above. The patch breaks it.
Thanks for your reminder, I don’t know the background before. But Ferruh give a solution to resolve The conflict. I’ll send a v2 patch later.
/*
* Check that the numbers of RX and TX queues are not greater
* than the maximum number of RX and TX queues supported by the