From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 693D5A04F1; Mon, 6 Jan 2020 05:29:07 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CE7E01D584; Mon, 6 Jan 2020 05:29:06 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 1CEE11D440 for ; Mon, 6 Jan 2020 05:29:04 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0064Kcf0030955; Sun, 5 Jan 2020 20:29:04 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=D0ywWak/2XQ0qemuCyrmhMZmT+0JuNYFAVptcDqOZHA=; b=AD++3M+5hOX9MBER07Qq3kmBj968VL52S7vy5OFeZR3OH7qtU/R9l/n3fwTmo6UKlnIh JtOw65MZQ0obfmIhPsN4WZ1AxVrq8Y/XwoAWT05rIQe57PLO6Cc53XPN6ZvdN7ZcEr/I o5QACCOhLCkmnpTm8QQ6a0jiqLj8ZJWoxv/M7XJd4vZSvJ5VOq/SOJTLaPy4ENETIQLK BjcbGaoDRI01HBHPbsBUwwhk/1DupsERMaNyFHDdY1yuwGbCCl/nRlTDqMeUCBJBMLqh bFmhHnodqiSUhn9dujo6GkLLL9PWiacsn2afQduw6Sp2rS3URxp36SvI+6ajPQRnq27n Aw== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2xarxv4hdj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 05 Jan 2020 20:29:04 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 5 Jan 2020 20:29:02 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.172) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Sun, 5 Jan 2020 20:29:02 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S9BAfpvFw8MpKB/2qPgvo+TMxM8/VibIIBucB1fMerJpkVoz5u19SC4dqgag99SsNeh0NIR7+HoMrOj7XMiRcP1pY0zE9Uykqtu1bDANSF4NFhdbQnpaiKjbEQI1NqHii3ld0+4V43yu0uxGFWnX6oMoQNeP+Cg+mICr/b6vdW1UdXWMLbeEwkaND3V5XVlPdQSEjgmRui3k3zJXsjq1E1otstc7HR7Wg0Ka0NLAD39XFcR8ZO0EW+a+Ezgjv73ibxSo4+E/P1SqqRodOmIr1C8aFGzW4erUCG0YJj7L1dwmNshoRCHuhyDIAe/W6JqyYFuOnKSkwIVOrJ++/tZtKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=D0ywWak/2XQ0qemuCyrmhMZmT+0JuNYFAVptcDqOZHA=; b=d+sZVpfTmXmlkN72Vu2onUJBX7bFY5q5xo5nmAc0GHdVMTZTmMqJZCHXrlQD+9Zx28U50zz1mstaR6iQjhEcdHgv/w3uwCdUTzSNiqVsRX4guRLkGky1W8gdZKOnYTwpelTNl3Rb9DBlFN+rQasRuasBr+WxPqfunGHFXN+K6HKExWXF0wHCL1TPcYQahcetBc20EdY/tzJ2lh/WwvqHD2awCrsXAQaPP/3gR7jHyEns+qqAadEqD1CtEv7SFHhA3fWsDad7FyIonifivIqtkDDK6L666j0OkTCFejYvqmtEzKOoMevKRmHSZ4w3cIbZM9Wf0hqFhPMOsnhIqYKiMQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=D0ywWak/2XQ0qemuCyrmhMZmT+0JuNYFAVptcDqOZHA=; b=IN1BEudI0B6WU2VKHHEpV6ILlcVSo5ooYYJW9PLsh0jj/ZEpMv1FZ8CKZCxc6M2csooUsQn8Y/mCPd8IR3j9N92oLXSn0EACCRWfbz9d1agK4U0Bd6lDGEB6Nzgqz6Oxa4QjUoHwx9FEkw4QZRaGYx9cNe7BoSVR3lw50iivf+c= Received: from CY4PR1801MB1863.namprd18.prod.outlook.com (10.171.255.160) by CY4PR1801MB1941.namprd18.prod.outlook.com (10.171.254.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.15; Mon, 6 Jan 2020 04:29:02 +0000 Received: from CY4PR1801MB1863.namprd18.prod.outlook.com ([fe80::edb0:c18d:7455:f60b]) by CY4PR1801MB1863.namprd18.prod.outlook.com ([fe80::edb0:c18d:7455:f60b%4]) with mapi id 15.20.2602.015; Mon, 6 Jan 2020 04:29:01 +0000 From: Pavan Nikhilesh Bhagavatula To: "Ananyev, Konstantin" , "Jerin Jacob Kollanukkaran" , "Kovacevic, Marko" , Ori Kam , "Richardson, Bruce" , "Nicolau, Radu" , Akhil Goyal , "Kantecki, Tomasz" , Sunil Kumar Kori CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2 07/11] examples/l3fwd: add service core setup based on caps Thread-Index: AQHVwjbHwERk7NcwLEa/a8PyEqJB1afdDsjA Date: Mon, 6 Jan 2020 04:29:01 +0000 Message-ID: References: <20191204144345.5736-1-pbhagavatula@marvell.com> <20191204144345.5736-8-pbhagavatula@marvell.com> In-Reply-To: Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [14.140.231.66] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a6adf094-71d4-46b7-116d-08d79260f4eb x-ms-traffictypediagnostic: CY4PR1801MB1941: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1417; x-forefront-prvs: 0274272F87 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39850400004)(396003)(366004)(136003)(346002)(376002)(199004)(189003)(55016002)(4326008)(9686003)(86362001)(52536014)(2906002)(33656002)(71200400001)(5660300002)(6636002)(110136005)(316002)(8936002)(186003)(81156014)(81166006)(66446008)(66556008)(478600001)(76116006)(55236004)(6506007)(26005)(66946007)(7696005)(64756008)(66476007)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1801MB1941; H:CY4PR1801MB1863.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 94LSv1qNJwn9gV68bPgZA7mEYuNStkYsZ0+6fQfZFdFpqPqzAOfW+QQO6F155FDfiiWW7nSlucdXV6Nlmb5KpLxMjIhmgGjLeBvmR413NbvNLiL5Vk/1eIu+FZ6cesSSYIb4LSjHV+qv19zvpa/hqLWqhVcFcFY38B+voYjC2kKbIGaV4vavggYdI2CAJxJEiKZt9jLRjij3ad3qcqCZtFh6gk06vYEc5dypCNTlT3ffnNYft4iS1I/WLyHlm4gjPa+NqbDbxN0BVFvCCohMoYqDLX1Go94LndEvoi72hd1Jcie9xEMNVWPx5Ffd7fxapkoL4mJ0+v+yh1XTE0ExDOlWzmnTy5SVT/aLLLiGRFEwg7T7ym15q4ayjVbtMAtOKqZGLOnSraxtSaeTmMxeynRxRwx4ZuA6eMWRkForV8gacXXm913WwGs0NHB/MkcZp1sAy+rldiVrlWXFPmozeyR1z/Y9SrMk0APkRVVrKCg8d/1oMaCpym2y+tJXEhoK Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: a6adf094-71d4-46b7-116d-08d79260f4eb X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jan 2020 04:29:01.7747 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: UG9K3t46XbBmlitPNq4r4Wx0PssT51iJbRKcAonrXeI646X4ZrKk8OceCWtTWv5tsOIy3yCjvAsKMq0mHd8CUhwnfqGXy1eOo1mUXiudqnA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1801MB1941 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2020-01-05_08:2020-01-02,2020-01-05 signatures=0 Subject: Re: [dpdk-dev] [PATCH v2 07/11] examples/l3fwd: add service core setup based on caps 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" >> diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c >> index 20df12748..69d212bc2 100644 >> --- a/examples/l3fwd/main.c >> +++ b/examples/l3fwd/main.c >> @@ -826,6 +826,93 @@ prepare_ptype_parser(uint16_t portid, >uint16_t queueid) >> return 0; >> } >> >> +static inline int >> +l3fwd_service_enable(uint32_t service_id) >> +{ >> + uint8_t min_service_count =3D UINT8_MAX; >> + uint32_t slcore_array[RTE_MAX_LCORE]; >> + unsigned int slcore =3D 0; >> + uint8_t service_count; >> + int32_t slcore_count; >> + >> + if (!rte_service_lcore_count()) >> + return -ENOENT; >> + >> + slcore_count =3D rte_service_lcore_list(slcore_array, >RTE_MAX_LCORE); >> + if (slcore_count < 0) >> + return -ENOENT; >> + /* Get the core which has least number of services running. */ >> + while (slcore_count--) { >> + /* Reset default mapping */ >> + rte_service_map_lcore_set(service_id, >> + slcore_array[slcore_count], 0); >> + service_count =3D rte_service_lcore_count_services( >> + slcore_array[slcore_count]); >> + if (service_count < min_service_count) { >> + slcore =3D slcore_array[slcore_count]; >> + min_service_count =3D service_count; >> + } >> + } >> + if (rte_service_map_lcore_set(service_id, slcore, 1)) >> + return -ENOENT; >> + rte_service_lcore_start(slcore); >> + >> + return 0; >> +} >> + >> +static void >> +l3fwd_event_service_setup(void) >> +{ >> + struct l3fwd_event_resources *evt_rsrc =3D >l3fwd_get_eventdev_rsrc(); >> + struct rte_event_dev_info evdev_info; >> + uint32_t service_id, caps; >> + int ret, i; >> + >> + rte_event_dev_info_get(evt_rsrc->event_d_id, &evdev_info); >> + if (evdev_info.event_dev_cap & >RTE_EVENT_DEV_CAP_DISTRIBUTED_SCHED) { >> + ret =3D rte_event_dev_service_id_get(evt_rsrc- >>event_d_id, >> + &service_id); >> + if (ret !=3D -ESRCH && ret !=3D 0) >> + rte_exit(EXIT_FAILURE, >> + "Error in starting eventdev service\n"); >> + l3fwd_service_enable(service_id); >> + } >> + >> + for (i =3D 0; i < evt_rsrc->rx_adptr.nb_rx_adptr; i++) { >> + ret =3D rte_event_eth_rx_adapter_caps_get(evt_rsrc- >>event_d_id, >> + evt_rsrc->rx_adptr.rx_adptr[i], &caps); >> + if (ret < 0) >> + rte_exit(EXIT_FAILURE, >> + "Failed to get Rx adapter[%d] caps\n", >> + evt_rsrc->rx_adptr.rx_adptr[i]); >> + ret =3D rte_event_eth_rx_adapter_service_id_get( >> + evt_rsrc->event_d_id, >> + &service_id); >> + if (ret !=3D -ESRCH && ret !=3D 0) >> + rte_exit(EXIT_FAILURE, >> + "Error in starting Rx adapter[%d] >service\n", >> + evt_rsrc->rx_adptr.rx_adptr[i]); >> + l3fwd_service_enable(service_id); >> + } >> + >> + for (i =3D 0; i < evt_rsrc->tx_adptr.nb_tx_adptr; i++) { >> + ret =3D rte_event_eth_tx_adapter_caps_get(evt_rsrc- >>event_d_id, >> + evt_rsrc->tx_adptr.tx_adptr[i], &caps); >> + if (ret < 0) >> + rte_exit(EXIT_FAILURE, >> + "Failed to get Rx adapter[%d] caps\n", >> + evt_rsrc->tx_adptr.tx_adptr[i]); >> + ret =3D rte_event_eth_tx_adapter_service_id_get( >> + evt_rsrc->event_d_id, >> + &service_id); >> + if (ret !=3D -ESRCH && ret !=3D 0) >> + rte_exit(EXIT_FAILURE, >> + "Error in starting Rx adapter[%d] >service\n", >> + evt_rsrc->tx_adptr.tx_adptr[i]); >> + l3fwd_service_enable(service_id); >> + } >> +} >> + >> int >> main(int argc, char **argv) >> { >> @@ -869,6 +956,8 @@ main(int argc, char **argv) >> evt_rsrc->port_mask =3D enabled_port_mask; >> /* Configure eventdev parameters if user has requested */ >> l3fwd_event_resource_setup(&port_conf); >> + if (evt_rsrc->enabled) >> + goto skip_port_config; > >Please try to avoid introducing more gotos. >If init code below is poll mode specific, let's move it int a separate >function. >Then we can have something like: >If (evt_rsrc->enabled) { > ... > ret =3D l3fwd_event_resource_setup(...); > l3fwd_event_service_setup(); > ... >} else > ret =3D l3fwd_poll_resource_setup(...); > >... > Sure, if we are ok to change/mode existing l3fwd code it makes things a lot= =20 easier. >> >> if (check_lcore_params() < 0) >> rte_exit(EXIT_FAILURE, "check_lcore_params >failed\n"); >> @@ -1054,6 +1143,7 @@ main(int argc, char **argv) >> } >> } >> >> +skip_port_config: >> printf("\n"); >> >> /* start ports */ >> @@ -1083,6 +1173,9 @@ main(int argc, char **argv) >> } >> } >> >> + if (evt_rsrc->enabled) >> + l3fwd_event_service_setup(); >> + >> printf("\n"); >> >> for (lcore_id =3D 0; lcore_id < RTE_MAX_LCORE; lcore_id++) { >> -- >> 2.17.1