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 A61F0A00C5; Fri, 11 Feb 2022 12:39:49 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 931E441144; Fri, 11 Feb 2022 12:39:49 +0100 (CET) Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by mails.dpdk.org (Postfix) with ESMTP id A0B1E40150 for ; Fri, 11 Feb 2022 12:39:48 +0100 (CET) Received: by mail-pf1-f178.google.com with SMTP id 9so12879900pfx.12 for ; Fri, 11 Feb 2022 03:39:48 -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=tcTC6qHN2GYZb5ez45cd/RK+Ycm437KhjbDqxwWM7UQ=; b=SQ6/UnyxCkPcQFqtuSzBF4e3PLRam8hYom/nf6jeZ03pon4uIy7zxatey2PX4NNzkL UUVBKgMsh+cB0bpPRU+4SgVSDoyL3Tm6PGjWLe+k8JPUTZB0EifGxrRH3RRkTZSZA3X3 e2RtAfqPr/XWJk78IY4exx0nzmXjpIpVyPxy9i149Piqqlt/Ip1vsqG6PckqHiUUc5Iq FdMxvo5LTNa1k56yqdbZKT+2X9QozWkRZeGt/6HaJK3QCHzaG//qd8JG/zMTz6AQj1bs dhq3NOr8crtZIytvH4Zt0aXl6APNXsKgZ5bfviN2Vw0UA/DiC0UCo1lM8B+PIbD3vgAP +gPA== 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=tcTC6qHN2GYZb5ez45cd/RK+Ycm437KhjbDqxwWM7UQ=; b=tFRut52Yw7h1zBxSeGr1fC2NnLGdK3L6CdBm4z0AYUca5jYiDUHCvTYAU+z+Vt2mE6 cnhZkQOP21mNfAxpKmuCj789/sJT0A3GiafBv0HIY+jIg7GQwCt8D7N2ccHfP/KCxrSq ht/HwfwY0ig7/C3ZSJ3W4tHcs+Yus1LIoLjxWSZfQhWzSTIr+kZTf6OfL1Ka0/SKCZZ8 71Lsy8+hyRm1/GEC0AvmCuQ5IsSRlNJC1C0zGQkQxZldvq1wBcHB5GiX4U1qJ3mU1CjW TYIeRI2XY8Ybcq+w7AjvSc5wN34vZ2j/oCz3VGeZqe8cDjMKJgpzj5IaIt7cg6u82Cib b9iQ== X-Gm-Message-State: AOAM5318QMfDaFaXi3Sx+ZcFMwlel27gGvVCuN0Txlh7n0V+PD3NsHh5 X3d4GDtZSmbyRiz4qcoUlxB39hjvYa98DQ== X-Google-Smtp-Source: ABdhPJw9VEAlaSNkcU8iXHEd0xvNwrjLPdwVK9H+LfLfXWyR++m7KAAiiZPyonOepXUm/E3KXUYz4g== X-Received: by 2002:a63:f34e:: with SMTP id t14mr993936pgj.622.1644579587701; Fri, 11 Feb 2022 03:39:47 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Feb 2022 03:39:47 -0800 (PST) From: John Miller To: dev@dpdk.org, ferruh.yigit@intel.com Cc: shepard.siegel@atomicrules.com, John Miller Subject: [PATCH v2 1/3] net/ark: add device capabilities record Date: Fri, 11 Feb 2022 05:39:33 -0600 Message-Id: <20220211113935.303366-1-john.miller@atomicrules.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220119191255.273988-ed.czeck@atomicrules.com> References: <20220119191255.273988-ed.czeck@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 a device capabilities record for supported features. Certain variants require that PCIe read-requests be correctly throttled. This is called "rqpacing" in Arkville, and has to do with credit and flow control on certain Arkville implementations. Signed-off-by: John Miller --- v2: - Improved code readability and comments. --- drivers/net/ark/ark_ethdev.c | 88 +++++++++++++++++++++++++++++------- 1 file changed, 71 insertions(+), 17 deletions(-) diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index b618cba3f0..9f5f375174 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -85,17 +85,53 @@ static const char * const valid_arguments[] = { NULL }; +#define AR_VENDOR_ID 0x1d6c static const struct rte_pci_id pci_id_ark_map[] = { - {RTE_PCI_DEVICE(0x1d6c, 0x100d)}, - {RTE_PCI_DEVICE(0x1d6c, 0x100e)}, - {RTE_PCI_DEVICE(0x1d6c, 0x100f)}, - {RTE_PCI_DEVICE(0x1d6c, 0x1010)}, - {RTE_PCI_DEVICE(0x1d6c, 0x1017)}, - {RTE_PCI_DEVICE(0x1d6c, 0x1018)}, - {RTE_PCI_DEVICE(0x1d6c, 0x1019)}, + {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100d)}, + {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100e)}, + {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100f)}, + {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1010)}, + {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1017)}, + {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1018)}, + {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1019)}, + {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x101e)}, + {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x101f)}, {.vendor_id = 0, /* sentinel */ }, }; +/* + * This structure is used to statically define the capabilities + * of supported devices. + * Capabilities: + * rqpacing - + * Some HW variants require that PCIe read-requests be correctly throttled. + * This is called "rqpacing" and has to do with credit and flow control + * on certain Arkville implementations. + */ +struct ark_caps { + bool rqpacing; +}; +struct ark_dev_caps { + uint32_t device_id; + struct ark_caps caps; +}; +#define SET_DEV_CAPS(id, rqp) \ + {id, {.rqpacing = rqp} } + +static const struct ark_dev_caps +ark_device_caps[] = { + SET_DEV_CAPS(0x100d, true), + SET_DEV_CAPS(0x100e, true), + SET_DEV_CAPS(0x100f, true), + SET_DEV_CAPS(0x1010, false), + SET_DEV_CAPS(0x1017, true), + SET_DEV_CAPS(0x1018, true), + SET_DEV_CAPS(0x1019, true), + SET_DEV_CAPS(0x101e, false), + SET_DEV_CAPS(0x101f, false), + {.device_id = 0,} +}; + static int eth_ark_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, struct rte_pci_device *pci_dev) @@ -256,6 +292,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev) int ret; int port_count = 1; int p; + bool rqpacing = false; ark->eth_dev = dev; @@ -270,6 +307,15 @@ eth_ark_dev_init(struct rte_eth_dev *dev) rte_eth_copy_pci_info(dev, pci_dev); dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; + p = 0; + while (ark_device_caps[p].device_id != 0) { + if (pci_dev->id.device_id == ark_device_caps[p].device_id) { + rqpacing = ark_device_caps[p].caps.rqpacing; + break; + } + p++; + } + /* Use dummy function until setup */ dev->rx_pkt_burst = ð_ark_recv_pkts_noop; dev->tx_pkt_burst = ð_ark_xmit_pkts_noop; @@ -288,8 +334,12 @@ eth_ark_dev_init(struct rte_eth_dev *dev) ark->pktgen.v = (void *)&ark->bar0[ARK_PKTGEN_BASE]; ark->pktchkr.v = (void *)&ark->bar0[ARK_PKTCHKR_BASE]; - ark->rqpacing = - (struct ark_rqpace_t *)(ark->bar0 + ARK_RCPACING_BASE); + if (rqpacing) { + ark->rqpacing = + (struct ark_rqpace_t *)(ark->bar0 + ARK_RCPACING_BASE); + } else { + ark->rqpacing = NULL; + } ark->started = 0; ark->pkt_dir_v = ARK_PKT_DIR_INIT_VAL; @@ -309,13 +359,15 @@ eth_ark_dev_init(struct rte_eth_dev *dev) return -1; } if (ark->sysctrl.t32[3] != 0) { - if (ark_rqp_lasped(ark->rqpacing)) { - ARK_PMD_LOG(ERR, "Arkville Evaluation System - " - "Timer has Expired\n"); - return -1; + if (ark->rqpacing) { + if (ark_rqp_lasped(ark->rqpacing)) { + ARK_PMD_LOG(ERR, "Arkville Evaluation System - " + "Timer has Expired\n"); + return -1; + } + ARK_PMD_LOG(WARNING, "Arkville Evaluation System - " + "Timer is Running\n"); } - ARK_PMD_LOG(WARNING, "Arkville Evaluation System - " - "Timer is Running\n"); } ARK_PMD_LOG(DEBUG, @@ -499,7 +551,8 @@ ark_config_device(struct rte_eth_dev *dev) ark_ddm_stats_reset(ark->ddm.v); ark_ddm_stop(ark->ddm.v, 0); - ark_rqp_stats_reset(ark->rqpacing); + if (ark->rqpacing) + ark_rqp_stats_reset(ark->rqpacing); return 0; } @@ -695,7 +748,8 @@ eth_ark_dev_close(struct rte_eth_dev *dev) /* * TODO This should only be called once for the device during shutdown */ - ark_rqp_dump(ark->rqpacing); + if (ark->rqpacing) + ark_rqp_dump(ark->rqpacing); for (i = 0; i < dev->data->nb_tx_queues; i++) { eth_ark_tx_queue_release(dev->data->tx_queues[i]); -- 2.25.1