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 55285A00BE; Thu, 10 Feb 2022 15:34:41 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 125F642721; Thu, 10 Feb 2022 15:34:39 +0100 (CET) Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by mails.dpdk.org (Postfix) with ESMTP id C843642721 for ; Thu, 10 Feb 2022 15:34:37 +0100 (CET) Received: by mail-pj1-f43.google.com with SMTP id v13-20020a17090ac90d00b001b87bc106bdso8691585pjt.4 for ; Thu, 10 Feb 2022 06:34:37 -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=4Y/POHsxjak+SFEjBByQR1jn+aasmt95wImyQIGuNyE=; b=wPDPXM9+MUfWO0zs0YyvSSlwSsJ7ucIBoX+oitE2Y2dfy+N3nmFRgLqC93uWanNfPA Pgli46/Nq9AZkqHwuo4HjZiuTXPaBr86X8OGa7I9SSHDYKl/2z7D1y/cAx19ag/K7zan qqjKjGg3ui8WBCFbK88f7GBIssvF/0BSxerhUqhNvqtTMOXKKjyA2xvdnCG568kK6KP6 g80op5zWYUWPIpZJhdVlzSTrU7siVZ8izSvNDHxFHvW4QJTJDZ4XxGYVdmM7aSqnoTkJ nxaM6Shj3B8r1gD7GnkFNAJ8BDS6lFtdP3FD5f9bL4FlmwF3+fd+ogxpFinrQf250uBN ER5A== 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=4Y/POHsxjak+SFEjBByQR1jn+aasmt95wImyQIGuNyE=; b=XS3dGzpE4zjX17aY39s/gzSIFjJUffCIAlZ7wnYM5Fclh3m4M1NTbsO5hlFT26Bg+K VWS2Bw8sOCnjMfO90BuY728Pe0ulKNMwmGSM9sZCZgazgofRg09a7zJZRO2xyKthJslh 1JdWRyvRJH04xyqooSGQUbW/2pmb4VtCaz5Scxz5Xt7aicylOT4YhifKKzKnCmh8v6m5 ihUqALyxSVTJ48ANEmqkqLEl9W1CmT6reXkmKovDck9JYVg8QhaV8CUR+KWOeOnTNAdq XbM9Vs+bQM9I2Vv6UNDenWPTLGQ44E4T7WjvE2zTh8y/jvhkVQA9y7aSR0kRijFzZ2ss yNug== X-Gm-Message-State: AOAM533QmEoheHBercySkQQcor50os0knA47i5jp57Jdqjq04zKntwJL HYwA139HgNshuRJz8OMFr/brAjE2tavlow== X-Google-Smtp-Source: ABdhPJzOEQMx3xyceGmbgjp3LNwLktlGI456yBt5dZZTut5hO+p1vlHdhOjgAoDWCFNhNk18BVdBvg== X-Received: by 2002:a17:90b:4a52:: with SMTP id lb18mr1951338pjb.92.1644503676866; Thu, 10 Feb 2022 06:34:36 -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 il18sm2875359pjb.27.2022.02.10.06.34.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Feb 2022 06:34:36 -0800 (PST) From: John Miller To: dev@dpdk.org, ferruh.yigit@intel.com Cc: shepard.siegel@atomicrules.com, John Miller Subject: [PATCH v2 2/3] net/ark: support arbitrary mbuf size Date: Thu, 10 Feb 2022 08:34:22 -0600 Message-Id: <20220210143423.287613-2-john.miller@atomicrules.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220210143423.287613-1-john.miller@atomicrules.com> References: <20220119191255.273988-ed.czeck@atomicrules.com> <20220210143423.287613-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 --- v2: Added arbitrary mbuf size per queue capability. Updated ARK_UDM_CONST3 value to reflect the version number read from the HW that is required to support this change. --- Signed-off-by: John Miller --- drivers/net/ark/ark_ethdev.c | 8 -------- drivers/net/ark/ark_ethdev_rx.c | 23 +++++++++++++++++++---- drivers/net/ark/ark_udm.h | 2 +- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index 9f5f375174..e2c0adf8cb 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -527,14 +527,6 @@ ark_config_device(struct rte_eth_dev *dev) mpu = RTE_PTR_ADD(mpu, ARK_MPU_QOFFSET); } - ark_udm_stop(ark->udm.v, 0); - ark_udm_configure(ark->udm.v, - RTE_PKTMBUF_HEADROOM, - RTE_MBUF_DEFAULT_DATAROOM, - ARK_RX_WRITE_TIME_NS); - ark_udm_stats_reset(ark->udm.v); - ark_udm_stop(ark->udm.v, 0); - /* TX -- DDM */ if (ark_ddm_stop(ark->ddm.v, 1)) ARK_PMD_LOG(ERR, "Unable to stop DDM\n"); diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c index 98658ce621..1000f50be0 100644 --- a/drivers/net/ark/ark_ethdev_rx.c +++ b/drivers/net/ark/ark_ethdev_rx.c @@ -12,7 +12,6 @@ #define ARK_RX_META_SIZE 32 #define ARK_RX_META_OFFSET (RTE_PKTMBUF_HEADROOM - ARK_RX_META_SIZE) -#define ARK_RX_MAX_NOCHAIN (RTE_MBUF_DEFAULT_DATAROOM) /* Forward declarations */ struct ark_rx_queue; @@ -41,6 +40,9 @@ struct ark_rx_queue { rx_user_meta_hook_fn rx_user_meta_hook; void *ext_user_data; + uint32_t dataroom; + uint32_t headroom; + uint32_t queue_size; uint32_t queue_mask; @@ -164,6 +166,9 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev, /* NOTE zmalloc is used, no need to 0 indexes, etc. */ queue->mb_pool = mb_pool; + queue->dataroom = rte_pktmbuf_data_room_size(mb_pool) - + RTE_PKTMBUF_HEADROOM; + queue->headroom = RTE_PKTMBUF_HEADROOM; queue->phys_qid = qidx; queue->queue_index = queue_idx; queue->queue_size = nb_desc; @@ -196,6 +201,15 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev, queue->udm = RTE_PTR_ADD(ark->udm.v, qidx * ARK_UDM_QOFFSET); queue->mpu = RTE_PTR_ADD(ark->mpurx.v, qidx * ARK_MPU_QOFFSET); + /* Configure UDM per queue */ + ark_udm_stop(queue->udm, 0); + ark_udm_configure(queue->udm, + RTE_PKTMBUF_HEADROOM, + queue->dataroom, + ARK_RX_WRITE_TIME_NS); + ark_udm_stats_reset(queue->udm); + ark_udm_stop(queue->udm, 0); + /* populate mbuf reserve */ status = eth_ark_rx_seed_mbufs(queue); @@ -276,6 +290,7 @@ eth_ark_recv_pkts(void *rx_queue, mbuf->data_len = meta->pkt_len; if (ARK_DEBUG_CORE) { /* debug sanity checks */ + if ((meta->pkt_len > (1024 * 16)) || (meta->pkt_len == 0)) { ARK_PMD_LOG(DEBUG, "RX: Bad Meta Q: %u" @@ -304,7 +319,7 @@ eth_ark_recv_pkts(void *rx_queue, } } - if (unlikely(meta->pkt_len > ARK_RX_MAX_NOCHAIN)) + if (unlikely(meta->pkt_len > queue->dataroom)) cons_index = eth_ark_rx_jumbo (queue, meta, mbuf, cons_index + 1); else @@ -345,14 +360,14 @@ eth_ark_rx_jumbo(struct ark_rx_queue *queue, /* first buf populated by called */ mbuf_prev = mbuf0; segments = 1; - data_len = RTE_MIN(meta->pkt_len, RTE_MBUF_DEFAULT_DATAROOM); + data_len = RTE_MIN(meta->pkt_len, queue->dataroom); remaining = meta->pkt_len - data_len; mbuf0->data_len = data_len; /* HW guarantees that the data does not exceed prod_index! */ while (remaining != 0) { data_len = RTE_MIN(remaining, - RTE_MBUF_DEFAULT_DATAROOM); + queue->dataroom); remaining -= data_len; segments += 1; diff --git a/drivers/net/ark/ark_udm.h b/drivers/net/ark/ark_udm.h index 4e51a5e82c..1cbcd94a98 100644 --- a/drivers/net/ark/ark_udm.h +++ b/drivers/net/ark/ark_udm.h @@ -33,7 +33,7 @@ struct ark_rx_meta { #define ARK_RX_WRITE_TIME_NS 2500 #define ARK_UDM_SETUP 0 #define ARK_UDM_CONST2 0xbACECACE -#define ARK_UDM_CONST3 0x334d4455 +#define ARK_UDM_CONST3 0x344d4455 #define ARK_UDM_CONST ARK_UDM_CONST3 struct ark_udm_setup_t { uint32_t r0; -- 2.25.1