[dpdk-dev,2/2] examples: adjust Rx and Tx descriptors to device limits

Message ID 591819ba-f8aa-8afd-9f69-f40befb93016@solarflare.com (mailing list archive)
State Not Applicable, archived
Headers

Checks

Context Check Description
ci/Intel-compilation fail apply patch file failure
ci/checkpatch warning coding style issues

Commit Message

Andrew Rybchenko July 9, 2017, 9:40 a.m. UTC
  On 07/08/2017 08:05 PM, Stephen Hemminger wrote:
> On Thu, 25 May 2017 16:57:54 +0100
> Andrew Rybchenko <arybchenko@solarflare.com> wrote:
>
>> +	retval = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd, &nb_txd);
>> +	if (retval != 0)
>> +		rte_exit(EXIT_FAILURE, "port %u: rte_eth_dev_adjust_nb_rx_tx_desc "
>> +				"failed (res=%d)\n", portid, retval);
>> +
> rte_exit is equivalent to panic in kernel.
> No API call should call rte_exit. Instead the error must be propogated
> back to caller and/or leave the slave in a dead state.

Unfortunately the remaining context lines are not provided in the above 
quote.
As I understand it is:

                                         mbuf_pool);
         if (retval < 0)

So, it is an example application (not a library API), we do not invent 
rte_exit() and
just follow practice which exists in the file.
  

Patch

diff --git a/examples/bond/main.c b/examples/bond/main.c
index 9a4ec80..6859e13 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -177,6 +177,8 @@ 
  slave_port_init(uint8_t portid, struct rte_mempool *mbuf_pool)
  {
         int retval;
+       uint16_t nb_rxd = RTE_RX_DESC_DEFAULT;
+       uint16_t nb_txd = RTE_TX_DESC_DEFAULT;

         if (portid >= rte_eth_dev_count())
                 rte_exit(EXIT_FAILURE, "Invalid port\n");
@@ -186,8 +188,13 @@ 
                 rte_exit(EXIT_FAILURE, "port %u: configuration failed 
(res=%d)\n",
                                 portid, retval);

+       retval = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd, &nb_txd);
+       if (retval != 0)
+               rte_exit(EXIT_FAILURE, "port %u: 
rte_eth_dev_adjust_nb_rx_tx_desc "
+                               "failed (res=%d)\n", portid, retval);
+
         /* RX setup */
-       retval = rte_eth_rx_queue_setup(portid, 0, RTE_RX_DESC_DEFAULT,
+       retval = rte_eth_rx_queue_setup(portid, 0, nb_rxd,
rte_eth_dev_socket_id(portid), NULL,