From patchwork Wed Feb 1 13:14:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 93028 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2411851qgi; Wed, 1 Feb 2017 05:20:12 -0800 (PST) X-Received: by 10.55.24.8 with SMTP id j8mr2932511qkh.181.1485955211972; Wed, 01 Feb 2017 05:20:11 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id q1si14410834qtq.167.2017.02.01.05.20.11; Wed, 01 Feb 2017 05:20:11 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 9FA77607C6; Wed, 1 Feb 2017 13:20:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id D335662DC2; Wed, 1 Feb 2017 13:14:55 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 20E4562D1B; Wed, 1 Feb 2017 13:14:27 +0000 (UTC) Received: from mail-qt0-f170.google.com (mail-qt0-f170.google.com [209.85.216.170]) by lists.linaro.org (Postfix) with ESMTPS id 50F7562CDE for ; Wed, 1 Feb 2017 13:14:22 +0000 (UTC) Received: by mail-qt0-f170.google.com with SMTP id v23so263216253qtb.0 for ; Wed, 01 Feb 2017 05:14:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GkYXrdoFx7aBQ0ev5hYyYvG3yvYsqEzSTfIZOSL5eoQ=; b=U21SOsJ9UafcOfOHfzpx85q9FcwteDOZQkbr6GiEf1FQfTx54s1RE5OC07eBO4MwU2 TNW9u3Msqa+Tn1+db5yr6Y2cbJpYIYkR5EDOiaLrhoIGydUrdPhphMAy3+vSjYDfZFH9 ns841SCWii3MWa2j4Q7REc53rumvfuZEWTWMmSutonrHYfyVfRP8kztZBxpJBA4A7DQc LV83/HNPeX7bgTprRReVLcd0iXilpuxDyG74u52ZVKFo9DM820dfONKBypkL1mxr4EjN QfhAt+PDbkN3B5/qdxqJq4tQFIXa1ZCnNPdP4ql7ugTK2m8dg8zoWwe2vWPP7JwcTHxd kXyQ== X-Gm-Message-State: AIkVDXL6uwrSmWV+WS4lgIf8rIEEd1Si7BtI3UYKH81PB2rCNcxLa0T6fqnVdgKIYPUO0EDMjfQ= X-Received: by 10.200.39.130 with SMTP id w2mr2454371qtw.280.1485954861627; Wed, 01 Feb 2017 05:14:21 -0800 (PST) Received: from localhost (c-98-221-136-245.hsd1.nj.comcast.net. [98.221.136.245]) by smtp.gmail.com with ESMTPSA id g13sm18569010qtg.8.2017.02.01.05.14.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Feb 2017 05:14:20 -0800 (PST) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Wed, 1 Feb 2017 08:14:09 -0500 Message-Id: <20170201131409.26631-6-mike.holmes@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170201131409.26631-1-mike.holmes@linaro.org> References: <20170201131409.26631-1-mike.holmes@linaro.org> Subject: [lng-odp] [PATCH 5/5] helper: use ABI mode for udp X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Signed-off-by: Mike Holmes --- helper/Makefile.am | 4 +++- helper/include/odp/helper/udp.h | 13 ++++++------ helper/include/odp/helper/udp_inlines.h | 36 +++++++++++++++++++++++++++++++++ helper/udp.c | 14 +++++++++++++ 4 files changed, 59 insertions(+), 8 deletions(-) create mode 100644 helper/include/odp/helper/udp_inlines.h create mode 100644 helper/udp.c -- 2.9.3 diff --git a/helper/Makefile.am b/helper/Makefile.am index 6820532..1bd2cda 100644 --- a/helper/Makefile.am +++ b/helper/Makefile.am @@ -34,6 +34,7 @@ helperinclude_HEADERS = \ $(srcdir)/include/odp/helper/table.h\ $(srcdir)/include/odp/helper/threads.h \ $(srcdir)/include/odp/helper/udp.h \ + $(srcdir)/include/odp/helper/udp_inlines.h \ $(srcdir)/include/odp/helper/udp_types.h if helper_extn @@ -53,7 +54,8 @@ __LIB__libodphelper_@with_platform@_la_SOURCES = \ lineartable.c \ cuckootable.c \ iplookuptable.c \ - threads.c + threads.c \ + udp.c if helper_extn __LIB__libodphelper_@with_platform@_la_SOURCES += \ diff --git a/helper/include/odp/helper/udp.h b/helper/include/odp/helper/udp.h index e1661de..e52dd4f 100644 --- a/helper/include/odp/helper/udp.h +++ b/helper/include/odp/helper/udp.h @@ -25,6 +25,7 @@ extern "C" { */ /** + * @fn odph_ipv4_udp_chksum(odp_packet_t pkt) * UDP checksum * * This function calculates the UDP checksum given an odp packet. @@ -32,14 +33,12 @@ extern "C" { * @param pkt calculate chksum for pkt * @return checksum value in BE endianness */ -static inline uint16_t odph_ipv4_udp_chksum(odp_packet_t pkt) -{ - uint16_t chksum; - int rc; - rc = odph_udp_tcp_chksum(pkt, ODPH_CHKSUM_RETURN, &chksum); - return (rc == 0) ? chksum : 0; -} +#if ODP_HELPER_ABI_COMPAT == 0 +#include +#else +uint16_t odph_ipv4_udp_chksum(odp_packet_t pkt); +#endif /** * @} diff --git a/helper/include/odp/helper/udp_inlines.h b/helper/include/odp/helper/udp_inlines.h new file mode 100644 index 0000000..fa2fc4a --- /dev/null +++ b/helper/include/odp/helper/udp_inlines.h @@ -0,0 +1,36 @@ +/* Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP UDP inline header + */ + +#ifndef ODPH_UDP_INLINES_H_ +#define ODPH_UDP_INLINES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +_HELPER_STATIC uint16_t odph_ipv4_udp_chksum(odp_packet_t pkt) +{ + uint16_t chksum; + int rc; + + rc = odph_udp_tcp_chksum(pkt, ODPH_CHKSUM_RETURN, &chksum); + return (rc == 0) ? chksum : 0; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/helper/udp.c b/helper/udp.c new file mode 100644 index 0000000..0b9a634 --- /dev/null +++ b/helper/udp.c @@ -0,0 +1,14 @@ +/* Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include + +#include +#include + +#if ODP_ABI_COMPAT == 1 +#include +#endif