Module Name: src Committed By: msaitoh Date: Thu Dec 5 05:29:28 UTC 2019
Modified Files: src/sys/net: if_media.h Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 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.67 src/sys/net/if_media.h:1.68 --- src/sys/net/if_media.h:1.67 Thu Nov 28 14:08:22 2019 +++ src/sys/net/if_media.h Thu Dec 5 05:29:27 2019 @@ -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_entry { */ 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 */