From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id E34F2B3D6 for ; Fri, 12 Jun 2015 13:55:08 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 12 Jun 2015 04:55:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,601,1427785200"; d="scan'208";a="745519263" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 12 Jun 2015 04:55:03 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t5CBSG8m013684; Fri, 12 Jun 2015 12:28:16 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id t5CBSG6Y002032; Fri, 12 Jun 2015 12:28:16 +0100 Received: (from bricha3@localhost) by sivswdev01.ir.intel.com with id t5CBSGmn002026; Fri, 12 Jun 2015 12:28:16 +0100 From: Bruce Richardson To: dev@dpdk.org Date: Fri, 12 Jun 2015 12:28:12 +0100 Message-Id: <1434108496-1993-1-git-send-email-bruce.richardson@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH 0/4] ethdev: Add checks for function support in driver X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jun 2015 11:55:09 -0000 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