Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci/ixgbe Don't panic when resource shortage occured...



details:   https://anonhg.NetBSD.org/src/rev/0b6be1fde782
branches:  trunk
changeset: 358294:0b6be1fde782
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Dec 20 08:51:42 2017 +0000

description:
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).

diffstat:

 sys/dev/pci/ixgbe/ixgbe.c |  12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diffs (40 lines):

diff -r 5e42faf322b5 -r 0b6be1fde782 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Wed Dec 20 08:21:11 2017 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Wed Dec 20 08:51:42 2017 +0000
@@ -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 @@
        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 @@
                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 @@
        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);



Home | Main Index | Thread Index | Old Index