Source-Changes-HG archive

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

[src/trunk]: src/sys/net ppp: Remove media



details:   https://anonhg.NetBSD.org/src/rev/1f25f0d35fe8
branches:  trunk
changeset: 976857:1f25f0d35fe8
user:      roy <roy%NetBSD.org@localhost>
date:      Mon Oct 05 16:11:25 2020 +0000

description:
ppp: Remove media

There is none after all.
Applications should be using ifi_link_state and not checking media.

diffstat:

 sys/net/if_spppsubr.c |  39 ++-------------------------------------
 sys/net/if_spppvar.h  |   5 +----
 2 files changed, 3 insertions(+), 41 deletions(-)

diffs (107 lines):

diff -r 3aae1a3e9daf -r 1f25f0d35fe8 sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c     Mon Oct 05 16:04:11 2020 +0000
+++ b/sys/net/if_spppsubr.c     Mon Oct 05 16:11:25 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_spppsubr.c,v 1.189 2020/04/04 17:12:33 is Exp $      */
+/*     $NetBSD: if_spppsubr.c,v 1.190 2020/10/05 16:11:25 roy Exp $     */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.189 2020/04/04 17:12:33 is Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.190 2020/10/05 16:11:25 roy Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -969,33 +969,6 @@
        return error;
 }
 
-static int
-sppp_mediachange(struct ifnet *ifp)
-{
-
-       return (0);
-}
-
-static void
-sppp_mediastatus(struct ifnet *ifp, struct ifmediareq *imr)
-{
-       int link_state;
-
-       link_state = atomic_load_relaxed(&ifp->if_link_state);
-       switch (link_state) {
-       case LINK_STATE_UP:
-               imr->ifm_status = IFM_AVALID | IFM_ACTIVE;
-               break;
-       case LINK_STATE_DOWN:
-               imr->ifm_status = IFM_AVALID;
-               break;
-       default:
-               /* Should be impossible as we set link state down in attach. */
-               imr->ifm_status = 0;
-               break;
-       }
-}
-
 void
 sppp_attach(struct ifnet *ifp)
 {
@@ -1038,8 +1011,6 @@
 
        /* Lets not beat about the bush, we know we're down. */
        ifp->if_link_state = LINK_STATE_DOWN;
-       /* There is no media for PPP, but it's needed to report link status. */
-       ifmedia_init(&sp->pp_im, 0, sppp_mediachange, sppp_mediastatus);
 
        memset(&sp->myauth, 0, sizeof sp->myauth);
        memset(&sp->hisauth, 0, sizeof sp->hisauth);
@@ -1097,8 +1068,6 @@
        if (sp->hisauth.secret) free(sp->hisauth.secret, M_DEVBUF);
        SPPP_UNLOCK(sp);
        rw_destroy(&sp->pp_lock);
-
-       ifmedia_fini(&sp->pp_im);
 }
 
 /*
@@ -1276,10 +1245,6 @@
                error = sppp_params(sp, cmd, data);
                break;
 
-       case SIOCGIFMEDIA:
-               error = ifmedia_ioctl(ifp, ifr, &sp->pp_im, cmd);
-               break;
-
        default:
                error = ifioctl_common(ifp, cmd, data);
                break;
diff -r 3aae1a3e9daf -r 1f25f0d35fe8 sys/net/if_spppvar.h
--- a/sys/net/if_spppvar.h      Mon Oct 05 16:04:11 2020 +0000
+++ b/sys/net/if_spppvar.h      Mon Oct 05 16:11:25 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_spppvar.h,v 1.23 2020/04/04 17:12:33 is Exp $       */
+/*     $NetBSD: if_spppvar.h,v 1.24 2020/10/05 16:11:25 roy Exp $      */
 
 #ifndef _NET_IF_SPPPVAR_H_
 #define _NET_IF_SPPPVAR_H_
@@ -29,8 +29,6 @@
 #include <sys/workqueue.h>
 #include <sys/pcq.h>
 
-#include <net/if_media.h>
-
 #define IDX_LCP 0              /* idx into state table */
 
 struct slcp {
@@ -92,7 +90,6 @@
 struct sppp {
        /* NB: pp_if _must_ be first */
        struct  ifnet pp_if;    /* network interface data */
-       struct  ifmedia pp_im;  /* interface media, to report link status */
        struct  ifqueue pp_fastq; /* fast output queue */
        struct  ifqueue pp_cpq; /* PPP control protocol queue */
        struct  sppp *pp_next;  /* next interface in keepalive list */



Home | Main Index | Thread Index | Old Index