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 38AA5A00BE; Thu, 10 Feb 2022 15:34:37 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1E19942714; Thu, 10 Feb 2022 15:34:37 +0100 (CET) Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by mails.dpdk.org (Postfix) with ESMTP id 960074013F for ; Thu, 10 Feb 2022 15:34:36 +0100 (CET) Received: by mail-pf1-f173.google.com with SMTP id r19so10567421pfh.6 for ; Thu, 10 Feb 2022 06:34:36 -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=ynLyVf7NQg5hsw2/eycbo7op/3XpQifd1KfsStErFZU=; b=Jn2ZyK0hzLEDhDwIJrrLL4xL4J8n81e0eviJegmtw3x10pKOiCrKBg8rwcBJjZf76O enMA2V9lLBeC3GBhrWo0cko7d8syja27ttWSRIC2+VW0uYAzyfM0W3bCLbocFqmNHBek HU9eZT6bNgre73AfZUacFZrZZ5CwE4kczjrraisPCZwyWTSqlJygSCeEi2lZh6uK4i6W rDyCpS4GYRkIz1ZAqz2PWJmLLr8SJw1+i8yFSLoqxvxi2dE8LkZrAmpF4ccsQH+57nRt AUQoFF0nR9bkR2L+q74nrA0oexa8qLmPyL+8hp49xq6Zbud2WDaQnzJ+mDi5FsWQ3AAO 8d5Q== 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=ynLyVf7NQg5hsw2/eycbo7op/3XpQifd1KfsStErFZU=; b=4hTJ4Y84MKxywOA+2GfadVB3hUabq7701a4VFiepJ0PXlIKP0LLH14mErObrEewUaB aTMd05GLOf7dIpNnFn3MRI5J0fxLyhI8Sp5uChB0k1OvrZ+bgnFEpw8F/vj0L8bpNdlM VtYuwFhMDoVmKpzBUMBkgQyc/JcpcCKZl2XbveUdYS4psuxjzwy1+GfWeWw0KL0GMLpR ykTEDwPs+r9zN5fmxPe/BBUPr7amO0zUmKZ4keVssIrXDAaZ0E9Azo5YG3I4fzY2aApp b4vM/LUzcAeqTy3hyFKX9v4ZEUXmf2QDL0juFyeXtmkOTPValWL8oU6K0CDB2c+SpiLn TjwQ== X-Gm-Message-State: AOAM532sKVHpLuMjVNkqQzGmlYOGUi4r+HkXPVA/1aRS+3RyqXWNaSZj LIMCniahdGb1dKfFnowjND5/va2dX9MP6Q== X-Google-Smtp-Source: ABdhPJxzGX8Tlj/7Rdug3fJtRJuWOMi4KViF3oFt3jl+hpeFzMxsUy1zSB/nrpjS5Z5CDGJMTW7A1g== X-Received: by 2002:a63:485f:: with SMTP id x31mr6429327pgk.358.1644503675530; Thu, 10 Feb 2022 06:34:35 -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.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Feb 2022 06:34:35 -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: Thu, 10 Feb 2022 08:34:21 -0600 Message-Id: <20220210143423.287613-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 --- v2: 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. Improved code readability and comments. --- Signed-off-by: John Miller --- 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