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 25501A04A9; Wed, 2 Mar 2022 20:27:20 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 15FF24274D; Wed, 2 Mar 2022 20:27:20 +0100 (CET) Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by mails.dpdk.org (Postfix) with ESMTP id A81C540141 for ; Wed, 2 Mar 2022 20:27:18 +0100 (CET) Received: by mail-pl1-f182.google.com with SMTP id e13so2449753plh.3 for ; Wed, 02 Mar 2022 11:27:18 -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=CcrkV2yDIKMNvGpBAYtaoByAS4EaJFEN/g04/eJOWns=; b=MhyjP6cwhuo0kxYjo5IRm4XgYamY7hLoLBPDN9LmlOpxTfXUuNcwCXqwN2eP5lA5LO Uu4RiH912E50IlkDaTFmiJi5DTue6KsPhTqznt9PCzIoHU93hVMezl1DL7fM7uPmoEFq jzRVzJY6k2riv94XZBjiO56vH5DLo19KUeoT/YDG4kLOcUPmyw/oo9y2Cid226UzwAmz LfEhep8Q+6vE6VV7EPZ3nVRkW/XrYAV8N5QM1kmOBZYBHLoNQ2pFkXrnxpIN0f7ORhHZ kMKqD4ZkTvkKok/u/WXK2cwXsjkaw5d+/ZBWIvc2FQHx/VSA8VRTXKyT5aloF7e9/2XZ CMpw== 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=CcrkV2yDIKMNvGpBAYtaoByAS4EaJFEN/g04/eJOWns=; b=b2R56slwMXV0XRLG7L1nM8YPfA6/Qwe4LLRYdmVnigVb8sPOItsixA0wU4yApboqVt j3BB31XWIqVV4fgyvaIjyw7BcmLVBm4p5n+L8fhOp+tPBwOCA4nK6jlGHXQ/wHVQ/0Ku 59TsddII3TvCRB+BogXiEi8C6ixUVna7eZCjQzHDdybYwFzRPOOIRXg0f/CD8N5xzVCq tcEK2Ew9PFqHcLRbaC34g/FPOET69DZfEP80AoTJZS1y7wKS3kRAxgsx6rLhv3BY59jK AGUEHPFEQ/HrWIxkD86LP/3G8hxVp1y7wKzjdxYkG3+oBu7Zrhmc9uWnFRuQ/brVZqVL ZRlA== X-Gm-Message-State: AOAM533FFqX6Gk9KrOD72ksD1N89r5Zv0qoL77H9i8tAQZ5GRhnhHwMA +wcZrncao7peQxVtfqqb0T5lzEDcvaYLOQ== X-Google-Smtp-Source: ABdhPJydv2nYvvAGYLjYi0E1rK2oGBe8XWkfaiX/PdHbajFDivpKHdey8/why/OsGGNDhvBTYKOg5Q== X-Received: by 2002:a17:902:9a46:b0:14e:ea0f:28cf with SMTP id x6-20020a1709029a4600b0014eea0f28cfmr32923649plv.43.1646249237674; Wed, 02 Mar 2022 11:27:17 -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 nl12-20020a17090b384c00b001bc1bb5449bsm6609915pjb.2.2022.03.02.11.27.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 11:27:17 -0800 (PST) From: John Miller To: dev@dpdk.org, ferruh.yigit@intel.com Cc: shepard.siegel@atomicrules.com, John Miller Subject: [PATCH v2] net/ark: support multi-port pkt generation Date: Wed, 2 Mar 2022 13:26:47 -0600 Message-Id: <20220302192647.374934-1-john.miller@atomicrules.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220226124454.68600-ed.czeck@atomicrules.com> References: <20220226124454.68600-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 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 --- 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