[dpdk-dev] [PATCH 0/4] ethdev: Add checks for function support in driver

Bruce Richardson bruce.richardson at intel.com
Fri Jun 12 13:28:12 CEST 2015


The functions to check the current occupancy of the RX descriptor ring, and
to specifically query if a particular descriptor is ready to be received, are
used for load monitoring on the data path, and so are inline functions inside
rte_ethdev.h. However, these functions are not implemented for the majority of
drivers, so their use can cause crashes in applications as there are no checks
for a function call with a NULL pointer.

This patchset attempts to fix this by putting in place the minimal check
for a NULL pointer needed before calling the function and thereby avoid any
crashes. The functions now also have a new possible return code of -ENOTSUP
but no return type changes, so ABI is preserved.

As part of the patchset, some additional cleanup is performed. The two functions
in question, as well as the rx and tx burst functions actually have two copies in
the ethdev library - one in the header and a debug version in the C file. This
patchset removes this duplication by merging the debug version into the header
file version. Build-time and runtime behaviour was preserved as part of this
merge.

NOTE: This patchset depends on Stephen Hemminger's patch to make
rte_eth_dev_is_valid_port() public: http://dpdk.org/dev/patchwork/patch/5373/ 

Bruce Richardson (4):
  ethdev: rename macros to have RTE_ETH prefix
  ethdev: move RTE_ETH_FPTR_OR_ERR macros to header
  ethdev: remove duplicated debug functions
  ethdev: check support for rx_queue_count and descriptor_done fns

 lib/librte_ether/rte_ethdev.c | 626 ++++++++++++++++++------------------------
 lib/librte_ether/rte_ethdev.h | 112 +++++---
 2 files changed, 345 insertions(+), 393 deletions(-)

-- 
2.4.2



More information about the dev mailing list