From patchwork Wed Jan 20 16:37:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zoltan Kiss X-Patchwork-Id: 60046 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp3277973lbb; Wed, 20 Jan 2016 08:37:37 -0800 (PST) X-Received: by 10.140.92.35 with SMTP id a32mr46263855qge.92.1453307857093; Wed, 20 Jan 2016 08:37:37 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id h13si44520157qge.46.2016.01.20.08.37.36; Wed, 20 Jan 2016 08:37:37 -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; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 760A3617A5; Wed, 20 Jan 2016 16:37:36 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=fXFrTmCO; dkim-adsp=none (unprotected policy); dkim-atps=neutral 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.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID, 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 2D09961712; Wed, 20 Jan 2016 16:37:31 +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 AFDD261795; Wed, 20 Jan 2016 16:37:27 +0000 (UTC) Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) by lists.linaro.org (Postfix) with ESMTPS id B9C6561745 for ; Wed, 20 Jan 2016 16:37:26 +0000 (UTC) Received: by mail-wm0-f54.google.com with SMTP id n5so38630698wmn.0 for ; Wed, 20 Jan 2016 08:37:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QOexv+ig9y4WPOwYzqs38qHA2jBPjN6eGylXz6zozqk=; b=fXFrTmCOH8zEcUcAs+LJYTGAh+GKS2KBvN1zw241eydb+DmJ9I6+OtV9TbQGL/tOrI oAJtEFWXJFXnJigHs6YITVLrm1K3xKFmLFy7qQn5CiwArUdYhfBKCFFVBJMAemDIARyi f5ym2U4r0FzhQoDtDoRsPXz0Gr/exPjE6/Fl8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QOexv+ig9y4WPOwYzqs38qHA2jBPjN6eGylXz6zozqk=; b=g/ovvPGgowjoGGN6eUPuFcSl5c/Epm9ZgnvRqvo+cuOty3x0WlKKfaZ/OIVjKaWtlz UtcC354b5QqEyjBnnDhII457p3gwm+LnYHhqCLiqwnY6q04o1DJlRLJ2hk3635wTDFbn EBsolY8DjldMVKj+I9BZO2GBhKIMtDwnzXcqVlPrv1Uh+zVn6N/MTXBPn/OIsJ/p4wfO 9gwpnkSvFktggS1MHHwSoBbtokWcdS63xV79UNueIPRcZKveq4mqEuj1smNzVR+1DShN 9rywgJa3D9Uw89620g67kii3yib2NkgayM4YbD462Q0hB67UjaAa9pOy4kKeh3Bv3w1s D8WQ== X-Gm-Message-State: AG10YOSJzX+YLFEUFciymscrBgwHbkTKdHpjGVsgACrBbp5LcD1mhRRZPodqsN1kyJArSWrZxuQ= X-Received: by 10.28.55.209 with SMTP id e200mr5308831wma.2.1453307845438; Wed, 20 Jan 2016 08:37:25 -0800 (PST) Received: from localhost.localdomain ([195.11.233.227]) by smtp.googlemail.com with ESMTPSA id l7sm34131552wjx.14.2016.01.20.08.37.24 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 20 Jan 2016 08:37:24 -0800 (PST) From: Zoltan Kiss To: lng-odp@lists.linaro.org Date: Wed, 20 Jan 2016 16:37:10 +0000 Message-Id: <1453307831-15459-2-git-send-email-zoltan.kiss@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1453307831-15459-1-git-send-email-zoltan.kiss@linaro.org> References: <1453307831-15459-1-git-send-email-zoltan.kiss@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 1/2] linux-generic: packet: hide frame_len behind accessor 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: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" The classification code accesses this variable directly, which prevents reusing that code e.g. in ODP-DPDK. Signed-off-by: Zoltan Kiss --- platform/linux-generic/include/odp_classification_inlines.h | 5 +++-- platform/linux-generic/include/odp_packet_internal.h | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/platform/linux-generic/include/odp_classification_inlines.h b/platform/linux-generic/include/odp_classification_inlines.h index e9739aa..e4d87c9 100644 --- a/platform/linux-generic/include/odp_classification_inlines.h +++ b/platform/linux-generic/include/odp_classification_inlines.h @@ -24,6 +24,7 @@ extern "C" { #include #include #include +#include /* PMR term value verification function These functions verify the given PMR term value with the value in the packet @@ -33,7 +34,7 @@ These following functions return 1 on success and 0 on failure static inline int verify_pmr_packet_len(odp_packet_hdr_t *pkt_hdr, pmr_term_value_t *term_value) { - if (term_value->val == (pkt_hdr->frame_len & + if (term_value->val == (packet_hdr_len(pkt_hdr) & term_value->mask)) return 1; @@ -240,7 +241,7 @@ static inline int verify_pmr_custom_frame(const uint8_t *pkt_addr, ODP_ASSERT(val_sz <= ODP_PMR_TERM_BYTES_MAX); - if (pkt_hdr->frame_len <= offset + val_sz) + if (packet_hdr_len(pkt_hdr) <= offset + val_sz) return 0; memcpy(&val, pkt_addr + offset, val_sz); diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 12e9cca..0b2e9d0 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -214,6 +214,11 @@ static inline void pull_tail(odp_packet_hdr_t *pkt_hdr, size_t len) pkt_hdr->frame_len -= len; } +static inline uint32_t packet_hdr_len(odp_packet_hdr_t* pkt_hdr) +{ + return pkt_hdr->frame_len; +} + static inline void packet_set_len(odp_packet_t pkt, uint32_t len) { odp_packet_hdr(pkt)->frame_len = len;