Source-Changes-HG archive

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

[src/trunk]: src/sys/dev These drivers do ether_ioctl() on SIOC{ADD, DEL}MULTI...



details:   https://anonhg.NetBSD.org/src/rev/09ce9997aea0
branches:  trunk
changeset: 450675:09ce9997aea0
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Mon Apr 22 08:36:03 2019 +0000

description:
These drivers do ether_ioctl() on SIOC{ADD,DEL}MULTI, SIOC{G,S}IFMEDIA and
default case in the switch statement. Only the default case didn't check the
return value with ENETRESET. Integrate them to one ether_ioctl() with
ENETRESET test. This change might improve some other ioctl()s which return
ENETRESET by calling if_init().

diffstat:

 sys/dev/marvell/if_gfe.c |  23 ++++++++---------------
 sys/dev/pcmcia/if_xi.c   |  11 +++--------
 sys/dev/usb/if_aue.c     |  12 +++---------
 3 files changed, 14 insertions(+), 32 deletions(-)

diffs (130 lines):

diff -r 46687e799c7d -r 09ce9997aea0 sys/dev/marvell/if_gfe.c
--- a/sys/dev/marvell/if_gfe.c  Mon Apr 22 08:30:31 2019 +0000
+++ b/sys/dev/marvell/if_gfe.c  Mon Apr 22 08:36:03 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_gfe.c,v 1.50 2019/01/22 03:42:27 msaitoh Exp $      */
+/*     $NetBSD: if_gfe.c,v 1.51 2019/04/22 08:36:03 msaitoh Exp $      */
 
 /*
  * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.50 2019/01/22 03:42:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.51 2019/04/22 08:36:03 msaitoh Exp $");
 
 #include "opt_inet.h"
 
@@ -656,18 +656,6 @@
                }
                break;
 
-       case SIOCSIFMEDIA:
-       case SIOCGIFMEDIA:
-       case SIOCADDMULTI:
-       case SIOCDELMULTI:
-               if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {
-                       if (ifp->if_flags & IFF_RUNNING)
-                               error = gfe_whack(sc, GE_WHACK_CHANGE);
-                       else
-                               error = 0;
-               }
-               break;
-
        case SIOCSIFMTU:
                if (ifr->ifr_mtu > ETHERMTU || ifr->ifr_mtu < ETHERMIN) {
                        error = EINVAL;
@@ -678,7 +666,12 @@
                break;
 
        default:
-               error = ether_ioctl(ifp, cmd, data);
+               if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {
+                       if (ifp->if_flags & IFF_RUNNING)
+                               error = gfe_whack(sc, GE_WHACK_CHANGE);
+                       else
+                               error = 0;
+               }
                break;
        }
        splx(s);
diff -r 46687e799c7d -r 09ce9997aea0 sys/dev/pcmcia/if_xi.c
--- a/sys/dev/pcmcia/if_xi.c    Mon Apr 22 08:30:31 2019 +0000
+++ b/sys/dev/pcmcia/if_xi.c    Mon Apr 22 08:36:03 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_xi.c,v 1.86 2019/02/05 06:17:03 msaitoh Exp $ */
+/*     $NetBSD: if_xi.c,v 1.87 2019/04/22 08:36:03 msaitoh Exp $ */
 /*     OpenBSD: if_xe.c,v 1.9 1999/09/16 11:28:42 niklas Exp   */
 
 /*
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.86 2019/02/05 06:17:03 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.87 2019/04/22 08:36:03 msaitoh Exp $");
 
 #include "opt_inet.h"
 
@@ -923,8 +923,7 @@
                        break;
                }
                /*FALLTHROUGH*/
-       case SIOCSIFMEDIA:
-       case SIOCGIFMEDIA:
+       default:
                if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {
                        /*
                         * Multicast list has changed; set the hardware
@@ -935,10 +934,6 @@
                        error = 0;
                }
                break;
-
-       default:
-               error = ether_ioctl(ifp, cmd, data);
-               break;
        }
 
        splx(s);
diff -r 46687e799c7d -r 09ce9997aea0 sys/dev/usb/if_aue.c
--- a/sys/dev/usb/if_aue.c      Mon Apr 22 08:30:31 2019 +0000
+++ b/sys/dev/usb/if_aue.c      Mon Apr 22 08:36:03 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_aue.c,v 1.149 2019/04/11 09:16:56 msaitoh Exp $     */
+/*     $NetBSD: if_aue.c,v 1.150 2019/04/22 08:36:03 msaitoh Exp $     */
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.149 2019/04/11 09:16:56 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.150 2019/04/22 08:36:03 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1585,10 +1585,7 @@
                sc->aue_if_flags = ifp->if_flags;
                error = 0;
                break;
-       case SIOCADDMULTI:
-       case SIOCDELMULTI:
-       case SIOCGIFMEDIA:
-       case SIOCSIFMEDIA:
+       default:
                if ((error = ether_ioctl(ifp, command, data)) == ENETRESET) {
                        if (ifp->if_flags & IFF_RUNNING) {
                                cv_signal(&sc->aue_domc);
@@ -1596,9 +1593,6 @@
                        error = 0;
                }
                break;
-       default:
-               error = ether_ioctl(ifp, command, data);
-               break;
        }
 
        splx(s);



Home | Main Index | Thread Index | Old Index