FreeBSD/sys/dev/cxgbe/common/t4_hw.c
/**
 *	t4_get_tx_sched - get the configuration of a Tx HW traffic scheduler
 *	@adap: the adapter
 *	@sched: the scheduler index
 *	@kbps: the byte rate in Kbps
 *	@ipg: the interpacket delay in tenths of nanoseconds
 *
 *	Return the current configuration of a HW Tx scheduler.
 */
get the configuration of a Tx HW traffic scheduler
@adap: the adapter
@sched: the scheduler index
@kbps: the byte rate in Kbps
@ipg: the interpacket delay in tenths of nanoseconds

Return the current configuration of a HW Tx scheduler.
get the configuration of a Tx HW traffic scheduler @adap : the adapter @sched : the scheduler index @kbps : the byte rate in Kbps @ipg : the interpacket delay in tenths of nanoseconds Return the current configuration of a HW Tx scheduler .
void t4_get_tx_sched(struct adapter *adap, unsigned int sched, unsigned int *kbps,
		     unsigned int *ipg)
{
	unsigned int v, addr, bpt, cpt;
	if (kbps) {
		addr = A_TP_TX_MOD_Q1_Q0_RATE_LIMIT - sched / 2;
		t4_write_reg(adap, A_TP_TM_PIO_ADDR, addr);
		v = t4_read_reg(adap, A_TP_TM_PIO_DATA);
		if (sched & 1)
			v >>= 16;
		bpt = (v >> 8) & 0xff;
		cpt = v & 0xff;
		if (!cpt)
			*kbps = 0;	
		else {
			v = (adap->params.vpd.cclk * 1000) / cpt; 
			*kbps = (v * bpt) / 125;
		}
	}
	if (ipg) {
		addr = A_TP_TX_MOD_Q1_Q0_TIMER_SEPARATOR - sched / 2;
		t4_write_reg(adap, A_TP_TM_PIO_ADDR, addr);
		v = t4_read_reg(adap, A_TP_TM_PIO_DATA);
		if (sched & 1)
			v >>= 16;
		v &= 0xffff;
		*ipg = (10000 * v) / core_ticks_per_usec(adap);
	}
}
void t4_get_tx_sched ( struct adapter * adap , unsigned int sched , unsigned int * kbps , unsigned int * ipg ) { unsigned int v , addr , bpt , cpt ; if ( kbps ) { addr = A_TP_TX_MOD_Q1_Q0_RATE_LIMIT - sched / 2 ; t4_write_reg ( adap , A_TP_TM_PIO_ADDR , addr ) ; v = t4_read_reg ( adap , A_TP_TM_PIO_DATA ) ; if ( sched & 1 ) v >>= 16 ; bpt = ( v >> 8 ) & 0xff ; cpt = v & 0xff ; if ( ! cpt ) * kbps = 0 ; else { v = ( adap -> params . vpd . cclk * 1000 ) / cpt ; * kbps = ( v * bpt ) / 125 ; } } if ( ipg ) { addr = A_TP_TX_MOD_Q1_Q0_TIMER_SEPARATOR - sched / 2 ; t4_write_reg ( adap , A_TP_TM_PIO_ADDR , addr ) ; v = t4_read_reg ( adap , A_TP_TM_PIO_DATA ) ; if ( sched & 1 ) v >>= 16 ; v &= 0xffff ; * ipg = ( 10000 * v ) / core_ticks_per_usec ( adap ) ; } }
t4_get_tx_sched - get the configuration of a Tx HW traffic scheduler
      @adap: the adapter
      @sched: the scheduler index
      @kbps: the byte rate in Kbps
      @ipg: the interpacket delay in tenths of nanoseconds
t4_get_tx_sched - get the configuration of a Tx HW traffic scheduler @adap : the adapter @sched : the scheduler index @kbps : the byte rate in Kbps @ipg : the interpacket delay in tenths of nanoseconds
/* scheduler disabled */ /* ticks/s */