src/dpdk/drivers/net/cxgbe/base/t4_hw.c
unsigned int t4_get_mps_bg_map(struct adapter *adap, unsigned int pidx)
{
	unsigned int chip_version = CHELSIO_CHIP_VERSION(adap->params.chip);
	unsigned int nports = 1 << G_NUMPORTS(t4_read_reg(adap,
							  A_MPS_CMN_CTL));

	if (pidx >= nports) {
		dev_warn(adap, "MPS Port Index %d >= Nports %d\n",
			 pidx, nports);
		return 0;
	}

	switch (chip_version) {
	case CHELSIO_T4:
	case CHELSIO_T5:
		switch (nports) {
		case 1: return 0xf;
		case 2: return 3 << (2 * pidx);
		case 4: return 1 << pidx;
		}
		break;

	case CHELSIO_T6:
		switch (nports) {
		case 2: return 1 << (2 * pidx);
		}
		break;
	}

	dev_err(adap, "Need MPS Buffer Group Map for Chip %0x, Nports %d\n",
		chip_version, nports);
	return 0;
}
/**
 * t4_get_mps_bg_map - return the buffer groups associated with a port
 * @adap: the adapter
 * @pidx: the port index
 *
 * Returns a bitmap indicating which MPS buffer groups are associated
 * with the given port.  Bit i is set if buffer group i is used by the
 * port.
 */
return the buffer groups associated with a port
@adap: the adapter
@pidx: the port index

Returns a bitmap indicating which MPS buffer groups are associated
with the given port.  Bit i is set if buffer group i is used by the
port.
return the buffer groups associated with a port @adap : the adapter @pidx : the port index Returns a bitmap indicating which MPS buffer groups are associated with the given port . Bit i is set if buffer group i is used by the port .
unsigned int t4_get_mps_bg_map(struct adapter *adap, unsigned int pidx)
{
	unsigned int chip_version = CHELSIO_CHIP_VERSION(adap->params.chip);
	unsigned int nports = 1 << G_NUMPORTS(t4_read_reg(adap,
							  A_MPS_CMN_CTL));
	if (pidx >= nports) {
		dev_warn(adap, "MPS Port Index %d >= Nports %d\n",
			 pidx, nports);
		return 0;
	}
	switch (chip_version) {
	case CHELSIO_T4:
	case CHELSIO_T5:
		switch (nports) {
		case 1: return 0xf;
		case 2: return 3 << (2 * pidx);
		case 4: return 1 << pidx;
		}
		break;
	case CHELSIO_T6:
		switch (nports) {
		case 2: return 1 << (2 * pidx);
		}
		break;
	}
	dev_err(adap, "Need MPS Buffer Group Map for Chip %0x, Nports %d\n",
		chip_version, nports);
	return 0;
}
unsigned int t4_get_mps_bg_map ( struct adapter * adap , unsigned int pidx ) { unsigned int chip_version = CHELSIO_CHIP_VERSION ( adap -> params . chip ) ; unsigned int nports = 1 << G_NUMPORTS ( t4_read_reg ( adap , A_MPS_CMN_CTL ) ) ; if ( pidx >= nports ) { dev_warn ( adap , " \n " , pidx , nports ) ; return 0 ; } switch ( chip_version ) { case CHELSIO_T4 : case CHELSIO_T5 : switch ( nports ) { case 1 : return 0xf ; case 2 : return 3 << ( 2 * pidx ) ; case 4 : return 1 << pidx ; } break ; case CHELSIO_T6 : switch ( nports ) { case 2 : return 1 << ( 2 * pidx ) ; } break ; } dev_err ( adap , " \n " , chip_version , nports ) ; return 0 ; }
t4_get_mps_bg_map - return the buffer groups associated with a port
 @adap: the adapter
 @pidx: the port index
t4_get_mps_bg_map - return the buffer groups associated with a port @adap : the adapter @pidx : the port index