FreeBSD/sys/dev/cxgbe/common/t4_hw.c
/**
 *	t4_get_trace_filter - query one of the tracing filters
 *	@adap: the adapter
 *	@tp: the current trace filter parameters
 *	@idx: which trace filter to query
 *	@enabled: non-zero if the filter is enabled
 *
 *	Returns the current settings of one of the HW tracing filters.
 */
query one of the tracing filters
@adap: the adapter
@tp: the current trace filter parameters
@idx: which trace filter to query
@enabled: non-zero if the filter is enabled

Returns the current settings of one of the HW tracing filters.
query one of the tracing filters @adap : the adapter @tp : the current trace filter parameters @idx : which trace filter to query @enabled : non - zero if the filter is enabled Returns the current settings of one of the HW tracing filters .
void t4_get_trace_filter(struct adapter *adap, struct trace_params *tp, int idx,
			 int *enabled)
{
	u32 ctla, ctlb;
	int i, ofst = idx * 4;
	u32 data_reg, mask_reg;
	ctla = t4_read_reg(adap, A_MPS_TRC_FILTER_MATCH_CTL_A + ofst);
	ctlb = t4_read_reg(adap, A_MPS_TRC_FILTER_MATCH_CTL_B + ofst);
	if (is_t4(adap)) {
		*enabled = !!(ctla & F_TFEN);
		tp->port =  G_TFPORT(ctla);
		tp->invert = !!(ctla & F_TFINVERTMATCH);
	} else {
		*enabled = !!(ctla & F_T5_TFEN);
		tp->port = G_T5_TFPORT(ctla);
		tp->invert = !!(ctla & F_T5_TFINVERTMATCH);
	}
	tp->snap_len = G_TFCAPTUREMAX(ctlb);
	tp->min_len = G_TFMINPKTSIZE(ctlb);
	tp->skip_ofst = G_TFOFFSET(ctla);
	tp->skip_len = G_TFLENGTH(ctla);
	ofst = (A_MPS_TRC_FILTER1_MATCH - A_MPS_TRC_FILTER0_MATCH) * idx;
	data_reg = A_MPS_TRC_FILTER0_MATCH + ofst;
	mask_reg = A_MPS_TRC_FILTER0_DONT_CARE + ofst;
	for (i = 0; i < TRACE_LEN / 4; i++, data_reg += 4, mask_reg += 4) {
		tp->mask[i] = ~t4_read_reg(adap, mask_reg);
		tp->data[i] = t4_read_reg(adap, data_reg) & tp->mask[i];
	}
}
void t4_get_trace_filter ( struct adapter * adap , struct trace_params * tp , int idx , int * enabled ) { u32 ctla , ctlb ; int i , ofst = idx * 4 ; u32 data_reg , mask_reg ; ctla = t4_read_reg ( adap , A_MPS_TRC_FILTER_MATCH_CTL_A + ofst ) ; ctlb = t4_read_reg ( adap , A_MPS_TRC_FILTER_MATCH_CTL_B + ofst ) ; if ( is_t4 ( adap ) ) { * enabled = ! ! ( ctla & F_TFEN ) ; tp -> port = G_TFPORT ( ctla ) ; tp -> invert = ! ! ( ctla & F_TFINVERTMATCH ) ; } else { * enabled = ! ! ( ctla & F_T5_TFEN ) ; tp -> port = G_T5_TFPORT ( ctla ) ; tp -> invert = ! ! ( ctla & F_T5_TFINVERTMATCH ) ; } tp -> snap_len = G_TFCAPTUREMAX ( ctlb ) ; tp -> min_len = G_TFMINPKTSIZE ( ctlb ) ; tp -> skip_ofst = G_TFOFFSET ( ctla ) ; tp -> skip_len = G_TFLENGTH ( ctla ) ; ofst = ( A_MPS_TRC_FILTER1_MATCH - A_MPS_TRC_FILTER0_MATCH ) * idx ; data_reg = A_MPS_TRC_FILTER0_MATCH + ofst ; mask_reg = A_MPS_TRC_FILTER0_DONT_CARE + ofst ; for ( i = 0 ; i < TRACE_LEN / 4 ; i ++ , data_reg += 4 , mask_reg += 4 ) { tp -> mask [ i ] = ~ t4_read_reg ( adap , mask_reg ) ; tp -> data [ i ] = t4_read_reg ( adap , data_reg ) & tp -> mask [ i ] ; } }
t4_get_trace_filter - query one of the tracing filters
      @adap: the adapter
      @tp: the current trace filter parameters
      @idx: which trace filter to query
      @enabled: non-zero if the filter is enabled
t4_get_trace_filter - query one of the tracing filters @adap : the adapter @tp : the current trace filter parameters @idx : which trace filter to query @enabled : non - zero if the filter is enabled