FreeBSD/sys/dev/cxgb/common/cxgb_xgmac.c
/**
 *	t3_mac_disable - disable the MAC in the given directions
 *	@mac: the MAC to configure
 *	@which: bitmap indicating which directions to disable
 *
 *	Disables the MAC in the given directions.
 *	%MAC_DIRECTION_TX disables the Tx direction, and %MAC_DIRECTION_RX
 *	disables the Rx one.
 */
disable the MAC in the given directions
@mac: the MAC to configure
@which: bitmap indicating which directions to disable

Disables the MAC in the given directions.
%MAC_DIRECTION_TX disables the Tx direction, and %MAC_DIRECTION_RX
disables the Rx one.
disable the MAC in the given directions @mac : the MAC to configure @which : bitmap indicating which directions to disable Disables the MAC in the given directions . %MAC_DIRECTION_TX disables the Tx direction and %MAC_DIRECTION_RX disables the Rx one .
int t3_mac_disable(struct cmac *mac, int which)
{
	adapter_t *adap = mac->adapter;
	if (mac->multiport)
		return t3_vsc7323_disable(adap, mac->ext_port, which);
	if (which & MAC_DIRECTION_TX) {
		t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset, 0);
		mac->txen = 0;
	}
	if (which & MAC_DIRECTION_RX) {
		int val = xgm_reset_ctrl(mac);
		t3_set_reg_field(mac->adapter, A_XGM_RESET_CTRL + mac->offset,
				 F_PCS_RESET_, 0);
		msleep(100);
		t3_write_reg(adap, A_XGM_RX_CTRL + mac->offset, 0);
		t3_write_reg(mac->adapter, A_XGM_RESET_CTRL + mac->offset, val);
	}
	return 0;
}
int t3_mac_disable ( struct cmac * mac , int which ) { adapter_t * adap = mac -> adapter ; if ( mac -> multiport ) return t3_vsc7323_disable ( adap , mac -> ext_port , which ) ; if ( which & MAC_DIRECTION_TX ) { t3_write_reg ( adap , A_XGM_TX_CTRL + mac -> offset , 0 ) ; mac -> txen = 0 ; } if ( which & MAC_DIRECTION_RX ) { int val = xgm_reset_ctrl ( mac ) ; t3_set_reg_field ( mac -> adapter , A_XGM_RESET_CTRL + mac -> offset , F_PCS_RESET_ , 0 ) ; msleep ( 100 ) ; t3_write_reg ( adap , A_XGM_RX_CTRL + mac -> offset , 0 ) ; t3_write_reg ( mac -> adapter , A_XGM_RESET_CTRL + mac -> offset , val ) ; } return 0 ; }
t3_mac_disable - disable the MAC in the given directions
      @mac: the MAC to configure
      @which: bitmap indicating which directions to disable
t3_mac_disable - disable the MAC in the given directions @mac : the MAC to configure @which : bitmap indicating which directions to disable