From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0041.outbound.protection.outlook.com [104.47.32.41]) by dpdk.org (Postfix) with ESMTP id 8DA671B1A7 for ; Thu, 21 Sep 2017 17:44:20 +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; bh=EZkqJxmkKkbSL7jm/gkehB8F/z2QxPNzUwh6yg2Ig2c=; b=ebuAM1rUIySZTvoRpWB/de/aRRdzxBeAdu/hM9bFA2tOT8CNQVpd3nrZE9+XqKtqJDKObEqlKVww/fCclvlDEsE3IZathE3yNC07vhewQTxeUQf5kB7y3E4t+eCQ/fxCUFOEWGzlVdspaTM6424E92AzH4spKrh2A6MlzOogrQU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from PBHAGAVATULA-LT (111.93.218.67) by DM5PR07MB3466.namprd07.prod.outlook.com (10.164.153.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.11; Thu, 21 Sep 2017 15:44:13 +0000 Date: Thu, 21 Sep 2017 21:13:53 +0530 From: Pavan Nikhilesh Bhagavatula To: Nikhil Rao Cc: bruce.richardson@intel.com, gage.eads@intel.com, dev@dpdk.org, thomas@monjalon.net, harry.van.haaren@intel.com, hemant.agrawal@nxp.com, nipun.gupta@nxp.com, narender.vangati@intel.com, erik.g.carrillo@intel.com, abhinandan.gujjar@intel.com Message-ID: <20170921154352.GA5744@PBHAGAVATULA-LT> References: <1506028634-22998-1-git-send-email-nikhil.rao@intel.com> <1506028634-22998-4-git-send-email-nikhil.rao@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1506028634-22998-4-git-send-email-nikhil.rao@intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: PN1PR01CA0086.INDPRD01.PROD.OUTLOOK.COM (10.174.144.154) To DM5PR07MB3466.namprd07.prod.outlook.com (10.164.153.21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 75df09dd-7d80-4697-cd42-08d501079e3a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DM5PR07MB3466; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3466; 3:B713mH+AkV7y3Cy1RSYxJllIXg6rOT4czPR8In5nHTyU22hEKMDzgA92MG0yH1bw+vN3h9yJ+V8U5GZ3NHoRPAM5HqpIa4/0d6E1MZ4St2vLMY0NFyHTDiGhivd26H1wZ+4Y7HE9aETWlOe9mB7O/MUkQbHc+h+jRhjdo3UmordJSP3UqWBMBukLf0y4EuXbyTeSD1l0pbCXJoO6mTp2lc/zNUkRFrQEqG8vN9/8PsCzKw+9I8zRc39cUsFHrwbJ; 25:ZDvjdtiYV18Yvz8/ag/CffTQ/UrcDvLZ0cI5cHrb92cqQxhmoJTiNkaYfUWZaesBZHrJ3pRBGpjJrIGD8OhSz6GDaqJRTzMljcQAKKJ5a1J+XBosVbrExjcgDXMcWjLb8DVhBuGa5VPnHjs2PO6nHymD18RWMQH3iK1aLiXQlR9FwZOE1cv+r4r9LwXApG1Lj89pxHryLLNdMnaxvBLreU5sTdNubmMlSYHzR1p30dGXkuXK7AX6OrjD5cWFJgidbIf7SYXUhJDJ8OUlyX/ppaI2jt2BrSPLBOrbr9udaGxhrOl062BHVTaTXU4Zk8lhSFUXUdeDjEsXda0LDQwzQg==; 31:xdQTsA2Aa7ZOybTDuv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gSBkp73V8/WREPLQkpSuvhuxIHWYgRlb1na+zyf9nOb/M/OnyvjOk/MP+EKO+4z88FYiZXQpZgd+OvYfJUxXl3v8ff0dNug2eGtVJYtRgeSQHH08zKdS1n0nGrzX2Vfo= X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(93006095)(100000703101)(100105400095)(3002001)(10201501046)(6041248)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123564025)(20161123560025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR07MB3466; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR07MB3466; X-Forefront-PRVS: 04371797A5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(189002)(24454002)(199003)(81156014)(16586007)(25786009)(81166006)(8676002)(33716001)(6916009)(105586002)(83506001)(6666003)(8936002)(50986999)(76176999)(16526017)(1076002)(189998001)(316002)(68736007)(42882006)(97736004)(54356999)(50466002)(9686003)(478600001)(33656002)(101416001)(66066001)(55016002)(305945005)(58126008)(3846002)(47776003)(6116002)(23726003)(2950100002)(7736002)(8656003)(229853002)(106356001)(7416002)(5009440100003)(6496005)(4326008)(2906002)(6246003)(53936002)(5660300001)(72206003)(18370500001)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3466; H:PBHAGAVATULA-LT; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR07MB3466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XOJZtVL0HCveeB8JjEVo9x0yTab4+j2NXh7sHcstmM2dtOsRDCaspLJW62RoqLKGHzXJ/Qr3LeWmGnWQRomLVM=; 7:g4hZHFafdRPqZr/V0bK5Nk8HM4/CxTnW4hhsO+yycMaYNUZtwBDw9YeJwNPUiu932SKEsHGKRhzG7lU/5VrzaVmc3Q77IrIi/PC8dN/EdKu8QXmmZttlX1dgJaO3Z5KNoyJcPpiSaqdCHL35bt35obNIcduWBU5hBJlormuce5KYwvXH1BelhIYSO1ACrbsrY06F6r6J94M2uh2AL0cEynvVXz+3siJeB7shpMStTeI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2017 15:44:13.7751 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3466 Subject: Re: [dpdk-dev] [PATCH v4 3/4] eventdev: Add eventdev ethernet Rx adapter 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: Thu, 21 Sep 2017 15:44:21 -0000 Hi Nikhil, Few comments Inline On Fri, Sep 22, 2017 at 02:47:13AM +0530, Nikhil Rao wrote: > Add common APIs for configuring packet transfer from ethernet Rx > queues to event devices across HW & SW packet transfer mechanisms. > A detailed description of the adapter is contained in the header's > comments. > > The adapter implementation uses eventdev PMDs to configure the packet > transfer if HW support is available and if not, it uses an EAL service > function that reads packets from ethernet Rx queues and injects these > as events into the event device. > > Signed-off-by: Nikhil Rao > Signed-off-by: Gage Eads > Signed-off-by: Abhinandan Gujjar > --- > lib/librte_eventdev/rte_event_eth_rx_adapter.h | 384 ++++++++ > lib/librte_eventdev/rte_event_eth_rx_adapter.c | 1238 ++++++++++++++++++++++++ > lib/Makefile | 2 +- > lib/librte_eventdev/Makefile | 2 + > lib/librte_eventdev/rte_eventdev_version.map | 11 +- > 5 files changed, 1635 insertions(+), 2 deletions(-) > create mode 100644 lib/librte_eventdev/rte_event_eth_rx_adapter.h > create mode 100644 lib/librte_eventdev/rte_event_eth_rx_adapter.c > > diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.h b/lib/librte_eventdev/rte_event_eth_rx_adapter.h > new file mode 100644 > index 000000000..c3849ec31 > --- /dev/null > +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.h > @@ -0,0 +1,384 @@ > +/* > + > +/** > + * Create a new ethernet Rx event adapter with the specified identifier. > + * > + * @param id > + * The identifier of the ethernet Rx event adapter. > + * > + * @dev_id > + * The identifier of the device to configure. > + * > + * @eth_port_id > + * The identifier of the ethernet device. > + * Invalid param > + * @param conf_cb > + * Callback function that fills in members of a > + * struct rte_event_eth_rx_adapter_conf struct passed into > + * it. > + * > + * @param conf_arg > + * Argument that is passed to the conf_cb function. > + * > + * @return > + * - 0: Success > + * - <0: Error code on failure > + */ > +int rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id, > + rx_adapter_conf_cb conf_cb, > + void *conf_arg); > + > +/** > + * Create a new ethernet Rx event adapter with the specified identifier. > + * This function uses an internal configuration function that creates an event > + * port. This default function reconfigures the event device with an > + * additional event port and setups up the event port using the port_config > + * parameter passed into this function. In case the application needs more > + * control in configuration of the service, it should use the > + * rte_event_eth_rx_adapter_create_ext() version. > + * > + * @param id > + * The identifier of the ethernet Rx event adapter. > + * > + * @dev_id > + * The identifier of the device to configure. > + * > + * @eth_port_id > + * The identifier of the ethernet device. > + * > + * @param conf_cb > + * Callback function that fills in members of a > + * struct rte_event_eth_rx_adapter_conf struct passed into > + * it. > + * > + * @param conf_arg > + * Argument of type *rte_event_port_conf* that is passed to the conf_cb > + * function. > + * Invalid param > + * @return > + * - 0: Success > + * - <0: Error code on failure > + */ > +int rte_event_eth_rx_adapter_create(uint8_t id, uint8_t dev_id, > + struct rte_event_port_conf *port_config); > + > +/** > + * Free an event adapter > + * > + * @param id > + * Adapter identifier. > + * > + * @return > + * - 0: Success > + * - <0: Error code on failure, If the adapter still has Rx queues > + * added to it, the function returns -EBUSY. > + */ > +int rte_event_eth_rx_adapter_free(uint8_t id); > + > +/** > + * Reset statistics for an adapter > + * > + * @param id > + * Adapter identifier. > + * > + * @return > + * - 0: Success, statistics reset successfully. > + * - <0: Error code on failure. > + */ > +int rte_event_eth_rx_adapter_stats_reset(uint8_t id); > + > +/** > + * Retrieve the service ID of an adapter. If the adapter doesn't use > + * a rte_service function, this function returns -ESRCH > + * > + * @param id > + * Adapter identifier. Param missing > + * > + * @return > + * - 0: Success, statistics reset successfully. Invalid description. > + * - <0: Error code on failure, if the adapter doesn't use a rte_service > + * function, this function returns -ESRCH. > + */ > +int rte_event_eth_rx_adapter_service_id_get(uint8_t id, uint32_t *service_id); > + > +#ifdef __cplusplus > +} > +#endif > +#endif /* _RTE_EVENT_ETH_RX_ADAPTER_ */ > diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c > new file mode 100644 > index 000000000..d5b655dae > --- /dev/null > +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c > @@ -0,0 +1,1238 @@ > + > +static int > +rx_adapter_ctrl(uint8_t id, int start) > +{ > + struct rte_event_eth_rx_adapter *rx_adapter; > + struct rte_eventdev *dev; > + struct eth_device_info *dev_info; > + uint32_t i; > + int use_service = 0; > + int stop = !start; > + > + RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL); > + rx_adapter = id_to_rx_adapter(id); > + if (!rx_adapter) > + return -EINVAL; > + > + dev = &rte_eventdevs[rx_adapter->eventdev_id]; > + > + for (i = 0; i < rte_eth_dev_count(); i++) { > + dev_info = &rx_adapter->eth_devices[i]; > + /* if start check for num dev queues */ > + if (start && !dev_info->nb_dev_queues) > + continue; > + /* if stop check if dev has been started */ > + if (stop && !dev_info->dev_rx_started) > + continue; > + use_service |= !dev_info->internal_event_port; > + dev_info->dev_rx_started = start; > + if (!dev_info->internal_event_port) > + continue; > + start ? (*dev->dev_ops->eth_rx_adapter_start)(dev, > + &rte_eth_devices[i]) : > + (*dev->dev_ops->eth_rx_adapter_stop)(dev, > + &rte_eth_devices[i]); > + } > + > + if (use_service) Here setting the service run state is not sufficient we need to enable the service on a service core calling rte_service_start_with_defaults() should be sufficient. > + rte_service_runstate_set(rx_adapter->service_id, start); > + > + return 0; > +} > + Regards, Pavan