FreeBSD/sys/dev/cxgbe/common/t4_hw.c
/**
 *	t4_set_filter_mode - configure the optional components of filter tuples
 *	@adap: the adapter
 *	@mode_map: a bitmap selcting which optional filter components to enable
 *
 *	Sets the filter mode by selecting the optional components to enable
 *	in filter tuples.  Returns 0 on success and a negative error if the
 *	requested mode needs more bits than are available for optional
 *	components.
 */
configure the optional components of filter tuples
@adap: the adapter
@mode_map: a bitmap selcting which optional filter components to enable

Sets the filter mode by selecting the optional components to enable
in filter tuples.  Returns 0 on success and a negative error if the
requested mode needs more bits than are available for optional
components.
configure the optional components of filter tuples @adap : the adapter @mode_map : a bitmap selcting which optional filter components to enable Sets the filter mode by selecting the optional components to enable in filter tuples . Returns 0 on success and a negative error if the requested mode needs more bits than are available for optional components .
int t4_set_filter_mode(struct adapter *adap, unsigned int mode_map)
{
	static u8 width[] = { 1, 3, 17, 17, 8, 8, 16, 9, 3, 1 };
	int i, nbits = 0;
	for (i = S_FCOE; i <= S_FRAGMENTATION; i++)
		if (mode_map & (1 << i))
			nbits += width[i];
	if (nbits > FILTER_OPT_LEN)
		return -EINVAL;
	if (t4_use_ldst(adap))
		t4_fw_tp_pio_rw(adap, &mode_map, 1, A_TP_VLAN_PRI_MAP, 0);
	else
		t4_write_indirect(adap, A_TP_PIO_ADDR, A_TP_PIO_DATA, &mode_map,
				  1, A_TP_VLAN_PRI_MAP);
	read_filter_mode_and_ingress_config(adap);
	return 0;
}
int t4_set_filter_mode ( struct adapter * adap , unsigned int mode_map ) { static u8 width [ ] = { 1 , 3 , 17 , 17 , 8 , 8 , 16 , 9 , 3 , 1 } ; int i , nbits = 0 ; for ( i = S_FCOE ; i <= S_FRAGMENTATION ; i ++ ) if ( mode_map & ( 1 << i ) ) nbits += width [ i ] ; if ( nbits > FILTER_OPT_LEN ) return - EINVAL ; if ( t4_use_ldst ( adap ) ) t4_fw_tp_pio_rw ( adap , & mode_map , 1 , A_TP_VLAN_PRI_MAP , 0 ) ; else t4_write_indirect ( adap , A_TP_PIO_ADDR , A_TP_PIO_DATA , & mode_map , 1 , A_TP_VLAN_PRI_MAP ) ; read_filter_mode_and_ingress_config ( adap ) ; return 0 ; }
t4_set_filter_mode - configure the optional components of filter tuples
      @adap: the adapter
      @mode_map: a bitmap selcting which optional filter components to enable
t4_set_filter_mode - configure the optional components of filter tuples @adap : the adapter @mode_map : a bitmap selcting which optional filter components to enable