[dpdk-dev] [PATCH v3 1/2] ethdev: add capability control API

Thomas Monjalon thomas.monjalon at 6wind.com
Mon Mar 6 11:32:16 CET 2017


Hi Cristian,

2017-03-04 01:10, Cristian Dumitrescu:
> 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, &eth_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.
> 
> Changes in v3:
> -Followed up on suggestion from Jerin: renamed capability from Hierarchical
>  Scheduler (sched) to Traffic Manager (tm)
> 
> Changes in v2:
> -Followed up on suggestion from Jerin and Hemant: renamed capability_control()
>  to capability_ops_get()
> -Added ACK from Keith, Jerin and Hemant

It is difficult to follow previous discussions as you do not
keep threading with --in-reply-to.

> Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu at intel.com>
> Acked-by: Keith Wiles <keith.wiles at intel.com>
> Acked-by: Jerin Jacob <jerin.jacob at caviumnetworks.com>
> Acked-by: Hemant Agrawal <hemant.agrawal at nxp.com>
[...]
> +enum rte_eth_capability {
> +	RTE_ETH_CAPABILITY_FLOW = 0, /**< Flow */
> +	RTE_ETH_CAPABILITY_TM, /**< Traffic Manager */
> +	RTE_ETH_CAPABILITY_MAX
> +};
[...]
>  /**
> + * 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_ops_get(uint8_t port_id,
> +	enum rte_eth_capability cap, void *arg);

What is the benefit of getting different kind of capabilities with
the same function?
enum + void* = ioctl
A self-explanatory API should have a dedicated function for each kind
of features with different argument types.



More information about the dev mailing list