From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 52F65A0096 for ; Mon, 3 Jun 2019 19:41:03 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B7CEF1BA46; Mon, 3 Jun 2019 19:37:15 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 12B511BB72 for ; Mon, 3 Jun 2019 19:37:13 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x53HbDQY014322; Mon, 3 Jun 2019 10:37:13 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=4g/jX3/ue+O6MBYSgVhpI1l1tNoULdHCY7A5t3lOtRo=; b=r5WanS+G1ShBxBgFmy+OHKr8AA1r3JrH1vaG3PyjLewEGS6aNGCGuAym/wciD0VUbseW rkNzJllQ0cjgBmh3ViI4AXLjSXNDUo37LUYaH0VOShCk5vkCZqSQeoMng5hDN7kUfpyh zYK79ygA901NK7xN8+28D3xk5fVMEfPBaCdRrqQguZQx+5RYmkY9VhEumTjwk70bJdeL 2ttEQHf5eZPe2sxuxsPZpVy0prjx+aoMisOUvTROR1gGcSsK+twyv3hN08Z6rbLvsBXB VwBpzbzTGnkgWhlR2Ek/PrVZN1Ff1Co3NxoXUeip3u4vs22RpgK9Uh/KIrNt4LcK9Qqx gQ== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2sw2wmhdx8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2019 10:37:13 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 3 Jun 2019 10:37:07 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 3 Jun 2019 10:37:07 -0700 Received: from ajoseph83.caveonetworks.com.com (unknown [10.29.45.56]) by maili.marvell.com (Postfix) with ESMTP id 623E83F7044; Mon, 3 Jun 2019 10:37:02 -0700 (PDT) From: Anoob Joseph To: Jerin Jacob , Nikhil Rao , "Erik Gabriel Carrillo" , Abhinandan Gujjar , Bruce Richardson , Pablo de Lara CC: Anoob Joseph , Narayana Prasad , , Lukasz Bartosik , Pavan Nikhilesh , Hemant Agrawal , "Nipun Gupta" , Harry van Haaren , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= , Liang Ma Date: Mon, 3 Jun 2019 23:02:37 +0530 Message-ID: <1559583160-13944-38-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1559583160-13944-1-git-send-email-anoobj@marvell.com> References: <1559583160-13944-1-git-send-email-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-03_14:, , signatures=0 Subject: [dpdk-dev] [PATCH 37/39] examples/l2fwd-event: add eventmode 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Adding non-burst Tx internal-port eventmode worker. Signed-off-by: Anoob Joseph Signed-off-by: Lukasz Bartosik --- examples/l2fwd-event/l2fwd_worker.c | 164 +++++++++++++++++++++++++++++++++++- 1 file changed, 163 insertions(+), 1 deletion(-) diff --git a/examples/l2fwd-event/l2fwd_worker.c b/examples/l2fwd-event/l2fwd_worker.c index 92eae02..0a413a4 100644 --- a/examples/l2fwd-event/l2fwd_worker.c +++ b/examples/l2fwd-event/l2fwd_worker.c @@ -315,7 +315,7 @@ l2fwd_poll_mode_worker(void) */ /* Workers registered */ -#define L2FWD_EVENTMODE_WORKERS 1 +#define L2FWD_EVENTMODE_WORKERS 2 /* * Event mode worker @@ -486,6 +486,159 @@ l2fwd_eventmode_non_burst_no_internal_port(void *args) rte_free(links); } +/* + * Event mode worker + * Operating mode : non-burst tx internal port + */ +static void +l2fwd_eventmode_non_burst_tx_internal_port(void *args) +{ + struct rte_event ev; + struct rte_mbuf *pkt; + struct rte_eventmode_helper_conf *mode_conf; + struct rte_eventmode_helper_event_link_info *links = NULL; + unsigned int lcore_nb_link = 0; + uint32_t lcore_id; + unsigned int i, nb_rx = 0; + unsigned int portid; + struct lcore_queue_conf *qconf; + int is_master_core; + struct tsc_tracker tsc = {0}; + + /* Get core ID */ + lcore_id = rte_lcore_id(); + + RTE_LOG(INFO, L2FWD, + "Launching event mode non-burst worker internal port " + "on lcore %d\n", lcore_id); + + /* Set the flag if master core */ + is_master_core = (lcore_id == rte_get_master_lcore()) ? 1 : 0; + + /* Get qconf for this core */ + qconf = &lcore_queue_conf[lcore_id]; + + /* Set drain tsc */ + tsc.drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) / + US_PER_S * BURST_TX_DRAIN_US; + + /* Mode conf will be passed as args */ + mode_conf = (struct rte_eventmode_helper_conf *)args; + + /* Get the links configured for this lcore */ + lcore_nb_link = rte_eventmode_helper_get_event_lcore_links(lcore_id, + mode_conf, &links); + + /* Check if we have links registered for this lcore */ + if (lcore_nb_link == 0) { + /* No links registered. The core could do periodic drains */ + l2fwd_drain_loop(qconf, &tsc, is_master_core); + goto clean_and_exit; + } + + /* We have valid links */ + + /* Reset stats before proceeding */ + reset_eth_stats(is_master_core); + + /* See if it's single link */ + if (lcore_nb_link == 1) + goto single_link_loop; + else + goto multi_link_loop; + +single_link_loop: + + RTE_LOG(INFO, L2FWD, " -- lcoreid=%u event_port_id=%u\n", lcore_id, + links[0].event_portid); + + while (!force_quit) { + + /* Do periodic operations (buffer drain & stats monitor) */ + l2fwd_periodic_drain_stats_monitor(qconf, &tsc, is_master_core); + + /* Read packet from event queues */ + nb_rx = rte_event_dequeue_burst(links[0].eventdev_id, + links[0].event_portid, + &ev, /* events */ + 1, /* nb_events */ + 0 /* timeout_ticks */); + + if (nb_rx == 0) + continue; + + portid = ev.queue_id; + port_statistics[portid].rx++; + pkt = ev.mbuf; + + rte_prefetch0(rte_pktmbuf_mtod(pkt, void *)); + + /* Process packet */ + l2fwd_event_pre_forward(&ev, portid); + + /* + * Since tx internal port is available, events can be + * directly enqueued to the adapter and it would be + * internally submitted to the eth device. + */ + rte_event_eth_tx_adapter_enqueue(links[0].eventdev_id, + links[0].event_portid, + &ev, /* events */ + 1 /* nb_events */); + } + goto clean_and_exit; + +multi_link_loop: + + for (i = 0; i < lcore_nb_link; i++) { + RTE_LOG(INFO, L2FWD, " -- lcoreid=%u event_port_id=%u\n", + lcore_id, links[i].event_portid); + } + + while (!force_quit) { + + /* Do periodic operations (buffer drain & stats monitor) */ + l2fwd_periodic_drain_stats_monitor(qconf, &tsc, is_master_core); + + for (i = 0; i < lcore_nb_link; i++) { + /* Read packet from event queues */ + nb_rx = rte_event_dequeue_burst(links[i].eventdev_id, + links[i].event_portid, + &ev, /* events */ + 1, /* nb_events */ + 0 /* timeout_ticks */); + + if (nb_rx == 0) + continue; + + portid = ev.queue_id; + port_statistics[portid].rx++; + pkt = ev.mbuf; + + rte_prefetch0(rte_pktmbuf_mtod(pkt, void *)); + + /* Process packet */ + l2fwd_event_pre_forward(&ev, portid); + + /* + * Since tx internal port is available, events can be + * directly enqueued to the adapter and it would be + * internally submitted to the eth device. + */ + rte_event_eth_tx_adapter_enqueue(links[i].eventdev_id, + links[i].event_portid, + &ev, /* events */ + 1 /* nb_events */); + + } + } + goto clean_and_exit; + +clean_and_exit: + if (links != NULL) + rte_free(links); +} + static uint8_t l2fwd_eventmode_populate_wrkr_params( struct rte_eventmode_helper_app_worker_params *wrkrs) @@ -503,6 +656,15 @@ l2fwd_eventmode_populate_wrkr_params( wrkr->worker_thread = l2fwd_eventmode_non_burst_no_internal_port; nb_wrkr_param++; + wrkr++; + + /* Non-burst tx internal port */ + wrkr->cap.burst = RTE_EVENTMODE_HELPER_RX_TYPE_NON_BURST; + wrkr->cap.tx_internal_port = + RTE_EVENTMODE_HELPER_TX_TYPE_INTERNAL_PORT; + wrkr->worker_thread = l2fwd_eventmode_non_burst_tx_internal_port; + + nb_wrkr_param++; return nb_wrkr_param; } -- 2.7.4