memif: If rx/tx_queues are unset, use default values

The standard behaviour for binary API is that zeroed arguments are
treated as if the default values were set. This way the configurator
does not need to know what default values are.
This, however, wasn't the case for rx_queues and tx_queues in
memif_create binary API message.

Change-Id: Ib588b472823f6bbb5ef12a798d68b0dda6dd2139
Signed-off-by: Milan Lenco <milan.lenco@pantheon.tech>
This commit is contained in:
Milan Lenco
2017-06-22 09:10:07 +02:00
committed by Damjan Marion
parent aad20988b6
commit 5fa72c8f1f

View File

@ -133,10 +133,20 @@ vl_api_memif_create_t_handler (vl_api_memif_create_t * mp)
/* role */
args.is_master = (mp->role == 0);
/* rx/tx queues */
if (args.is_master == 0)
{
args.rx_queues = mp->rx_queues;
args.tx_queues = mp->tx_queues;
args.rx_queues = MEMIF_DEFAULT_RX_QUEUES;
args.tx_queues = MEMIF_DEFAULT_TX_QUEUES;
if (mp->rx_queues)
{
args.rx_queues = mp->rx_queues;
}
if (mp->tx_queues)
{
args.tx_queues = mp->tx_queues;
}
}
/* ring size */