DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ed Czeck <ed.czeck@atomicrules.com>
To: dev@dpdk.org
Cc: Ed Czeck <ed.czeck@atomicrules.com>,
	Shepard Siegel <shepard.siegel@atomicrules.com>,
	John Miller <john.miller@atomicrules.com>
Subject: [PATCH v1 5/5] net/ark: add PMD support for devices as virtual functions
Date: Fri,  6 May 2022 17:27:32 -0400	[thread overview]
Message-ID: <20220506212732.28504-5-ed.czeck@atomicrules.com> (raw)
In-Reply-To: <20220506212732.28504-1-ed.czeck@atomicrules.com>

Add capabilities field isvf to dev struct
Disable configuration calls as required by vf

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
---
 drivers/net/ark/ark_ethdev.c | 79 ++++++++++++++++++++----------------
 drivers/net/ark/ark_global.h |  1 +
 2 files changed, 45 insertions(+), 35 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 7cf896f6f1..fde94ee431 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -113,28 +113,29 @@ static const struct rte_pci_id pci_id_ark_map[] = {
  */
 struct ark_caps {
 	bool rqpacing;
+	bool isvf;
 };
 struct ark_dev_caps {
 	uint32_t  device_id;
 	struct ark_caps  caps;
 };
-#define SET_DEV_CAPS(id, rqp) \
-	{id, {.rqpacing = rqp} }
+#define SET_DEV_CAPS(id, rqp, vf)			\
+	{id, {.rqpacing = rqp, .isvf = vf} }
 
 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(0x101a, true),
-		     SET_DEV_CAPS(0x101b, true),
-		     SET_DEV_CAPS(0x101c, false),
-		     SET_DEV_CAPS(0x101e, false),
-		     SET_DEV_CAPS(0x101f, false),
+		     SET_DEV_CAPS(0x100d, true, false),
+		     SET_DEV_CAPS(0x100e, true, false),
+		     SET_DEV_CAPS(0x100f, true, false),
+		     SET_DEV_CAPS(0x1010, false, false),
+		     SET_DEV_CAPS(0x1017, true, false),
+		     SET_DEV_CAPS(0x1018, true, false),
+		     SET_DEV_CAPS(0x1019, true, false),
+		     SET_DEV_CAPS(0x101a, true, false),
+		     SET_DEV_CAPS(0x101b, true, false),
+		     SET_DEV_CAPS(0x101c, false, true),
+		     SET_DEV_CAPS(0x101e, false, false),
+		     SET_DEV_CAPS(0x101f, false, false),
 		     {.device_id = 0,}
 };
 
@@ -317,6 +318,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
 	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;
+			ark->isvf = ark_device_caps[p].caps.isvf;
 			break;
 		}
 		p++;
@@ -498,20 +500,21 @@ ark_config_device(struct rte_eth_dev *dev)
 	 * Make sure that the packet director, generator and checker are in a
 	 * known state
 	 */
-	ark->start_pg = 0;
-	ark->pg_running = 0;
-	ark->pg = ark_pktgen_init(ark->pktgen.v, 0, 1);
-	if (ark->pg == NULL)
-		return -1;
-	ark_pktgen_reset(ark->pg);
-	ark->pc = ark_pktchkr_init(ark->pktchkr.v, 0, 1);
-	if (ark->pc == NULL)
-		return -1;
-	ark_pktchkr_stop(ark->pc);
-	ark->pd = ark_pktdir_init(ark->pktdir.v);
-	if (ark->pd == NULL)
-		return -1;
-
+	if (!ark->isvf) {
+		ark->start_pg = 0;
+		ark->pg_running = 0;
+		ark->pg = ark_pktgen_init(ark->pktgen.v, 0, 1);
+		if (ark->pg == NULL)
+			return -1;
+		ark_pktgen_reset(ark->pg);
+		ark->pc = ark_pktchkr_init(ark->pktchkr.v, 0, 1);
+		if (ark->pc == NULL)
+			return -1;
+		ark_pktchkr_stop(ark->pc);
+		ark->pd = ark_pktdir_init(ark->pktdir.v);
+		if (ark->pd == NULL)
+			return -1;
+	}
 	/* Verify HW */
 	if (ark_udm_verify(ark->udm.v))
 		return -1;
@@ -533,7 +536,7 @@ ark_config_device(struct rte_eth_dev *dev)
 		mpu = RTE_PTR_ADD(mpu, ARK_MPU_QOFFSET);
 	}
 
