src/dpdk/drivers/net/cxgbe/cxgbe_filter.c
void cxgbe_hash_filter_rpl(struct adapter *adap,
			   const struct cpl_act_open_rpl *rpl)
{
	struct tid_info *t = &adap->tids;
	struct filter_entry *f;
	struct filter_ctx *ctx = NULL;
	unsigned int tid = GET_TID(rpl);
	unsigned int ftid = G_TID_TID(G_AOPEN_ATID
				      (be32_to_cpu(rpl->atid_status)));
	unsigned int status  = G_AOPEN_STATUS(be32_to_cpu(rpl->atid_status));

	f = lookup_atid(t, ftid);
	if (!f) {
		dev_warn(adap, "%s: could not find filter entry: %d\n",
			 __func__, ftid);
		return;
	}

	ctx = f->ctx;
	f->ctx = NULL;

	switch (status) {
	case CPL_ERR_NONE: {
		f->tid = tid;
		f->pending = 0;  /* asynchronous setup completed */
		f->valid = 1;

		cxgbe_insert_tid(t, f, f->tid, 0);
		cxgbe_free_atid(t, ftid);
		if (ctx) {
			ctx->tid = f->tid;
			ctx->result = 0;
		}
		if (f->fs.hitcnts)
			set_tcb_field(adap, tid,
				      W_TCB_TIMESTAMP,
				      V_TCB_TIMESTAMP(M_TCB_TIMESTAMP) |
				      V_TCB_T_RTT_TS_RECENT_AGE
					      (M_TCB_T_RTT_TS_RECENT_AGE),
				      V_TCB_TIMESTAMP(0ULL) |
				      V_TCB_T_RTT_TS_RECENT_AGE(0ULL),
				      1);
		if (f->fs.newdmac)
			set_tcb_tflag(adap, tid, S_TF_CCTRL_ECE, 1, 1);
		if (f->fs.newvlan == VLAN_INSERT ||
		    f->fs.newvlan == VLAN_REWRITE)
			set_tcb_tflag(adap, tid, S_TF_CCTRL_RFR, 1, 1);
		if (f->fs.newsmac) {
			set_tcb_tflag(adap, tid, S_TF_CCTRL_CWR, 1, 1);
			set_tcb_field(adap, tid, W_TCB_SMAC_SEL,
				      V_TCB_SMAC_SEL(M_TCB_SMAC_SEL),
				      V_TCB_SMAC_SEL(f->smt->hw_idx), 1);
		}
		break;
	}
	default:
		dev_warn(adap, "%s: filter creation failed with status = %u\n",
			 __func__, status);

		if (ctx) {
			if (status == CPL_ERR_TCAM_FULL)
				ctx->result = -EAGAIN;
			else
				ctx->result = -EINVAL;
		}

		cxgbe_free_atid(t, ftid);
		clear_filter(f);
		t4_os_free(f);
	}

	if (ctx)
		t4_complete(&ctx->completion);
}
/**
 * Handle a Hash filter write reply.
 */
