DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kamil Rytarowski <krytarowski@caviumnetworks.com>
To: <dev@dpdk.org>
Cc: <maciej.czekaj@caviumnetworks.com>, <zyta.szpak@semihalf.com>,
	<slawomir.rosek@semihalf.com>, <rad@semihalf.com>,
	<jerin.jacob@caviumnetworks.com>, <ferruh.yigit@intel.com>,
	<john.mcnamara@intel.com>,
	Kamil Rytarowski <kamil.rytarowski@caviumnetworks.com>
Subject: [dpdk-dev] [PATCH v2 11/15] net/thunderx: add secondary qset support in device configure
Date: Fri, 30 Sep 2016 14:05:50 +0200	[thread overview]
Message-ID: <1475237154-25388-12-git-send-email-krytarowski@caviumnetworks.com> (raw)
In-Reply-To: <1475237154-25388-1-git-send-email-krytarowski@caviumnetworks.com>

From: Kamil Rytarowski <kamil.rytarowski@caviumnetworks.com>

Signed-off-by: Maciej Czekaj <maciej.czekaj@caviumnetworks.com>
Signed-off-by: Kamil Rytarowski <kamil.rytarowski@caviumnetworks.com>
Signed-off-by: Zyta Szpak <zyta.szpak@semihalf.com>
Signed-off-by: Slawomir Rosek <slawomir.rosek@semihalf.com>
Signed-off-by: Radoslaw Biernacki <rad@semihalf.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 drivers/net/thunderx/nicvf_ethdev.c | 65 +++++++++++++++++++++++++++++++++----
 1 file changed, 59 insertions(+), 6 deletions(-)

diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index f7d5188..5f12b91 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -163,6 +163,7 @@ nicvf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 {
 	struct nicvf *nic = nicvf_pmd_priv(dev);
 	uint32_t buffsz, frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
+	size_t i;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -198,6 +199,10 @@ nicvf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 	/* Update max frame size */
 	dev->data->dev_conf.rxmode.max_rx_pkt_len = (uint32_t)frame_size;
 	nic->mtu = mtu;
+
+	for (i = 0; i < nic->sqs_count; i++)
+		nic->snicvf[i]->mtu = mtu;
+
 	return 0;
 }
 
