From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0041.outbound.protection.outlook.com [104.47.40.41]) by dpdk.org (Postfix) with ESMTP id 122D0952 for ; Tue, 21 Feb 2017 13:46:07 +0100 (CET) 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=HVsCTM4kwmmnbuNXnv4tE7cI2WvZa3qm9SjU0HUUWtk=; b=VLHwfxz163iJINp/bPtdVjMCeV0FCqKXQ8Dhkvo7mZ6NqqjFNfWqN7qN2r71cGmg10VQjN3Uv7BCeF8M5IgUOw4He9mNE4aERX/3s8xsahJnensDJhM1F6GIQ72RJXCuU3lHMrw1fuOBSOHNsKnXpBKuC2/Bd5epkLlDQvusqdg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; Received: from localhost.localdomain (111.93.218.67) by BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16; Tue, 21 Feb 2017 12:46:03 +0000 Date: Tue, 21 Feb 2017 18:15:42 +0530 From: Jerin Jacob To: Cristian Dumitrescu Cc: dev@dpdk.org, thomas.monjalon@6wind.com, hemant.agrawal@nxp.com Message-ID: <20170221124541.GA4411@localhost.localdomain> References: <1486735550-149878-1-git-send-email-cristian.dumitrescu@intel.com> <1486735550-149878-2-git-send-email-cristian.dumitrescu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1486735550-149878-2-git-send-email-cristian.dumitrescu@intel.com> User-Agent: Mutt/1.7.1 (2016-10-04) X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MAXPR01CA0018.INDPRD01.PROD.OUTLOOK.COM (10.164.147.25) To BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) X-MS-Office365-Filtering-Correlation-Id: 06e4333e-5c05-43b7-2d77-08d45a5799aa X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 3:W8Z92X5AnDhYfTHTfOprjCazUJ9PWNUux6/AyjudFXDMBuTsWKWy3P9WE+zUii1OKixB5/cnjm9q9v5qI88+Y4CkS5OnnGHMfaFLowynSLN7LLTAmXquX/ym2RS3kc82cooZoKRwEnbwWKwRYK6w2wy2ef5fsxqKjhY6lZJSuHpJjC8hK/nFAH48YFojPM8HRMdx5iZUGjhKBYKvflMl3ZYs4P2F5lXupMPUehnoBSIwaSH5tmWOW/4WXp0R/aiksJsPiVSFdllMnVvSx5/VFg==; 25:Biv1Uru5JQDA6V9wDdanXCEg9PrXsW3sDJ6Yoa2tKOidB20bI21MtfKfbTa4EN1JTT+tN4uU82mM7BOJDrZoVvsqFrzefeCnj3JiIREproIcthSkU37ZBmYWFpDd08b4gRz1y5cubzK/1+bp4vt7iRRVMetBoi+taCetTzR9SK/02XDIkqRBeLoaBd4lgf9McMr4JHCGFoDiNey7jqdpXfmsaALfWmbeUm/uHDFcZksNFpKn9k7L6PQN/v+o9HNUZEiBjFQjoXnVMJaRkdF7BQ8NC2Ob/oozfOU/i3QVe1X6eTXxG8nmfbtFaudKyE9LOPjwjDG0hpIbBU7Mxd8xoIF2EmNmKP1Gp/DPuLgRcBDPmUPOLcgiXp7yVRVyZ4iV2Wh3rmJSya9TXPThs7YvaPLd6LO1BzXVpUhh8j5EZe/es++TXfQtB5VXZfzBn2WqW28pMPUmtRKrtOcNYwYB1A== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 31:QFpphFSc+DJLvccn8lehwEuBtuKpzAmcCy5cXv0m6PP1Iy7jJemrr/BkmEHG8jgmcmQSm5XINylScgIwBgZKJjHieCIqRr1fMEFDYkoKyVi+JbW66XhUkANg5XD9Q4tPXz5R3kyua9GHe6RQ2WuMfu9Y5P3R6DoKF5NWzNFmNYlln3Be2Ea0w5iffX67jaLHG6CfT81hLoAv4XBuLruTNdio9BBnKeEZUTDRd9uFiOR/KCGVWOgqzR0jaC7RjowTtRVULrMuOIaDPfNWCgg6HQ==; 20:2Yu+3aorzLUuA/DDXd/4OtbSIQct1MQO9bky5JmjlkagfkhQJwtTEg5wsIvF5vwukK+EEFRkqmIg+CXQ8yakkV+o0uGq7YcKexWpU8QNY2hADCw8fvbnEbbx7zv2BWTLCHsaGw2tky6mgeQJcrQtrcNZElR7De5EEHUq+WlhaA7rI8o7OwZARxf4UfyWdEI07GYbCKTwagwsgOHYo7yhx136Pis17hKC163EYxae54IblXIQo6xc/TBtVxCBzaSNIEWTI2MlecZCdG503RIzivmw0w7VnR0ngwpkhGLdXihdSFJp2TM59Q+GupMWKpPk/tRqnsWPaKQfaa3Il92+OvliCuBpW+sj2NN5ItJkdlY8zHRTemhJ/LXzsBmlTy0hzmj4mf+uQFF2OcjNXPaMLs16uCdxzaPhBsxfhDqkznazwrxyYrIr7C79I/zYk/tAI2FqAhTbVUYlYNZBlJJoGJtemgS2n8CKo063mL4hZJysS7PXxl5bkWPLxFqvZSlqOv2rXAceO4GW5kUyYsIuBxVe0/wS5VzjzoC8cEkOCzKlyMKSUNizX2Ybp74iUJpcSaC3KIyrB1PDTMIf0hvRJRHMHk6Le2PmVqYrPf+5Ybc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6041248)(20161123564025)(20161123558025)(20161123560025)(20161123555025)(20161123562025)(6072148)(6042181); SRVR:BLUPR0701MB1714; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 4:10yKRUK7gsh4i+tQRgIouEz72ban2D+P6cmsd13bSCoOY5TZ+Dk/UmeKJGK003CKg7bj/NlTz2iUfsxH88UsbSV5QFYoRuVcpGPylR+p3wF/UhQQ5KGBjh6gNS8USX5ChmKP9x02r8dYuEsx+LOjo3DCq3WtporajGMZODzZR6IN6gIja2bWoE5D1YTLN7LlPEIJXGY9v0H1BzkBnqwhJZjP8cIYW9b5KQrw0pLDU4pJSr3JfOEfBjKaq0Bl+OG8Tp/aceV8Rzu31jwNaApXiKlLGb3IVIiAz3t2hwi3+jcSD/6fwkw9J9/Gzx9Nb6rKIi49t/fQlwuulGB0qkquR4b4XCGergydR4knQMlj3uH/UlhBnnqOit2gl66my4RODsJ1av8Uew5IgzQNufH1YSUiXf9aCnRkmKExpaSFeLNk3z1EBzTIDhCC1wrKuwG1Np/Xiq1GyWoE1pkwlYCtGlqSGkCApiI6IittPAeK2pj/WVmAGye/HOBeHE9ewXatLbXzpxuvCJbhai+NOPBeWR32sYTmh4Mv/5OG7+VG2A7NsnsJlD1wi+Q1FKy+hi+VYvGOlyrd3uc2TkXBdwDRtNBo9EZuAp93osUEaQXUBbuDL4ve4xAwNB9imOIoh5WqNe6ABDXjfEY3R7yAJtNF0hoV5/aRCwgCC/T7+P8e3vg= X-Forefront-PRVS: 0225B0D5BC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(199003)(189002)(24454002)(229853002)(575784001)(25786008)(55016002)(33656002)(5660300001)(2906002)(2950100002)(4001350100001)(47776003)(3846002)(50466002)(97736004)(6916009)(42186005)(6666003)(101416001)(6506006)(53936002)(81166006)(110136004)(6246003)(42882006)(66066001)(38730400002)(61506002)(1076002)(7736002)(305945005)(76176999)(68736007)(50986999)(5009440100003)(6116002)(23726003)(9686003)(92566002)(189998001)(8676002)(81156014)(83506001)(8656002)(106356001)(54356999)(105586002)(7099028)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1714; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; BLUPR0701MB1714; 23:JNnnTtifkm6JTQWqhe0j6mIU+vc7jDVwpojtMnn?= =?us-ascii?Q?fRiRoSFw/qzuqeUepjNvkeE64EV4HzbQfha9FrgKGOoabqgZ9zr41IEpAfll?= =?us-ascii?Q?gFWBJljZe/JU1ytoltZ3mr0m2mCLvbMBM31h18hLdO8Alio/uU4dGlyD+hUz?= =?us-ascii?Q?wXtloeMU29WB4/x54h5vQ/Y0EUBvqddfBM9dzCTndVpZia2I3PA/15kdPDuk?= =?us-ascii?Q?R7vVPPeyXQdZv0aMYQe0k9SkpLVXxortwSWByiD/+ectjgO/6sXNbZ2VyfQY?= =?us-ascii?Q?DOqHcqUxS22zNmlwqdJ1GwW1YrdpyoOO1lwX86+wvprxoDn16P2DDcjfVMIc?= =?us-ascii?Q?hdKVJbl3IgpB2fMj2PqT3LLsxjQe955RORAnfUGxFXj3BDqkWvt/hJBKV+cE?= =?us-ascii?Q?Y0hR5MQ/KUH1BP0WJZJ5+M9OtDSt7h5Lsn8VIDb8JkMLd9IWYuaglwXvfo4b?= =?us-ascii?Q?sK2DeE21TIm1Ej238I5pxcg3sHUusV7g+FktTNSlMHCnaZhIbFkJ64sRVulK?= =?us-ascii?Q?xCleBPYfcrG1g+fqYWA4+dPGRfbocb84idjqHrr5oNvGKPLj6UwhY1DUKVLu?= =?us-ascii?Q?apTGjuryaMmJ1YdNrcBm1IVUb4cEefFM8Wiiafkk4Mxql11KfhBnH0MJAGvw?= =?us-ascii?Q?m2He/pLc9vQMIjDmOTi2Cz/HHi8d5Dh8QYwMJ+RXdsHFkFezRrs78qkF65tV?= =?us-ascii?Q?CITFtXyBGUogw8ZdxbY6YC5d28746w0DMSxk+MK9Y+Hn1BomhBSz+Jvg1bdf?= =?us-ascii?Q?CrV5LihluMqBu58NAsWm3ivK1LcgJpp/3WkufvhvaPxb8kqH7Bnh7tjJ0o7N?= =?us-ascii?Q?+o+kbwiJfBUtIEFvWe1mgc4BpXowkpP5ykOlrYCu8izAYCRNSG0aRT4HcL5B?= =?us-ascii?Q?UVvePt6Wf1iYrqM30snZhTZZE2+NrLgEfn0ZM/gaxaq5pHWd8a/AOTnmLSvM?= =?us-ascii?Q?8SpxKN2+42Eu2UhwWitchiGF2aPN4zxynng61px8jjDeGQiSptrP4ilswUX+?= =?us-ascii?Q?es7zRn6UexlVta+NS/h63/W1QS4mmz/VCA/0/D/cHyovJfww6rW3BAlDPyQt?= =?us-ascii?Q?aOvWUMsAynLhjOWK272SCpQgPe9YIcU3U+KsAt/tQCutbfRIKnr1gF4I2SF3?= =?us-ascii?Q?cuECNhCVnnnL/CI2Mbqfd0YPQOZU40bfpfCepeh0pK07B1FWyw5MgKmUwFDZ?= =?us-ascii?Q?CZ4jLKg2b83db/Bvu3U8lTJme/nkWBCs7A2sGc2JRiUMwZ52+1eVmrWcxfng?= =?us-ascii?Q?eH3i6W751+n6KPxqCNk7PIPzzWoI56XDgjK2cbr1g/ewE/6lCKyhNTizHxHa?= =?us-ascii?Q?yCA=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 6:0NAH0d6mAyQ6HweSN58LjxofiBAKDMAOoXVTiFcKWuRySwNIovE+Tcqdbw9PGH2s/SFm6dZfAAElMqmzXGsIwEA6RL7gCyfn/t5lbd1exqd85M8qOrWBxSOvw5Z3L/2uZ9O/q6L9N51DYuS1BzimEnbftray6/QRbSSLJ48mp66Imo5HAtuBEnPZBgQJ8u5ALczqlxPu8uTv/isjlJDcTMVcpAq4px/SfqpcqqzLduCDxgnsf9b3NIc+rycGwRUcZAjCsqDrIH8AskAbqDfFP2AlX94rN0Icwb5zLCvKdJsU9TAak32vDhiakDm5/34DyPbrN15/jyxBBd2C62GQe1OW5rarPLfFKdDMQ8xosf1MuVljdSPyMHrYh2M3iwrvs4c2hsiimWGJZauBPbch6w==; 5:4tB1ni3MswlEgJw02QiL/zBn9vI3JqhEnqztAQT5HqKR/8jlDuoF6sLN9r/8hDD/HkZo3U4NWz6pdfb69at//u3kEARmrhR0UeaRwEuezOf0aBXNzpkHf4q/JsBtLwEHzWT6mzHtndFgCwcf2N3OCw==; 24:yIgYrdPtAot4X8TwnByUj3P3WkyzPr3xAwoEgZfee/TCcEUNdpZ46btBveN4cdeCEyYLQDqqqBhIRW2CQb6k5nh3Dzl5ERU8z4nrY+Ym6yY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 7:0DzQ0tdmch4oBJvtF0X7OryLOuKpkgjJkhNgszZEHAv0dzSo619ak9tqSjRaNpRLkSPq7/pMMjfRLhkQwjNl29JQ9UMR6NBgnN5rKmKslFD0837TF6fPeap9+pDfw3sAVFA4Ya5WRR2hbW3lTdWEPshwxhrmj7jdW0SAxTGzJ3dCddLgjP1N1gbWighG1O9y/b2O+7nRqHz1ACxKV5GgSoCHWf7PANppF4hOdrTK+C3vyFQQgAF779ndf1hznpNSO5e3BIyNPBtjOCvcy02d2w7aQCo0zbTJYiWFWMgBZPgBgaI5at6gYTo5+PThPLVZT1iCUw8J7RXQW5r/kyr3Hw== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2017 12:46:03.8740 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1714 Subject: Re: [dpdk-dev] [PATCH 1/2] ethdev: add capability control API 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: Tue, 21 Feb 2017 12:46:08 -0000 On Fri, Feb 10, 2017 at 02:05:49PM +0000, Cristian Dumitrescu wrote: > The rte_flow feature breaks the current monolithic approach for ethdev and > introduces the new generic flow API to ethdev using a plugin-like approach. > > Basically, the rte_flow API is still logically part of ethdev: > - It extends the ethdev functionality: rte_flow is a new feature/capability > of ethdev; > - all its functions work on an Ethernet device: the first parameter of the > rte_flow functions is Ethernet device port ID. > > At the same time, the rte_flow API is a sort of capability plugin for ethdev: > - the rte_flow API functions have their own name space: they are called > rte_flow_operationXYZ() as opposed to rte_eth_dev_flow_operationXYZ()); > - the rte_flow API functions are placed in separate files in the same > librte_ether folder as opposed to rte_ethdev.[hc]. > > The way it works is by using the existing ethdev API function > rte_eth_dev_filter_ctrl() to query the current Ethernet device port ID for the > support of the rte_flow capability and return the pointer to the > rte_flow operations when supported and NULL otherwise: > > struct rte_flow_ops *eth_flow_ops; > int rte = rte_eth_dev_filter_ctrl(eth_port_id, > RTE_ETH_FILTER_GENERIC, RTE_ETH_FILTER_GET, ð_flow_ops); > > Unfortunately, the rte_flow opportunistically uses the rte_eth_dev_filter_ctrl() > API function, which is applicable just to RX-side filters as opposed to > introducing a mechanism that could be used by any capability in a generic way. > > This is the gap that addressed by the current patch. This mechanism is intended > to be used to introduce new capabilities into ethdev in a modular plugin-like > approach, such as hierarchical scheduler. Over time, if agreed, it can also be > used for exposing the existing Ethernet device capabilities in a modular way, > such as: xstats, filters, multicast, mirroring, tunnels, time stamping, eeprom, > bypass, etc. > > Signed-off-by: Cristian Dumitrescu > --- > lib/librte_ether/rte_ethdev.c | 13 +++++++++++++ > lib/librte_ether/rte_ethdev.h | 29 +++++++++++++++++++++++++++++ > lib/librte_ether/rte_ether_version.map | 7 +++++++ > 3 files changed, 49 insertions(+) > > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index eb0a94a..ae187c4 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -2802,6 +2802,19 @@ rte_eth_dev_filter_ctrl(uint8_t port_id, enum rte_filter_type filter_type, > return (*dev->dev_ops->filter_ctrl)(dev, filter_type, filter_op, arg); > } > > +int > +rte_eth_dev_capability_control(uint8_t port_id, enum rte_eth_capability cap, > + void *arg) > +{ > + struct rte_eth_dev *dev; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > + > + dev = &rte_eth_devices[port_id]; > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->cap_ctrl, -ENOTSUP); > + return (*dev->dev_ops->cap_ctrl)(dev, cap, arg); > +} > + > void * > rte_eth_add_rx_callback(uint8_t port_id, uint16_t queue_id, > rte_rx_callback_fn fn, void *user_param) > diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h > index c17bbda..43ffb9e 100644 > --- a/lib/librte_ether/rte_ethdev.h > +++ b/lib/librte_ether/rte_ethdev.h > @@ -1073,6 +1073,12 @@ TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback); > * structure associated with an Ethernet device. > */ > > +enum rte_eth_capability { > + RTE_ETH_CAPABILITY_FLOW = 0, /**< Flow */ > + RTE_ETH_CAPABILITY_SCHED, /**< Hierarchical Scheduler */ > + RTE_ETH_CAPABILITY_MAX > +}; > + > typedef int (*eth_dev_configure_t)(struct rte_eth_dev *dev); > /**< @internal Ethernet device configuration. */ > > @@ -1427,6 +1433,10 @@ typedef int (*eth_filter_ctrl_t)(struct rte_eth_dev *dev, > void *arg); > /**< @internal Take operations to assigned filter type on an Ethernet device */ > > +typedef int (*eth_capability_control_t)(struct rte_eth_dev *dev, > + enum rte_eth_capability cap, void *arg); > +/**< @internal Take capability operations on an Ethernet device */ > + > typedef int (*eth_get_dcb_info)(struct rte_eth_dev *dev, > struct rte_eth_dcb_info *dcb_info); > /**< @internal Get dcb information on an Ethernet device */ > @@ -1548,6 +1558,8 @@ struct eth_dev_ops { > eth_timesync_adjust_time timesync_adjust_time; /** Adjust the device clock. */ > eth_timesync_read_time timesync_read_time; /** Get the device clock time. */ > eth_timesync_write_time timesync_write_time; /** Set the device clock time. */ > + > + eth_capability_control_t cap_ctrl; /**< capability control. */ > }; > > /** > @@ -3890,6 +3902,23 @@ int rte_eth_dev_filter_ctrl(uint8_t port_id, enum rte_filter_type filter_type, > enum rte_filter_op filter_op, void *arg); > > /** > + * Take capability operations on an Ethernet device. > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @param cap > + * The capability of the Ethernet device > + * @param arg > + * A pointer to arguments defined specifically for the operation. Better to add _out_ for output parameter. @param[out] arg. > + * @return > + * - (0) if successful. > + * - (-ENOTSUP) if hardware doesn't support. > + * - (-ENODEV) if *port_id* invalid. > + */ > +int rte_eth_dev_capability_control(uint8_t port_id, > + enum rte_eth_capability cap, void *arg); I like the idea of "plugin" interface to ethdev to accommodate hierarchical scheduler ops with different name space like rte_flow. Though I don't have strong opinion on the API name, I think its better to have something end with _ops_get instead of capability_control With that suggestion, Acked-by: Jerin Jacob > + > +/** > * Get DCB information on an Ethernet device. > * > * @param port_id > diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map > index c6c9d0d..d00cb5c 100644 > --- a/lib/librte_ether/rte_ether_version.map > +++ b/lib/librte_ether/rte_ether_version.map > @@ -154,3 +154,10 @@ DPDK_17.02 { > rte_flow_validate; > > } DPDK_16.11; > + > +DPDK_17.05 { > + global: > + > + rte_eth_dev_capability_control; > + > +} DPDK_17.02; > -- > 2.5.0 >