-	if (ark->rqpacing)
+	if (!ark->isvf && ark->rqpacing)
 		ark_rqp_stats_reset(ark->rqpacing);
 
 	return 0;
@@ -551,8 +554,10 @@ eth_ark_dev_uninit(struct rte_eth_dev *dev)
 		ark->user_ext.dev_uninit(dev,
 			 ark->user_data[dev->data->port_id]);
 
-	ark_pktgen_uninit(ark->pg);
-	ark_pktchkr_uninit(ark->pc);
+	if (!ark->isvf) {
+		ark_pktgen_uninit(ark->pg);
+		ark_pktchkr_uninit(ark->pc);
+	}
 
 	return 0;
 }
@@ -588,10 +593,10 @@ eth_ark_dev_start(struct rte_eth_dev *dev)
 	dev->rx_pkt_burst = &eth_ark_recv_pkts;
 	dev->tx_pkt_burst = &eth_ark_xmit_pkts;
 
-	if (ark->start_pg)
+	if (!ark->isvf && ark->start_pg)
 		ark_pktchkr_run(ark->pc);
 
-	if (ark->start_pg && !ark->pg_running) {
+	if (!ark->isvf && ark->start_pg && !ark->pg_running) {
 		pthread_t thread;
 
 		/* Delay packet generatpr start allow the hardware to be ready
@@ -635,7 +640,7 @@ eth_ark_dev_stop(struct rte_eth_dev *dev)
 		       ark->user_data[dev->data->port_id]);
 
 	/* Stop the packet generator */
-	if (ark->start_pg && ark->pg_running) {
+	if (!ark->isvf && ark->start_pg && ark->pg_running) {
 		ark_pktgen_pause(ark->pg);
 		ark->pg_running = 0;
 	}
@@ -661,7 +666,7 @@ eth_ark_dev_stop(struct rte_eth_dev *dev)
 		eth_ark_rx_dump_queue(dev, i, __func__);
 
 	/* Stop the packet checker if it is running */
-	if (ark->start_pg) {
+	if (!ark->isvf && ark->start_pg) {
 		ark_pktchkr_dump_stats(ark->pc);
 		ark_pktchkr_stop(ark->pc);
 	}
@@ -974,6 +979,10 @@ eth_ark_check_args(struct ark_adapter *ark, const char *params)
 		goto free_kvlist;
 	}
 
+	if (ark->isvf) {
+		ret = 0;
+		goto free_kvlist;
+	}
 	ARK_PMD_LOG(INFO, "packet director set to 0x%x\n", ark->pkt_dir_v);
 	/* Setup the packet director */
 	ark_pktdir_setup(ark->pd, ark->pkt_dir_v);
diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h
index 3c3a712bc8..748db590c1 100644
--- a/drivers/net/ark/ark_global.h
+++ b/drivers/net/ark/ark_global.h
@@ -113,6 +113,7 @@ struct ark_adapter {
 	ark_pkt_dir_t pd;
 
 	int num_ports;
+	bool isvf;
 
 	/* Packet generator/checker args */
 	char pkt_gen_args[ARK_MAX_ARG_LEN];
-- 
2.17.1


  parent reply	other threads:[~2022-05-06 21:28 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-02 21:22 [PATCH 1/4] net/ark: update mpu code to match current hardware version Ed Czeck
2022-05-02 21:22 ` [PATCH 2/4] net/ark: update ddm " Ed Czeck
2022-05-02 21:22 ` [PATCH 3/4] net/ark: update udm " Ed Czeck
2022-05-02 21:22 ` [PATCH 4/4] net/ark: add new devices to support list Ed Czeck
2022-05-05 15:37 ` [PATCH v1 1/5] net/ark: update mpu code to match current hardware version Ed Czeck
2022-05-05 15:37   ` [PATCH v1 2/5] net/ark: update ddm " Ed Czeck
2022-05-05 15:37   ` [PATCH v1 3/5] net/ark: update udm " Ed Czeck
2022-05-05 15:37   ` [PATCH v1 4/5] net/ark: add new devices to support list Ed Czeck
2022-05-05 15:37   ` [PATCH v1 5/5] net/ark: add PMD support for devices as virtual functions Ed Czeck
2022-05-06 21:27 ` [PATCH v1 1/5] net/ark: update mpu code to match current hardware version Ed Czeck
2022-05-06 21:27   ` [PATCH v1 2/5] net/ark: update ddm " Ed Czeck
2022-05-06 21:27   ` [PATCH v1 3/5] net/ark: update udm " Ed Czeck
2022-05-06 21:27   ` [PATCH v1 4/5] net/ark: add new devices to support list Ed Czeck
2022-05-06 21:27   ` Ed Czeck [this message]
2022-05-18 12:56     ` [PATCH v1 5/5] net/ark: add PMD support for devices as virtual functions Ferruh Yigit
2022-05-18 12:54   ` [PATCH v1 1/5] net/ark: update mpu code to match current hardware version Ferruh Yigit
2022-05-19 10:13     ` Kevin Traynor
2022-05-19 21:36 ` [PATCH v2 1/7] devtools: add Atomic Rules acronyms for commit checks Ed Czeck
2022-05-19 21:36   ` [PATCH v2 2/7] net/ark: update MPU functions for firmware update Ed Czeck
2022-05-19 21:36   ` [PATCH v2 3/7] net/ark: update DDM " Ed Czeck
2022-05-19 21:36   ` [PATCH v2 4/7] net/ark: update UDM " Ed Czeck
2022-05-19 21:36   ` [PATCH v2 5/7] net/ark: report additional errors from firmware Ed Czeck
2022-05-19 21:36   ` [PATCH v2 6/7] net/ark: add new devices to support list Ed Czeck
2022-05-20  8:14     ` Andrew Rybchenko
2022-05-19 21:36   ` [PATCH v2 7/7] net/ark: add PMD support for devices as virtual functions Ed Czeck
2022-05-20 14:15 ` [PATCH v2 1/7] devtools: add Atomic Rules acronyms for commit checks Ed Czeck
2022-05-20 14:15   ` [PATCH v2 2/7] net/ark: update MPU functions for firmware update Ed Czeck
2022-05-23 14:39     ` Ferruh Yigit
2022-05-20 14:15   ` [PATCH v2 3/7] net/ark: update DDM " Ed Czeck
2022-05-20 14:15   ` [PATCH v2 4/7] net/ark: update UDM " Ed Czeck
2022-05-20 14:15   ` [PATCH v2 5/7] net/ark: report additional errors from firmware Ed Czeck
2022-05-20 14:15   ` [PATCH v2 6/7] net/ark: add new devices to support list Ed Czeck
2022-05-20 14:15   ` [PATCH v2 7/7] net/ark: add PMD support for devices as virtual functions Ed Czeck
2022-05-23 14:38     ` Ferruh Yigit
2022-06-07 15:49 ` [PATCH v3 1/7] devtools: add Atomic Rules acronyms for commit checks Ed Czeck
2022-06-07 15:49   ` [PATCH v3 2/7] net/ark: update MPU functions for firmware update Ed Czeck
2022-06-07 15:49   ` [PATCH v3 3/7] net/ark: update DDM " Ed Czeck
2022-06-07 15:49   ` [PATCH v3 4/7] net/ark: update UDM " Ed Czeck
2022-06-07 15:49   ` [PATCH v3 5/7] net/ark: report additional errors from firmware Ed Czeck
2022-06-07 15:49   ` [PATCH v3 6/7] net/ark: add new devices to support list Ed Czeck
2022-06-07 15:49   ` [PATCH v3 7/7] net/ark: add PMD support for devices as virtual functions Ed Czeck
2022-06-07 21:31 ` [PATCH v4 1/7] devtools: add Atomic Rules acronyms for commit checks Ed Czeck
2022-06-07 21:31   ` [PATCH v4 2/7] net/ark: update MPU functions for firmware update Ed Czeck
2022-06-07 21:31   ` [PATCH v4 3/7] net/ark: update DDM " Ed Czeck
2022-06-07 21:31   ` [PATCH v4 4/7] net/ark: update UDM " Ed Czeck
2022-06-07 21:31   ` [PATCH v4 5/7] net/ark: report additional errors from firmware Ed Czeck
2022-06-07 21:31   ` [PATCH v4 6/7] net/ark: add new devices to support list Ed Czeck
2022-06-07 21:31   ` [PATCH v4 7/7] net/ark: add PMD support for devices as virtual functions Ed Czeck
2022-06-08  8:41   ` [PATCH v4 1/7] devtools: add Atomic Rules acronyms for commit checks Ferruh Yigit

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=20220506212732.28504-5-ed.czeck@atomicrules.com \
    --to=ed.czeck@atomicrules.com \
    --cc=dev@dpdk.org \
    --cc=john.miller@atomicrules.com \
    --cc=shepard.siegel@atomicrules.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).