From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 040806932 for ; Fri, 10 Feb 2017 21:29:44 +0100 (CET) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP; 10 Feb 2017 12:29:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,142,1484035200"; d="scan'208";a="63667504" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga005.fm.intel.com with ESMTP; 10 Feb 2017 12:29:43 -0800 Received: from fmsmsx125.amr.corp.intel.com (10.18.125.40) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 10 Feb 2017 12:29:43 -0800 Received: from fmsmsx113.amr.corp.intel.com ([169.254.13.230]) by FMSMSX125.amr.corp.intel.com ([169.254.2.191]) with mapi id 14.03.0248.002; Fri, 10 Feb 2017 12:29:42 -0800 From: "Wiles, Keith" To: "Dumitrescu, Cristian" CC: "dev@dpdk.org" , "thomas.monjalon@6wind.com" , "jerin.jacob@caviumnetworks.com" , "hemant.agrawal@nxp.com" Thread-Topic: [dpdk-dev] [PATCH 1/2] ethdev: add capability control API Thread-Index: AQHSg6bcwgxjGGWElEGKfUHKJieqdqFisYTf Date: Fri, 10 Feb 2017 20:29:42 +0000 Message-ID: <14A543E9-E3B8-43AF-A295-9625633365A0@intel.com> References: <1486735550-149878-1-git-send-email-cristian.dumitrescu@intel.com>, <1486735550-149878-2-git-send-email-cristian.dumitrescu@intel.com> In-Reply-To: <1486735550-149878-2-git-send-email-cristian.dumitrescu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: Fri, 10 Feb 2017 20:29:45 -0000 > On Feb 10, 2017, at 8:06 AM, Cristian Dumitrescu wrote: >=20 > The rte_flow feature breaks the current monolithic approach for ethdev an= d > introduces the new generic flow API to ethdev using a plugin-like approac= h. >=20 > Basically, the rte_flow API is still logically part of ethdev: > - It extends the ethdev functionality: rte_flow is a new feature/capabili= ty > of ethdev; > - all its functions work on an Ethernet device: the first parameter of th= e > rte_flow functions is Ethernet device port ID. >=20 > At the same time, the rte_flow API is a sort of capability plugin for eth= dev: > - 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]. >=20 > 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 fo= r the > support of the rte_flow capability and return the pointer to the > rte_flow operations when supported and NULL otherwise: >=20 > struct rte_flow_ops *eth_flow_ops; > int rte =3D rte_eth_dev_filter_ctrl(eth_port_id, > RTE_ETH_FILTER_GENERIC, RTE_ETH_FILTER_GET, ð_flow_ops); >=20 > 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. >=20 > This is the gap that addressed by the current patch. This mechanism is in= tended > 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 al= so be > used for exposing the existing Ethernet device capabilities in a modular = way, > such as: xstats, filters, multicast, mirroring, tunnels, time stamping, e= eprom, > bypass, etc. >=20 > Signed-off-by: Cristian Dumitrescu Acked by: Keith.wiles@intel.com > > --- > 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(+) >=20 > 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); > } >=20 > +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 =3D &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_callba= ck); > * structure associated with an Ethernet device. > */ >=20 > +enum rte_eth_capability { > + RTE_ETH_CAPABILITY_FLOW =3D 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. */ >=20 > @@ -1427,6 +1433,10 @@ typedef int (*eth_filter_ctrl_t)(struct rte_eth_de= v *dev, > void *arg); > /**< @internal Take operations to assigned filter type on an Ethernet dev= ice */ >=20 > +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 cloc= k time. */ > eth_timesync_write_time timesync_write_time; /** Set the device clo= ck time. */ > + > + eth_capability_control_t cap_ctrl; /**< capability control. */ > }; >=20 > /** > @@ -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); >=20 > /** > + * 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. > + * @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); > + > +/** > * Get DCB information on an Ethernet device. > * > * @param port_id > diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rt= e_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; >=20 > } DPDK_16.11; > + > +DPDK_17.05 { > + global: > + > + rte_eth_dev_capability_control; > + > +} DPDK_17.02; > --=20 > 2.5.0 >=20