ethdev: fix device info getting
PATCH 1/1 ethdev: fix device info getting
The device information cannot be gotten correctly before the configuration is set. Because on some NICs the information has dependence on the configuration.
--- lib/librte_ethdev/rte_ethdev.c | 47 +++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 23 deletions(-)
lib/librte_ethdev/rte_ethdev.c +24 -23
@@ -1017,28 +1017,6 @@ struct rte_eth_dev *RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -EINVAL ); - dev = &rte_eth_devices[port_id]; - -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 ); - -rte_eth_dev_info_get (port_id, &dev_info); - -/* If number of queues specified by application for both Rx and Tx is -* zero, use driver preferred values. This cannot be done individually -* as it is valid for either Tx or Rx (but not both) to be zero. -* If driver does not provide any preferred valued, fall back on -* EAL defaults. -*/ -if (nb_rx_q ==0 && nb_tx_q ==0 ) { - nb_rx_q = dev_info.default_rxportconf.nb_queues; -if (nb_rx_q ==0 ) - nb_rx_q =RTE_ETH_DEV_FALLBACK_RX_NBQUEUES ; - nb_tx_q = dev_info.default_txportconf.nb_queues; -if (nb_tx_q ==0 ) - nb_tx_q =RTE_ETH_DEV_FALLBACK_TX_NBQUEUES ; - } -if (nb_rx_q >RTE_MAX_QUEUES_PER_PORT ) { RTE_ETHDEV_LOG(ERR, "Number of RX queues requested (%u) is greater than max supported(%d)\n",
@@ -1053,6 +1031,11 @@ struct rte_eth_dev *return -EINVAL ; } + dev = &rte_eth_devices[port_id]; + +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 ); +if (dev->data->dev_started) { RTE_ETHDEV_LOG(ERR, "Port %u must be stopped to allow configuration\n",
@@ -1060,8 +1043,26 @@ struct rte_eth_dev *return -EBUSY ; } -/* Copy the dev_conf parameter into the dev structure */ +/* Copy the dev_conf parameter into the dev structure, +* then get the info. +*/ 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 +* zero, use driver preferred values. This cannot be done individually +* as it is valid for either Tx or Rx (but not both) to be zero. +* If driver does not provide any preferred valued, fall back on +* EAL defaults. +*/ +if (nb_rx_q ==0 && nb_tx_q ==0 ) { + nb_rx_q = dev_info.default_rxportconf.nb_queues; +if (nb_rx_q ==0 ) + nb_rx_q =RTE_ETH_DEV_FALLBACK_RX_NBQUEUES ; + nb_tx_q = dev_info.default_txportconf.nb_queues; +if (nb_tx_q ==0 ) + nb_tx_q =RTE_ETH_DEV_FALLBACK_TX_NBQUEUES ; + }/* * Check that the numbers of RX and TX queues are not greater
Signature · 1 line
1.9.3
Quoted 69 lines · Wenzhuo Lu
The device information cannot be gotten correctly before the configuration is set. Because on some NICs the information has dependence on the configuration.
Fixes 3be82f5cc5e3 ("ethdev: support PMD-tuned Tx/Rx parameters")Signed-off-by Wenzhuo Lu <[email protected]>--- lib/librte_ethdev/rte_ethdev.c | 47 +++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 23 deletions(-)lib/librte_ethdev/rte_ethdev.c +13
-23@@ -1017,28 +1017,6 @@ struct rte_eth_dev *RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -EINVAL ); - dev = &rte_eth_devices[port_id]; - -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 ); - -rte_eth_dev_info_get (port_id, &dev_info); - -/* If number of queues specified by application for both Rx and Tx is -* zero, use driver preferred values. This cannot be done individually -* as it is valid for either Tx or Rx (but not both) to be zero. -* If driver does not provide any preferred valued, fall back on -* EAL defaults. -*/ -if (nb_rx_q ==0 && nb_tx_q ==0 ) { - nb_rx_q = dev_info.default_rxportconf.nb_queues; -if (nb_rx_q ==0 ) - nb_rx_q =RTE_ETH_DEV_FALLBACK_RX_NBQUEUES ; - nb_tx_q = dev_info.default_txportconf.nb_queues; -if (nb_tx_q ==0 ) - nb_tx_q =RTE_ETH_DEV_FALLBACK_TX_NBQUEUES ; - } -if (nb_rx_q >RTE_MAX_QUEUES_PER_PORT ) { RTE_ETHDEV_LOG(ERR, "Number of RX queues requested (%u) is greater than max supported(%d)\n",@@ -1053,6 +1031,11 @@ struct rte_eth_dev *return -EINVAL ; } + dev = &rte_eth_devices[port_id]; + +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 ); +if (dev->data->dev_started) { RTE_ETHDEV_LOG(ERR, "Port %u must be stopped to allow configuration\n",@@ -1060,8 +1043,26 @@ struct rte_eth_dev *return -EBUSY ; } -/* Copy the dev_conf parameter into the dev structure */ +/* Copy the dev_conf parameter into the dev structure, +* then get the info. +*/ 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 +* zero, use driver preferred values. This cannot be done individually +* as it is valid for either Tx or Rx (but not both) to be zero.
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev * · line 1064
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +10
-0+* If driver does not provide any preferred valued, fall back on +* EAL defaults. +*/ +if (nb_rx_q ==0 && nb_tx_q ==0 ) { + nb_rx_q = dev_info.default_rxportconf.nb_queues; +if (nb_rx_q ==0 ) + nb_rx_q =RTE_ETH_DEV_FALLBACK_RX_NBQUEUES ; + nb_tx_q = dev_info.default_txportconf.nb_queues; +if (nb_tx_q ==0 ) + nb_tx_q =RTE_ETH_DEV_FALLBACK_TX_NBQUEUES ;
Values assigned in this branch are not checked against RTE_MAX_QUEUES_PER_PORT and RTE_MAX_QUEUES_PER_PORT now
Quoted 4 lines
lib/librte_ethdev/rte_ethdev.c +1
-0+ }/* * Check that the numbers of RX and TX queues are not greater
Hi Andrew,
Quoted 89 lines
-----Original Message-----
From: Andrew Rybchenko [mailto:[email protected]]
Sent: Thursday, July 12, 2018 4:06 PM
To: Lu, Wenzhuo <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH] ethdev: fix device info gettingQuoted 8 lines · Wenzhuo Lu
The device information cannot be gotten correctly before the configuration is set. Because on some NICs the information has dependence on the configuration.
Fixes 3be82f5cc5e3 ("ethdev: support PMD-tuned Tx/Rx parameters")Signed-off-by Wenzhuo Lu <[email protected]>--- lib/librte_ethdev/rte_ethdev.c | 47 +++++++++++++++++++++---------------------
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev * · line 1022
Quoted 13 lines
1 file changed, 24 insertions(+), 23 deletions(-)(quoted diff) +0
-0
b/lib/librte_ethdev/rte_ethdev.cindex 3d556a8..9d60bea 100644lib/librte_ethdev/rte_ethdev.c +0
-3@@ -1017,28 +1017,6 @@ struct rte_eth_dev *RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -EINVAL ); - dev = &rte_eth_devices[port_id]; - - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev * · line 1023
Quoted 1 line
lib/librte_ethdev/rte_ethdev.c +0
-1- RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
Quoted 11 lines
lib/librte_ethdev/rte_ethdev.c +0
-11- -rte_eth_dev_info_get (port_id, &dev_info); - -/* If number of queues specified by application for both Rx and Tx is -* zero, use driver preferred values. This cannot be done individually -* as it is valid for either Tx or Rx (but not both) to be zero. -* If driver does not provide any preferred valued, fall back on -* EAL defaults. -*/ -if (nb_rx_q ==0 && nb_tx_q ==0 ) { - nb_rx_q = dev_info.default_rxportconf.nb_queues;lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev *
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +0
-7-if (nb_rx_q ==0 ) - nb_rx_q =RTE_ETH_DEV_FALLBACK_RX_NBQUEUES ; - nb_tx_q = dev_info.default_txportconf.nb_queues; -if (nb_tx_q ==0 ) - nb_tx_q =RTE_ETH_DEV_FALLBACK_TX_NBQUEUES ; - } -if (nb_rx_q >RTE_MAX_QUEUES_PER_PORT ) { RTE_ETHDEV_LOG(ERR, "Number of RX queues requested (%u) is greaterthan max
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev *
Quoted 7 lines
supported(%d)\n", @@ -1053,6 +1031,11 @@ struct
rte_eth_dev*
return-EINVAL;
}lib/librte_ethdev/rte_ethdev.c +3
-0+ dev = &rte_eth_devices[port_id]; + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
lib/librte_ethdev/rte_ethdev.c
Quoted 1 line
lib/librte_ethdev/rte_ethdev.c +1
-0+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
Quoted 4 lines
+
if (dev->data->dev_started) {
RTE_ETHDEV_LOG(ERR,
"Port %u must be stopped to allow configuration\n",@@ -1060,8
Quoted 20 lines
+1043,26 @@ struct
rte_eth_dev*
return-EBUSY;
}lib/librte_ethdev/rte_ethdev.c +3
-1-/* Copy the dev_conf parameter into the dev structure */ +/* Copy the dev_conf parameter into the dev structure, +* then get the info. +*/ memcpy(&dev->data->dev_conf, &local_conf,
sizeof(dev->data->dev_conf));lib/librte_ethdev/rte_ethdev.c +10
-0+rte_eth_dev_info_get (port_id, &dev_info); + +/* If number of queues specified by application for both Rx and Tx is +* zero, use driver preferred values. This cannot be done individually +* as it is valid for either Tx or Rx (but not both) to be zero. +* If driver does not provide any preferred valued, fall back on +* EAL defaults. +*/ +if (nb_rx_q ==0 && nb_tx_q ==0 ) { + nb_rx_q = dev_info.default_rxportconf.nb_queues;
Quoted 8 lines
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev * · line 1064
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.c +5
-0+if (nb_rx_q ==0 ) + nb_rx_q =RTE_ETH_DEV_FALLBACK_RX_NBQUEUES ; + nb_tx_q = dev_info.default_txportconf.nb_queues; +if (nb_tx_q ==0 ) + nb_tx_q =RTE_ETH_DEV_FALLBACK_TX_NBQUEUES ;Values assigned in this branch are not checked against
RTE_MAX_QUEUES_PER_PORTandRTE_MAX_QUEUES_PER_PORTnow
O, I supposed the default values cannot be larger than RTE_MAX_QUEUES_PER_PORT. But, yes, it's each NIC's decision. My assumption can be wrong. I'll move the check down here.
Quoted 5 lines
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.c +1
-0+ }/* * Check that the numbers of RX and TX queues are not greater
PATCH v2 1/1 ethdev: fix device info getting
In reply to Wenzhuo LuThe device information cannot be gotten correctly before the configuration is set. Because on some NICs the information has dependence on the configuration.
--- lib/librte_ethdev/rte_ethdev.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
lib/librte_ethdev/rte_ethdev.c +11 -10
@@ -1022,6 +1022,17 @@ struct rte_eth_dev *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 ); +if (dev->data->dev_started) { +RTE_ETHDEV_LOG (ERR , +"Port %u must be stopped to allow configuration\n" , + port_id); +return -EBUSY ; + } + +/* Copy the dev_conf parameter into the dev structure, +* then get the info. +*/ +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
@@ -1053,16 +1064,6 @@ struct rte_eth_dev *return -EINVAL ; } -if (dev->data->dev_started) { -RTE_ETHDEV_LOG (ERR , -"Port %u must be stopped to allow configuration\n" , - port_id); -return -EBUSY ; - } - -/* 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
1.9.3
Hi, Wenzhuo,
I'm sorry, but I have more even harder questions than the previous one. This questions are rather generic and mainly to ethdev maintainers.
Quoted 3 lines · Wenzhuo Lu
The device information cannot be gotten correctly before the configuration is set. Because on some NICs the information has dependence on the configuration.
Thinking about it I have the following question. Is it valid behaviour of the dev_info if it changes after configuration?
I always thought that the primary goal of the dev_info is to provide information to app about device capabilities to allow app configure device and queues correctly. Now we see the case when dev_info changes on configure. May be it is acceptable, but it is really suspicious. If we accept it, it should be documented. May be dev_info should be split into parts: part which is persistent and part which may depend on device configuration.
Quoted 15 lines
Fixes 3be82f5cc5e3 ("ethdev: support PMD-tuned Tx/Rx parameters")Signed-off-by Wenzhuo Lu <[email protected]>--- lib/librte_ethdev/rte_ethdev.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)lib/librte_ethdev/rte_ethdev.c +1
-0@@ -1022,6 +1022,17 @@ struct rte_eth_dev *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 ); +if (dev->data->dev_started) {
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev * · line 1035
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +10
-0+RTE_ETHDEV_LOG (ERR , +"Port %u must be stopped to allow configuration\n" , + port_id); +return -EBUSY ; + } + +/* Copy the dev_conf parameter into the dev structure, +* then get the info. +*/ +memcpy (&dev->data->dev_conf, &local_conf,sizeof (dev->data->dev_conf));
It is not a problem of the patch, but I'd like to highlight it to Ferruh and Thomas. What we have in the case of below failures? State is really inconsistent in the case of reconfigure. We have applied new dev_conf, but we still have previous Rx/Tx queues which were setup before.
Quoted 20 lines
lib/librte_ethdev/rte_ethdev.c +0
-10rte_eth_dev_info_get (port_id, &dev_info);/* If number of queues specified by application for both Rx and Tx is @@ -1053,16 +1064,6 @@ struct rte_eth_dev *return -EINVAL ; } -if (dev->data->dev_started) { -RTE_ETHDEV_LOG (ERR , -"Port %u must be stopped to allow configuration\n" , - port_id); -return -EBUSY ; - } - -/* 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
Hi Andrew,
Quoted 18 lines
-----Original Message-----
From: Andrew Rybchenko [mailto:[email protected]]
Sent: Friday, July 13, 2018 4:03 PM
To: Lu, Wenzhuo <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingHi, Wenzhuo,
I'm sorry, but I have more even harder questions than the previous one. This questions are rather generic and mainly to ethdev maintainers.
Quoted 3 lines · Wenzhuo Lu
The device information cannot be gotten correctly before the configuration is set. Because on some NICs the information has dependence on the configuration.
Quoted 9 lines
Thinking about it I have the following question. Is it valid behaviour of the
dev_infoif it changes after configuration?
I always thought that the primary goal of thedev_infois to provide information to app about device capabilities to allow app configure device and queues correctly. Now we see the case whendev_infochanges on configure. May be it is acceptable, but it is really suspicious. If we accept it, it should be documented.
May bedev_infoshould be split into parts: part which is persistent and part which may depend on device configuration.
As I remember, the similar discussion has happened :) I've raised the similar suggestion like this. But we don’t make it happen.
The reason is, you see, this is the rte layer's behavior. So the user doesn't have to know it. From APP's PoV, it inputs the configuration, it calls this API "rte_eth_dev_configure". It doesn't know the configuration is copied before getting the info or not. So, to my opinion, we can still keep the behavior. We only need to split it into parts when we do see the case that cannot make it.
Quoted 56 lines
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev * · line 1022
Quoted 13 lines
Fixes 3be82f5cc5e3 ("ethdev: support PMD-tuned Tx/Rx parameters")Signed-off-by Wenzhuo Lu <[email protected]>--- lib/librte_ethdev/rte_ethdev.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)(quoted diff) +0
-0
b/lib/librte_ethdev/rte_ethdev.cindex 3d556a8..6f606c1 100644lib/librte_ethdev/rte_ethdev.c +0
-0@@ -1022,6 +1022,17 @@ struct rte_eth_dev * RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev * · line 1023
Quoted 1 line
lib/librte_ethdev/rte_ethdev.c +0
-0RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev *
Quoted 13 lines
lib/librte_ethdev/rte_ethdev.c +12
-0+if (dev->data->dev_started) { +RTE_ETHDEV_LOG (ERR , +"Port %u must be stopped to allow configuration\n" , + port_id); +return -EBUSY ; + } + +/* Copy the dev_conf parameter into the dev structure, +* then get the info. +*/ +memcpy (&dev->data->dev_conf, &local_conf, +sizeof (dev->data->dev_conf));It is not a problem of the patch, but I'd like to highlight it to Ferruh and Thomas. What we have in the case of below failures? State is really inconsistent in the case of reconfigure. We have applied new
dev_conf, but we still have previous Rx/Tx queues which were setup before.Quoted 21 lines
lib/librte_ethdev/rte_ethdev.c +0
-0rte_eth_dev_info_get (port_id, &dev_info);/* If number of queues specified by application for both Rx and Tx is @@ -1053,16 +1064,6 @@ struct
rte_eth_dev*
return-EINVAL;
}lib/librte_ethdev/rte_ethdev.c +0
-9-if (dev->data->dev_started) { -RTE_ETHDEV_LOG (ERR , -"Port %u must be stopped to allow configuration\n" , - port_id); -return -EBUSY ; - } - -/* 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
Hi Andrew,
Quoted 37 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Lu, Wenzhuo
Sent: Monday, July 16, 2018 9:08 AM
To: Andrew Rybchenko <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingHi Andrew,
Quoted 18 lines
-----Original Message-----
From: Andrew Rybchenko [mailto:[email protected]]
Sent: Friday, July 13, 2018 4:03 PM
To: Lu, Wenzhuo <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingHi, Wenzhuo,
I'm sorry, but I have more even harder questions than the previous one. This questions are rather generic and mainly to ethdev maintainers.
Quoted 3 lines · Wenzhuo Lu
The device information cannot be gotten correctly before the configuration is set. Because on some NICs the information has dependence on the configuration.
Quoted 9 lines
Thinking about it I have the following question. Is it valid behaviour of the
dev_infoif it changes after configuration?
I always thought that the primary goal of thedev_infois to provide information to app about device capabilities to allow app configure device and queues correctly. Now we see the case whendev_infochanges on configure. May be it is acceptable, but it is really suspicious. If we accept it, it should be documented.
May bedev_infoshould be split into parts: part which is persistent and part which may depend on device configuration.
Quoted 8 lines
As I remember, the similar discussion has happened :) I've raised the similar suggestion like this. But we don’t make it happen.
The reason is, you see, this is the rte layer's behavior. So the user doesn't have to know it. From APP's PoV, it inputs the configuration, it calls this API "rte_eth_dev_configure". It doesn't know the configuration is copied before getting the info or not.
So, to my opinion, we can still keep the behavior. We only need to split it into parts when we do see the case that cannot make it.
Maybe I talked too much about the patch. Think about it again. Your comments is about how to use the APIs,rte_eth_dev_info_get, rte_eth_dev_configure. To my opinion, rte_eth_dev_info_get is just to get the info. It can be called anywhere, before configuration or after. It's reasonable the info changes with the configuration changing. But we do have something missing, like, rte_eth_dev_capability_get which should be stable. APP can use this API to get the necessary info before configuration.
A question, maybe a little divergent thinking, that APP should have some intelligence to handle the capability automatically. So getting the capability is not so good and effective, looks like we still need the human involvement. Maybe that the reason currently we suppose APP know the capability from the paper copies, examples...
Quoted 57 lines
Quoted 57 lines
Quoted 13 lines
Fixes 3be82f5cc5e3 ("ethdev: support PMD-tuned Tx/Rx parameters")Signed-off-by Wenzhuo Lu <[email protected]>--- lib/librte_ethdev/rte_ethdev.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)(quoted diff) +0
-0
b/lib/librte_ethdev/rte_ethdev.cindex 3d556a8..6f606c1 100644lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev * · line 1022
Quoted 1 line
lib/librte_ethdev/rte_ethdev.c +0
-0@@ -1022,6 +1022,17 @@ struct rte_eth_dev * RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev * · line 1023
Quoted 1 line
lib/librte_ethdev/rte_ethdev.c +0
-0RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev *
Quoted 13 lines
lib/librte_ethdev/rte_ethdev.c +12
-0+if (dev->data->dev_started) { +RTE_ETHDEV_LOG (ERR , +"Port %u must be stopped to allow configuration\n" , + port_id); +return -EBUSY ; + } + +/* Copy the dev_conf parameter into the dev structure, +* then get the info. +*/ +memcpy (&dev->data->dev_conf, &local_conf, +sizeof (dev->data->dev_conf));It is not a problem of the patch, but I'd like to highlight it to Ferruh and Thomas. What we have in the case of below failures? State is really inconsistent in the case of reconfigure. We have applied new
dev_conf, but we still have previous Rx/Tx queues which were setup before.Quoted 21 lines
lib/librte_ethdev/rte_ethdev.c +0
-0rte_eth_dev_info_get (port_id, &dev_info);/* If number of queues specified by application for both Rx and Tx is @@ -1053,16 +1064,6 @@ struct
rte_eth_dev*
return-EINVAL;
}lib/librte_ethdev/rte_ethdev.c +0
-9-if (dev->data->dev_started) { -RTE_ETHDEV_LOG (ERR , -"Port %u must be stopped to allow configuration\n" , - port_id); -return -EBUSY ; - } - -/* 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
16/07/2018 03:58, Lu, Wenzhuo:
Quoted 47 lines
Hi Andrew,
Quoted 37 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Lu, Wenzhuo
Sent: Monday, July 16, 2018 9:08 AM
To: Andrew Rybchenko <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingHi Andrew,
Quoted 18 lines
-----Original Message-----
From: Andrew Rybchenko [mailto:[email protected]]
Sent: Friday, July 13, 2018 4:03 PM
To: Lu, Wenzhuo <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingHi, Wenzhuo,
I'm sorry, but I have more even harder questions than the previous one. This questions are rather generic and mainly to ethdev maintainers.
Quoted 3 lines · Wenzhuo Lu
The device information cannot be gotten correctly before the configuration is set. Because on some NICs the information has dependence on the configuration.
Quoted 9 lines
Thinking about it I have the following question. Is it valid behaviour of the
dev_infoif it changes after configuration?
I always thought that the primary goal of thedev_infois to provide information to app about device capabilities to allow app configure device and queues correctly. Now we see the case whendev_infochanges on configure. May be it is acceptable, but it is really suspicious. If we accept it, it should be documented.
May bedev_infoshould be split into parts: part which is persistent and part which may depend on device configuration.Quoted 8 lines
As I remember, the similar discussion has happened :) I've raised the similar suggestion like this. But we don’t make it happen.
The reason is, you see, this is the rte layer's behavior. So the user doesn't have to know it. From APP's PoV, it inputs the configuration, it calls this API "rte_eth_dev_configure". It doesn't know the configuration is copied before getting the info or not.
So, to my opinion, we can still keep the behavior. We only need to split it into parts when we do see the case that cannot make it.
Quoted 5 lines
Maybe I talked too much about the patch. Think about it again. Your comments is about how to use the APIs,
rte_eth_dev_info_get,rte_eth_dev_configure. To my opinion,rte_eth_dev_info_getis just to get the info. It can be called anywhere, before configuration or after. It's reasonable the info changes with the configuration changing. But we do have something missing, like,rte_eth_dev_capability_getwhich should be stable. APP can use this API to get the necessary info before configuration.A question, maybe a little divergent thinking, that APP should have some intelligence to handle the capability automatically. So getting the capability is not so good and effective, looks like we still need the human involvement. Maybe that the reason currently we suppose APP know the capability from the paper copies, examples...
I am not sure to understand all the sentences.
But I agree that we should take a decision about the stability of these infos.
Either infos cannot change after probing,
or we must document that the app must request infos regularly (when?).
Hi Thomas,
Quoted 71 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Wednesday, August 1, 2018 11:37 PM
To: Lu, Wenzhuo <[email protected]>; Andrew Rybchenko <[email protected]>; Yigit, Ferruh <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info getting16/07/2018 03:58, Lu, Wenzhuo:
Quoted 47 lines
Hi Andrew,
Quoted 37 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Lu, Wenzhuo
Sent: Monday, July 16, 2018 9:08 AM
To: Andrew Rybchenko <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingHi Andrew,
Quoted 18 lines
-----Original Message-----
From: Andrew Rybchenko [mailto:[email protected]]
Sent: Friday, July 13, 2018 4:03 PM
To: Lu, Wenzhuo <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingHi, Wenzhuo,
I'm sorry, but I have more even harder questions than the previous one. This questions are rather generic and mainly to ethdev maintainers.
Quoted 3 lines · Wenzhuo Lu
The device information cannot be gotten correctly before the configuration is set. Because on some NICs the information has dependence on the configuration.
Quoted 9 lines
Thinking about it I have the following question. Is it valid behaviour of the
dev_infoif it changes after configuration? I always thought that the primary goal of thedev_infois to provide information to app about device capabilities to allow app configure device and queues correctly. Now we see the case whendev_infochanges on configure. May be it is acceptable, but it is really suspicious. If we accept it, it should be documented. May bedev_infoshould be split into parts: part which is persistent and part which may depend on device configuration.Quoted 8 lines
As I remember, the similar discussion has happened :) I've raised the similar suggestion like this. But we don’t make it happen. The reason is, you see, this is the rte layer's behavior. So the user doesn't have to know it. From APP's PoV, it inputs the configuration, it calls this API "
rte_eth_dev_configure". It doesn't know the configuration is copied before getting the info or not. So, to my opinion, we can still keep the behavior. We only need to split it into parts when we do see the case that cannot make it.Quoted 2 lines
Maybe I talked too much about the patch. Think about it again. Your comments is about how to use the APIs,
rte_eth_dev_info_get,
rte_eth_dev_configure. To my opinion,rte_eth_dev_info_getis just to get the info. It can be called anywhere, before configuration or after. It's reasonable the info changes with the configuration changing.Quoted 1 line
But we do have something missing, like,
rte_eth_dev_capability_getwhichshould be stable. APP can use this API to get the necessary info before configuration.
Quoted 2 lines
A question, maybe a little divergent thinking, that APP should have some
intelligence to handle the capability automatically. So getting the capability is not so good and effective, looks like we still need the human involvement. Maybe that the reason currently we suppose APP know the capability from the paper copies, examples...
Quoted 4 lines
I am not sure to understand all the sentences.
But I agree that we should take a decision about the stability of these infos. Either infos cannot change after probing, or we must document that the app must request infos regularly (when?).
Sorry, I missed this mail.
I have the concern that different NICs have different behavior. One info can be stable on a NIC but dynamic on another. Considering this, we may better not splitting the rte_eth_dev_info_get to 2 APIs. And comparing with handling this in rte layer, maybe we can let every NIC has its own decision. I have an idea. Maybe we can add a parameter for potential dynamic fields. Like,
Changinguint16_t nb_rx_queues;
to
struct nb_rx_queues {uint16_t value;
bool stable;
}
By default, the stable is false. Then every NIC can maintain its own behavior.
Some fileds that must be stable can be left unchanged, like, driver_name, max_rx_queues.
As this patch is just reversing a bad commit to fix a bug, if my idea sounds good or worth discussing, I can send another RFC mail for it.
Quoted 78 lines · Wenzhuo
Hi Thomas,
Quoted 69 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Wednesday, August 1, 2018 11:37 PM
To: Lu, Wenzhuo <[email protected]>; Andrew Rybchenko <[email protected]>; Yigit, Ferruh <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info getting16/07/2018 03:58, Lu, Wenzhuo:
Quoted 46 lines
Hi Andrew,
Quoted 36 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Lu, Wenzhuo
Sent: Monday, July 16, 2018 9:08 AM
To: Andrew Rybchenko <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingHi Andrew,
Quoted 17 lines
-----Original Message-----
From: Andrew Rybchenko [mailto:[email protected]]
Sent: Friday, July 13, 2018 4:03 PM
To: Lu, Wenzhuo <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingHi, Wenzhuo,
I'm sorry, but I have more even harder questions than the previous one. This questions are rather generic and mainly to ethdev maintainers.
Quoted 3 lines · Wenzhuo Lu
The device information cannot be gotten correctly before the configuration is set. Because on some NICs the information has dependence on the configuration.
Quoted 9 lines
Thinking about it I have the following question. Is it valid behaviour of the
dev_infoif it changes after configuration? I always thought that the primary goal of thedev_infois to provide information to app about device capabilities to allow app configure device and queues correctly. Now we see the case whendev_infochanges on configure. May be it is acceptable, but it is really suspicious. If we accept it, it should be documented. May bedev_infoshould be split into parts: part which is persistent and part which may depend on device configuration.Quoted 8 lines
As I remember, the similar discussion has happened :) I've raised the similar suggestion like this. But we don’t make it happen. The reason is, you see, this is the rte layer's behavior. So the user doesn't have to know it. From APP's PoV, it inputs the configuration, it calls this API "
rte_eth_dev_configure". It doesn't know the configuration is copied before getting the info or not. So, to my opinion, we can still keep the behavior. We only need to split it into parts when we do see the case that cannot make it.Quoted 2 lines
Maybe I talked too much about the patch. Think about it again. Your comments is about how to use the APIs,
rte_eth_dev_info_get,
rte_eth_dev_configure. To my opinion,rte_eth_dev_info_getis just to get the info. It can be called anywhere, before configuration or after. It's reasonable the info changes with the configuration changing.Quoted 1 line
But we do have something missing, like,
rte_eth_dev_capability_getwhichshould be stable. APP can use this API to get the necessary info before configuration.
Quoted 1 line
A question, maybe a little divergent thinking, that APP should have some
intelligence to handle the capability automatically. So getting the capability is not so good and effective, looks like we still need the human involvement. Maybe that the reason currently we suppose APP know the capability from the paper copies, examples...
Quoted 4 lines
I am not sure to understand all the sentences.
But I agree that we should take a decision about the stability of these infos. Either infos cannot change after probing, or we must document that the app must request infos regularly (when?).Sorry, I missed this mail.
Quoted 9 lines
I have the concern that different NICs have different behavior. One info can be stable on a NIC but dynamic on another. Considering this, we may better not splitting the
rte_eth_dev_info_getto 2 APIs. And comparing with handling this in rte layer, maybe we can let every NIC has its own decision. I have an idea. Maybe we can add a parameter for potential dynamic fields. Like,
Changinguint16_tnb_rx_queues;
to
structnb_rx_queues{uint16_tvalue;
bool stable;
}
May be it is just very bad example, but as I understand nb_rx_queues is mainly required to configure the device properly. Or should app configure, get new value, reconfigure again, get new value and so on and stop when previous is equal to the new one. Yes, I dramatise and it sounds really bad. In any case it would over-complicate interface and no single app will do it correctly.
Stable dev_info is simple. If there are real cases when something can't be stable (and may be recommended Rx/Tx ring sizes is good example, it should at least documented in dev_info structure description or may be moved to separate API.
Quoted 6 lines
By default, the stable is false. Then every NIC can maintain its own behavior.
Some fileds that must be stable can be left unchanged, like,
driver_name,max_rx_queues.As this patch is just reversing a bad commit to fix a bug, if my idea sounds good or worth discussing, I can send another RFC mail for it.
Hi Andrew,
Quoted 100 lines
-----Original Message-----
From: Andrew Rybchenko [mailto:[email protected]]
Sent: Monday, August 13, 2018 4:39 PM
To: Lu, Wenzhuo <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingQuoted 35 lines · Wenzhuo
Hi Thomas,
Quoted 32 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Wednesday, August 1, 2018 11:37 PM
To: Lu, Wenzhuo <[email protected]>; Andrew Rybchenko <[email protected]>; Yigit, Ferruh <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info getting16/07/2018 03:58, Lu, Wenzhuo:
Quoted 23 lines
Hi Andrew,
Quoted 21 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Lu, Wenzhuo
Sent: Monday, July 16, 2018 9:08 AM
To: Andrew Rybchenko <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingHi Andrew,
Quoted 11 lines
-----Original Message-----
From: Andrew Rybchenko [mailto:[email protected]]
Sent: Friday, July 13, 2018 4:03 PM
To: Lu, Wenzhuo <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingHi, Wenzhuo,
I'm sorry, but I have more even harder questions than the previous
one.
Quoted 28 lines
Quoted 28 lines
Quoted 23 lines
Quoted 15 lines
Quoted 6 lines
This questions are rather generic and mainly to ethdev maintainers.
Quoted 3 lines · Wenzhuo Lu
The device information cannot be gotten correctly before the configuration is set. Because on some NICs the information has dependence on the configuration.
Quoted 9 lines
Thinking about it I have the following question. Is it valid behaviour of the
dev_infoif it changes after configuration? I always thought that the primary goal of thedev_infois to provide information to app about device capabilities to allow app configure device and queues correctly. Now we see the case whendev_infochanges on configure. May be it is acceptable, but it is really suspicious. If we accept it, it should be documented. May bedev_infoshould be split into parts: part which is persistent and part which may depend on device configuration.Quoted 8 lines
As I remember, the similar discussion has happened :) I've raised the similar suggestion like this. But we don’t make it happen. The reason is, you see, this is the rte layer's behavior. So the user doesn't have to know it. From APP's PoV, it inputs the configuration, it calls this API "
rte_eth_dev_configure". It doesn't know the configuration is copied before getting the info or not. So, to my opinion, we can still keep the behavior. We only need to split it into parts when we do see the case that cannot make it.Quoted 2 lines
Maybe I talked too much about the patch. Think about it again. Your comments is about how to use the APIs,
rte_eth_dev_info_get,
rte_eth_dev_configure. To my opinion,rte_eth_dev_info_getis just to get the info. It can be called anywhere, before configuration or after. It's reasonable the info changes with the configuration changing.Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
But we do have something missing, like,
rte_eth_dev_capability_getwhichshould be stable. APP can use this API to get the necessary info before configuration.
Quoted 2 lines
A question, maybe a little divergent thinking, that APP should have some
intelligence to handle the capability automatically. So getting the capability is not so good and effective, looks like we still need the human
involvement.
Quoted 5 lines
Quoted 5 lines
Maybe that the reason currently we suppose APP know the capability from the paper copies, examples...
I am not sure to understand all the sentences.
But I agree that we should take a decision about the stability of theseinfos.
Quoted 5 lines
Quoted 2 lines
Either infos cannot change after probing, or we must document that the app must request infos regularly (when?).
Sorry, I missed this mail.
I have the concern that different NICs have different behavior. One info
can be stable on a NIC but dynamic on another. Considering this, we may better not splitting the
rte_eth_dev_info_getto 2 APIs. And comparing with handling this in rte layer, maybe we can let every NIC has its own decision.Quoted 3 lines
I have an idea. Maybe we can add a parameter for potential dynamic fields. Like, Changing
uint16_tnb_rx_queues; to structnb_rx_queues{uint16_tvalue; bool stable; }
Quoted 6 lines
May be it is just very bad example, but as I understand
nb_rx_queuesis mainly required to configure the device properly. Or should app configure, get new value, reconfigure again, get new value and so on and stop when previous is equal to the new one. Yes, I dramatise and it sounds really bad. In any case it would over-complicate interface and no single app will do it correctly.
I think you're talking about max_rx_queues. APP can get that info before configuration. Then configure rx queue number which is not larger than it. That's enough. nb_rx_queues should be the number which is configured by APP and how many queues are actually used. To my opinion, it's mainly used by the GUI to show the value to human being.
BTW, max_rx_queues could be an good example that shows that some parameters are stable on some NICs but not on other NICs.
Take Intel NICs for example (I don’t familiar with others.), normally max_rx_queues is stable on PF. But on VF, as the max number is decided by PF, it could be dynamic. When VF starts, it can get an default value from PF. If it not enough, it can request a larger one from PF. If the number works, VF can get a new number.
Quoted 15 lines
Stable
dev_infois simple. If there are real cases when something can't be stable (and may be recommended Rx/Tx ring sizes is good example, it should at least documented indev_infostructure description or may be moved to separate API.Quoted 1 line
By default, the stable is false. Then every NIC can maintain its own
behavior.
Quoted 2 lines
Some fileds that must be stable can be left unchanged, like,
driver_name,
max_rx_queues.Quoted 2 lines
As this patch is just reversing a bad commit to fix a bug, if my idea sounds
good or worth discussing, I can send another RFC mail for it.
Quoted 1 line
Quoted 108 lines · Wenzhuo
Hi Andrew,
Quoted 100 lines
-----Original Message-----
From: Andrew Rybchenko [mailto:[email protected]]
Sent: Monday, August 13, 2018 4:39 PM
To: Lu, Wenzhuo <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingQuoted 35 lines · Wenzhuo
Hi Thomas,
Quoted 32 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Wednesday, August 1, 2018 11:37 PM
To: Lu, Wenzhuo <[email protected]>; Andrew Rybchenko <[email protected]>; Yigit, Ferruh <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info getting16/07/2018 03:58, Lu, Wenzhuo:
Quoted 23 lines
Hi Andrew,
Quoted 21 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Lu, Wenzhuo
Sent: Monday, July 16, 2018 9:08 AM
To: Andrew Rybchenko <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingHi Andrew,
Quoted 11 lines
-----Original Message-----
From: Andrew Rybchenko [mailto:[email protected]]
Sent: Friday, July 13, 2018 4:03 PM
To: Lu, Wenzhuo <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingHi, Wenzhuo,
I'm sorry, but I have more even harder questions than the previous
one.
Quoted 28 lines
Quoted 28 lines
Quoted 23 lines
Quoted 15 lines
Quoted 6 lines
This questions are rather generic and mainly to ethdev maintainers.
Quoted 3 lines · Wenzhuo Lu
The device information cannot be gotten correctly before the configuration is set. Because on some NICs the information has dependence on the configuration.
Quoted 9 lines
Thinking about it I have the following question. Is it valid behaviour of the
dev_infoif it changes after configuration? I always thought that the primary goal of thedev_infois to provide information to app about device capabilities to allow app configure device and queues correctly. Now we see the case whendev_infochanges on configure. May be it is acceptable, but it is really suspicious. If we accept it, it should be documented. May bedev_infoshould be split into parts: part which is persistent and part which may depend on device configuration.Quoted 8 lines
As I remember, the similar discussion has happened :) I've raised the similar suggestion like this. But we don’t make it happen. The reason is, you see, this is the rte layer's behavior. So the user doesn't have to know it. From APP's PoV, it inputs the configuration, it calls this API "
rte_eth_dev_configure". It doesn't know the configuration is copied before getting the info or not. So, to my opinion, we can still keep the behavior. We only need to split it into parts when we do see the case that cannot make it.Quoted 2 lines
Maybe I talked too much about the patch. Think about it again. Your comments is about how to use the APIs,
rte_eth_dev_info_get,
rte_eth_dev_configure. To my opinion,rte_eth_dev_info_getis just to get the info. It can be called anywhere, before configuration or after. It's reasonable the info changes with the configuration changing.Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
But we do have something missing, like,
rte_eth_dev_capability_getwhichshould be stable. APP can use this API to get the necessary info before configuration.
Quoted 2 lines
A question, maybe a little divergent thinking, that APP should have some
intelligence to handle the capability automatically. So getting the capability is not so good and effective, looks like we still need the human
involvement.
Quoted 5 lines
Quoted 5 lines
Maybe that the reason currently we suppose APP know the capability from the paper copies, examples...
I am not sure to understand all the sentences.
But I agree that we should take a decision about the stability of theseinfos.
Quoted 5 lines
Quoted 2 lines
Either infos cannot change after probing, or we must document that the app must request infos regularly (when?).
Sorry, I missed this mail.
I have the concern that different NICs have different behavior. One info
can be stable on a NIC but dynamic on another. Considering this, we may better not splitting the
rte_eth_dev_info_getto 2 APIs. And comparing with handling this in rte layer, maybe we can let every NIC has its own decision.Quoted 3 lines
I have an idea. Maybe we can add a parameter for potential dynamic fields. Like, Changing
uint16_tnb_rx_queues; to structnb_rx_queues{uint16_tvalue; bool stable; }Quoted 6 lines
May be it is just very bad example, but as I understand
nb_rx_queuesis mainly required to configure the device properly. Or should app configure, get new value, reconfigure again, get new value and so on and stop when previous is equal to the new one. Yes, I dramatise and it sounds really bad. In any case it would over-complicate interface and no single app will do it correctly.
Quoted 5 lines
I think you're talking about
max_rx_queues. APP can get that info before configuration. Then configure rx queue number which is not larger than it. That's enough.nb_rx_queuesshould be the number which is configured by APP and how many queues are actually used. To my opinion, it's mainly used by the GUI to show the value to human being.BTW,
max_rx_queuescould be an good example that shows that some parameters are stable on some NICs but not on other NICs.
Take Intel NICs for example (I don’t familiar with others.), normallymax_rx_queuesis stable on PF. But on VF, as the max number is decided by PF, it could be dynamic. When VF starts, it can get an default value from PF. If it not enough, it can request a larger one from PF. If the number works, VF can get a new number.
"struct rte_eth_dev_info" is a little overloaded, it has:
- static info, like *device
- device limitations, max_*, *_lim
- device capabilities, *_capa
- suggested configurations, default_*conf
- device configuration, nb_[r/t]x_queues
- other, switch_info
There is a concern that some values are dynamic, but this is not new, for example nb_rx/tx_queues can be changed by rte_eth_dev_rx/tx_queue_config() API and rte_eth_dev_info() output will be changed.
For this patch suggested configuration changes based on some other config values looks ok as concept.
So I think we can say after every configuration related API dev info can be changed.
But rte_eth_dev_info_get() has been called within rte_eth_dev_configure() creating a cyclic dependency, this is forcing copy the user provided config before rte_eth_dev_info().
This case the concern of copying user provided config to device config in early stages cause inconsistent data in error case, this is valid concern and unfortunately already an issue with the current implementation.
What would you think keep the logic in this patch but improve it with save and restore existing device config for error cases?
Quoted 17 lines
Quoted 16 lines
Stable
dev_infois simple. If there are real cases when something can't be stable (and may be recommended Rx/Tx ring sizes is good example, it should at least documented indev_infostructure description or may be moved to separate API.Quoted 1 line
By default, the stable is false. Then every NIC can maintain its own
behavior.
Quoted 2 lines
Some fileds that must be stable can be left unchanged, like,
driver_name,
max_rx_queues.Quoted 2 lines
As this patch is just reversing a bad commit to fix a bug, if my idea sounds
good or worth discussing, I can send another RFC mail for it.
Quoted 1 line
Quoted 121 lines · Ferruh Yigit
Quoted 107 lines · Wenzhuo
Hi Andrew,
Quoted 99 lines
-----Original Message-----
From: Andrew Rybchenko [mailto:[email protected]]
Sent: Monday, August 13, 2018 4:39 PM
To: Lu, Wenzhuo <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingQuoted 35 lines · Wenzhuo
Hi Thomas,
Quoted 32 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Wednesday, August 1, 2018 11:37 PM
To: Lu, Wenzhuo <[email protected]>; Andrew Rybchenko <[email protected]>; Yigit, Ferruh <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info getting16/07/2018 03:58, Lu, Wenzhuo:
Quoted 23 lines
Hi Andrew,
Quoted 21 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Lu, Wenzhuo
Sent: Monday, July 16, 2018 9:08 AM
To: Andrew Rybchenko <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingHi Andrew,
Quoted 11 lines
-----Original Message-----
From: Andrew Rybchenko [mailto:[email protected]]
Sent: Friday, July 13, 2018 4:03 PM
To: Lu, Wenzhuo <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingHi, Wenzhuo,
I'm sorry, but I have more even harder questions than the previous
one.
Quoted 28 lines
Quoted 28 lines
Quoted 23 lines
Quoted 15 lines
Quoted 6 lines
This questions are rather generic and mainly to ethdev maintainers.
Quoted 3 lines · Wenzhuo Lu
The device information cannot be gotten correctly before the configuration is set. Because on some NICs the information has dependence on the configuration.
Quoted 9 lines
Thinking about it I have the following question. Is it valid behaviour of the
dev_infoif it changes after configuration? I always thought that the primary goal of thedev_infois to provide information to app about device capabilities to allow app configure device and queues correctly. Now we see the case whendev_infochanges on configure. May be it is acceptable, but it is really suspicious. If we accept it, it should be documented. May bedev_infoshould be split into parts: part which is persistent and part which may depend on device configuration.Quoted 8 lines
As I remember, the similar discussion has happened :) I've raised the similar suggestion like this. But we don’t make it happen. The reason is, you see, this is the rte layer's behavior. So the user doesn't have to know it. From APP's PoV, it inputs the configuration, it calls this API "
rte_eth_dev_configure". It doesn't know the configuration is copied before getting the info or not. So, to my opinion, we can still keep the behavior. We only need to split it into parts when we do see the case that cannot make it.Quoted 2 lines
Maybe I talked too much about the patch. Think about it again. Your comments is about how to use the APIs,
rte_eth_dev_info_get,
rte_eth_dev_configure. To my opinion,rte_eth_dev_info_getis just to get the info. It can be called anywhere, before configuration or after. It's reasonable the info changes with the configuration changing.Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
But we do have something missing, like,
rte_eth_dev_capability_getwhichshould be stable. APP can use this API to get the necessary info before configuration.
Quoted 2 lines
A question, maybe a little divergent thinking, that APP should have some
intelligence to handle the capability automatically. So getting the capability is not so good and effective, looks like we still need the human
involvement.
Quoted 5 lines
Quoted 5 lines
Maybe that the reason currently we suppose APP know the capability from the paper copies, examples...
I am not sure to understand all the sentences.
But I agree that we should take a decision about the stability of theseinfos.
Quoted 5 lines
Quoted 2 lines
Either infos cannot change after probing, or we must document that the app must request infos regularly (when?).
Sorry, I missed this mail.
I have the concern that different NICs have different behavior. One info
can be stable on a NIC but dynamic on another. Considering this, we may better not splitting the
rte_eth_dev_info_getto 2 APIs. And comparing with handling this in rte layer, maybe we can let every NIC has its own decision.Quoted 3 lines
I have an idea. Maybe we can add a parameter for potential dynamic fields. Like, Changing
uint16_tnb_rx_queues; to structnb_rx_queues{uint16_tvalue; bool stable; }Quoted 6 lines
May be it is just very bad example, but as I understand
nb_rx_queuesis mainly required to configure the device properly. Or should app configure, get new value, reconfigure again, get new value and so on and stop when previous is equal to the new one. Yes, I dramatise and it sounds really bad. In any case it would over-complicate interface and no single app will do it correctly.Quoted 5 lines
I think you're talking about
max_rx_queues. APP can get that info before configuration. Then configure rx queue number which is not larger than it. That's enough.nb_rx_queuesshould be the number which is configured by APP and how many queues are actually used. To my opinion, it's mainly used by the GUI to show the value to human being.BTW,
max_rx_queuescould be an good example that shows that some parameters are stable on some NICs but not on other NICs.
Take Intel NICs for example (I don’t familiar with others.), normallymax_rx_queuesis stable on PF. But on VF, as the max number is decided by PF, it could be dynamic. When VF starts, it can get an default value from PF. If it not enough, it can request a larger one from PF. If the number works, VF can get a new number."struct
rte_eth_dev_info" is a little overloaded, it has:
- static info, like *device
- device limitations, max_*,*_lim
- device capabilities,*_capa
- suggested configurations, default_*conf
- device configuration, nb_[r/t]x_queues
- other,switch_info
Quoted 3 lines
There is a concern that some values are dynamic, but this is not new, for example nb_rx/tx_queues can be changed by rte_eth_dev_rx/tx_queue_config() API and
rte_eth_dev_info()output will be changed.
The example looks different to me. It is explicit changes directly requested by the application. So, it is not a surprise that it changes.
Quoted 4 lines
For this patch suggested configuration changes based on some other config values looks ok as concept.
So I think we can say after every configuration related API dev info can be changed.
I think that saying that any configuration changes may result in any changes in dev_info is hardly helpful. I'd suggest to be more specific. Yes, it is harder and will have bugs, but at least it is helpful.
Quoted 22 lines
But
rte_eth_dev_info_get()has been called withinrte_eth_dev_configure()creating a cyclic dependency, this is forcing copy the user provided config beforerte_eth_dev_info().This case the concern of copying user provided config to device config in early stages cause inconsistent data in error case, this is valid concern and unfortunately already an issue with the current implementation.
What would you think keep the logic in this patch but improve it with save and restore existing device config for error cases?
Quoted 11 lines
Quoted 11 lines
Stable
dev_infois simple. If there are real cases when something can't be stable (and may be recommended Rx/Tx ring sizes is good example, it should at least documented indev_infostructure description or may be moved to separate API.Quoted 1 line
By default, the stable is false. Then every NIC can maintain its own
behavior.
Quoted 1 line
Some fileds that must be stable can be left unchanged, like,
driver_name,
max_rx_queues.Quoted 1 line
As this patch is just reversing a bad commit to fix a bug, if my idea sounds
good or worth discussing, I can send another RFC mail for it.
Quoted 129 lines · Andrew Rybchenko
Quoted 121 lines · Ferruh Yigit
Quoted 107 lines · Wenzhuo
Hi Andrew,
Quoted 99 lines
-----Original Message-----
From: Andrew Rybchenko [mailto:[email protected]]
Sent: Monday, August 13, 2018 4:39 PM
To: Lu, Wenzhuo <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingQuoted 35 lines · Wenzhuo
Hi Thomas,
Quoted 32 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Wednesday, August 1, 2018 11:37 PM
To: Lu, Wenzhuo <[email protected]>; Andrew Rybchenko <[email protected]>; Yigit, Ferruh <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info getting16/07/2018 03:58, Lu, Wenzhuo:
Quoted 23 lines
Hi Andrew,
Quoted 21 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Lu, Wenzhuo
Sent: Monday, July 16, 2018 9:08 AM
To: Andrew Rybchenko <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingHi Andrew,
Quoted 11 lines
-----Original Message-----
From: Andrew Rybchenko [mailto:[email protected]]
Sent: Friday, July 13, 2018 4:03 PM
To: Lu, Wenzhuo <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingHi, Wenzhuo,
I'm sorry, but I have more even harder questions than the previous
one.
Quoted 28 lines
Quoted 28 lines
Quoted 23 lines
Quoted 15 lines
Quoted 6 lines
This questions are rather generic and mainly to ethdev maintainers.
Quoted 3 lines · Wenzhuo Lu
The device information cannot be gotten correctly before the configuration is set. Because on some NICs the information has dependence on the configuration.
Quoted 9 lines
Thinking about it I have the following question. Is it valid behaviour of the
dev_infoif it changes after configuration? I always thought that the primary goal of thedev_infois to provide information to app about device capabilities to allow app configure device and queues correctly. Now we see the case whendev_infochanges on configure. May be it is acceptable, but it is really suspicious. If we accept it, it should be documented. May bedev_infoshould be split into parts: part which is persistent and part which may depend on device configuration.Quoted 8 lines
As I remember, the similar discussion has happened :) I've raised the similar suggestion like this. But we don’t make it happen. The reason is, you see, this is the rte layer's behavior. So the user doesn't have to know it. From APP's PoV, it inputs the configuration, it calls this API "
rte_eth_dev_configure". It doesn't know the configuration is copied before getting the info or not. So, to my opinion, we can still keep the behavior. We only need to split it into parts when we do see the case that cannot make it.Quoted 2 lines
Maybe I talked too much about the patch. Think about it again. Your comments is about how to use the APIs,
rte_eth_dev_info_get,
rte_eth_dev_configure. To my opinion,rte_eth_dev_info_getis just to get the info. It can be called anywhere, before configuration or after. It's reasonable the info changes with the configuration changing.Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
But we do have something missing, like,
rte_eth_dev_capability_getwhichshould be stable. APP can use this API to get the necessary info before configuration.
Quoted 2 lines
A question, maybe a little divergent thinking, that APP should have some
intelligence to handle the capability automatically. So getting the capability is not so good and effective, looks like we still need the human
involvement.
Quoted 5 lines
Quoted 5 lines
Maybe that the reason currently we suppose APP know the capability from the paper copies, examples...
I am not sure to understand all the sentences.
But I agree that we should take a decision about the stability of theseinfos.
Quoted 5 lines
Quoted 2 lines
Either infos cannot change after probing, or we must document that the app must request infos regularly (when?).
Sorry, I missed this mail.
I have the concern that different NICs have different behavior. One info
can be stable on a NIC but dynamic on another. Considering this, we may better not splitting the
rte_eth_dev_info_getto 2 APIs. And comparing with handling this in rte layer, maybe we can let every NIC has its own decision.Quoted 3 lines
I have an idea. Maybe we can add a parameter for potential dynamic fields. Like, Changing
uint16_tnb_rx_queues; to structnb_rx_queues{uint16_tvalue; bool stable; }Quoted 6 lines
May be it is just very bad example, but as I understand
nb_rx_queuesis mainly required to configure the device properly. Or should app configure, get new value, reconfigure again, get new value and so on and stop when previous is equal to the new one. Yes, I dramatise and it sounds really bad. In any case it would over-complicate interface and no single app will do it correctly.Quoted 5 lines
I think you're talking about
max_rx_queues. APP can get that info before configuration. Then configure rx queue number which is not larger than it. That's enough.nb_rx_queuesshould be the number which is configured by APP and how many queues are actually used. To my opinion, it's mainly used by the GUI to show the value to human being.BTW,
max_rx_queuescould be an good example that shows that some parameters are stable on some NICs but not on other NICs.
Take Intel NICs for example (I don’t familiar with others.), normallymax_rx_queuesis stable on PF. But on VF, as the max number is decided by PF, it could be dynamic. When VF starts, it can get an default value from PF. If it not enough, it can request a larger one from PF. If the number works, VF can get a new number."struct
rte_eth_dev_info" is a little overloaded, it has:
- static info, like *device
- device limitations, max_*,*_lim
- device capabilities,*_capa
- suggested configurations, default_*conf
- device configuration, nb_[r/t]x_queues
- other,switch_infoQuoted 3 lines
There is a concern that some values are dynamic, but this is not new, for example nb_rx/tx_queues can be changed by rte_eth_dev_rx/tx_queue_config() API and
rte_eth_dev_info()output will be changed.The example looks different to me. It is explicit changes directly requested by the application. So, it is not a surprise that it changes.
Quoted 8 lines
Quoted 4 lines
For this patch suggested configuration changes based on some other config values looks ok as concept.
So I think we can say after every configuration related API dev info can be changed.I think that saying that any configuration changes may result in any changes in
dev_infois hardly helpful. I'd suggest to be more specific. Yes, it is harder and will have bugs, but at least it is helpful.
Hi Andrew, Wenzhuo,
Back to this patch, which fixes an actual defect,
What do you think about:
1- Keep existing patch but extend it as, save the original "dev->data" and revert it back to this original data on all error path.
2- Update rte_eth_dev_info() API document and say default configuration can be changed based on other config fields. So this reduces the scope of things can change in dev_info.
Thanks,
ferruh
Quoted 25 lines
Quoted 23 lines
But
rte_eth_dev_info_get()has been called withinrte_eth_dev_configure()creating a cyclic dependency, this is forcing copy the user provided config beforerte_eth_dev_info().This case the concern of copying user provided config to device config in early stages cause inconsistent data in error case, this is valid concern and unfortunately already an issue with the current implementation.
What would you think keep the logic in this patch but improve it with save and restore existing device config for error cases?
Quoted 11 lines
Quoted 11 lines
Stable
dev_infois simple. If there are real cases when something can't be stable (and may be recommended Rx/Tx ring sizes is good example, it should at least documented indev_infostructure description or may be moved to separate API.Quoted 1 line
By default, the stable is false. Then every NIC can maintain its own
behavior.
Quoted 1 line
Some fileds that must be stable can be left unchanged, like,
driver_name,
max_rx_queues.Quoted 1 line
As this patch is just reversing a bad commit to fix a bug, if my idea sounds
good or worth discussing, I can send another RFC mail for it.
22/10/2018 14:01, Ferruh Yigit:
Quoted 141 lines · Andrew Rybchenko
Quoted 129 lines · Ferruh Yigit
Quoted 121 lines · Wenzhuo
Quoted 107 lines
Hi Andrew,
Quoted 99 lines
-----Original Message-----
From: Andrew Rybchenko [mailto:[email protected]]
Sent: Monday, August 13, 2018 4:39 PM
To: Lu, Wenzhuo <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingQuoted 35 lines · Wenzhuo
Hi Thomas,
Quoted 32 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Wednesday, August 1, 2018 11:37 PM
To: Lu, Wenzhuo <[email protected]>; Andrew Rybchenko <[email protected]>; Yigit, Ferruh <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info getting16/07/2018 03:58, Lu, Wenzhuo:
Quoted 23 lines
Hi Andrew,
Quoted 21 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Lu, Wenzhuo
Sent: Monday, July 16, 2018 9:08 AM
To: Andrew Rybchenko <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingHi Andrew,
Quoted 11 lines
-----Original Message-----
From: Andrew Rybchenko [mailto:[email protected]]
Sent: Friday, July 13, 2018 4:03 PM
To: Lu, Wenzhuo <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingHi, Wenzhuo,
I'm sorry, but I have more even harder questions than the previous
one.
Quoted 28 lines
Quoted 28 lines
Quoted 23 lines
Quoted 15 lines
Quoted 6 lines
This questions are rather generic and mainly to ethdev maintainers.
Quoted 3 lines · Wenzhuo Lu
The device information cannot be gotten correctly before the configuration is set. Because on some NICs the information has dependence on the configuration.
Quoted 9 lines
Thinking about it I have the following question. Is it valid behaviour of the
dev_infoif it changes after configuration? I always thought that the primary goal of thedev_infois to provide information to app about device capabilities to allow app configure device and queues correctly. Now we see the case whendev_infochanges on configure. May be it is acceptable, but it is really suspicious. If we accept it, it should be documented. May bedev_infoshould be split into parts: part which is persistent and part which may depend on device configuration.Quoted 8 lines
As I remember, the similar discussion has happened :) I've raised the similar suggestion like this. But we don’t make it happen. The reason is, you see, this is the rte layer's behavior. So the user doesn't have to know it. From APP's PoV, it inputs the configuration, it calls this API "
rte_eth_dev_configure". It doesn't know the configuration is copied before getting the info or not. So, to my opinion, we can still keep the behavior. We only need to split it into parts when we do see the case that cannot make it.Quoted 2 lines
Maybe I talked too much about the patch. Think about it again. Your comments is about how to use the APIs,
rte_eth_dev_info_get,
rte_eth_dev_configure. To my opinion,rte_eth_dev_info_getis just to get the info. It can be called anywhere, before configuration or after. It's reasonable the info changes with the configuration changing.Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
But we do have something missing, like,
rte_eth_dev_capability_getwhichshould be stable. APP can use this API to get the necessary info before configuration.
Quoted 2 lines
A question, maybe a little divergent thinking, that APP should have some
intelligence to handle the capability automatically. So getting the capability is not so good and effective, looks like we still need the human
involvement.
Quoted 5 lines
Quoted 5 lines
Maybe that the reason currently we suppose APP know the capability from the paper copies, examples...
I am not sure to understand all the sentences.
But I agree that we should take a decision about the stability of theseinfos.
Quoted 5 lines
Quoted 2 lines
Either infos cannot change after probing, or we must document that the app must request infos regularly (when?).
Sorry, I missed this mail.
I have the concern that different NICs have different behavior. One info
can be stable on a NIC but dynamic on another. Considering this, we may better not splitting the
rte_eth_dev_info_getto 2 APIs. And comparing with handling this in rte layer, maybe we can let every NIC has its own decision.Quoted 3 lines
I have an idea. Maybe we can add a parameter for potential dynamic fields. Like, Changing
uint16_tnb_rx_queues; to structnb_rx_queues{uint16_tvalue; bool stable; }Quoted 6 lines
May be it is just very bad example, but as I understand
nb_rx_queuesis mainly required to configure the device properly. Or should app configure, get new value, reconfigure again, get new value and so on and stop when previous is equal to the new one. Yes, I dramatise and it sounds really bad. In any case it would over-complicate interface and no single app will do it correctly.Quoted 5 lines
I think you're talking about
max_rx_queues. APP can get that info before configuration. Then configure rx queue number which is not larger than it. That's enough.nb_rx_queuesshould be the number which is configured by APP and how many queues are actually used. To my opinion, it's mainly used by the GUI to show the value to human being.BTW,
max_rx_queuescould be an good example that shows that some parameters are stable on some NICs but not on other NICs.
Take Intel NICs for example (I don’t familiar with others.), normallymax_rx_queuesis stable on PF. But on VF, as the max number is decided by PF, it could be dynamic. When VF starts, it can get an default value from PF. If it not enough, it can request a larger one from PF. If the number works, VF can get a new number."struct
rte_eth_dev_info" is a little overloaded, it has:
- static info, like *device
- device limitations, max_*,*_lim
- device capabilities,*_capa
- suggested configurations, default_*conf
- device configuration, nb_[r/t]x_queues
- other,switch_infoQuoted 3 lines
There is a concern that some values are dynamic, but this is not new, for example nb_rx/tx_queues can be changed by rte_eth_dev_rx/tx_queue_config() API and
rte_eth_dev_info()output will be changed.The example looks different to me. It is explicit changes directly requested by the application. So, it is not a surprise that it changes.
Quoted 8 lines
Quoted 4 lines
For this patch suggested configuration changes based on some other config values looks ok as concept.
So I think we can say after every configuration related API dev info can be changed.I think that saying that any configuration changes may result in any changes in
dev_infois hardly helpful. I'd suggest to be more specific. Yes, it is harder and will have bugs, but at least it is helpful.Hi Andrew, Wenzhuo,
Quoted 8 lines
Back to this patch, which fixes an actual defect,
What do you think about:
1- Keep existing patch but extend it as, save the original "dev->data" and revert it back to this original data on all error path.
2- Updaterte_eth_dev_info()API document and say default configuration can be changed based on other config fields. So this reduces the scope of things can change indev_info.
I think we are doing too much juggling with data in ethdev layer. All these things should be the responsibility of the PMD. My radical proposal would be to remove rte_eth_dev_info and integrate all the data into rte_eth_dev_data.
Hi Thomas, Ferruh, Andrew,
Quoted 189 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Monday, October 22, 2018 8:13 PM
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>; Lu, Wenzhuo <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info getting22/10/2018 14:01, Ferruh Yigit:
Quoted 53 lines · Andrew Rybchenko
Quoted 52 lines · Ferruh Yigit
Quoted 51 lines · Wenzhuo
Quoted 50 lines
Hi Andrew,
Quoted 48 lines
-----Original Message-----
From: Andrew Rybchenko [mailto:[email protected]]
Sent: Monday, August 13, 2018 4:39 PM
To: Lu, Wenzhuo <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingQuoted 38 lines · Wenzhuo
Hi Thomas,
Quoted 35 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Wednesday, August 1, 2018 11:37 PM
To: Lu, Wenzhuo <[email protected]>; Andrew Rybchenko <[email protected]>; Yigit, Ferruh <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info getting16/07/2018 03:58, Lu, Wenzhuo:
Quoted 24 lines
Hi Andrew,
Quoted 22 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Lu, Wenzhuo
Sent: Monday, July 16, 2018 9:08 AM
To: Andrew Rybchenko <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingHi Andrew,
Quoted 9 lines
-----Original Message-----
From: Andrew Rybchenko [mailto:[email protected]]
Sent: Friday, July 13, 2018 4:03 PM
To: Lu, Wenzhuo <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingQuoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Hi, Wenzhuo,
I'm sorry, but I have more even harder questions than the previous
one.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
This questions are rather generic and mainly to ethdev
maintainers.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines · Wenzhuo Lu
Quoted 3 lines
The device information cannot be gotten correctly before the configuration is set. Because on some NICs the information has dependence on the configuration.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Thinking about it I have the following question. Is it valid behaviour of the
dev_infoif it changes after configuration? I always thought that the primary goal of thedev_infois to provide information to app about device capabilities to allow app configure device and queues correctly. Now we see the case whendev_infochanges on configure. May be it is acceptable, but it is really suspicious. If we accept it, it shouldbe documented.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
May be
dev_infoshould be split into parts: part which is persistent and part which may depend on device configuration.As I remember, the similar discussion has happened :) I've raised the similar suggestion like this. But we don’t make it
happen.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
The reason is, you see, this is the rte layer's behavior. So the user doesn't have to know it. From APP's PoV, it inputs the configuration, it calls this API "
rte_eth_dev_configure". It doesn't know the configuration is copied before getting theinfo or not.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
So, to my opinion, we can still keep the behavior. We only need to split it into parts when we do see the case that cannot
make it.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Maybe I talked too much about the patch. Think about it again. Your comments is about how to use the APIs,
rte_eth_dev_info_get,
rte_eth_dev_configure. To my opinion,rte_eth_dev_info_getis just to get the info. It can be called anywhere, before configuration or after. It's reasonable the info changes with theconfiguration changing.
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 9 lines
Quoted 9 lines
Quoted 2 lines
But we do have something missing, like,
rte_eth_dev_capability_getwhichshould be stable. APP can use this API to get the necessary info before configuration.
Quoted 2 lines
A question, maybe a little divergent thinking, that APP should have some
intelligence to handle the capability automatically. So getting the capability is not so good and effective, looks like we still need the human
involvement.
Quoted 6 lines
Quoted 6 lines
Maybe that the reason currently we suppose APP know the capability from the paper copies, examples...
I am not sure to understand all the sentences.
But I agree that we should take a decision about the stability of theseinfos.
Quoted 2 lines
Quoted 2 lines
Either infos cannot change after probing, or we must document that the app must request infos regularly (when?).
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Sorry, I missed this mail.
I have the concern that different NICs have different behavior. One info
can be stable on a NIC but dynamic on another. Considering this, we may better not splitting the
rte_eth_dev_info_getto 2 APIs. And comparing with handling this in rte layer, maybe we can let everyNIC has its own decision.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
I have an idea. Maybe we can add a parameter for potential dynamic fields. Like, Changing
uint16_tnb_rx_queues; to structnb_rx_queues{uint16_tvalue; bool stable; }May be it is just very bad example, but as I understand
nb_rx_queuesis mainly required to configure the device properly. Or should app configure, get new value, reconfigure again, get new value and so on and stop when previous is equal to the new one.Yes, I dramatise and it sounds really bad.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
In any case it would over-complicate interface and no single app will do it correctly.
I think you're talking about
max_rx_queues. APP can get that infobefore configuration. Then configure rx queue number which is not larger than it. That's enough.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
nb_rx_queuesshould be the number which is configured by APP andhow many queues are actually used. To my opinion, it's mainly used by the GUI to show the value to human being.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
BTW,
max_rx_queuescould be an good example that shows thatsome parameters are stable on some NICs but not on other NICs.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Take Intel NICs for example (I don’t familiar with others.), normally
max_rx_queuesis stable on PF. But on VF, as the max number is decided by PF, it could be dynamic. When VF starts, it can get an default value from PF. If it not enough, it can request a larger one from PF. If the number works, VF can get a new number.Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
"struct
rte_eth_dev_info" is a little overloaded, it has:
- static info, like *device
- device limitations, max_*,*_lim
- device capabilities,*_capa
- suggested configurations, default_*conf
- device configuration, nb_[r/t]x_queues
- other,switch_infoThere is a concern that some values are dynamic, but this is not new, for example nb_rx/tx_queues can be changed by rte_eth_dev_rx/tx_queue_config() API and
rte_eth_dev_info()outputwill be changed.
Quoted 15 lines
Quoted 4 lines
The example looks different to me. It is explicit changes directly requested by the application. So, it is not a surprise that it changes.
Quoted 8 lines
Quoted 4 lines
For this patch suggested configuration changes based on some other config values looks ok as concept.
So I think we can say after every configuration related API dev info can be changed.I think that saying that any configuration changes may result in any changes in
dev_infois hardly helpful. I'd suggest to be more specific. Yes, it is harder and will have bugs, but at least it is helpful.Hi Andrew, Wenzhuo,
Quoted 8 lines
Back to this patch, which fixes an actual defect,
What do you think about:
1- Keep existing patch but extend it as, save the original "dev->data" and revert it back to this original data on all error path. 2- Updaterte_eth_dev_info()API document and say default configuration can be changed based on other config fields. So this reduces the scope of things can change indev_info.
Quoted 5 lines
I think we are doing too much juggling with data in ethdev layer. All these things should be the responsibility of the PMD.
My radical proposal would be to removerte_eth_dev_infoand integrate all the data intorte_eth_dev_data.
Sorry for missing this discussion. It's a good discussion about how to optimize the rte_eth.
But I have to say that above discussion can reach a huge reconsitution of the rte_eth and impact every PMD. Is that fair?
This patch is only try to revert a bad commit as we already find bug. As I remember, at the beginning, Andrew said the discussion may not about the patch but generic. So could we just tell if this patch itself OK at first? Thanks.
23/10/2018 03:25, Lu, Wenzhuo:
Quoted 143 lines
Hi Thomas, Ferruh, Andrew,
From: Thomas Monjalon [mailto:[email protected]]
Quoted 140 lines
22/10/2018 14:01, Ferruh Yigit:
Quoted 10 lines · Andrew Rybchenko
Quoted 9 lines · Ferruh Yigit
Quoted 8 lines · Wenzhuo
Quoted 7 lines
Hi Andrew,
From: Andrew Rybchenko [mailto:[email protected]]Quoted 5 lines · Wenzhuo
Quoted 4 lines
From: Thomas Monjalon [mailto:[email protected]]
Quoted 3 lines
16/07/2018 03:58, Lu, Wenzhuo:
Quoted 2 lines
Hi Andrew,
From: Lu, WenzhuoQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
From: Andrew Rybchenko [mailto:[email protected]]
Quoted 5 lines
Hi, Wenzhuo,
I'm sorry, but I have more even harder questions than the previous
one.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
This questions are rather generic and mainly to ethdev
maintainers.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines · Wenzhuo Lu
Quoted 3 lines
The device information cannot be gotten correctly before
the configuration is set. Because on some NICs the
information has dependence on the configuration.Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Thinking about it I have the following question. Is it valid behaviour of the
dev_infoif it changes after configuration? I always thought that the primary goal of thedev_infois to provide information to app about device capabilities to allow app configure device and queues correctly. Now we see the case whendev_infochanges on configure. May be it is acceptable, but it is really suspicious. If we accept it, it shouldbe documented.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
May be
dev_infoshould be split into parts: part which is persistent and part which may depend on device configuration.As I remember, the similar discussion has happened :) I've raised the similar suggestion like this. But we don’t make it
happen.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
The reason is, you see, this is the rte layer's behavior. So the user doesn't have to know it. From APP's PoV, it inputs the configuration, it calls this API "
rte_eth_dev_configure". It doesn't know the configuration is copied before getting theinfo or not.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
So, to my opinion, we can still keep the behavior. We only need to split it into parts when we do see the case that cannot
make it.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Maybe I talked too much about the patch. Think about it again. Your comments is about how to use the APIs,
rte_eth_dev_info_get,
rte_eth_dev_configure. To my opinion,rte_eth_dev_info_getis just to get the info. It can be called anywhere, before configuration or after. It's reasonable the info changes with theconfiguration changing.
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 9 lines
Quoted 9 lines
Quoted 2 lines
But we do have something missing, like,
rte_eth_dev_capability_getwhichshould be stable. APP can use this API to get the necessary info before configuration.
Quoted 2 lines
A question, maybe a little divergent thinking, that APP should have some
intelligence to handle the capability automatically. So getting the capability is not so good and effective, looks like we still need the human
involvement.
Quoted 6 lines
Quoted 6 lines
Maybe that the reason currently we suppose APP know the capability from the paper copies, examples...
I am not sure to understand all the sentences.
But I agree that we should take a decision about the stability of theseinfos.
Quoted 2 lines
Quoted 2 lines
Either infos cannot change after probing, or we must document that the app must request infos regularly (when?).
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Sorry, I missed this mail.
I have the concern that different NICs have different behavior. One info
can be stable on a NIC but dynamic on another. Considering this, we may better not splitting the
rte_eth_dev_info_getto 2 APIs. And comparing with handling this in rte layer, maybe we can let everyNIC has its own decision.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
I have an idea. Maybe we can add a parameter for potential dynamic fields. Like, Changing
uint16_tnb_rx_queues; to structnb_rx_queues{uint16_tvalue; bool stable; }May be it is just very bad example, but as I understand
nb_rx_queuesis mainly required to configure the device properly. Or should app configure, get new value, reconfigure again, get new value and so on and stop when previous is equal to the new one.Yes, I dramatise and it sounds really bad.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
In any case it would over-complicate interface and no single app will do it correctly.
I think you're talking about
max_rx_queues. APP can get that infobefore configuration. Then configure rx queue number which is not larger than it. That's enough.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
nb_rx_queuesshould be the number which is configured by APP andhow many queues are actually used. To my opinion, it's mainly used by the GUI to show the value to human being.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
BTW,
max_rx_queuescould be an good example that shows thatsome parameters are stable on some NICs but not on other NICs.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Take Intel NICs for example (I don’t familiar with others.), normally
max_rx_queuesis stable on PF. But on VF, as the max number is decided by PF, it could be dynamic. When VF starts, it can get an default value from PF. If it not enough, it can request a larger one from PF. If the number works, VF can get a new number.Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
"struct
rte_eth_dev_info" is a little overloaded, it has:
- static info, like *device
- device limitations, max_*,*_lim
- device capabilities,*_capa
- suggested configurations, default_*conf
- device configuration, nb_[r/t]x_queues
- other,switch_infoThere is a concern that some values are dynamic, but this is not new, for example nb_rx/tx_queues can be changed by rte_eth_dev_rx/tx_queue_config() API and
rte_eth_dev_info()outputwill be changed.
Quoted 23 lines
Quoted 4 lines
The example looks different to me. It is explicit changes directly requested by the application. So, it is not a surprise that it changes.
Quoted 8 lines
Quoted 4 lines
For this patch suggested configuration changes based on some other config values looks ok as concept.
So I think we can say after every configuration related API dev info can be changed.I think that saying that any configuration changes may result in any changes in
dev_infois hardly helpful. I'd suggest to be more specific. Yes, it is harder and will have bugs, but at least it is helpful.Hi Andrew, Wenzhuo,
Back to this patch, which fixes an actual defect,
What do you think about:
1- Keep existing patch but extend it as, save the original "dev->data" and revert it back to this original data on all error path. 2- Updaterte_eth_dev_info()API document and say default configuration can be changed based on other config fields. So this reduces the scope of things can change indev_info.
Quoted 8 lines
Quoted 5 lines
I think we are doing too much juggling with data in ethdev layer. All these things should be the responsibility of the PMD.
My radical proposal would be to removerte_eth_dev_infoand integrate all the data intorte_eth_dev_data.Sorry for missing this discussion. It's a good discussion about how to optimize the
rte_eth.
But I have to say that above discussion can reach a huge reconsitution of therte_ethand impact every PMD. Is that fair?
This patch is only try to revert a bad commit as we already find bug. As I remember, at the beginning, Andrew said the discussion may not about the patch but generic. So could we just tell if this patch itself OK at first? Thanks.
I have no strong opinion about your patch.
Sorry, I am more interested by a possible future big clean-up. About a temporary fix, I am OK if Ferruh and Andrew are OK.
Hi Ferruh, Andrew,
Quoted 179 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Tuesday, October 23, 2018 3:29 PM
To: Lu, Wenzhuo <[email protected]>
Cc: [email protected]; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info getting23/10/2018 03:25, Lu, Wenzhuo:
Quoted 15 lines
Hi Thomas, Ferruh, Andrew,
From: Thomas Monjalon [mailto:[email protected]]
Quoted 12 lines
22/10/2018 14:01, Ferruh Yigit:
Quoted 11 lines · Andrew Rybchenko
Quoted 10 lines · Ferruh Yigit
Quoted 9 lines · Wenzhuo
Quoted 8 lines
Hi Andrew,
From: Andrew Rybchenko [mailto:[email protected]]Quoted 6 lines · Wenzhuo
Quoted 5 lines
From: Thomas Monjalon [mailto:[email protected]]
Quoted 4 lines
16/07/2018 03:58, Lu, Wenzhuo:
Quoted 3 lines
Hi Andrew,
From: Lu, WenzhuoQuoted 1 line
From: Andrew Rybchenko
[mailto:[email protected]]
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Hi, Wenzhuo,
I'm sorry, but I have more even harder questions than
the previousone.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
This questions are rather generic and mainly to ethdev
Quoted 8 lines
Quoted 8 lines
maintainers.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines · Wenzhuo Lu
The device information cannot be gotten correctly
before the configuration is set. Because on some NICs
the information has dependence on the configuration.
Thinking about it I have the following question. Is it
valid behaviour of the dev_info if it changes afterconfiguration?
Quoted 9 lines
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
I always thought that the primary goal of the dev_info
is to provide information to app about device
capabilities to allow app configure device and queues
correctly. Now we see the case when dev_info changes on
configure. May be it is acceptable, but it is really
suspicious. If we accept it, it shouldbe documented.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
May be dev_info should be split into parts: part which
is persistent and part which may depend on deviceconfiguration.
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
As I remember, the similar discussion has happened :) I've raised the similar suggestion like this. But we don’t make it
happen.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
The reason is, you see, this is the rte layer's behavior. So the user doesn't have to know it. From APP's PoV, it inputs the configuration, it calls this API
"
rte_eth_dev_configure".Quoted 32 lines
Quoted 32 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
It doesn't know the configuration is copied before getting the
info or not.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
So, to my opinion, we can still keep the behavior. We only need to split it into parts when we do see the case that cannot
make it.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Maybe I talked too much about the patch. Think about it again. Your comments is about how to use the APIs,
rte_eth_dev_info_get,
rte_eth_dev_configure. To my opinion,rte_eth_dev_info_getis just to get the info. It can be called anywhere, before configuration or after. It's reasonable the info changes with theconfiguration changing.
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 9 lines
Quoted 9 lines
Quoted 2 lines
But we do have something missing, like,
rte_eth_dev_capability_getwhichshould be stable. APP can use this API to get the necessary info before configuration.
Quoted 2 lines
A question, maybe a little divergent thinking, that APP should have some
intelligence to handle the capability automatically. So getting the capability is not so good and effective, looks like we still need the human
involvement.
Quoted 6 lines
Quoted 6 lines
Maybe that the reason currently we suppose APP know the capability from the paper copies, examples...
I am not sure to understand all the sentences. But I agree that we should take a decision about the stability of these
infos.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Either infos cannot change after probing, or we must document that the app must request infos regularly (when?).
Sorry, I missed this mail.
I have the concern that different NICs have different behavior. One info
can be stable on a NIC but dynamic on another. Considering this, we may better not splitting the
rte_eth_dev_info_getto 2APIs.
Quoted 10 lines
Quoted 10 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
And comparing with handling this in rte layer, maybe we can let every
NIC has its own decision.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
I have an idea. Maybe we can add a parameter for potential dynamic fields. Like, Changing
uint16_tnb_rx_queues; to structnb_rx_queues{uint16_tvalue; bool stable; }May be it is just very bad example, but as I understand
nb_rx_queuesis mainly required to configure the device properly. Or should app configure, get new value, reconfigure again, get new value and so on and stop when previous is equal to thenew one.
Quoted 12 lines
Quoted 12 lines
Yes, I dramatise and it sounds really bad.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
In any case it would over-complicate interface and no single app will do it correctly.
I think you're talking about
max_rx_queues. APP can get that infobefore configuration. Then configure rx queue number which is not larger than it. That's enough.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
nb_rx_queuesshould be the number which is configured by APP andhow many queues are actually used. To my opinion, it's mainly used by the GUI to show the value to human being.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
BTW,
max_rx_queuescould be an good example that shows thatsome parameters are stable on some NICs but not on other NICs.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Take Intel NICs for example (I don’t familiar with others.), normally
max_rx_queuesis stable on PF. But on VF, as the max number is decided by PF, it could be dynamic. When VF starts, it can get an defaultvalue from PF.
Quoted 10 lines
Quoted 10 lines
If it not enough, it can request a larger one from PF. If the number works, VF can get a new number.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
"struct
rte_eth_dev_info" is a little overloaded, it has:
- static info, like *device
- device limitations, max_*,*_lim
- device capabilities,*_capa
- suggested configurations, default_*conf
- device configuration, nb_[r/t]x_queues
- other,switch_infoQuoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
There is a concern that some values are dynamic, but this is not new, for example nb_rx/tx_queues can be changed by rte_eth_dev_rx/tx_queue_config() API and
rte_eth_dev_info()outputwill be changed.
Quoted 3 lines
Quoted 3 lines
The example looks different to me. It is explicit changes directly requested by the application. So, it is not a surprise that it
changes.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
For this patch suggested configuration changes based on some other config values looks ok as concept.
So I think we can say after every configuration related API dev info can be changed.I think that saying that any configuration changes may result in any changes in
dev_infois hardly helpful. I'd suggest to be morespecific.
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 1 line
Yes, it is harder and will have bugs, but at least it is helpful.
Hi Andrew, Wenzhuo,
Back to this patch, which fixes an actual defect,
What do you think about:
1- Keep existing patch but extend it as, save the original "dev->data" and revert it back to this original data on all error path. 2- Updaterte_eth_dev_info()API document and say default configuration can be changed based on other config fields. So this reduces the scope of things can change indev_info.Quoted 6 lines
Quoted 5 lines
I think we are doing too much juggling with data in ethdev layer. All these things should be the responsibility of the PMD. My radical proposal would be to remove
rte_eth_dev_infoand integrate all the data intorte_eth_dev_data.Sorry for missing this discussion. It's a good discussion about how to
optimize the
rte_eth.Quoted 1 line
But I have to say that above discussion can reach a huge reconsitution of
Quoted 8 lines
the
rte_ethand impact every PMD. Is that fair?Quoted 1 line
This patch is only try to revert a bad commit as we already find bug. As I
remember, at the beginning, Andrew said the discussion may not about the patch but generic. So could we just tell if this patch itself OK at first? Thanks.
I have no strong opinion about your patch.
Sorry, I am more interested by a possible future big clean-up. About a temporary fix, I am OK if Ferruh and Andrew are OK.
About this patch itself, is it OK? If so, would you like ack it? Thanks.
Quoted 144 lines · Thomas Monjalon
22/10/2018 14:01, Ferruh Yigit:
Quoted 143 lines · Andrew Rybchenko
Quoted 128 lines · Ferruh Yigit
Quoted 121 lines · Wenzhuo
Quoted 107 lines
Hi Andrew,
Quoted 99 lines
-----Original Message-----
From: Andrew Rybchenko [mailto:[email protected]]
Sent: Monday, August 13, 2018 4:39 PM
To: Lu, Wenzhuo <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingQuoted 35 lines · Wenzhuo
Hi Thomas,
Quoted 32 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Wednesday, August 1, 2018 11:37 PM
To: Lu, Wenzhuo <[email protected]>; Andrew Rybchenko <[email protected]>; Yigit, Ferruh <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info getting16/07/2018 03:58, Lu, Wenzhuo:
Quoted 23 lines
Hi Andrew,
Quoted 21 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Lu, Wenzhuo
Sent: Monday, July 16, 2018 9:08 AM
To: Andrew Rybchenko <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingHi Andrew,
Quoted 11 lines
-----Original Message-----
From: Andrew Rybchenko [mailto:[email protected]]
Sent: Friday, July 13, 2018 4:03 PM
To: Lu, Wenzhuo <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix device info gettingHi, Wenzhuo,
I'm sorry, but I have more even harder questions than the previous
one.
Quoted 28 lines
Quoted 28 lines
Quoted 23 lines
Quoted 15 lines
Quoted 6 lines
This questions are rather generic and mainly to ethdev maintainers.
Quoted 3 lines · Wenzhuo Lu
The device information cannot be gotten correctly before the configuration is set. Because on some NICs the information has dependence on the configuration.
Quoted 9 lines
Thinking about it I have the following question. Is it valid behaviour of the
dev_infoif it changes after configuration? I always thought that the primary goal of thedev_infois to provide information to app about device capabilities to allow app configure device and queues correctly. Now we see the case whendev_infochanges on configure. May be it is acceptable, but it is really suspicious. If we accept it, it should be documented. May bedev_infoshould be split into parts: part which is persistent and part which may depend on device configuration.Quoted 8 lines
As I remember, the similar discussion has happened :) I've raised the similar suggestion like this. But we don’t make it happen. The reason is, you see, this is the rte layer's behavior. So the user doesn't have to know it. From APP's PoV, it inputs the configuration, it calls this API "
rte_eth_dev_configure". It doesn't know the configuration is copied before getting the info or not. So, to my opinion, we can still keep the behavior. We only need to split it into parts when we do see the case that cannot make it.Quoted 2 lines
Maybe I talked too much about the patch. Think about it again. Your comments is about how to use the APIs,
rte_eth_dev_info_get,
rte_eth_dev_configure. To my opinion,rte_eth_dev_info_getis just to get the info. It can be called anywhere, before configuration or after. It's reasonable the info changes with the configuration changing.Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
But we do have something missing, like,
rte_eth_dev_capability_getwhichshould be stable. APP can use this API to get the necessary info before configuration.
Quoted 2 lines
A question, maybe a little divergent thinking, that APP should have some
intelligence to handle the capability automatically. So getting the capability is not so good and effective, looks like we still need the human
involvement.
Quoted 5 lines
Quoted 5 lines
Maybe that the reason currently we suppose APP know the capability from the paper copies, examples...
I am not sure to understand all the sentences.
But I agree that we should take a decision about the stability of theseinfos.
Quoted 5 lines
Quoted 2 lines
Either infos cannot change after probing, or we must document that the app must request infos regularly (when?).
Sorry, I missed this mail.
I have the concern that different NICs have different behavior. One info
can be stable on a NIC but dynamic on another. Considering this, we may better not splitting the
rte_eth_dev_info_getto 2 APIs. And comparing with handling this in rte layer, maybe we can let every NIC has its own decision.Quoted 3 lines
I have an idea. Maybe we can add a parameter for potential dynamic fields. Like, Changing
uint16_tnb_rx_queues; to structnb_rx_queues{uint16_tvalue; bool stable; }Quoted 6 lines
May be it is just very bad example, but as I understand
nb_rx_queuesis mainly required to configure the device properly. Or should app configure, get new value, reconfigure again, get new value and so on and stop when previous is equal to the new one. Yes, I dramatise and it sounds really bad. In any case it would over-complicate interface and no single app will do it correctly.Quoted 5 lines
I think you're talking about
max_rx_queues. APP can get that info before configuration. Then configure rx queue number which is not larger than it. That's enough.nb_rx_queuesshould be the number which is configured by APP and how many queues are actually used. To my opinion, it's mainly used by the GUI to show the value to human being.BTW,
max_rx_queuescould be an good example that shows that some parameters are stable on some NICs but not on other NICs.
Take Intel NICs for example (I don’t familiar with others.), normallymax_rx_queuesis stable on PF. But on VF, as the max number is decided by PF, it could be dynamic. When VF starts, it can get an default value from PF. If it not enough, it can request a larger one from PF. If the number works, VF can get a new number."struct
rte_eth_dev_info" is a little overloaded, it has:
- static info, like *device
- device limitations, max_*,*_lim
- device capabilities,*_capa
- suggested configurations, default_*conf
- device configuration, nb_[r/t]x_queues
- other,switch_infoQuoted 3 lines
There is a concern that some values are dynamic, but this is not new, for example nb_rx/tx_queues can be changed by rte_eth_dev_rx/tx_queue_config() API and
rte_eth_dev_info()output will be changed.The example looks different to me. It is explicit changes directly requested by the application. So, it is not a surprise that it changes.
Quoted 7 lines
Quoted 4 lines
For this patch suggested configuration changes based on some other config values looks ok as concept.
So I think we can say after every configuration related API dev info can be changed.I think that saying that any configuration changes may result in any changes in
dev_infois hardly helpful. I'd suggest to be more specific. Yes, it is harder and will have bugs, but at least it is helpful.Hi Andrew, Wenzhuo,
Back to this patch, which fixes an actual defect,
What do you think about:
1- Keep existing patch but extend it as, save the original "dev->data" and revert it back to this original data on all error path.
I guess you mean dev->data->dev_conf here. If so, OK.
Quoted 3 lines
Quoted 3 lines
2- Update
rte_eth_dev_info()API document and say default configuration can be changed based on other config fields. So this reduces the scope of things can change indev_info.
Yes, it looks like many items in rte_eth_conf may change defaults (Rx/Tx modes, offloads, loopback mode, intr_conf). However, it should be highlighted that it is device configuration (struct rte_eth_conf), not per-queue configuration.
Quoted 4 lines
I think we are doing too much juggling with data in ethdev layer. All these things should be the responsibility of the PMD. My radical proposal would be to remove
rte_eth_dev_infoand integrate all the data intorte_eth_dev_data.
I think it is a bad idea. It is too error-prone since it will require from PMD to spread the logic and update rte_eth_dev_data in each place which should change it. I think existing functional interface is the right approach here. However, we cannot say that dev_info may change after any configuration action - it could make application impossible or very hard to configure the device properly (get dev_info, find the best settings, try to configure starting from the most important, rollback in the case of failure and retry other ways).
PATCH v3 1/2 ethdev: fix device info getting
In reply to Wenzhuo LuThe device information cannot be gotten correctly before the configuration is set. Because on some NICs the information has dependence on the configuration.
--- lib/librte_ethdev/rte_ethdev.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
lib/librte_ethdev/rte_ethdev.c +11 -10
@@ -1102,6 +1102,17 @@ struct rte_eth_dev *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 ); +if (dev->data->dev_started) { +RTE_ETHDEV_LOG (ERR , +"Port %u must be stopped to allow configuration\n" , + port_id); +return -EBUSY ; + } + +/* Copy the dev_conf parameter into the dev structure, +* then get the info. +*/ +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
@@ -1133,16 +1144,6 @@ struct rte_eth_dev *return -EINVAL ; } -if (dev->data->dev_started) { -RTE_ETHDEV_LOG (ERR , -"Port %u must be stopped to allow configuration\n" , - port_id); -return -EBUSY ; - } - -/* 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
1.9.3
PATCH v3 2/2 ethdev: device configuration enhancement
The new configuration is stored during the process. But the process may fail. We better rolling the configuration back as the new one doesn't take effect.
--- lib/librte_ethdev/rte_ethdev.c | 59 ++++++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 16 deletions(-)
lib/librte_ethdev/rte_ethdev.c +43 -16
@@ -1092,8 +1092,10 @@ struct rte_eth_dev * {struct rte_eth_dev *dev;struct rte_eth_dev_info dev_info; +struct rte_eth_conf orig_conf;struct rte_eth_conf local_conf = *dev_conf;int diag; +int ret;RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -EINVAL );
@@ -1106,12 +1108,16 @@ struct rte_eth_dev *RTE_ETHDEV_LOG (ERR ,"Port %u must be stopped to allow configuration\n" , port_id); -return -EBUSY ; + ret = -EBUSY ; + goto fail; }/* Copy the dev_conf parameter into the dev structure, * then get the info. +* But restore the original configure first, as rollback is needed +* when failure happens. */ +memcpy (&orig_conf, &dev->data->dev_conf,sizeof (dev->data->dev_conf));memcpy (&dev->data->dev_conf, &local_conf,sizeof (dev->data->dev_conf));rte_eth_dev_info_get (port_id, &dev_info);
@@ -1134,14 +1140,16 @@ struct rte_eth_dev *RTE_ETHDEV_LOG (ERR ,"Number of RX queues requested (%u) is greater than max supported(%d)\n" , nb_rx_q,RTE_MAX_QUEUES_PER_PORT ); -return -EINVAL ; + ret = -EINVAL ; + goto rollback; }if (nb_tx_q >RTE_MAX_QUEUES_PER_PORT ) {RTE_ETHDEV_LOG (ERR ,"Number of TX queues requested (%u) is greater than max supported(%d)\n" , nb_tx_q,RTE_MAX_QUEUES_PER_PORT ); -return -EINVAL ; + ret = -EINVAL ; + goto rollback; }/*
@@ -1152,13 +1160,15 @@ struct rte_eth_dev *if (nb_rx_q > dev_info.max_rx_queues) {RTE_ETHDEV_LOG (ERR ,"Ethdev port_id=%u nb_rx_queues=%u > %u\n" , port_id, nb_rx_q, dev_info.max_rx_queues); -return -EINVAL ; + ret = -EINVAL ; + goto rollback; }if (nb_tx_q > dev_info.max_tx_queues) {RTE_ETHDEV_LOG (ERR ,"Ethdev port_id=%u nb_tx_queues=%u > %u\n" , port_id, nb_tx_q, dev_info.max_tx_queues); -return -EINVAL ; + ret = -EINVAL ; + goto rollback; }/* Check that the device supports requested interrupts */
@@ -1166,13 +1176,15 @@ struct rte_eth_dev * (!(dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC))) {RTE_ETHDEV_LOG (ERR ,"Driver %s does not support lsc\n" , dev->device->driver->name); -return -EINVAL ; + ret = -EINVAL ; + goto rollback; }if ((dev_conf->intr_conf.rmv ==1 ) && (!(dev->data->dev_flags &RTE_ETH_DEV_INTR_RMV ))) {RTE_ETHDEV_LOG (ERR ,"Driver %s does not support rmv\n" , dev->device->driver->name); -return -EINVAL ; + ret = -EINVAL ; + goto rollback; }/*
@@ -1185,13 +1197,15 @@ struct rte_eth_dev *"Ethdev port_id=%u max_rx_pkt_len %u > max valid value %u\n" , port_id, dev_conf->rxmode.max_rx_pkt_len, dev_info.max_rx_pktlen); -return -EINVAL ; + ret = -EINVAL ; + goto rollback; }else if (dev_conf->rxmode.max_rx_pkt_len <ETHER_MIN_LEN ) {RTE_ETHDEV_LOG (ERR ,"Ethdev port_id=%u max_rx_pkt_len %u < min valid value %u\n" , port_id, dev_conf->rxmode.max_rx_pkt_len, (unsigned )ETHER_MIN_LEN ); -return -EINVAL ; + ret = -EINVAL ; + goto rollback; } }else { if (dev_conf->rxmode.max_rx_pkt_len < ETHER_MIN_LEN ||
@@ -1210,7 +1224,8 @@ struct rte_eth_dev * port_id, local_conf.rxmode.offloads, dev_info.rx_offload_capa, __func__); -return -EINVAL ; + ret = -EINVAL ; + goto rollback; }if ((local_conf.txmode.offloads & dev_info.tx_offload_capa) != local_conf.txmode.offloads) {
@@ -1220,7 +1235,8 @@ struct rte_eth_dev * port_id, local_conf.txmode.offloads, dev_info.tx_offload_capa, __func__); -return -EINVAL ; + ret = -EINVAL ; + goto rollback; }/* Check that device supports requested rss hash functions. */
@@ -1231,7 +1247,8 @@ struct rte_eth_dev *"Ethdev port_id=%u invalid rss_hf: 0x%" PRIx64", valid value: 0x%" PRIx64"\n" , port_id, dev_conf->rx_adv_conf.rss_conf.rss_hf, dev_info.flow_type_rss_offloads); -return -EINVAL ; + ret = -EINVAL ; + goto rollback; }/*
@@ -1242,7 +1259,8 @@ struct rte_eth_dev *RTE_ETHDEV_LOG (ERR ,"Port%u rte_eth_dev_rx_queue_config = %d\n" , port_id, diag); -return diag; + ret = diag; + goto rollback; } diag =rte_eth_dev_tx_queue_config (dev, nb_tx_q);
@@ -1251,7 +1269,8 @@ struct rte_eth_dev *"Port%u rte_eth_dev_tx_queue_config = %d\n" , port_id, diag);rte_eth_dev_rx_queue_config (dev,0 ); -return diag; + ret = diag; + goto rollback; } diag = (*dev->dev_ops->dev_configure)(dev);
@@ -1260,7 +1279,8 @@ struct rte_eth_dev * port_id, diag);rte_eth_dev_rx_queue_config (dev,0 );rte_eth_dev_tx_queue_config (dev,0 ); -return eth_err (port_id, diag); + ret =eth_err (port_id, diag); + goto rollback; }/* Initialize Rx profiling if enabled at compilation time. */
@@ -1270,10 +1290,17 @@ struct rte_eth_dev * port_id, diag);rte_eth_dev_rx_queue_config (dev,0 );rte_eth_dev_tx_queue_config (dev,0 ); -return eth_err (port_id, diag); + ret =eth_err (port_id, diag); + goto rollback; }return 0 ; + +rollback: +memcpy (&dev->data->dev_conf, &orig_conf,sizeof (dev->data->dev_conf)); + +fail: +return ret; }void
Signature · 1 line
1.9.3
Re: [PATCH v3 2/2] ethdev: device configuration enhancement
Quoted 5 lines · Wenzhuo Lu
The new configuration is stored during the process. But the process may fail. We better rolling the configuration back as the new one doesn't take effect.
Signed-off-by Wenzhuo Lu <[email protected]>
I would say that the order is wrong. We should fix this bug first and the changeset should have appropriate Fixes tags.
I think this bug is older and should be fixed first.
Then the second bug should be fixed without this one present.
Re: [PATCH v3 2/2] ethdev: device configuration enhancement
Quoted 11 lines · Andrew Rybchenko
Quoted 5 lines · Wenzhuo Lu
The new configuration is stored during the process. But the process may fail. We better rolling the configuration back as the new one doesn't take effect.
Signed-off-by Wenzhuo Lu <[email protected]>I would say that the order is wrong. We should fix this bug first and the changeset should have appropriate Fixes tags.
I think this bug is older and should be fixed first.
Then the second bug should be fixed without this one present.
Logically suggested order make sense I agree, but both patches are fixing defect and order won't help backporting them [1], so no strong opinion about order.
Overall this patch should be converted into fix defect with proper Fixes tag independent from order.
Wenzhuo, what do you think? I would like to get this one for rc3!
[1]
This is older defect but I believe can't be backported cleanly into older stable trees because of "PMD-tuned Tx/Rx parameters" patches in the middle. Downside having this first prevents other patch to backported to closer stable trees.
Also having this patch first will require additional return value update in some checks (nb_tx_q && nb_rx_q checks) in next patch, so for separation fixes this order is clearer.
Re: [PATCH v3 2/2] ethdev: device configuration enhancement
Hi Ferruh,
Quoted 37 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Saturday, November 10, 2018 5:10 AM
To: Andrew Rybchenko <[email protected]>; Lu, Wenzhuo <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 2/2] ethdev: device configuration enhancementQuoted 11 lines · Andrew Rybchenko
Quoted 5 lines · Wenzhuo Lu
The new configuration is stored during the process.
But the process may fail. We better rolling the configuration back as the new one doesn't take effect.Signed-off-by Wenzhuo Lu <[email protected]>I would say that the order is wrong. We should fix this bug first and the changeset should have appropriate Fixes tags.
I think this bug is older and should be fixed first.
Then the second bug should be fixed without this one present.Logically suggested order make sense I agree, but both patches are fixing defect and order won't help backporting them [1], so no strong opinion about order.
Overall this patch should be converted into fix defect with proper Fixes tag independent from order.
Wenzhuo, what do you think? I would like to get this one for rc3!
[1]
This is older defect but I believe can't be backported cleanly into older stable trees because of "PMD-tuned Tx/Rx parameters" patches in the middle. Downside having this first prevents other patch to backported to closer stable trees.
Quoted 3 lines
Also having this patch first will require additional return value update in some checks (
nb_tx_q&&nb_rx_qchecks) in next patch, so for separation fixes this order is clearer.
Yes, to my opinion, these 2 are separate patches. Actually there's no order between them. I put them together only because we have had a mixed discussion. I didn't put a fix prefix because it's hard to add a fix tag for it. We know it has the problem from the beginning, so after some changes this patch cannot be backported.
Re: [PATCH v3 2/2] ethdev: device configuration enhancement
Quoted 40 lines · Wenzhuo
Hi Ferruh,
Quoted 37 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Saturday, November 10, 2018 5:10 AM
To: Andrew Rybchenko <[email protected]>; Lu, Wenzhuo <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 2/2] ethdev: device configuration enhancementQuoted 11 lines · Andrew Rybchenko
Quoted 5 lines · Wenzhuo Lu
The new configuration is stored during the process.
But the process may fail. We better rolling the configuration back as the new one doesn't take effect.Signed-off-by Wenzhuo Lu <[email protected]>I would say that the order is wrong. We should fix this bug first and the changeset should have appropriate Fixes tags.
I think this bug is older and should be fixed first.
Then the second bug should be fixed without this one present.Logically suggested order make sense I agree, but both patches are fixing defect and order won't help backporting them [1], so no strong opinion about order.
Overall this patch should be converted into fix defect with proper Fixes tag independent from order.
Wenzhuo, what do you think? I would like to get this one for rc3!
[1]
This is older defect but I believe can't be backported cleanly into older stable trees because of "PMD-tuned Tx/Rx parameters" patches in the middle. Downside having this first prevents other patch to backported to closer stable trees.
Quoted 4 lines
Quoted 3 lines
Also having this patch first will require additional return value update in some checks (
nb_tx_q&&nb_rx_qchecks) in next patch, so for separation fixes this order is clearer.Yes, to my opinion, these 2 are separate patches. Actually there's no order between them. I put them together only because we have had a mixed discussion.
Yes they are not depends each other. Thinking twice adding first patch will leave the code in a state more open the defect fixed in second patch. But by fixing defect first second fix can be applied without having that open.
I will send a new version of the set.
Quoted 2 lines
I didn't put a fix prefix because it's hard to add a fix tag for it. We know it has the problem from the beginning, so after some changes this patch cannot be backported.
Re: [PATCH v3 2/2] ethdev: device configuration enhancement
Hi Ferruh,
Quoted 54 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, November 13, 2018 5:41 PM
To: Lu, Wenzhuo <[email protected]>; Andrew Rybchenko <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 2/2] ethdev: device configuration enhancementQuoted 37 lines · Wenzhuo
Hi Ferruh,
Quoted 34 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Saturday, November 10, 2018 5:10 AM
To: Andrew Rybchenko <[email protected]>; Lu, Wenzhuo <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 2/2] ethdev: device configuration enhancementQuoted 11 lines · Andrew Rybchenko
Quoted 5 lines · Wenzhuo Lu
The new configuration is stored during the process.
But the process may fail. We better rolling the configuration back as the new one doesn't take effect.Signed-off-by Wenzhuo Lu <[email protected]>I would say that the order is wrong. We should fix this bug first and the changeset should have appropriate Fixes tags.
I think this bug is older and should be fixed first. Then the second bug should be fixed without this one present.Logically suggested order make sense I agree, but both patches are fixing defect and order won't help backporting them [1], so no strong opinion about order.
Overall this patch should be converted into fix defect with proper Fixes tag independent from order.
Wenzhuo, what do you think? I would like to get this one for rc3!
[1]
This is older defect but I believe can't be backported cleanly into older stable trees because of "PMD-tuned Tx/Rx parameters" patches inthe middle.
Quoted 7 lines
Quoted 6 lines
Downside having this first prevents other patch to backported to closer stable trees.
Also having this patch first will require additional return value update in some checks (
nb_tx_q&&nb_rx_qchecks) in next patch, so for separation fixes this order is clearer.Yes, to my opinion, these 2 are separate patches. Actually there's no order
Quoted 8 lines
between them. I put them together only because we have had a mixed discussion.
Yes they are not depends each other. Thinking twice adding first patch will leave the code in a state more open the defect fixed in second patch. But by fixing defect first second fix can be applied without having that open.
I will send a new version of the set.
Thanks a lot! Very appreciate for your help!
Quoted 5 lines
Quoted 2 lines
I didn't put a fix prefix because it's hard to add a fix tag for it. We know it
has the problem from the beginning, so after some changes this patch cannot be backported.
Quoted 1 line
PATCH v4 1/3 ethdev: fix invalid device configuration after failure
In reply to Wenzhuo LuFrom: Wenzhuo Lu <[email protected]>
The new configuration is stored during the rte_eth_dev_configure() API but the API may fail. After failure stored configuration will be invalid since it is not fully applied to the device.
We better roll the configuration back after failure.
---
Cc: Andrew Rybchenko <[email protected]>
--- lib/librte_ethdev/rte_ethdev.c | 49 +++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 13 deletions(-)
lib/librte_ethdev/rte_ethdev.c +36 -13
@@ -1092,8 +1092,10 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, {struct rte_eth_dev *dev;struct rte_eth_dev_info dev_info; +struct rte_eth_conf orig_conf;struct rte_eth_conf local_conf = *dev_conf;int diag; +int ret;RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -EINVAL );
@@ -1140,6 +1142,9 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,return -EBUSY ; } +/* Store original config, as rollback required on failure */ +memcpy (&orig_conf, &dev->data->dev_conf,sizeof (dev->data->dev_conf)); +/* Copy the dev_conf parameter into the dev structure */ memcpy (&dev->data->dev_conf, &local_conf,sizeof (dev->data->dev_conf));
@@ -1151,13 +1156,15 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,if (nb_rx_q > dev_info.max_rx_queues) {RTE_ETHDEV_LOG (ERR ,"Ethdev port_id=%u nb_rx_queues=%u > %u\n" , port_id, nb_rx_q, dev_info.max_rx_queues); -return -EINVAL ; + ret = -EINVAL ; + goto rollback; }if (nb_tx_q > dev_info.max_tx_queues) {RTE_ETHDEV_LOG (ERR ,"Ethdev port_id=%u nb_tx_queues=%u > %u\n" , port_id, nb_tx_q, dev_info.max_tx_queues); -return -EINVAL ; + ret = -EINVAL ; + goto rollback; }/* Check that the device supports requested interrupts */
@@ -1165,13 +1172,15 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, (!(dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC))) {RTE_ETHDEV_LOG (ERR ,"Driver %s does not support lsc\n" , dev->device->driver->name); -return -EINVAL ; + ret = -EINVAL ; + goto rollback; }if ((dev_conf->intr_conf.rmv ==1 ) && (!(dev->data->dev_flags &RTE_ETH_DEV_INTR_RMV ))) {RTE_ETHDEV_LOG (ERR ,"Driver %s does not support rmv\n" , dev->device->driver->name); -return -EINVAL ; + ret = -EINVAL ; + goto rollback; }/*
@@ -1184,13 +1193,15 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,"Ethdev port_id=%u max_rx_pkt_len %u > max valid value %u\n" , port_id, dev_conf->rxmode.max_rx_pkt_len, dev_info.max_rx_pktlen); -return -EINVAL ; + ret = -EINVAL ; + goto rollback; }else if (dev_conf->rxmode.max_rx_pkt_len <ETHER_MIN_LEN ) {RTE_ETHDEV_LOG (ERR ,"Ethdev port_id=%u max_rx_pkt_len %u < min valid value %u\n" , port_id, dev_conf->rxmode.max_rx_pkt_len, (unsigned )ETHER_MIN_LEN ); -return -EINVAL ; + ret = -EINVAL ; + goto rollback; } }else { if (dev_conf->rxmode.max_rx_pkt_len < ETHER_MIN_LEN ||
@@ -1209,7 +1220,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, port_id, local_conf.rxmode.offloads, dev_info.rx_offload_capa, __func__); -return -EINVAL ; + ret = -EINVAL ; + goto rollback; }if ((local_conf.txmode.offloads & dev_info.tx_offload_capa) != local_conf.txmode.offloads) {
@@ -1219,7 +1231,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, port_id, local_conf.txmode.offloads, dev_info.tx_offload_capa, __func__); -return -EINVAL ; + ret = -EINVAL ; + goto rollback; }/* Check that device supports requested rss hash functions. */
@@ -1230,7 +1243,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,"Ethdev port_id=%u invalid rss_hf: 0x%" PRIx64", valid value: 0x%" PRIx64"\n" , port_id, dev_conf->rx_adv_conf.rss_conf.rss_hf, dev_info.flow_type_rss_offloads); -return -EINVAL ; + ret = -EINVAL ; + goto rollback; }/*
@@ -1241,7 +1255,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,RTE_ETHDEV_LOG (ERR ,"Port%u rte_eth_dev_rx_queue_config = %d\n" , port_id, diag); -return diag; + ret = diag; + goto rollback; } diag =rte_eth_dev_tx_queue_config (dev, nb_tx_q);
@@ -1250,7 +1265,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,"Port%u rte_eth_dev_tx_queue_config = %d\n" , port_id, diag);rte_eth_dev_rx_queue_config (dev,0 ); -return diag; + ret = diag; + goto rollback; } diag = (*dev->dev_ops->dev_configure)(dev);
@@ -1259,7 +1275,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, port_id, diag);rte_eth_dev_rx_queue_config (dev,0 );rte_eth_dev_tx_queue_config (dev,0 ); -return eth_err (port_id, diag); + ret =eth_err (port_id, diag); + goto rollback; }/* Initialize Rx profiling if enabled at compilation time. */
@@ -1269,10 +1286,16 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, port_id, diag);rte_eth_dev_rx_queue_config (dev,0 );rte_eth_dev_tx_queue_config (dev,0 ); -return eth_err (port_id, diag); + ret =eth_err (port_id, diag); + goto rollback; }return 0 ; + +rollback: +memcpy (&dev->data->dev_conf, &orig_conf,sizeof (dev->data->dev_conf)); + +return ret; }void
Signature · 1 line
2.17.2
PATCH v4 2/3 ethdev: fix device info getting
From: Wenzhuo Lu <[email protected]>
The device information cannot be gotten correctly before the configuration is set. Because on some NICs the information has dependence on the configuration.
---
Cc: Andrew Rybchenko <[email protected]>
--- lib/librte_ethdev/rte_ethdev.c | 35 +++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-)
lib/librte_ethdev/rte_ethdev.c +20 -15
@@ -1104,6 +1104,22 @@ 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 ); +if (dev->data->dev_started) { +RTE_ETHDEV_LOG (ERR , +"Port %u must be stopped to allow configuration\n" , + port_id); +return -EBUSY ; + } + +/* Store original config, as rollback required on failure */ +memcpy (&orig_conf, &dev->data->dev_conf,sizeof (dev->data->dev_conf)); + +/* +* Copy the dev_conf parameter into the dev structure. +* rte_eth_dev_info_get() requires dev_conf, copy it before dev_info get +*/ +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
@@ -1125,29 +1141,18 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,RTE_ETHDEV_LOG (ERR ,"Number of RX queues requested (%u) is greater than max supported(%d)\n" , nb_rx_q,RTE_MAX_QUEUES_PER_PORT ); -return -EINVAL ; + ret = -EINVAL ; + goto rollback; }if (nb_tx_q >RTE_MAX_QUEUES_PER_PORT ) {RTE_ETHDEV_LOG (ERR ,"Number of TX queues requested (%u) is greater than max supported(%d)\n" , nb_tx_q,RTE_MAX_QUEUES_PER_PORT ); -return -EINVAL ; - } - -if (dev->data->dev_started) { -RTE_ETHDEV_LOG (ERR , -"Port %u must be stopped to allow configuration\n" , - port_id); -return -EBUSY ; + ret = -EINVAL ; + goto rollback; } -/* Store original config, as rollback required on failure */ -memcpy (&orig_conf, &dev->data->dev_conf,sizeof (dev->data->dev_conf)); - -/* 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.17.2
Quoted 11 lines · Ferruh Yigit
From: Wenzhuo Lu <[email protected]>
The device information cannot be gotten correctly before the configuration is set. Because on some NICs the information has dependence on the configuration.
Fixes 3be82f5cc5e3 ("ethdev: support PMD-tuned Tx/Rx parameters")Signed-off-by Wenzhuo Lu <[email protected]>Signed-off-by Ferruh Yigit <[email protected]>
PATCH v4 3/3 ethdev: eliminate interim variable
In reply to Ferruh Yigitlocal_conf variable was needed for offload conversions but no more required. No functional difference, only interim variable eliminated.
---
Cc: Andrew Rybchenko <[email protected]>
Cc: Wenzhuo Lu <[email protected]>
--- lib/librte_ethdev/rte_ethdev.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
lib/librte_ethdev/rte_ethdev.c +8 -9
@@ -1093,7 +1093,6 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,struct rte_eth_dev *dev;struct rte_eth_dev_info dev_info;struct rte_eth_conf orig_conf; -struct rte_eth_conf local_conf = *dev_conf;int diag;int ret;
@@ -1118,7 +1117,7 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,* Copy the dev_conf parameter into the dev structure. * rte_eth_dev_info_get() requires dev_conf, copy it before dev_info get */ -memcpy (&dev->data->dev_conf, &local_conf,sizeof (dev->data->dev_conf)); +memcpy (&dev->data->dev_conf, dev_conf,sizeof (dev->data->dev_conf));rte_eth_dev_info_get (port_id, &dev_info);
@@ -1192,7 +1191,7 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,* If jumbo frames are enabled, check that the maximum RX packet * length is supported by the configured device. */ -if (local_conf.rxmode.offloads &DEV_RX_OFFLOAD_JUMBO_FRAME ) { +if (dev_conf->rxmode.offloads &DEV_RX_OFFLOAD_JUMBO_FRAME ) {if (dev_conf->rxmode.max_rx_pkt_len > dev_info.max_rx_pktlen) { RTE_ETHDEV_LOG(ERR, "Ethdev port_id=%u max_rx_pkt_len %u > max valid value %u\n",
@@ -1217,23 +1216,23 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, }/* Any requested offloading must be within its device capabilities */ -if ((local_conf.rxmode.offloads & dev_info.rx_offload_capa) != - local_conf.rxmode.offloads) { +if ((dev_conf->rxmode.offloads & dev_info.rx_offload_capa) != + dev_conf->rxmode.offloads) {RTE_ETHDEV_LOG (ERR ,"Ethdev port_id=%u requested Rx offloads 0x%" PRIx64" doesn't match Rx offloads " "capabilities 0x%" PRIx64" in %s()\n" , - port_id, local_conf.rxmode.offloads, + port_id, dev_conf->rxmode.offloads, dev_info.rx_offload_capa, __func__); ret = -EINVAL ; goto rollback; } -if ((local_conf.txmode.offloads & dev_info.tx_offload_capa) != - local_conf.txmode.offloads) { +if ((dev_conf->txmode.offloads & dev_info.tx_offload_capa) != + dev_conf->txmode.offloads) {RTE_ETHDEV_LOG (ERR ,"Ethdev port_id=%u requested Tx offloads 0x%" PRIx64" doesn't match Tx offloads " "capabilities 0x%" PRIx64" in %s()\n" , - port_id, local_conf.txmode.offloads, + port_id, dev_conf->txmode.offloads, dev_info.tx_offload_capa, __func__); ret = -EINVAL ;
Signature · 1 line
2.17.2
Re: [PATCH v4 3/3] ethdev: eliminate interim variable
Quoted 7 lines · Ferruh Yigit
local_confvariable was needed for offload conversions but no more required. No functional difference, only interim variable eliminated.Fixes ab3ce1e0c193 ("ethdev: remove old offload API")Signed-off-by Ferruh Yigit <[email protected]>
I guess it will be easier to backport the fix if it is the first fix in the series.
Re: [PATCH v4 3/3] ethdev: eliminate interim variable
Quoted 10 lines · Andrew Rybchenko
Quoted 7 lines · Ferruh Yigit
local_confvariable was needed for offload conversions but no more required. No functional difference, only interim variable eliminated.Fixes ab3ce1e0c193 ("ethdev: remove old offload API")Signed-off-by Ferruh Yigit <[email protected]>I guess it will be easier to backport the fix if it is the first fix in the series.
I thought this is the less important one and that is why put it as last. Didn't want this patch cause any conflict while getting other fixes.
Which patch do you mention to be easier to backport if this is the first, this one or others?
Quoted 3 lines
Reviewed-by Andrew Rybchenko <[email protected]>
Re: [PATCH v4 3/3] ethdev: eliminate interim variable
Quoted 8 lines · Ferruh Yigit
Quoted 7 lines · Andrew Rybchenko
Quoted 6 lines · Ferruh Yigit
local_confvariable was needed for offload conversions but no more required. No functional difference, only interim variable eliminated.Fixes ab3ce1e0c193 ("ethdev: remove old offload API")
Quoted 7 lines
Quoted 2 lines
Quoted 1 line
Signed-off-by Ferruh Yigit <[email protected]>I guess it will be easier to backport the fix if it is the first fix in the series.
I thought this is the less important one and that is why put it as last. Didn't want this patch cause any conflict while getting other fixes.
Which patch do you mention to be easier to backport if this is the first, this one or others?
This one. It touches lines which are moved in the previous patch. Not really that important.
Quoted 2 lines
Quoted 2 lines
Reviewed-by Andrew Rybchenko <[email protected]>
Re: [PATCH v4 1/3] ethdev: fix invalid device configuration after failure
In reply to Ferruh YigitQuoted 6 lines · Ferruh Yigit
From: Wenzhuo Lu <[email protected]>
The new configuration is stored during the
rte_eth_dev_configure()API but the API may fail. After failure stored configuration will be invalid since it is not fully applied to the device.
Quoted 7 lines
We better roll the configuration back after failure.
Fixes af75078fece3 ("first public release")Signed-off-by Wenzhuo Lu <[email protected]>Signed-off-by Ferruh Yigit <[email protected]>
Re: [PATCH v4 1/3] ethdev: fix invalid device configuration after failure
Quoted 9 lines · Andrew Rybchenko
Quoted 8 lines · Ferruh Yigit
From: Wenzhuo Lu <[email protected]>
The new configuration is stored during the
rte_eth_dev_configure()API but the API may fail. After failure stored configuration will be invalid since it is not fully applied to the device.We better roll the configuration back after failure.
Quoted 8 lines
Quoted 5 lines
Fixes af75078fece3 ("first public release")Signed-off-by Wenzhuo Lu <[email protected]>Signed-off-by Ferruh Yigit <[email protected]>Reviewed-by Andrew Rybchenko <[email protected]>
Series applied to dpdk-next-net/master, thanks.