Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Jan 2020 22:04:11 +0000 (UTC)
From:      Conrad Meyer <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r356852 - head/sys/net80211
Message-ID:  <202001172204.00HM4BWK037161@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cem
Date: Fri Jan 17 22:04:11 2020
New Revision: 356852
URL: https://svnweb.freebsd.org/changeset/base/356852

Log:
  net80211: Move rate printing in amrr_node_stats() to a separate method
  
  This makes amrr_node_stats() cleaner and allows the rate printing to be
  reusable.
  
  Submitted by:	Neel Chauhan <neel at neelc.org>
  Reviewed by:	adrian
  Differential Revision:	https://reviews.freebsd.org/D22318

Modified:
  head/sys/net80211/ieee80211_amrr.c

Modified: head/sys/net80211/ieee80211_amrr.c
==============================================================================
--- head/sys/net80211/ieee80211_amrr.c	Fri Jan 17 22:02:35 2020	(r356851)
+++ head/sys/net80211/ieee80211_amrr.c	Fri Jan 17 22:04:11 2020	(r356852)
@@ -477,18 +477,12 @@ amrr_sysctlattach(struct ieee80211vap *vap,
 }
 
 static void
-amrr_node_stats(struct ieee80211_node *ni, struct sbuf *s)
+amrr_print_node_rate(struct ieee80211_amrr_node *amn,
+    struct ieee80211_node *ni, struct sbuf *s)
 {
 	int rate;
-	struct ieee80211_amrr_node *amn = ni->ni_rctls;
 	struct ieee80211_rateset *rs;
 
-	/* XXX TODO: check locking? */
-
-	if (!amn)
-		return;
-
-	/* XXX TODO: this should be a method */
 	if (amrr_node_is_11n(ni)) {
 		rs = (struct ieee80211_rateset *) &ni->ni_htrates;
 		rate = rs->rs_rates[amn->amn_rix] & IEEE80211_RATE_VAL;
@@ -498,7 +492,19 @@ amrr_node_stats(struct ieee80211_node *ni, struct sbuf
 		rate = rs->rs_rates[amn->amn_rix] & IEEE80211_RATE_VAL;
 		sbuf_printf(s, "rate: %d Mbit\n", rate / 2);
 	}
+}
 
+static void
+amrr_node_stats(struct ieee80211_node *ni, struct sbuf *s)
+{
+	struct ieee80211_amrr_node *amn = ni->ni_rctls;
+
+	/* XXX TODO: check locking? */
+
+	if (!amn)
+		return;
+
+	amrr_print_node_rate(amn, ni, s);
 	sbuf_printf(s, "ticks: %d\n", amn->amn_ticks);
 	sbuf_printf(s, "txcnt: %u\n", amn->amn_txcnt);
 	sbuf_printf(s, "success: %u\n", amn->amn_success);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202001172204.00HM4BWK037161>