| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: if_le_ebus.c,v 1.20 2019/05/29 10:07:28 msaitoh Exp $ */ | | 1 | /* $NetBSD: if_le_ebus.c,v 1.21 2019/12/05 05:28:09 msaitoh Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2010 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2010 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code was written by Alessandro Forin and Neil Pittman | | 7 | * This code was written by Alessandro Forin and Neil Pittman |
8 | * at Microsoft Research and contributed to The NetBSD Foundation | | 8 | * at Microsoft Research and contributed to The NetBSD Foundation |
9 | * by Microsoft Corporation. | | 9 | * by Microsoft Corporation. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -21,27 +21,27 @@ | | | @@ -21,27 +21,27 @@ |
21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
30 | * POSSIBILITY OF SUCH DAMAGE. | | 30 | * POSSIBILITY OF SUCH DAMAGE. |
31 | */ | | 31 | */ |
32 | | | 32 | |
33 | #include <sys/cdefs.h> | | 33 | #include <sys/cdefs.h> |
34 | __KERNEL_RCSID(0, "$NetBSD: if_le_ebus.c,v 1.20 2019/05/29 10:07:28 msaitoh Exp $"); | | 34 | __KERNEL_RCSID(0, "$NetBSD: if_le_ebus.c,v 1.21 2019/12/05 05:28:09 msaitoh Exp $"); |
35 | | | 35 | |
36 | #include "opt_inet.h" | | 36 | #include "opt_inet.h" |
37 | | | 37 | |
38 | | | 38 | |
39 | | | 39 | |
40 | #include <sys/param.h> | | 40 | #include <sys/param.h> |
41 | #include <sys/systm.h> | | 41 | #include <sys/systm.h> |
42 | #include <sys/mbuf.h> | | 42 | #include <sys/mbuf.h> |
43 | #include <sys/syslog.h> | | 43 | #include <sys/syslog.h> |
44 | #include <sys/socket.h> | | 44 | #include <sys/socket.h> |
45 | #include <sys/device.h> | | 45 | #include <sys/device.h> |
46 | #include <sys/malloc.h> | | 46 | #include <sys/malloc.h> |
47 | #include <sys/ioctl.h> | | 47 | #include <sys/ioctl.h> |
| @@ -581,62 +581,31 @@ enic_mediastatus(struct ifnet *ifp, stru | | | @@ -581,62 +581,31 @@ enic_mediastatus(struct ifnet *ifp, stru |
581 | ifmr->ifm_status = IFM_AVALID; | | 581 | ifmr->ifm_status = IFM_AVALID; |
582 | if (sc->sc_havecarrier) | | 582 | if (sc->sc_havecarrier) |
583 | ifmr->ifm_status |= IFM_ACTIVE; | | 583 | ifmr->ifm_status |= IFM_ACTIVE; |
584 | | | 584 | |
585 | /* more code here someday.. */ | | 585 | /* more code here someday.. */ |
586 | } | | 586 | } |
587 | | | 587 | |
588 | /* | | 588 | /* |
589 | * Process an ioctl request. | | 589 | * Process an ioctl request. |
590 | */ | | 590 | */ |
591 | int | | 591 | int |
592 | enic_ioctl(struct ifnet *ifp, u_long cmd, void *data) | | 592 | enic_ioctl(struct ifnet *ifp, u_long cmd, void *data) |
593 | { | | 593 | { |
594 | struct enic_softc *sc = ifp->if_softc; | | | |
595 | struct ifreq *ifr = (struct ifreq *)data; | | | |
596 | int s, error = 0; | | 594 | int s, error = 0; |
597 | | | 595 | |
598 | s = splnet(); | | 596 | s = splnet(); |
599 | | | 597 | |
600 | switch (cmd) { | | 598 | switch (cmd) { |
601 | case SIOCSIFMEDIA: | | | |
602 | #if 0 /*DEBUG*/ | | | |
603 | { | | | |
604 | extern int ei_drops[]; | | | |
605 | static int flip = 0; | | | |
606 | if (flip++ == 2) { | | | |
607 | int i; | | | |
608 | flip = 0; | | | |
609 | printf("enic_ioctl(%x) %qd/%qd %qd/%qd %d/%d %d:%d " | | | |
610 | "%d+%d %d/%d/%d\n", ifp->if_flags, | | | |
611 | ifp->if_ierrors, ifp->if_oerrors, | | | |
612 | ifp->if_ipackets, ifp->if_opackets, | | | |
613 | sc->sc_no_rd, sc->sc_no_td, | | | |
614 | sc->xhit, sc->xmiss, | | | |
615 | sc->tfull, sc->tfull2, | | | |
616 | sc->brh, sc->rf, sc->bxh); | | | |
617 | printf(" Ctl %x lt %x tim %d\n", | | | |
618 | sc->sc_regs->Control, sc->it, ifp->if_timer); | | | |
619 | | | | |
620 | for (i = 0; i < 64; i++) | | | |
621 | if (ei_drops[i]) | | | |
622 | printf(" %d.%d", i, ei_drops[i]); | | | |
623 | printf("\n"); | | | |
624 | } | | | |
625 | } | | | |
626 | #endif | | | |
627 | error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); | | | |
628 | break; | | | |
629 | | | | |
630 | default: | | 599 | default: |
631 | error = ether_ioctl(ifp, cmd, data); | | 600 | error = ether_ioctl(ifp, cmd, data); |
632 | if (cmd == SIOCSIFADDR) { | | 601 | if (cmd == SIOCSIFADDR) { |
633 | /* | | 602 | /* |
634 | * hackattack: NFS does not turn us back | | 603 | * hackattack: NFS does not turn us back |
635 | * on after a stop. So. | | 604 | * on after a stop. So. |
636 | */ | | 605 | */ |
637 | #if 0 | | 606 | #if 0 |
638 | printf("enic_ioctl(%lx)\n", cmd); | | 607 | printf("enic_ioctl(%lx)\n", cmd); |
639 | #endif | | 608 | #endif |
640 | enic_init(ifp); | | 609 | enic_init(ifp); |
641 | } | | 610 | } |
642 | if (error != ENETRESET) | | 611 | if (error != ENETRESET) |