add lib and testpmd functions to sync upstream

change port link speed without stopping all
add dev configured flag

Signed-off-by: speech_white <humin29@huawei.com>
This commit is contained in:
speech_white 2021-07-30 08:22:39 +08:00
parent c88e0aa74a
commit 4c7a6531fd
3 changed files with 159 additions and 1 deletions

View File

@ -0,0 +1,46 @@
From 3e1dae547da0a58b31d551edee18511232ba5716 Mon Sep 17 00:00:00 2001
From: Huisong Li <lihuisong@huawei.com>
Date: Wed, 28 Apr 2021 16:36:59 +0800
Subject: [PATCH 10/26] app/testpmd: change port link speed without stopping
all
When we use the following cmd to modify the link speed of specified
port: "port config <port_id> speed xxx duplex xxx", we have to stop
all ports. It's not necessary.
Fixes: 82113036e4e5 ("ethdev: redesign link speed config")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
---
app/test-pmd/cmdline.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 78db462..b69c648 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1613,13 +1613,13 @@ cmd_config_speed_specific_parsed(void *parsed_result,
struct cmd_config_speed_specific *res = parsed_result;
uint32_t link_speed;
- if (!all_ports_stopped()) {
- printf("Please stop all ports first\n");
+ if (port_id_is_invalid(res->id, ENABLED_WARN))
return;
- }
- if (port_id_is_invalid(res->id, ENABLED_WARN))
+ if (!port_is_stopped(res->id)) {
+ printf("Please stop port %d first\n", res->id);
return;
+ }
if (parse_and_check_speed_duplex(res->value1, res->value2,
&link_speed) < 0)
--
2.7.4

View File

@ -0,0 +1,107 @@
From f38367e915cd94db9dc3e178eeff114e605d1f1c Mon Sep 17 00:00:00 2001
From: Huisong Li <lihuisong@huawei.com>
Date: Wed, 7 Jul 2021 17:53:34 +0800
Subject: [PATCH 11/26] ethdev: add dev configured flag
Currently, if dev_configure is not called or fails to be called, users
can still call dev_start successfully. So it is necessary to have a flag
which indicates whether the device is configured, to control whether
dev_start can be called and eliminate dependency on user invocation order.
The flag stored in "struct rte_eth_dev_data" is more reasonable than
"enum rte_eth_dev_state". "enum rte_eth_dev_state" is private to the
primary and secondary processes, and can be independently controlled.
However, the secondary process does not make resource allocations and
does not call dev_configure(). These are done by the primary process
and can be obtained or used by the secondary process. So this patch
adds a "dev_configured" flag in "rte_eth_dev_data", like "dev_started".
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
libabigail raised a warning on this change.
This change is fine wrt ABI as far as we understand, but we can't
express an exception rule (see libabigail bug #28060) to waive the
changes only in this part of the rte_eth_dev_data struct.
The solution for now is to globally waive any change on the
rte_eth_dev_data structure.
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
devtools/libabigail.abignore | 7 +++++++
lib/librte_ethdev/rte_ethdev.c | 11 +++++++++++
lib/librte_ethdev/rte_ethdev_core.h | 6 +++++-
3 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/devtools/libabigail.abignore b/devtools/libabigail.abignore
index b649af1..80eb0ab 100644
--- a/devtools/libabigail.abignore
+++ b/devtools/libabigail.abignore
@@ -16,3 +16,10 @@
[suppress_type]
name = rte_eth_txq_info
has_data_member_inserted_between = {offset_after(nb_desc), end}
+
+; Ignore all changes to rte_eth_dev_data
+; Note: we only cared about dev_configured bit addition, but libabigail
+; seems to wrongly compute bitfields offset.
+; https://sourceware.org/bugzilla/show_bug.cgi?id=28060
+[suppress_type]
+ name = rte_eth_dev_data
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 87d1b56..4bed431 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -1543,6 +1543,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
}
rte_ethdev_trace_configure(port_id, nb_rx_q, nb_tx_q, dev_conf, 0);
+ dev->data->dev_configured = 1;
+
return 0;
reset_queues:
eth_dev_rx_queue_config(dev, 0);
@@ -1551,6 +1553,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
memcpy(&dev->data->dev_conf, &orig_conf, sizeof(dev->data->dev_conf));
rte_ethdev_trace_configure(port_id, nb_rx_q, nb_tx_q, dev_conf, ret);
+ dev->data->dev_configured = 0;
+
return ret;
}
@@ -1687,6 +1691,13 @@ rte_eth_dev_start(uint16_t port_id)
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+ if (dev->data->dev_configured == 0) {
+ RTE_ETHDEV_LOG(INFO,
+ "Device with port_id=%"PRIu16" is not configured.\n",
+ port_id);
+ return -EINVAL;
+ }
+
if (dev->data->dev_started != 0) {
RTE_ETHDEV_LOG(INFO,
"Device with port_id=%"PRIu16" already started\n",
diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h
index 918a34e..8d97dd1 100644
--- a/lib/librte_ethdev/rte_ethdev_core.h
+++ b/lib/librte_ethdev/rte_ethdev_core.h
@@ -168,7 +168,11 @@ struct rte_eth_dev_data {
scattered_rx : 1, /**< RX of scattered packets is ON(1) / OFF(0) */
all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */
dev_started : 1, /**< Device state: STARTED(1) / STOPPED(0). */
- lro : 1; /**< RX LRO is ON(1) / OFF(0) */
+ lro : 1, /**< RX LRO is ON(1) / OFF(0) */
+ dev_configured : 1;
+ /**< Device configuration state:
+ * CONFIGURED(1) / NOT CONFIGURED(0).
+ */
uint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT];
/**< Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0). */
uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT];
--
2.7.4

View File

@ -1,6 +1,6 @@
Name: dpdk
Version: 20.11
Release: 7
Release: 8
Packager: packaging@6wind.com
URL: http://dpdk.org
%global source_version 20.11
@ -219,6 +219,8 @@ Patch209: 0209-net-hns3-fix-flow-rule-list-in-multi-process.patch
Patch210: 0210-net-hns3-fix-Tx-prepare-after-stop.patch
Patch211: 0211-net-hns3-disable-PFC-if-not-configured.patch
Patch212: 0212-net-hns3-use-the-correct-HiSilicon-copyright.patch
Patch213: 0213-app-testpmd-change-port-link-speed-without-stopping-.patch
Patch214: 0214-ethdev-add-dev-configured-flag.patch
Summary: Data Plane Development Kit core
Group: System Environment/Libraries
@ -344,6 +346,9 @@ strip -g $RPM_BUILD_ROOT/lib/modules/${namer}/extra/dpdk/rte_kni.ko
/usr/sbin/depmod
%changelog
* Tur Jul 29 2021 Min Hu <humin29@huawei.com> - 20.11-8
- add lib and testpmd functions to sync upstream
* Tue Jul 27 2021 Min Hu <humin29@huawei.com> - 20.11-7
- add bugfixes for hns3 PMD and sync upstream