src/dpdk/drivers/net/i40e/i40e_fdir.c
static int
i40e_sw_fdir_filter_insert(struct i40e_pf *pf, struct i40e_fdir_filter *filter)
{
	struct i40e_fdir_info *fdir_info = &pf->fdir;
	struct i40e_fdir_filter *hash_filter;
	int ret;

	if (filter->fdir.input.flow_ext.pkt_template)
		ret = rte_hash_add_key_with_hash(fdir_info->hash_table,
				 &filter->fdir.input,
				 filter->fdir.input.flow.raw_flow.length);
	else
		ret = rte_hash_add_key(fdir_info->hash_table,
				       &filter->fdir.input);
	if (ret < 0) {
		PMD_DRV_LOG(ERR,
			    "Failed to insert fdir filter to hash table %d!",
			    ret);
		return ret;
	}

	if (fdir_info->hash_map[ret])
		return -1;

	hash_filter = &fdir_info->fdir_filter_array[ret];
	rte_memcpy(hash_filter, filter, sizeof(*filter));
	fdir_info->hash_map[ret] = hash_filter;
	TAILQ_INSERT_TAIL(&fdir_info->fdir_list, hash_filter, rules);

	return 0;
}
/* Add a flow director filter into the SW list */
Add a flow director filter into the SW list
Add a flow director filter into the SW list
static int
i40e_sw_fdir_filter_insert(struct i40e_pf *pf, struct i40e_fdir_filter *filter)
{
	struct i40e_fdir_info *fdir_info = &pf->fdir;
	struct i40e_fdir_filter *hash_filter;
	int ret;
	if (filter->fdir.input.flow_ext.pkt_template)
		ret = rte_hash_add_key_with_hash(fdir_info->hash_table,
				 &filter->fdir.input,
				 filter->fdir.input.flow.raw_flow.length);
	else
		ret = rte_hash_add_key(fdir_info->hash_table,
				       &filter->fdir.input);
	if (ret < 0) {
		PMD_DRV_LOG(ERR,
			    "Failed to insert fdir filter to hash table %d!",
			    ret);
		return ret;
	}
	if (fdir_info->hash_map[ret])
		return -1;
	hash_filter = &fdir_info->fdir_filter_array[ret];
	rte_memcpy(hash_filter, filter, sizeof(*filter));
	fdir_info->hash_map[ret] = hash_filter;
	TAILQ_INSERT_TAIL(&fdir_info->fdir_list, hash_filter, rules);
	return 0;
}
static int i40e_sw_fdir_filter_insert ( struct i40e_pf * pf , struct i40e_fdir_filter * filter ) { struct i40e_fdir_info * fdir_info = & pf -> fdir ; struct i40e_fdir_filter * hash_filter ; int ret ; if ( filter -> fdir . input . flow_ext . pkt_template ) ret = rte_hash_add_key_with_hash ( fdir_info -> hash_table , & filter -> fdir . input , filter -> fdir . input . flow . raw_flow . length ) ; else ret = rte_hash_add_key ( fdir_info -> hash_table , & filter -> fdir . input ) ; if ( ret < 0 ) { PMD_DRV_LOG ( ERR , " " , ret ) ; return ret ; } if ( fdir_info -> hash_map [ ret ] ) return -1 ; hash_filter = & fdir_info -> fdir_filter_array [ ret ] ; rte_memcpy ( hash_filter , filter , sizeof ( * filter ) ) ; fdir_info -> hash_map [ ret ] = hash_filter ; TAILQ_INSERT_TAIL ( & fdir_info -> fdir_list , hash_filter , rules ) ; return 0 ; }
Add a flow director filter into the SW list
Add a flow director filter into the SW list