From patchwork Wed Jan 21 15:15:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 43452 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 644B8218DB for ; Wed, 21 Jan 2015 15:17:57 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id k14sf21655460wgh.2 for ; Wed, 21 Jan 2015 07:17:56 -0800 (PST) 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:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=7qw/Md9IruIgLxcD370oIqdJFNLEGmA/1gRpEqGc/1c=; b=mtwJMJog9a5IFicIplAntK6NTQiAwFxMuFMsgIgtdLicAZOCvYpQ9eKDCmr63vMOZU PI9NDQGOSvO4806ULst02S3ImI/fajtDA+ClG50a/Mc/6cxAlcDBDaQPROUvvLJLUq/E HjNVEaLXPqixAEzH6aMmEM47eaMcPq8sE+wyOnuhxBo7mkWyEedvSz1nzMIvjy97tHgZ AclderTimFFrfroUN8tTRiG7ZBWi+B1XCuaub2e/LiF2YHdEYMfadcl06WMucgV2zsef goEmFJhaQBwKSCdhl9sRpxmGy3Ll7NF2BKfH0Fo9KevY3kLy1DSQXtNHri8KIM6RZURD 5K9w== X-Gm-Message-State: ALoCoQlMQk3QT4RkiRzBHvXEAXrloe8PT6hOqaO2+25zeJCPIjempXbnecM7AT3sS7Fb/s7QcZp8 X-Received: by 10.180.88.66 with SMTP id be2mr1967403wib.1.1421853476698; Wed, 21 Jan 2015 07:17:56 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.225 with SMTP id i1ls54952lae.19.gmail; Wed, 21 Jan 2015 07:17:56 -0800 (PST) X-Received: by 10.152.198.200 with SMTP id je8mr2469779lac.93.1421853476509; Wed, 21 Jan 2015 07:17:56 -0800 (PST) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id gy9si18178407lac.53.2015.01.21.07.17.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Jan 2015 07:17:56 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by mail-lb0-f170.google.com with SMTP id w7so1051081lbi.1 for ; Wed, 21 Jan 2015 07:17:56 -0800 (PST) X-Received: by 10.152.3.70 with SMTP id a6mr27348358laa.71.1421853476379; Wed, 21 Jan 2015 07:17:56 -0800 (PST) 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.9.200 with SMTP id c8csp1810324lbb; Wed, 21 Jan 2015 07:17:55 -0800 (PST) X-Received: by 10.236.206.13 with SMTP id k13mr24342540yho.51.1421853468487; Wed, 21 Jan 2015 07:17:48 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id v10si511753qgv.67.2015.01.21.07.17.42 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 21 Jan 2015 07:17:48 -0800 (PST) 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 1YDx2K-000829-8s; Wed, 21 Jan 2015 15:17:40 +0000 Received: from mail-qc0-f176.google.com ([209.85.216.176]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YDx20-0007wG-69 for lng-odp@lists.linaro.org; Wed, 21 Jan 2015 15:17:20 +0000 Received: by mail-qc0-f176.google.com with SMTP id c9so14994838qcz.7 for ; Wed, 21 Jan 2015 07:17:15 -0800 (PST) X-Received: by 10.140.32.166 with SMTP id h35mr38234986qgh.22.1421853434913; Wed, 21 Jan 2015 07:17:14 -0800 (PST) Received: from mcpro03.emea.nsn-net.net (ec2-23-23-178-99.compute-1.amazonaws.com. [23.23.178.99]) by mx.google.com with ESMTPSA id 91sm415056qgf.1.2015.01.21.07.17.12 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Jan 2015 07:17:14 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Wed, 21 Jan 2015 17:15:34 +0200 Message-Id: <1421853343-22138-8-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.2.2 In-Reply-To: <1421853343-22138-1-git-send-email-petri.savolainen@linaro.org> References: <1421853343-22138-1-git-send-email-petri.savolainen@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v3 07/16] api: packet: Removed odp_packet_to_buffer 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.217.170 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 Removed packet to buffer conversion. packet -> event -> buffer conversions are temporary. Signed-off-by: Petri Savolainen --- example/generator/odp_generator.c | 2 +- example/ipsec/odp_ipsec.c | 8 ++++---- platform/linux-generic/include/api/odp_packet.h | 9 --------- platform/linux-generic/include/odp_packet_internal.h | 9 +++++++++ platform/linux-generic/odp_crypto.c | 4 ++-- platform/linux-generic/odp_packet.c | 2 +- platform/linux-generic/odp_packet_io.c | 6 +++--- test/validation/buffer/odp_packet_test.c | 2 +- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 547366a..5df8868 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -448,7 +448,7 @@ static void print_pkts(int thr, odp_packet_t pkt_tbl[], unsigned len) odp_atomic_inc_u64(&counters.ip); rlen += sprintf(msg, "receive Packet proto:IP "); - buf = odp_buffer_addr(odp_packet_to_buffer(pkt)); + buf = odp_packet_data(pkt); ip = (odph_ipv4hdr_t *)(buf + odp_packet_l3_offset(pkt)); rlen += sprintf(msg + rlen, "id %d ", odp_be_to_cpu_16(ip->id)); diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index a59794a..9fdaeab 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -740,7 +740,7 @@ pkt_disposition_e do_ipsec_in_classify(odp_packet_t pkt, *skip = FALSE; if (odp_crypto_operation(¶ms, &posted, - odp_packet_to_buffer(pkt))) { + odp_buffer_from_event(odp_packet_to_event(pkt)))) { abort(); } return (posted) ? PKT_POSTED : PKT_CONTINUE; @@ -766,7 +766,7 @@ pkt_disposition_e do_ipsec_in_finish(odp_packet_t pkt, int trl_len = 0; /* Check crypto result */ - event = odp_packet_to_buffer(pkt); + event = odp_buffer_from_event(odp_packet_to_event(pkt)); odp_crypto_get_operation_compl_status(event, &auth_rc, &cipher_rc); if (!is_crypto_compl_status_ok(&cipher_rc)) return PKT_DROP; @@ -974,7 +974,7 @@ pkt_disposition_e do_ipsec_out_seq(odp_packet_t pkt, /* Issue crypto request */ if (odp_crypto_operation(&ctx->ipsec.params, &posted, - odp_packet_to_buffer(pkt))) { + odp_buffer_from_event(odp_packet_to_event(pkt)))) { abort(); } return (posted) ? PKT_POSTED : PKT_CONTINUE; @@ -998,7 +998,7 @@ pkt_disposition_e do_ipsec_out_finish(odp_packet_t pkt, odph_ipv4hdr_t *ip; /* Check crypto result */ - event = odp_packet_to_buffer(pkt); + event = odp_buffer_from_event(odp_packet_to_event(pkt)); odp_crypto_get_operation_compl_status(event, &auth_rc, &cipher_rc); if (!is_crypto_compl_status_ok(&cipher_rc)) return PKT_DROP; diff --git a/platform/linux-generic/include/api/odp_packet.h b/platform/linux-generic/include/api/odp_packet.h index 5ab96c6..c67fd62 100644 --- a/platform/linux-generic/include/api/odp_packet.h +++ b/platform/linux-generic/include/api/odp_packet.h @@ -105,15 +105,6 @@ int odp_packet_reset(odp_packet_t pkt, uint32_t len); odp_packet_t odp_packet_from_buffer(odp_buffer_t buf); /** - * Convert a packet handle to a buffer handle - * - * @param pkt Packet handle - * - * @return Buffer handle - */ -odp_buffer_t odp_packet_to_buffer(odp_packet_t pkt); - -/** * Get packet handle from event * * Converts an ODP_EVENT_PACKET type event to a packet. diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 179330c..fe4a223 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -257,6 +257,15 @@ odp_packet_t _odp_packet_alloc(odp_buffer_pool_t pool_hdl); int _odp_packet_parse(odp_packet_t pkt); +/* + * Convert a packet handle to a buffer handle + * + * @param pkt Packet handle + * + * @return Buffer handle + */ +odp_buffer_t _odp_packet_to_buffer(odp_packet_t pkt); + #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index bee6fe5..74fac5c 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -364,9 +364,9 @@ odp_crypto_operation(odp_crypto_op_params_t *params, ODP_ABORT(); _odp_packet_copy_to_packet(params->pkt, 0, params->out_pkt, 0, odp_packet_len(params->pkt)); - if (completion_event == odp_packet_to_buffer(params->pkt)) + if (completion_event == _odp_packet_to_buffer(params->pkt)) completion_event = - odp_packet_to_buffer(params->out_pkt); + _odp_packet_to_buffer(params->out_pkt); odp_packet_free(params->pkt); params->pkt = ODP_PACKET_INVALID; } diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index ebe3b55..bcbac79 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -70,7 +70,7 @@ odp_packet_t odp_packet_from_buffer(odp_buffer_t buf) return (odp_packet_t)buf; } -odp_buffer_t odp_packet_to_buffer(odp_packet_t pkt) +odp_buffer_t _odp_packet_to_buffer(odp_packet_t pkt) { return (odp_buffer_t)pkt; } diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index c03f47c..fd71bfa 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -407,7 +407,7 @@ static int enq_loopback(pktio_entry_t *pktio_entry, odp_packet_t pkt_tbl[], unsigned i; for (i = 0; i < len; ++i) - hdr_tbl[i] = odp_buf_to_hdr(odp_packet_to_buffer(pkt_tbl[i])); + hdr_tbl[i] = odp_buf_to_hdr(_odp_packet_to_buffer(pkt_tbl[i])); qentry = queue_to_qentry(pktio_entry->s.loopq); return queue_enq_multi(qentry, hdr_tbl, len) == 0 ? len : 0; @@ -561,7 +561,7 @@ odp_buffer_hdr_t *pktin_dequeue(queue_entry_t *qentry) return NULL; for (i = 0, j = 0; i < pkts; ++i) { - buf = odp_packet_to_buffer(pkt_tbl[i]); + buf = _odp_packet_to_buffer(pkt_tbl[i]); buf_hdr = odp_buf_to_hdr(buf); if (0 > packet_classifier(qentry->s.pktin, pkt_tbl[i])) tmp_hdr_tbl[j++] = buf_hdr; @@ -607,7 +607,7 @@ int pktin_deq_multi(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr[], int num) return nbr; for (i = 0, j = 0; i < pkts; ++i) { - buf = odp_packet_to_buffer(pkt_tbl[i]); + buf = _odp_packet_to_buffer(pkt_tbl[i]); tmp_hdr = odp_buf_to_hdr(buf); if (0 > packet_classifier(qentry->s.pktin, pkt_tbl[i])) tmp_hdr_tbl[j++] = tmp_hdr; diff --git a/test/validation/buffer/odp_packet_test.c b/test/validation/buffer/odp_packet_test.c index 63caec6..6e44443 100644 --- a/test/validation/buffer/odp_packet_test.c +++ b/test/validation/buffer/odp_packet_test.c @@ -374,7 +374,7 @@ static void packet_segments(void) } CU_ASSERT(seg_index == num_segs); - CU_ASSERT(buf_len == odp_buffer_size(odp_packet_to_buffer(pkt))); + CU_ASSERT(buf_len == odp_packet_buf_len(pkt)); CU_ASSERT(data_len == odp_packet_len(pkt)); if (seg_index == num_segs)