FreeBSD/sys/dev/cxgb/common/cxgb_t3_hw.c
/**
 *	t3_config_trace_filter - configure one of the tracing filters
 *	@adapter: the adapter
 *	@tp: the desired trace filter parameters
 *	@filter_index: which filter to configure
 *	@invert: if set non-matching packets are traced instead of matching ones
 *	@enable: whether to enable or disable the filter
 *
 *	Configures one of the tracing filters available in HW.
 */


Configures one of the tracing filters available in HW.
Configures one of the tracing filters available in HW .
void t3_config_trace_filter(adapter_t *adapter, const struct trace_params *tp,
			    int filter_index, int invert, int enable)
{
	u32 addr, key[4], mask[4];
	key[0] = tp->sport | (tp->sip << 16);
	key[1] = (tp->sip >> 16) | (tp->dport << 16);
	key[2] = tp->dip;
	key[3] = tp->proto | (tp->vlan << 8) | (tp->intf << 20);
	mask[0] = tp->sport_mask | (tp->sip_mask << 16);
	mask[1] = (tp->sip_mask >> 16) | (tp->dport_mask << 16);
	mask[2] = tp->dip_mask;
	mask[3] = tp->proto_mask | (tp->vlan_mask << 8) | (tp->intf_mask << 20);
	if (invert)
		key[3] |= (1 << 29);
	if (enable)
		key[3] |= (1 << 28);
	addr = filter_index ? A_TP_RX_TRC_KEY0 : A_TP_TX_TRC_KEY0;
	tp_wr_indirect(adapter, addr++, key[0]);
	tp_wr_indirect(adapter, addr++, mask[0]);
	tp_wr_indirect(adapter, addr++, key[1]);
	tp_wr_indirect(adapter, addr++, mask[1]);
	tp_wr_indirect(adapter, addr++, key[2]);
	tp_wr_indirect(adapter, addr++, mask[2]);
	tp_wr_indirect(adapter, addr++, key[3]);
	tp_wr_indirect(adapter, addr,   mask[3]);
	(void) t3_read_reg(adapter, A_TP_PIO_DATA);
}
void t3_config_trace_filter ( adapter_t * adapter , const struct trace_params * tp , int filter_index , int invert , int enable ) { u32 addr , key [ 4 ] , mask [ 4 ] ; key [ 0 ] = tp -> sport | ( tp -> sip << 16 ) ; key [ 1 ] = ( tp -> sip >> 16 ) | ( tp -> dport << 16 ) ; key [ 2 ] = tp -> dip ; key [ 3 ] = tp -> proto | ( tp -> vlan << 8 ) | ( tp -> intf << 20 ) ; mask [ 0 ] = tp -> sport_mask | ( tp -> sip_mask << 16 ) ; mask [ 1 ] = ( tp -> sip_mask >> 16 ) | ( tp -> dport_mask << 16 ) ; mask [ 2 ] = tp -> dip_mask ; mask [ 3 ] = tp -> proto_mask | ( tp -> vlan_mask << 8 ) | ( tp -> intf_mask << 20 ) ; if ( invert ) key [ 3 ] |= ( 1 << 29 ) ; if ( enable ) key [ 3 ] |= ( 1 << 28 ) ; addr = filter_index ? A_TP_RX_TRC_KEY0 : A_TP_TX_TRC_KEY0 ; tp_wr_indirect ( adapter , addr ++ , key [ 0 ] ) ; tp_wr_indirect ( adapter , addr ++ , mask [ 0 ] ) ; tp_wr_indirect ( adapter , addr ++ , key [ 1 ] ) ; tp_wr_indirect ( adapter , addr ++ , mask [ 1 ] ) ; tp_wr_indirect ( adapter , addr ++ , key [ 2 ] ) ; tp_wr_indirect ( adapter , addr ++ , mask [ 2 ] ) ; tp_wr_indirect ( adapter , addr ++ , key [ 3 ] ) ; tp_wr_indirect ( adapter , addr , mask [ 3 ] ) ; ( void ) t3_read_reg ( adapter , A_TP_PIO_DATA ) ; }
t3_config_trace_filter - configure one of the tracing filters
      @adapter: the adapter
      @tp: the desired trace filter parameters
      @filter_index: which filter to configure
      @invert: if set non-matching packets are traced instead of matching ones
      @enable: whether to enable or disable the filter
t3_config_trace_filter - configure one of the tracing filters @adapter : the adapter @tp : the desired trace filter parameters @filter_index : which filter to configure @invert : if set non - matching packets are traced instead of matching ones @enable : whether to enable or disable the filter