src/dpdk/drivers/net/cxgbe/cxgbe_filter.c
int cxgbe_del_filter(struct rte_eth_dev *dev, unsigned int filter_id,
		     struct ch_filter_specification *fs,
		     struct filter_ctx *ctx)
{
	struct port_info *pi = dev->data->dev_private;
	struct adapter *adapter = pi->adapter;
	struct filter_entry *f;
	unsigned int chip_ver;
	u8 nentries;
	int ret;

	if (is_hashfilter(adapter) && fs->cap)
		return cxgbe_del_hash_filter(dev, filter_id, ctx);

	if (filter_id >= adapter->tids.nftids)
		return -ERANGE;

	chip_ver = CHELSIO_CHIP_VERSION(adapter->params.chip);

	/*
	 * Ensure IPv6 filter id is aligned on the 2 slot boundary for T6,
	 * and 4 slot boundary for cards below T6.
	 */
	if (fs->type == FILTER_TYPE_IPV6) {
		if (chip_ver < CHELSIO_T6)
			filter_id &= ~(0x3);
		else
			filter_id &= ~(0x1);
	}

	nentries = cxgbe_filter_slots(adapter, fs->type);
	ret = cxgbe_is_filter_set(&adapter->tids, filter_id, nentries);
	if (!ret) {
		dev_warn(adap, "%s: could not find filter entry: %u\n",
			 __func__, filter_id);
		return -EINVAL;
	}

	f = &adapter->tids.ftid_tab[filter_id];
	ret = writable_filter(f);
	if (ret)
		return ret;

	if (f->valid) {
		f->ctx = ctx;
		cxgbe_clear_ftid(&adapter->tids,
				 f->tid - adapter->tids.ftid_base,
				 nentries);
		return del_filter_wr(dev, filter_id);
	}

	/*
	 * If the caller has passed in a Completion Context then we need to
	 * mark it as a successful completion so they don't stall waiting
	 * for it.
	 */
	if (ctx) {
		ctx->result = 0;
		t4_complete(&ctx->completion);
	}

	return 0;
}
/**
 * Check a delete filter request for validity and send it to the hardware.
 * Return 0 on success, an error number otherwise.  We attach any provided
 * filter operation context to the internal filter specification in order to
 * facilitate signaling completion of the operation.
 */
Check a delete filter request for validity and send it to the hardware.
Return 0 on success, an error number otherwise.  We attach any provided
filter operation context to the internal filter specification in order to
facilitate signaling completion of the operation.
Check a delete filter request for validity and send it to the hardware . Return 0 on success an error number otherwise . We attach any provided filter operation context to the internal filter specification in order to facilitate signaling completion of the operation .
int cxgbe_del_filter(struct rte_eth_dev *dev, unsigned int filter_id,
		     struct ch_filter_specification *fs,
		     struct filter_ctx *ctx)
{
	struct port_info *pi = dev->data->dev_private;
	struct adapter *adapter = pi->adapter;
	struct filter_entry *f;
	unsigned int chip_ver;
	u8 nentries;
	int ret;
	if (is_hashfilter(adapter) && fs->cap)
		return cxgbe_del_hash_filter(dev, filter_id, ctx);
	if (filter_id >= adapter->tids.nftids)
		return -ERANGE;
	chip_ver = CHELSIO_CHIP_VERSION(adapter->params.chip);
	if (fs->type == FILTER_TYPE_IPV6) {
		if (chip_ver < CHELSIO_T6)
			filter_id &= ~(0x3);
		else
			filter_id &= ~(0x1);
	}
	nentries = cxgbe_filter_slots(adapter, fs->type);
	ret = cxgbe_is_filter_set(&adapter->tids, filter_id, nentries);
	if (!ret) {
		dev_warn(adap, "%s: could not find filter entry: %u\n",
			 __func__, filter_id);
		return -EINVAL;
	}
	f = &adapter->tids.ftid_tab[filter_id];
	ret = writable_filter(f);
	if (ret)
		return ret;
	if (f->valid) {
		f->ctx = ctx;
		cxgbe_clear_ftid(&adapter->tids,
				 f->tid - adapter->tids.ftid_base,
				 nentries);
		return del_filter_wr(dev, filter_id);
	}
	if (ctx) {
		ctx->result = 0;
		t4_complete(&ctx->completion);
	}
	return 0;
}
int cxgbe_del_filter ( struct rte_eth_dev * dev , unsigned int filter_id , struct ch_filter_specification * fs , struct filter_ctx * ctx ) { struct port_info * pi = dev -> data -> dev_private ; struct adapter * adapter = pi -> adapter ; struct filter_entry * f ; unsigned int chip_ver ; u8 nentries ; int ret ; if ( is_hashfilter ( adapter ) && fs -> cap ) return cxgbe_del_hash_filter ( dev , filter_id , ctx ) ; if ( filter_id >= adapter -> tids . nftids ) return - ERANGE ; chip_ver = CHELSIO_CHIP_VERSION ( adapter -> params . chip ) ; if ( fs -> type == FILTER_TYPE_IPV6 ) { if ( chip_ver < CHELSIO_T6 ) filter_id &= ~ ( 0x3 ) ; else filter_id &= ~ ( 0x1 ) ; } nentries = cxgbe_filter_slots ( adapter , fs -> type ) ; ret = cxgbe_is_filter_set ( & adapter -> tids , filter_id , nentries ) ; if ( ! ret ) { dev_warn ( adap , " \n " , __func__ , filter_id ) ; return - EINVAL ; } f = & adapter -> tids . ftid_tab [ filter_id ] ; ret = writable_filter ( f ) ; if ( ret ) return ret ; if ( f -> valid ) { f -> ctx = ctx ; cxgbe_clear_ftid ( & adapter -> tids , f -> tid - adapter -> tids . ftid_base , nentries ) ; return del_filter_wr ( dev , filter_id ) ; } if ( ctx ) { ctx -> result = 0 ; t4_complete ( & ctx -> completion ) ; } return 0 ; }
Check a delete filter request for validity and send it to the hardware.
Check a delete filter request for validity and send it to the hardware .
/*
	 * Ensure IPv6 filter id is aligned on the 2 slot boundary for T6,
	 * and 4 slot boundary for cards below T6.
	 */ /*
	 * If the caller has passed in a Completion Context then we need to
	 * mark it as a successful completion so they don't stall waiting
	 * for it.
	 */