sys/dev/cxgbe/common/t4_hw.c
/**
 *	t4_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 t4_set_sched_ipg(struct adapter *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 > M_TXTIMERSEPQ0)
		return -EINVAL;
	t4_write_reg(adap, A_TP_TM_PIO_ADDR, addr);
	v = t4_read_reg(adap, A_TP_TM_PIO_DATA);
	if (sched & 1)
		v = (v & V_TXTIMERSEPQ0(M_TXTIMERSEPQ0)) | V_TXTIMERSEPQ1(ipg);
	else
		v = (v & V_TXTIMERSEPQ1(M_TXTIMERSEPQ1)) | V_TXTIMERSEPQ0(ipg);
	t4_write_reg(adap, A_TP_TM_PIO_DATA, v);
	t4_read_reg(adap, A_TP_TM_PIO_DATA);
	return 0;
}
int t4_set_sched_ipg ( struct adapter * 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 > M_TXTIMERSEPQ0 ) return - EINVAL ; t4_write_reg ( adap , A_TP_TM_PIO_ADDR , addr ) ; v = t4_read_reg ( adap , A_TP_TM_PIO_DATA ) ; if ( sched & 1 ) v = ( v & V_TXTIMERSEPQ0 ( M_TXTIMERSEPQ0 ) ) | V_TXTIMERSEPQ1 ( ipg ) ; else v = ( v & V_TXTIMERSEPQ1 ( M_TXTIMERSEPQ1 ) ) | V_TXTIMERSEPQ0 ( ipg ) ; t4_write_reg ( adap , A_TP_TM_PIO_DATA , v ) ; t4_read_reg ( adap , A_TP_TM_PIO_DATA ) ; return 0 ; }
t4_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
t4_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 */