Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci - use if_initialize() and if_register() instead ...



details:   https://anonhg.NetBSD.org/src/rev/ec812b461320
branches:  trunk
changeset: 959554:ec812b461320
user:      ryo <ryo%NetBSD.org@localhost>
date:      Thu Feb 18 17:56:04 2021 +0000

description:
- use if_initialize() and if_register() instead of if_attach()
- add IFEF_MPSAFE to if_extflags

pointed out by msaitoh@, thanks

diffstat:

 sys/dev/pci/if_aq.c |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (46 lines):

diff -r 41fe0e4a4225 -r ec812b461320 sys/dev/pci/if_aq.c
--- a/sys/dev/pci/if_aq.c       Thu Feb 18 17:05:51 2021 +0000
+++ b/sys/dev/pci/if_aq.c       Thu Feb 18 17:56:04 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_aq.c,v 1.19 2020/09/24 05:13:03 ryo Exp $   */
+/*     $NetBSD: if_aq.c,v 1.20 2021/02/18 17:56:04 ryo Exp $   */
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.19 2020/09/24 05:13:03 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.20 2021/02/18 17:56:04 ryo Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -1407,6 +1407,7 @@
        strlcpy(ifp->if_xname, device_xname(self), IFNAMSIZ);
        ifp->if_softc = sc;
        ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+       ifp->if_extflags = IFEF_MPSAFE;
        ifp->if_baudrate = IF_Gbps(10);
        ifp->if_init = aq_init;
        ifp->if_ioctl = aq_ioctl;
@@ -1463,11 +1464,18 @@
        /* RX hardware checksum offloadding */
        ifp->if_capabilities |= IFCAP_CSUM_IPv4_Rx;
 
-       if_attach(ifp);
+       error = if_initialize(ifp);
+       if (error != 0) {
+               aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
+                   error);
+               goto attach_failure;
+       }
+       ifp->if_percpuq = if_percpuq_create(ifp);
        if_deferred_start_init(ifp, NULL);
        ether_ifattach(ifp, sc->sc_enaddr.ether_addr_octet);
        ether_set_vlan_cb(&sc->sc_ethercom, aq_vlan_cb);
        ether_set_ifflags_cb(&sc->sc_ethercom, aq_ifflags_cb);
+       if_register(ifp);
 
        aq_enable_intr(sc, true, false);        /* only intr about link */
 



Home | Main Index | Thread Index | Old Index