Lines 670-680
Link Here
|
670 |
|
670 |
|
671 |
err_late: |
671 |
err_late: |
672 |
igb_detach(dev); |
672 |
igb_detach(dev); |
673 |
igb_free_transmit_structures(adapter); |
|
|
674 |
igb_free_receive_structures(adapter); |
675 |
igb_release_hw_control(adapter); |
673 |
igb_release_hw_control(adapter); |
676 |
if (adapter->ifp != NULL) |
674 |
if (adapter->ifp != NULL) |
677 |
if_free(adapter->ifp); |
675 |
if_free(adapter->ifp); |
|
|
676 |
igb_free_pci_resources(adapter); |
677 |
return (error); |
678 |
|
678 |
err_pci: |
679 |
err_pci: |
679 |
igb_free_pci_resources(adapter); |
680 |
igb_free_pci_resources(adapter); |
680 |
free(adapter->mta, M_DEVBUF); |
681 |
free(adapter->mta, M_DEVBUF); |
Lines 701-726
Link Here
|
701 |
|
702 |
|
702 |
INIT_DEBUGOUT("igb_detach: begin"); |
703 |
INIT_DEBUGOUT("igb_detach: begin"); |
703 |
|
704 |
|
704 |
/* Make sure VLANS are not using driver */ |
705 |
IGB_CORE_LOCK(adapter); |
705 |
if (adapter->ifp->if_vlantrunk != NULL) { |
706 |
adapter->in_detach = 1; |
706 |
device_printf(dev,"Vlan in use, detach first\n"); |
707 |
igb_stop(adapter); |
707 |
return (EBUSY); |
708 |
IGB_CORE_UNLOCK(adapter); |
708 |
} |
|
|
709 |
|
709 |
|
710 |
ether_ifdetach(adapter->ifp); |
710 |
/* Unregister VLAN events */ |
|
|
711 |
if (adapter->vlan_attach != NULL) |
712 |
EVENTHANDLER_DEREGISTER(vlan_config, adapter->vlan_attach); |
713 |
if (adapter->vlan_detach != NULL) |
714 |
EVENTHANDLER_DEREGISTER(vlan_unconfig, adapter->vlan_detach); |
711 |
|
715 |
|
712 |
if (adapter->led_dev != NULL) |
716 |
callout_drain(&adapter->timer); |
713 |
led_destroy(adapter->led_dev); |
|
|
714 |
|
717 |
|
|
|
718 |
if (ifp != NULL) { |
719 |
/* Make sure VLANS are not using driver */ |
720 |
if (ifp->if_vlantrunk != NULL) { |
721 |
device_printf(dev,"Vlan in use, detach first\n"); |
722 |
return (EBUSY); |
723 |
} |
724 |
|
725 |
ether_ifdetach(ifp); |
726 |
|
715 |
#ifdef DEVICE_POLLING |
727 |
#ifdef DEVICE_POLLING |
716 |
if (ifp->if_capenable & IFCAP_POLLING) |
728 |
if (ifp->if_capenable & IFCAP_POLLING) |
717 |
ether_poll_deregister(ifp); |
729 |
ether_poll_deregister(ifp); |
718 |
#endif |
730 |
#endif |
|
|
731 |
if_free(ifp); |
732 |
} |
719 |
|
733 |
|
720 |
IGB_CORE_LOCK(adapter); |
734 |
if (adapter->led_dev != NULL) |
721 |
adapter->in_detach = 1; |
735 |
led_destroy(adapter->led_dev); |
722 |
igb_stop(adapter); |
|
|
723 |
IGB_CORE_UNLOCK(adapter); |
724 |
|
736 |
|
725 |
e1000_phy_hw_reset(&adapter->hw); |
737 |
e1000_phy_hw_reset(&adapter->hw); |
726 |
|
738 |
|
Lines 734-750
Link Here
|
734 |
igb_enable_wakeup(dev); |
746 |
igb_enable_wakeup(dev); |
735 |
} |
747 |
} |
736 |
|
748 |
|
737 |
/* Unregister VLAN events */ |
|
|
738 |
if (adapter->vlan_attach != NULL) |
739 |
EVENTHANDLER_DEREGISTER(vlan_config, adapter->vlan_attach); |
740 |
if (adapter->vlan_detach != NULL) |
741 |
EVENTHANDLER_DEREGISTER(vlan_unconfig, adapter->vlan_detach); |
742 |
|
743 |
callout_drain(&adapter->timer); |
744 |
|
745 |
igb_free_pci_resources(adapter); |
749 |
igb_free_pci_resources(adapter); |
746 |
bus_generic_detach(dev); |
750 |
bus_generic_detach(dev); |
747 |
if_free(ifp); |
|
|
748 |
|
751 |
|
749 |
igb_free_transmit_structures(adapter); |
752 |
igb_free_transmit_structures(adapter); |
750 |
igb_free_receive_structures(adapter); |
753 |
igb_free_receive_structures(adapter); |
Lines 2135-2141
Link Here
|
2135 |
callout_stop(&adapter->timer); |
2138 |
callout_stop(&adapter->timer); |
2136 |
|
2139 |
|
2137 |
/* Tell the stack that the interface is no longer active */ |
2140 |
/* Tell the stack that the interface is no longer active */ |
2138 |
ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); |
2141 |
if (ifp != NULL) |
|
|
2142 |
ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); |
2139 |
|
2143 |
|
2140 |
/* Unarm watchdog timer. */ |
2144 |
/* Unarm watchdog timer. */ |
2141 |
for (int i = 0; i < adapter->num_queues; i++, txr++) { |
2145 |
for (int i = 0; i < adapter->num_queues; i++, txr++) { |