From patchwork Tue Jul 4 12:54:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Eremin-Solenikov X-Patchwork-Id: 106965 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp969123qge; Tue, 4 Jul 2017 05:54:40 -0700 (PDT) X-Received: by 10.200.54.247 with SMTP id b52mr50876615qtc.145.1499172879838; Tue, 04 Jul 2017 05:54:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499172879; cv=none; d=google.com; s=arc-20160816; b=DpLQLbenKu/1YuFLaxnbNQmUyX6/7jGjymseyPG+xjpBACR5dQVuHKDkrGWZdO1hty Xhz6pK85d13Ph/EXmjsFvPcfYIvcgg6Pk5YJWsrbXUK1oQL+dGFgW5ZS4kRmhHk8tBAO 9PltUzd6SWfShbGHBW2xFQ5Ks0+sWl/4LJfj2vA08Y11hNL8Vm2x/qYFDzDapur6KvXf ATKHu+0OZ8lmDPGjE9FrTVkCbKbbJnyvEvQo9GOkjdfPswX68v4vp+SdhphSPtHHY01G dmVnercY2y7qrU3tj/lNdSyqP0vX/7cNwknkHk+plcxyg/vKptiMI9vZny2hpxLWHhP7 PzPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:delivered-to:arc-authentication-results; bh=YH8D19J4lazh7MGai5BqETOLev8fO7s1icGQBIrDUWA=; b=yt2tamXkUoFutu1Twkc3IZBSEWnS1k1SoVf0AEokYNtnKY1xhBUwWy0UInWAhU2DMl qrbqL4js1xUp+WehFwVJ9YVMht/gTeRoikxoHgTp2/12nFStA2JyUs3tS1FjZxR19p7P fV5harYsKyG1Os+TZEwSawuCjSnS2JlUrmunxZUK7mbYPHJQIA4wWcY5DN+SRjMdopoy YM5ashjfaxhe5VMw2UmZrV1Q6Y76tH7oXL1zmEFvhnfolBUVEs+N5yZ1weWWv02wW9MZ JExmNNWKVC6vIC042j3W7UAFEGd2/huLVdQHpP0qGvIGRxGnaWXoKsYxy2Z7ixuPkLXE SVCg== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 38si3362845qtp.137.2017.07.04.05.54.39; Tue, 04 Jul 2017 05:54:39 -0700 (PDT) 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 849AF60A45; Tue, 4 Jul 2017 12:54:39 +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=-1.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM, 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 6E29E60BE6; Tue, 4 Jul 2017 12:54:12 +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 49E43609EE; Tue, 4 Jul 2017 12:54:09 +0000 (UTC) Received: from mail-lf0-f53.google.com (mail-lf0-f53.google.com [209.85.215.53]) by lists.linaro.org (Postfix) with ESMTPS id 22E7560921 for ; Tue, 4 Jul 2017 12:54:08 +0000 (UTC) Received: by mail-lf0-f53.google.com with SMTP id b207so118359723lfg.2 for ; Tue, 04 Jul 2017 05:54:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=YH8D19J4lazh7MGai5BqETOLev8fO7s1icGQBIrDUWA=; b=OI1umvZDvIBNip5H/oS+om/qGdB8rTYzrHvjg/JTPyqZZb26Zhf7Jpni0jUzsyU+MN coZEFjFlmDbfrCSwKGAcNBKxGmbTKaIov8bC+tfIT+KZOMyiEvj+w7NQK8B7ktzVp6Zy 1ZrdKKNBXtKyzj7rfGiQTCrjuNt1k8U6CTzR54JgkicjtGVX0u6oTKG/cDQmO6sa2VEX kHRjWTMdn9u5KH3d0gzla5DlB/DAGRI5TJe4PZ1g48pvKm2nUoGyK89q32IIpNMP/w8b r7HcMtK0g4ftQU4qebGRDqaeg/3kF5S5FEG+fgfOUzNHqh6n5KdH2o/+04+8LoXwz3FE HuqQ== X-Gm-Message-State: AKS2vOx5l51QrF282vAGWYgfgE1pWA8DlD4YmuQDyikLbd0zMKhtiwXT jgVhpkkJdBdh5V8OF9CxhwXG X-Received: by 10.46.97.26 with SMTP id v26mr7068466ljb.83.1499172846738; Tue, 04 Jul 2017 05:54:06 -0700 (PDT) Received: from forlindon.lumag.auriga.ru ([94.25.229.3]) by smtp.gmail.com with ESMTPSA id l73sm4958732lfi.7.2017.07.04.05.54.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jul 2017 05:54:06 -0700 (PDT) From: Dmitry Eremin-Solenikov To: lng-odp@lists.linaro.org Date: Tue, 4 Jul 2017 15:54:02 +0300 Message-Id: <20170704125403.9212-2-dmitry.ereminsolenikov@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170704125403.9212-1-dmitry.ereminsolenikov@linaro.org> References: <20170704125403.9212-1-dmitry.ereminsolenikov@linaro.org> Subject: [lng-odp] [PATCH API-NEXT v4 1/2] linux-generic: events subtype implementation 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: Dmitry Eremin-Solenikov --- platform/linux-generic/include/odp_buffer_inlines.h | 2 ++ platform/linux-generic/include/odp_buffer_internal.h | 3 +++ platform/linux-generic/odp_crypto.c | 15 +++++++++------ platform/linux-generic/odp_event.c | 15 +++++++++++++++ platform/linux-generic/odp_packet.c | 1 + platform/linux-generic/odp_pool.c | 11 +++++++++++ 6 files changed, 41 insertions(+), 6 deletions(-) -- 2.11.0 diff --git a/platform/linux-generic/include/odp_buffer_inlines.h b/platform/linux-generic/include/odp_buffer_inlines.h index cf817d907ab5..4c0e73390948 100644 --- a/platform/linux-generic/include/odp_buffer_inlines.h +++ b/platform/linux-generic/include/odp_buffer_inlines.h @@ -21,6 +21,8 @@ extern "C" { odp_event_type_t _odp_buffer_event_type(odp_buffer_t buf); void _odp_buffer_event_type_set(odp_buffer_t buf, int ev); +odp_event_subtype_t _odp_buffer_event_subtype(odp_buffer_t buf); +void _odp_buffer_event_subtype_set(odp_buffer_t buf, int ev); int odp_buffer_snprint(char *str, uint32_t n, odp_buffer_t buf); static inline odp_buffer_t odp_hdr_to_buf(odp_buffer_hdr_t *hdr) diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h index 076abe96e072..dadf285e796d 100644 --- a/platform/linux-generic/include/odp_buffer_internal.h +++ b/platform/linux-generic/include/odp_buffer_internal.h @@ -96,6 +96,9 @@ struct odp_buffer_hdr_t { /* Event type. Maybe different than pool type (crypto compl event) */ int8_t event_type; + /* Event subtype. Should be ODP_EVENT_NO_SUBTYPE except packets. */ + int8_t event_subtype; + /* Burst table */ struct odp_buffer_hdr_t *burst[BUFFER_BURST_SIZE]; diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 68fc5658b65b..0e2adad1f346 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -907,12 +907,13 @@ odp_crypto_operation(odp_crypto_op_param_t *param, if (ODP_QUEUE_INVALID != session->p.compl_queue) { odp_event_t completion_event; odp_crypto_generic_op_result_t *op_result; + odp_buffer_t buf; /* Linux generic will always use packet for completion event */ completion_event = odp_packet_to_event(param->out_pkt); - _odp_buffer_event_type_set( - odp_buffer_from_event(completion_event), - ODP_EVENT_CRYPTO_COMPL); + buf = odp_buffer_from_event(completion_event); + _odp_buffer_event_type_set(buf, ODP_EVENT_CRYPTO_COMPL); + _odp_buffer_event_subtype_set(buf, ODP_EVENT_NO_SUBTYPE); /* Asynchronous, build result (no HW so no errors) and send it*/ op_result = get_op_result_from_event(completion_event); op_result->magic = OP_RESULT_MAGIC; @@ -1106,9 +1107,11 @@ odp_crypto_compl_result(odp_crypto_compl_t completion_event, void odp_crypto_compl_free(odp_crypto_compl_t completion_event) { - _odp_buffer_event_type_set( - odp_buffer_from_event((odp_event_t)completion_event), - ODP_EVENT_PACKET); + odp_buffer_t buf = + odp_buffer_from_event((odp_event_t)completion_event); + + _odp_buffer_event_type_set(buf, ODP_EVENT_PACKET); + _odp_buffer_event_subtype_set(buf, ODP_EVENT_PACKET_BASIC); } void odp_crypto_session_param_init(odp_crypto_session_param_t *param) diff --git a/platform/linux-generic/odp_event.c b/platform/linux-generic/odp_event.c index d71f4464af48..23b410d8a60e 100644 --- a/platform/linux-generic/odp_event.c +++ b/platform/linux-generic/odp_event.c @@ -19,6 +19,21 @@ odp_event_type_t odp_event_type(odp_event_t event) return _odp_buffer_event_type(odp_buffer_from_event(event)); } +odp_event_subtype_t odp_event_subtype(odp_event_t event) +{ + return _odp_buffer_event_subtype(odp_buffer_from_event(event)); +} + +odp_event_type_t odp_event_types(odp_event_t event, + odp_event_subtype_t *subtype) +{ + odp_buffer_t buf = odp_buffer_from_event(event); + + *subtype = _odp_buffer_event_subtype(buf); + + return _odp_buffer_event_type(buf); +} + void odp_event_free(odp_event_t event) { switch (odp_event_type(event)) { diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index eb66af2d3b9c..3789feca45f9 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -268,6 +268,7 @@ static inline void packet_init(odp_packet_hdr_t *pkt_hdr, uint32_t len) CONFIG_PACKET_TAILROOM; pkt_hdr->input = ODP_PKTIO_INVALID; + pkt_hdr->buf_hdr.event_subtype = ODP_EVENT_PACKET_BASIC; } static inline void init_segments(odp_packet_hdr_t *pkt_hdr[], int num) diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index 9dba734130b4..23b80698d3b0 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -259,6 +259,7 @@ static void init_buffers(pool_t *pool) buf_hdr->size = seg_size; buf_hdr->type = type; buf_hdr->event_type = type; + buf_hdr->event_subtype = ODP_EVENT_NO_SUBTYPE; buf_hdr->pool_hdl = pool->pool_hdl; buf_hdr->uarea_addr = uarea; /* Show user requested size through API */ @@ -566,6 +567,16 @@ void _odp_buffer_event_type_set(odp_buffer_t buf, int ev) buf_hdl_to_hdr(buf)->event_type = ev; } +odp_event_subtype_t _odp_buffer_event_subtype(odp_buffer_t buf) +{ + return buf_hdl_to_hdr(buf)->event_subtype; +} + +void _odp_buffer_event_subtype_set(odp_buffer_t buf, int ev) +{ + buf_hdl_to_hdr(buf)->event_subtype = ev; +} + odp_pool_t odp_pool_lookup(const char *name) { uint32_t i;