From patchwork Tue Feb 15 17:30:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 107658 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3F866A00C5; Tue, 15 Feb 2022 18:30:43 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0406C410F7; Tue, 15 Feb 2022 18:30:43 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 3B373410F3 for ; Tue, 15 Feb 2022 18:30:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644946241; x=1676482241; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UpZsPtd5oPIZVllKWMiyF/k0Dj5LaytbIchCBMC1ZoM=; b=KC539Np52YkQ1yjDl0Vm1LJF8fZ0EZuWSrWY/D0Wt4VYmRMDDciPkR+7 HbFUn9d9dxSX83bQZQe4G5tDsfP7hYeF5/rP44KTMNQUPvrVin31FzSSC BkG5EpslUxI4LViNmx+GhwVHTr+dfm7PNhlOT54NC/LQOuoKXQkjWKUL5 5cd+ez5OqU7N1eMR8g2GAFxdJMUfPJdtJ0VLRKfI2ul1XJhiHGVhEQHUm nUJEO96FDonXpGyj/B2L1wDxydK3FhCpBk9SIOVIY9D/ha/nDD8O+vjak D7X4rdBfgXHV3hMW73Dc7dQo5cFlkLGoJnBgSDZ6P+Asi3xaJ+FQDdnpK Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10259"; a="250608771" X-IronPort-AV: E=Sophos;i="5.88,371,1635231600"; d="scan'208";a="250608771" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2022 09:30:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,371,1635231600"; d="scan'208";a="570927394" Received: from silpixa00399126.ir.intel.com ([10.237.223.192]) by orsmga001.jf.intel.com with ESMTP; 15 Feb 2022 09:30:38 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko Subject: [PATCH 1/3] ethdev: fix missing cast for C++ compatibility Date: Tue, 15 Feb 2022 17:30:27 +0000 Message-Id: <20220215173029.1893710-2-bruce.richardson@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220215173029.1893710-1-bruce.richardson@intel.com> References: <20220215173029.1893710-1-bruce.richardson@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org C++ does not allow implicit conversion to/from void*, so we need an explicit cast to allow the driver sdk header to be included from C++ code. Signed-off-by: Bruce Richardson --- lib/ethdev/ethdev_pci.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ethdev/ethdev_pci.h b/lib/ethdev/ethdev_pci.h index 71aa4b2e98..d2bc3fe5e0 100644 --- a/lib/ethdev/ethdev_pci.h +++ b/lib/ethdev/ethdev_pci.h @@ -46,8 +46,9 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, } static inline int -eth_dev_pci_specific_init(struct rte_eth_dev *eth_dev, void *bus_device) { - struct rte_pci_device *pci_dev = bus_device; +eth_dev_pci_specific_init(struct rte_eth_dev *eth_dev, void *bus_device) +{ + struct rte_pci_device *pci_dev = (struct rte_pci_device *)bus_device; if (!pci_dev) return -ENODEV; From patchwork Tue Feb 15 17:30:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 107659 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 667F9A00C5; Tue, 15 Feb 2022 18:30:48 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE26C4114E; Tue, 15 Feb 2022 18:30:45 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id EC7FB4114B for ; Tue, 15 Feb 2022 18:30:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644946244; x=1676482244; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IXu1Hu5qW23B+EnVO4mrQKRCYqrzNFWQhna6Lrg8rMw=; b=WHjw6usFgX0bC4aWU6z91Iesm7ixGqrEL8pbZ2lfEepgC+x4aRrteUkk EbH+CL2Y+Eh7dtR70HMnCLiQHRpW6ZXwoRenqffRLw+cTXryHjxiT4jHx 7h3z3TGngvxZg7/fjQNntYV5fy25KczueoctNawWgIlygHjLZDFca1xPB xITq/iTaIxU5XEFUMNMvps3ky9QZbChK+BUFwq3LDo79zpXZJrMIqqGpA smhGJFKrhKBkcZM3xbRlQZMyKMQleAXx8jt+FGFCMDtdeE/QMbv9Sgdyz r4BE3zw02H3qeB7XvMrgi7YkFs2b4L3QQVoAJvuRt56GSkD3T735pPjV5 g==; X-IronPort-AV: E=McAfee;i="6200,9189,10259"; a="250608799" X-IronPort-AV: E=Sophos;i="5.88,371,1635231600"; d="scan'208";a="250608799" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2022 09:30:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,371,1635231600"; d="scan'208";a="570927428" Received: from silpixa00399126.ir.intel.com ([10.237.223.192]) by orsmga001.jf.intel.com with ESMTP; 15 Feb 2022 09:30:42 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [PATCH 2/3] buildtools/chkincs: check sdk headers for C++ compatibility Date: Tue, 15 Feb 2022 17:30:28 +0000 Message-Id: <20220215173029.1893710-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220215173029.1893710-1-bruce.richardson@intel.com> References: <20220215173029.1893710-1-bruce.richardson@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org With a one-line change to the lib meson.build file we can add the sdk headers to the list of files to be checked using the chkincs binary. Unfortunately, many of those sdk header depend upon headers in the PCI and vdev bus drivers, so we need to update chkincs build to ensure those dependencies are added. We also need to allow internal APIs to be present in these SDK headers. Signed-off-by: Bruce Richardson --- buildtools/chkincs/meson.build | 6 +++++- lib/meson.build | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) -- 2.32.0 diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build index 790f700619..9442235200 100644 --- a/buildtools/chkincs/meson.build +++ b/buildtools/chkincs/meson.build @@ -13,11 +13,15 @@ gen_c_files = generator(gen_c_file_for_header, cflags = machine_args cflags += '-DALLOW_EXPERIMENTAL_API' +cflags += '-DALLOW_INTERNAL_API' sources = files('main.c') sources += gen_c_files.process(dpdk_chkinc_headers) -deps = [] +# some driver sdk headers depend on these two buses, which are mandatory in build +# so we always include them in deps list +deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')] +# add the rest of the libs to the dependencies foreach l:enabled_libs deps += get_variable('shared_rte_' + l) endforeach diff --git a/lib/meson.build b/lib/meson.build index 8e5acd7819..24adbe44c9 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -171,6 +171,7 @@ foreach l:libraries install_headers(driver_sdk_headers) endif dpdk_chkinc_headers += headers + dpdk_chkinc_headers += driver_sdk_headers libname = 'rte_' + name includes += include_directories(l) From patchwork Tue Feb 15 17:30:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 107660 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EFF69A00C5; Tue, 15 Feb 2022 18:30:54 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A22BD41155; Tue, 15 Feb 2022 18:30:49 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 95C9741154 for ; Tue, 15 Feb 2022 18:30:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644946247; x=1676482247; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tU+l8SPSE8XWp/UxmbRD7yp48IoZMFJSCGEU2zCRaTU=; b=egsWwFb/iL30r27HJKgtedXA6w4il0bdIhu+pYEdGoUsfyL5aMNFC+8V B4cp/KuLEUSR3ycXCBfyknJdCzs/RyLxPnJk7kLUlDWjnsOYA8uaWn1Gx tjHOZqHXZ+lIOXY6Rxyk2N1p/gcy/zbOO9v3JONgfmYr7A0m1+3ZBstyG 7abN4e0GU3/ZiApSynlWMPu6prKBXTi70WU7zTU3OYBovfdTdJYSL3A7c Xld2FrlVJJPOe+EeW8XFCHB7dtVbNfbpS1Dxya9bDKfa2vldmv0M3xZ0S gFsPiM1IrPurzONDLR5azCgzJqGHVQ+bBxeuEr6W5HPrmkGfreNCfijev Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10259"; a="250608828" X-IronPort-AV: E=Sophos;i="5.88,371,1635231600"; d="scan'208";a="250608828" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2022 09:30:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,371,1635231600"; d="scan'208";a="570927459" Received: from silpixa00399126.ir.intel.com ([10.237.223.192]) by orsmga001.jf.intel.com with ESMTP; 15 Feb 2022 09:30:46 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [PATCH 3/3] buildtools/chkincs: add checks for missing C++ guards Date: Tue, 15 Feb 2022 17:30:29 +0000 Message-Id: <20220215173029.1893710-4-bruce.richardson@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220215173029.1893710-1-bruce.richardson@intel.com> References: <20220215173029.1893710-1-bruce.richardson@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Simply compiling a C header with a C++ compiler is not enough to flag missing 'extern "C"' guards. To catch missing guards, we can just use a simple grep for the 'extern "C"' part, and error out if any files have a miss. Signed-off-by: Bruce Richardson --- Depends-on: series-21685 ("add missing C++ guards") --- buildtools/chkincs/meson.build | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.32.0 diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build index 9442235200..77ef59fb13 100644 --- a/buildtools/chkincs/meson.build +++ b/buildtools/chkincs/meson.build @@ -37,6 +37,16 @@ if not add_languages('cpp', required: false) subdir_done() endif +# check for extern C in files, since this is not detected as an error by the compiler +grep = find_program('grep', required: false) +if grep.found() + errlist = run_command([grep, '--files-without-match', '^extern "C"', dpdk_chkinc_headers], + check: false, capture: true).stdout().split() + if errlist != [] + error('Files missing C++ \'extern "C"\' guards:\n- ' + '\n- '.join(errlist)) + endif +endif + gen_cpp_files = generator(gen_c_file_for_header, output: '@BASENAME@.cpp', arguments: ['@INPUT@', '@OUTPUT@'])