From patchwork Thu Oct 5 20:52:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ed Czeck X-Patchwork-Id: 132345 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B90F0426C6; Thu, 5 Oct 2023 22:52:29 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 100C0402DB; Thu, 5 Oct 2023 22:52:29 +0200 (CEST) Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) by mails.dpdk.org (Postfix) with ESMTP id 0B7B74014F for ; Thu, 5 Oct 2023 22:52:28 +0200 (CEST) Received: by mail-qk1-f181.google.com with SMTP id af79cd13be357-7757f2d3956so203941185a.0 for ; Thu, 05 Oct 2023 13:52:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atomicrules-com.20230601.gappssmtp.com; s=20230601; t=1696539147; x=1697143947; darn=dpdk.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=vjK8hjdCGsCKZzwsp6RU11piDZab/243o0NTMR+6J88=; b=m73tSBQpNPsdeWhZHOd/8K+I1fxC2deieUdvjEKejbTon7e44qirj5cnmY/mVRb0t3 DqDkx40j7nEUIILg3eyqiysmnml4zgBrf9JQAaI0DC0hzYE4Go84Aqhe9UO7tvTEffoV 5hST43sYRGU//psi4gxNzBPL0altzaGzvQINc2J6sqqOCOoZJbt8Bky0UoyFhFPCushZ jrOLJuFvOidaMBlhyYyDGHkdnq6ghWBRcKXIKjV6U91TRg+VW9tKBitZ+vqtpdVc/qTU PcHISe9iUJk+HshzKm1GkCSmDAnzrJNsDRgZNfdY0iJeIXuBcZujAEwVedpqoqUKJNBh YRSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696539147; x=1697143947; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vjK8hjdCGsCKZzwsp6RU11piDZab/243o0NTMR+6J88=; b=L+/ecQU5UnahobXz3KS3RLDUA8LPPD5n0ZrQnjwCqtd0vDwFnzamQiNq89ZhKKOJFh HZiROPJIYjJ2IFqPWEThfpGGfypOsOci1ajJVOoeX/Ob63SYOml0QTMYMR8KasjkTEqq 0nhai/0Bj39isWR6niz413AM/GSVQAXGua1gMwW+0HZa/G5ppvQBzQvQ8bGZSRTkVH1F wILpsursyQC1UUSdBsPxOfqFpJQpzVB8gUMsAO3TYomZ/POJIl9eyKTaMey//D0VNlP9 vBtHq6bpY+8X+cuo/z8/FCk9lk+VAZQPAXvZr6BavkaXPCWM+vi1IFLli/laxaLbJzWu 1n0Q== X-Gm-Message-State: AOJu0YzmAU1TLj9ZuqUI5S+7SIpvtBNG+gH5/CY3kn5QgSVjLLCB4PhW EuheGnQULIIxrZg0sXWNW94v5QfZXf6H9tlOnd4= X-Google-Smtp-Source: AGHT+IH4iNP+Q1OPNERnbTKbEhEb1tfDwjNPl3dLX9bLjWFGKJv6g7JB6VKL5m4eDsHFqPkfuJRgog== X-Received: by 2002:a05:620a:410b:b0:773:f6ea:1f59 with SMTP id j11-20020a05620a410b00b00773f6ea1f59mr3146433qko.16.1696539146894; Thu, 05 Oct 2023 13:52:26 -0700 (PDT) Received: from z690.czeck.local (pool-173-48-111-149.bstnma.fios.verizon.net. [173.48.111.149]) by smtp.gmail.com with ESMTPSA id l25-20020ac84cd9000000b004181c32dcc3sm748021qtv.16.2023.10.05.13.52.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 13:52:26 -0700 (PDT) From: Ed Czeck To: dev@dpdk.org, ferruh.yigit@amd.com Cc: stable@dpdk.org, Shepard Siegel , John Miller Subject: [PATCH 1/3] net/ark: support for single function with multiple port Date: Thu, 5 Oct 2023 16:52:15 -0400 Message-Id: <20231005205217.1753187-1-ed.czeck@atomicrules.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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 Support the creation of multiple ports from one ark device via the use of ark pmd extension. I.e., one device with q queue can seen a p ports each with q/p queues. Add unique dev_private data for each port to manage queue assignment. This patch repairs a latent issue uncovered during testing. Fixes: 6799275eeea6 ("net/ark: support virtual functions") Cc: stable@dpdk.org Backporting is not requested. Signed-off-by: Ed Czeck --- drivers/net/ark/ark_ethdev.c | 15 ++++++++++++++- drivers/net/ark/ark_ethdev_rx.c | 6 +++--- drivers/net/ark/ark_ethdev_tx.c | 2 +- drivers/net/ark/ark_global.h | 3 +++ 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index 3ddcc9b461..90d3c8abe6 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -300,6 +300,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev) int ret; int port_count = 1; int p; + uint16_t num_queues; bool rqpacing = false; ark->eth_dev = dev; @@ -427,6 +428,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev) ark->user_ext.dev_get_port_count(dev, ark->user_data[dev->data->port_id]); ark->num_ports = port_count; + num_queues = ark_api_num_queues_per_port(ark->mpurx.v, port_count); for (p = 0; p < port_count; p++) { struct rte_eth_dev *eth_dev; @@ -452,7 +454,18 @@ eth_ark_dev_init(struct rte_eth_dev *dev) } eth_dev->device = &pci_dev->device; - eth_dev->data->dev_private = ark; + /* Device requires new dev_private data */ + eth_dev->data->dev_private = + rte_zmalloc_socket(name, + sizeof(struct ark_adapter), + RTE_CACHE_LINE_SIZE, + rte_socket_id()); + + memcpy(eth_dev->data->dev_private, ark, + sizeof(struct ark_adapter)); + ark = eth_dev->data->dev_private; + ark->qbase = p * num_queues; + eth_dev->dev_ops = ark->eth_dev->dev_ops; eth_dev->tx_pkt_burst = ark->eth_dev->tx_pkt_burst; eth_dev->rx_pkt_burst = ark->eth_dev->rx_pkt_burst; diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c index cbc0416bc2..38bc69dff4 100644 --- a/drivers/net/ark/ark_ethdev_rx.c +++ b/drivers/net/ark/ark_ethdev_rx.c @@ -68,7 +68,7 @@ struct ark_rx_queue { static int eth_ark_rx_hw_setup(struct rte_eth_dev *dev, struct ark_rx_queue *queue, - uint16_t rx_queue_id __rte_unused, uint16_t rx_queue_idx) + uint16_t rx_queue_idx) { rte_iova_t queue_base; rte_iova_t phys_addr_q_base; @@ -124,7 +124,7 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev, uint32_t i; int status; - int qidx = queue_idx; + int qidx = ark->qbase + queue_idx; /* We may already be setup, free memory prior to re-allocation */ if (dev->data->rx_queues[queue_idx] != NULL) { @@ -215,7 +215,7 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev, } /* MPU Setup */ if (status == 0) - status = eth_ark_rx_hw_setup(dev, queue, qidx, queue_idx); + status = eth_ark_rx_hw_setup(dev, queue, queue_idx); if (unlikely(status != 0)) { struct rte_mbuf **mbuf; diff --git a/drivers/net/ark/ark_ethdev_tx.c b/drivers/net/ark/ark_ethdev_tx.c index 5940a592a2..4792754f19 100644 --- a/drivers/net/ark/ark_ethdev_tx.c +++ b/drivers/net/ark/ark_ethdev_tx.c @@ -229,7 +229,7 @@ eth_ark_tx_queue_setup(struct rte_eth_dev *dev, struct ark_tx_queue *queue; int status; - int qidx = queue_idx; + int qidx = ark->qbase + queue_idx; if (!rte_is_power_of_2(nb_desc)) { ARK_PMD_LOG(ERR, diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h index 71d0b53e03..2f198edfe4 100644 --- a/drivers/net/ark/ark_global.h +++ b/drivers/net/ark/ark_global.h @@ -112,7 +112,10 @@ struct ark_adapter { ark_pkt_chkr_t pc; ark_pkt_dir_t pd; + /* For single function, multiple ports */ int num_ports; + uint16_t qbase; + bool isvf; /* Packet generator/checker args */