From patchwork Fri Oct 3 10:17:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 38312 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 966602057C for ; Fri, 3 Oct 2014 10:19:00 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id b57sf628386eek.0 for ; Fri, 03 Oct 2014 03:18:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=oI2yR/yAmJOKzYlDV22gya4bqMtIO4s+encSZZ1DVkM=; b=U9TMVwz3/zDHClLouXAAZJ5lV51SL7ExDGRcA1dYNKKAMTv6JowZ39IKUAd8z40ob5 0521b/3n3QDTEtl8AtSlRRB5Kt8b9sQFdmKiuz4yj//KyjsMZaWV/goWxskh2yj9irga XhSiNM+bVV/cWS2I6AJLswxehF5EIzWbhb/uG+IbAetKcUkR8dOxoD3fzsc2rcMv1GHO C9u/YcZE9nBw2RMM1sMN1GdnZgLEOHFScBo9s3nZoJwLunqsxax9BrGB9dEZjPjOw3kr MF4XVkJdLnf21olwFNwHpPuHjH8v7QprofTI34JPnsstR3Lr6UIONgbURsjWi2j56jL4 Ppaw== X-Gm-Message-State: ALoCoQl4rj58Uj6cPe3g6tvNwYofVFXOmiNGwNA6gzMrhzo8Lwm7oacPZKTCojOxYGtZUq/tSYgf X-Received: by 10.180.109.67 with SMTP id hq3mr305210wib.1.1412331539697; Fri, 03 Oct 2014 03:18:59 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.134 with SMTP id b6ls331447laa.77.gmail; Fri, 03 Oct 2014 03:18:59 -0700 (PDT) X-Received: by 10.152.26.133 with SMTP id l5mr5036802lag.4.1412331539535; Fri, 03 Oct 2014 03:18:59 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com [209.85.215.42]) by mx.google.com with ESMTPS id ei3si5918332lad.84.2014.10.03.03.18.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 03 Oct 2014 03:18:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id mk6so763990lab.29 for ; Fri, 03 Oct 2014 03:18:59 -0700 (PDT) X-Received: by 10.112.134.229 with SMTP id pn5mr4667860lbb.22.1412331539400; Fri, 03 Oct 2014 03:18:59 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp201327lbb; Fri, 3 Oct 2014 03:18:58 -0700 (PDT) X-Received: by 10.140.83.74 with SMTP id i68mr4159241qgd.18.1412331538246; Fri, 03 Oct 2014 03:18:58 -0700 (PDT) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id 15si11478147qga.45.2014.10.03.03.18.57 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 03 Oct 2014 03:18:58 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XZzwu-0007Ix-Tf; Fri, 03 Oct 2014 10:18:56 +0000 Received: from mail-qg0-f43.google.com ([209.85.192.43]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XZzwl-0007Ig-Th for lng-odp@lists.linaro.org; Fri, 03 Oct 2014 10:18:47 +0000 Received: by mail-qg0-f43.google.com with SMTP id j107so708633qga.16 for ; Fri, 03 Oct 2014 03:18:42 -0700 (PDT) X-Received: by 10.140.101.9 with SMTP id t9mr3905444qge.67.1412331522735; Fri, 03 Oct 2014 03:18:42 -0700 (PDT) Received: from localhost.localdomain (ec2-23-23-178-99.compute-1.amazonaws.com. [23.23.178.99]) by mx.google.com with ESMTPSA id s49sm5370573qge.15.2014.10.03.03.18.40 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 03 Oct 2014 03:18:41 -0700 (PDT) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Fri, 3 Oct 2014 13:17:58 +0300 Message-Id: <1412331478-30433-2-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1412331478-30433-1-git-send-email-petri.savolainen@linaro.org> References: <1412331478-30433-1-git-send-email-petri.savolainen@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 2/2] Rename packet start function X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: petri.savolainen@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 - Unify function naming between packets and segments: xxx_addr(), xxx_data() - Rename odp_packet_start() to odp_packet_data() Signed-off-by: Petri Savolainen --- example/ipsec/odp_ipsec_stream.c | 4 ++-- platform/linux-generic/include/api/odp_packet.h | 32 +++++++++++-------------- platform/linux-generic/odp_packet.c | 8 +++---- 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/example/ipsec/odp_ipsec_stream.c b/example/ipsec/odp_ipsec_stream.c index de8305a..fba425c 100644 --- a/example/ipsec/odp_ipsec_stream.c +++ b/example/ipsec/odp_ipsec_stream.c @@ -193,8 +193,8 @@ odp_packet_t create_ipv4_packet(stream_db_entry_t *stream, return ODP_PACKET_INVALID; pkt = odp_packet_from_buffer(bfr); odp_packet_init(pkt); - base = odp_packet_start(pkt); - data = odp_packet_start(pkt); + base = odp_packet_data(pkt); + data = odp_packet_data(pkt); /* Ethernet */ odp_packet_set_inflag_eth(pkt, 1); diff --git a/platform/linux-generic/include/api/odp_packet.h b/platform/linux-generic/include/api/odp_packet.h index 83f345a..316279b 100644 --- a/platform/linux-generic/include/api/odp_packet.h +++ b/platform/linux-generic/include/api/odp_packet.h @@ -116,41 +116,37 @@ void odp_packet_set_ctx(odp_packet_t buf, const void *ctx); void *odp_packet_get_ctx(odp_packet_t buf); /** - * Get address to the start of the packet buffer + * Packet buffer start address + * + * Returns a pointer to the start of the packet buffer. The address is not + * necessarily the same as packet data address. E.g. on a received Ethernet + * frame, the protocol header may start 2 or 6 bytes within the buffer to + * ensure 32 or 64-bit alignment of the IP header. * - * The address of the packet buffer is not necessarily the same as the start - * address of the received frame, e.g. an eth frame may be offset by 2 or 6 - * bytes to ensure 32 or 64-bit alignment of the IP header. * Use odp_packet_l2(pkt) to get the start address of a received valid frame - * or odp_packet_start(pkt) to get the start address even if no valid L2 header - * could be found. + * or odp_packet_data(pkt) to get the current packet data address. * * @param pkt Packet handle * * @return Pointer to the start of the packet buffer * - * @see odp_packet_l2(), odp_packet_start() + * @see odp_packet_l2(), odp_packet_data() */ uint8_t *odp_packet_addr(odp_packet_t pkt); /** - * Get pointer to the start of the received frame - * - * The address of the packet buffer is not necessarily the same as the start - * address of the received frame, e.g. an eth frame may be offset by 2 or 6 - * bytes to ensure 32 or 64-bit alignment of the IP header. - * Use odp_packet_l2(pkt) to get the start address of a received valid eth frame + * Packet data address * - * odp_packet_start() will always return a pointer to the start of the frame, - * even if the frame is unrecognized and no valid L2 header could be found. + * Returns the current packet data address. When a packet is received from + * packet input, the data address points to the first byte of the packet. * * @param pkt Packet handle * - * @return Pointer to the start of the received frame + * @return Pointer to the packet data * * @see odp_packet_l2(), odp_packet_addr() */ -uint8_t *odp_packet_start(odp_packet_t pkt); +uint8_t *odp_packet_data(odp_packet_t pkt); /** * Get pointer to the start of the L2 frame @@ -162,7 +158,7 @@ uint8_t *odp_packet_start(odp_packet_t pkt); * * @return Pointer to L2 header or NULL if not found * - * @see odp_packet_addr(), odp_packet_start() + * @see odp_packet_addr(), odp_packet_data() */ uint8_t *odp_packet_l2(odp_packet_t pkt); diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 6cd6183..435bc8b 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -61,7 +61,7 @@ uint8_t *odp_packet_addr(odp_packet_t pkt) return odp_buffer_addr(odp_buffer_from_packet(pkt)); } -uint8_t *odp_packet_start(odp_packet_t pkt) +uint8_t *odp_packet_data(odp_packet_t pkt) { return odp_packet_addr(pkt) + odp_packet_hdr(pkt)->frame_offset; } @@ -183,7 +183,7 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) pkt_hdr->input_flags.l2 = 1; pkt_hdr->l2_offset = frame_offset; - eth = (odph_ethhdr_t *)odp_packet_start(pkt); + eth = (odph_ethhdr_t *)odp_packet_data(pkt); ethtype = odp_be_to_cpu_16(eth->type); vlan = (odph_vlanhdr_t *)ð->type; @@ -372,8 +372,8 @@ int odp_packet_copy(odp_packet_t pkt_dst, odp_packet_t pkt_src) memcpy(start_dst, start_src, len); /* Copy frame payload */ - start_dst = (uint8_t *)odp_packet_start(pkt_dst); - start_src = (uint8_t *)odp_packet_start(pkt_src); + start_dst = (uint8_t *)odp_packet_data(pkt_dst); + start_src = (uint8_t *)odp_packet_data(pkt_src); len = pkt_hdr_src->frame_len; memcpy(start_dst, start_src, len);