From patchwork Fri Feb 4 17:42:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 106854 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 874A8A0350; Fri, 4 Feb 2022 18:42:30 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6D82640143; Fri, 4 Feb 2022 18:42:30 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id DE22140041 for ; Fri, 4 Feb 2022 18:42:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643996548; x=1675532548; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wxXoraHC/PYMOgAHtbEi1hhTgG70FYfiXZ9yxOydCIQ=; b=laTZCqpRMJ9lmvttJYhHxYVcC2ZOHEQONqM+/ulKarutEtKh6OghEzAW M2S+0uD67U0NOAFwLRSla3yQgB591F2QIntMwM4gVdjfZ9mV3PbzCKCkv hobXYVmWeUCwFWXy3Vd52AkGrIHnyx3zVipxG2bjOTWue18y5dhFo0XSe 3QRJeplEi+azgoHD/p5xjPcm2Xr8VetxXMaT+P4iHxbC3ZzHsSHdNIptR BF1lXfarsq/dOwlRbA2k4btlrdlGL3c0A+xqKxTEYn0mF4hkPA6z+5pKQ aAu28fExBImvklF3+LF2KIKPaK078duIXzgdOTVnvGCtM35KWLrgNqOkv w==; X-IronPort-AV: E=McAfee;i="6200,9189,10248"; a="247241572" X-IronPort-AV: E=Sophos;i="5.88,343,1635231600"; d="scan'208";a="247241572" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2022 09:42:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,343,1635231600"; d="scan'208";a="620890260" Received: from silpixa00399126.ir.intel.com ([10.237.223.162]) by FMSMGA003.fm.intel.com with ESMTP; 04 Feb 2022 09:42:25 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Joyce Kong , Jerin Jacob , Sunil Kumar Kori Subject: [PATCH 1/7] eal: fix header build with C++ Date: Fri, 4 Feb 2022 17:42:03 +0000 Message-Id: <20220204174209.440207-2-bruce.richardson@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220204174209.440207-1-bruce.richardson@intel.com> References: <20220204174209.440207-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++ files could not include some headers because: * "new" is a keyword in C++, so can't be a variable name * there is no automatic casting to/from void * Signed-off-by: Bruce Richardson --- lib/eal/include/generic/rte_ticketlock.h | 14 +++++++------- lib/eal/include/rte_trace_point.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/eal/include/generic/rte_ticketlock.h b/lib/eal/include/generic/rte_ticketlock.h index c1b8808f51..693c67b517 100644 --- a/lib/eal/include/generic/rte_ticketlock.h +++ b/lib/eal/include/generic/rte_ticketlock.h @@ -91,13 +91,13 @@ rte_ticketlock_unlock(rte_ticketlock_t *tl) static inline int rte_ticketlock_trylock(rte_ticketlock_t *tl) { - rte_ticketlock_t old, new; - old.tickets = __atomic_load_n(&tl->tickets, __ATOMIC_RELAXED); - new.tickets = old.tickets; - new.s.next++; - if (old.s.next == old.s.current) { - if (__atomic_compare_exchange_n(&tl->tickets, &old.tickets, - new.tickets, 0, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) + rte_ticketlock_t oldl, newl; + oldl.tickets = __atomic_load_n(&tl->tickets, __ATOMIC_RELAXED); + newl.tickets = oldl.tickets; + newl.s.next++; + if (oldl.s.next == oldl.s.current) { + if (__atomic_compare_exchange_n(&tl->tickets, &oldl.tickets, + newl.tickets, 0, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) return 1; } diff --git a/lib/eal/include/rte_trace_point.h b/lib/eal/include/rte_trace_point.h index e226f073f7..0f8700974f 100644 --- a/lib/eal/include/rte_trace_point.h +++ b/lib/eal/include/rte_trace_point.h @@ -370,7 +370,7 @@ do { \ do { \ if (unlikely(in == NULL)) \ return; \ - rte_strscpy(mem, in, __RTE_TRACE_EMIT_STRING_LEN_MAX); \ + rte_strscpy((char *)mem, in, __RTE_TRACE_EMIT_STRING_LEN_MAX); \ mem = RTE_PTR_ADD(mem, __RTE_TRACE_EMIT_STRING_LEN_MAX); \ } while (0) From patchwork Fri Feb 4 17:42:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 106855 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 6B0F9A0350; Fri, 4 Feb 2022 18:42:36 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 55CF540687; Fri, 4 Feb 2022 18:42:36 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id BF26840041 for ; Fri, 4 Feb 2022 18:42:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643996554; x=1675532554; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ja0j57+SzFMUqGBDQIjVZ/OP3kKyWyL0J8SUPewu1zE=; b=nlMtGS3U+kI6DtdkXfwGQZP9dWiWrirHaVISl33KEkjFXh+eB/DcOivw 7DidNmJ0jJ9zRNFop4tdNCV2q6ii4LAkBuKEJZ2MGziMHv4/7IoAr0Ews r2qJax8rC+KYfx6TgfXeN1c0DclopTJhcozQ/qvKBpFjnF6iqJU9m3nT3 U3s7/rM5TGZAWnmjDjSYnxS42+UyQiJsEICeIRPNU1vZlqoRCKy7OxHyz 20tHawLKi1hTfmK+pQqHRlYmIPrV4+ZW8zre5rh7S7NXUq7mxkjs7eOBb VMpHuWgfXQiFsM/6+T+QK0hPcrSGQbt3Af2IoHIh5JF2qVJttk2cEQkRk Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10248"; a="334805442" X-IronPort-AV: E=Sophos;i="5.88,343,1635231600"; d="scan'208";a="334805442" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2022 09:42:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,343,1635231600"; d="scan'208";a="620890324" Received: from silpixa00399126.ir.intel.com ([10.237.223.162]) by FMSMGA003.fm.intel.com with ESMTP; 04 Feb 2022 09:42:31 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Erik Gabriel Carrillo , Jerin Jacob Subject: [PATCH 2/7] eventdev: fix header build with C++ Date: Fri, 4 Feb 2022 17:42:04 +0000 Message-Id: <20220204174209.440207-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220204174209.440207-1-bruce.richardson@intel.com> References: <20220204174209.440207-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 The eventdev headers had issues when used from C++ * Missing closing "}" for the extern "C" block * No automatic casting to/from void * Signed-off-by: Bruce Richardson Acked-by: Jerin Jacob --- lib/eventdev/rte_event_timer_adapter.h | 3 +++ lib/eventdev/rte_eventdev.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/eventdev/rte_event_timer_adapter.h b/lib/eventdev/rte_event_timer_adapter.h index 1551741820..1fe4dd8e8f 100644 --- a/lib/eventdev/rte_event_timer_adapter.h +++ b/lib/eventdev/rte_event_timer_adapter.h @@ -678,4 +678,7 @@ rte_event_timer_cancel_burst(const struct rte_event_timer_adapter *adapter, return adapter->cancel_burst(adapter, evtims, nb_evtims); } +#ifdef __cplusplus +} +#endif #endif /* __RTE_EVENT_TIMER_ADAPTER_H__ */ diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev.h index eef47d8acc..25fb7c89dd 100644 --- a/lib/eventdev/rte_eventdev.h +++ b/lib/eventdev/rte_eventdev.h @@ -1805,7 +1805,7 @@ __rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id, return 0; } #endif - rte_eventdev_trace_enq_burst(dev_id, port_id, ev, nb_events, fn); + rte_eventdev_trace_enq_burst(dev_id, port_id, ev, nb_events, (void *)fn); /* * Allow zero cost non burst mode routine invocation if application * requests nb_events as const one From patchwork Fri Feb 4 17:42:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 106856 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 59038A0350; Fri, 4 Feb 2022 18:42:41 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4638A40E03; Fri, 4 Feb 2022 18:42:41 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 713C740E03 for ; Fri, 4 Feb 2022 18:42:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643996559; x=1675532559; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2hgcpc4graWtkEicx9y1HVphqZvw6xv3bbVZIf8uINg=; b=H8hUAizlIoRJHuopzMBhmAzj7ToZSpc1tJ9C+lRIpXa+Mp7FIjEmTH7O +5JOAaTYPX9bIc55pgFgDZaoT+sYrEqtUvIC04RxtJdKWzdrRcfY0xSDT Js7WUeFHsISYS1L5KTo2nd7Auloj2RwQ3EjYUsU1pvIMIU/vCu9tQ/rD/ 8vwQPQVzxqVhw/MCyqcJ+5R1/iC10ZfjhScaB9QRkrOd1gWyITLKzVvvL os7cC0uv5pdBQkxImmb5WLqypVEgXqIrA9pl3CtxJz3Vuzk7Wg1hz2Itq WSjcSvrO+7EglP/do6N+d7rfLUV6tWLqjQ+DFq/gJHCDRJPDQB+/tuAQN Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10248"; a="229060574" X-IronPort-AV: E=Sophos;i="5.88,343,1635231600"; d="scan'208";a="229060574" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2022 09:42:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,343,1635231600"; d="scan'208";a="620890366" Received: from silpixa00399126.ir.intel.com ([10.237.223.162]) by FMSMGA003.fm.intel.com with ESMTP; 04 Feb 2022 09:42:37 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Jerin Jacob , Kiran Kumar K , Nithin Dabilpuram Subject: [PATCH 3/7] graph: add explicit cast to allow C++ build Date: Fri, 4 Feb 2022 17:42:05 +0000 Message-Id: <20220204174209.440207-4-bruce.richardson@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220204174209.440207-1-bruce.richardson@intel.com> References: <20220204174209.440207-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 have automatic casting to/from void pointers, so need explicit cast if header is to be included in C++ code Signed-off-by: Bruce Richardson Acked-by: Jerin Jacob --- lib/graph/rte_graph_worker.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/graph/rte_graph_worker.h b/lib/graph/rte_graph_worker.h index eef77f732a..0c0b9c095a 100644 --- a/lib/graph/rte_graph_worker.h +++ b/lib/graph/rte_graph_worker.h @@ -155,7 +155,7 @@ rte_graph_walk(struct rte_graph *graph) * +-----+ <= cir_start + mask */ while (likely(head != graph->tail)) { - node = RTE_PTR_ADD(graph, cir_start[(int32_t)head++]); + node = (struct rte_node *)RTE_PTR_ADD(graph, cir_start[(int32_t)head++]); RTE_ASSERT(node->fence == RTE_GRAPH_FENCE); objs = node->objs; rte_prefetch0(objs); From patchwork Fri Feb 4 17:42:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 106857 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 718E9A0350; Fri, 4 Feb 2022 18:42:46 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6D7E140E5A; Fri, 4 Feb 2022 18:42:44 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 47DBC40E09 for ; Fri, 4 Feb 2022 18:42: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=1643996563; x=1675532563; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cJ3V4VuGkAVShj73ZQTWTQdKr1BpKXyQ3o2Mz0ilgEo=; b=CBzWl3/nFjJMF2Ko2YqXj9LVKejwyCTCfw2Wz8v2/j/B9zIwNr7FCWkM n1HZfYO75YASvoMtKKLTj8FEzvzebA33IZdjB9H5GAQlw4GUugVtSOMJg tdPtAAwmFlFDb+7MAq+tDWTJjrk4mHw69Q6c5EmOYaRyawSbehyZkhqPh EAQ+8sjVGg2ErLHXF3Jf2x24OaHsa4Sz+OuW1JYtAO400andc9qYEIRHO Jb+ql95Yq61r1NSQDQo6DFiCsCr3NKApinTCtb1bQCCLmi1BEReuwBj3v qhzHBVexlJsY4wgUurQAbUh/qURmkjSRNyrSoVOMxtGXUCTTkZBtF9x1v g==; X-IronPort-AV: E=McAfee;i="6200,9189,10248"; a="229060598" X-IronPort-AV: E=Sophos;i="5.88,343,1635231600"; d="scan'208";a="229060598" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2022 09:42:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,343,1635231600"; d="scan'208";a="620890414" Received: from silpixa00399126.ir.intel.com ([10.237.223.162]) by FMSMGA003.fm.intel.com with ESMTP; 04 Feb 2022 09:42:41 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Konstantin Ananyev , Bernard Iremonger , Vladimir Medvedkin Subject: [PATCH 4/7] ipsec: add explicit cast to allow C++ build Date: Fri, 4 Feb 2022 17:42:06 +0000 Message-Id: <20220204174209.440207-5-bruce.richardson@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220204174209.440207-1-bruce.richardson@intel.com> References: <20220204174209.440207-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 have automatic casting to/from void pointers, so need explicit cast if header is to be included in C++ code Signed-off-by: Bruce Richardson --- lib/ipsec/rte_ipsec_group.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.32.0 diff --git a/lib/ipsec/rte_ipsec_group.h b/lib/ipsec/rte_ipsec_group.h index 60ab297710..62c2bd7217 100644 --- a/lib/ipsec/rte_ipsec_group.h +++ b/lib/ipsec/rte_ipsec_group.h @@ -49,10 +49,10 @@ rte_ipsec_ses_from_crypto(const struct rte_crypto_op *cop) if (cop->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) { ss = cop->sym[0].sec_session; - return (void *)(uintptr_t)ss->opaque_data; + return (struct rte_ipsec_session *)(uintptr_t)ss->opaque_data; } else if (cop->sess_type == RTE_CRYPTO_OP_WITH_SESSION) { cs = cop->sym[0].session; - return (void *)(uintptr_t)cs->opaque_data; + return (struct rte_ipsec_session *)(uintptr_t)cs->opaque_data; } return NULL; } From patchwork Fri Feb 4 17:42:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 106858 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 09B58A0350; Fri, 4 Feb 2022 18:42:51 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5B37040E09; Fri, 4 Feb 2022 18:42:49 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id B46A240E28 for ; Fri, 4 Feb 2022 18:42: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=1643996567; x=1675532567; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gSCpS1Gf1XA9xcLYoq2nwXsRj7YPNm9OVq7nrHs6uk4=; b=lhw9H+f9VnTWoM6SDt+Wm6JnxtJuGjnUDaMymv/Zl8QyfAH2chEgK3Qe pVc7gxjpYM7x57lFBxu0lWWPhSQh4j+A17YIYhNpKWIsnD9xPvqjJRSA2 EWVwCclmTwbPCGqr4O3k2nFif+pCA35KFrQ67M35ZNTIKXz1cwnMqHR2w lYv+PQ18yv0qh24P1HB2h72EhLjhEk2KEujJM0730XD2bas7XvqWgGter C/XvChOi4FFw3uJgt2Ukz5BZlSXy56040eLG4AGtDuIPhLx8+8iNuFp8L x6yctmTbgGLbH78Y31Cady33j4XmESrRBzwFnbgxM2yMlDlkPXlKOSC1+ g==; X-IronPort-AV: E=McAfee;i="6200,9189,10248"; a="229060617" X-IronPort-AV: E=Sophos;i="5.88,343,1635231600"; d="scan'208";a="229060617" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2022 09:42:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,343,1635231600"; d="scan'208";a="620890448" Received: from silpixa00399126.ir.intel.com ([10.237.223.162]) by FMSMGA003.fm.intel.com with ESMTP; 04 Feb 2022 09:42:46 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Cristian Dumitrescu Subject: [PATCH 5/7] table: add explicit casts for C++ compatibility Date: Fri, 4 Feb 2022 17:42:07 +0000 Message-Id: <20220204174209.440207-6-bruce.richardson@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220204174209.440207-1-bruce.richardson@intel.com> References: <20220204174209.440207-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 Since C++ doesn't support automatic casting from void * to other types, we need to explicitly add the casts to any header files in DPDK. Signed-off-by: Bruce Richardson --- lib/table/rte_table_hash_func.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/table/rte_table_hash_func.h b/lib/table/rte_table_hash_func.h index c4c35cc06a..a962ec2f68 100644 --- a/lib/table/rte_table_hash_func.h +++ b/lib/table/rte_table_hash_func.h @@ -58,8 +58,8 @@ static inline uint64_t rte_table_hash_crc_key8(void *key, void *mask, __rte_unused uint32_t key_size, uint64_t seed) { - uint64_t *k = key; - uint64_t *m = mask; + uint64_t *k = (uint64_t *)key; + uint64_t *m = (uint64_t *)mask; uint64_t crc0; crc0 = rte_crc32_u64(seed, k[0] & m[0]); @@ -72,8 +72,8 @@ static inline uint64_t rte_table_hash_crc_key16(void *key, void *mask, __rte_unused uint32_t key_size, uint64_t seed) { - uint64_t *k = key; - uint64_t *m = mask; + uint64_t *k = (uint64_t *)key; + uint64_t *m = (uint64_t *)mask; uint64_t k0, crc0, crc1; k0 = k[0] & m[0]; @@ -91,8 +91,8 @@ static inline uint64_t rte_table_hash_crc_key24(void *key, void *mask, __rte_unused uint32_t key_size, uint64_t seed) { - uint64_t *k = key; - uint64_t *m = mask; + uint64_t *k = (uint64_t *)key; + uint64_t *m = (uint64_t *)mask; uint64_t k0, k2, crc0, crc1; k0 = k[0] & m[0]; @@ -113,8 +113,8 @@ static inline uint64_t rte_table_hash_crc_key32(void *key, void *mask, __rte_unused uint32_t key_size, uint64_t seed) { - uint64_t *k = key; - uint64_t *m = mask; + uint64_t *k = (uint64_t *)key; + uint64_t *m = (uint64_t *)mask; uint64_t k0, k2, crc0, crc1, crc2, crc3; k0 = k[0] & m[0]; @@ -139,8 +139,8 @@ static inline uint64_t rte_table_hash_crc_key40(void *key, void *mask, __rte_unused uint32_t key_size, uint64_t seed) { - uint64_t *k = key; - uint64_t *m = mask; + uint64_t *k = (uint64_t *)key; + uint64_t *m = (uint64_t *)mask; uint64_t k0, k2, crc0, crc1, crc2, crc3; k0 = k[0] & m[0]; @@ -165,8 +165,8 @@ static inline uint64_t rte_table_hash_crc_key48(void *key, void *mask, __rte_unused uint32_t key_size, uint64_t seed) { - uint64_t *k = key; - uint64_t *m = mask; + uint64_t *k = (uint64_t *)key; + uint64_t *m = (uint64_t *)mask; uint64_t k0, k2, k5, crc0, crc1, crc2, crc3; k0 = k[0] & m[0]; @@ -192,8 +192,8 @@ static inline uint64_t rte_table_hash_crc_key56(void *key, void *mask, __rte_unused uint32_t key_size, uint64_t seed) { - uint64_t *k = key; - uint64_t *m = mask; + uint64_t *k = (uint64_t *)key; + uint64_t *m = (uint64_t *)mask; uint64_t k0, k2, k5, crc0, crc1, crc2, crc3, crc4, crc5; k0 = k[0] & m[0]; @@ -222,8 +222,8 @@ static inline uint64_t rte_table_hash_crc_key64(void *key, void *mask, __rte_unused uint32_t key_size, uint64_t seed) { - uint64_t *k = key; - uint64_t *m = mask; + uint64_t *k = (uint64_t *)key; + uint64_t *m = (uint64_t *)mask; uint64_t k0, k2, k5, crc0, crc1, crc2, crc3, crc4, crc5; k0 = k[0] & m[0]; From patchwork Fri Feb 4 17:42:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 106859 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 20A23A0350; Fri, 4 Feb 2022 18:42:56 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5880A40E28; Fri, 4 Feb 2022 18:42:53 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 5FBF9410D5 for ; Fri, 4 Feb 2022 18:42:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643996572; x=1675532572; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WDVlg225rtoKKy0IqVnNCWKSBfLLDWdoS03V0aStnGA=; b=JAnXukclFi9Di+wQyx2rGdwBpPJQwi/JGaKvU23bHtOSavEpSkJi8w5R gQ0D/+tXavnooXjlhDIZP2hDvJJhagZ9ehXsCJifYs2BkGzodoc1L+AVV 9mc/vJDpJVq1If5u6e0RgCF5RS4bTXu4guhbNlyXQHGd1/5I76njnTsRd OqiSb7l8Z7ZBeM82hJrpjIYKhKN9MSSCRwoGRWkbMV4RZkIb1xgxfic6j W7Iy6kcQ3FD7rFB3PggMRsLWjynkHFieT3F247JGRWShss0whgGG+8WZL 4+i8Br9PCtnV6YO4sZIL8kXaKLGGbMcrlIP5VYnKVEkXNzZmBXO9Cd0Il w==; X-IronPort-AV: E=McAfee;i="6200,9189,10248"; a="229060640" X-IronPort-AV: E=Sophos;i="5.88,343,1635231600"; d="scan'208";a="229060640" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2022 09:42:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,343,1635231600"; d="scan'208";a="620890463" Received: from silpixa00399126.ir.intel.com ([10.237.223.162]) by FMSMGA003.fm.intel.com with ESMTP; 04 Feb 2022 09:42:50 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Maxime Coquelin , Chenbo Xia , Xiao Wang , Matan Azrad , Viacheslav Ovsiienko Subject: [PATCH 6/7] vhost: remove non-C++ compatible includes Date: Fri, 4 Feb 2022 17:42:08 +0000 Message-Id: <20220204174209.440207-7-bruce.richardson@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220204174209.440207-1-bruce.richardson@intel.com> References: <20220204174209.440207-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 Some of the linux header includes are explicitly noted as being incompatible with C++. However, these headers can included by C files directly, or by internal headers, to avoid polluting the public DPDK headers with non-C++ safe includes. Signed-off-by: Bruce Richardson --- drivers/net/vhost/rte_eth_vhost.c | 2 ++ drivers/vdpa/ifc/ifcvf_vdpa.c | 2 ++ drivers/vdpa/mlx5/mlx5_vdpa.h | 1 + lib/vhost/rte_vhost.h | 4 ---- 4 files changed, 5 insertions(+), 4 deletions(-) -- 2.32.0 diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index 070f0e6dfd..cd2afe3100 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -16,6 +16,8 @@ #include #include #include +#include +#include #include "rte_eth_vhost.h" diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c index 3853c4cf7e..cbd190ea8d 100644 --- a/drivers/vdpa/ifc/ifcvf_vdpa.c +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c @@ -24,6 +24,8 @@ #include #include +#include + #include "base/ifcvf.h" RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.vdpa.ifcvf, NOTICE); diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.h b/drivers/vdpa/mlx5/mlx5_vdpa.h index 22617924ea..a7fa4356dd 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa.h +++ b/drivers/vdpa/mlx5/mlx5_vdpa.h @@ -6,6 +6,7 @@ #define RTE_PMD_MLX5_VDPA_H_ #include +#include #include #ifdef PEDANTIC diff --git a/lib/vhost/rte_vhost.h b/lib/vhost/rte_vhost.h index b454c05868..0a21177199 100644 --- a/lib/vhost/rte_vhost.h +++ b/lib/vhost/rte_vhost.h @@ -21,10 +21,6 @@ extern "C" { #endif -/* These are not C++-aware. */ -#include -#include -#include #define RTE_VHOST_USER_CLIENT (1ULL << 0) #define RTE_VHOST_USER_NO_RECONNECT (1ULL << 1) From patchwork Fri Feb 4 17:42:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 106860 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 73E22A0350; Fri, 4 Feb 2022 18:43:01 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 46EEA410E8; Fri, 4 Feb 2022 18:42:58 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id F128840041 for ; Fri, 4 Feb 2022 18:42:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643996577; x=1675532577; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qOcgvMD67t0FQBAuad4/OKjnMTgYNAuM5LsiMr1NU0Y=; b=K+sRZ5N5pdpprUYix2sNcNbjRo83PpsCjTtBGb6zKmiU0wHHUQCH9QZ1 t851narZiyk8GRxUtKJieaESCk6h9QE3Nc9EotfI+NxXnEWftyASzIAnZ Xewi+mEIgA3Vj3kMC+QX80M6CcMnaqQc5hyOSs+KcLvuZ95ip2P1t06dT v4A5uJ0zVt7H6BXxYdTUf8xbTLPtiyqwjD4dOHUE7X35ZUM34z+Fhrtad PJHaa25ZoYEWybcgKyqx8RrcFDHjdTMin04Tsg6TCFGC2I2Hvg0VkfGdt 3gnJyzOOakMIbAIaTGbzzb2lfzrVceBUgKnSIOdRPW46L2ajDWdc3MwKB Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10248"; a="229060663" X-IronPort-AV: E=Sophos;i="5.88,343,1635231600"; d="scan'208";a="229060663" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2022 09:42:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,343,1635231600"; d="scan'208";a="620890488" Received: from silpixa00399126.ir.intel.com ([10.237.223.162]) by FMSMGA003.fm.intel.com with ESMTP; 04 Feb 2022 09:42:55 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [PATCH 7/7] buildtools/chkincs: test headers for C++ compatibility Date: Fri, 4 Feb 2022 17:42:09 +0000 Message-Id: <20220204174209.440207-8-bruce.richardson@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220204174209.440207-1-bruce.richardson@intel.com> References: <20220204174209.440207-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 Add support for checking each of our headers for issues when included in a C++ file. Signed-off-by: Bruce Richardson --- buildtools/chkincs/main.cpp | 4 ++++ buildtools/chkincs/meson.build | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 buildtools/chkincs/main.cpp diff --git a/buildtools/chkincs/main.cpp b/buildtools/chkincs/main.cpp new file mode 100644 index 0000000000..d25bb8852a --- /dev/null +++ b/buildtools/chkincs/main.cpp @@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2021 Intel Corporation + */ +int main(void) { return 0; } diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build index 5ffca89761..beabcd55d8 100644 --- a/buildtools/chkincs/meson.build +++ b/buildtools/chkincs/meson.build @@ -28,3 +28,23 @@ executable('chkincs', sources, dependencies: deps, link_whole: dpdk_static_libraries + dpdk_drivers, install: false) + +# run tests for c++ builds also +if not add_languages('cpp', required: false) + subdir_done() +endif + +gen_cpp_files = generator(gen_c_file_for_header, + output: '@BASENAME@.cpp', + arguments: ['@INPUT@', '@OUTPUT@']) + +cpp_sources = files('main.cpp') +cpp_sources += gen_cpp_files.process(dpdk_chkinc_headers) + +executable('chkincs-cpp', cpp_sources, + cpp_args: ['-include', 'rte_config.h', cflags], + link_args: dpdk_extra_ldflags, + include_directories: includes, + dependencies: deps, + link_whole: dpdk_static_libraries + dpdk_drivers, + install: false)