From patchwork Mon Sep 28 16:42:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 79025 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id ADDC7A04DB; Mon, 28 Sep 2020 18:44:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5142A1D6B4; Mon, 28 Sep 2020 18:43:08 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 57E351D64E for ; Mon, 28 Sep 2020 18:43:02 +0200 (CEST) IronPort-SDR: XIVhhSuNXtf5vvHOygVAtjuABw7goP0uezODJ8bXaArbDu21xC3pA07SsoMjHV+RZG+Sbu8LoK 7vYn4Watt79A== X-IronPort-AV: E=McAfee;i="6000,8403,9758"; a="223619752" X-IronPort-AV: E=Sophos;i="5.77,313,1596524400"; d="scan'208";a="223619752" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2020 09:43:01 -0700 IronPort-SDR: oqNGnGHlPXUk77UMcuT5ApNEDfyG16Eos6RP3d3GJpqsmFC6Nc3w7FZG3R8Coc9bcX1IrGkEfF N7DV7f0JSq/g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,313,1596524400"; d="scan'208";a="338250463" Received: from silpixa00399126.ir.intel.com ([10.237.222.4]) by fmsmga004.fm.intel.com with ESMTP; 28 Sep 2020 09:43:00 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: patrick.fu@intel.com, Bruce Richardson , Kevin Laatz Date: Mon, 28 Sep 2020 17:42:23 +0100 Message-Id: <20200928164245.84997-4-bruce.richardson@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928164245.84997-1-bruce.richardson@intel.com> References: <20200721095140.719297-1-bruce.richardson@intel.com> <20200928164245.84997-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 03/25] raw/ioat: enable use from C++ code X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" To allow the header file to be used from C++ code we need to ensure all typecasts are explicit, and include an 'extern "C"' guard. Signed-off-by: Bruce Richardson Reviewed-by: Kevin Laatz --- drivers/raw/ioat/rte_ioat_rawdev.h | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/raw/ioat/rte_ioat_rawdev.h b/drivers/raw/ioat/rte_ioat_rawdev.h index f765a65571..3d84192714 100644 --- a/drivers/raw/ioat/rte_ioat_rawdev.h +++ b/drivers/raw/ioat/rte_ioat_rawdev.h @@ -5,6 +5,10 @@ #ifndef _RTE_IOAT_RAWDEV_H_ #define _RTE_IOAT_RAWDEV_H_ +#ifdef __cplusplus +extern "C" { +#endif + /** * @file rte_ioat_rawdev.h * @@ -100,7 +104,8 @@ rte_ioat_enqueue_copy(int dev_id, phys_addr_t src, phys_addr_t dst, unsigned int length, uintptr_t src_hdl, uintptr_t dst_hdl, int fence) { - struct rte_ioat_rawdev *ioat = rte_rawdevs[dev_id].dev_private; + struct rte_ioat_rawdev *ioat = + (struct rte_ioat_rawdev *)rte_rawdevs[dev_id].dev_private; unsigned short read = ioat->next_read; unsigned short write = ioat->next_write; unsigned short mask = ioat->ring_size - 1; @@ -141,7 +146,8 @@ rte_ioat_enqueue_copy(int dev_id, phys_addr_t src, phys_addr_t dst, static inline void rte_ioat_do_copies(int dev_id) { - struct rte_ioat_rawdev *ioat = rte_rawdevs[dev_id].dev_private; + struct rte_ioat_rawdev *ioat = + (struct rte_ioat_rawdev *)rte_rawdevs[dev_id].dev_private; ioat->desc_ring[(ioat->next_write - 1) & (ioat->ring_size - 1)].u .control.completion_update = 1; rte_compiler_barrier(); @@ -190,7 +196,8 @@ static inline int rte_ioat_completed_copies(int dev_id, uint8_t max_copies, uintptr_t *src_hdls, uintptr_t *dst_hdls) { - struct rte_ioat_rawdev *ioat = rte_rawdevs[dev_id].dev_private; + struct rte_ioat_rawdev *ioat = + (struct rte_ioat_rawdev *)rte_rawdevs[dev_id].dev_private; unsigned short mask = (ioat->ring_size - 1); unsigned short read = ioat->next_read; unsigned short end_read, count; @@ -212,13 +219,13 @@ rte_ioat_completed_copies(int dev_id, uint8_t max_copies, __m128i hdls0 = _mm_load_si128(&ioat->hdls[read & mask]); __m128i hdls1 = _mm_load_si128(&ioat->hdls[(read + 1) & mask]); - _mm_storeu_si128((void *)&src_hdls[i], + _mm_storeu_si128((__m128i *)&src_hdls[i], _mm_unpacklo_epi64(hdls0, hdls1)); - _mm_storeu_si128((void *)&dst_hdls[i], + _mm_storeu_si128((__m128i *)&dst_hdls[i], _mm_unpackhi_epi64(hdls0, hdls1)); } for (; i < count; i++, read++) { - uintptr_t *hdls = (void *)&ioat->hdls[read & mask]; + uintptr_t *hdls = (uintptr_t *)&ioat->hdls[read & mask]; src_hdls[i] = hdls[0]; dst_hdls[i] = hdls[1]; } @@ -228,4 +235,8 @@ rte_ioat_completed_copies(int dev_id, uint8_t max_copies, return count; } +#ifdef __cplusplus +} +#endif + #endif /* _RTE_IOAT_RAWDEV_H_ */