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 7A06AA00C5; Tue, 15 Feb 2022 23:19:39 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4113A410F7; Tue, 15 Feb 2022 23:19:39 +0100 (CET) Received: from mail-il1-f180.google.com (mail-il1-f180.google.com [209.85.166.180]) by mails.dpdk.org (Postfix) with ESMTP id C6C14410F3 for ; Tue, 15 Feb 2022 23:19:37 +0100 (CET) Received: by mail-il1-f180.google.com with SMTP id f13so106513ilq.5 for ; Tue, 15 Feb 2022 14:19: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=KguQqGEE4xD9lgm370trL71NvbNkvmnDaH/+eujfBAI=; b=wqjLnEqbqY90+wbG8GI+KNGqyd9xiqHwJWqRTO6LuvDSLjZkeEg5FK9JCn4DWPOg1T rbHRhKxe8ukLSUXvuuI2rRwH76DAp5Dojntg4F+MvuOz/Zr/ymwE/0ZWqPsXJ0IQudSI nHqbq944zEOeXwPPgW1lvcnswJ38FmZU3x4MpBMD0V5G254kMhC/w8agPv8qtdHP3srt QWDRsB2wlxvfYyIt1S5sJwpcJw22f/cBR09WHf2HrLhTzYt9tKgtmzwcTucNZCXsJyao KEPfpfnVggh9hNI8NWg809hYx8gqJwrA8A+TWUyot0sN6mIyKq6LoNp5ZCFn520ESPJ8 s3bw== 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=KguQqGEE4xD9lgm370trL71NvbNkvmnDaH/+eujfBAI=; b=A9AGMa71cX1H9EdW3vdLIvewSpXyZD9u+BQTX8tTadT7ijVnrNLIKiOlubRUIL2STQ KoXpOXItoYCMF2cCt29LQc+LAvrPbNFtu0HVVCW44I2RUVhE35vyBcX4BP0znzr+d8Sz o+HKw06Cr75CExzwyZBsRuyctRYL0K7ArDB4vJ3ZdZH5RAiMhM/3GU9kkMBUCq4Oyrys cTED254qfCCQly+IwPRqfSJHDv0fmfdcHq7bE/L1y232Egr5yuUiLSi2yM7a+1y53PEc 8Z1fv8/Jz5RCNS7fWKXQ+J8oY2bSsVj3Ddp/wP6gXUrZ9brWzt1IKvZWPHuXGEu9lKeG DEWg== X-Gm-Message-State: AOAM5322lrKqpWCmyKcbNuMXYp6DqB5nsTyAUfBBX6eKaJgvAwkR+ONA 86YNB+aAHoAER3sd/1brns4HhS+hRcA8/w== X-Google-Smtp-Source: ABdhPJxha4kHZtCpbXUDw03PVTIEjyh0fWm/wl3MjXDnrVcc72PHQl2BMb1vB1GbWf2FN6EWHg2fFw== X-Received: by 2002:a05:6e02:1c2e:: with SMTP id m14mr738965ilh.243.1644963576944; Tue, 15 Feb 2022 14:19: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 a15sm10758823ilj.21.2022.02.15.14.19.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 14:19:36 -0800 (PST) From: John Miller To: dev@dpdk.org, ferruh.yigit@intel.com Cc: shepard.siegel@atomicrules.com, John Miller Subject: [PATCH v3 1/7] net/ark: add device capabilities record Date: Tue, 15 Feb 2022 16:19:20 -0600 Message-Id: <20220215221926.409039-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. v3: - Split patch to separate new supported devices. --- drivers/net/ark/ark_ethdev.c | 84 ++++++++++++++++++++++++++++-------- 1 file changed, 67 insertions(+), 17 deletions(-) diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index 230a1272e9..d2b1cb083b 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -85,17 +85,49 @@ 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)}, {.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), + {.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 +288,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 +303,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 = rte_eth_pkt_burst_dummy; dev->tx_pkt_burst = rte_eth_pkt_burst_dummy; @@ -288,8 +330,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 +355,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 +547,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 +744,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