From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0083.outbound.protection.outlook.com [104.47.42.83]) by dpdk.org (Postfix) with ESMTP id 7D5411D080 for ; Fri, 8 Jun 2018 19:25:52 +0200 (CEST) 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:X-MS-Exchange-SenderADCheck; bh=22MD7jH5Iu1YHBs65tMYGIwS0Rl3u6jzmJPCZWHr5JE=; b=Fz0ibpmqfPGI9htok0wD7CzAKL6GbfM9FuNOkx4uKlqk0gL1anpOP0sZ7RoHRGAzzowBm7VnVpw60vEGOZDsxNlYR6rtJzjC+DwoYQzaAcLzXMf9DRMwKVn2bJR9t1nTYsEjykItXWLpjpNIuFXLtTke8kMJDee1CFZj4Ld+Xfo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; Received: from ajoseph83.caveonetworks.com.caveonetworks.com (115.113.156.2) by DM6PR07MB4906.namprd07.prod.outlook.com (2603:10b6:5:a3::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.17; Fri, 8 Jun 2018 17:25:48 +0000 From: Anoob Joseph To: Bruce Richardson , Jerin Jacob , Pablo de Lara Cc: Anoob Joseph , Hemant Agrawal , Narayana Prasad , Nikhil Rao , Pavan Nikhilesh , Sunil Kumar Kori , dev@dpdk.org Date: Fri, 8 Jun 2018 22:54:14 +0530 Message-Id: <1528478659-15859-16-git-send-email-anoob.joseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528478659-15859-1-git-send-email-anoob.joseph@caviumnetworks.com> References: <1528478659-15859-1-git-send-email-anoob.joseph@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: BM1PR0101CA0050.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:19::12) To DM6PR07MB4906.namprd07.prod.outlook.com (2603:10b6:5:a3::11) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DM6PR07MB4906; X-Microsoft-Exchange-Diagnostics: 1; DM6PR07MB4906; 3:wTGYG0qM+7Qg+3eLvq4INq4nB+JUUa+YYMGVY1at4k9BkB8gtooK7+7IrMPGTUZ/a3HlyVnlzBVbpfsXXYE7wA25dANcmOov53qz1y8QYn4/W2T6GVEmInEbAAbK4iLMyNxQZhhYzizQiNonRjyVykFyxEd4q2dfNxXiJkYXb4DvDy6BBnzOTdrlsCXz0QFBCRwABeUY3U/sWg83G5W2MqXsN0CCf7g36W5uGrd329TyUJziLyNNuqryHAoBi8jL; 25:sCUueyZ+7H2ZwKyKXFjIva/YeYQLo2j2a5JB3iTNst3CUUp2f1bw4ugDU8c1bwBD10oCDa3Ga64JPfbO01oCP/XhEL31Q5nS3NKyTPOtdetYmv1cTZN0/WvTrQC6+vtGZ3EZwJ6j78LwB+5YJNsqQwfww3PCcMh/c+7IWGpYbyoT92UdH3BMLd4C143EVLlaH5Z+ZiSAUi7Dh70C/ChzK3ymXkCpBXYMaH8mJckPfWbt0C2L11ByUL8cCK+/RtpN9vMBo9USSR/xx6jMj+FW5mpfKrOTCuyH/QUZ39M+AOtNlq32emXRQrRK835Wqc9wXdA646xY+rhoaxCwQKEfDw==; 31:9wjr4XEyCrMJ1+f0/Jbdxd7svrPtAvJkBwbYxYdAHrPlZt6fhIrFd28wmbyMHYpGCjs+ITZDfhaKtwuvcrPwoDeTURdK8IfU0NNIl6GuYEbKswXn0cJCfn4U2JmxqYpMQi7yOE8Zofm7POKcz3ptzHsSMv/fSrEWgYol9mugMDb6XoqDqy64EvBN/TjiHPKRFP7jzY30WTK8JUDkM08n/iZe71B/0bspfUCTz/nqBrk= X-MS-TrafficTypeDiagnostic: DM6PR07MB4906: X-Microsoft-Exchange-Diagnostics: 1; DM6PR07MB4906; 20:3R5CFw7elT5nh4XdjubgIz1u4Usy1j0IjSWP1UgjCIw1+J64QfvVp+Ffie5E289BPTS5d+Lse0NXNmCgjCvC/PBoChyb8HX2UuEZp7QtMmybf5LbwtbSDdOa6P1MMPMF6mstVlfO0VysYnUh5tnSYfX9B9fcraPXkCtaahdB8jJNlQzsT/ewCrG8AvBQtVcMPMH9OiXCejDR2CPYCN1CXh0DeBwLbfUtwRtUiZvIYtBN9HSlsShAW3I+k3cESk6np06HrawWweF1Qml4cvitGpC056R7eqLCNCe6hqqr+0WaYJBMtAKU/G+dRIHj8ticloRMYLJJ00MwjUoPLpUBOHnjU+aQ6coG1S7ghw0JVi3UyegShlSSI5ZvA4iyUZ/fwLi49jvuP4ushfrF9A5FM8z9WTueoolEzWbV93lLklOuqzrFCR9jG3KCG/Pb9O/ofzBZ1eZh7MbREyr9f7MH+nHPjtXIAmtBMPGeOCXdWhLq+i28kL/Cp5gvyvVLM3MS010yi6ERLtDz8GuGYeGZaXYdSmLVj+RObqH1tO1uX/lNg53ePPtDKUcZ26VQfU0fXMcFCJ+k85ATL4LbmS3QMXPcVV9dKZJAmtd91cqmSJs=; 4:S0+y3iQ8RO7FiJklbneVZ200W521N1FJuuvj+stabupV9tU8iKFGxYojIgEVUoYIt5r9tzesxtmi0upb+g003I8zO9IYVUvvPX6iRgMTZkDcTH3nCSPbGkmI7+ziYOQZh5SInvaupntbf+k4yIy9EEpYpwP9J9+jDEXRZcQGSDEgB6V8ZeFVRDJ7gsb1l+LnGiQ/ohd+FoIexM4GmDiA2i6TdthETtgIm1NPzSYreq/uWpYiO9xvsbU442x8RVx37vWSnr6r4Npc5PeQTfrB4g== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(3231254)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:DM6PR07MB4906; BCL:0; PCL:0; RULEID:; SRVR:DM6PR07MB4906; X-Forefront-PRVS: 06973FFAD3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(346002)(366004)(376002)(396003)(39380400002)(189003)(199004)(186003)(16526019)(5660300001)(26005)(42882007)(55236004)(66066001)(47776003)(68736007)(6666003)(305945005)(2906002)(8676002)(7736002)(8936002)(36756003)(52116002)(2616005)(956004)(476003)(446003)(50226002)(81166006)(11346002)(44832011)(6506007)(386003)(486006)(59450400001)(76176011)(51416003)(48376002)(50466002)(97736004)(316002)(6512007)(25786009)(53936002)(6486002)(81156014)(4326008)(3846002)(6116002)(16586007)(54906003)(110136005)(105586002)(106356001)(72206003)(478600001)(8656006); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR07MB4906; H:ajoseph83.caveonetworks.com.caveonetworks.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM6PR07MB4906; 23:7xYjGHOISTibKvHqSbAsUjsUZFTT7z1tepcqYDvGM?= =?us-ascii?Q?nkA1GWXTLMC722qFIL/UrxW8j5WlJdquuUqQquvCXReqLLPvNzC5dbyLerxH?= =?us-ascii?Q?VlPKMLyp71bGVEi6t+SIwWIQva//knCUKKpYwBaywPLiE7uGHLC+uiHxPorr?= =?us-ascii?Q?oFs6yRdTolkVIHVwCNriKPVwL4SArKK7uezwFL1culR71qMssTLEVpgWZ81D?= =?us-ascii?Q?h4f2c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qdGbEOGZBFbH/r53dNvMo4vSJcNVZHvy6xrtoSDK5HnbwPiAmXrRxguXMcst96tOkasATcYkNxUdwnuY4QMwknDnSHukDjE4EmlMzjJNy0=; 24:Ek5UD5KmFtyQBffz2AdAqPRE8miwlCUtiWXuOD70Of6c7p72cnTxfHl0HU3i7q0EKtF1mig4mt84R5A95IjfJXMLo1ZlMn5xLcmw0wJSnI4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM6PR07MB4906; 7:V68KzoNnG33hsdXqizuDB+hbtxFudBOxgluY74mLzutyUF1S2As93oZUUb4XH+IvsnmR+NKeW/vnU/6TBHYn3/pgZTciMAos91FH2Ghg+vBKIMAKqTmsZ5enUYuopj+InlE4nsZcNEf45wW93z9B1XDR3JjswLSU7ga5Va+Q4DU21Gr2Us72P7aHE1hm97B92cmMQGlPShbXwci0fBM4zIJN5TboGI6aGzj8BMOIhDAQurF1HUY/vc2LYXUQULsh X-MS-Office365-Filtering-Correlation-Id: 8a276f14-b8f5-4991-89c6-08d5cd64e1c8 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2018 17:25:48.2951 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8a276f14-b8f5-4991-89c6-08d5cd64e1c8 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR07MB4906 Subject: [dpdk-dev] [PATCH 15/20] eventdev: add default conf for event port-lcore link 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: Fri, 08 Jun 2018 17:25:53 -0000 Generate a default conf for event port-lcore link, if not specified in the conf. This routine will check the number of available ports and then create links according to the number of cores available. This patch also adds a new entry in the eventmode conf to denote that all queues is to be linked with every port. This enables one core to receive packets from every port. Signed-off-by: Anoob Joseph --- lib/librte_eventdev/rte_eventmode_helper.c | 109 ++++++++++++++++++++- .../rte_eventmode_helper_internal.h | 5 + 2 files changed, 113 insertions(+), 1 deletion(-) diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c index bec893c..6bdd64c 100644 --- a/lib/librte_eventdev/rte_eventmode_helper.c +++ b/lib/librte_eventdev/rte_eventmode_helper.c @@ -87,6 +87,28 @@ internal_get_next_rx_core(struct eventmode_conf *em_conf, unsigned prev_core) return next_core; } +static inline unsigned +internal_get_next_active_core(struct eventmode_conf *em_conf, + unsigned prev_core) +{ + unsigned next_core; + +get_next_core: + /* Get the next core */ + next_core = rte_get_next_lcore(prev_core, 0, 0); + + /* Check if we have reached max lcores */ + if (next_core == RTE_MAX_LCORE) + return next_core; + + /* Some cores would be reserved as rx cores. Skip them */ + if (em_conf->rx_core_mask & (1 << next_core)) { + prev_core = next_core; + goto get_next_core; + } + + return next_core; +} /* Global functions */ @@ -367,6 +389,74 @@ rte_eventmode_helper_set_default_conf_adapter(struct eventmode_conf *em_conf) } static int +rte_eventmode_helper_set_default_conf_link(struct eventmode_conf *em_conf) +{ + int i, j; + struct eventdev_params *eventdev_config; + unsigned lcore_id = -1; + int link_index; + struct rte_eventmode_helper_event_link_info *link; + + /* + * Create a 1:1 mapping from event ports to cores. If the number + * of event ports is lesser than the cores, some cores won't + * execute worker. If event ports are more, then some ports won't + * be used. + * + */ + + /* + * The event queue-port mapping is done according to the link. Since + * we are falling back to the default link conf, enabling + * "all_ev_queue_to_ev_port" mode flag. This will map all queues to the + * port. + */ + em_conf->ext_params.all_ev_queue_to_ev_port = 1; + + for (i = 0; i < em_conf->nb_eventdev; i++) { + + /* Get event dev conf */ + eventdev_config = &(em_conf->eventdev_config[i]); + + /* Loop through the ports */ + for (j = 0; j < eventdev_config->nb_eventport; j++) { + + /* Get next active core id */ + lcore_id = internal_get_next_active_core(em_conf, + lcore_id); + + if (lcore_id == RTE_MAX_LCORE) { + /* Reached max cores */ + return 0; + } + + /* Save the current combination as one link */ + + /* Get the index */ + link_index = em_conf->nb_link; + + /* Get the corresponding link */ + link = &(em_conf->link[link_index]); + + /* Save link */ + link->eventdev_id = eventdev_config->eventdev_id; + link->event_portid = j; + link->lcore_id = lcore_id; + + /* + * Not setting eventq_id as by default all queues + * need to be mapped to the port, and is controlled + * by the operating mode. + */ + + /* Update number of links */ + em_conf->nb_link++; + } + } + return 0; +} + +static int rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf) { int ret; @@ -396,6 +486,16 @@ rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf) return ret; } + /* + * See if links are specified. Else generate a default conf for + * the event ports used. + */ + if (em_conf->nb_link == 0) { + ret = rte_eventmode_helper_set_default_conf_link(em_conf); + if (ret != 0) + return ret; + } + return 0; } @@ -523,7 +623,14 @@ rte_eventmode_helper_initialize_eventdev(struct eventmode_conf *em_conf) /* Get event dev ID */ eventdev_id = link->eventdev_id; - queue = &(link->eventq_id); + /* + * If "all_ev_queue_to_ev_port" params flag is selected, all + * queues need to be mapped to the port. + */ + if (em_conf->ext_params.all_ev_queue_to_ev_port) + queue = NULL; + else + queue = &(link->eventq_id); /* Link queue to port */ ret = rte_event_port_link(eventdev_id, link->event_portid, diff --git a/lib/librte_eventdev/rte_eventmode_helper_internal.h b/lib/librte_eventdev/rte_eventmode_helper_internal.h index 9db9684..3a4e52f 100644 --- a/lib/librte_eventdev/rte_eventmode_helper_internal.h +++ b/lib/librte_eventdev/rte_eventmode_helper_internal.h @@ -93,6 +93,11 @@ struct eventmode_conf { /**< Stage 1 schedule type */ uint64_t s2_sched_type : 2; /**< Stage 2 schedule type */ + uint64_t all_ev_queue_to_ev_port : 1; + /**< + * When enabled, all event queues need to be mapped to + * each event port + */ }; uint64_t u64; } ext_params; -- 2.7.4