Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/phil-wifi]: src/sys/net80211 Use if_stat functions.
details: https://anonhg.NetBSD.org/src/rev/04ccdbd696fe
branches: phil-wifi
changeset: 1025124:04ccdbd696fe
user: nat <nat%NetBSD.org@localhost>
date: Thu Apr 16 15:30:00 2020 +0000
description:
Use if_stat functions.
diffstat:
sys/net80211/ieee80211.c | 16 +++++++++++-----
sys/net80211/ieee80211_netbsd.c | 40 +++++++++++++++++++++++++++-------------
sys/net80211/ieee80211_netbsd.h | 7 ++-----
3 files changed, 40 insertions(+), 23 deletions(-)
diffs (154 lines):
diff -r 682b92667457 -r 04ccdbd696fe sys/net80211/ieee80211.c
--- a/sys/net80211/ieee80211.c Mon Apr 13 07:55:06 2020 +0000
+++ b/sys/net80211/ieee80211.c Thu Apr 16 15:30:00 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ieee80211.c,v 1.56.18.8 2020/04/13 08:05:15 martin Exp $ */
+/* $NetBSD: ieee80211.c,v 1.56.18.9 2020/04/16 15:30:00 nat Exp $ */
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -30,7 +30,7 @@
#include <sys/cdefs.h>
#ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211.c,v 1.56.18.8 2020/04/13 08:05:15 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211.c,v 1.56.18.9 2020/04/16 15:30:00 nat Exp $");
#endif
/*
@@ -2016,7 +2016,13 @@
ifm_change_cb_t media_change, ifm_stat_cb_t media_stat)
{
- ieee80211_media_init_with_lock(ic, media_change, media_stat, NULL);
+ struct ieee80211vap *vap;
+
+ vap = TAILQ_FIRST(&ic->ic_vaps);
+ KASSERT(vap != NULL, ("media vap is null"));
+
+ ifmedia_init_with_lock(&vap->iv_media, 0, media_change,
+ media_stat, NULL);
}
void
@@ -2030,8 +2036,8 @@
for (mode = IEEE80211_MODE_AUTO+1; mode < IEEE80211_MODE_11NA; mode++) {
if (isclr(ic->ic_modecaps, mode))
continue;
- aprint_debug("%s: %s rates: ", ifp->if_xname,
- ieee80211_phymode_name[mode]);
+ //aprint_debug("%s: %s rates: ", ifp->if_xname,
+ // ieee80211_phymode_name[mode]);
ic_printf(ic, "%s rates: ", ieee80211_phymode_name[mode]);
rs = &ic->ic_sup_rates[mode];
for (i = 0; i < rs->rs_nrates; i++) {
diff -r 682b92667457 -r 04ccdbd696fe sys/net80211/ieee80211_netbsd.c
--- a/sys/net80211/ieee80211_netbsd.c Mon Apr 13 07:55:06 2020 +0000
+++ b/sys/net80211/ieee80211_netbsd.c Thu Apr 16 15:30:00 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ieee80211_netbsd.c,v 1.31.2.9 2019/11/19 19:17:16 phil Exp $ */
+/* $NetBSD: ieee80211_netbsd.c,v 1.31.2.10 2020/04/16 15:30:00 nat Exp $ */
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
#ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_netbsd.c,v 1.31.2.9 2019/11/19 19:17:16 phil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_netbsd.c,v 1.31.2.10 2020/04/16 15:30:00 nat Exp $");
#endif
/*
@@ -1183,45 +1183,59 @@
}
#endif
+int64_t
+if_get_counter_default(struct ifnet * ifp, ift_counter cnt)
+{
+ struct if_data if_stats;
+ int64_t result;
+
+ if_stats_to_if_data(ifp, &if_stats, false);
+
+ result = (cnt == IFCOUNTER_OERRORS ? if_stats.ifi_oerrors :
+ (cnt == IFCOUNTER_IERRORS ? if_stats.ifi_ierrors : 0 ));
+
+ return result;
+}
+
void
if_inc_counter(struct ifnet *ifp, ift_counter ifc, int64_t value)
{
switch (ifc) {
case IFCOUNTER_IPACKETS:
- ifp->if_data.ifi_ipackets += value;
+ if_statadd(ifp, if_ipackets, value);
break;
case IFCOUNTER_IERRORS:
- ifp->if_data.ifi_ierrors += value;
+ if_statadd(ifp, if_ierrors, value);
break;
case IFCOUNTER_OPACKETS:
- ifp->if_data.ifi_opackets += value;
+ if_statadd(ifp, if_opackets, value);
break;
case IFCOUNTER_OERRORS:
- ifp->if_data.ifi_oerrors += value;
+ if_statadd(ifp, if_oerrors, value);
break;
case IFCOUNTER_COLLISIONS:
- ifp->if_data.ifi_collisions += value;
+ if_statadd(ifp, if_collisions, value);
break;
case IFCOUNTER_IBYTES:
- ifp->if_data.ifi_ibytes += value;
+ if_statadd(ifp, if_ibytes, value);
break;
case IFCOUNTER_OBYTES:
- ifp->if_data.ifi_obytes += value;
+ if_statadd(ifp, if_obytes, value);
break;
case IFCOUNTER_IMCASTS:
- ifp->if_data.ifi_imcasts += value;
+ if_statadd(ifp, if_imcasts, value);
break;
case IFCOUNTER_OMCASTS:
- ifp->if_data.ifi_omcasts += value;
+ if_statadd(ifp, if_omcasts, value);
break;
case IFCOUNTER_IQDROPS:
- ifp->if_data.ifi_iqdrops += value;
+ if_statadd(ifp, if_iqdrops, value);
break;
case IFCOUNTER_OQDROPS:
/* ifp->if_data.ifi_oqdrops += value; No such field, just ignore it q*/
break;
case IFCOUNTER_NOPROTO:
- ifp->if_data.ifi_noproto += value;
+ if_statadd(ifp, if_noproto, value);
break;
default:
panic("if_inc_counter: non-existant counter");
diff -r 682b92667457 -r 04ccdbd696fe sys/net80211/ieee80211_netbsd.h
--- a/sys/net80211/ieee80211_netbsd.h Mon Apr 13 07:55:06 2020 +0000
+++ b/sys/net80211/ieee80211_netbsd.h Thu Apr 16 15:30:00 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ieee80211_netbsd.h,v 1.21.2.11 2020/04/13 08:05:16 martin Exp $ */
+/* $NetBSD: ieee80211_netbsd.h,v 1.21.2.12 2020/04/16 15:30:00 nat Exp $ */
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -172,10 +172,7 @@
IFCOUNTERS /* Array size. */
} ift_counter;
void if_inc_counter(struct ifnet *, ift_counter, int64_t);
-
-#define if_get_counter_default(ipf,cnt) \
- (cnt == IFCOUNTER_OERRORS ? ipf->if_oerrors : \
- (cnt == IFCOUNTER_IERRORS ? ipf->if_ierrors : 0 ))
+int64_t if_get_counter_default(struct ifnet *, ift_counter);
#define IF_LLADDR(ifp) (((struct ieee80211vap *)ifp->if_softc)->iv_myaddr)
Home |
Main Index |
Thread Index |
Old Index