From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E19B2A04DD; Wed, 28 Oct 2020 13:23:04 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8EC99CAC8; Wed, 28 Oct 2020 13:20:57 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by dpdk.org (Postfix) with ESMTP id 3CE9BCA14 for ; Wed, 28 Oct 2020 13:20:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603887646; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yh98GBARPgjY8MDlwC8z8S2X8IhZYnPNVv4r4LrchCs=; b=ZzM+azY7E9n+e/3+1G8LlUipcIH5wkJHTfz91EIWWnJuvrRiU4yGMlPtHLFuD5bPhBYvqH eB4yY1FJNMVkARC87yECR+U1GsKNTj0T4kmf0mx6+5+Tk38tbg5IVWdYo+NQsbo8/Eq0PC IjfSMgSz0IKL4TVPDlB+m/DL7G+EP8k= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-372-PU8Cp5JlO2WwrmpbKyQAew-1; Wed, 28 Oct 2020 08:20:44 -0400 X-MC-Unique: PU8Cp5JlO2WwrmpbKyQAew-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 929DA6414A; Wed, 28 Oct 2020 12:20:43 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.192.40]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE07D1001901; Wed, 28 Oct 2020 12:20:42 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Jerin Jacob Date: Wed, 28 Oct 2020 13:20:12 +0100 Message-Id: <20201028122013.31104-9-david.marchand@redhat.com> In-Reply-To: <20201028122013.31104-1-david.marchand@redhat.com> References: <20201027221343.28551-1-david.marchand@redhat.com> <20201028122013.31104-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [dpdk-dev] [PATCH v2 8/9] app/eventdev: switch sequence number to dynamic mbuf field X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The order test stored a sequence number in the deprecated mbuf field seqn. It is moved to a dynamic field in order to allow removal of seqn. Signed-off-by: David Marchand --- app/test-eventdev/test_order_common.c | 14 +++++++++++++- app/test-eventdev/test_order_common.h | 13 +++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/app/test-eventdev/test_order_common.c b/app/test-eventdev/test_order_common.c index 01a44bcd75..04456d56db 100644 --- a/app/test-eventdev/test_order_common.c +++ b/app/test-eventdev/test_order_common.c @@ -48,7 +48,7 @@ order_producer(void *arg) const flow_id_t flow = (uintptr_t)m % nb_flows; /* Maintain seq number per flow */ - m->seqn = producer_flow_seq[flow]++; + *order_mbuf_seqn(t, m) = producer_flow_seq[flow]++; order_flow_id_save(t, flow, m, &ev); while (rte_event_enqueue_burst(dev_id, port, &ev, 1) != 1) { @@ -141,6 +141,11 @@ order_test_setup(struct evt_test *test, struct evt_options *opt) .size = sizeof(flow_id_t), .align = __alignof__(flow_id_t), }; + static const struct rte_mbuf_dynfield seqn_dynfield_desc = { + .name = "test_event_dynfield_seqn", + .size = sizeof(seqn_t), + .align = __alignof__(seqn_t), + }; test_order = rte_zmalloc_socket(test->name, sizeof(struct test_order), RTE_CACHE_LINE_SIZE, opt->socket_id); @@ -158,6 +163,13 @@ order_test_setup(struct evt_test *test, struct evt_options *opt) return -rte_errno; } + t->seqn_dynfield_offset = + rte_mbuf_dynfield_register(&seqn_dynfield_desc); + if (t->seqn_dynfield_offset < 0) { + evt_err("failed to register mbuf field"); + return -rte_errno; + } + t->producer_flow_seq = rte_zmalloc_socket("test_producer_flow_seq", sizeof(*t->producer_flow_seq) * opt->nb_flows, RTE_CACHE_LINE_SIZE, opt->socket_id); diff --git a/app/test-eventdev/test_order_common.h b/app/test-eventdev/test_order_common.h index 90eac96fc8..5ef8404938 100644 --- a/app/test-eventdev/test_order_common.h +++ b/app/test-eventdev/test_order_common.h @@ -22,6 +22,7 @@ #define BURST_SIZE 16 typedef uint32_t flow_id_t; +typedef uint32_t seqn_t; struct test_order; @@ -53,6 +54,7 @@ struct test_order { uint64_t nb_pkts; struct rte_mempool *pool; int flow_id_dynfield_offset; + int seqn_dynfield_offset; struct prod_data prod; struct worker_data worker[EVT_MAX_PORTS]; uint32_t *producer_flow_seq; @@ -77,6 +79,12 @@ order_flow_id_save(struct test_order *t, flow_id_t flow_id, event->mbuf = mbuf; } +static inline seqn_t * +order_mbuf_seqn(struct test_order *t, struct rte_mbuf *mbuf) +{ + return RTE_MBUF_DYNFIELD(mbuf, t->seqn_dynfield_offset, seqn_t *); +} + static inline int order_nb_event_ports(struct evt_options *opt) { @@ -91,9 +99,10 @@ order_process_stage_1(struct test_order *const t, { const uint32_t flow = (uintptr_t)ev->mbuf % nb_flows; /* compare the seqn against expected value */ - if (ev->mbuf->seqn != expected_flow_seq[flow]) { + if (*order_mbuf_seqn(t, ev->mbuf) != expected_flow_seq[flow]) { evt_err("flow=%x seqn mismatch got=%x expected=%x", - flow, ev->mbuf->seqn, expected_flow_seq[flow]); + flow, *order_mbuf_seqn(t, ev->mbuf), + expected_flow_seq[flow]); t->err = true; rte_smp_wmb(); } -- 2.23.0