From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9546AA00C5; Fri, 11 Feb 2022 12:40:01 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D428B42764; Fri, 11 Feb 2022 12:39:53 +0100 (CET) Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by mails.dpdk.org (Postfix) with ESMTP id 382C342760 for ; Fri, 11 Feb 2022 12:39:51 +0100 (CET) Received: by mail-pj1-f48.google.com with SMTP id t4-20020a17090a510400b001b8c4a6cd5dso8568462pjh.5 for ; Fri, 11 Feb 2022 03:39:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atomicrules-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jQLOl3cry2X3jdXezJAgGRHM1EHtLWA4ilf8Yxoqvts=; b=C0W+BMWbiI5olcO487afq13EDZMBNVumatTVdfyrnSV+Q4JKx8aShYsX2c3yUKQZ8Z ngSzZ1eRZfkSC+P9D1I8ktPru1DzL6r8J51dOMWKeM1n591JECoyd5PKR48BshQnOZfm GhTTzzQRmFhF9UTU2qf12KT2+qFYh98b4GI8iv3Bbnl0JPY+MuZarxYcQMUyGDFh3PDY qXV2eX92KCPadEjetGNqzTnBL8rAXbitC9nw/5Eqhs8TPqwQzRVAqR8UaFTF9vk5fNoL aELPco6YXtXyrOFgaKqrjLC3PX9QXyvYl+bFpqhttjccnznPPBmBQTm2g7DPE8S9+/+J ZeWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jQLOl3cry2X3jdXezJAgGRHM1EHtLWA4ilf8Yxoqvts=; b=W6Ec75Sya3yEwO68L6DOfTR9mRa0GVtuVRexl3aW3ZlMZL2npNohbC9m4sz8anexii qIFj5J4OY84ltY6JJI7HJhsRyM3oUXNDXP2WXCI9CI1qdXT3Hsy7IZJv3+C7HTLYqSqX pgtD041gNjblaqGI3nNVX3OxClZv1Y/cBkmkukC2WxLmOmVIaN62aHfMsjJOS7J7/b9z JqHUy9ciViHQcJadRxXmq6NL1pl2o71Pi9pjtpTTxaQJskkUG0hcrx5r9vstEzsYjJ/R JkudqYh1wbvOLSHKd7doTMlG14lkgpIa+j3d0eHMmF+ejVbWJ4WQP81mZ8BU0EWTlyv0 zUGQ== X-Gm-Message-State: AOAM532EpLDHWmA4MdI5arS1K8OD4C4kDP2AqB20Enp5PafdDirwJiaz qpunPO1yvZNlGnOl1ezYd36c/MMi7xkWKg== X-Google-Smtp-Source: ABdhPJyYuXCPJwB5rPFs/ZWVzChSNjw9N4D9ILxzogSK9nNGUMLHST3tabls/3tsWaX/vlkZ/7/75w== X-Received: by 2002:a17:902:da81:: with SMTP id j1mr1092063plx.3.1644579590318; Fri, 11 Feb 2022 03:39:50 -0800 (PST) Received: from john-All-Series.tds (h75-100-85-216.cntcnh.broadband.dynamic.tds.net. [75.100.85.216]) by smtp.gmail.com with ESMTPSA id s14sm27750838pfk.174.2022.02.11.03.39.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Feb 2022 03:39:50 -0800 (PST) From: John Miller To: dev@dpdk.org, ferruh.yigit@intel.com Cc: shepard.siegel@atomicrules.com, John Miller Subject: [PATCH v2 3/3] net/ark: support chunk DMA transfers Date: Fri, 11 Feb 2022 05:39:35 -0600 Message-Id: <20220211113935.303366-3-john.miller@atomicrules.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220211113935.303366-1-john.miller@atomicrules.com> References: <20220119191255.273988-ed.czeck@atomicrules.com> <20220211113935.303366-1-john.miller@atomicrules.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add support for chunk DMA transfers. Various performance optimizations and behavior fixes. Chunk mpu transfer use 64 objects (512 byte) to maintain memory read alignment. Align mpu memory allocation to be at 512 byte boundaries. Reduce force-close allocation from 10000 objects to 64 objects. Add memory write barriers for read and wait status functions in ddm, udm and mpu. Configuration status updates for internal packet checker and generator. Signed-off-by: John Miller --- v2: - Added more details to the git log. --- drivers/net/ark/ark_ddm.c | 1 + drivers/net/ark/ark_ethdev_rx.c | 16 +++++++++------- drivers/net/ark/ark_mpu.c | 1 + drivers/net/ark/ark_pktchkr.c | 2 +- drivers/net/ark/ark_pktgen.c | 2 +- drivers/net/ark/ark_udm.c | 3 +++ 6 files changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/net/ark/ark_ddm.c b/drivers/net/ark/ark_ddm.c index 2321371572..b16c739d50 100644 --- a/drivers/net/ark/ark_ddm.c +++ b/drivers/net/ark/ark_ddm.c @@ -55,6 +55,7 @@ ark_ddm_stop(struct ark_ddm_t *ddm, const int wait) int cnt = 0; ddm->cfg.command = 2; + rte_wmb(); while (wait && (ddm->cfg.stop_flushed & 0x01) == 0) { if (cnt++ > 1000) return 1; diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c index 1000f50be0..49134ea08f 100644 --- a/drivers/net/ark/ark_ethdev_rx.c +++ b/drivers/net/ark/ark_ethdev_rx.c @@ -12,6 +12,7 @@ #define ARK_RX_META_SIZE 32 #define ARK_RX_META_OFFSET (RTE_PKTMBUF_HEADROOM - ARK_RX_META_SIZE) +#define ARK_RX_MPU_CHUNK (64U) /* Forward declarations */ struct ark_rx_queue; @@ -104,7 +105,7 @@ static inline void eth_ark_rx_update_cons_index(struct ark_rx_queue *queue, uint32_t cons_index) { queue->cons_index = cons_index; - if ((cons_index + queue->queue_size - queue->seed_index) >= 64U) { + if ((cons_index + queue->queue_size - queue->seed_index) >= ARK_RX_MPU_CHUNK) { eth_ark_rx_seed_mbufs(queue); ark_mpu_set_producer(queue->mpu, queue->seed_index); } @@ -179,12 +180,12 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev, queue->reserve_q = rte_zmalloc_socket("Ark_rx_queue mbuf", nb_desc * sizeof(struct rte_mbuf *), - 64, + 512, socket_id); queue->paddress_q = rte_zmalloc_socket("Ark_rx_queue paddr", nb_desc * sizeof(rte_iova_t), - 64, + 512, socket_id); if (queue->reserve_q == 0 || queue->paddress_q == 0) { @@ -455,7 +456,8 @@ eth_ark_rx_stop_queue(struct rte_eth_dev *dev, uint16_t queue_id) static inline int eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue) { - uint32_t limit = queue->cons_index + queue->queue_size; + uint32_t limit = (queue->cons_index & ~(ARK_RX_MPU_CHUNK - 1)) + + queue->queue_size; uint32_t seed_index = queue->seed_index; uint32_t count = 0; @@ -618,14 +620,14 @@ eth_ark_udm_force_close(struct rte_eth_dev *dev) ark_mpu_start(queue->mpu); /* Add some buffers */ - index = 100000 + queue->seed_index; + index = ARK_RX_MPU_CHUNK + queue->seed_index; ark_mpu_set_producer(queue->mpu, index); } /* Wait to allow data to pass */ usleep(100); - ARK_PMD_LOG(DEBUG, "UDM forced flush attempt, stopped = %d\n", - ark_udm_is_flushed(ark->udm.v)); + ARK_PMD_LOG(NOTICE, "UDM forced flush attempt, stopped = %d\n", + ark_udm_is_flushed(ark->udm.v)); } ark_udm_reset(ark->udm.v); } diff --git a/drivers/net/ark/ark_mpu.c b/drivers/net/ark/ark_mpu.c index 8160c1de7b..b8e94b6ed3 100644 --- a/drivers/net/ark/ark_mpu.c +++ b/drivers/net/ark/ark_mpu.c @@ -68,6 +68,7 @@ ark_mpu_reset(struct ark_mpu_t *mpu) int cnt = 0; mpu->cfg.command = MPU_CMD_RESET; + rte_wmb(); while (mpu->cfg.command != MPU_CMD_IDLE) { if (cnt++ > 1000) diff --git a/drivers/net/ark/ark_pktchkr.c b/drivers/net/ark/ark_pktchkr.c index 84bb567a41..12a5abb2f7 100644 --- a/drivers/net/ark/ark_pktchkr.c +++ b/drivers/net/ark/ark_pktchkr.c @@ -113,7 +113,7 @@ ark_pktchkr_stopped(ark_pkt_chkr_t handle) struct ark_pkt_chkr_inst *inst = (struct ark_pkt_chkr_inst *)handle; uint32_t r = inst->sregs->pkt_start_stop; - return (((r >> 16) & 1) == 1); + return (((r >> 16) & 1) == 1) || (r == 0); } void diff --git a/drivers/net/ark/ark_pktgen.c b/drivers/net/ark/ark_pktgen.c index 515bfe461c..6195ef997f 100644 --- a/drivers/net/ark/ark_pktgen.c +++ b/drivers/net/ark/ark_pktgen.c @@ -107,7 +107,7 @@ ark_pktgen_paused(ark_pkt_gen_t handle) struct ark_pkt_gen_inst *inst = (struct ark_pkt_gen_inst *)handle; uint32_t r = inst->regs->pkt_start_stop; - return (((r >> 16) & 1) == 1); + return (((r >> 24) & 1) == 1) || (((r >> 16) & 1) == 1) || (r == 0); } void diff --git a/drivers/net/ark/ark_udm.c b/drivers/net/ark/ark_udm.c index 28c4500a2c..9ebed89627 100644 --- a/drivers/net/ark/ark_udm.c +++ b/drivers/net/ark/ark_udm.c @@ -33,7 +33,9 @@ ark_udm_stop(struct ark_udm_t *udm, const int wait) { int cnt = 0; + udm->setup.r0 = 0; udm->cfg.command = 2; + rte_wmb(); while (wait && (udm->cfg.stop_flushed & 0x01) == 0) { if (cnt++ > 1000) @@ -70,6 +72,7 @@ ark_udm_reset(struct ark_udm_t *udm) void ark_udm_start(struct ark_udm_t *udm) { + udm->setup.r0 = 0x100; udm->cfg.command = 1; } -- 2.25.1