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

Andrew Rybchenko arybchenko at solarflare.com
Sun Jul 9 11:40:23 CEST 2017


On 07/08/2017 08:05 PM, Stephen Hemminger wrote:
> On Thu, 25 May 2017 16:57:54 +0100
> Andrew Rybchenko <arybchenko at 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:

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,
                                         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.


More information about the dev mailing list