Source-Changes-HG archive

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

[src/trunk]: src/sys/net Fix comment. The ifm_media member of struct ifmedia ...



details:   https://anonhg.NetBSD.org/src/rev/176616f02f62
branches:  trunk
changeset: 846679:176616f02f62
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Nov 28 14:08:22 2019 +0000

description:
Fix comment. The ifm_media member of struct ifmedia is NOT user-set media
word but the current "active" media.

 The user-set media word is one of the ifmedia_entry's ifm_media(A) that
ifm_cur points to (e.g. IFM_AUTO). It can be taken as ifmediareq's ifm_current
entry. The current active media word is the ifm_media(B) entry of struct
ifmedia (e.g 1000baseTX-FDX as the result of auto negotiation). It can be
taken as ifmediareq's ifm_active entry.

struct ifmedia_entry {
        TAILQ_ENTRY(ifmedia_entry) ifm_list;
        u_int   ifm_media;      /* IFMWD: description of this media */ /* A */
        u_int   ifm_data;       /* for driver-specific use */
        void    *ifm_aux;       /* for driver-specific use */
};

struct ifmedia {
        u_int   ifm_mask;       /* IFMWD: mask of changes we don't care */
        u_int   ifm_media;      /* IFMWD: current active media word */ /* B */
        struct ifmedia_entry *ifm_cur;  /* current user-selected media */
        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 */
};

So:

                        in kernel               SIOCGIFMEDIA(ifmediareq)
        -----------------------------------------------------------------
        user-setting:   ifm->ifm_cur->ifm_media ifm_current
        current active: ifm->ifm_media          ifm_active

It would be good to rename some members to make those meaning clear.

diffstat:

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

diffs (31 lines):

diff -r a4d214225b89 -r 176616f02f62 sys/net/if_media.h
--- a/sys/net/if_media.h        Thu Nov 28 12:33:23 2019 +0000
+++ b/sys/net/if_media.h        Thu Nov 28 14:08:22 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_media.h,v 1.66 2019/10/03 14:41:14 jmcneill Exp $   */
+/*     $NetBSD: if_media.h,v 1.67 2019/11/28 14:08:22 msaitoh Exp $    */
 
 /*-
  * Copyright (c) 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -872,7 +872,7 @@
  */
 struct ifmedia_entry {
        TAILQ_ENTRY(ifmedia_entry) ifm_list;
-       u_int   ifm_media;      /* description of this media attachment */
+       u_int   ifm_media;      /* IFMWD: description of this media */
        u_int   ifm_data;       /* for driver-specific use */
        void    *ifm_aux;       /* for driver-specific use */
 };
@@ -882,9 +882,9 @@
  * It is used to keep general media state.
  */
 struct ifmedia {
-       u_int   ifm_mask;       /* mask of changes we don't care about */
-       u_int   ifm_media;      /* current user-set media word */
-       struct ifmedia_entry *ifm_cur;  /* currently selected media */
+       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 */
        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