Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src-draft/trunk]: src/sys/net80211 Fix sysctl setup for rate adaption
details: https://anonhg.NetBSD.org/src-all/rev/f5a12e500044
branches: trunk
changeset: 375804:f5a12e500044
user: Martin Husemann <martin%NetBSD.org@localhost>
date: Mon Aug 15 17:45:30 2022 +0200
description:
Fix sysctl setup for rate adaption
diffstat:
sys/net80211/ieee80211_amrr.c | 80 ++++++++++++++++++++++++++++++++++----
sys/net80211/ieee80211_netbsd.c | 18 +++-----
sys/net80211/ieee80211_netbsd.h | 1 +
sys/net80211/ieee80211_rssadapt.c | 54 ++++++++++++++++++++++---
sys/net80211/ieee80211_var.h | 10 ++-
5 files changed, 132 insertions(+), 31 deletions(-)
diffs (truncated from 317 to 300 lines):
diff -r f16d5d2a3a84 -r f5a12e500044 sys/net80211/ieee80211_amrr.c
--- a/sys/net80211/ieee80211_amrr.c Mon Aug 15 17:42:49 2022 +0200
+++ b/sys/net80211/ieee80211_amrr.c Mon Aug 15 17:45:30 2022 +0200
@@ -93,10 +93,8 @@ static void amrr_tx_complete(const struc
static void amrr_tx_update_cb(void *, struct ieee80211_node *);
static void amrr_tx_update(struct ieee80211vap *vap,
struct ieee80211_ratectl_tx_stats *);
-#ifdef notyet
static void amrr_sysctlattach(struct ieee80211vap *,
- struct sysctl_ctx_list *, struct sysctl_oid *);
-#endif
+ IEEE80211_SYSC_CONTEXT, IEEE80211_SYSC_OID_ARG);
static void amrr_node_stats(struct ieee80211_node *ni, struct sbuf *s);
/* number of references from net80211 layer */
@@ -155,9 +153,7 @@ amrr_init(struct ieee80211vap *vap)
amrr->amrr_min_success_threshold = IEEE80211_AMRR_MIN_SUCCESS_THRESHOLD;
amrr->amrr_max_success_threshold = IEEE80211_AMRR_MAX_SUCCESS_THRESHOLD;
amrr_setinterval(vap, 500 /* ms */);
-#ifdef notyet
amrr_sysctlattach(vap, vap->iv_sysctl, vap->iv_oid);
-#endif
}
static void
@@ -273,6 +269,9 @@ amrr_node_init(struct ieee80211_node *ni
static void
amrr_node_deinit(struct ieee80211_node *ni)
{
+ if (!ni->ni_rctls)
+ return;
+
IEEE80211_FREE(ni->ni_rctls, M_80211_RATECTL,
sizeof(struct ieee80211_amrr_node));
}
@@ -469,7 +468,7 @@ amrr_tx_update(struct ieee80211vap *vap,
}
}
-#ifdef notyet
+#if defined(__FreeBSD__)
static int
amrr_sysctl_interval(SYSCTL_HANDLER_ARGS)
{
@@ -487,12 +486,10 @@ amrr_sysctl_interval(SYSCTL_HANDLER_ARGS
amrr_setinterval(vap, msecs);
return 0;
}
-#endif
-#ifdef notyet
static void
amrr_sysctlattach(struct ieee80211vap *vap,
- struct sysctl_ctx_list *ctx, struct sysctl_oid *tree)
+ IEEE80211_SYSC_CONTEXT ctx, IEEE80211_SYSC_OID_ARG tree)
{
struct ieee80211_amrr *amrr = vap->iv_rs;
@@ -510,6 +507,71 @@ amrr_sysctlattach(struct ieee80211vap *v
"amrr_min_sucess_threshold", CTLFLAG_RW,
&amrr->amrr_min_success_threshold, 0, "");
}
+#elif defined(__NetBSD__)
+static int
+amrr_sysctl_interval(SYSCTLFN_ARGS)
+{
+ struct sysctlnode node = *rnode;
+ struct ieee80211vap *vap = (struct ieee80211vap *)node.sysctl_data;
+ struct ieee80211_amrr *amrr = vap->iv_rs;
+ int msecs, error;
+
+ if (!amrr)
+ return ENOMEM;
+
+ msecs = ticks_to_msecs(amrr->amrr_interval);
+ node.sysctl_data = &msecs;
+ error = sysctl_lookup(SYSCTLFN_CALL(&node));
+ if (error || (newp == NULL))
+ return error;
+ amrr_setinterval(vap, msecs);
+ return 0;
+}
+
+static void
+amrr_sysctlattach(struct ieee80211vap *vap,
+ IEEE80211_SYSC_CONTEXT ctx, IEEE80211_SYSC_OID_ARG tree)
+{
+ struct ieee80211_amrr *amrr = vap->iv_rs;
+ int rc;
+
+ if (!amrr)
+ return;
+
+ if ((rc = sysctl_createv(&ctx, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_READWRITE, CTLTYPE_INT,
+ "amrr_rate_interval", SYSCTL_DESCR("amrr operation interval (ms)"),
+ amrr_sysctl_interval, 0, (void*)vap, sizeof(int),
+ CTL_NET, ieee80211_sysctl_wlan, tree, CTL_CREATE, CTL_EOL)) != 0)
+ goto err;
+
+ /* XXX bounds check values */
+ if ((rc = sysctl_createv(&ctx, 0, NULL, NULL,
+ CTLFLAG_READWRITE, CTLTYPE_INT,
+ "amrr_max_sucess_threshold",
+ SYSCTL_DESCR("amrr max sucess threshold"),
+ NULL, 0, &amrr->amrr_max_success_threshold,
+ sizeof(amrr->amrr_max_success_threshold),
+ CTL_NET, ieee80211_sysctl_wlan, tree, CTL_CREATE, CTL_EOL)) != 0)
+ goto err;
+
+ if ((rc = sysctl_createv(&ctx, 0, NULL, NULL,
+ CTLFLAG_READWRITE, CTLTYPE_INT,
+ "amrr_min_sucess_threshold",
+ SYSCTL_DESCR("amrr min sucess threshold"),
+ NULL, 0, &amrr->amrr_min_success_threshold,
+ sizeof(amrr->amrr_max_success_threshold),
+ CTL_NET, ieee80211_sysctl_wlan, tree, CTL_CREATE, CTL_EOL)) != 0)
+ goto err;
+
+ return;
+
+err:
+#ifdef IEEE80211_DEBUG
+ printf("%s: sysctl_createv failed (rc = %d)\n", __func__, rc);
+#endif
+ return;
+}
#endif
static void
diff -r f16d5d2a3a84 -r f5a12e500044 sys/net80211/ieee80211_netbsd.c
--- a/sys/net80211/ieee80211_netbsd.c Mon Aug 15 17:42:49 2022 +0200
+++ b/sys/net80211/ieee80211_netbsd.c Mon Aug 15 17:45:30 2022 +0200
@@ -351,7 +351,7 @@ ieee80211_sysctl_vap_restart(SYSCTLFN_AR
/*
* Setup sysctl(3) MIB, net.wlan.*
*/
-static int32_t ctl_wlan;
+int32_t ieee80211_sysctl_wlan;
static struct sysctllog *wlan_sysctl_clog;
SYSCTL_SETUP(sysctl_net_wlan_setup, "sysctl net.wlan subtree setup")
@@ -367,7 +367,7 @@ SYSCTL_SETUP(sysctl_net_wlan_setup, "sys
goto err;
/* remember the (dynamic) MIB so we can find this node later */
- ctl_wlan = wlan_node->sysctl_num;
+ ieee80211_sysctl_wlan = wlan_node->sysctl_num;
#ifdef notyet
if ((rc = sysctl_createv(&wlan_sysctl_clog, 0, &wlan_node, NULL,
@@ -400,10 +400,6 @@ SYSCTL_SETUP(sysctl_net_wlan_setup, "sys
sysctl_ieee80211coms, 0, NULL, 0, CTL_CREATE, CTL_EOL)) != 0)
goto err;
-#ifdef notyet
- ieee80211_rssadapt_sysctl_setup(&wlan_sysctl_clog);
-#endif
-
return;
err:
#ifdef IEEE80211_DEBUG
@@ -434,7 +430,7 @@ ieee80211_sysctl_vattach(struct ieee8021
if ((rc = sysctl_createv(&ctx, 0, NULL, &rnode,
0, CTLTYPE_NODE, ifp->if_xname, SYSCTL_DESCR("virtual AP"),
NULL, 0, NULL, 0,
- CTL_NET, ctl_wlan, CTL_CREATE, CTL_EOL)) != 0)
+ CTL_NET, ieee80211_sysctl_wlan, CTL_CREATE, CTL_EOL)) != 0)
goto err;
oid = rnode->sysctl_num;
@@ -562,7 +558,7 @@ ieee80211_sysctl_vattach(struct ieee8021
goto err;
}
- vap->iv_sysctllog = ctx;
+ vap->iv_sysctl = ctx;
vap->iv_oid = oid;
return;
err:
@@ -572,9 +568,9 @@ err:
void
ieee80211_sysctl_vdetach(struct ieee80211vap *vap)
{
- if (vap->iv_sysctllog != NULL) {
- sysctl_teardown(&vap->iv_sysctllog);
- vap->iv_sysctllog = NULL;
+ if (vap->iv_sysctl != NULL) {
+ sysctl_teardown(&vap->iv_sysctl);
+ vap->iv_sysctl = NULL;
}
}
diff -r f16d5d2a3a84 -r f5a12e500044 sys/net80211/ieee80211_netbsd.h
--- a/sys/net80211/ieee80211_netbsd.h Mon Aug 15 17:42:49 2022 +0200
+++ b/sys/net80211/ieee80211_netbsd.h Mon Aug 15 17:45:30 2022 +0200
@@ -54,6 +54,7 @@
#ifdef IEEE80211_DEBUG
extern int ieee80211_debug;
#endif
+extern int32_t ieee80211_sysctl_wlan;
/*
* Defines to make the FreeBSD code work on NetBSD
*/
diff -r f16d5d2a3a84 -r f5a12e500044 sys/net80211/ieee80211_rssadapt.c
--- a/sys/net80211/ieee80211_rssadapt.c Mon Aug 15 17:42:49 2022 +0200
+++ b/sys/net80211/ieee80211_rssadapt.c Mon Aug 15 17:45:30 2022 +0200
@@ -111,10 +111,8 @@ static void rssadapt_raise_rate(struct i
int, int);
static void rssadapt_tx_complete(const struct ieee80211_node *,
const struct ieee80211_ratectl_tx_status *);
-#ifdef notyet
static void rssadapt_sysctlattach(struct ieee80211vap *,
- struct sysctl_ctx_list *, struct sysctl_oid *);
-#endif
+ IEEE80211_SYSC_CONTEXT, IEEE80211_SYSC_OID_ARG);
/* number of references from net80211 layer */
static int nrefs = 0;
@@ -171,9 +169,7 @@ rssadapt_init(struct ieee80211vap *vap)
}
rs->vap = vap;
rssadapt_setinterval(vap, 500 /* msecs */);
-#ifdef notyet
rssadapt_sysctlattach(vap, vap->iv_sysctl, vap->iv_oid);
-#endif
}
static void
@@ -389,7 +385,7 @@ rssadapt_tx_complete(const struct ieee80
}
}
-#ifdef notyet
+#if defined(__FreeBSD__)
static int
rssadapt_sysctl_interval(SYSCTL_HANDLER_ARGS)
{
@@ -410,11 +406,55 @@ rssadapt_sysctl_interval(SYSCTL_HANDLER_
static void
rssadapt_sysctlattach(struct ieee80211vap *vap,
- struct sysctl_ctx_list *ctx, struct sysctl_oid *tree)
+ struct sysctl_ctx_list *ctx, IEEE80211_SYSC_OID_ARG tree)
{
SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
"rssadapt_rate_interval",
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, vap, 0,
rssadapt_sysctl_interval, "I", "rssadapt operation interval (ms)");
}
+#elif defined(__NetBSD__)
+static int
+rssadapt_sysctl_interval(SYSCTLFN_ARGS)
+{
+ struct sysctlnode node = *rnode;
+ struct ieee80211vap *vap = (struct ieee80211vap *)node.sysctl_data;
+ struct ieee80211_rssadapt *rs = vap->iv_rs;
+ int msecs, error;
+
+ if (!rs)
+ return ENOMEM;
+
+ msecs = ticks_to_msecs(rs->interval);
+ node.sysctl_data = &msecs;
+ error = sysctl_lookup(SYSCTLFN_CALL(&node));
+ if (error || !newp)
+ return error;
+ rssadapt_setinterval(vap, msecs);
+ return 0;
+}
+
+static void
+rssadapt_sysctlattach(struct ieee80211vap *vap,
+ IEEE80211_SYSC_CONTEXT ctx, IEEE80211_SYSC_OID_ARG tree)
+{
+ int rc;
+
+ if (!vap->iv_rs)
+ return;
+
+ if ((rc = sysctl_createv(&ctx, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_READWRITE, CTLTYPE_INT,
+ "rssadapt_rate_interval",
+ SYSCTL_DESCR("rssadapt operation interval (ms)"),
+ rssadapt_sysctl_interval, 0, (void*)vap, sizeof(int),
+ CTL_NET, ieee80211_sysctl_wlan, tree, CTL_CREATE, CTL_EOL)) != 0)
+ goto err;
+ return;
+err:
+#ifdef IEEE80211_DEBUG
+ printf("%s: sysctl_createv failed (rc = %d)\n", __func__, rc);
#endif
+ return;
+}
+#endif
diff -r f16d5d2a3a84 -r f5a12e500044 sys/net80211/ieee80211_var.h
--- a/sys/net80211/ieee80211_var.h Mon Aug 15 17:42:49 2022 +0200
+++ b/sys/net80211/ieee80211_var.h Mon Aug 15 17:45:30 2022 +0200
@@ -399,12 +399,14 @@ struct ieee80211vap {
struct ifnet *iv_ifp; /* associated device */
Home |
Main Index |
Thread Index |
Old Index