Module Name: src Committed By: msaitoh Date: Thu Nov 28 14:08:22 UTC 2019
Modified Files: src/sys/net: if_media.h Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/net/if_media.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_media.h diff -u src/sys/net/if_media.h:1.66 src/sys/net/if_media.h:1.67 --- src/sys/net/if_media.h:1.66 Thu Oct 3 14:41:14 2019 +++ src/sys/net/if_media.h Thu Nov 28 14:08:22 2019 @@ -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 @@ typedef void (*ifm_stat_cb_t)(struct ifn */ 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 @@ struct ifmedia_entry { * 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 */