On 20.10.23 12:03, Kevin Traynor wrote:
> On 13/10/2023 10:07, jm...@redhat.com wrote:
>> From: Jakob Meng <c...@jakobmeng.de>
>>
>> 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 <c...@jakobmeng.de>
>> ---
>>   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(&netdev->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(&netdev->mutex);
>> diff --git a/tests/pmd.at b/tests/pmd.at
>> index 7bdaca9e7..df6adde6c 100644
>> --- a/tests/pmd.at
>> +++ b/tests/pmd.at
>> @@ -93,11 +93,11 @@ pmd thread numa_id <cleared> core_id <cleared>:
>>     overhead: NOT AVAIL
>>   ])
>>   -AT_CHECK([ovs-appctl dpif/show | sed 
>> 's/\(tx_queues=\)[[0-9]]*/\1<cleared>/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=<cleared>, requested_rx_queues=1, 
>> requested_tx_queues=<cleared>)
>> +    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<cleared>/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=<cleared>, requested_rx_queues=8, 
>> requested_tx_queues=<cleared>)
>> +    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<cleared>/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=<cleared>, requested_rx_queues=8, 
>> requested_tx_queues=<cleared>)
>> +    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<cleared>/g'], [0], [dnl
>> +AT_CHECK([ovs-appctl dpif/show | sed 
>> 's/\(numa_id=\)[[0-9]]*/\1<cleared>/g'], [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=<cleared>, requested_rx_queues=8, 
>> requested_tx_queues=<cleared>)
>> +    p0 1/1: (dummy-pmd: n_rxq=8, n_txq=1, numa_id=<cleared>)
>
> The port is added with 'options:numa_id=1' so should be able to remove the 
> sed and just have numa_id=1

Good catch! Missed it in my last revision 🙄 (will try to send future patches 
only after enough sleep)

>>   ])
>>     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<cleared>/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=<cleared>, requested_rx_queues=4, 
>> requested_tx_queues=<cleared>)
>> +    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 @@ 
>> icmp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10
>>   dnl Check resetting to default number of rx queues after removal from the 
>> db.
>>   AT_CHECK([ovs-vsctl remove interface p1 options n_rxq])
>>   -AT_CHECK([ovs-appctl dpif/show | grep p1 | sed 
>> 's/\(tx_queues=\)[[0-9]]*/\1<cleared>/g'], [0], [dnl
>> -    p1 1/1: (dummy-pmd: configured_rx_queues=1, 
>> configured_tx_queues=<cleared>, requested_rx_queues=1, 
>> requested_tx_queues=<cleared>)
>> +AT_CHECK([ovs-appctl dpif/show | grep p1], [0], [dnl
>> +    p1 1/1: (dummy-pmd: n_rxq=1, n_txq=1, numa_id=0)
>>   ])
>>     OVS_VSWITCHD_STOP
>> @@ -1152,7 +1152,7 @@ dummy@dp0:
>>     lookups: hit:0 missed:0 lost:0
>>     flows: 0
>>     port 0: dp0 (dummy-internal)
>> -  port 1: p1 (dummy-pmd: configured_rx_queues=1, configured_tx_queues=1, 
>> requested_rx_queues=1, requested_tx_queues=1)
>> +  port 1: p1 (dummy-pmd: n_rxq=1, n_txq=1, numa_id=0)
>>     port 2: p2 (dummy)
>>   ])
>>   
>

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

Reply via email to