From patchwork Fri Feb 17 16:00:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ed Czeck X-Patchwork-Id: 124134 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 29E7B41CC1; Fri, 17 Feb 2023 17:00:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A393A42D2D; Fri, 17 Feb 2023 17:00:49 +0100 (CET) Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) by mails.dpdk.org (Postfix) with ESMTP id 2CF4640EE3 for ; Fri, 17 Feb 2023 17:00:46 +0100 (CET) Received: by mail-qt1-f175.google.com with SMTP id u22so1050955qtq.13 for ; Fri, 17 Feb 2023 08:00:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atomicrules-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Za96cy54hNnpA2RBCW5VRodHJ7t0VdB4hm0NFPKEBa8=; b=ajSEU7LpxNkl5/em4V5u6fsnKo0+fhaNXkGD2iet25bpFmAFYZxbpI67nDD6Vfu3Ba xcn+SJXYx6U1EV45P3JjQbZ8Km8RvNOHqwZ8w2f2f0NaTfoCna3tYAdNtcJCuMCJTCvM K5f3Rm8VkynzuaavRuLlBkmoRyGAffz5/UEohSdKFvpBY5H/SE3hBUCTjUmM3BJdYuQv axKlgOs9pfmV0J989lkkLc3h6z1XDTcs8ip8EUOjoax9zIbDb9FpJdO9noikoXGkilrl xwP3wUlhUoldfcedLpqqOFfVQ1nLahyI6H6tBkzFWFbYc044eOohv3DcSlw8qh6VJ79M xrEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Za96cy54hNnpA2RBCW5VRodHJ7t0VdB4hm0NFPKEBa8=; b=kMjvHzsSCmLovbBRsgRU7rfn6lsIt2JL9vIta6mRzgMFVAcMsPyCSNJ9VoyrzNXC8n DGQi4UGX53IOsKX6My2Xt6ZGy6tdGcUr2Qh4qZlN13DsVZvyW3BbjgjlLANKe09tloAM TKuLhP1gP6vxC9jboHQOqDc2Tp5zZRU+StkpqsO7pjGI+QdCMbImkz0AwyBK1UIfC9TH jAqxKg3yoJq8FXWTVQ/SB5zEPkuSMTEKNBtReuZTL9eybFoN1gbMYv/CbHKN5veQ/HJw n4jN+nq64igKVcZP0glpRLQUxnKHHoT7PNA/wA4vgx5lFb1l7qMndUGs3oHmvGPC728l DbUg== X-Gm-Message-State: AO0yUKVoD97BqEY5BUbbPQpvjGQebwUFFE2iEyAbD7vc63HRBSXW+ObO x+zNSrrPE+A8GcC69uAVMK5+8+34fvGjJKiZ X-Google-Smtp-Source: AK7set8lfXXqdFj8/JoE0vHVZobCZlE4PtDm/52BxMTA+YZ7XSt83PIylCTSmJqVACOeumRTnPgBSA== X-Received: by 2002:ac8:5911:0:b0:3ba:2066:58dc with SMTP id 17-20020ac85911000000b003ba206658dcmr17237018qty.11.1676649645004; Fri, 17 Feb 2023 08:00:45 -0800 (PST) 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 o6-20020a37be06000000b0073b338b4eb1sm3382460qkf.133.2023.02.17.08.00.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Feb 2023 08:00:43 -0800 (PST) From: Ed Czeck To: dev@dpdk.org, ferruh.yigit@amd.com Cc: Shepard Siegel , John Miller Subject: [PATCH 2/3] net/ark: support for single function with multiple port Date: Fri, 17 Feb 2023 11:00:37 -0500 Message-Id: <20230217160039.2487085-2-ed.czeck@atomicrules.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230217160039.2487085-1-ed.czeck@atomicrules.com> References: <20230217160039.2487085-1-ed.czeck@atomicrules.com> 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 allows the creation of multiple ports from one ark device via the use of ark pmd extension, though the splitting of queues Add unique dev_private data for each port Signed-off-by: Ed Czeck --- drivers/net/ark/ark_ethdev.c | 14 +++++++++++++- drivers/net/ark/ark_ethdev_rx.c | 6 +++--- drivers/net/ark/ark_ethdev_tx.c | 2 +- drivers/net/ark/ark_global.h | 4 ++++ 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index f96722551e..2fff3cd6ba 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -432,6 +432,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; + ark->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; @@ -457,7 +458,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 * ark->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..176fbcda17 100644 --- a/drivers/net/ark/ark_global.h +++ b/drivers/net/ark/ark_global.h @@ -112,7 +112,11 @@ struct ark_adapter { ark_pkt_chkr_t pc; ark_pkt_dir_t pd; + /* For single function, multiple ports */ int num_ports; + uint16_t qbase; + uint16_t num_queues; + bool isvf; /* Packet generator/checker args */