FreeBSD/sys/dev/cxgb/common/cxgb_t3_hw.c
/**
 *	t3_set_sched_ipg - set the IPG for a Tx HW packet rate scheduler
 *	@adap: the adapter
 *	@sched: the scheduler index
 *	@ipg: the interpacket delay in tenths of nanoseconds
 *
 *	Set the interpacket delay for a HW packet rate scheduler.
 */
set the IPG for a Tx HW packet rate scheduler
@adap: the adapter
@sched: the scheduler index
@ipg: the interpacket delay in tenths of nanoseconds

Set the interpacket delay for a HW packet rate scheduler.
set the IPG for a Tx HW packet rate scheduler @adap : the adapter @sched : the scheduler index @ipg : the interpacket delay in tenths of nanoseconds Set the interpacket delay for a HW packet rate scheduler .
int t3_set_sched_ipg(adapter_t *adap, int sched, unsigned int ipg)
{
	unsigned int v, addr = A_TP_TX_MOD_Q1_Q0_TIMER_SEPARATOR - sched / 2;
	ipg *= core_ticks_per_usec(adap);
	ipg = (ipg + 5000) / 10000;
	if (ipg > 0xffff)
		return -EINVAL;
	t3_write_reg(adap, A_TP_TM_PIO_ADDR, addr);
	v = t3_read_reg(adap, A_TP_TM_PIO_DATA);
	if (sched & 1)
		v = (v & 0xffff) | (ipg << 16);
	else
		v = (v & 0xffff0000) | ipg;
	t3_write_reg(adap, A_TP_TM_PIO_DATA, v);
	t3_read_reg(adap, A_TP_TM_PIO_DATA);
	return 0;
}
int t3_set_sched_ipg ( adapter_t * adap , int sched , unsigned int ipg ) { unsigned int v , addr = A_TP_TX_MOD_Q1_Q0_TIMER_SEPARATOR - sched / 2 ; ipg *= core_ticks_per_usec ( adap ) ; ipg = ( ipg + 5000 ) / 10000 ; if ( ipg > 0xffff ) return - EINVAL ; t3_write_reg ( adap , A_TP_TM_PIO_ADDR , addr ) ; v = t3_read_reg ( adap , A_TP_TM_PIO_DATA ) ; if ( sched & 1 ) v = ( v & 0xffff ) | ( ipg << 16 ) ; else v = ( v & 0xffff0000 ) | ipg ; t3_write_reg ( adap , A_TP_TM_PIO_DATA , v ) ; t3_read_reg ( adap , A_TP_TM_PIO_DATA ) ; return 0 ; }
t3_set_sched_ipg - set the IPG for a Tx HW packet rate scheduler
      @adap: the adapter
      @sched: the scheduler index
      @ipg: the interpacket delay in tenths of nanoseconds
t3_set_sched_ipg - set the IPG for a Tx HW packet rate scheduler @adap : the adapter @sched : the scheduler index @ipg : the interpacket delay in tenths of nanoseconds
/* convert ipg to nearest number of core clocks */