<snip> > > On Fri, 11 Feb 2022 00:26:07 +0000 > Honnappa Nagarahalli <honnappa.nagaraha...@arm.com> wrote: > > > +static void > > +parse_rx_queue_size(const char *rx_queue_size_arg) { > > + char *end = NULL; > > + uint32_t rx_queue_size; > > + > > + /* parse decimal string */ > > + rx_queue_size = strtoul(rx_queue_size_arg, &end, 10); > > + if ((rx_queue_size_arg[0] == '\0') || (end == NULL) || (*end != '\0')) > > + return; > > + > > + if (rx_queue_size == 0) > > + return; > > + > > + nb_rxd = rx_queue_size; > > +} > > + > > +static void > > +parse_tx_queue_size(const char *tx_queue_size_arg) { > > + char *end = NULL; > > + uint32_t tx_queue_size; > > + > > + /* parse decimal string */ > > + tx_queue_size = strtoul(tx_queue_size_arg, &end, 10); > > + if ((tx_queue_size_arg[0] == '\0') || (end == NULL) || (*end != '\0')) > > + return; > > + > > + if (tx_queue_size == 0) > > + return; > > + > > + nb_txd = tx_queue_size; > > These are duplications of the same function, just different result. Agreed, make sense to combine
> Also programs should test for invalid queue size which is currently limited > to 16 > bits by rte_eth_dev_configure > > static void > parse_queue_size(const char *size_arg, uint32_t *size_ret) { > unsigned long result; > char *end; > > result = strtoul(size_arg, &end, 0); > if (size_arg[0] == '\0' || *end != '\0' || result > UINT16_MAX) > rte_exit(EXIT_FAILURE, "Invalid queue size '%s'\n", size_arg); > *size_ret = result; > }