FreeBSD/sys/dev/cxgb/common/cxgb_t3_hw.c
/**
 *	t3_config_rss - configure Rx packet steering
 *	@adapter: the adapter
 *	@rss_config: RSS settings (written to TP_RSS_CONFIG)
 *	@cpus: values for the CPU lookup table (0xff terminated)
 *	@rspq: values for the response queue lookup table (0xffff terminated)
 *
 *	Programs the receive packet steering logic.  @cpus and @rspq provide
 *	the values for the CPU and response queue lookup tables.  If they
 *	provide fewer values than the size of the tables the supplied values
 *	are used repeatedly until the tables are fully populated.
 */
configure Rx packet steering
@adapter: the adapter
@rss_config: RSS settings (written to TP_RSS_CONFIG)
@cpus: values for the CPU lookup table (0xff terminated)
@rspq: values for the response queue lookup table (0xffff terminated)

Programs the receive packet steering logic.  @cpus and @rspq provide
the values for the CPU and response queue lookup tables.  If they
provide fewer values than the size of the tables the supplied values
are used repeatedly until the tables are fully populated.
configure Rx packet steering @adapter : the adapter @rss_config : RSS settings ( written to TP_RSS_CONFIG ) @cpus : values for the CPU lookup table ( 0xff terminated ) @rspq : values for the response queue lookup table ( 0xffff terminated ) Programs the receive packet steering logic . @cpus and @rspq provide the values for the CPU and response queue lookup tables . If they provide fewer values than the size of the tables the supplied values are used repeatedly until the tables are fully populated .
void t3_config_rss(adapter_t *adapter, unsigned int rss_config, const u8 *cpus,
		   const u16 *rspq)
{
	int i, j, cpu_idx = 0, q_idx = 0;
	if (cpus)
		for (i = 0; i < RSS_TABLE_SIZE; ++i) {
			u32 val = i << 16;
			for (j = 0; j < 2; ++j) {
				val |= (cpus[cpu_idx++] & 0x3f) << (8 * j);
				if (cpus[cpu_idx] == 0xff)
					cpu_idx = 0;
			}
			t3_write_reg(adapter, A_TP_RSS_LKP_TABLE, val);
		}
	if (rspq)
		for (i = 0; i < RSS_TABLE_SIZE; ++i) {
			t3_write_reg(adapter, A_TP_RSS_MAP_TABLE,
				     (i << 16) | rspq[q_idx++]);
			if (rspq[q_idx] == 0xffff)
				q_idx = 0;
		}
	t3_write_reg(adapter, A_TP_RSS_CONFIG, rss_config);
}
void t3_config_rss ( adapter_t * adapter , unsigned int rss_config , const u8 * cpus , const u16 * rspq ) { int i , j , cpu_idx = 0 , q_idx = 0 ; if ( cpus ) for ( i = 0 ; i < RSS_TABLE_SIZE ; ++ i ) { u32 val = i << 16 ; for ( j = 0 ; j < 2 ; ++ j ) { val |= ( cpus [ cpu_idx ++ ] & 0x3f ) << ( 8 * j ) ; if ( cpus [ cpu_idx ] == 0xff ) cpu_idx = 0 ; } t3_write_reg ( adapter , A_TP_RSS_LKP_TABLE , val ) ; } if ( rspq ) for ( i = 0 ; i < RSS_TABLE_SIZE ; ++ i ) { t3_write_reg ( adapter , A_TP_RSS_MAP_TABLE , ( i << 16 ) | rspq [ q_idx ++ ] ) ; if ( rspq [ q_idx ] == 0xffff ) q_idx = 0 ; } t3_write_reg ( adapter , A_TP_RSS_CONFIG , rss_config ) ; }
t3_config_rss - configure Rx packet steering
      @adapter: the adapter
      @rss_config: RSS settings (written to TP_RSS_CONFIG)
      @cpus: values for the CPU lookup table (0xff terminated)
      @rspq: values for the response queue lookup table (0xffff terminated)
t3_config_rss - configure Rx packet steering @adapter : the adapter @rss_config : RSS settings ( written to TP_RSS_CONFIG ) @cpus : values for the CPU lookup table ( 0xff terminated ) @rspq : values for the response queue lookup table ( 0xffff terminated )