@@ -507,7 +512,8 @@ nicvf_qset_cq_alloc(struct rte_eth_dev *dev, struct nicvf *nic,
 	const struct rte_memzone *rz;
 	uint32_t ring_size = CMP_QUEUE_SZ_MAX * sizeof(union cq_entry_t);
 
-	rz = rte_eth_dma_zone_reserve(dev, "cq_ring", qidx, ring_size,
+	rz = rte_eth_dma_zone_reserve(dev, "cq_ring",
+				      nicvf_netdev_qidx(nic, qidx), ring_size,
 				      NICVF_CQ_BASE_ALIGN_BYTES, nic->node);
 	if (rz == NULL) {
 		PMD_INIT_LOG(ERR, "Failed to allocate mem for cq hw ring");
@@ -530,8 +536,9 @@ nicvf_qset_sq_alloc(struct rte_eth_dev *dev, struct nicvf *nic,
 	const struct rte_memzone *rz;
 	uint32_t ring_size = SND_QUEUE_SZ_MAX * sizeof(union sq_entry_t);
 
-	rz = rte_eth_dma_zone_reserve(dev, "sq", qidx, ring_size,
-				NICVF_SQ_BASE_ALIGN_BYTES, nic->node);
+	rz = rte_eth_dma_zone_reserve(dev, "sq",
+				      nicvf_netdev_qidx(nic, qidx), ring_size,
+				      NICVF_SQ_BASE_ALIGN_BYTES, nic->node);
 	if (rz == NULL) {
 		PMD_INIT_LOG(ERR, "Failed allocate mem for sq hw ring");
 		return -ENOMEM;
@@ -563,8 +570,9 @@ nicvf_qset_rbdr_alloc(struct rte_eth_dev *dev, struct nicvf *nic,
 	}
 
 	ring_size = sizeof(struct rbdr_entry_t) * RBDR_QUEUE_SZ_MAX;
-	rz = rte_eth_dma_zone_reserve(dev, "rbdr", 0, ring_size,
-				   NICVF_RBDR_BASE_ALIGN_BYTES, nic->node);
+	rz = rte_eth_dma_zone_reserve(dev, "rbdr",
+				      nicvf_netdev_qidx(nic, 0), ring_size,
+				      NICVF_RBDR_BASE_ALIGN_BYTES, nic->node);
 	if (rz == NULL) {
 		PMD_INIT_LOG(ERR, "Failed to allocate mem for rbdr desc ring");
 		return -ENOMEM;
@@ -1685,12 +1693,37 @@ nicvf_dev_close(struct rte_eth_dev *dev)
 }
 
 static int
+nicvf_request_sqs(struct nicvf *nic)
+{
+	size_t i;
+
+	assert_primary(nic);
+	assert(nic->sqs_count > 0);
+	assert(nic->sqs_count <= MAX_SQS_PER_VF);
+
+	/* Set no of Rx/Tx queues in each of the SQsets */
+	for (i = 0; i < nic->sqs_count; i++) {
+		if (nicvf_svf_empty())
+			rte_panic("Cannot assign sufficient number of "
+				  "secondary queues to primary VF%" PRIu8 "\n",
+				  nic->vf_id);
+
+		nic->snicvf[i] = nicvf_svf_pop();
+		nic->snicvf[i]->sqs_id = i;
+	}
+
+	return nicvf_mbox_request_sqs(nic);
+}
+
+static int
 nicvf_dev_configure(struct rte_eth_dev *dev)
 {
-	struct rte_eth_conf *conf = &dev->data->dev_conf;
+	struct rte_eth_dev_data *data = dev->data;
+	struct rte_eth_conf *conf = &data->dev_conf;
 	struct rte_eth_rxmode *rxmode = &conf->rxmode;
 	struct rte_eth_txmode *txmode = &conf->txmode;
 	struct nicvf *nic = nicvf_pmd_priv(dev);
+	uint8_t cqcount;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -1755,6 +1788,26 @@ nicvf_dev_configure(struct rte_eth_dev *dev)
 		return -EINVAL;
 	}
 
+	assert_primary(nic);
+	NICVF_STATIC_ASSERT(MAX_RCV_QUEUES_PER_QS == MAX_SND_QUEUES_PER_QS);
+	cqcount = RTE_MAX(data->nb_tx_queues, data->nb_rx_queues);
+	if (cqcount > MAX_RCV_QUEUES_PER_QS) {
+		nic->sqs_count = RTE_ALIGN_CEIL(cqcount, MAX_RCV_QUEUES_PER_QS);
+		nic->sqs_count = (nic->sqs_count / MAX_RCV_QUEUES_PER_QS) - 1;
+	} else {
+		nic->sqs_count = 0;
+	}
+
+	assert(nic->sqs_count <= MAX_SQS_PER_VF);
+
+	if (nic->sqs_count > 0) {
+		if (nicvf_request_sqs(nic)) {
+			rte_panic("Cannot assign sufficient number of "
+				  "secondary queues to PORT%d VF%" PRIu8 "\n",
+				  dev->data->port_id, nic->vf_id);
+		}
+	}
+
 	PMD_INIT_LOG(DEBUG, "Configured ethdev port%d hwcap=0x%" PRIx64,
 		dev->data->port_id, nicvf_hw_cap(nic));
 
-- 
1.9.1

  parent reply	other threads:[~2016-09-30 12:07 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-26 16:53 [dpdk-dev] [PATCH 00/13] Add support for secondary queue set in nicvf thunderx driver Kamil Rytarowski
2016-08-26 16:53 ` [dpdk-dev] [PATCH 01/13] net/thunderx: cleanup the driver before adding new features Kamil Rytarowski
2016-09-20 13:48   ` Ferruh Yigit
2016-09-29 14:21     ` Maciej Czekaj
2016-08-26 16:53 ` [dpdk-dev] [PATCH 02/13] net/thunderx: correct transmit checksum handling Kamil Rytarowski
2016-08-26 16:53 ` [dpdk-dev] [PATCH 03/13] net/thunderx/base: add family of functions to store qsets Kamil Rytarowski
2016-08-26 16:53 ` [dpdk-dev] [PATCH 04/13] net/thunderx/base: add secondary queue set support Kamil Rytarowski
2016-09-20 13:48   ` Ferruh Yigit
2016-09-29 14:22     ` Maciej Czekaj
2016-08-26 16:54 ` [dpdk-dev] [PATCH 05/13] net/thunderx: add family of functions to store DPDK qsets Kamil Rytarowski
2016-08-26 16:54 ` [dpdk-dev] [PATCH 06/13] net/thunderx: add secondary queue set in interrupt functions Kamil Rytarowski
2016-08-26 16:54 ` [dpdk-dev] [PATCH 07/13] net/thunderx: fix multiprocess support in stats Kamil Rytarowski
2016-09-20 13:48   ` Ferruh Yigit
2016-09-29 14:35     ` Maciej Czekaj
2016-08-26 16:54 ` [dpdk-dev] [PATCH 08/13] net/thunderx: add helper utils for secondary qset support Kamil Rytarowski
2016-08-26 16:54 ` [dpdk-dev] [PATCH 09/13] net/thunderx: add secondary qset support in dev stop/close Kamil Rytarowski
2016-08-26 16:54 ` [dpdk-dev] [PATCH 10/13] net/thunderx: add secondary qset support in device start Kamil Rytarowski
2016-08-26 16:54 ` [dpdk-dev] [PATCH 11/13] net/thunderx: add secondary qset support in device configure Kamil Rytarowski
2016-08-26 16:54 ` [dpdk-dev] [PATCH 12/13] net/thunderx: add final bits for secondary queue support Kamil Rytarowski
2016-09-20 13:49   ` Ferruh Yigit
2016-09-29 14:37     ` Maciej Czekaj
2016-08-26 16:54 ` [dpdk-dev] [PATCH 13/13] net/thunderx: document secondary queue set support Kamil Rytarowski
2016-09-26 20:17   ` Mcnamara, John
2016-09-29 14:38     ` Maciej Czekaj
2016-09-12 10:59 ` [dpdk-dev] [PATCH 00/13] Add support for secondary queue set in nicvf thunderx driver Kamil Rytarowski
2016-09-19 12:23   ` Kamil Rytarowski
2016-09-30 12:05 ` [dpdk-dev] [PATCH v2 00/15] " Kamil Rytarowski
2016-09-30 12:05   ` [dpdk-dev] [PATCH v2 01/15] net/thunderx: cleanup the driver before adding new features Kamil Rytarowski
2016-09-30 12:05   ` [dpdk-dev] [PATCH v2 02/15] net/thunderx: correct transmit checksum handling Kamil Rytarowski
2016-09-30 12:05   ` [dpdk-dev] [PATCH v2 03/15] net/thunderx/base: add family of functions to store qsets Kamil Rytarowski
2016-09-30 12:05   ` [dpdk-dev] [PATCH v2 04/15] net/thunderx/base: add secondary queue set support Kamil Rytarowski
2016-09-30 12:05   ` [dpdk-dev] [PATCH v2 05/15] net/thunderx: add family of functions to store DPDK qsets Kamil Rytarowski
2016-09-30 12:05   ` [dpdk-dev] [PATCH v2 06/15] net/thunderx: add secondary queue set in interrupt functions Kamil Rytarowski
2016-09-30 12:05   ` [dpdk-dev] [PATCH v2 07/15] net/thunderx: remove problematic private_data->eth_dev link Kamil Rytarowski
2016-09-30 12:05   ` [dpdk-dev] [PATCH v2 08/15] net/thunderx: add helper utils for secondary qset support Kamil Rytarowski
2016-09-30 12:05   ` [dpdk-dev] [PATCH v2 09/15] net/thunderx: add secondary qset support in dev stop/close Kamil Rytarowski
2016-09-30 12:05   ` [dpdk-dev] [PATCH v2 10/15] net/thunderx: add secondary qset support in device start Kamil Rytarowski
2016-09-30 12:05   ` Kamil Rytarowski [this message]
2016-09-30 12:05   ` [dpdk-dev] [PATCH v2 12/15] net/thunderx: add final bits for secondary queue support Kamil Rytarowski
2016-09-30 12:05   ` [dpdk-dev] [PATCH v2 13/15] net/thunderx: document secondary queue set support Kamil Rytarowski
2016-09-30 15:12     ` Mcnamara, John
2016-09-30 12:05   ` [dpdk-dev] [PATCH v2 14/15] ethdev: Support VFs on the different PCI domains Kamil Rytarowski
2016-10-10 10:19     ` Ferruh Yigit
2016-10-10 13:01       ` Kamil Rytarowski
2016-10-10 13:27         ` Ferruh Yigit
2016-10-11 13:52           ` Kamil Rytarowski
2016-09-30 12:05   ` [dpdk-dev] [PATCH v2 15/15] net/thunderx: Bump driver version to 2.0 Kamil Rytarowski
2016-10-12 15:59   ` [dpdk-dev] [PATCH v2 00/15] Add support for secondary queue set in nicvf thunderx driver Bruce Richardson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1475237154-25388-12-git-send-email-krytarowski@caviumnetworks.com \
    --to=krytarowski@caviumnetworks.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=john.mcnamara@intel.com \
    --cc=kamil.rytarowski@caviumnetworks.com \
    --cc=maciej.czekaj@caviumnetworks.com \
    --cc=rad@semihalf.com \
    --cc=slawomir.rosek@semihalf.com \
    --cc=zyta.szpak@semihalf.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).