Source-Changes-HG archive

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

[src/trunk]: src/sys/net Fix previous comment change for ifm_media. It was co...



details:   https://anonhg.NetBSD.org/src/rev/7e9621074ff7
branches:  trunk
changeset: 846952:7e9621074ff7
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Dec 05 05:29:27 2019 +0000

description:
Fix previous comment change for ifm_media. It was correct.

 The real problem is that some driver misuse ifm_media as the current active
media. struct mii_data has the current active media(mii_media_active). If a
driver use mii(4), it can be use mii->mii_media_active for this purpose.
struct ifmedia has no entry for this purpose. Some drivers have an entry
in their own softc to keep the value, but some other's don't have it and
they mistakenly use ifm_media.

 We might add a new entry to struct ifmedia in future to avoid this confusion
and for simplify.

diffstat:

 sys/net/if_media.h |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r bb1ece1e591c -r 7e9621074ff7 sys/net/if_media.h
--- a/sys/net/if_media.h        Thu Dec 05 05:28:09 2019 +0000
+++ b/sys/net/if_media.h        Thu Dec 05 05:29:27 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_media.h,v 1.67 2019/11/28 14:08:22 msaitoh Exp $    */
+/*     $NetBSD: if_media.h,v 1.68 2019/12/05 05:29:27 msaitoh Exp $    */
 
 /*-
  * Copyright (c) 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -883,8 +883,15 @@
  */
 struct ifmedia {
        u_int   ifm_mask;       /* IFMWD: mask of changes we don't care */
-       u_int   ifm_media;      /* IFMWD: current active media word */
-       struct ifmedia_entry *ifm_cur;  /* current user-selected media */
+       u_int   ifm_media;      /*
+                                * IFMWD: current use-set media word.
+                                *
+                                * XXX some drivers misuse this entry as
+                                * current active media word. Don't use this
+                                * entry as this purpose but use driver
+                                * specific entry if you don't use mii(4).
+                                */
+       struct ifmedia_entry *ifm_cur;  /* current user-selected media entry */
        TAILQ_HEAD(, ifmedia_entry) ifm_list; /* list of all supported media */
        ifm_change_cb_t ifm_change;     /* media change driver callback */
        ifm_stat_cb_t   ifm_status;     /* media status driver callback */



Home | Main Index | Thread Index | Old Index