src/dpdk/lib/librte_ethdev/rte_flow.c
struct rte_flow *
rte_flow_create(uint16_t port_id,
		const struct rte_flow_attr *attr,
		const struct rte_flow_item pattern[],
		const struct rte_flow_action actions[],
		struct rte_flow_error *error)
{
	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
	struct rte_flow *flow;
	const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);

	if (unlikely(!ops))
		return NULL;
	if (likely(!!ops->create)) {
		fts_enter(dev);
		flow = ops->create(dev, attr, pattern, actions, error);
		fts_exit(dev);
		if (flow == NULL)
			flow_err(port_id, -rte_errno, error);
		return flow;
	}
	rte_flow_error_set(error, ENOSYS, RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
			   NULL, rte_strerror(ENOSYS));
	return NULL;
}
/* Create a flow rule on a given port. */
Create a flow rule on a given port.
Create a flow rule on a given port .
struct rte_flow *
rte_flow_create(uint16_t port_id,
		const struct rte_flow_attr *attr,
		const struct rte_flow_item pattern[],
		const struct rte_flow_action actions[],
		struct rte_flow_error *error)
{
	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
	struct rte_flow *flow;
	const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);
	if (unlikely(!ops))
		return NULL;
	if (likely(!!ops->create)) {
		fts_enter(dev);
		flow = ops->create(dev, attr, pattern, actions, error);
		fts_exit(dev);
		if (flow == NULL)
			flow_err(port_id, -rte_errno, error);
		return flow;
	}
	rte_flow_error_set(error, ENOSYS, RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
			   NULL, rte_strerror(ENOSYS));
	return NULL;
}
struct rte_flow * rte_flow_create ( uint16_t port_id , const struct rte_flow_attr * attr , const struct rte_flow_item pattern [ ] , const struct rte_flow_action actions [ ] , struct rte_flow_error * error ) { struct rte_eth_dev * dev = & rte_eth_devices [ port_id ] ; struct rte_flow * flow ; const struct rte_flow_ops * ops = rte_flow_ops_get ( port_id , error ) ; if ( unlikely ( ! ops ) ) return NULL ; if ( likely ( ! ! ops -> create ) ) { fts_enter ( dev ) ; flow = ops -> create ( dev , attr , pattern , actions , error ) ; fts_exit ( dev ) ; if ( flow == NULL ) flow_err ( port_id , - rte_errno , error ) ; return flow ; } rte_flow_error_set ( error , ENOSYS , RTE_FLOW_ERROR_TYPE_UNSPECIFIED , NULL , rte_strerror ( ENOSYS ) ) ; return NULL ; }
Create a flow rule on a given port.
Create a flow rule on a given port .