From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0053.outbound.protection.outlook.com [104.47.42.53]) by dpdk.org (Postfix) with ESMTP id 2D6FC1D079 for ; Fri, 8 Jun 2018 19:25:49 +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=ouyqMP73UC/+Hrfjo+LhZ4i9OGxhi24XHfB3SiGAP2A=; b=MZjyp04sZN3fXiU6604WgTAizVWPFuMGBE7Po6CYVFYPLiwMvc3l9ARYs02TzkFOAVMzDhoxUCuTJljHTxGn4cS3nl5hkX2zpjM6/h8HPLcT6GiXcXGjYoy3iFI9ybPbBRkTsszf0sgf7bH81bjRMn9wnKvnppa9v0+knp5wq9s= 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:44 +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:13 +0530 Message-Id: <1528478659-15859-15-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:w7Z4Ih2u5vN0l5FSF5GIWTiR1ht9g2b8H0gN4IqD1gjx2hyk6khbHeQ46ElGLRTYwMh2uhwU3qJbWakRJ3gynTxqwk2NeyYcnPn2BCV108P8PsFDTTzRyxMKdApUzbXja3wsOYX5csJyjmUeIuuW2WS8KY/a/YIR4RGU0b56x2OEu57C8v2ztOUnfT9rhnmHWEWHTjsMK8qOdeVPubGuKkjwGhcCz2jDRKKbuy6+u6CjLs0UH+EmNtGjI7K66pqs; 25:ZRxQfQPDziko1YL31YyAKnONYvJgZP3jGo5co36OpXyBaKyF4XY91J+hRXQLPITIclL4ko61V/AC1O2y76O8/sBHO63BWMT6bI/fjhUmipjUzUqxS0TEMy1EKrXVZsJSqG5pYlcXFA+xdvMHkhADOIIsyFqO4uIFygpd2mMlV4W26nBNTYeTlW5PVF1p4CTb0vhr/Q3B5UsB3hwPQ1g6mnmCyPvqY7ptAdlhla1ddO0VCkh78Ee+Fk6wrbojNZO6DerfhaA+ANnulG18jI0gWToC1axpooVlwiZSvJ2yC588edzJ/3bxSsBmXXidPpscM1xnC5gR1yum5bqM81Y9rQ==; 31:nxZHEIwJ0SHaEqRW1ZFFwpW4P5MaBq4u+kzWhWCVGhMtdTXLX9ysCihxzF+Cfj+TdtWSko4ArpNbsM5+oEHtdHd965Q2uyCiPJwldyBH0OVkRsCSrbzy04nqGXsRVTYvwgAct7XzK0OJRcUGz8b/dV4fj4tW/m35yz4cG6KtTB3pNaZtfCoJfQ58jnzFUiG7ZHqwfenqO/OvrmpFd3TjtnxqLbZtU7IU1JiUR8fnosA= X-MS-TrafficTypeDiagnostic: DM6PR07MB4906: X-Microsoft-Exchange-Diagnostics: 1; DM6PR07MB4906; 20:gUOr11z8WMnmwZKhRXlR+ws5DvZDaXpAalYO0ScDxEZUDZGv/D+LAGBQeUXyszSqCQfdfbc0d5GEbABKqkk1Pp0QI7L9YWYRRQcE+wW9us+14mMXmffDkSmg1jVr3POn5WKyRXtv66X88+3C5kYM0ZO5TMpoL1kKYW9sHC+T8bc/5IX/6GxpWVwWY0+Mr5qN//YkkWU9ocG1UxEIBX4VvNosMJrLlWvqNFFMujPHKRJifWP/ZAcLdij5P4JRav3Q0hMCI9Mckvsnj0C/aPdYbbBehjN90gioQ1yrYCy+8wa8smN6pJrHjPxlG5rxkQD0xbtYXheAdgPAeF+dfYDgBWSf8+SPUybO68pul4c01vaARWq7+o/gFTuqDJ49+gNemujJ0RCh9yFzU4/u7phgXt3Mge+CNW4bWJcWtpUYhpaoKZcGHlFjjrJfxjRiOAib40p28S/RKiYrjbz9RoQmq6Xxhk0je1U9FLgBObnFJM9M8QsVLb1F29I4Lnw6OiTGQYhf6p2+hFMXVU+DaCsF6nmkQLkQwbb5spBM+8byVvm1GiMosXV82VZk1dUwhvXfLnQVWtme44pCMdaFyOgju4kV7xXqSkctVF9r3kiB2WE=; 4:SvX6l5zdB/C4quzlb1hsu7VrdiIXxNJ3UhRg+DJ0nwxVtpOdvAnXdlJAU7JsUmfemCgrQIkjCsTqLItmIQFjXtMWEIQJBnygadERevwcnSv/J0nSXsLfG/a91qpLlQ0KXzc7+gBbYQVJHCbEZDzQjWkP4elo4aAqpyDFI4bxjx00FGjoAEW+W6Pask3P1zYPeZajkbPcBU1MaGDXO7SLnXuwyFVQiiSRchy7bLPCXa8Xicoqjn50lpKuUQemuqcbl+a1FzZUFR+5pmbEe+siZA== 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:Skv922y6iaP4mluSb57efawbEeltI/cJdcfD0JapW?= =?us-ascii?Q?CMM8f/AoP+UTO/X8uD7uNPqVV4Y6DiuHmsCrxSUhjgS7EME+3byGekZVgGHN?= =?us-ascii?Q?JiheegymLRCxIpcZBT/j+trJcb4TSeWGyLpOH58pOHPFuG8KcuBhq0aS04uR?= =?us-ascii?Q?32WPc4Sjffxsy6ScoalwA83Kx4ix3CHI5aH9nC1s5Mmlz5qB1xAwNO4RAIrW?= =?us-asc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+oiRMMA9CqOD54byExW/tVNXe44pG8cLiJ0rnSN1H+cb0qpYUSN5rTc+Wj8IF0qZG0Pm7DpzSkcolLq4ha29ZfsmOgXdo4SHwD0fRc=; 24:y/Cc0Cr41cJ+no4Cl3vBk1ow8YIBCwFcxWWsWRKtu2kWrzjzdoiEGwLXKAGX/ktADinUVfIWWDQXa7a/ZxhTLPlPYOgPjQRppZwh5Tc6lgc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM6PR07MB4906; 7:RuNYiMCNMVO6+Hm0E0unusK9Nv9WjMpeFbgPjrwN8iMtSd0XRX+ougkkgKcXn5xwrsyovxtBQTyuD4Xs3OrhBYmwCr0X23nHbCnGYF6v8iHSrkrtxJgLaoL+5+5n2p0CkQznOn1EVAeG+q5ErZk98PZZI7aurADXq0xMDesjcw0IXQQnjhK7BTm6q4i5UbNWNtqoHaoMEK1nAppKpl8ldWSWV6VMW2gwvrnQMliA0a9o4sNFHiRF5NuT6CK9LIKq X-MS-Office365-Filtering-Correlation-Id: b435c113-f205-4ccd-50e3-08d5cd64dfca X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2018 17:25:44.9513 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b435c113-f205-4ccd-50e3-08d5cd64dfca 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 14/20] eventdev: add default conf for Rx adapter conf 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:49 -0000 Generate a default conf for Rx adapter, if not specified in the conf. This routine will check the available eth ports and event queues, and maps them 1:1. So one eth port will be connected to one event queue. This way, event queue ID could be used to figure out the port on which the packet came in. Signed-off-by: Anoob Joseph --- lib/librte_eventdev/rte_eventmode_helper.c | 127 +++++++++++++++++++++ .../rte_eventmode_helper_internal.h | 4 + 2 files changed, 131 insertions(+) diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c index 4d6888c..bec893c 100644 --- a/lib/librte_eventdev/rte_eventmode_helper.c +++ b/lib/librte_eventdev/rte_eventmode_helper.c @@ -65,6 +65,29 @@ internal_get_eventdev_params(struct eventmode_conf *em_conf, return &(em_conf->eventdev_config[i]); } +static inline unsigned +internal_get_next_rx_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; + + /* Only some cores would be marked as rx cores. Skip others */ + if (!(em_conf->rx_core_mask & (1 << next_core))) { + prev_core = next_core; + goto get_next_core; + } + + return next_core; +} + + /* Global functions */ void @@ -105,6 +128,7 @@ static void em_initialize_helper_conf(struct rte_eventmode_helper_conf *conf) { struct eventmode_conf *em_conf = NULL; + unsigned rx_core_id; /* Set default conf */ @@ -119,6 +143,13 @@ em_initialize_helper_conf(struct rte_eventmode_helper_conf *conf) /* Stage 1 schedule type: atomic */ em_conf->ext_params.s1_sched_type = RTE_SCHED_TYPE_ATOMIC; + + /* Set rx core. Use first core other than master core as Rx core */ + rx_core_id = rte_get_next_lcore(0, /* curr core */ + 1, /* skip master core */ + 0 /* wrap */); + + em_conf->rx_core_mask = (1 << rx_core_id); } struct rte_eventmode_helper_conf * @@ -253,6 +284,89 @@ rte_eventmode_helper_set_default_conf_eventdev(struct eventmode_conf *em_conf) } static int +rte_eventmode_helper_set_default_conf_adapter(struct eventmode_conf *em_conf) +{ + int nb_eth_dev; + int i; + int adapter_id; + int eventdev_id; + int conn_id; + struct rx_adapter_conf *adapter; + struct adapter_connection_info *conn; + struct eventdev_params *eventdev_config; + + /* Create one adapter with all eth queues mapped to event queues 1:1 */ + + if (em_conf->nb_eventdev == 0) { + RTE_EM_HLPR_LOG_ERR("No event devs registered"); + return -1; + } + + /* Get the number of eth devs */ + nb_eth_dev = rte_eth_dev_count_avail(); + + /* Use the first event dev */ + eventdev_config = &(em_conf->eventdev_config[0]); + + /* Get eventdev ID */ + eventdev_id = eventdev_config->eventdev_id; + adapter_id = 0; + + /* Get adapter conf */ + adapter = &(em_conf->adapter[adapter_id]); + + /* Set adapter conf */ + adapter->eventdev_id = eventdev_id; + adapter->adapter_id = adapter_id; + adapter->rx_core_id = internal_get_next_rx_core(em_conf, -1); + + /* + * All queues of one eth device (port) will be mapped to one event + * queue. Each port will have an individual connection. + * + */ + + /* Make sure there is enough event queues for 1:1 mapping */ + if (nb_eth_dev > eventdev_config->nb_eventqueue) { + RTE_EM_HLPR_LOG_ERR( + "Not enough event queues for 1:1 mapping " + "[eth devs: %d, event queues: %d]\n", + nb_eth_dev, + eventdev_config->nb_eventqueue); + return -1; + } + + for (i = 0; i < nb_eth_dev; i++) { + + /* Use only the ports enabled */ + if ((em_conf->eth_portmask & (1 << i)) == 0) + continue; + + /* Get the connection id */ + conn_id = adapter->nb_connections; + + /* Get the connection */ + conn = &(adapter->conn[conn_id]); + + /* Set 1:1 mapping between eth ports & event queues*/ + conn->ethdev_id = i; + conn->eventq_id = i; + + /* Add all eth queues of one eth port to one event queue */ + conn->ethdev_rx_qid = -1; + + /* Update no of connections */ + adapter->nb_connections++; + + } + + /* We have setup one adapter */ + em_conf->nb_rx_adapter = 1; + + return 0; +} + +static int rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf) { int ret; @@ -272,6 +386,16 @@ rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf) return ret; } + /* + * See if adapters are specified. Else generate a default conf + * with one adapter and all eth queue - event queue mapped. + */ + if (em_conf->nb_rx_adapter == 0) { + ret = rte_eventmode_helper_set_default_conf_adapter(em_conf); + if (ret != 0) + return ret; + } + return 0; } @@ -591,6 +715,9 @@ rte_eventmode_helper_initialize_devs( /* Get eventmode conf */ em_conf = (struct eventmode_conf *)(mode_conf->mode_params); + /* Eventmode conf would need eth portmask */ + em_conf->eth_portmask = mode_conf->eth_portmask; + /* Validate the conf requested */ if (rte_eventmode_helper_validate_conf(em_conf) != 0) { RTE_EM_HLPR_LOG_ERR( diff --git a/lib/librte_eventdev/rte_eventmode_helper_internal.h b/lib/librte_eventdev/rte_eventmode_helper_internal.h index 63b2fb5..9db9684 100644 --- a/lib/librte_eventdev/rte_eventmode_helper_internal.h +++ b/lib/librte_eventdev/rte_eventmode_helper_internal.h @@ -83,6 +83,10 @@ struct eventmode_conf { struct rte_eventmode_helper_event_link_info link[EVENT_MODE_MAX_LCORE_LINKS]; /**< Per link conf */ + uint32_t rx_core_mask; + /**< Core mask of rx cores to be used */ + uint32_t eth_portmask; + /**< Mask of the eth ports to be used */ union { struct { uint64_t s1_sched_type : 2; -- 2.7.4