FreeBSD/sys/dev/cxgb/common/cxgb_t3_hw.c
/**
 *	t3_load_mtus - write the MTU and congestion control HW tables
 *	@adap: the adapter
 *	@mtus: the unrestricted values for the MTU table
 *	@alpha: the values for the congestion control alpha parameter
 *	@beta: the values for the congestion control beta parameter
 *	@mtu_cap: the maximum permitted effective MTU
 *
 *	Write the MTU table with the supplied MTUs capping each at &mtu_cap.
 *	Update the high-speed congestion control table with the supplied alpha,
 * 	beta, and MTUs.
 */


Write the MTU table with the supplied MTUs capping each at &mtu_cap.
Update the high-speed congestion control table with the supplied alpha,
beta, and MTUs.
Write the MTU table with the supplied MTUs capping each at &mtu_cap . Update the high - speed congestion control table with the supplied alpha beta and MTUs .
void t3_load_mtus(adapter_t *adap, unsigned short mtus[NMTUS],
		  unsigned short alpha[NCCTRL_WIN],
		  unsigned short beta[NCCTRL_WIN], unsigned short mtu_cap)
{
	static const unsigned int avg_pkts[NCCTRL_WIN] = {
		2, 6, 10, 14, 20, 28, 40, 56, 80, 112, 160, 224, 320, 448, 640,
		896, 1281, 1792, 2560, 3584, 5120, 7168, 10240, 14336, 20480,
		28672, 40960, 57344, 81920, 114688, 163840, 229376 };
	unsigned int i, w;
	for (i = 0; i < NMTUS; ++i) {
		unsigned int mtu = min(mtus[i], mtu_cap);
		unsigned int log2 = fls(mtu);
		if (!(mtu & ((1 << log2) >> 2)))     
			log2--;
		t3_write_reg(adap, A_TP_MTU_TABLE,
			     (i << 24) | (log2 << 16) | mtu);
		for (w = 0; w < NCCTRL_WIN; ++w) {
			unsigned int inc;
			inc = max(((mtu - 40) * alpha[w]) / avg_pkts[w],
				  CC_MIN_INCR);
			t3_write_reg(adap, A_TP_CCTRL_TABLE, (i << 21) |
				     (w << 16) | (beta[w] << 13) | inc);
		}
	}
}
void t3_load_mtus ( adapter_t * adap , unsigned short mtus [ NMTUS ] , unsigned short alpha [ NCCTRL_WIN ] , unsigned short beta [ NCCTRL_WIN ] , unsigned short mtu_cap ) { static const unsigned int avg_pkts [ NCCTRL_WIN ] = { 2 , 6 , 10 , 14 , 20 , 28 , 40 , 56 , 80 , 112 , 160 , 224 , 320 , 448 , 640 , 896 , 1281 , 1792 , 2560 , 3584 , 5120 , 7168 , 10240 , 14336 , 20480 , 28672 , 40960 , 57344 , 81920 , 114688 , 163840 , 229376 } ; unsigned int i , w ; for ( i = 0 ; i < NMTUS ; ++ i ) { unsigned int mtu = min ( mtus [ i ] , mtu_cap ) ; unsigned int log2 = fls ( mtu ) ; if ( ! ( mtu & ( ( 1 << log2 ) >> 2 ) ) ) log2 -- ; t3_write_reg ( adap , A_TP_MTU_TABLE , ( i << 24 ) | ( log2 << 16 ) | mtu ) ; for ( w = 0 ; w < NCCTRL_WIN ; ++ w ) { unsigned int inc ; inc = max ( ( ( mtu - 40 ) * alpha [ w ] ) / avg_pkts [ w ] , CC_MIN_INCR ) ; t3_write_reg ( adap , A_TP_CCTRL_TABLE , ( i << 21 ) | ( w << 16 ) | ( beta [ w ] << 13 ) | inc ) ; } } }
t3_load_mtus - write the MTU and congestion control HW tables
      @adap: the adapter
      @mtus: the unrestricted values for the MTU table
      @alpha: the values for the congestion control alpha parameter
      @beta: the values for the congestion control beta parameter
      @mtu_cap: the maximum permitted effective MTU
t3_load_mtus - write the MTU and congestion control HW tables @adap : the adapter @mtus : the unrestricted values for the MTU table @alpha : the values for the congestion control alpha parameter @beta : the values for the congestion control beta parameter @mtu_cap : the maximum permitted effective MTU
/* round */