src/dpdk/drivers/net/txgbe/txgbe_flow.c
static int
txgbe_parse_ntuple_filter(struct rte_eth_dev *dev,
			  const struct rte_flow_attr *attr,
			  const struct rte_flow_item pattern[],
			  const struct rte_flow_action actions[],
			  struct rte_eth_ntuple_filter *filter,
			  struct rte_flow_error *error)
{
	int ret;

	ret = cons_parse_ntuple_filter(attr, pattern, actions, filter, error);

	if (ret)
		return ret;

#ifdef RTE_LIB_SECURITY
	/* ESP flow not really a flow */
	if (filter->proto == IPPROTO_ESP)
		return 0;
#endif

	/* txgbe doesn't support tcp flags */
	if (filter->flags & RTE_NTUPLE_FLAGS_TCP_FLAG) {
		memset(filter, 0, sizeof(struct rte_eth_ntuple_filter));
		rte_flow_error_set(error, EINVAL,
				   RTE_FLOW_ERROR_TYPE_ITEM,
				   NULL, "Not supported by ntuple filter");
		return -rte_errno;
	}

	/* txgbe doesn't support many priorities */
	if (filter->priority < TXGBE_MIN_N_TUPLE_PRIO ||
	    filter->priority > TXGBE_MAX_N_TUPLE_PRIO) {
		memset(filter, 0, sizeof(struct rte_eth_ntuple_filter));
		rte_flow_error_set(error, EINVAL,
			RTE_FLOW_ERROR_TYPE_ITEM,
			NULL, "Priority not supported by ntuple filter");
		return -rte_errno;
	}

	if (filter->queue >= dev->data->nb_rx_queues) {
		memset(filter, 0, sizeof(struct rte_eth_ntuple_filter));
		rte_flow_error_set(error, EINVAL,
				   RTE_FLOW_ERROR_TYPE_ITEM,
				   NULL, "Not supported by ntuple filter");
		return -rte_errno;
	}

	/* fixed value for txgbe */
	filter->flags = RTE_5TUPLE_FLAGS;
	return 0;
}
/* a specific function for txgbe because the flags is specific */
a specific function for txgbe because the flags is specific
a specific function for txgbe because the flags is specific
static int
txgbe_parse_ntuple_filter(struct rte_eth_dev *dev,
			  const struct rte_flow_attr *attr,
			  const struct rte_flow_item pattern[],
			  const struct rte_flow_action actions[],
			  struct rte_eth_ntuple_filter *filter,
			  struct rte_flow_error *error)
{
	int ret;
	ret = cons_parse_ntuple_filter(attr, pattern, actions, filter, error);
	if (ret)
		return ret;
#ifdef RTE_LIB_SECURITY
	if (filter->proto == IPPROTO_ESP)
		return 0;
#endif
	if (filter->flags & RTE_NTUPLE_FLAGS_TCP_FLAG) {
		memset(filter, 0, sizeof(struct rte_eth_ntuple_filter));
		rte_flow_error_set(error, EINVAL,
				   RTE_FLOW_ERROR_TYPE_ITEM,
				   NULL, "Not supported by ntuple filter");
		return -rte_errno;
	}
	if (filter->priority < TXGBE_MIN_N_TUPLE_PRIO ||
	    filter->priority > TXGBE_MAX_N_TUPLE_PRIO) {
		memset(filter, 0, sizeof(struct rte_eth_ntuple_filter));
		rte_flow_error_set(error, EINVAL,
			RTE_FLOW_ERROR_TYPE_ITEM,
			NULL, "Priority not supported by ntuple filter");
		return -rte_errno;
	}
	if (filter->queue >= dev->data->nb_rx_queues) {
		memset(filter, 0, sizeof(struct rte_eth_ntuple_filter));
		rte_flow_error_set(error, EINVAL,
				   RTE_FLOW_ERROR_TYPE_ITEM,
				   NULL, "Not supported by ntuple filter");
		return -rte_errno;
	}
	filter->flags = RTE_5TUPLE_FLAGS;
	return 0;
}
static int txgbe_parse_ntuple_filter ( struct rte_eth_dev * dev , const struct rte_flow_attr * attr , const struct rte_flow_item pattern [ ] , const struct rte_flow_action actions [ ] , struct rte_eth_ntuple_filter * filter , struct rte_flow_error * error ) { int ret ; ret = cons_parse_ntuple_filter ( attr , pattern , actions , filter , error ) ; if ( ret ) return ret ; #ifdef RTE_LIB_SECURITY if ( filter -> proto == IPPROTO_ESP ) return 0 ; #endif if ( filter -> flags & RTE_NTUPLE_FLAGS_TCP_FLAG ) { memset ( filter , 0 , sizeof ( struct rte_eth_ntuple_filter ) ) ; rte_flow_error_set ( error , EINVAL , RTE_FLOW_ERROR_TYPE_ITEM , NULL , " " ) ; return - rte_errno ; } if ( filter -> priority < TXGBE_MIN_N_TUPLE_PRIO || filter -> priority > TXGBE_MAX_N_TUPLE_PRIO ) { memset ( filter , 0 , sizeof ( struct rte_eth_ntuple_filter ) ) ; rte_flow_error_set ( error , EINVAL , RTE_FLOW_ERROR_TYPE_ITEM , NULL , " " ) ; return - rte_errno ; } if ( filter -> queue >= dev -> data -> nb_rx_queues ) { memset ( filter , 0 , sizeof ( struct rte_eth_ntuple_filter ) ) ; rte_flow_error_set ( error , EINVAL , RTE_FLOW_ERROR_TYPE_ITEM , NULL , " " ) ; return - rte_errno ; } filter -> flags = RTE_5TUPLE_FLAGS ; return 0 ; }
a specific function for txgbe because the flags is specific
a specific function for txgbe because the flags is specific
/* ESP flow not really a flow */ /* txgbe doesn't support tcp flags */ /* txgbe doesn't support many priorities */ /* fixed value for txgbe */