Handle a Hash filter write reply.
Handle a Hash filter write reply .
void cxgbe_hash_filter_rpl(struct adapter *adap,
			   const struct cpl_act_open_rpl *rpl)
{
	struct tid_info *t = &adap->tids;
	struct filter_entry *f;
	struct filter_ctx *ctx = NULL;
	unsigned int tid = GET_TID(rpl);
	unsigned int ftid = G_TID_TID(G_AOPEN_ATID
				      (be32_to_cpu(rpl->atid_status)));
	unsigned int status  = G_AOPEN_STATUS(be32_to_cpu(rpl->atid_status));
	f = lookup_atid(t, ftid);
	if (!f) {
		dev_warn(adap, "%s: could not find filter entry: %d\n",
			 __func__, ftid);
		return;
	}
	ctx = f->ctx;
	f->ctx = NULL;
	switch (status) {
	case CPL_ERR_NONE: {
		f->tid = tid;
		f->pending = 0;  
		f->valid = 1;
		cxgbe_insert_tid(t, f, f->tid, 0);
		cxgbe_free_atid(t, ftid);
		if (ctx) {
			ctx->tid = f->tid;
			ctx->result = 0;
		}
		if (f->fs.hitcnts)
			set_tcb_field(adap, tid,
				      W_TCB_TIMESTAMP,
				      V_TCB_TIMESTAMP(M_TCB_TIMESTAMP) |
				      V_TCB_T_RTT_TS_RECENT_AGE
					      (M_TCB_T_RTT_TS_RECENT_AGE),
				      V_TCB_TIMESTAMP(0ULL) |
				      V_TCB_T_RTT_TS_RECENT_AGE(0ULL),
				      1);
		if (f->fs.newdmac)
			set_tcb_tflag(adap, tid, S_TF_CCTRL_ECE, 1, 1);
		if (f->fs.newvlan == VLAN_INSERT ||
		    f->fs.newvlan == VLAN_REWRITE)
			set_tcb_tflag(adap, tid, S_TF_CCTRL_RFR, 1, 1);
		if (f->fs.newsmac) {
			set_tcb_tflag(adap, tid, S_TF_CCTRL_CWR, 1, 1);
			set_tcb_field(adap, tid, W_TCB_SMAC_SEL,
				      V_TCB_SMAC_SEL(M_TCB_SMAC_SEL),
				      V_TCB_SMAC_SEL(f->smt->hw_idx), 1);
		}
		break;
	}
	default:
		dev_warn(adap, "%s: filter creation failed with status = %u\n",
			 __func__, status);
		if (ctx) {
			if (status == CPL_ERR_TCAM_FULL)
				ctx->result = -EAGAIN;
			else
				ctx->result = -EINVAL;
		}
		cxgbe_free_atid(t, ftid);
		clear_filter(f);
		t4_os_free(f);
	}
	if (ctx)
		t4_complete(&ctx->completion);
}
void cxgbe_hash_filter_rpl ( struct adapter * adap , const struct cpl_act_open_rpl * rpl ) { struct tid_info * t = & adap -> tids ; struct filter_entry * f ; struct filter_ctx * ctx = NULL ; unsigned int tid = GET_TID ( rpl ) ; unsigned int ftid = G_TID_TID ( G_AOPEN_ATID ( be32_to_cpu ( rpl -> atid_status ) ) ) ; unsigned int status = G_AOPEN_STATUS ( be32_to_cpu ( rpl -> atid_status ) ) ; f = lookup_atid ( t , ftid ) ; if ( ! f ) { dev_warn ( adap , " \n " , __func__ , ftid ) ; return ; } ctx = f -> ctx ; f -> ctx = NULL ; switch ( status ) { case CPL_ERR_NONE : { f -> tid = tid ; f -> pending = 0 ; f -> valid = 1 ; cxgbe_insert_tid ( t , f , f -> tid , 0 ) ; cxgbe_free_atid ( t , ftid ) ; if ( ctx ) { ctx -> tid = f -> tid ; ctx -> result = 0 ; } if ( f -> fs . hitcnts ) set_tcb_field ( adap , tid , W_TCB_TIMESTAMP , V_TCB_TIMESTAMP ( M_TCB_TIMESTAMP ) | V_TCB_T_RTT_TS_RECENT_AGE ( M_TCB_T_RTT_TS_RECENT_AGE ) , V_TCB_TIMESTAMP ( 0ULL ) | V_TCB_T_RTT_TS_RECENT_AGE ( 0ULL ) , 1 ) ; if ( f -> fs . newdmac ) set_tcb_tflag ( adap , tid , S_TF_CCTRL_ECE , 1 , 1 ) ; if ( f -> fs . newvlan == VLAN_INSERT || f -> fs . newvlan == VLAN_REWRITE ) set_tcb_tflag ( adap , tid , S_TF_CCTRL_RFR , 1 , 1 ) ; if ( f -> fs . newsmac ) { set_tcb_tflag ( adap , tid , S_TF_CCTRL_CWR , 1 , 1 ) ; set_tcb_field ( adap , tid , W_TCB_SMAC_SEL , V_TCB_SMAC_SEL ( M_TCB_SMAC_SEL ) , V_TCB_SMAC_SEL ( f -> smt -> hw_idx ) , 1 ) ; } break ; } default : dev_warn ( adap , " \n " , __func__ , status ) ; if ( ctx ) { if ( status == CPL_ERR_TCAM_FULL ) ctx -> result = - EAGAIN ; else ctx -> result = - EINVAL ; } cxgbe_free_atid ( t , ftid ) ; clear_filter ( f ) ; t4_os_free ( f ) ; } if ( ctx ) t4_complete ( & ctx -> completion ) ; }
Handle a Hash filter write reply.
Handle a Hash filter write reply .
/* asynchronous setup completed */