Skip to content

Commit

Permalink
netdev: Set the default number of queues at removal from the database
Browse files Browse the repository at this point in the history
Expected behavior for attribute removal from the database is
resetting it to default value. Currently this doesn't work for
n_rxq/n_txq options of pmd netdevs (last requested value used):

	# ovs-vsctl set interface dpdk0 options:n_rxq=4
	# ovs-vsctl remove interface dpdk0 options n_rxq
	# ovs-appctl dpif/show | grep dpdk0
	  <...>
	  dpdk0 1/1: (dpdk: configured_rx_queues=4, <...> \
	                    requested_rx_queues=4,  <...>)

Fix that by using NR_QUEUE or 1 as a default value for 'smap_get_int'.

Fixes: a14b894 ("dpif-netdev: Allow different numbers of
                      rx queues for different ports.")
Signed-off-by: Ilya Maximets <[email protected]>
Tested-by: Ian Stokes <[email protected]>
Signed-off-by: Daniele Di Proietto <[email protected]>
  • Loading branch information
igsilya authored and ddiproietto committed Dec 10, 2016
1 parent b381553 commit 2a21e75
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/netdev-dpdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ dpdk_set_rxq_config(struct netdev_dpdk *dev, const struct smap *args)
{
int new_n_rxq;

new_n_rxq = MAX(smap_get_int(args, "n_rxq", dev->requested_n_rxq), 1);
new_n_rxq = MAX(smap_get_int(args, "n_rxq", NR_QUEUE), 1);
if (new_n_rxq != dev->requested_n_rxq) {
dev->requested_n_rxq = new_n_rxq;
netdev_request_reconfigure(&dev->up);
Expand Down
4 changes: 2 additions & 2 deletions lib/netdev-dummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -868,8 +868,8 @@ netdev_dummy_set_config(struct netdev *netdev_, const struct smap *args)
goto exit;
}

new_n_rxq = MAX(smap_get_int(args, "n_rxq", netdev->requested_n_rxq), 1);
new_n_txq = MAX(smap_get_int(args, "n_txq", netdev->requested_n_txq), 1);
new_n_rxq = MAX(smap_get_int(args, "n_rxq", 1), 1);
new_n_txq = MAX(smap_get_int(args, "n_txq", 1), 1);
new_numa_id = smap_get_int(args, "numa_id", 0);
if (new_n_rxq != netdev->requested_n_rxq
|| new_n_txq != netdev->requested_n_txq
Expand Down
7 changes: 7 additions & 0 deletions tests/pmd.at
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,13 @@ NXT_PACKET_IN2 (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_le
icmp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.0.0.2,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0 icmp_csum:f7ff
])

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>)
])

OVS_VSWITCHD_STOP
AT_CLEANUP

Expand Down

0 comments on commit 2a21e75

Please sign in to comment.