Re: [ovs-dev] [PATCH v7 1/3] netdev-dummy: Sync and clean {get, set}_config() callbacks.

2023-11-02 Thread Kevin Traynor

On 30/10/2023 09:49, jm...@redhat.com wrote:

From: Jakob Meng

For better usability, the function pairs get_config() and
set_config() for netdevs should be symmetric: Options which are
accepted by set_config() should be returned by get_config() and the
latter should output valid options for set_config() only. This patch
also moves key-value pairs which are no valid options from get_config()
to the get_status() callback. The tests have been updated accordingly.

Reported-at:https://bugzilla.redhat.com/1949855
Signed-off-by: Jakob Meng
---
  lib/netdev-dummy.c | 19 +++
  tests/pmd.at   | 26 +-
  2 files changed, 28 insertions(+), 17 deletions(-)


Acked-by: Kevin Traynor 

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v7 1/3] netdev-dummy: Sync and clean {get, set}_config() callbacks.

2023-10-30 Thread jmeng
From: Jakob Meng 

For better usability, the function pairs get_config() and
set_config() for netdevs should be symmetric: Options which are
accepted by set_config() should be returned by get_config() and the
latter should output valid options for set_config() only. This patch
also moves key-value pairs which are no valid options from get_config()
to the get_status() callback. The tests have been updated accordingly.

Reported-at: https://bugzilla.redhat.com/1949855
Signed-off-by: Jakob Meng 
---
 lib/netdev-dummy.c | 19 +++
 tests/pmd.at   | 26 +-
 2 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
index 1a54add87..fe82317d7 100644
--- a/lib/netdev-dummy.c
+++ b/lib/netdev-dummy.c
@@ -795,14 +795,25 @@ netdev_dummy_get_config(const struct netdev *dev, struct 
smap *args)
 
 dummy_packet_conn_get_config(>conn, args);
 
+/* pcap, rxq_pcap and tx_pcap cannot be recovered because filenames have
+ * been discarded after opening file descriptors */
+
+if (netdev->ol_ip_csum) {
+smap_add_format(args, "ol_ip_csum", "%s", "true");
+}
+
+if (netdev->ol_ip_csum_set_good) {
+smap_add_format(args, "ol_ip_csum_set_good", "%s", "true");
+}
+
 /* 'dummy-pmd' specific config. */
 if (!netdev_is_pmd(dev)) {
 goto exit;
 }
-smap_add_format(args, "requested_rx_queues", "%d", 
netdev->requested_n_rxq);
-smap_add_format(args, "configured_rx_queues", "%d", dev->n_rxq);
-smap_add_format(args, "requested_tx_queues", "%d", 
netdev->requested_n_txq);
-smap_add_format(args, "configured_tx_queues", "%d", dev->n_txq);
+
+smap_add_format(args, "n_rxq", "%d", netdev->requested_n_rxq);
+smap_add_format(args, "n_txq", "%d", netdev->requested_n_txq);
+smap_add_format(args, "numa_id", "%d", netdev->requested_numa_id);
 
 exit:
 ovs_mutex_unlock(>mutex);
diff --git a/tests/pmd.at b/tests/pmd.at
index 7bdaca9e7..06cc90477 100644
--- a/tests/pmd.at
+++ b/tests/pmd.at
@@ -93,11 +93,11 @@ pmd thread numa_id  core_id :
   overhead: NOT AVAIL
 ])
 
