Module Name: src Committed By: msaitoh Date: Wed Dec 20 08:51:43 UTC 2017
Modified Files: src/sys/dev/pci/ixgbe: ixgbe.c Log Message: Don't panic when resource shortage occured. Fixes PR#52820 reported by kardel@: - Don't use if_free() because ixgbe(4) don't use if_alloc(). - Move location of {ixgbe,ixv}_setup_interface() call at a position that any error don't occur. One of the reason is that it should be. Another reason is that it's hard to call ether_ifdetach() and if_detach() when cold == 1 (because of pserialize_perform, xc_wait, timing of domaininit and maybe more). To generate a diff of this commit: cvs rdiff -u -r1.115 -r1.116 src/sys/dev/pci/ixgbe/ixgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/ixgbe/ixgbe.c diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.115 src/sys/dev/pci/ixgbe/ixgbe.c:1.116 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.115 Wed Dec 6 04:08:50 2017 +++ src/sys/dev/pci/ixgbe/ixgbe.c Wed Dec 20 08:51:42 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.115 2017/12/06 04:08:50 msaitoh Exp $ */ +/* $NetBSD: ixgbe.c,v 1.116 2017/12/20 08:51:42 msaitoh Exp $ */ /****************************************************************************** @@ -1043,10 +1043,6 @@ ixgbe_attach(device_t parent, device_t d hw->eeprom.ops.read(hw, IXGBE_ETRACKID_L, &low); aprint_normal(" ETrackID %08x\n", ((uint32_t)high << 16) | low); - /* Setup OS specific network interface */ - if (ixgbe_setup_interface(dev, adapter) != 0) - goto err_late; - if (adapter->feat_en & IXGBE_FEATURE_MSIX) error = ixgbe_allocate_msix(adapter, pa); else @@ -1074,6 +1070,10 @@ ixgbe_attach(device_t parent, device_t d break; } + /* Setup OS specific network interface */ + if (ixgbe_setup_interface(dev, adapter) != 0) + goto err_late; + /* * Print PHY ID only for copper PHY. On device which has SFP(+) cage * and a module is inserted, phy.id is not MII PHY id but SFF 8024 ID. @@ -1155,8 +1155,6 @@ err_late: ixgbe_free_receive_structures(adapter); free(adapter->queues, M_DEVBUF); err_out: - if (adapter->ifp != NULL) - if_free(adapter->ifp); ctrl_ext = IXGBE_READ_REG(&adapter->hw, IXGBE_CTRL_EXT); ctrl_ext &= ~IXGBE_CTRL_EXT_DRV_LOAD; IXGBE_WRITE_REG(&adapter->hw, IXGBE_CTRL_EXT, ctrl_ext);