src/drivers/trex_i40e_fdir.c
int
trex_i40e_fdir_ctrl_func(struct rte_eth_dev *dev,
		       enum trex_rte_filter_op filter_op,
		       void *arg)
{
	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
	int ret = 0;

	if ((pf->flags & I40E_FLAG_FDIR) == 0)
		return -ENOTSUP;

	if (filter_op == TREX_RTE_ETH_FILTER_NOP)
		return 0;

	if (arg == NULL && filter_op != TREX_RTE_ETH_FILTER_FLUSH)
		return -EINVAL;

	switch (filter_op) {
	case TREX_RTE_ETH_FILTER_ADD:
		ret = trex_i40e_add_del_fdir_filter(dev,
			(struct trex_rte_eth_fdir_filter *)arg,
			TRUE);
		break;
	case TREX_RTE_ETH_FILTER_DELETE:
		ret = trex_i40e_add_del_fdir_filter(dev,
			(struct trex_rte_eth_fdir_filter *)arg,
			FALSE);
		break;
	case TREX_RTE_ETH_FILTER_FLUSH:
		ret = trex_i40e_fdir_flush(dev);
		break;
	case TREX_RTE_ETH_FILTER_INFO:
		trex_i40e_fdir_info_get(dev, (struct trex_rte_eth_fdir_info *)arg);
		break;
	case TREX_RTE_ETH_FILTER_SET:
		ret = i40e_fdir_filter_set(dev,
			(struct trex_rte_eth_fdir_filter_info *)arg);
		break;
	case TREX_RTE_ETH_FILTER_STATS:
		trex_i40e_fdir_stats_get(dev, (struct trex_rte_eth_fdir_stats *)arg);
		break;
	default:
		PMD_DRV_LOG(ERR, "unknown operation %u.", filter_op);
		ret = -EINVAL;
		break;
	}
	return ret;
}
/*
 * i40e_fdir_ctrl_func - deal with all operations on flow director.
 * @pf: board private structure
 * @filter_op:operation will be taken.
 * @arg: a pointer to specific structure corresponding to the filter_op
 */
deal with all operations on flow director.
@pf: board private structure
@filter_op:operation will be taken.
@arg: a pointer to specific structure corresponding to the filter_op
deal with all operations on flow director . @pf : board private structure @filter_op : operation will be taken . @arg : a pointer to specific structure corresponding to the filter_op
int
trex_i40e_fdir_ctrl_func(struct rte_eth_dev *dev,
		       enum trex_rte_filter_op filter_op,
		       void *arg)
{
	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
	int ret = 0;
	if ((pf->flags & I40E_FLAG_FDIR) == 0)
		return -ENOTSUP;
	if (filter_op == TREX_RTE_ETH_FILTER_NOP)
		return 0;
	if (arg == NULL && filter_op != TREX_RTE_ETH_FILTER_FLUSH)
		return -EINVAL;
	switch (filter_op) {
	case TREX_RTE_ETH_FILTER_ADD:
		ret = trex_i40e_add_del_fdir_filter(dev,
			(struct trex_rte_eth_fdir_filter *)arg,
			TRUE);
		break;
	case TREX_RTE_ETH_FILTER_DELETE:
		ret = trex_i40e_add_del_fdir_filter(dev,
			(struct trex_rte_eth_fdir_filter *)arg,
			FALSE);
		break;
	case TREX_RTE_ETH_FILTER_FLUSH:
		ret = trex_i40e_fdir_flush(dev);
		break;
	case TREX_RTE_ETH_FILTER_INFO:
		trex_i40e_fdir_info_get(dev, (struct trex_rte_eth_fdir_info *)arg);
		break;
	case TREX_RTE_ETH_FILTER_SET:
		ret = i40e_fdir_filter_set(dev,
			(struct trex_rte_eth_fdir_filter_info *)arg);
		break;
	case TREX_RTE_ETH_FILTER_STATS:
		trex_i40e_fdir_stats_get(dev, (struct trex_rte_eth_fdir_stats *)arg);
		break;
	default:
		PMD_DRV_LOG(ERR, "unknown operation %u.", filter_op);
		ret = -EINVAL;
		break;
	}
	return ret;
}
int trex_i40e_fdir_ctrl_func ( struct rte_eth_dev * dev , enum trex_rte_filter_op filter_op , void * arg ) { struct i40e_pf * pf = I40E_DEV_PRIVATE_TO_PF ( dev -> data -> dev_private ) ; int ret = 0 ; if ( ( pf -> flags & I40E_FLAG_FDIR ) == 0 ) return - ENOTSUP ; if ( filter_op == TREX_RTE_ETH_FILTER_NOP ) return 0 ; if ( arg == NULL && filter_op != TREX_RTE_ETH_FILTER_FLUSH ) return - EINVAL ; switch ( filter_op ) { case TREX_RTE_ETH_FILTER_ADD : ret = trex_i40e_add_del_fdir_filter ( dev , ( struct trex_rte_eth_fdir_filter * ) arg , TRUE ) ; break ; case TREX_RTE_ETH_FILTER_DELETE : ret = trex_i40e_add_del_fdir_filter ( dev , ( struct trex_rte_eth_fdir_filter * ) arg , FALSE ) ; break ; case TREX_RTE_ETH_FILTER_FLUSH : ret = trex_i40e_fdir_flush ( dev ) ; break ; case TREX_RTE_ETH_FILTER_INFO : trex_i40e_fdir_info_get ( dev , ( struct trex_rte_eth_fdir_info * ) arg ) ; break ; case TREX_RTE_ETH_FILTER_SET : ret = i40e_fdir_filter_set ( dev , ( struct trex_rte_eth_fdir_filter_info * ) arg ) ; break ; case TREX_RTE_ETH_FILTER_STATS : trex_i40e_fdir_stats_get ( dev , ( struct trex_rte_eth_fdir_stats * ) arg ) ; break ; default : PMD_DRV_LOG ( ERR , " " , filter_op ) ; ret = - EINVAL ; break ; } return ret ; }
i40e_fdir_ctrl_func - deal with all operations on flow director.
i40e_fdir_ctrl_func - deal with all operations on flow director .