FreeBSD/sys/dev/cxgb/common/cxgb_t3_hw.c
/**
 *	t3_sge_enable_ecntxt - enable/disable an SGE egress context
 *	@adapter: the adapter
 *	@id: the egress context id
 *	@enable: enable (1) or disable (0) the context
 *
 *	Enable or disable an SGE egress context.  The caller is responsible for
 *	ensuring only one context operation occurs at a time.
 */
enable/disable an SGE egress context
@adapter: the adapter
@id: the egress context id
@enable: enable (1) or disable (0) the context

Enable or disable an SGE egress context.  The caller is responsible for
ensuring only one context operation occurs at a time.
enable / disable an SGE egress context @adapter : the adapter @id : the egress context id @enable : enable ( 1 ) or disable ( 0 ) the context Enable or disable an SGE egress context . The caller is responsible for ensuring only one context operation occurs at a time .
int t3_sge_enable_ecntxt(adapter_t *adapter, unsigned int id, int enable)
{
	if (t3_read_reg(adapter, A_SG_CONTEXT_CMD) & F_CONTEXT_CMD_BUSY)
		return -EBUSY;
	t3_write_reg(adapter, A_SG_CONTEXT_MASK0, 0);
	t3_write_reg(adapter, A_SG_CONTEXT_MASK1, 0);
	t3_write_reg(adapter, A_SG_CONTEXT_MASK2, 0);
	t3_write_reg(adapter, A_SG_CONTEXT_MASK3, F_EC_VALID);
	t3_write_reg(adapter, A_SG_CONTEXT_DATA3, V_EC_VALID(enable));
	t3_write_reg(adapter, A_SG_CONTEXT_CMD,
		     V_CONTEXT_CMD_OPCODE(1) | F_EGRESS | V_CONTEXT(id));
	return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY,
			       0, SG_CONTEXT_CMD_ATTEMPTS, 1);
}
int t3_sge_enable_ecntxt ( adapter_t * adapter , unsigned int id , int enable ) { if ( t3_read_reg ( adapter , A_SG_CONTEXT_CMD ) & F_CONTEXT_CMD_BUSY ) return - EBUSY ; t3_write_reg ( adapter , A_SG_CONTEXT_MASK0 , 0 ) ; t3_write_reg ( adapter , A_SG_CONTEXT_MASK1 , 0 ) ; t3_write_reg ( adapter , A_SG_CONTEXT_MASK2 , 0 ) ; t3_write_reg ( adapter , A_SG_CONTEXT_MASK3 , F_EC_VALID ) ; t3_write_reg ( adapter , A_SG_CONTEXT_DATA3 , V_EC_VALID ( enable ) ) ; t3_write_reg ( adapter , A_SG_CONTEXT_CMD , V_CONTEXT_CMD_OPCODE ( 1 ) | F_EGRESS | V_CONTEXT ( id ) ) ; return t3_wait_op_done ( adapter , A_SG_CONTEXT_CMD , F_CONTEXT_CMD_BUSY , 0 , SG_CONTEXT_CMD_ATTEMPTS , 1 ) ; }
t3_sge_enable_ecntxt - enable/disable an SGE egress context
      @adapter: the adapter
      @id: the egress context id
      @enable: enable (1) or disable (0) the context
t3_sge_enable_ecntxt - enable / disable an SGE egress context @adapter : the adapter @id : the egress context id @enable : enable ( 1 ) or disable ( 0 ) the context