DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v2] net/ark: support multi-port pkt generation
       [not found] <20220226124454.68600-ed.czeck@atomicrules.com>
@ 2022-03-02 19:26 ` John Miller
  2022-03-03 12:00   ` Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: John Miller @ 2022-03-02 19:26 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: shepard.siegel, John Miller

Added support for packet generation in
multi-port Arkville implementations. The packet
generator is a singleton within the device but is
capable of generating packets for any port within
one device.

Signed-off-by: John Miller <john.miller@atomicrules.com>

---
v2:
- Incorporated changes from Ferruh's comments.
---
 drivers/net/ark/ark_ethdev.c | 14 +++++++++++---
 drivers/net/ark/ark_global.h |  1 +
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 51b9e04701..76b88c62d0 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -493,6 +493,7 @@ ark_config_device(struct rte_eth_dev *dev)
 	 * 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;
@@ -607,18 +608,23 @@ eth_ark_dev_start(struct rte_eth_dev *dev)
 	if (ark->start_pg)
 		ark_pktchkr_run(ark->pc);
 
-	if (ark->start_pg && (dev->data->port_id == 0)) {
+	if (ark->start_pg && !ark->pg_running) {
 		pthread_t thread;
 
 		/* Delay packet generatpr start allow the hardware to be ready
 		 * This is only used for sanity checking with internal generator
 		 */
-		if (rte_ctrl_thread_create(&thread, "ark-delay-pg", NULL,
+		char tname[32];
+		snprintf(tname, sizeof(tname), "ark-delay-pg-%d",
+			 dev->data->port_id);
+
+		if (rte_ctrl_thread_create(&thread, tname, NULL,
 					   ark_pktgen_delay_start, ark->pg)) {
 			ARK_PMD_LOG(ERR, "Could not create pktgen "
 				    "starter thread\n");
 			return -1;
 		}
+		ark->pg_running = 1;
 	}
 
 	if (ark->user_ext.dev_start)
@@ -647,8 +653,10 @@ eth_ark_dev_stop(struct rte_eth_dev *dev)
 		       ark->user_data[dev->data->port_id]);
 
 	/* Stop the packet generator */
-	if (ark->start_pg)
+	if (ark->start_pg && ark->pg_running) {
 		ark_pktgen_pause(ark->pg);
+		ark->pg_running = 0;
+	}
 
 	dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
 	dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h
index 49193ac5b3..3c3a712bc8 100644
--- a/drivers/net/ark/ark_global.h
+++ b/drivers/net/ark/ark_global.h
@@ -107,6 +107,7 @@ struct ark_adapter {
 
 	/* Pointers to packet generator and checker */
 	int start_pg;
+	uint16_t pg_running;
 	ark_pkt_gen_t pg;
 	ark_pkt_chkr_t pc;
 	ark_pkt_dir_t pd;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] net/ark: support multi-port pkt generation
  2022-03-02 19:26 ` [PATCH v2] net/ark: support multi-port pkt generation John Miller
@ 2022-03-03 12:00   ` Ferruh Yigit
  0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2022-03-03 12:00 UTC (permalink / raw)
  To: John Miller, dev; +Cc: shepard.siegel

On 3/2/2022 7:26 PM, John Miller wrote:
> Added support for packet generation in
> multi-port Arkville implementations. The packet
> generator is a singleton within the device but is
> capable of generating packets for any port within
> one device.
> 
> Signed-off-by: John Miller<john.miller@atomicrules.com>

Applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-03 12:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20220226124454.68600-ed.czeck@atomicrules.com>
2022-03-02 19:26 ` [PATCH v2] net/ark: support multi-port pkt generation John Miller
2022-03-03 12:00   ` Ferruh Yigit

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).