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 C5447A04F3; Fri, 3 Jan 2020 14:07:37 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 03CC61D381; Fri, 3 Jan 2020 14:07:37 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id EC20A1D380 for ; Fri, 3 Jan 2020 14:07:35 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jan 2020 05:07:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,390,1571727600"; d="scan'208";a="210084718" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga007.jf.intel.com with ESMTP; 03 Jan 2020 05:07:34 -0800 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 3 Jan 2020 05:07:33 -0800 Received: from fmsmsx605.amr.corp.intel.com (10.18.126.85) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 3 Jan 2020 05:07:33 -0800 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Fri, 3 Jan 2020 05:07:33 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.172) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 3 Jan 2020 05:07:33 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aAEHwekqhrpNL7Et9Yb9zEaJAiMn/uPkYZB00X1gJ0kcst+dE7y5D0pxACwOYKMeYIi13tNtkRN9BN1cBI9Er6NKuvSyl5hkhUXMLp/hgCaU50tq6HyyHMhZnfqjViMjKuY3Q0R2OJbdz56o+e/i0td6rKBUnNnNfeOgtpIJPUUyZNba4+IXfZpTF+c0HgnskrFPTCiZ+YwNsgWPrP7Awpwz6QKoPQua1ytiNzlb2z7Ecai27q95CaeUu6XavbkYwgWPlq+jfedD00B9ltZdOeU7weLGePB306NZu5omHn0M+3zmQvlPRKdnKhzaS/ze1z+lLqw/5sG0JzPo5MsH0w== 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=13vGN2bHvTiXi6XtB4+8uNRUXvLjvb3h9eIgH+Y/G6E=; b=RCztAp/ebyyN879Tp2Pjud16YOO+o+xt34MeMzgGn908ulchV+p8fQC+C/J4AaKRQc9x1YQ9rFZWAg5QHste0d1Z82Ka2Ko0HyqIL2WfbN7VzXBy8sphsPgdN7cHqSZTBRW1dT95fqmRs5muHXbJdhn/JyXNqufylsjlOYJBfZBido75inbp/MV3+TXPuU/gEyG5PjgY8IrqoyK3Ar7j/2KDeN6oG+2G32cyn93kMI7yQVKlwu6/A4QMTT9kW+/LtBE5EbJFR5y0FTWBPSUsjn3snjyovuGUY+RtGzCdMra4oUgZ39GIs5x15w/urEVo2lSpGBzLX+Hk6RpuYBwmUA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=13vGN2bHvTiXi6XtB4+8uNRUXvLjvb3h9eIgH+Y/G6E=; b=mGTp0n0nfNRT8Dn3DR6wrpKMlUqvUJiZ3+zES2KK5qKDs4fIi5wSFiwoasbUQToMuoght2LG1hmdx4SbQiz5ORyIZah5TBKy9JsSJ2dga64dUXDaK6NrITWSAJl8ZBNntxYgfD1UzKnmVvFa3CHQy3I1iOO8iLLQZ2xRY6+UaUc= Received: from SN6PR11MB2558.namprd11.prod.outlook.com (52.135.94.19) by SN6PR11MB3151.namprd11.prod.outlook.com (52.135.125.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.11; Fri, 3 Jan 2020 13:07:31 +0000 Received: from SN6PR11MB2558.namprd11.prod.outlook.com ([fe80::4d86:362a:13c3:8386]) by SN6PR11MB2558.namprd11.prod.outlook.com ([fe80::4d86:362a:13c3:8386%7]) with mapi id 15.20.2602.012; Fri, 3 Jan 2020 13:07:30 +0000 From: "Ananyev, Konstantin" To: "pbhagavatula@marvell.com" , "jerinj@marvell.com" , "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: AQHVqrGSBAY954JLWE+p8X9Zl/05RqfZFgNA Date: Fri, 3 Jan 2020 13:07:30 +0000 Message-ID: References: <20191204144345.5736-1-pbhagavatula@marvell.com> <20191204144345.5736-8-pbhagavatula@marvell.com> In-Reply-To: <20191204144345.5736-8-pbhagavatula@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOTA2MjNmZDAtNGVmMy00MWE3LTk5NzItZDg4NTJmZDQ3MTBmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoibFlBSDVxMnRWRXNENExCaEpWK05OcG5JSExNSmhcL212VGsxSE5hSVdRRUlpdUh6U1FRNFR1NHFmNkU1NWRQR2gifQ== dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.2.0.6 x-ctpclassification: CTP_NT authentication-results: spf=none (sender IP is ) smtp.mailfrom=konstantin.ananyev@intel.com; x-originating-ip: [192.198.151.189] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: cb2c7bc3-aa43-4dd4-9c5d-08d7904de40f x-ms-traffictypediagnostic: SN6PR11MB3151: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2399; x-forefront-prvs: 0271483E06 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(136003)(346002)(376002)(366004)(396003)(189003)(199004)(4326008)(110136005)(9686003)(66476007)(66446008)(186003)(52536014)(316002)(55016002)(478600001)(5660300002)(71200400001)(2906002)(33656002)(76116006)(6506007)(66946007)(8936002)(7696005)(81156014)(81166006)(64756008)(86362001)(66556008)(26005)(921003)(1121003); DIR:OUT; SFP:1102; SCL:1; SRVR:SN6PR11MB3151; H:SN6PR11MB2558.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: IpchaornGSkrajEbT+6Bi18kI3KJ3yq+55he7eN7iVxSJzB7A7T7ahP6E5AgVWiXQRClyn1AHvV5nCmQfYNaeaRwu9Z9mJgS+Mwdouwi2a4ItDO2WBeVe5CKOFnT+8xxOmPjjcvYFIGxytWEdYIIl5ON+lhgzbOZI2JrgiUGo4qZhMMPx2sLwqT6W3Bx+79eUSolzO8fFS3yrJoHsPk4DEBfIk8HtOHRMxEdhdVqCwgG776QAwQys19GOy8n8eMpIEjQ50ghsqnnD0sqdpdcYg3x4pmkSJOrho8KrQM2xURrxJYK2E3oITQw0Bs9tmz/Lup66gBsuaboGybs1r66IHo4waeitQZ2ycthX2YY3rxI/WsvFBnGDvLPXF1NH3/I9PwPGO2n/Ob6TmNO4GwzRy3fqT7SUO0SK146a7B2XYtAVJ3eoo5IFP3fpL8Jo4hiSqV9T23HaomhN303xAFp58WsCSf6AzuUU6DWC8p/oDNnl8Pd8/DdQD3E7Qt01XAK Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: cb2c7bc3-aa43-4dd4-9c5d-08d7904de40f X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Jan 2020 13:07:30.7985 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: VJEoXLwo3tgqlXnGw+FOdkcJsvlauG3FphSwUo8vWtnad5s+Vk+MiOmkFRIu+ls9w1sHToWL8wIt2hkiqwgTl9IBEO2aSGAvn7dhiifYNis= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3151 X-OriginatorOrg: intel.com 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 queue= id) > return 0; > } >=20 > +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 func= tion. Then we can have something like: If (evt_rsrc->enabled) { ... ret =3D l3fwd_event_resource_setup(...); l3fwd_event_service_setup(); ... } else=20 ret =3D l3fwd_poll_resource_setup(...); ... >=20 > if (check_lcore_params() < 0) > rte_exit(EXIT_FAILURE, "check_lcore_params failed\n"); > @@ -1054,6 +1143,7 @@ main(int argc, char **argv) > } > } >=20 > +skip_port_config: > printf("\n"); >=20 > /* start ports */ > @@ -1083,6 +1173,9 @@ main(int argc, char **argv) > } > } >=20 > + if (evt_rsrc->enabled) > + l3fwd_event_service_setup(); > + > printf("\n"); >=20 > for (lcore_id =3D 0; lcore_id < RTE_MAX_LCORE; lcore_id++) { > -- > 2.17.1