Module Name:    src
Committed By:   roy
Date:           Mon Oct  5 16:11:25 UTC 2020

Modified Files:
        src/sys/net: if_spppsubr.c if_spppvar.h

Log Message:
ppp: Remove media

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


To generate a diff of this commit:
cvs rdiff -u -r1.189 -r1.190 src/sys/net/if_spppsubr.c
cvs rdiff -u -r1.23 -r1.24 src/sys/net/if_spppvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.189 src/sys/net/if_spppsubr.c:1.190
--- src/sys/net/if_spppsubr.c:1.189	Sat Apr  4 17:12:33 2020
+++ src/sys/net/if_spppsubr.c	Mon Oct  5 16:11:25 2020
@@ -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 @@ sppp_output(struct ifnet *ifp, struct mb
 	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 @@ sppp_attach(struct ifnet *ifp)
 
 	/* 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 @@ sppp_detach(struct ifnet *ifp)
 	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 @@ sppp_ioctl(struct ifnet *ifp, u_long cmd
 		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;

Index: src/sys/net/if_spppvar.h
diff -u src/sys/net/if_spppvar.h:1.23 src/sys/net/if_spppvar.h:1.24
--- src/sys/net/if_spppvar.h:1.23	Sat Apr  4 17:12:33 2020
+++ src/sys/net/if_spppvar.h	Mon Oct  5 16:11:25 2020
@@ -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 sauth {
 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 */

Reply via email to