From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0045.outbound.protection.outlook.com [104.47.42.45]) by dpdk.org (Postfix) with ESMTP id A848D1B169 for ; Wed, 10 Jan 2018 12:10:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=tWMY4rdrIXGtxfO7/KACQtN5r8tWcj49WJAqXKScU0g=; b=aZkpiqE4QOsTEbxSnieeAgbuSEp0iJ2JYbIOxUAiNjyUAx0yEhHDRXd8s0f5BgK0y804/gKqAqQSbzUe1erGo3to7b2PpXTDLN2wYDAgj1Rekfc2KccSsSAIAlk2PqNYdfZREyolXDiUYUgvlje2cldYuwsO8AolMcuxp20REGk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from Pavan-LT.caveonetworks.com (111.93.218.67) by MWHPR07MB3469.namprd07.prod.outlook.com (10.164.192.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Wed, 10 Jan 2018 11:10:52 +0000 From: Pavan Nikhilesh To: gage.eads@intel.com, jerin.jacobkollanukkaran@cavium.com, harry.van.haaren@intel.com, hemant.agrawal@nxp.com, liang.j.ma@intel.com, santosh.shukla@caviumnetworks.com Cc: dev@dpdk.org, Pavan Nikhilesh Date: Wed, 10 Jan 2018 16:40:04 +0530 Message-Id: <20180110111013.14644-6-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180110111013.14644-1-pbhagavatula@caviumnetworks.com> References: <20171207203705.25020-1-pbhagavatula@caviumnetworks.com> <20180110111013.14644-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: CY4PR1701CA0010.namprd17.prod.outlook.com (10.171.208.20) To MWHPR07MB3469.namprd07.prod.outlook.com (10.164.192.20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 85ccd909-9a4b-437e-d0ed-08d5581ad190 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603307)(7153060)(7193020); SRVR:MWHPR07MB3469; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3469; 3:Yzia8QrMqji+NoPXTCAe7q5VyyWeN/g279WbBwCs//LptLBluUZe4twujJA7b4IkLFrBBe0xXU0sD58lhnWsoFoIWG3+U8V5qH9VuGGcKYRLqIe2QRff8PzPGlrdJK1jtb88pcaTFO72Kh8UrAaqyJXhHSFl72eoIXU1iqIu5N375cYPSWB26bR6On77fFljWEOuJ+iLde/W7oh92WslgA5U94TOzg2Cd4KzyNTShVMSJ1CYluGrjxqejYWAoEzA; 25:Ji713OK2Bfz9VX/s0ObevwIqVrE4fGNApqK1E/UYJscqTlVU8RuCl0Uj39aALBhxQCvdaOGckon5+Btw/vdNj6bSnwAEC7bxsUs5ffPM0NrUInqz//lijfjTij5VxdDmx5L0osQKrIjjIXB0V5R4sTo/cjpT6t6OVNFEzS7wcASJm5l9N0TdLSs/ipfStSpMlMG0UOfh0WMbqdgtsN8pXgP9CJIGbfUcgsJ7IBjmeJRdTr3XOSZuou2QFcgtK+wGloQXju3NRZQzIXDDwneNzJk2DDnThY6PTixe/i95kufRNZ75JkbbZK5cEB+TNCsRuT8VSUm0Nw+cZ4Lc5FzdSg==; 31:tjd2b7OpoeXm3rlqeXAasS4wIi6pALGZU41Z+6L4kVlgaAcvMiHzgU/2swhh6gaj1gwLzSzfVci+XzIeAcVatfCr9ZQ37tUkzK0HedP4tHfaFq3Az8y9Vq2nbMH75gPnW5t2nkW6xLYuoFFJlMBqitTpYcw5IQdzbWF49uozIYvDNpFE1nAZ6qozWVhHebskSfiikBQLCvHZeCwJD0lDZoRhoYu+g4MWlmTxrP6Y6i8= X-MS-TrafficTypeDiagnostic: MWHPR07MB3469: X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3469; 20:Zm9X7XwlZ07SIlba2kF/qRIKo0sdm1u4uxtIH9qbehLmVwXns1sMVvRgyKFkpzT0gmeX97WZb3+oGhYXjGOZPh+gzvo3qMwpONwv5I7o78Gg0OtnXkUVQRp6lk4dzTcsRBZaYF6GTPbnoFZ9RLja1gHHsXN2VCOf50aphCM/+NZTvb4c25UANzP9ojQqr9LUag7oWQ73RSIzWGTvr4ah45crWG20lHGhuG4qobI9VOUm5GJaFPaSExghPe7Jluh+fXYi5eE4RXdW7E1zh4i3wJKqYvBkukOvpVSKoRYdibSruvfIahC1tdwARHT1MKbn9AnPPez5k3PJVf/vVn4/oi47bTUre3fNXl3rPM4HmAcpQXCh21MGFgrE1gUyC4XTzKc2yi+n/88jILZpDcOEaU74CWvNT1WJOxV5qfX7XMOVR0+seZaKqpZfX24uuFErzAfeEO6FZFsiqlz2uq/hTx+q6TyupNacqRY+PfnrlDdvNR7CjnT7QK7a2tM7CD/Okwz7LE+NZpHOv36Jo5AS6nV56O0J6wSdcuk9c1l4UZ9hUIYeV2Yp10KNB6y9RMsVIxU/w4dWGp359kn7WuNtcF63AsOwfqZA8CPNR1GQmf8=; 4:JcCbbNzHB0Nek0DhaVz1LcEfB6kHDXtyLLCR4LYzR9JI0Z/3kGDs7Ej3KnXKOpIcFH63Gg+DeYnG0iFALy8FCPcycDBdiU3kx6FGJF1PNowzGyOxASzSmKqVql2GYHIVa/q2SG1TzEJqq2vrFpreNeJocSsI7EJ6FwVbBSQJ5f0HAdzKKGDjDGGHgZjI+X+M5Hhl3wVU9ke/sSzg1fythkOKbTzY/tRI11OcFyQQjXV9KBrL7sqCq7V9zk4IFTkzcys529Nn3WTQvshllhDNyA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(3002001)(93006095)(10201501046)(3231023)(944501075)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123564045)(20161123562045)(6072148)(201708071742011); SRVR:MWHPR07MB3469; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:MWHPR07MB3469; X-Forefront-PRVS: 0548586081 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39380400002)(376002)(346002)(396003)(39860400002)(199004)(189003)(4326008)(8656006)(81156014)(316002)(81166006)(5009440100003)(53416004)(50466002)(50226002)(16586007)(8936002)(16526018)(47776003)(68736007)(66066001)(48376002)(36756003)(69596002)(25786009)(107886003)(575784001)(42882006)(2950100002)(106356001)(5660300001)(51416003)(52116002)(386003)(53936002)(6636002)(6666003)(105586002)(97736004)(305945005)(7736002)(8676002)(6116002)(3846002)(2906002)(478600001)(72206003)(6512007)(76176011)(6486002)(6506007)(1076002)(41533002)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR07MB3469; H:Pavan-LT.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR07MB3469; 23:IF0QzHFOsNqKXGJMdxOzj7NKyBdgaUzJSlR8N6PGU?= =?us-ascii?Q?l8w8enDKeuzYIKf2PkEiBijEfDJ9aJDK+qf9j9V4p+24tJEBMcWc6rbiSGtB?= =?us-ascii?Q?2AsT1ekJ0n8wZL0D2t6oBd6NqXYZj3NI55mzainGAg0hA9CPFmwgQ2MT6jG1?= =?us-ascii?Q?uGBKnSd6ttuPLoJqOscheSzq8EuSpo+IhyEsXfH47ZDu8ae7BFNOYHqogUTW?= =?us-ascii?Q?9xgyiU3OKQywLdAHmtpZf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JY6F9kJvUQT66BTc0HdCr3bO1az7HXNCPoWzFqjEcKXxUPcIc9+yWdYQgJGNotgWi/ZwcesfmXRrzSRzHvONvd SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2018 11:10:52.4240 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 85ccd909-9a4b-437e-d0ed-08d5581ad190 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3469 Subject: [dpdk-dev] [PATCH v2 06/15] examples/eventdev: add non burst mode generic worker X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 11:10:57 -0000 Currently, worker uses burst dequeue and burst enqueue to forward events. Add a non burst mode based on the event dev capabilities. Signed-off-by: Pavan Nikhilesh --- examples/eventdev_pipeline_sw_pmd/main.c | 12 +- .../pipeline_worker_generic.c | 126 ++++++++++++++++++++- 2 files changed, 133 insertions(+), 5 deletions(-) diff --git a/examples/eventdev_pipeline_sw_pmd/main.c b/examples/eventdev_pipeline_sw_pmd/main.c index 9e6061643..947c5f786 100644 --- a/examples/eventdev_pipeline_sw_pmd/main.c +++ b/examples/eventdev_pipeline_sw_pmd/main.c @@ -382,8 +382,16 @@ static void do_capability_setup(uint16_t nb_ethdev, uint8_t eventdev_id) { RTE_SET_USED(nb_ethdev); - RTE_SET_USED(eventdev_id); - set_worker_generic_setup_data(&fdata->cap, 1); + uint8_t burst = 0; + + struct rte_event_dev_info eventdev_info; + memset(&eventdev_info, 0, sizeof(struct rte_event_dev_info)); + + rte_event_dev_info_get(eventdev_id, &eventdev_info); + burst = eventdev_info.event_dev_cap & RTE_EVENT_DEV_CAP_BURST_MODE ? 1 : + 0; + + set_worker_generic_setup_data(&fdata->cap, burst); } static void diff --git a/examples/eventdev_pipeline_sw_pmd/pipeline_worker_generic.c b/examples/eventdev_pipeline_sw_pmd/pipeline_worker_generic.c index d1b0e1db1..f4523902b 100644 --- a/examples/eventdev_pipeline_sw_pmd/pipeline_worker_generic.c +++ b/examples/eventdev_pipeline_sw_pmd/pipeline_worker_generic.c @@ -6,6 +6,59 @@ #include "pipeline_common.h" +static __rte_always_inline int +worker_generic(void *arg) +{ + struct rte_event ev; + + struct worker_data *data = (struct worker_data *)arg; + uint8_t dev_id = data->dev_id; + uint8_t port_id = data->port_id; + size_t sent = 0, received = 0; + unsigned int lcore_id = rte_lcore_id(); + + while (!fdata->done) { + + if (fdata->cap.scheduler) + fdata->cap.scheduler(lcore_id); + + if (!fdata->worker_core[lcore_id]) { + rte_pause(); + continue; + } + + const uint16_t nb_rx = rte_event_dequeue_burst(dev_id, port_id, + &ev, 1, 0); + + if (nb_rx == 0) { + rte_pause(); + continue; + } + received++; + + /* The first worker stage does classification */ + if (ev.queue_id == cdata.qid[0]) + ev.flow_id = ev.mbuf->hash.rss + % cdata.num_fids; + + ev.queue_id = cdata.next_qid[ev.queue_id]; + ev.op = RTE_EVENT_OP_FORWARD; + ev.sched_type = cdata.queue_type; + + work(ev.mbuf); + + while (rte_event_enqueue_burst(dev_id, port_id, &ev, 1) != 1) + rte_pause(); + sent++; + } + + if (!cdata.quiet) + printf(" worker %u thread done. RX=%zu TX=%zu\n", + rte_lcore_id(), received, sent); + + return 0; +} + static int worker_generic_burst(void *arg) { @@ -66,6 +119,69 @@ worker_generic_burst(void *arg) return 0; } +static __rte_always_inline int +consumer(void) +{ + const uint64_t freq_khz = rte_get_timer_hz() / 1000; + struct rte_event packet; + + static uint64_t received; + static uint64_t last_pkts; + static uint64_t last_time; + static uint64_t start_time; + int i; + uint8_t dev_id = cons_data.dev_id; + uint8_t port_id = cons_data.port_id; + + do { + uint16_t n = rte_event_dequeue_burst(dev_id, port_id, + &packet, 1, 0); + + if (n == 0) { + for (i = 0; i < rte_eth_dev_count(); i++) + rte_eth_tx_buffer_flush(i, 0, fdata->tx_buf[i]); + return 0; + } + if (start_time == 0) + last_time = start_time = rte_get_timer_cycles(); + + received++; + uint8_t outport = packet.mbuf->port; + + rte_eth_tx_buffer(outport, 0, fdata->tx_buf[outport], + packet.mbuf); + + if (cons_data.release) + rte_event_enqueue_burst(dev_id, port_id, + &packet, n); + + /* Print out mpps every 1<22 packets */ + if (!cdata.quiet && received >= last_pkts + (1<<22)) { + const uint64_t now = rte_get_timer_cycles(); + const uint64_t total_ms = (now - start_time) / freq_khz; + const uint64_t delta_ms = (now - last_time) / freq_khz; + uint64_t delta_pkts = received - last_pkts; + + printf("# %s RX=%"PRIu64", time %"PRIu64 "ms, " + "avg %.3f mpps [current %.3f mpps]\n", + __func__, + received, + total_ms, + received / (total_ms * 1000.0), + delta_pkts / (delta_ms * 1000.0)); + last_pkts = received; + last_time = now; + } + + cdata.num_packets--; + if (cdata.num_packets <= 0) + fdata->done = 1; + /* Be stuck in this loop if single. */ + } while (!fdata->done && fdata->tx_single); + + return 0; +} + static __rte_always_inline int consumer_burst(void) { @@ -430,9 +546,13 @@ generic_opt_check(void) void set_worker_generic_setup_data(struct setup_data *caps, bool burst) { - RTE_SET_USED(burst); - caps->consumer = consumer_burst; - caps->worker = worker_generic_burst; + if (burst) { + caps->consumer = consumer_burst; + caps->worker = worker_generic_burst; + } else { + caps->consumer = consumer; + caps->worker = worker_generic; + } caps->adptr_setup = init_rx_adapter; caps->scheduler = schedule_devices; -- 2.15.1