FreeBSD/sys/dev/cxgb/cxgb_main.c
/**
 *	t3_os_link_changed - handle link status changes
 *	@sc: the adapter associated with the link change
 *	@port_id: the port index whose link status has changed
 *	@link_status: the new status of the link
 *	@speed: the new speed setting
 *	@duplex: the new duplex setting
 *	@fc: the new flow-control setting
 *
 *	This is the OS-dependent handler for link status changes.  The OS
 *	neutral handler takes care of most of the processing for these events,
 *	then calls this handler for any OS-specific processing.
 */


This is the OS-dependent handler for link status changes.  The OS
neutral handler takes care of most of the processing for these events,
then calls this handler for any OS-specific processing.
This is the OS - dependent handler for link status changes . The OS neutral handler takes care of most of the processing for these events then calls this handler for any OS - specific processing .
void
t3_os_link_changed(adapter_t *adapter, int port_id, int link_status, int speed,
     int duplex, int fc, int mac_was_reset)
{
	struct port_info *pi = &adapter->port[port_id];
	struct ifnet *ifp = pi->ifp;
	KASSERT(ifp, ("%s: if detached.", __func__));
	if (mac_was_reset) {
		PORT_LOCK(pi);
		cxgb_update_mac_settings(pi);
		PORT_UNLOCK(pi);
	}
	if (link_status) {
		ifp->if_baudrate = IF_Mbps(speed);
		if_link_state_change(ifp, LINK_STATE_UP);
	} else
		if_link_state_change(ifp, LINK_STATE_DOWN);
}
void t3_os_link_changed ( adapter_t * adapter , int port_id , int link_status , int speed , int duplex , int fc , int mac_was_reset ) { struct port_info * pi = & adapter -> port [ port_id ] ; struct ifnet * ifp = pi -> ifp ; KASSERT ( ifp , ( " " , __func__ ) ) ; if ( mac_was_reset ) { PORT_LOCK ( pi ) ; cxgb_update_mac_settings ( pi ) ; PORT_UNLOCK ( pi ) ; } if ( link_status ) { ifp -> if_baudrate = IF_Mbps ( speed ) ; if_link_state_change ( ifp , LINK_STATE_UP ) ; } else if_link_state_change ( ifp , LINK_STATE_DOWN ) ; }
t3_os_link_changed - handle link status changes
      @sc: the adapter associated with the link change
      @port_id: the port index whose link status has changed
      @link_status: the new status of the link
      @speed: the new speed setting
      @duplex: the new duplex setting
      @fc: the new flow-control setting
t3_os_link_changed - handle link status changes @sc : the adapter associated with the link change @port_id : the port index whose link status has changed @link_status : the new status of the link @speed : the new speed setting @duplex : the new duplex setting @fc : the new flow - control setting
/* no race with detach, so ifp should always be good */ /* Reapply mac settings if they were lost due to a reset */