From owner-svn-src-all@freebsd.org Wed Mar 6 07:58:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8770B15078BD; Wed, 6 Mar 2019 07:58:20 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2EE9B81AC4; Wed, 6 Mar 2019 07:58:20 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 247CD891; Wed, 6 Mar 2019 07:58:20 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x267wJ5h073630; Wed, 6 Mar 2019 07:58:19 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x267wJcP073627; Wed, 6 Mar 2019 07:58:19 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201903060758.x267wJcP073627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 6 Mar 2019 07:58:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r344842 - in head/tools/tools/ath: . athani X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: in head/tools/tools/ath: . athani X-SVN-Commit-Revision: 344842 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2EE9B81AC4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2019 07:58:20 -0000 Author: adrian Date: Wed Mar 6 07:58:19 2019 New Revision: 344842 URL: https://svnweb.freebsd.org/changeset/base/344842 Log: [athani] Add a simple tool to list and control ANI parameters. This is a WIP tool I'm using to figure out why ANI is weirdly busted in my home FreeBSD AP/STA setup. Although athstats (mostly) gets the ANI statistics correct, ANI is making the radio deaf it doesn't recover without being disabled. It's very WIP. Tested: * Carambola 2, (AR9331), AP/STA mode. Added: head/tools/tools/ath/athani/ head/tools/tools/ath/athani/Makefile (contents, props changed) head/tools/tools/ath/athani/main.c (contents, props changed) Modified: head/tools/tools/ath/Makefile Modified: head/tools/tools/ath/Makefile ============================================================================== --- head/tools/tools/ath/Makefile Wed Mar 6 07:54:29 2019 (r344841) +++ head/tools/tools/ath/Makefile Wed Mar 6 07:58:19 2019 (r344842) @@ -3,6 +3,6 @@ SUBDIR= arcode athdebug athdecode athkey athpoke athprom athrd athregs athalq SUBDIR+= athstats ath_prom_read athradar athaggrstats SUBDIR+= ath_ee_v14_print ath_ee_v4k_print ath_ee_9287_print ath_ee_9300_print -SUBDIR+= athsurvey athratestats athspectral +SUBDIR+= athsurvey athratestats athspectral athani .include Added: head/tools/tools/ath/athani/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/athani/Makefile Wed Mar 6 07:58:19 2019 (r344842) @@ -0,0 +1,23 @@ +# $FreeBSD$ + +PROG= athani +MAN= + +CFLAGS+= -I../../../../sys/contrib + +SRCS= main.c + +.include <../Makefile.inc> + +CFLAGS+= -I${.CURDIR}/../common/ +.PATH.c: ${.CURDIR}/../common/ +SRCS+= ctrl.c + +CLEANFILES+= opt_ah.h + +opt_ah.h: + echo "#define AH_DEBUG 1" > opt_ah.h + echo "#define AH_DEBUG_COUNTRY 1" >> opt_ah.h + echo "#define AH_SUPPORT_AR5416 1" >> opt_ah.h + +.include Added: head/tools/tools/ath/athani/main.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/athani/main.c Wed Mar 6 07:58:19 2019 (r344842) @@ -0,0 +1,226 @@ +/*- + * Copyright (c) 2019 Adrian Chadd . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGES. + * + * $FreeBSD$ + */ +#include "diag.h" + +#include "ah.h" +#include "ah_internal.h" + +#include +#include +#include +#include +#include + +#include "../common/ctrl.h" + +/* + * This is a simple wrapper program around the ANI diagnostic interface. + * It is for fetching and setting the live ANI configuration when trying + * to diagnose a noisy environment. + */ + +/* + * HAL_DIAG_ANI_CMD is used to set the ANI configuration. + * HAL_DIAG_ANI_CURRENT is used to fetch the current ANI configuration. + */ + +struct ani_var { + const char *name; + int id; +}; + +static struct ani_var ani_labels[] = { + { "ofdm_noise_immunity_level", 1, }, + { "noise_immunity_level", 1, }, + { "ofdm_weak_signal_detect", 2, }, + { "cck_weak_signal_threshold", 3, }, + { "firstep_level", 4, }, + { "spur_immunity_level", 5, }, + { "mrc_cck", 8, }, + { "cck_noise_immunity_level", 9, }, + { NULL, -1, }, +}; + +static void +usage(void) +{ + fprintf(stderr, "usage: athani [-i interface] [-l]\n"); + fprintf(stderr, " -i: interface\n"); + fprintf(stderr, " -l: list ANI labels\n"); + fprintf(stderr, " If no args are given after flags, the ANI state will be listed.\n"); + fprintf(stderr, " To set, use '