-AT_CHECK([ovs-appctl dpif/show | sed 
's/\(tx_queues=\)[[0-9]]*/\1/g'], [0], [dnl
+AT_CHECK([ovs-appctl dpif/show], [0], [dnl
 dummy@ovs-dummy: hit:0 missed:0
   br0:
 br0 65534/100: (dummy-internal)
-p0 1/1: (dummy-pmd: configured_rx_queues=1, 
configured_tx_queues=, requested_rx_queues=1, 
requested_tx_queues=)
+p0 1/1: (dummy-pmd: n_rxq=1, n_txq=1, numa_id=0)
 ])
 
 OVS_VSWITCHD_STOP
@@ -111,11 +111,11 @@ CHECK_PMD_THREADS_CREATED()
 
 AT_CHECK([ovs-vsctl set interface p0 options:n_rxq=8])
 
-AT_CHECK([ovs-appctl dpif/show | sed 
's/\(tx_queues=\)[[0-9]]*/\1/g'], [0], [dnl
+AT_CHECK([ovs-appctl dpif/show], [0], [dnl
 dummy@ovs-dummy: hit:0 missed:0
   br0:
 br0 65534/100: (dummy-internal)
-p0 1/1: (dummy-pmd: configured_rx_queues=8, 
configured_tx_queues=, requested_rx_queues=8, 
requested_tx_queues=)
+p0 1/1: (dummy-pmd: n_rxq=8, n_txq=1, numa_id=0)
 ])
 
 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | sed SED_NUMA_CORE_PATTERN], 
[0], [dnl
@@ -144,11 +144,11 @@ OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 
type=dummy-pmd options:n
 CHECK_CPU_DISCOVERED(2)
 CHECK_PMD_THREADS_CREATED()
 
-AT_CHECK([ovs-appctl dpif/show | sed 
's/\(tx_queues=\)[[0-9]]*/\1/g'], [0], [dnl
+AT_CHECK([ovs-appctl dpif/show], [0], [dnl
 dummy@ovs-dummy: hit:0 missed:0
   br0:
 br0 65534/100: (dummy-internal)
-p0 1/1: (dummy-pmd: configured_rx_queues=8, 
configured_tx_queues=, requested_rx_queues=8, 
requested_tx_queues=)
+p0 1/1: (dummy-pmd: n_rxq=8, n_txq=1, numa_id=0)
 ])
 
 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | sed SED_NUMA_CORE_PATTERN], 
[0], [dnl
@@ -227,11 +227,11 @@ TMP=$(($(cat ovs-vswitchd.log | wc -l | tr -d 
[[:blank:]])+1))
 CHECK_CPU_DISCOVERED(4)
 CHECK_PMD_THREADS_CREATED()
 
-AT_CHECK([ovs-appctl dpif/show | sed 
's/\(tx_queues=\)[[0-9]]*/\1/g'], [0], [dnl
+AT_CHECK([ovs-appctl dpif/show], [0], [dnl
 dummy@ovs-dummy: hit:0 missed:0
   br0:
 br0 65534/100: (dummy-internal)
-p0 1/1: (dummy-pmd: configured_rx_queues=8, 
configured_tx_queues=, requested_rx_queues=8, 
requested_tx_queues=)
+p0 1/1: (dummy-pmd: n_rxq=8, n_txq=1, numa_id=1)
 ])
 
 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | sed SED_NUMA_CORE_PATTERN], 
[0], [dnl
@@ -436,11 +436,11 @@ AT_CHECK([ovs-vsctl set Open_vSwitch . 
other_config:smc-enable=true])
 
 sleep 1
 
-AT_CHECK([ovs-appctl dpif/show | sed 
's/\(tx_queues=\)[[0-9]]*/\1/g'], [0], [dnl
+AT_CHECK([ovs-appctl dpif/show], [0], [dnl
 dummy@ovs-dummy: hit:0 missed:0
   br0:
 br0 65534/100: (dummy-internal)
-p0 7/1: (dummy-pmd: configured_rx_queues=4, 
configured_tx_queues=, requested_rx_queues=4, 
requested_tx_queues=)
+p0 7/1: (dummy-pmd: n_rxq=4, n_txq=1, numa_id=0)
 ])
 
 AT_CHECK([ovs-appctl dpif-netdev/pmd-stats-show | sed SED_NUMA_CORE_PATTERN | 
sed '/cycles/d' | grep pmd -A 12], [0], [dnl
@@ -604,8 +604,8