svn commit: r368451 - head/sys/dev/ath

2020-12-08 Thread Adrian Chadd
Author: adrian
Date: Tue Dec  8 17:28:42 2020
New Revision: 368451
URL: https://svnweb.freebsd.org/changeset/base/368451

Log:
  [ath] also remove the magic size value here for the transmit antenna 
statistics.

Modified:
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/if_athvar.h
==
--- head/sys/dev/ath/if_athvar.hTue Dec  8 17:27:24 2020
(r368450)
+++ head/sys/dev/ath/if_athvar.hTue Dec  8 17:28:42 2020
(r368451)
@@ -780,7 +780,8 @@ struct ath_softc {
ath_bufhead sc_bbuf;/* beacon buffers */
u_int   sc_bhalq;   /* HAL q for outgoing beacons */
u_int   sc_bmisscount;  /* missed beacon transmits */
-   u_int32_t   sc_ant_tx[8];   /* recent tx frames/antenna */
+   u_int32_t   sc_ant_tx[ATH_IOCTL_STATS_NUM_TX_ANTENNA];
+   /* recent tx frames/antenna */
struct ath_txq  *sc_cabq;   /* tx q for cab frames */
struct task sc_bmisstask;   /* bmiss int processing */
struct task sc_bstucktask;  /* stuck beacon processing */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r368450 - head/sys/dev/ath

2020-12-08 Thread Adrian Chadd
Author: adrian
Date: Tue Dec  8 17:27:24 2020
New Revision: 368450
URL: https://svnweb.freebsd.org/changeset/base/368450

Log:
  [ath] Don't use hard-coded values in the sanity check.
  
  Don't use hard-coded values in the phy error and receive antenna
  checks.

Modified:
  head/sys/dev/ath/if_ath_rx.c

Modified: head/sys/dev/ath/if_ath_rx.c
==
--- head/sys/dev/ath/if_ath_rx.cTue Dec  8 17:25:59 2020
(r368449)
+++ head/sys/dev/ath/if_ath_rx.cTue Dec  8 17:27:24 2020
(r368450)
@@ -706,8 +706,11 @@ ath_rx_pkt(struct ath_softc *sc, struct ath_rx_status 
ath_dfs_process_phy_err(sc, m, rstamp, rs);
}
 
-   /* Be suitably paranoid about receiving phy errors out 
of the stats array bounds */
-   if (rs->rs_phyerr < 64)
+   /*
+* Be suitably paranoid about receiving phy errors
+* out of the stats array bounds
+*/
+   if (rs->rs_phyerr < ATH_IOCTL_STATS_NUM_RX_PHYERR)
sc->sc_stats.ast_rx_phy[rs->rs_phyerr]++;
goto rx_error;  /* NB: don't count in ierrors */
}
@@ -835,7 +838,7 @@ rx_accept:
 * the majority of the statistics are only valid
 * for the last frame in an aggregate.
 */
-   if (rs->rs_antenna > 7) {
+   if (rs->rs_antenna >= ATH_IOCTL_STATS_NUM_RX_ANTENNA) {
device_printf(sc->sc_dev, "%s: rs_antenna > 7 (%d)\n",
__func__, rs->rs_antenna);
 #ifdef ATH_DEBUG
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r368449 - head/sys/dev/ath

2020-12-08 Thread Adrian Chadd
Author: adrian
Date: Tue Dec  8 17:25:59 2020
New Revision: 368449
URL: https://svnweb.freebsd.org/changeset/base/368449

Log:
  [ath] replace the hard-coded magic values in if_athioctl.h with constant 
defines
  
  Replace some hard-coded magic values in the ioctl stats struct with
  #defines.  I'm going to follow up with some more sanity checking in
  the receive path that also use these values so we don't do bad
  things if the hardware is (more) confused.

Modified:
  head/sys/dev/ath/if_athioctl.h

Modified: head/sys/dev/ath/if_athioctl.h
==
--- head/sys/dev/ath/if_athioctl.h  Tue Dec  8 16:46:00 2020
(r368448)
+++ head/sys/dev/ath/if_athioctl.h  Tue Dec  8 17:25:59 2020
(r368449)
@@ -48,10 +48,14 @@ struct ath_tx_aggr_stats {
u_int32_t   aggr_rts_aggr_limited;
 };
 
+#defineATH_IOCTL_INTR_NUM_SYNC_INTR32
 struct ath_intr_stats {
-   u_int32_t   sync_intr[32];
+   u_int32_t   sync_intr[ATH_IOCTL_INTR_NUM_SYNC_INTR];
 };
 
+#defineATH_IOCTL_STATS_NUM_RX_PHYERR   64
+#defineATH_IOCTL_STATS_NUM_TX_ANTENNA  8
+#defineATH_IOCTL_STATS_NUM_RX_ANTENNA  8
 struct ath_stats {
u_int32_t   ast_watchdog;   /* device reset by watchdog */
u_int32_t   ast_hardware;   /* fatal hardware error interrupts */
@@ -96,7 +100,8 @@ struct ath_stats {
u_int32_t   ast_rx_badcrypt;/* rx failed 'cuz decryption */
u_int32_t   ast_rx_badmic;  /* rx failed 'cuz MIC failure */
u_int32_t   ast_rx_phyerr;  /* rx failed 'cuz of PHY err */
-   u_int32_t   ast_rx_phy[64]; /* rx PHY error per-code counts */
+   u_int32_t   ast_rx_phy[ATH_IOCTL_STATS_NUM_RX_PHYERR];
+   /* rx PHY error per-code counts */
u_int32_t   ast_rx_tooshort;/* rx discarded 'cuz frame too short */
u_int32_t   ast_rx_toobig;  /* rx discarded 'cuz frame too large */
u_int32_t   ast_rx_packets; /* packet recv on the interface */
@@ -115,8 +120,10 @@ struct ath_stats {
u_int32_t   ast_rate_drop;  /* rate control dropped xmit rate */
u_int32_t   ast_ant_defswitch;/* rx/default antenna switches */
u_int32_t   ast_ant_txswitch;/* tx antenna switches */
-   u_int32_t   ast_ant_rx[8];  /* rx frames with antenna */
-   u_int32_t   ast_ant_tx[8];  /* tx frames with antenna */
+   u_int32_t   ast_ant_rx[ATH_IOCTL_STATS_NUM_RX_ANTENNA];
+   /* rx frames with antenna */
+   u_int32_t   ast_ant_tx[ATH_IOCTL_STATS_NUM_TX_ANTENNA];
+   /* tx frames with antenna */
u_int32_t   ast_cabq_xmit;  /* cabq frames transmitted */
u_int32_t   ast_cabq_busy;  /* cabq found busy */
u_int32_t   ast_tx_raw; /* tx frames through raw api */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r368305 - head/sys/dev/axgbe

2020-12-03 Thread Adrian Chadd
Author: adrian
Date: Thu Dec  3 16:54:59 2020
New Revision: 368305
URL: https://svnweb.freebsd.org/changeset/base/368305

Log:
  [axgbe] Fix compiler warnings in gcc-6.3; perhaps fix a PHY issue
  
  * uninitialised variable use
  * Using AXGBE_SET_ADV() where it was intended; using AXGBE_ADV()
seems wrong and also causes a compiler warning.
  
  Reviewed by:  rpokala
  Differential Revision:  https://reviews.freebsd.org/D26839

Modified:
  head/sys/dev/axgbe/xgbe-dev.c
  head/sys/dev/axgbe/xgbe-mdio.c
  head/sys/dev/axgbe/xgbe-phy-v2.c

Modified: head/sys/dev/axgbe/xgbe-dev.c
==
--- head/sys/dev/axgbe/xgbe-dev.c   Thu Dec  3 15:55:07 2020
(r368304)
+++ head/sys/dev/axgbe/xgbe-dev.c   Thu Dec  3 16:54:59 2020
(r368305)
@@ -1337,7 +1337,7 @@ xgbe_dev_read(struct xgbe_channel *channel)
struct xgbe_ring_data *rdata;
struct xgbe_ring_desc *rdesc;
struct xgbe_packet_data *packet = &ring->packet_data;
-   unsigned int err, etlt, l34t;
+   unsigned int err, etlt, l34t = 0;
 
axgbe_printf(1, "-->xgbe_dev_read: cur = %d\n", ring->cur);
 

Modified: head/sys/dev/axgbe/xgbe-mdio.c
==
--- head/sys/dev/axgbe/xgbe-mdio.c  Thu Dec  3 15:55:07 2020
(r368304)
+++ head/sys/dev/axgbe/xgbe-mdio.c  Thu Dec  3 16:54:59 2020
(r368305)
@@ -1186,7 +1186,7 @@ static int
 __xgbe_phy_config_aneg(struct xgbe_prv_data *pdata, bool set_mode)
 {
int ret;
-   unsigned int reg;
+   unsigned int reg = 0;
 
sx_xlock(&pdata->an_mutex);
 

Modified: head/sys/dev/axgbe/xgbe-phy-v2.c
==
--- head/sys/dev/axgbe/xgbe-phy-v2.cThu Dec  3 15:55:07 2020
(r368304)
+++ head/sys/dev/axgbe/xgbe-phy-v2.cThu Dec  3 16:54:59 2020
(r368305)
@@ -2706,7 +2706,7 @@ xgbe_upd_link(struct xgbe_prv_data *pdata)
 static int
 xgbe_phy_read_status(struct xgbe_prv_data *pdata)
 {
-   int common_adv_gb;
+   int common_adv_gb = 0;
int common_adv;
int lpagb = 0;
int adv, lpa;
@@ -2741,9 +2741,9 @@ xgbe_phy_read_status(struct xgbe_prv_data *pdata)
}
 
if (pdata->phy.supported == SUPPORTED_1000baseT_Half) 
-   XGBE_ADV(&pdata->phy, 1000baseT_Half); 
+   XGBE_SET_ADV(&pdata->phy, 1000baseT_Half); 
else if (pdata->phy.supported == 
SUPPORTED_1000baseT_Full) 
-   XGBE_ADV(&pdata->phy, 1000baseT_Full); 
+   XGBE_SET_ADV(&pdata->phy, 1000baseT_Full); 
 
common_adv_gb = lpagb & adv << 2;
}
@@ -2753,7 +2753,7 @@ xgbe_phy_read_status(struct xgbe_prv_data *pdata)
return (lpa);
 
if (pdata->phy.supported == SUPPORTED_Autoneg) 
-   XGBE_ADV(&pdata->phy, Autoneg);
+   XGBE_SET_ADV(&pdata->phy, Autoneg);
  
adv = xgbe_phy_mii_read(pdata, pdata->mdio_addr, MII_ANAR);
if (adv < 0)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367771 - head/sbin/nvmecontrol

2020-11-17 Thread Adrian Chadd
Author: adrian
Date: Tue Nov 17 17:12:28 2020
New Revision: 367771
URL: https://svnweb.freebsd.org/changeset/base/367771

Log:
  [nvmecontrol] Fix type signedness warning-to-error on gcc-6.4
  
  This fixes a type signedness comparison warning-to-error on
  gcc-6.4. The ternary operation casts it right but the actual
  assignment doesn't.
  
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D26791

Modified:
  head/sbin/nvmecontrol/firmware.c

Modified: head/sbin/nvmecontrol/firmware.c
==
--- head/sbin/nvmecontrol/firmware.cTue Nov 17 17:11:07 2020
(r367770)
+++ head/sbin/nvmecontrol/firmware.cTue Nov 17 17:12:28 2020
(r367771)
@@ -159,8 +159,9 @@ static void
 update_firmware(int fd, uint8_t *payload, int32_t payload_size, uint8_t fwug)
 {
struct nvme_pt_command  pt;
-   uint64_tmax_xfer_size;
-   int32_t off, resid, size;
+   uint64_tmax_xfer_size;
+   int32_t off;
+   uint32_tresid, size;
void*chunk;
 
off = 0;
@@ -175,8 +176,7 @@ update_firmware(int fd, uint8_t *payload, int32_t payl
errx(EX_OSERR, "unable to malloc %zd bytes", 
(size_t)max_xfer_size);
 
while (resid > 0) {
-   size = (resid >= (int32_t)max_xfer_size) ?
-   max_xfer_size : resid;
+   size = (resid >= max_xfer_size) ?  max_xfer_size : resid;
memcpy(chunk, payload + off, size);
 
memset(&pt, 0, sizeof(pt));
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367770 - head/sys/cddl/contrib/opensolaris/common/lz4

2020-11-17 Thread Adrian Chadd
Author: adrian
Date: Tue Nov 17 17:11:07 2020
New Revision: 367770
URL: https://svnweb.freebsd.org/changeset/base/367770

Log:
  [cddl] Fix lz4 function definitions to not tri pup compile.
  
  This tripped up in llvm compilation on amd64 noting that lz4_init/lz4_fini
  were lacking in being previously defined.
  
  Reviewed by:  emaste, freqlabs, brooks
  Differential Revision:https://reviews.freebsd.org/D27240

Modified:
  head/sys/cddl/contrib/opensolaris/common/lz4/lz4.c
  head/sys/cddl/contrib/opensolaris/common/lz4/lz4.h

Modified: head/sys/cddl/contrib/opensolaris/common/lz4/lz4.c
==
--- head/sys/cddl/contrib/opensolaris/common/lz4/lz4.c  Tue Nov 17 16:54:12 
2020(r367769)
+++ head/sys/cddl/contrib/opensolaris/common/lz4/lz4.c  Tue Nov 17 17:11:07 
2020(r367770)
@@ -1024,7 +1024,7 @@ LZ4_uncompress_unknownOutputSize(const char *source, c
 }
 
 #if defined(_KERNEL) || defined(_FAKE_KERNEL)
-extern void
+void
 lz4_init(void)
 {
 
@@ -1034,7 +1034,7 @@ lz4_init(void)
 #endif
 }
 
-extern void
+void
 lz4_fini(void)
 {
 

Modified: head/sys/cddl/contrib/opensolaris/common/lz4/lz4.h
==
--- head/sys/cddl/contrib/opensolaris/common/lz4/lz4.h  Tue Nov 17 16:54:12 
2020(r367769)
+++ head/sys/cddl/contrib/opensolaris/common/lz4/lz4.h  Tue Nov 17 17:11:07 
2020(r367770)
@@ -43,6 +43,11 @@ extern "C" {
 extern size_t lz4_compress(void *, void *, size_t, size_t, int);
 extern int lz4_decompress(void *, void *, size_t, size_t, int);
 
+#if defined(_KERNEL) || defined(_FAKE_KERNEL)
+extern void lz4_init(void);
+extern void lz4_fini(void);
+#endif
+
 #ifdef __cplusplus
 }
 #endif
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367647 - head/tests/sys/vm

2020-11-13 Thread Adrian Chadd
Author: adrian
Date: Fri Nov 13 18:50:24 2020
New Revision: 367647
URL: https://svnweb.freebsd.org/changeset/base/367647

Log:
  [tests] Fix unused variable warning in gcc
  
  Reviewed by:  markj, imp, cem,
  Approved by:  markj
  Differential Revision:https://reviews.freebsd.org/D26792

Modified:
  head/tests/sys/vm/page_fault_signal.c

Modified: head/tests/sys/vm/page_fault_signal.c
==
--- head/tests/sys/vm/page_fault_signal.c   Fri Nov 13 18:34:13 2020
(r367646)
+++ head/tests/sys/vm/page_fault_signal.c   Fri Nov 13 18:50:24 2020
(r367647)
@@ -107,7 +107,6 @@ ATF_TC_WITHOUT_HEAD(page_fault_signal__segv_accerr_2);
 ATF_TC_BODY(page_fault_signal__segv_accerr_2, tc)
 {
int *p;
-   volatile int dummy;
int sz;
 
sz = getpagesize();
@@ -115,7 +114,7 @@ ATF_TC_BODY(page_fault_signal__segv_accerr_2, tc)
ATF_REQUIRE(p != MAP_FAILED);
if (sigsetjmp(sig_env, 1) == 0) {
setup_signals();
-   dummy = *p;
+   (void)*(volatile int *)p;
}
(void)munmap(p, sz);
ATF_CHECK_EQ(SIGSEGV, last_sig);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367629 - head/sys/sys

2020-11-12 Thread Adrian Chadd
Author: adrian
Date: Fri Nov 13 01:53:59 2020
New Revision: 367629
URL: https://svnweb.freebsd.org/changeset/base/367629

Log:
  [malloc] quieten -Werror=missing-braces with malloc.h wth gcc-6.4
  
  This sets off gcc-6.4 to spit out a 'error: missing braces around initializer'
  error when compiling this.
  
  Remove it as it isn't needed.
  
  Reviewed by:  brooks
  Differential Revision: https://reviews.freebsd.org/D27183

Modified:
  head/sys/sys/malloc.h

Modified: head/sys/sys/malloc.h
==
--- head/sys/sys/malloc.h   Thu Nov 12 21:58:47 2020(r367628)
+++ head/sys/sys/malloc.h   Fri Nov 13 01:53:59 2020(r367629)
@@ -147,7 +147,6 @@ struct malloc_type_header {
.ks_next = NULL,\
.ks_version = M_VERSION,\
.ks_shortdesc = shortdesc,  \
-   .ks_mti = { 0 },\
}   \
};  \
SYSINIT(type##_init, SI_SUB_KMEM, SI_ORDER_THIRD, malloc_init,  \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367273 - head/lib/libnetmap

2020-11-02 Thread Adrian Chadd
Author: adrian
Date: Mon Nov  2 15:01:37 2020
New Revision: 367273
URL: https://svnweb.freebsd.org/changeset/base/367273

Log:
  [libnetmap] Fix 32 bit compilation under gcc-6.4
  
  Use uintptr_t to cast a uint64_t to a pointer type.
  Yeah, it isn't technically correct for platforms with pointers
  > 64 bits, but it's fine here.
  
  This fixes 32 bit compat library builds on amd64 and also
  mips32 builds.
  
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D26790

Modified:
  head/lib/libnetmap/nmreq.c

Modified: head/lib/libnetmap/nmreq.c
==
--- head/lib/libnetmap/nmreq.c  Mon Nov  2 14:30:55 2020(r367272)
+++ head/lib/libnetmap/nmreq.c  Mon Nov  2 15:01:37 2020(r367273)
@@ -603,10 +603,9 @@ nmreq_options_decode(const char *opt, struct nmreq_opt
 struct nmreq_option *
 nmreq_find_option(struct nmreq_header *h, uint32_t t)
 {
-   struct nmreq_option *o;
+   struct nmreq_option *o = NULL;
 
-   for (o = (struct nmreq_option *)h->nr_options; o != NULL;
-   o = (struct nmreq_option *)o->nro_next) {
+   nmreq_foreach_option(h, o) {
if (o->nro_reqtype == t)
break;
}
@@ -633,8 +632,14 @@ nmreq_free_options(struct nmreq_header *h)
 {
struct nmreq_option *o, *next;
 
-   for (o = (struct nmreq_option *)h->nr_options; o != NULL; o = next) {
-   next = (struct nmreq_option *)o->nro_next;
+   /*
+* Note: can't use nmreq_foreach_option() here; it frees the
+* list as it's walking and nmreq_foreach_option() isn't
+* modification-safe.
+*/
+   for (o = (struct nmreq_option *)(uintptr_t)h->nr_options; o != NULL;
+   o = next) {
+   next = (struct nmreq_option *)(uintptr_t)o->nro_next;
free(o);
}
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367257 - head/usr.sbin/ctld

2020-11-01 Thread Adrian Chadd
Author: adrian
Date: Sun Nov  1 21:18:21 2020
New Revision: 367257
URL: https://svnweb.freebsd.org/changeset/base/367257

Log:
  [ctld] Fix compilation under gcc-6.4
  
  * remove dup yylex symbol; already defined in a header file
  * uint64_t is always >= 0
  
  Reviewed by:  cem, imp
  Differential Revision:https://reviews.freebsd.org/D27046

Modified:
  head/usr.sbin/ctld/parse.y

Modified: head/usr.sbin/ctld/parse.y
==
--- head/usr.sbin/ctld/parse.y  Sun Nov  1 20:54:02 2020(r367256)
+++ head/usr.sbin/ctld/parse.y  Sun Nov  1 21:18:21 2020(r367257)
@@ -54,7 +54,6 @@ static struct target *target = NULL;
 static struct lun *lun = NULL;
 
 extern voidyyerror(const char *);
-extern int yylex(void);
 extern voidyyrestart(FILE *);
 
 %}
@@ -522,7 +521,7 @@ portal_group_pcp:   PCP STR
free($2);
return (1);
}
-   if (!((tmp >= 0) && (tmp <= 7))) {
+   if (tmp > 7) {
yyerror("invalid pcp value");
free($2);
return (1);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367248 - head/usr.bin/iscsictl

2020-11-01 Thread Adrian Chadd
Author: adrian
Date: Sun Nov  1 15:57:14 2020
New Revision: 367248
URL: https://svnweb.freebsd.org/changeset/base/367248

Log:
  [iscsictl] Fix compile issues that creep up with gcc-6.4
  
  This fixes two warnings:
  
  * double-definition of a symbol in a yacc header
  * Comparison of an unsigned int being >= 0; that's always
going to be true.
  
  Reviewed by:  imp, rscheff
  Differential Revision:https://reviews.freebsd.org/D27036

Modified:
  head/usr.bin/iscsictl/parse.y

Modified: head/usr.bin/iscsictl/parse.y
==
--- head/usr.bin/iscsictl/parse.y   Sun Nov  1 11:34:15 2020
(r367247)
+++ head/usr.bin/iscsictl/parse.y   Sun Nov  1 15:57:14 2020
(r367248)
@@ -54,7 +54,6 @@ static struct conf *conf;
 static struct target *target;
 
 extern voidyyerror(const char *);
-extern int yylex(void);
 extern voidyyrestart(FILE *);
 
 %}
@@ -359,7 +358,7 @@ pcp:PCP EQUALS STR
free($3);
return(1);
}
-   if (!((tmp >=0) && (tmp <= 7))) {
+   if (tmp > 7) {
yyerror("invalid pcp value");
return(1);
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366818 - head/sys/conf

2020-10-18 Thread Adrian Chadd
Author: adrian
Date: Sun Oct 18 22:37:58 2020
New Revision: 366818
URL: https://svnweb.freebsd.org/changeset/base/366818

Log:
  [zfs] Remove a non-existent directory in the build infra
  
  This directory doesn't exist and causes gcc-6.4 to complain about
  a non-existent include directory
  
  Approved by:  kevans, imp
  Differential Revision:https://reviews.freebsd.org/D26846

Modified:
  head/sys/conf/kmod.mk

Modified: head/sys/conf/kmod.mk
==
--- head/sys/conf/kmod.mk   Sun Oct 18 21:34:04 2020(r366817)
+++ head/sys/conf/kmod.mk   Sun Oct 18 22:37:58 2020(r366818)
@@ -540,7 +540,6 @@ OPENZFS_CFLAGS= \
-nostdinc \
-DSMP \
-I${ZINCDIR}  \
-   -I${ZINCDIR}/spl \
-I${ZINCDIR}/os/freebsd \
-I${ZINCDIR}/os/freebsd/spl \
-I${ZINCDIR}/os/freebsd/zfs \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366814 - head/contrib/llvm-project/libcxx/include

2020-10-18 Thread Adrian Chadd
Author: adrian
Date: Sun Oct 18 17:31:10 2020
New Revision: 366814
URL: https://svnweb.freebsd.org/changeset/base/366814

Log:
  [libcxx] Fix atomic type for mips32 on gcc to work w/out needing libatomic
  
  When compiling this for mips32 on gcc-6.x, we'd hit issues where we
  don't have 64 bit atomics on mips32.
  
  gcc implements this using libatomic, which we don't currently include
  in our freebsd-gcc compiler packages.
  
  So for now add this work around so mips32 works.  It's also fine for
  mips64.  We can fix this later once we get libatomic included.
  
  Approved by:  dim
  Differential Revision:https://reviews.freebsd.org/D26774

Modified:
  head/contrib/llvm-project/libcxx/include/atomic

Modified: head/contrib/llvm-project/libcxx/include/atomic
==
--- head/contrib/llvm-project/libcxx/include/atomic Sun Oct 18 17:15:47 
2020(r366813)
+++ head/contrib/llvm-project/libcxx/include/atomic Sun Oct 18 17:31:10 
2020(r366814)
@@ -1480,11 +1480,11 @@ struct __cxx_atomic_impl : public _Base {
 : _Base(value) {}
 };
 
-#ifdef __linux__
+#if defined(__linux__) || (defined(__FreeBSD__) && defined(__mips__))
 using __cxx_contention_t = int32_t;
 #else
 using __cxx_contention_t = int64_t;
-#endif //__linux__
+#endif
 
 #if _LIBCPP_STD_VER >= 11
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366765 - head/contrib/libgnuregex

2020-10-16 Thread Adrian Chadd
Author: adrian
Date: Fri Oct 16 14:28:13 2020
New Revision: 366765
URL: https://svnweb.freebsd.org/changeset/base/366765

Log:
   This fixes some fun type size truncation that shows up giving errors like
  " changes value from '287948901175001088' to '0' "
  
  .. which turns out is a known issue with later gcc's.
  
  eg - https://lists.gnu.org/archive/html/bug-gnulib/2012-03/msg00154.html
  
  It was fixed up upstream corelib/gnulib in commit hash
  252b52457da7887667c036d18cc5169777615bb0
  (eg in 
https://github.com/coreutils/gnulib/commit/252b52457da7887667c036d18cc5169777615bb0)
  
  TEST PLAN
- compiled/run for gcc-6.4 on amd64
  
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D26804

Modified:
  head/contrib/libgnuregex/regcomp.c

Modified: head/contrib/libgnuregex/regcomp.c
==
--- head/contrib/libgnuregex/regcomp.c  Fri Oct 16 13:37:58 2020
(r366764)
+++ head/contrib/libgnuregex/regcomp.c  Fri Oct 16 14:28:13 2020
(r366765)
@@ -930,26 +930,30 @@ init_word_char (re_dfa_t *dfa)
   int ch = 0;
   if (BE (dfa->map_notascii == 0, 1))
 {
-  if (sizeof (dfa->word_char[0]) == 8)
+  /* Avoid uint32_t and uint64_t as some non-GCC platforms lack
+them, an issue when this code is used in Gnulib.  */
+  bitset_word_t bits0 = 0x;
+  bitset_word_t bits1 = 0x03ff;
+  bitset_word_t bits2 = 0x87fe;
+  bitset_word_t bits3 = 0x07fe;
+
+  if (BITSET_WORD_BITS == 64)
{
-  /* The extra temporaries here avoid "implicitly truncated"
- warnings in the case when this is dead code, i.e. 32-bit.  */
-  const uint64_t wc0 = UINT64_C (0x03ff);
-  const uint64_t wc1 = UINT64_C (0x07fe87fe);
- dfa->word_char[0] = wc0;
- dfa->word_char[1] = wc1;
+  /* Pacify gcc -Woverflow on 32-bit platformns.  */
+  dfa->word_char[0] = bits1 << 31 << 1 | bits0;
+  dfa->word_char[1] = bits3 << 31 << 1 | bits2;
  i = 2;
}
-  else if (sizeof (dfa->word_char[0]) == 4)
+  else if (BITSET_WORD_BITS == 32)
{
- dfa->word_char[0] = UINT32_C (0x);
- dfa->word_char[1] = UINT32_C (0x03ff);
- dfa->word_char[2] = UINT32_C (0x87fe);
- dfa->word_char[3] = UINT32_C (0x07fe);
+  dfa->word_char[0] = bits0;
+  dfa->word_char[1] = bits1;
+  dfa->word_char[2] = bits2;
+  dfa->word_char[3] = bits3;
  i = 4;
}
   else
-   abort ();
+   goto general_case;
   ch = 128;
 
   if (BE (dfa->is_utf8, 1))
@@ -959,6 +963,7 @@ init_word_char (re_dfa_t *dfa)
}
 }
 
+general_case:
   for (; i < BITSET_WORDS; ++i)
 for (int j = 0; j < BITSET_WORD_BITS; ++j, ++ch)
   if (isalnum (ch) || ch == '_')
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366728 - head/sbin/pfctl/tests

2020-10-15 Thread Adrian Chadd
Author: adrian
Date: Thu Oct 15 14:56:51 2020
New Revision: 366728
URL: https://svnweb.freebsd.org/changeset/base/366728

Log:
  [pfctl_tests] Add missing void to empty function declaration
  
  Our gcc-6.4 flags require non-empty function declarations.
  Fix this to match the rest of the codebase.
  
  Tested:
  
  * compiled on gcc-6.4 for amd64
  
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D26795

Modified:
  head/sbin/pfctl/tests/pfctl_test.c

Modified: head/sbin/pfctl/tests/pfctl_test.c
==
--- head/sbin/pfctl/tests/pfctl_test.c  Thu Oct 15 14:55:07 2020
(r366727)
+++ head/sbin/pfctl/tests/pfctl_test.c  Thu Oct 15 14:56:51 2020
(r366728)
@@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$");
  */
 
 static bool
-check_pf_module_available()
+check_pf_module_available(void)
 {
int modid;
struct module_stat stat;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366727 - head/contrib/netbsd-tests/lib/libc/sys

2020-10-15 Thread Adrian Chadd
Author: adrian
Date: Thu Oct 15 14:55:07 2020
New Revision: 366727
URL: https://svnweb.freebsd.org/changeset/base/366727

Log:
  [tests] Fix itimer test warning-errors on gcc-6.4
  
  This fixes a "suggested parens" compile warning-into-error
  that shows up on gcc-6.4.
  
  Reviewed by:  ngie
  Differential Revision:https://reviews.freebsd.org/D26789

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_getitimer.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getitimer.c
==
--- head/contrib/netbsd-tests/lib/libc/sys/t_getitimer.cThu Oct 15 
14:37:51 2020(r366726)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_getitimer.cThu Oct 15 
14:55:07 2020(r366727)
@@ -195,8 +195,8 @@ ATF_TC_BODY(setitimer_old, tc)
ATF_REQUIRE(setitimer(ITIMER_REAL, &it, &ot) == 0);
 
 #ifdef __FreeBSD__
-   ATF_REQUIRE_MSG(ot.it_value.tv_sec < 4 ||
-   ot.it_value.tv_sec == 4 && ot.it_value.tv_usec <= 3,
+   ATF_REQUIRE_MSG((ot.it_value.tv_sec < 4) ||
+   (ot.it_value.tv_sec == 4 && ot.it_value.tv_usec <= 3),
"setitimer(2) returned invalid it_value: %jd %jd",
(intmax_t)ot.it_value.tv_sec, (intmax_t)ot.it_value.tv_usec);
 #else
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366709 - head/sys/crypto/skein/amd64

2020-10-14 Thread Adrian Chadd
Author: adrian
Date: Wed Oct 14 20:55:31 2020
New Revision: 366709
URL: https://svnweb.freebsd.org/changeset/base/366709

Log:
  [skein] Fix compile issue with unknown symbol SKEIN_ASM_UNROLL1024
  
  Weirdly, I needed to sprinkle more parens here to get gcc-as in 6.4
  to correctly generate things.
  
  Without them, I'd get an unknown variable reference to SKEIN_ASM_UNROLL1024.
  
  This at least links now, but I haven't run any test cases against it.
  It may be worthwhile doing it in case gcc-as demands we liberally sprinkle
  more brackets around variables in .if statements.
  
  Thanks to ed for the suggestion of just sprinkling more brackets to
  see if that helped.
  
  Reviewed by:  emaste

Modified:
  head/sys/crypto/skein/amd64/skein_block_asm.S

Modified: head/sys/crypto/skein/amd64/skein_block_asm.S
==
--- head/sys/crypto/skein/amd64/skein_block_asm.S   Wed Oct 14 17:39:50 
2020(r366708)
+++ head/sys/crypto/skein/amd64/skein_block_asm.S   Wed Oct 14 20:55:31 
2020(r366709)
@@ -41,7 +41,7 @@ SKEIN_UNROLL_1024 = (_SKEIN_LOOP  ) % 10
 SKEIN_ASM_UNROLL  = 0
   .irp _NN_,256,512,1024
 .if (SKEIN_UNROLL_\_NN_) == 0
-SKEIN_ASM_UNROLL  = SKEIN_ASM_UNROLL + \_NN_
+SKEIN_ASM_UNROLL  = (SKEIN_ASM_UNROLL) + \_NN_
 .endif
   .endr
 #
@@ -397,7 +397,7 @@ _NN_ = _NN_ - 1
 .macro Skein_Debug_Round BLK_BITS,R,RDI_OFFS,afterOp
 # call the appropriate (local) debug "function"
 pushq   %rdx#save rdx, so we can use it for round 
"number"
-  .if (SKEIN_ASM_UNROLL & \BLK_BITS) || (\R >= SKEIN_RND_SPECIAL)
+  .if ((SKEIN_ASM_UNROLL) & \BLK_BITS) || (\R >= SKEIN_RND_SPECIAL)
 movq$\R,%rdx
   .else #compute round number using edi
 _rOffs_ = \RDI_OFFS + 0
@@ -533,7 +533,7 @@ Skein_256_block_loop:
 Skein_Debug_Round 256,SKEIN_RND_KEY_INITIAL
 .endif
 #
-.if ((SKEIN_ASM_UNROLL & 256) == 0)
+.if (((SKEIN_ASM_UNROLL) & 256) == 0)
 movq%r8 ,ksKey+40+F_O(%rbp)  #save key schedule on stack for looping 
code
 movq%r9 ,ksKey+ 8+F_O(%rbp)
 movq%r10,ksKey+16+F_O(%rbp)
@@ -549,7 +549,7 @@ Skein_256_block_loop:
 #
 # now the key schedule is computed. Start the rounds
 #
-.if SKEIN_ASM_UNROLL & 256
+.if (SKEIN_ASM_UNROLL) & 256
 _UNROLL_CNT =   ROUNDS_256/8
 .else
 _UNROLL_CNT =   SKEIN_UNROLL_256
@@ -566,20 +566,20 @@ _Rbase_ = 0
 addReg  rax, rbx
 RotL64  rbx, 256,%((4*_Rbase_+0) % 8),0
 addReg  rcx, rdx
-.if (SKEIN_ASM_UNROLL & 256) == 0
+.if ((SKEIN_ASM_UNROLL) & 256) == 0
 movq ksKey+8*1+F_O(%rbp,%rdi,8),%r8
 .endif
 xorReg  rbx, rax
 RotL64  rdx, 256,%((4*_Rbase_+0) % 8),1
 xorReg  rdx, rcx
-  .if SKEIN_ASM_UNROLL & 256
+  .if (SKEIN_ASM_UNROLL) & 256
 .irp _r0_,%( 8+(_Rbase_+3) % 5)
 .irp _r1_,%(13+(_Rbase_+2) % 3)
   leaq   (%r\_r0_,%r\_r1_),%rdi#precompute key injection value for %rcx
 .endr
 .endr
   .endif
-.if (SKEIN_ASM_UNROLL & 256) == 0
+.if ((SKEIN_ASM_UNROLL) & 256) == 0
 movq ksTwk+8*1+F_O(%rbp,%rdi,8),%r13
 .endif
 Skein_Debug_Round 256,%(4*_Rbase_+1)
@@ -588,17 +588,17 @@ _Rbase_ = 0
 addReg  rax, rdx
 RotL64  rdx, 256,%((4*_Rbase_+1) % 8),0
 xorReg  rdx, rax
-.if (SKEIN_ASM_UNROLL & 256) == 0
+.if ((SKEIN_ASM_UNROLL) & 256) == 0
 movq ksKey+8*2+F_O(%rbp,%rdi,8),%r9
 .endif
 addReg  rcx, rbx
 RotL64  rbx, 256,%((4*_Rbase_+1) % 8),1
 xorReg  rbx, rcx
-.if (SKEIN_ASM_UNROLL & 256) == 0
+.if ((SKEIN_ASM_UNROLL) & 256) == 0
 movq ksKey+8*4+F_O(%rbp,%rdi,8),%r11
 .endif
 Skein_Debug_Round 256,%(4*_Rbase_+2)
- .if SKEIN_ASM_UNROLL & 256
+ .if (SKEIN_ASM_UNROLL) & 256
 .irp _r0_,%( 8+(_Rbase_+2) % 5)
 .irp _r1_,%(13+(_Rbase_+1) % 3)
   leaq   (%r\_r0_,%r\_r1_),%rsi #precompute key injection value for 
%rbx
@@ -609,13 +609,13 @@ _Rbase_ = 0
 addReg  rax, rbx
 RotL64  rbx, 256,%((4*_Rbase_+2) % 8),0
 addReg  rcx, rdx
-.if (SKEIN_ASM_UNROLL & 256) == 0
+.if ((SKEIN_ASM_UNROLL) & 256) == 0
 movq ksKey+8*3+F_O(%rbp,%rdi,8),%r10
 .endif
 xorReg  rbx, rax
 RotL64  rdx, 256,%((4*_Rbase_+2) % 8),1
 xorReg  rdx, rcx
-.if (SKEIN_ASM_UNROLL & 256) == 0
+.if ((SKEIN_ASM_UNROLL) & 256) == 0
 movq %r8,ksKey+8*6+F_O(%rbp,%rdi,8)  #"rotate" the key
 leaq 1(%r11,%rdi),%r11   #precompute key + 
tweak
 .endif
@@ -624,7 +624,7 @@ _Rbase_ = 0
 addReg  rax, rdx
 RotL64  rdx, 256,%((4*_Rbase_+3) % 8),0
 addReg  rcx, rbx
-.if (SKEIN_

svn commit: r366703 - head/sys/crypto/skein/amd64

2020-10-14 Thread Adrian Chadd
Author: adrian
Date: Wed Oct 14 14:29:56 2020
New Revision: 366703
URL: https://svnweb.freebsd.org/changeset/base/366703

Log:
  [skein] Fix compilation on gnu assembler with gcc-6 and gcc-9
  
  For some reason I don't want to really understand, the following
  happens with gnu as.
  
  /home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S: 
Assembler messages:
  /home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:466: 
Error: found '(', expected: ')'
  /home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:466: 
Error: junk at end of line, first unrecognized character is `('
  /home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:795: 
Error: found '(', expected: ')'
  /home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:795: 
Error: junk at end of line, first unrecognized character is `('
  /home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:885: 
Error: non-constant expression in ".if" statement
  /home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:885: 
Error: non-constant expression in ".if" statement
  /home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:885: 
Error: non-constant expression in ".if" statement
  /home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:885: 
Error: non-constant expression in ".if" statement
  /home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:885: 
Error: non-constant expression in ".if" statement
  /home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:885: 
Error: non-constant expression in ".if" statement
  
  After an exhaustive search and experimentation at 11pm, I discovered that
  putting them in parentheses fixes the compilation.
  
  Ed pointed out that I could likely fix this in a bunch of other
  locations but I'd rather leave these alone until other options
  are enabled.
  
  Tested:
  
  * gcc-6, amd64
  
  Reviewed by:  emaste

Modified:
  head/sys/crypto/skein/amd64/skein_block_asm.S

Modified: head/sys/crypto/skein/amd64/skein_block_asm.S
==
--- head/sys/crypto/skein/amd64/skein_block_asm.S   Wed Oct 14 14:12:15 
2020(r366702)
+++ head/sys/crypto/skein/amd64/skein_block_asm.S   Wed Oct 14 14:29:56 
2020(r366703)
@@ -277,7 +277,7 @@ _STK_OFFS_  =   0   #starting offset f
 StackVarX_stk  ,8*(WCNT)#local context vars
 StackVarksTwk  ,8*3 #key schedule: tweak words
 StackVarksKey  ,8*(WCNT)+8  #key schedule: key   words
-  .if (SKEIN_ASM_UNROLL & (\BLK_BITS)) == 0
+  .if ((SKEIN_ASM_UNROLL) & (\BLK_BITS)) == 0
 StackVarksRot ,16*(\KS_CNT) #leave space for "rotation" to happen
   .endif
 StackVarWcopy  ,8*(WCNT)#copy of input block
@@ -749,7 +749,7 @@ C_label Skein_256_Unroll_Cnt
 # MACRO: eight rounds for 512-bit blocks
 #
 .macro R_512_FourRounds _RR_#RR = base round number (0 % 8)
-  .if (SKEIN_ASM_UNROLL & 512)
+  .if ((SKEIN_ASM_UNROLL) & 512)
 # here for fully unrolled case.
 _II_ = ((\_RR_)/4) + 1   #key injection counter
 R_512_OneRound  8, 9,10,11,12,13,14,15,%((\_RR_)+0),,,
@@ -978,7 +978,7 @@ rIdx_offs = tmpStk_1024
 movq   %\reg1 , xDebug_1024+8*\w1(%rsp)# (before inline key 
injection)
  .endif
 _II_ = ((\_RN0_)/4)+1   #injection count
- .if SKEIN_ASM_UNROLL & 1024   #here to do fully unrolled key injection
+ .if (SKEIN_ASM_UNROLL) & 1024   #here to do fully unrolled key injection
 addqksKey+ 8*((_II_+\w0) % 17)(%rsp),%\reg0
 addqksKey+ 8*((_II_+\w1) % 17)(%rsp),%\reg1
   .if \w1 == 13#tweak injection
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366690 - head/usr.sbin/traceroute6

2020-10-13 Thread Adrian Chadd
Author: adrian
Date: Wed Oct 14 00:01:17 2020
New Revision: 366690
URL: https://svnweb.freebsd.org/changeset/base/366690

Log:
  [traceroute6] Don't do the casper bits when we're not doing casper
  
  This with the previous patch I committed makes traceroute6/traceroute
  compile fine when libcasper isn't enabled.
  
  This complains strongly with unused variables and such when compiled
  with gcc-6 on mips32.
  
  Tested:
  
  * compiled/run on mips32 hardware (AR9344)
  
  Reviewed by:  emaste
  Differential Revision: https://reviews.freebsd.org/D26773

Modified:
  head/usr.sbin/traceroute6/traceroute6.c

Modified: head/usr.sbin/traceroute6/traceroute6.c
==
--- head/usr.sbin/traceroute6/traceroute6.c Tue Oct 13 23:29:06 2020
(r366689)
+++ head/usr.sbin/traceroute6/traceroute6.c Wed Oct 14 00:01:17 2020
(r366690)
@@ -1527,8 +1527,9 @@ get_uphdr(struct ip6_hdr *ip6, u_char *lim)
 }
 
 void
-capdns_open()
+capdns_open(void)
 {
+#ifdef WITH_CASPER
const char *types[] = { "NAME", "ADDR" };
int families[1];
cap_channel_t *casper;
@@ -1545,6 +1546,7 @@ capdns_open()
if (cap_dns_family_limit(capdns, families, nitems(families)) < 0)
errx(1, "unable to limit access to system.dns service");
cap_close(casper);
+#endif /* WITH_CASPER */
 }
 
 void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366688 - head/lib/libcasper/services/cap_dns

2020-10-13 Thread Adrian Chadd
Author: adrian
Date: Tue Oct 13 22:49:43 2020
New Revision: 366688
URL: https://svnweb.freebsd.org/changeset/base/366688

Log:
  [libcasper] Update cap_dns API to not trigger unused variable warnings when 
disabled
  
  When compiling without casper these API calls result in unused variable 
warnings.
  Using #defines was lovely in the past but unfortunately it triggers warnings
  which can cascade into errors.
  
  Instead, just inline with some fallthrough functions and keep things happy.
  
  Tested:
  
  * gcc-6 targeting mips32, with casper disabled
  
  Reviewed by:  emaste
  Differential Revision:https://reviews.freebsd.org/D26762

Modified:
  head/lib/libcasper/services/cap_dns/cap_dns.h

Modified: head/lib/libcasper/services/cap_dns/cap_dns.h
==
--- head/lib/libcasper/services/cap_dns/cap_dns.h   Tue Oct 13 22:20:03 
2020(r366687)
+++ head/lib/libcasper/services/cap_dns/cap_dns.h   Tue Oct 13 22:49:43 
2020(r366688)
@@ -39,6 +39,15 @@
 #include 
 #include /* socklen_t */
 
+/*
+ * Pull these in if we're just inlining calls to the underlying
+ * libc functions.
+ */
+#ifndefWITH_CASPER
+#include 
+#include 
+#endif /* WITH_CASPER */
+
 struct addrinfo;
 struct hostent;
 
@@ -64,17 +73,62 @@ int cap_dns_family_limit(cap_channel_t *chan, const in
 
 __END_DECLS
 #else
-#definecap_gethostbyname(chan, name)gethostbyname(name)
-#define cap_gethostbyname2(chan, name, type)gethostbyname2(name, type)
-#define cap_gethostbyaddr(chan, addr, len, type) gethostbyaddr(addr, len, type)
 
-#definecap_getaddrinfo(chan, hostname, servname, hints, res)   
\
-   getaddrinfo(hostname, servname, hints, res)
-#definecap_getnameinfo(chan, sa, salen, host, hostlen, serv, servlen, 
flags)   \
-   getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
+static inline struct hostent *
+cap_gethostbyname(cap_channel_t *chan __unused, const char *name)
+{
 
-#definecap_dns_type_limit(chan, types, ntypes) (0)
-#define cap_dns_family_limit(chan, families, nfamilies)(0)
-#endif
+   return (gethostbyname(name));
+}
+
+static inline struct hostent *
+cap_gethostbyname2(cap_channel_t *chan __unused, const char *name, int type)
+{
+
+   return (gethostbyname2(name, type));
+}
+
+static inline struct hostent *
+cap_gethostbyaddr(cap_channel_t *chan __unused, const void *addr,
+socklen_t len, int type)
+{
+
+   return (gethostbyaddr(addr, len, type));
+}
+
+static inline int cap_getaddrinfo(cap_channel_t *chan __unused,
+const char *hostname, const char *servname, const struct addrinfo *hints,
+struct addrinfo **res)
+{
+
+   return (getaddrinfo(hostname, servname, hints, res));
+}
+
+static inline int cap_getnameinfo(cap_channel_t *chan __unused,
+const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen,
+char *serv, size_t servlen, int flags)
+{
+
+   return (getnameinfo(sa, salen, host, hostlen, serv, servlen, flags));
+}
+
+static inline int
+cap_dns_type_limit(cap_channel_t *chan __unused,
+const char * const *types __unused,
+size_t ntypes __unused)
+{
+
+   return (0);
+}
+
+static inline int
+cap_dns_family_limit(cap_channel_t *chan __unused,
+const int *families __unused,
+size_t nfamilies __unused)
+{
+
+   return (0);
+}
+#endif /* WITH_CASPER */
 
 #endif /* !_CAP_DNS_H_ */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366680 - head/tools/tools/ath

2020-10-13 Thread Adrian Chadd
Author: adrian
Date: Tue Oct 13 18:36:35 2020
New Revision: 366680
URL: https://svnweb.freebsd.org/changeset/base/366680

Log:
  [ath] Set WARNS to 0 here for now
  
  There are still more warnings to fix here, but gcc on mips treats a lot
  of these as failures.
  
  So stop it stopping me for now whilst I fix them.

Modified:
  head/tools/tools/ath/Makefile.inc

Modified: head/tools/tools/ath/Makefile.inc
==
--- head/tools/tools/ath/Makefile.inc   Tue Oct 13 18:35:43 2020
(r366679)
+++ head/tools/tools/ath/Makefile.inc   Tue Oct 13 18:36:35 2020
(r366680)
@@ -5,6 +5,8 @@ MAN=
 
 ATH_DEFAULT=   ath0
 
+WARNS?=0
+
 CFLAGS+=-DATH_DEFAULT='"${ATH_DEFAULT}"'
 CFLAGS+=-I${.CURDIR}
 CFLAGS+=-I${.CURDIR}/../common
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366679 - head/tools/tools/ath/athdebug

2020-10-13 Thread Adrian Chadd
Author: adrian
Date: Tue Oct 13 18:35:43 2020
New Revision: 366679
URL: https://svnweb.freebsd.org/changeset/base/366679

Log:
  [athdebug] Fix warnings generated by gcc on mips
  
  * commented out currently unused/dead code; need to see what it was once
used for
  * remove unused variable
  * fix typing

Modified:
  head/tools/tools/ath/athdebug/athdebug.c

Modified: head/tools/tools/ath/athdebug/athdebug.c
==
--- head/tools/tools/ath/athdebug/athdebug.cTue Oct 13 18:28:48 2020
(r366678)
+++ head/tools/tools/ath/athdebug/athdebug.cTue Oct 13 18:35:43 2020
(r366679)
@@ -112,7 +112,7 @@ static struct {
 static uint64_t
 getflag(const char *name, int len)
 {
-   int i;
+   unsigned int i;
 
for (i = 0; i < nitems(flags); i++)
if (strncasecmp(flags[i].name, name, len) == 0)
@@ -120,6 +120,7 @@ getflag(const char *name, int len)
return 0;
 }
 
+#if 0
 static const char *
 getflagname(u_int flag)
 {
@@ -130,11 +131,12 @@ getflagname(u_int flag)
return flags[i].name;
return "???";
 }
+#endif
 
 static void
 usage(void)
 {
-   int i;
+   unsigned int i;
 
fprintf(stderr, "usage: %s [-i device] [flags]\n", progname);
fprintf(stderr, "where flags are:\n");
@@ -149,7 +151,8 @@ main(int argc, char *argv[])
const char *ifname;
const char *cp, *tp;
const char *sep;
-   int c, op, i;
+   int op;
+   unsigned int i;
uint64_t debug, ndebug;
size_t debuglen;
char oid[256];
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r365957 - in head: sbin/rcorder usr.sbin/crunch/crunchgen

2020-09-21 Thread Adrian Chadd
Author: adrian
Date: Mon Sep 21 17:59:45 2020
New Revision: 365957
URL: https://svnweb.freebsd.org/changeset/base/365957

Log:
  [rcorder] [crunch] Fix C function declarations to include void
  
  This fixes a compile issue under gcc6 which complains about
  legacy style C function declarations.
  
  Differential Revision:https://reviews.freebsd.org/D26504

Modified:
  head/sbin/rcorder/rcorder.c
  head/usr.sbin/crunch/crunchgen/crunched_main.c

Modified: head/sbin/rcorder/rcorder.c
==
--- head/sbin/rcorder/rcorder.c Mon Sep 21 17:48:28 2020(r365956)
+++ head/sbin/rcorder/rcorder.c Mon Sep 21 17:59:45 2020(r365957)
@@ -990,7 +990,7 @@ do_file(filenode *fnode, strnodelist *stack_ptr)
 }
 
 static void
-generate_graphviz_header()
+generate_graphviz_header(void)
 {
 
if (do_graphviz != true)
@@ -1003,7 +1003,7 @@ generate_graphviz_header()
 }
 
 static void
-generate_graphviz_footer()
+generate_graphviz_footer(void)
 {
 
if (do_graphviz == true)
@@ -1011,7 +1011,7 @@ generate_graphviz_footer()
 }
 
 static void
-generate_graphviz_providers()
+generate_graphviz_providers(void)
 {
Hash_Entry *entry;
Hash_Search psearch;

Modified: head/usr.sbin/crunch/crunchgen/crunched_main.c
==
--- head/usr.sbin/crunch/crunchgen/crunched_main.c  Mon Sep 21 17:48:28 
2020(r365956)
+++ head/usr.sbin/crunch/crunchgen/crunched_main.c  Mon Sep 21 17:59:45 
2020(r365957)
@@ -183,7 +183,7 @@ crunched_main(int argc, char **argv, char **envp)
 }
 
 static void
-crunched_usage()
+crunched_usage(void)
 {
int columns, len;
struct stub *ep;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r364091 - head/lib/libc/gen

2020-08-27 Thread Adrian Chadd
{snip}

and for completeness sake, bsearch_b.c has the same issue but isn't
included in lib/Makefile; thus why it's not tripping the compiler error.



-adrian
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r364091 - head/lib/libc/gen

2020-08-27 Thread Adrian Chadd
Hi!

This breaks when compiling FreeBSD-mips on GCC-9. :(

In file included from
/usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/gen/scandir.c:50,
 from
/usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/gen/scandir_b.c:29:
/usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/include/block_abi.h:45:2:
error: anonymous struct declared inside parameter list will not be visible
outside of this definition or declarati
   45 |  struct {\
  |  ^~
/usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/gen/scandir.c:67:5:
note: in expansion of macro 'DECLARE_BLOCK'
   67 | DECLARE_BLOCK(int, dcomp, const struct dirent **, const struct
dirent **))
  | ^
/usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/include/block_abi.h:45:2:
error: anonymous struct declared inside parameter list will not be visible
outside of this definition or declarati
   45 |  struct {\
  |  ^~
/usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/gen/scandir.c:66:5:
note: in expansion of macro 'DECLARE_BLOCK'
   66 | DECLARE_BLOCK(int, select, const struct dirent *),
  | ^
cc1: all warnings being treated as errors
--- scandir_b.o ---
*** [scandir_b.o] Error code 1


-adrian
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r363328 - head/sys/dev/an

2020-07-19 Thread Adrian Chadd
Author: adrian
Date: Sun Jul 19 17:27:48 2020
New Revision: 363328
URL: https://svnweb.freebsd.org/changeset/base/363328

Log:
  [if_an] unbreak!
  
  .. I missed this when checking drivers.
  
  Differential Revision:https://reviews.freebsd.org/D25723

Modified:
  head/sys/dev/an/if_an.c

Modified: head/sys/dev/an/if_an.c
==
--- head/sys/dev/an/if_an.c Sun Jul 19 16:07:51 2020(r363327)
+++ head/sys/dev/an/if_an.c Sun Jul 19 17:27:48 2020(r363328)
@@ -2324,7 +2324,7 @@ an_ioctl(struct ifnet *ifp, u_long command, caddr_t da
}
break;
case SIOCS80211:
-   if ((error = priv_check(td, PRIV_NET80211_MANAGE)))
+   if ((error = priv_check(td, PRIV_NET80211_VAP_MANAGE)))
goto out;
AN_LOCK(sc);
sc->areq.an_len = sizeof(sc->areq);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r363327 - head/sys/sys

2020-07-19 Thread Adrian Chadd
Author: adrian
Date: Sun Jul 19 16:07:51 2020
New Revision: 363327
URL: https://svnweb.freebsd.org/changeset/base/363327

Log:
  [net80211] missing from last commit, le whoops
  
  Differential Revision:https://reviews.freebsd.org/D25630

Modified:
  head/sys/sys/priv.h

Modified: head/sys/sys/priv.h
==
--- head/sys/sys/priv.h Sun Jul 19 15:16:57 2020(r363326)
+++ head/sys/sys/priv.h Sun Jul 19 16:07:51 2020(r363327)
@@ -351,8 +351,10 @@
 /*
  * 802.11-related privileges.
  */
-#definePRIV_NET80211_GETKEY440 /* Query 802.11 keys. */
-#definePRIV_NET80211_MANAGE441 /* Administer 802.11. */
+#definePRIV_NET80211_VAP_GETKEY440 /* Query VAP 802.11 
keys. */
+#definePRIV_NET80211_VAP_MANAGE441 /* Administer 802.11 
VAP */
+#definePRIV_NET80211_VAP_SETMAC442 /* Set VAP MAC address 
*/
+#definePRIV_NET80211_CREATE_VAP443 /* Create a new VAP */
 
 /*
  * Placeholder for AppleTalk privileges, not supported anymore.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r363325 - in head/sys: kern net80211

2020-07-19 Thread Adrian Chadd
Author: adrian
Date: Sun Jul 19 15:16:27 2020
New Revision: 363325
URL: https://svnweb.freebsd.org/changeset/base/363325

Log:
  [net80211] Add new privileges; restrict what can be done in a jail.
  
  Split the MANAGE privilege into MANAGE, SETMAC and CREATE_VAP.
  
  + VAP_MANAGE is everything but setting the MAC and creating a VAP.
  + VAP_SETMAC is setting the MAC address of the VAP.
Typically you wouldn't want the jail to be able to modify this.
  + CREATE_VAP is to create a new VAP. Again, you don't want to be doing
this in a jail, but this DOES stop being able to run some corner
cases like Dynamic WDS (DWDS) AP in a jail/vnet. We can figure this
bit out later.
  
  This allows me to run wpa_supplicant in a jail after transferring
  a STA VAP into it. I unfortunately can't currently set the wlan
  debugging inside the jail; that would be super useful!
  
  Reviewed by:  bz
  Differential Revision:https://reviews.freebsd.org/D25630

Modified:
  head/sys/kern/kern_jail.c
  head/sys/net80211/ieee80211_freebsd.c
  head/sys/net80211/ieee80211_ioctl.c

Modified: head/sys/kern/kern_jail.c
==
--- head/sys/kern/kern_jail.c   Sun Jul 19 14:42:13 2020(r363324)
+++ head/sys/kern/kern_jail.c   Sun Jul 19 15:16:27 2020(r363325)
@@ -3107,10 +3107,8 @@ prison_priv_check(struct ucred *cred, int priv)
/*
 * 802.11-related privileges.
 */
-   case PRIV_NET80211_GETKEY:
-#ifdef notyet
-   case PRIV_NET80211_MANAGE:  /* XXX-BZ discuss with sam@ */
-#endif
+   case PRIV_NET80211_VAP_GETKEY:
+   case PRIV_NET80211_VAP_MANAGE:
 
 #ifdef notyet
/*

Modified: head/sys/net80211/ieee80211_freebsd.c
==
--- head/sys/net80211/ieee80211_freebsd.c   Sun Jul 19 14:42:13 2020
(r363324)
+++ head/sys/net80211/ieee80211_freebsd.c   Sun Jul 19 15:16:27 2020
(r363325)
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include
 #include 
+#include 
 #include 
 #include 
 
@@ -81,6 +82,10 @@ wlan_clone_create(struct if_clone *ifc, int unit, cadd
struct ieee80211vap *vap;
struct ieee80211com *ic;
int error;
+
+   error = priv_check(curthread, PRIV_NET80211_CREATE_VAP);
+   if (error)
+   return error;
 
error = copyin(params, &cp, sizeof(cp));
if (error)

Modified: head/sys/net80211/ieee80211_ioctl.c
==
--- head/sys/net80211/ieee80211_ioctl.c Sun Jul 19 14:42:13 2020
(r363324)
+++ head/sys/net80211/ieee80211_ioctl.c Sun Jul 19 15:16:27 2020
(r363325)
@@ -106,7 +106,8 @@ ieee80211_ioctl_getkey(struct ieee80211vap *vap, struc
ik.ik_flags = wk->wk_flags & (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV);
if (wk->wk_keyix == vap->iv_def_txkey)
ik.ik_flags |= IEEE80211_KEY_DEFAULT;
-   if (priv_check(curthread, PRIV_NET80211_GETKEY) == 0) {
+   /* XXX TODO: move priv check to ieee80211_freebsd.c */
+   if (priv_check(curthread, PRIV_NET80211_VAP_GETKEY) == 0) {
/* NB: only root can read key data */
ik.ik_keyrsc = wk->wk_keyrsc[IEEE80211_NONQOS_TID];
ik.ik_keytsc = wk->wk_keytsc;
@@ -815,7 +816,8 @@ ieee80211_ioctl_get80211(struct ieee80211vap *vap, u_l
return EINVAL;
len = (u_int) vap->iv_nw_keys[kid].wk_keylen;
/* NB: only root can read WEP keys */
-   if (priv_check(curthread, PRIV_NET80211_GETKEY) == 0) {
+   /* XXX TODO: move priv check to ieee80211_freebsd.c */
+   if (priv_check(curthread, PRIV_NET80211_VAP_GETKEY) == 0) {
bcopy(vap->iv_nw_keys[kid].wk_key, tmpkey, len);
} else {
bzero(tmpkey, len);
@@ -3636,7 +3638,8 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t
(struct ieee80211req *) data);
break;
case SIOCS80211:
-   error = priv_check(curthread, PRIV_NET80211_MANAGE);
+   /* XXX TODO: move priv check to ieee80211_freebsd.c */
+   error = priv_check(curthread, PRIV_NET80211_VAP_MANAGE);
if (error == 0)
error = ieee80211_ioctl_set80211(vap, cmd,
(struct ieee80211req *) data);
@@ -3681,6 +3684,12 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t
break;
}
break;
+   case SIOCSIFLLADDR:
+   /* XXX TODO: move priv check to ieee80211_freebsd.c */
+   error = priv_check(curthread, PRIV_NET80211_VAP_SETMAC);
+   if (error == 0)
+   break;
+ 

svn commit: r363236 - head/sys/mips/atheros

2020-07-15 Thread Adrian Chadd
Author: adrian
Date: Wed Jul 15 19:34:19 2020
New Revision: 363236
URL: https://svnweb.freebsd.org/changeset/base/363236

Log:
  [ar71xx] fix watchdog to work on subsequent SoCs
  
  The AR9341 AHB runs at 225MHz, much faster than the 33MHz of the
  AR71xx AHB.  So not only is the math going to do weird things, it
  will also wrap rather than being clamped.
  
  So:
  
  * clamp! don't wrap!
  * tidy up some debugging
  * add an option to throw an NMI rather than reset!
  
  Tested:
  
  * AR9341 SoC (TP-Link TL-WDR4300), patting/not patting the watchdog!

Modified:
  head/sys/mips/atheros/ar71xx_wdog.c

Modified: head/sys/mips/atheros/ar71xx_wdog.c
==
--- head/sys/mips/atheros/ar71xx_wdog.c Wed Jul 15 18:49:00 2020
(r363235)
+++ head/sys/mips/atheros/ar71xx_wdog.c Wed Jul 15 19:34:19 2020
(r363236)
@@ -50,6 +50,7 @@ struct ar71xx_wdog_softc {
device_t dev;
int armed;
int reboot_from_watchdog;
+   int watchdog_nmi;
int debug;
 };
 
@@ -58,32 +59,54 @@ ar71xx_wdog_watchdog_fn(void *private, u_int cmd, int 
 {
struct ar71xx_wdog_softc *sc = private;
uint64_t timer_val;
+   int action;
 
+   action = RST_WDOG_ACTION_RESET;
+   if (sc->watchdog_nmi != 0)
+   action = RST_WDOG_ACTION_NMI;
+
cmd &= WD_INTERVAL;
if (sc->debug)
-   device_printf(sc->dev, "ar71xx_wdog_watchdog_fn: cmd: %x\n", 
cmd);
+   device_printf(sc->dev, "%s: : cmd: %x\n", __func__, cmd);
if (cmd > 0) {
timer_val = (uint64_t)(1ULL << cmd) * ar71xx_ahb_freq() /
10;
+
+   /*
+* Clamp the timer value in case we overflow.
+*/
+   if (timer_val > 0x)
+   timer_val = 0x;
if (sc->debug)
-   device_printf(sc->dev, "ar71xx_wdog_watchdog_fn: 
programming timer: %jx\n", (uintmax_t) timer_val);
+   device_printf(sc->dev, "%s: programming timer: %jx\n",
+   __func__, (uintmax_t) timer_val);
/*
-* Load timer with large enough value to prevent spurious
-* reset
+* Make sure the watchdog is set to NOACTION and give it
+* time to take.
 */
-   ATH_WRITE_REG(AR71XX_RST_WDOG_TIMER, 
-   ar71xx_ahb_freq() * 10);
-   ATH_WRITE_REG(AR71XX_RST_WDOG_CONTROL, 
-   RST_WDOG_ACTION_RESET);
-   ATH_WRITE_REG(AR71XX_RST_WDOG_TIMER, 
-   (timer_val & 0x));
+   ATH_WRITE_REG(AR71XX_RST_WDOG_CONTROL, 
RST_WDOG_ACTION_NOACTION);
+   wmb();
+   DELAY(100);
+
+   /*
+* Update the timer value.  It's already clamped at this
+* point so we don't have to wrap/clamp it here.
+*/
+   ATH_WRITE_REG(AR71XX_RST_WDOG_TIMER, timer_val);
+   wmb();
+   DELAY(100);
+
+   /*
+* And now, arm.
+*/
+   ATH_WRITE_REG(AR71XX_RST_WDOG_CONTROL, action);
sc->armed = 1;
*error = 0;
} else {
if (sc->debug)
-   device_printf(sc->dev, "ar71xx_wdog_watchdog_fn: 
disarming\n");
+   device_printf(sc->dev, "%s: disarming\n", __func__);
if (sc->armed) {
-   ATH_WRITE_REG(AR71XX_RST_WDOG_CONTROL, 
+   ATH_WRITE_REG(AR71XX_RST_WDOG_CONTROL,
RST_WDOG_ACTION_NOACTION);
sc->armed = 0;
}
@@ -109,6 +132,9 @@ ar71xx_wdog_sysctl(device_t dev)
 SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
 "debug", CTLFLAG_RW, &sc->debug, 0,
 "enable watchdog debugging");
+SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+"nmi", CTLFLAG_RW, &sc->watchdog_nmi, 0,
+"watchdog triggers NMI instead of reset");
 SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
 "armed", CTLFLAG_RD, &sc->armed, 0,
 "whether the watchdog is armed");
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r363171 - head/contrib/flex/src

2020-07-14 Thread Adrian Chadd
Hi!

On Tue, 14 Jul 2020 at 08:00, Jung-uk Kim  wrote:

> On 20. 7. 14., Adrian Chadd wrote:
> > Author: adrian
> > Date: Tue Jul 14 05:00:08 2020
> > New Revision: 363171
> > URL: https://svnweb.freebsd.org/changeset/base/363171
> >
> > Log:
> >   [flex] Fix compilation issue under mips-gcc-6.4
> >
> >   This was triggering a pointer-losing-constness error.
>


> It was discussed in this ML.
>
> https://lists.freebsd.org/pipermail/svn-src-head/2020-June/137432.html
>
> kevans even filed an upstream pull request.
>
> https://github.com/westes/flex/pull/449


Oh good!


>
>
> Why did you commit it without asking us?
>

Oh I'm sorry! I didn't realise you were already doing the work to get it
fixed upstream. I just saw things broken when building my test wifi setups
here at home and saw they were small fixes that could be submitted upstream.

I'm personally not a huge fan of sitting on patches that
fix builds/functionality whilst waiting for upstream - this was one of the
many reasons for migrating from CVS to SVN in the long distant past! - so I
figured it would be easy to commit.

I'll make sure I ask around a little more next time!



-adrian


> Jung-uk Kim
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r363172 - head/contrib/bc/src

2020-07-14 Thread Adrian Chadd
On Tue, 14 Jul 2020 at 06:42, Warner Losh  wrote:

> Did you intend to commit to contrib software that has an active upstream?
> This is going to cause conflicts in the future. Maybe you can submit it to
> the new upstream instead?
>

i was going to do both, for the changes to both flex and bc.



-adrian


>
> Warner
>
> On Mon, Jul 13, 2020 at 11:02 PM Adrian Chadd  wrote:
>
>> Author: adrian
>> Date: Tue Jul 14 05:02:18 2020
>> New Revision: 363172
>> URL: https://svnweb.freebsd.org/changeset/base/363172
>>
>> Log:
>>   [bc] Fix a "maybe uninitialized" compiler warning under mips-gcc-6.3.0.
>>
>>   I guess this didn't like the case statements.. ? But this does quieten
>>   the compiler error.
>>
>> Modified:
>>   head/contrib/bc/src/program.c
>>
>> Modified: head/contrib/bc/src/program.c
>>
>> ==
>> --- head/contrib/bc/src/program.c   Tue Jul 14 05:00:08 2020
>> (r363171)
>> +++ head/contrib/bc/src/program.c   Tue Jul 14 05:02:18 2020
>> (r363172)
>> @@ -180,7 +180,7 @@ static inline BcVec* bc_program_vec(const BcProgram *p
>>
>>  static BcNum* bc_program_num(BcProgram *p, BcResult *r) {
>>
>> -   BcNum *n;
>> +   BcNum *n = NULL;
>>
>> switch (r->t) {
>>
>>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r363176 - head/usr.sbin

2020-07-13 Thread Adrian Chadd
Author: adrian
Date: Tue Jul 14 05:33:23 2020
New Revision: 363176
URL: https://svnweb.freebsd.org/changeset/base/363176

Log:
  [pmc] whoops, remove spurious #'s
  
  pointed out by gonzo@, thanks!

Modified:
  head/usr.sbin/Makefile

Modified: head/usr.sbin/Makefile
==
--- head/usr.sbin/Makefile  Tue Jul 14 05:24:07 2020(r363175)
+++ head/usr.sbin/Makefile  Tue Jul 14 05:33:23 2020(r363176)
@@ -186,9 +186,9 @@ SUBDIR.${MK_NTP}+=  ntp
 SUBDIR.${MK_OPENSSL}+= keyserv
 SUBDIR.${MK_PF}+=  ftp-proxy
 SUBDIR.${MK_PKGBOOTSTRAP}+=pkg
-#.if ${COMPILER_FEATURES:Mc++11}
-#SUBDIR.${MK_PMC}+=pmc
-#.endif
+.if ${COMPILER_FEATURES:Mc++11}
+SUBDIR.${MK_PMC}+= pmc
+.endif
 SUBDIR.${MK_PMC}+= pmcannotate pmccontrol pmcstat pmcstudy
 SUBDIR.${MK_PORTSNAP}+=portsnap
 SUBDIR.${MK_PPP}+= ppp
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r363174 - head/usr.sbin

2020-07-13 Thread Adrian Chadd
Author: adrian
Date: Tue Jul 14 05:10:50 2020
New Revision: 363174
URL: https://svnweb.freebsd.org/changeset/base/363174

Log:
  [hwpmc] Compile 'pmc' only if we have C++11.
  
  I noticed when compiling with ye olde gcc-6.3.0 on mips that it tripped over
  a lack of C++11 bits.  This allows it to compile fine.

Modified:
  head/usr.sbin/Makefile

Modified: head/usr.sbin/Makefile
==
--- head/usr.sbin/Makefile  Tue Jul 14 05:07:16 2020(r363173)
+++ head/usr.sbin/Makefile  Tue Jul 14 05:10:50 2020(r363174)
@@ -186,9 +186,9 @@ SUBDIR.${MK_NTP}+=  ntp
 SUBDIR.${MK_OPENSSL}+= keyserv
 SUBDIR.${MK_PF}+=  ftp-proxy
 SUBDIR.${MK_PKGBOOTSTRAP}+=pkg
-.if ${COMPILER_FEATURES:Mc++11}
-SUBDIR.${MK_PMC}+= pmc
-.endif
+#.if ${COMPILER_FEATURES:Mc++11}
+#SUBDIR.${MK_PMC}+=pmc
+#.endif
 SUBDIR.${MK_PMC}+= pmcannotate pmccontrol pmcstat pmcstudy
 SUBDIR.${MK_PORTSNAP}+=portsnap
 SUBDIR.${MK_PPP}+= ppp
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r363173 - head/sbin/ipfw

2020-07-13 Thread Adrian Chadd
Author: adrian
Date: Tue Jul 14 05:07:16 2020
New Revision: 363173
URL: https://svnweb.freebsd.org/changeset/base/363173

Log:
  [ipfw] quieten maybe-uninitialized errors in ipfw when compiled under 
mips-gcc-6.3.0.
  
  This is mostly an exercise to set variables to NULL/0 when declared, but
  one was ensuring a string variable was set before printing it.
  We should never see "" in a printed rule; if we do then this code
  definitely has some bugs that need addressing.

Modified:
  head/sbin/ipfw/dummynet.c
  head/sbin/ipfw/ipfw2.c
  head/sbin/ipfw/nat64lsn.c
  head/sbin/ipfw/tables.c

Modified: head/sbin/ipfw/dummynet.c
==
--- head/sbin/ipfw/dummynet.c   Tue Jul 14 05:02:18 2020(r363172)
+++ head/sbin/ipfw/dummynet.c   Tue Jul 14 05:07:16 2020(r363173)
@@ -1279,8 +1279,8 @@ ipfw_config_pipe(int ac, char **av)
struct dn_profile *pf = NULL;
struct ipfw_flow_id *mask = NULL;
 #ifdef NEW_AQM
-   struct dn_extra_parms *aqm_extra;
-   struct dn_extra_parms *sch_extra;
+   struct dn_extra_parms *aqm_extra = NULL;
+   struct dn_extra_parms *sch_extra = NULL;
int lmax_extra;
 #endif


Modified: head/sbin/ipfw/ipfw2.c
==
--- head/sbin/ipfw/ipfw2.c  Tue Jul 14 05:02:18 2020(r363172)
+++ head/sbin/ipfw/ipfw2.c  Tue Jul 14 05:07:16 2020(r363173)
@@ -1618,6 +1618,9 @@ print_instruction(struct buf_pr *bp, const struct form
case O_TCPWIN:
s = "tcpwin";
break;
+   default:
+   s = "";
+   break;
}
bprintf(bp, " %s %u", s, cmd->arg1);
} else
@@ -4003,7 +4006,7 @@ chkarg:
struct addrinfo *res;
char *s, *end;
int family;
-   u_short port_number;
+   u_short port_number = 0;
 
NEED1("missing forward address[:port]");
 
@@ -5600,7 +5603,7 @@ ifinfo_cmp(const void *a, const void *b)
 static void
 ipfw_list_tifaces(void)
 {
-   ipfw_obj_lheader *olh;
+   ipfw_obj_lheader *olh = NULL;
ipfw_iface_info *info;
uint32_t i;
int error;
@@ -5608,7 +5611,6 @@ ipfw_list_tifaces(void)
if ((error = ipfw_get_tracked_ifaces(&olh)) != 0)
err(EX_OSERR, "Unable to request ipfw tracked interface list");
 
-
qsort(olh + 1, olh->count, olh->objsize, ifinfo_cmp);
 
info = (ipfw_iface_info *)(olh + 1);
@@ -5625,7 +5627,3 @@ ipfw_list_tifaces(void)
 
free(olh);
 }
-
-
-
-

Modified: head/sbin/ipfw/nat64lsn.c
==
--- head/sbin/ipfw/nat64lsn.c   Tue Jul 14 05:02:18 2020(r363172)
+++ head/sbin/ipfw/nat64lsn.c   Tue Jul 14 05:07:16 2020(r363173)
@@ -99,6 +99,7 @@ nat64lsn_print_states(void *buf)
stg = (ipfw_nat64lsn_stg_v1 *)(od + 1);
sz = od->head.length - sizeof(*od);
next_idx = 0;
+   proto = NULL;
while (sz > 0 && next_idx != 0xFF) {
next_idx = stg->next.index;
sz -= sizeof(*stg);

Modified: head/sbin/ipfw/tables.c
==
--- head/sbin/ipfw/tables.c Tue Jul 14 05:02:18 2020(r363172)
+++ head/sbin/ipfw/tables.c Tue Jul 14 05:07:16 2020(r363173)
@@ -847,7 +847,7 @@ table_show_info(ipfw_xtable_info *i, void *arg)
 static int
 table_show_one(ipfw_xtable_info *i, void *arg)
 {
-   ipfw_obj_header *oh;
+   ipfw_obj_header *oh = NULL;
int error;
int is_all;
 
@@ -1179,7 +1179,7 @@ tentry_fill_key_type(char *arg, ipfw_obj_tentry *tentr
struct servent *sent;
int masklen;
 
-   masklen = 0;
+   mask = masklen = 0;
af = 0;
paddr = (struct in6_addr *)&tentry->k;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r363172 - head/contrib/bc/src

2020-07-13 Thread Adrian Chadd
Author: adrian
Date: Tue Jul 14 05:02:18 2020
New Revision: 363172
URL: https://svnweb.freebsd.org/changeset/base/363172

Log:
  [bc] Fix a "maybe uninitialized" compiler warning under mips-gcc-6.3.0.
  
  I guess this didn't like the case statements.. ? But this does quieten
  the compiler error.

Modified:
  head/contrib/bc/src/program.c

Modified: head/contrib/bc/src/program.c
==
--- head/contrib/bc/src/program.c   Tue Jul 14 05:00:08 2020
(r363171)
+++ head/contrib/bc/src/program.c   Tue Jul 14 05:02:18 2020
(r363172)
@@ -180,7 +180,7 @@ static inline BcVec* bc_program_vec(const BcProgram *p
 
 static BcNum* bc_program_num(BcProgram *p, BcResult *r) {
 
-   BcNum *n;
+   BcNum *n = NULL;
 
switch (r->t) {
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r363171 - head/contrib/flex/src

2020-07-13 Thread Adrian Chadd
Author: adrian
Date: Tue Jul 14 05:00:08 2020
New Revision: 363171
URL: https://svnweb.freebsd.org/changeset/base/363171

Log:
  [flex] Fix compilation issue under mips-gcc-6.4
  
  This was triggering a pointer-losing-constness error.

Modified:
  head/contrib/flex/src/main.c

Modified: head/contrib/flex/src/main.c
==
--- head/contrib/flex/src/main.cTue Jul 14 01:54:24 2020
(r363170)
+++ head/contrib/flex/src/main.cTue Jul 14 05:00:08 2020
(r363171)
@@ -342,7 +342,7 @@ void check_options (void)
 /* Setup the filter chain. */
 output_chain = filter_create_int(NULL, filter_tee_header, headerfilename);
 if ( !(m4 = getenv("M4"))) {
-   char *slash;
+   const char *slash;
m4 = M4;
if ((slash = strrchr(M4, '/')) != NULL) {
m4 = slash+1;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362816 - head/sys/net80211

2020-06-30 Thread Adrian Chadd
Author: adrian
Date: Wed Jul  1 00:24:55 2020
New Revision: 362816
URL: https://svnweb.freebsd.org/changeset/base/362816

Log:
  [net80211] Commit files missing in the previous commit
  
  These belong to my previous commit, but apparently I typed ieee80211_vhf.[ch]
  and forgot ht.h.  Le oops.

Modified:
  head/sys/net80211/ieee80211_ht.h
  head/sys/net80211/ieee80211_vht.c
  head/sys/net80211/ieee80211_vht.h

Modified: head/sys/net80211/ieee80211_ht.h
==
--- head/sys/net80211/ieee80211_ht.hWed Jul  1 00:23:49 2020
(r362815)
+++ head/sys/net80211/ieee80211_ht.hWed Jul  1 00:24:55 2020
(r362816)
@@ -210,8 +210,8 @@ struct ieee80211_channel *ieee80211_ht_adjust_channel(
 void   ieee80211_ht_wds_init(struct ieee80211_node *);
 void   ieee80211_ht_node_join(struct ieee80211_node *);
 void   ieee80211_ht_node_leave(struct ieee80211_node *);
-void   ieee80211_htprot_update(struct ieee80211com *, int protmode);
-void   ieee80211_ht_timeout(struct ieee80211com *);
+void   ieee80211_htprot_update(struct ieee80211vap *, int protmode);
+void   ieee80211_ht_timeout(struct ieee80211vap *);
 void   ieee80211_parse_htcap(struct ieee80211_node *, const uint8_t *);
 void   ieee80211_parse_htinfo(struct ieee80211_node *, const uint8_t *);
 void   ieee80211_ht_updateparams(struct ieee80211_node *, const uint8_t *,
@@ -241,5 +241,6 @@ voidieee80211_ampdu_rx_stop_ext(struct 
ieee80211_node
 intieee80211_ampdu_tx_request_ext(struct ieee80211_node *ni, int tid);
 intieee80211_ampdu_tx_request_active_ext(struct ieee80211_node *ni,
int tid, int status);
+void   ieee80211_htinfo_notify(struct ieee80211vap *vap);
 
 #endif /* _NET80211_IEEE80211_HT_H_ */

Modified: head/sys/net80211/ieee80211_vht.c
==
--- head/sys/net80211/ieee80211_vht.c   Wed Jul  1 00:23:49 2020
(r362815)
+++ head/sys/net80211/ieee80211_vht.c   Wed Jul  1 00:24:55 2020
(r362816)
@@ -312,7 +312,7 @@ ieee80211_setup_vht_rates(struct ieee80211_node *ni,
 }
 
 void
-ieee80211_vht_timeout(struct ieee80211com *ic)
+ieee80211_vht_timeout(struct ieee80211vap *vap)
 {
 }
 

Modified: head/sys/net80211/ieee80211_vht.h
==
--- head/sys/net80211/ieee80211_vht.h   Wed Jul  1 00:23:49 2020
(r362815)
+++ head/sys/net80211/ieee80211_vht.h   Wed Jul  1 00:24:55 2020
(r362816)
@@ -45,7 +45,7 @@ int   ieee80211_vht_updateparams(struct ieee80211_node *
 void   ieee80211_setup_vht_rates(struct ieee80211_node *,
const uint8_t *, const uint8_t *);
 
-void   ieee80211_vht_timeout(struct ieee80211com *ic);
+void   ieee80211_vht_timeout(struct ieee80211vap *vap);
 
 void   ieee80211_vht_node_join(struct ieee80211_node *ni);
 void   ieee80211_vht_node_leave(struct ieee80211_node *ni);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362815 - head/sys/net80211

2020-06-30 Thread Adrian Chadd
Author: adrian
Date: Wed Jul  1 00:23:49 2020
New Revision: 362815
URL: https://svnweb.freebsd.org/changeset/base/362815

Log:
  [net80211] Migrate HT/legacy protection mode and preamble calculation to 
per-VAP flags
  
  The later firmware devices (including iwn!) support multiple configuration
  contexts for a lot of things, leaving it up to the firmware to decide
  which channel and vap is active.  This allows for things like off-channel
  p2p sta/ap operation and other weird things.
  
  However, net80211 is still focused on a "net80211 drives all" when it comes 
to driving
  the NIC, and as part of this history a lot of these options are global and 
not per-VAP.
  This is fine when net80211 drives things and all VAPs share a single channel 
- these
  parameters importantly really reflect the state of the channel! - but it will 
increasingly
  be not fine when we start supporting more weird configurations and more 
recent NICs.
  Yeah, recent like iwn/iwm.
  
  Anyway - so, migrate all of the HT protection, legacy protection and preamble
  stuff to be per-VAP.  The global flags are still there; they're now calculated
  in a deferred taskqueue that mirrors the old behaviour.  Firmware based 
drivers
  which have per-VAP configuration of these parameters can now just listen to 
the
  per-VAP options.
  
  What do I mean by per-channel? Well, the above configuration parameters really
  are about interoperation with other devices on the same channel. Eg, HT 
protection
  mode will flip to legacy/mixed if it hears ANY BSS that supports non-HT 
stations or
  indicates it has non-HT stations associated.  So, these flags really should be
  per-channel rather than per-VAP, and then for things like "do i need short 
preamble
  or long preamble?" turn into a "do I need it for this current operating 
channel".
  Then any VAP using it can query the channel that it's on, reflecting the real
  required state.
  
  This patch does none of the above paragraph just yet.
  
  I'm also cheating a bit - I'm currently not using separate taskqueues for
  the beacon updates and the per-VAP configuration updates.  I can always 
further
  split it later if I need to but I didn't think it was SUPER important here.
  
  So:
  
  * Create vap taskqueue entries for ERP/protection, HT protection and 
short/long
preamble;
  * Migrate the HT station count, short/long slot station count, etc - into 
per-VAP
variables rather than global;
  * Fix a bug with my WME work from a while ago which made it per-VAP - do the 
WME
beacon update /after/ the WME update taskqueue runs, not before;
  * Any time the HT protmode configuration changes or the ERP protection mode
config changes - schedule the task, which will call the driver without the
net80211 lock held and all correctly serialised;
  * Use the global flags for beacon IEs and VAP flags for probe responses and
other IE situations.
  
  The primary consumer of this is ath10k.  iwn could use it when sending RXON,
  but we don't support IBSS or AP modes on it yet, and I'm not yet sure whether
  it's required in STA mode (ie whether the firmware parses beacons to change
  protection mode or whether we need to.)
  
  Tested:
  
  * AR9280, STA/AP
  * AR9380, DWDS STA+STA/AP
  * ath10k work, STA/AP
  * Intel 6235, STA
  * Various rtwn / run NICs, DWDS STA and STA configurations

Modified:
  head/sys/net80211/ieee80211_ddb.c
  head/sys/net80211/ieee80211_hostap.c
  head/sys/net80211/ieee80211_ht.c
  head/sys/net80211/ieee80211_ioctl.c
  head/sys/net80211/ieee80211_node.c
  head/sys/net80211/ieee80211_node.h
  head/sys/net80211/ieee80211_output.c
  head/sys/net80211/ieee80211_power.c
  head/sys/net80211/ieee80211_proto.c
  head/sys/net80211/ieee80211_proto.h
  head/sys/net80211/ieee80211_sta.c
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/net80211/ieee80211_ddb.c
==
--- head/sys/net80211/ieee80211_ddb.c   Tue Jun 30 22:01:21 2020
(r362814)
+++ head/sys/net80211/ieee80211_ddb.c   Wed Jul  1 00:23:49 2020
(r362815)
@@ -483,6 +483,17 @@ _db_show_vap(const struct ieee80211vap *vap, int showm
if (vap->iv_tdma != NULL)
_db_show_tdma("\t", vap->iv_tdma, showprocs);
 #endif /* IEEE80211_SUPPORT_TDMA */
+
+   db_printf("\tsta_assoc %u", vap->iv_sta_assoc);
+   db_printf(" ht_sta_assoc %u", vap->iv_ht_sta_assoc);
+   db_printf(" ht40_sta_assoc %u", vap->iv_ht40_sta_assoc);
+   db_printf("\n");
+   db_printf(" nonerpsta %u", vap->iv_nonerpsta);
+   db_printf(" longslotsta %u", vap->iv_longslotsta);
+   db_printf(" lastnonerp %d", vap->iv_lastnonerp);
+   db_printf(" lastnonht %d", vap->iv_lastnonht);
+   db_printf("\n");
+
if (showprocs) {
DB_PRINTSYM("\t", "iv_key_alloc", vap->iv_key_alloc);
DB_PRINTSYM("\t", "iv_key_delete", vap->iv_key_delete);
@@ -608,17 +619,8 @@ _db_show_com(cons

svn commit: r362718 - head/usr.sbin/fifolog/lib

2020-06-27 Thread Adrian Chadd
Author: adrian
Date: Sun Jun 28 06:52:39 2020
New Revision: 362718
URL: https://svnweb.freebsd.org/changeset/base/362718

Log:
  [fifolog] wrap the recno when we hit the end of the provided file size.
  
  Without this the log just keeps growing to infinity.
  
  Reviewed by:  phk
  Differential Revision:https://reviews.freebsd.org/D25478

Modified:
  head/usr.sbin/fifolog/lib/fifolog_write_poll.c

Modified: head/usr.sbin/fifolog/lib/fifolog_write_poll.c
==
--- head/usr.sbin/fifolog/lib/fifolog_write_poll.c  Sun Jun 28 04:08:42 
2020(r362717)
+++ head/usr.sbin/fifolog/lib/fifolog_write_poll.c  Sun Jun 28 06:52:39 
2020(r362718)
@@ -239,6 +239,14 @@ fifolog_write_output(struct fifolog_writer *f, int fl,
 */
f->seq++;
f->recno++;
+
+   /*
+* Ensure we wrap recno once we hit the file size (in records.)
+*/
+   if (f->recno >= f->ff->logsize)
+   /* recno 0 is header; skip */
+   f->recno = 1;
+
f->flag = 0;
 
memset(f->obuf, 0, f->obufsize);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362671 - in head/sys/dev/ath/ath_hal: ar5212 ar5416

2020-06-26 Thread Adrian Chadd
Author: adrian
Date: Sat Jun 27 02:59:51 2020
New Revision: 362671
URL: https://svnweb.freebsd.org/changeset/base/362671

Log:
  [ath_hal] Add KeyMiss for AR5212/AR5416 series chips.
  
  This is a flag from the MAC that says the received packet didn't match
  a keycache slot.  This isn't technically a problem as WEP keys don't
  match keycache slots (they're "global" keys), but it could be useful
  for tracking down CCMP decryption failures.
  
  Right now it's a no-op - it mirrors what the AR9300 HAL does and it
  just increments a counter.  But, hey, maybe one day I'll use it for
  diagnosing keycache/CCMP decrypt issues.

Modified:
  head/sys/dev/ath/ath_hal/ar5212/ar5212_recv.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_recv.c
==
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_recv.c   Sat Jun 27 02:31:39 
2020(r362670)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_recv.c   Sat Jun 27 02:59:51 
2020(r362671)
@@ -265,7 +265,6 @@ ar5212ProcRxDesc(struct ath_hal *ah, struct ath_desc *
rs->rs_datalen = ads->ds_rxstatus0 & AR_DataLen;
rs->rs_tstamp = MS(ads->ds_rxstatus1, AR_RcvTimestamp);
rs->rs_status = 0;
-   /* XXX what about KeyCacheMiss? */
rs->rs_rssi = MS(ads->ds_rxstatus0, AR_RcvSigStrength);
/* discard invalid h/w rssi data */
if (rs->rs_rssi == -128)
@@ -274,6 +273,8 @@ ar5212ProcRxDesc(struct ath_hal *ah, struct ath_desc *
rs->rs_keyix = MS(ads->ds_rxstatus1, AR_KeyIdx);
else
rs->rs_keyix = HAL_RXKEYIX_INVALID;
+   if (ads->ds_rxstatus1 & AR_KeyCacheMiss)
+   rs->rs_status |= HAL_RXERR_KEYMISS;
/* NB: caller expected to do rate table mapping */
rs->rs_rate = MS(ads->ds_rxstatus0, AR_RcvRate);
rs->rs_antenna  = MS(ads->ds_rxstatus0, AR_RcvAntenna);

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c   Sat Jun 27 02:31:39 
2020(r362670)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c   Sat Jun 27 02:59:51 
2020(r362671)
@@ -183,8 +183,6 @@ ar5416ProcRxDesc(struct ath_hal *ah, struct ath_desc *
rs->rs_datalen = ads->ds_rxstatus1 & AR_DataLen;
rs->rs_tstamp =  ads->AR_RcvTimestamp;
 
-   /* XXX what about KeyCacheMiss? */
-
rs->rs_rssi = MS(ads->ds_rxstatus4, AR_RxRSSICombined);
rs->rs_rssi_ctl[0] = MS(ads->ds_rxstatus0, AR_RxRSSIAnt00);
rs->rs_rssi_ctl[1] = MS(ads->ds_rxstatus0, AR_RxRSSIAnt01);
@@ -276,6 +274,9 @@ ar5416ProcRxDesc(struct ath_hal *ah, struct ath_desc *
else if (ads->ds_rxstatus8 & AR_MichaelErr)
rs->rs_status |= HAL_RXERR_MIC;
}
+
+   if (ads->ds_rxstatus8 & AR_KeyMiss)
+   rs->rs_status |= HAL_RXERR_KEYMISS;
 
return HAL_OK;
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362257 - head/share/man/man4

2020-06-16 Thread Adrian Chadd
Author: adrian
Date: Wed Jun 17 03:16:20 2020
New Revision: 362257
URL: https://svnweb.freebsd.org/changeset/base/362257

Log:
  [ath] Mention DWDS, expresscard and minipcie.
  
  I use all of these..

Modified:
  head/share/man/man4/ath.4

Modified: head/share/man/man4/ath.4
==
--- head/share/man/man4/ath.4   Wed Jun 17 03:12:43 2020(r362256)
+++ head/share/man/man4/ath.4   Wed Jun 17 03:16:20 2020(r362257)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"/
-.Dd January 25, 2019
+.Dd June 16, 2020
 .Dt ATH 4
 .Os
 .Sh NAME
@@ -59,10 +59,10 @@ The
 driver provides support for wireless network adapters based on
 the Atheros AR5210, AR5211, AR5212, AR5416 and AR9300 programming APIs.
 These APIs are used by a wide variety of chips; most all chips with
-a PCI and/or CardBus interface are supported.
+a PCI, PCIe and/or CardBus interface are supported.
 .Pp
 Supported features include 802.11 and 802.3 frames, power management, BSS,
-IBSS, MBSS, TDMA, and host-based access point operation modes.
+IBSS, MBSS, WDS/DWDS TDMA, and host-based access point operation modes.
 All host/device interaction is via DMA.
 .Pp
 Please note that from FreeBSD-9.0, the
@@ -147,12 +147,13 @@ For more information on configuring this device, see
 .Pp
 Devices supported by the
 .Nm
-driver come in either Cardbus or mini-PCI packages.
-Wireless cards in Cardbus slots may be inserted and ejected on the fly.
+driver come in Cardbus, ExpressCard, Mini-PCI and Mini-PCIe packages.
+Wireless cards in Cardbus and ExpressCard slots may be inserted and
+ejected on the fly.
 .Sh HARDWARE
 The
 .Nm
-driver supports all Atheros Cardbus and PCI cards,
+driver supports all Atheros Cardbus, ExpressCard, PCI and PCIe cards,
 except those that are based on the AR5005VL chipset.
 .Sh EXAMPLES
 Join a specific BSS network with WEP encryption:
@@ -292,8 +293,7 @@ device driver first appeared in
 Revision A1 of the D-LINK DWL-G520 and DWL-G650 are based on an
 Intersil PrismGT chip and are not supported by this driver.
 .Sh BUGS
-The driver does not fully enable power-save operation of the chip
-in station mode; consequently power use is suboptimal (e.g. on a laptop).
+The driver does supports optional station mode power-save operation.
 .Pp
 The AR5210 can only do WEP in hardware; consequently hardware assisted WEP
 is disabled in order to allow software implementations of TKIP and CCMP to
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362256 - head/share/man/man4

2020-06-16 Thread Adrian Chadd
Author: adrian
Date: Wed Jun 17 03:12:43 2020
New Revision: 362256
URL: https://svnweb.freebsd.org/changeset/base/362256

Log:
  [run] mention that some 11n functionality is now available.
  
  A-MPDU, short-gi and 40MHz mode is currently not supported, but hey,
  it supports enough 11n to be useful.

Modified:
  head/share/man/man4/run.4

Modified: head/share/man/man4/run.4
==
--- head/share/man/man4/run.4   Wed Jun 17 01:11:47 2020(r362255)
+++ head/share/man/man4/run.4   Wed Jun 17 03:12:43 2020(r362256)
@@ -16,7 +16,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 8, 2018
+.Dd June 16, 2020
 .Dt RUN 4
 .Os
 .Sh NAME
@@ -251,5 +251,5 @@ driver was written by
 .Sh CAVEATS
 The
 .Nm
-driver does not support any of the 802.11n capabilities offered by the
+driver supports some of the 11n capabilities found in the
 RT2800, RT3000 and RT3900 chipsets.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362216 - head/sbin/ifconfig

2020-06-15 Thread Adrian Chadd
Author: adrian
Date: Tue Jun 16 04:17:08 2020
New Revision: 362216
URL: https://svnweb.freebsd.org/changeset/base/362216

Log:
  [ifconfig] add UAPSD and LPDC flags
  
  * Add UAPSD and LDPC flags
  * expand the FLAGS section; it's kinda grown since I started hacking
on net80211..

Modified:
  head/sbin/ifconfig/ifieee80211.c

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cTue Jun 16 02:35:30 2020
(r362215)
+++ head/sbin/ifconfig/ifieee80211.cTue Jun 16 04:17:08 2020
(r362216)
@@ -125,6 +125,8 @@
 #defineIEEE80211_NODE_AMSDU_RX 0x04/* AMSDU rx enabled */
 #defineIEEE80211_NODE_AMSDU_TX 0x08/* AMSDU tx enabled */
 #defineIEEE80211_NODE_VHT  0x10/* VHT enabled */
+#defineIEEE80211_NODE_LDPC 0x20/* LDPC enabled */
+#defineIEEE80211_NODE_UAPSD0x40/* UAPSD enabled */
 #endif
 
 #defineMAXCHAN 1536/* max 1.5K channels */
@@ -2637,6 +2639,10 @@ getflags(int flags)
*cp++ = 't';
if (flags & IEEE80211_NODE_AMSDU_RX)
*cp++ = 'r';
+   if (flags & IEEE80211_NODE_UAPSD)
+   *cp++ = 'U';
+   if (flags & IEEE80211_NODE_LDPC)
+   *cp++ = 'L';
*cp = '\0';
return flagstring;
 }
@@ -3846,8 +3852,8 @@ list_stations(int s)
, "TXSEQ"
, "RXSEQ"
);
-   else 
-   printf("%-17.17s %4s %4s %4s %4s %4s %6s %6s %4s %-7s\n"
+   else
+   printf("%-17.17s %4s %4s %4s %4s %4s %6s %6s %4s %-12s\n"
, "ADDR"
, "AID"
, "CHAN"
@@ -3881,8 +3887,8 @@ list_stations(int s)
, gettxseq(si)
, getrxseq(si)
);
-   else 
-   printf("%s %4u %4d %3dM %4.1f %4d %6d %6d %-4.4s %-7.7s"
+   else
+   printf("%s %4u %4d %3dM %4.1f %4d %6d %6d %-4.4s 
%-12.12s"
, ether_ntoa((const struct ether_addr*)
si->isi_macaddr)
, IEEE80211_AID(si->isi_associd)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362213 - head/sys/dev/usb/wlan

2020-06-15 Thread Adrian Chadd
Author: adrian
Date: Tue Jun 16 01:11:40 2020
New Revision: 362213
URL: https://svnweb.freebsd.org/changeset/base/362213

Log:
  [rsu] Update wme ie API use.
  
  Whoops, forgot to land this one too!

Modified:
  head/sys/dev/usb/wlan/if_rsu.c

Modified: head/sys/dev/usb/wlan/if_rsu.c
==
--- head/sys/dev/usb/wlan/if_rsu.c  Tue Jun 16 00:28:45 2020
(r362212)
+++ head/sys/dev/usb/wlan/if_rsu.c  Tue Jun 16 01:11:40 2020
(r362213)
@@ -1982,7 +1982,7 @@ rsu_join_bss(struct rsu_softc *sc, struct ieee80211_no
frm = ieee80211_add_qos(frm, ni);
if ((ic->ic_flags & IEEE80211_F_WME) &&
(ni->ni_ies.wme_ie != NULL))
-   frm = ieee80211_add_wme_info(frm, &ic->ic_wme);
+   frm = ieee80211_add_wme_info(frm, &ic->ic_wme, ni);
if (ni->ni_flags & IEEE80211_NODE_HT) {
frm = ieee80211_add_htcap(frm, ni);
frm = ieee80211_add_htinfo(frm, ni);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362212 - head/sys/net80211

2020-06-15 Thread Adrian Chadd
Author: adrian
Date: Tue Jun 16 00:28:45 2020
New Revision: 362212
URL: https://svnweb.freebsd.org/changeset/base/362212

Log:
  [net80211] Add missing commit to previous-1 uapsd commit.
  
  Whoops; somehow my big commit line didn't include this..  cue the tree 
breakage emails.

Modified:
  head/sys/net80211/ieee80211_proto.h

Modified: head/sys/net80211/ieee80211_proto.h
==
--- head/sys/net80211/ieee80211_proto.h Tue Jun 16 00:28:08 2020
(r362211)
+++ head/sys/net80211/ieee80211_proto.h Tue Jun 16 00:28:45 2020
(r362212)
@@ -152,7 +152,8 @@ uint8_t *ieee80211_add_qos(uint8_t *, const struct iee
 uint16_t ieee80211_getcapinfo(struct ieee80211vap *,
struct ieee80211_channel *);
 struct ieee80211_wme_state;
-uint8_t * ieee80211_add_wme_info(uint8_t *frm, struct ieee80211_wme_state 
*wme);
+uint8_t * ieee80211_add_wme_info(uint8_t *frm, struct ieee80211_wme_state *wme,
+   struct ieee80211_node *ni);
 
 void   ieee80211_vap_reset_erp(struct ieee80211vap *);
 void   ieee80211_reset_erp(struct ieee80211com *);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362211 - head/sbin/ifconfig

2020-06-15 Thread Adrian Chadd
Author: adrian
Date: Tue Jun 16 00:28:08 2020
New Revision: 362211
URL: https://svnweb.freebsd.org/changeset/base/362211

Log:
  [net80211] Add uapsd option to ifconfig
  
  Add an enable/disable option for controlling uapsd.  I'm not yet controlling
  the individual AC configs or the service period.

Modified:
  head/sbin/ifconfig/ifieee80211.c

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cTue Jun 16 00:27:32 2020
(r362210)
+++ head/sbin/ifconfig/ifieee80211.cTue Jun 16 00:28:08 2020
(r362211)
@@ -1804,6 +1804,12 @@ set80211ldpc(const char *val, int d, int s, const stru
 set80211(s, IEEE80211_IOC_LDPC, ldpc, 0, NULL);
 }
 
+static void
+set80211uapsd(const char *val, int d, int s, const struct afswtch *rafp)
+{
+   set80211(s, IEEE80211_IOC_UAPSD, d, 0, NULL);
+}
+
 static
 DECL_CMD_FUNC(set80211ampdulimit, val, d)
 {
@@ -5288,6 +5294,16 @@ end:
break;
}
}
+   if (get80211val(s, IEEE80211_IOC_UAPSD, &val) != -1) {
+   switch (val) {
+   case 0:
+   LINE_CHECK("-uapsd");
+   break;
+   case 1:
+   LINE_CHECK("uapsd");
+   break;
+   }
+   }
}
 
if (IEEE80211_IS_CHAN_VHT(c) || verbose) {
@@ -5872,6 +5888,8 @@ static struct cmd ieee80211_cmds[] = {
DEF_CMD("-ldpctx",  -1, set80211ldpc),
DEF_CMD("ldpc", 3,  set80211ldpc),  /* NB: tx+rx */
DEF_CMD("-ldpc",-3, set80211ldpc),
+   DEF_CMD("uapsd",1,  set80211uapsd),
+   DEF_CMD("-uapsd",   0,  set80211uapsd),
DEF_CMD("puren",1,  set80211puren),
DEF_CMD("-puren",   0,  set80211puren),
DEF_CMD("doth", 1,  set80211doth),
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362210 - head/sys/net80211

2020-06-15 Thread Adrian Chadd
Author: adrian
Date: Tue Jun 16 00:27:32 2020
New Revision: 362210
URL: https://svnweb.freebsd.org/changeset/base/362210

Log:
  [net80211] Add initial U-APSD negotiation support.
  
  U-APSD (unscheduled automatic power save delivery) is a power save method
  that's a bit better than legacy PS-POLL - stations can mark frames with
  an extra flag that tells the AP to leak out more frames after it sends
  its own frames rather than needing to send a PS-POLL to get another frame
  from the AP.
  
  Now, this code just handles the negotiation bits; it doesn't actually
  implement U-APSD.  That's up to drivers, and nothing in the tree yet
  implements this.  I /may/ implement this for ath(4) if I eventually care
  enough but right now I plan on just implementing it for firmware offload
  based NICs that handle this in the NIC.
  
  I'll commit the ifconfig bit after this and I may have some follow-up
  commits as this gets used more by me in local testing.
  
  This should be a glorious no-op for everyone else.  If things change
  for anyone that isn't fixed by a complete recompile then please reach out
  to me.

Modified:
  head/sys/net80211/_ieee80211.h
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211_hostap.c
  head/sys/net80211/ieee80211_ioctl.c
  head/sys/net80211/ieee80211_ioctl.h
  head/sys/net80211/ieee80211_node.h
  head/sys/net80211/ieee80211_output.c
  head/sys/net80211/ieee80211_proto.c
  head/sys/net80211/ieee80211_sta.c
  head/sys/net80211/ieee80211_sta.h
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/net80211/_ieee80211.h
==
--- head/sys/net80211/_ieee80211.h  Mon Jun 15 22:43:46 2020
(r362209)
+++ head/sys/net80211/_ieee80211.h  Tue Jun 16 00:27:32 2020
(r362210)
@@ -488,6 +488,7 @@ struct ieee80211_mimo_info {
 #defineIEEE80211_C_MBSS0x0004  /* CAPABILITY: MBSS 
available */
 #defineIEEE80211_C_SWSLEEP 0x0008  /* CAPABILITY: do sleep 
here */
 #defineIEEE80211_C_SWAMSDUTX   0x0010  /* CAPABILITY: software 
A-MSDU TX */
+#defineIEEE80211_C_UAPSD   0x0020  /* CAPABILITY: U-APSD */
 /* 0x7c available */
 #defineIEEE80211_C_WPA10x0080  /* CAPABILITY: WPA1 
avail */
 #defineIEEE80211_C_WPA20x0100  /* CAPABILITY: WPA2 
avail */

Modified: head/sys/net80211/ieee80211.c
==
--- head/sys/net80211/ieee80211.c   Mon Jun 15 22:43:46 2020
(r362209)
+++ head/sys/net80211/ieee80211.c   Tue Jun 16 00:27:32 2020
(r362210)
@@ -616,6 +616,12 @@ ieee80211_vap_setup(struct ieee80211com *ic, struct ie
if (vap->iv_opmode == IEEE80211_M_HOSTAP &&
(vap->iv_caps & IEEE80211_C_DFS))
vap->iv_flags_ext |= IEEE80211_FEXT_DFS;
+   /* NB: only flip on U-APSD for hostap/sta for now */
+   if ((vap->iv_opmode == IEEE80211_M_STA)
+   || (vap->iv_opmode == IEEE80211_M_HOSTAP)) {
+   if (vap->iv_caps & IEEE80211_C_UAPSD)
+   vap->iv_flags_ext |= IEEE80211_FEXT_UAPSD;
+   }
 
vap->iv_des_chan = IEEE80211_CHAN_ANYC; /* any channel is ok */
vap->iv_bmissthreshold = IEEE80211_HWBMISS_DEFAULT;

Modified: head/sys/net80211/ieee80211_hostap.c
==
--- head/sys/net80211/ieee80211_hostap.cMon Jun 15 22:43:46 2020
(r362209)
+++ head/sys/net80211/ieee80211_hostap.cTue Jun 16 00:27:32 2020
(r362210)
@@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$");
 #endif
 #include 
 #include 
+#include  /* for parse_wmeie */
 
 #defineIEEE80211_RATE2MBS(r)   (((r) & IEEE80211_RATE_VAL) / 2)
 
@@ -2253,8 +2254,18 @@ hostap_recv_mgmt(struct ieee80211_node *ni, struct mbu
 * Mark node as capable of QoS.
 */
ni->ni_flags |= IEEE80211_NODE_QOS;
+   if (ieee80211_parse_wmeie(wme, wh, ni) > 0) {
+   if (ni->ni_uapsd != 0)
+   ni->ni_flags |=
+   IEEE80211_NODE_UAPSD;
+   else
+   ni->ni_flags &=
+   ~IEEE80211_NODE_UAPSD;
+   }
} else
-   ni->ni_flags &= ~IEEE80211_NODE_QOS;
+   ni->ni_flags &=
+   ~(IEEE80211_NODE_QOS |
+ IEEE80211_NODE_UAPSD);
 #ifdef IEEE80211_SUPPORT_SUPERG
if (ath != NULL) {
setie(a

svn commit: r362162 - head/sys/net80211

2020-06-13 Thread Adrian Chadd
Author: adrian
Date: Sun Jun 14 00:23:06 2020
New Revision: 362162
URL: https://svnweb.freebsd.org/changeset/base/362162

Log:
  [net80211] Treat frames without an rx status as not a decap'ed A-MSDU.
  
  Drivers for NICs which do A-MSDU decap in hardware / driver will need to
  set the rx status, so if it's missing then treat it as not a decap'ed
  A-MSDU.

Modified:
  head/sys/net80211/ieee80211_input.h

Modified: head/sys/net80211/ieee80211_input.h
==
--- head/sys/net80211/ieee80211_input.h Sun Jun 14 00:21:48 2020
(r362161)
+++ head/sys/net80211/ieee80211_input.h Sun Jun 14 00:23:06 2020
(r362162)
@@ -136,7 +136,8 @@ ishtinfooui(const uint8_t *frm)
 static __inline int
 ieee80211_check_rxseq_amsdu(const struct ieee80211_rx_stats *rxs)
 {
-
+   if (rxs == NULL)
+   return 0;
return (!! (rxs->c_pktflags & IEEE80211_RX_F_AMSDU));
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362161 - head/sys/net80211

2020-06-13 Thread Adrian Chadd
Author: adrian
Date: Sun Jun 14 00:21:48 2020
New Revision: 362161
URL: https://svnweb.freebsd.org/changeset/base/362161

Log:
  [net80211] Also convert the ddb path
  
  Whoops - this belonged in my previous commit.

Modified:
  head/sys/net80211/ieee80211_ddb.c

Modified: head/sys/net80211/ieee80211_ddb.c
==
--- head/sys/net80211/ieee80211_ddb.c   Sun Jun 14 00:15:44 2020
(r362160)
+++ head/sys/net80211/ieee80211_ddb.c   Sun Jun 14 00:21:48 2020
(r362161)
@@ -209,6 +209,7 @@ _db_show_txampdu(const char *sep, int ix, const struct
 static void
 _db_show_rxampdu(const char *sep, int ix, const struct ieee80211_rx_ampdu *rap)
 {
+   struct mbuf *m;
int i;
 
db_printf("%srxampdu[%d]: %p flags 0x%x tid %u\n",
@@ -219,10 +220,15 @@ _db_show_rxampdu(const char *sep, int ix, const struct
db_printf("%s  age %d nframes %d\n", sep,
rap->rxa_age, rap->rxa_nframes);
for (i = 0; i < IEEE80211_AGGR_BAWMAX; i++)
-   if (rap->rxa_m[i] != NULL)
-   db_printf("%s  m[%2u:%4u] %p\n", sep, i,
-   IEEE80211_SEQ_ADD(rap->rxa_start, i),
-   rap->rxa_m[i]);
+   if (mbufq_len(&rap->rxa_mq[i]) > 0) {
+   db_printf("%s  m[%2u:%4u] ", sep, i,
+   IEEE80211_SEQ_ADD(rap->rxa_start, i));
+   STAILQ_FOREACH(m, &rap->rxa_mq[i].mq_head,
+   m_stailqpkt) {
+   db_printf(" %p", m);
+   }
+   db_printf("\n");
+   }
 }
 
 static void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362157 - head/sys/net80211

2020-06-13 Thread Adrian Chadd
Author: adrian
Date: Sat Jun 13 23:35:22 2020
New Revision: 362157
URL: https://svnweb.freebsd.org/changeset/base/362157

Log:
  [net80211] Handle offloaded AMSDU in AMPDU reordering.
  
  In the 11n world, most NICs did A-MPDU receive/transmit offloading but
  not A-MSDU offloading.  So, the net80211 A-MPDU receive path would just
  receive MPDUs, do the reordering bit, pass it up to the rest of
  net80211 for crypto decap and then do A-MSDU decap before throwing ethernet
  frames up to the rest of the system.
  
  However 11ac and 11ax NICs are increasingly doing A-MSDU offload (and
  newer 11ax stuff does socket offload, but hey I don't want to scare people
  JUST yet) - so although A-MPDU reordering may be done in the OS, A-MSDUs
  look like a normal MPDU.  This means that all the MSDUs are actually
  faked into a set of MPDUs with matching 802.11 header - the sequence number,
  QoS header and any encryption verification bits (like IV) are just copied.
  
  This shows up as MASSIVE packet loss in net80211, cause after the first MPDU
  we just toss the rest.
  
  (And don't get me started about ethernet decap with A-MPDU host reordering;
  we'll have to cross that bridge for later 11ac and 11ax bits too.)
  
  Anyway, this work changes each A-MPDU reorder slot into an mbufq.
  The mbufq is treated as a whole set of frames to pass up to the stack
  and reordered/de-duped as a group.  The last frame in the reorder list
  is checked to see if it's an A-MSDU final frame so any duplicates are
  correctly tossed rather than double-received.  Other than that, the
  rest of the logic is unchanged.
  
  The previous commit did a small subset of this - if there wasn't any 
reordering
  going on then it'd accept the A-MSDUs.  This is the rest of the needed work.
  
  This is a no-op for 11n NICs doing A-MPDU reordering but needing software
  A-MSDU decap - they aren't tagged as A-MSDU and so any subsequent
  frames added to the reorder slot are tossed.
  
  Tested:
  
  * QCA9880 (ath10k/athp) - STA/AP mode;
  * RT3593 (if_rsu) - 11n STA+DWDS mode (I'm committing through it rn);
  * QCA9380 (if_ath) - STA/AP mode.

Modified:
  head/sys/net80211/ieee80211_ht.c
  head/sys/net80211/ieee80211_ht.h

Modified: head/sys/net80211/ieee80211_ht.c
==
--- head/sys/net80211/ieee80211_ht.cSat Jun 13 22:20:02 2020
(r362156)
+++ head/sys/net80211/ieee80211_ht.cSat Jun 13 23:35:22 2020
(r362157)
@@ -517,6 +517,22 @@ ieee80211_decap_amsdu(struct ieee80211_node *ni, struc
return m;   /* last delivered by caller */
 }
 
+static void
+ampdu_rx_purge_slot(struct ieee80211_rx_ampdu *rap, int i)
+{
+   struct mbuf *m;
+
+   /* Walk the queue, removing frames as appropriate */
+   while (mbufq_len(&rap->rxa_mq[i]) != 0) {
+   m = mbufq_dequeue(&rap->rxa_mq[i]);
+   if (m == NULL)
+   break;
+   rap->rxa_qbytes -= m->m_pkthdr.len;
+   rap->rxa_qframes--;
+   m_freem(m);
+   }
+}
+
 /*
  * Add the given frame to the current RX reorder slot.
  *
@@ -528,16 +544,94 @@ static int
 ampdu_rx_add_slot(struct ieee80211_rx_ampdu *rap, int off, int tid,
 ieee80211_seq rxseq,
 struct ieee80211_node *ni,
-struct mbuf *m)
+struct mbuf *m,
+const struct ieee80211_rx_stats *rxs)
 {
+   const struct ieee80211_rx_stats *rxs_final = NULL;
struct ieee80211vap *vap = ni->ni_vap;
+   int toss_dup;
+#definePROCESS 0   /* caller should process frame */
+#defineCONSUMED1   /* frame consumed, caller does nothing 
*/
 
-   if (rap->rxa_m[off] == NULL) {
-   rap->rxa_m[off] = m;
+   /*
+* Figure out if this is a duplicate frame for the given slot.
+*
+* We're assuming that the driver will hand us all the frames
+* for a given AMSDU decap pass and if we get /a/ frame
+* for an AMSDU decap then we'll get all of them.
+*
+* The tricksy bit is that we don't know when the /end/ of
+* the decap pass is, because we aren't tracking state here
+* per-slot to know that we've finished receiving the frame list.
+*
+* The driver sets RX_F_AMSDU and RX_F_AMSDU_MORE to tell us
+* what's going on; so ideally we'd just check the frame at the
+* end of the reassembly slot to see if its F_AMSDU w/ no F_AMSDU_MORE -
+* that means we've received the whole AMSDU decap pass.
+*/
+
+   /*
+* Get the rxs of the final mbuf in the slot, if one exists.
+*/
+   if (mbufq_len(&rap->rxa_mq[off]) != 0) {
+   rxs_final = 
ieee80211_get_rx_params_ptr(mbufq_last(&rap->rxa_mq[off]));
+   }
+
+   /* Default to tossing the duplicate frame */
+   toss_dup = 1;
+
+   /*
+* Check to see if the final frame ha

svn commit: r362156 - head/sys/net80211

2020-06-13 Thread Adrian Chadd
Author: adrian
Date: Sat Jun 13 22:20:02 2020
New Revision: 362156
URL: https://svnweb.freebsd.org/changeset/base/362156

Log:
  [net80211] separate out node allocation and node initialisation.
  
  This is a new, optional (for now!) method that drivers can use to separate
  node allocation and node initialisation.  Right now they're the same, and
  drivers that need to do node allocation via firmware commands need to sleep
  and thus they need to defer node allocation into an internal taskqueue.
  
  Right now they're just separate but not deferred.  Later on if I get the time
  we'll start deferring the node and key related operations but that requires
  making a bunch of other stuff (notably things that generate frames!) also
  async/deferred.
  
  Tested:
  
  * RT3593, STA/DWDS mode
  * AR9380, STA/AP modes
  * QCA9880 (athp) - STA/AP modes

Modified:
  head/sys/net80211/ieee80211_node.c
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/net80211/ieee80211_node.c
==
--- head/sys/net80211/ieee80211_node.c  Sat Jun 13 21:23:26 2020
(r362155)
+++ head/sys/net80211/ieee80211_node.c  Sat Jun 13 22:20:02 2020
(r362156)
@@ -80,6 +80,7 @@ static int ieee80211_sta_join1(struct ieee80211_node *
 
 static struct ieee80211_node *node_alloc(struct ieee80211vap *,
const uint8_t [IEEE80211_ADDR_LEN]);
+static int node_init(struct ieee80211_node *);
 static void node_cleanup(struct ieee80211_node *);
 static void node_free(struct ieee80211_node *);
 static void node_age(struct ieee80211_node *);
@@ -116,6 +117,7 @@ ieee80211_node_attach(struct ieee80211com *ic)
ieee80211_node_timeout, ic);
 
ic->ic_node_alloc = node_alloc;
+   ic->ic_node_init = node_init;
ic->ic_node_free = node_free;
ic->ic_node_cleanup = node_cleanup;
ic->ic_node_age = node_age;
@@ -1074,6 +1076,12 @@ node_alloc(struct ieee80211vap *vap, const uint8_t mac
return ni;
 }
 
+static int
+node_init(struct ieee80211_node *ni)
+{
+   return 0;
+}
+
 /*
  * Initialize an ie blob with the specified data.  If previous
  * data exists re-use the data block.  As a side effect we clear
@@ -1414,6 +1422,15 @@ ieee80211_alloc_node(struct ieee80211_node_table *nt,
ni->ni_ic = ic;
IEEE80211_NODE_UNLOCK(nt);
 
+   /* handle failure; free node state */
+   if (ic->ic_node_init(ni) != 0) {
+   vap->iv_stats.is_rx_nodealloc++;
+   ieee80211_psq_cleanup(&ni->ni_psq);
+   ieee80211_ratectl_node_deinit(ni);
+   _ieee80211_free_node(ni);
+   return NULL;
+   }
+
IEEE80211_NOTE(vap, IEEE80211_MSG_INACT, ni,
"%s: inact_reload %u", __func__, ni->ni_inact_reload);
 
@@ -1456,6 +1473,16 @@ ieee80211_tmp_node(struct ieee80211vap *vap,
ieee80211_psq_init(&ni->ni_psq, "unknown");
 
ieee80211_ratectl_node_init(ni);
+
+   /* handle failure; free node state */
+   if (ic->ic_node_init(ni) != 0) {
+   vap->iv_stats.is_rx_nodealloc++;
+   ieee80211_psq_cleanup(&ni->ni_psq);
+   ieee80211_ratectl_node_deinit(ni);
+   _ieee80211_free_node(ni);
+   return NULL;
+   }
+
} else {
/* XXX msg */
vap->iv_stats.is_rx_nodealloc++;

Modified: head/sys/net80211/ieee80211_var.h
==
--- head/sys/net80211/ieee80211_var.h   Sat Jun 13 21:23:26 2020
(r362155)
+++ head/sys/net80211/ieee80211_var.h   Sat Jun 13 22:20:02 2020
(r362156)
@@ -310,11 +310,22 @@ struct ieee80211com {
/* TDMA update notification */
void(*ic_tdma_update)(struct ieee80211_node *,
const struct ieee80211_tdma_param *, int);
-   /* node state management */
+
+   /* Node state management */
+
+   /* Allocate a new node */
struct ieee80211_node*  (*ic_node_alloc)(struct ieee80211vap *,
const uint8_t [IEEE80211_ADDR_LEN]);
+
+   /* Driver node initialisation after net80211 setup */
+   int (*ic_node_init)(struct ieee80211_node *);
+
+   /* Driver node deallocation */
void(*ic_node_free)(struct ieee80211_node *);
+
+   /* Driver node state cleanup before deallocation */
void(*ic_node_cleanup)(struct ieee80211_node *);
+
void(*ic_node_age)(struct ieee80211_node *);
void(*ic_node_drain)(struct ieee80211_node *);
int8_t  (*ic_node_getrssi)(const struct 
ieee80211_node*);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.or

svn commit: r362085 - head/tools/tools/net80211/wlanstats

2020-06-11 Thread Adrian Chadd
Author: adrian
Date: Fri Jun 12 06:10:27 2020
New Revision: 362085
URL: https://svnweb.freebsd.org/changeset/base/362085

Log:
  [wlanstats] Add the per-node amsdu hardware decap'ed receive stats.
  
  This is useful for tracking hardware provided AMSDU frames to see
  when we're (a) seeing them, and (b) seeing the split between
  intermediary and final frames.
  
  Tested:
  
  * QCA9880 (athp) - AP mode

Modified:
  head/tools/tools/net80211/wlanstats/main.c
  head/tools/tools/net80211/wlanstats/wlanstats.c

Modified: head/tools/tools/net80211/wlanstats/main.c
==
--- head/tools/tools/net80211/wlanstats/main.c  Fri Jun 12 04:19:03 2020
(r362084)
+++ head/tools/tools/net80211/wlanstats/main.c  Fri Jun 12 06:10:27 2020
(r362085)
@@ -63,7 +63,7 @@ static struct {
   },
   {
 "amsdu",
-"input,output,amsdu_tooshort,amsdu_split,amsdu_decap,amsdu_encap,rssi,rate"
+
"input,output,amsdu_tooshort,amsdu_split,amsdu_decap,amsdu_encap,rx_amsdu_more,rx_amsdu_more_end,rssi,rate"
   },
 };
 

Modified: head/tools/tools/net80211/wlanstats/wlanstats.c
==
--- head/tools/tools/net80211/wlanstats/wlanstats.c Fri Jun 12 04:19:03 
2020(r362084)
+++ head/tools/tools/net80211/wlanstats/wlanstats.c Fri Jun 12 06:10:27 
2020(r362085)
@@ -276,7 +276,11 @@ static const struct fmt wlanstats[] = {
{ 8,  "amsdu_decap","decap","A-MSDU frames received" },
 #defineS_AMSDU_ENCAP   AFTER(S_AMSDU_DECAP)
{ 8,  "amsdu_encap","encap","A-MSDU frames transmitted" },
-#defineS_AMPDU_REORDER AFTER(S_AMSDU_ENCAP)
+#defineS_AMSDU_RX_MORE AFTER(S_AMSDU_ENCAP)
+   { 13,  "rx_amsdu_more", "rx_amsdu_more","A-MSDU HW intermediary 
decap'ed received" },
+#defineS_AMSDU_RX_MORE_END AFTER(S_AMSDU_RX_MORE)
+   { 17,  "rx_amsdu_more_end", "rx_amsdu_more_end","A-MSDU HW end 
decap'ed received" },
+#defineS_AMPDU_REORDER AFTER(S_AMSDU_RX_MORE_END)
{ 8,  "ampdu_reorder",  "reorder","A-MPDU frames held in reorder q" },
 #defineS_AMPDU_FLUSH   AFTER(S_AMPDU_REORDER)
{ 8,  "ampdu_flush","flush","A-MPDU frames sent up from 
reorder q" },
@@ -778,6 +782,8 @@ wlan_get_curstat(struct bsdstat *sf, int s, char b[], 
case S_AMSDU_SPLIT: STAT(amsdu_split);
case S_AMSDU_DECAP: STAT(amsdu_decap);
case S_AMSDU_ENCAP: STAT(amsdu_encap);
+   case S_AMSDU_RX_MORE:   NSTAT(rx_amsdu_more);
+   case S_AMSDU_RX_MORE_END:   NSTAT(rx_amsdu_more_end);
case S_AMPDU_REORDER:   STAT(ampdu_rx_reorder);
case S_AMPDU_FLUSH: STAT(ampdu_rx_flush);
case S_AMPDU_BARBAD:STAT(ampdu_bar_bad);
@@ -941,6 +947,8 @@ wlan_get_totstat(struct bsdstat *sf, int s, char b[], 
case S_AMSDU_SPLIT: STAT(amsdu_split);
case S_AMSDU_DECAP: STAT(amsdu_decap);
case S_AMSDU_ENCAP: STAT(amsdu_encap);
+   case S_AMSDU_RX_MORE:   NSTAT(rx_amsdu_more);
+   case S_AMSDU_RX_MORE_END:   NSTAT(rx_amsdu_more_end);
case S_AMPDU_REORDER:   STAT(ampdu_rx_reorder);
case S_AMPDU_FLUSH: STAT(ampdu_rx_flush);
case S_AMPDU_BARBAD:STAT(ampdu_bar_bad);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362084 - head/sys/net80211

2020-06-11 Thread Adrian Chadd
Author: adrian
Date: Fri Jun 12 04:19:03 2020
New Revision: 362084
URL: https://svnweb.freebsd.org/changeset/base/362084

Log:
  [net80211] First part of A-MSDU offload handling - don't bump A-MPDU 
reordering seqno
  
  When doing A-MSDU offload handling the driver is required to mark
  A-MSDUs from the same MPDU with the same sequence number.
  It then tags them as AMSDU (if it's a decap'ed A-MSDU) and AMSDU_MORE
  (saying there's more AMSDUs decapped in the same MSDU.)
  This allows encryption and sequence number offload to work right.
  
  In the A-MSDU path the sequence number check looks at the A-MSDU flags
  in the frame to see whether it's part of the same seqno and will pass them
  (ie, not increment rx_seq until the last A-MSDU is seen from the driver,
  or a new seqno shows up.0
  
  However, I did this work in the A-MSDU path but not the A-MSDU in A-MPDU path.
  For the non A-MDSU offload case the A-MPDU receive reordering will do its
  thing and then pass up the MPDU up for decap - which then will see it's
  an A-MSDU and decap each sub-frame.  But this isn't done for offloaded
  A-MSDU frames.
  
  This requires two parts:
  
  * Don't bump the RX sequence number, same as above; and
  * If frames go into the reordering buffer, they need to be added into the slot
as a set of frames rather than a single frame, so once a new seqno shows up
this slot can be marked as "full" and we can move on.
  
  This patch does the first.  The latter requires that I find and commit
  work to change rxa_m from an mbuf to an mbufq and the nhandle A-MSDU
  there.  But, the first is enough to allow the normal case (ie, no or not
  a lot of A-MPDU RX reordering) to work.
  
  This allows the athp driver (QCA9880) throughput to go from VERY low
  (like 5mbit TCP, 1/3-1/4 expected UDP throughput) to ~ 250mbit TCP
  and > 300mbit UDP on a VHT/40 channel.  TCP sucks because, well, it
  shows up as MASSIVE packet loss when all but one frame in a decap'ed
  A-MSDU stream is dropped. Le whoops.
  
  Now, where'd I put that laptop with the patch for rxa_m mbufq that
  I wrote like in 2017...
  
  Tested:
  
  * AR9380, STA/AP mode (a big no-op, no A-MSDU hardware decap);
  * if_run (RT3593), STA DWDS mode (A-MPDU / A-MSDU receive, but again
no A-MSDU hardware decap);
  * QCA9880, STA/AP mode (which is doing hardware A-MPDU/A-MSDU decap,
but no A-MPDU reordering in the firmware.)

Modified:
  head/sys/net80211/ieee80211_ht.c

Modified: head/sys/net80211/ieee80211_ht.c
==
--- head/sys/net80211/ieee80211_ht.cFri Jun 12 01:58:14 2020
(r362083)
+++ head/sys/net80211/ieee80211_ht.cFri Jun 12 04:19:03 2020
(r362084)
@@ -875,6 +875,7 @@ ieee80211_ampdu_reorder(struct ieee80211_node *ni, str
ieee80211_seq rxseq;
uint8_t tid;
int off;
+   int amsdu_more = ieee80211_check_rxseq_amsdu_more(rxs);
 
KASSERT((m->m_flags & (M_AMPDU | M_AMPDU_MPDU)) == M_AMPDU,
("!a-mpdu or already re-ordered, flags 0x%x", m->m_flags));
@@ -949,10 +950,11 @@ again:
return CONSUMED;
} else {
/*
-* In order; advance window and notify
+* In order; advance window if needed and notify
 * caller to dispatch directly.
 */
-   rap->rxa_start = IEEE80211_SEQ_INC(rxseq);
+   if (amsdu_more)
+   rap->rxa_start = IEEE80211_SEQ_INC(rxseq);
return PROCESS;
}
}
@@ -996,7 +998,8 @@ again:
rap->rxa_qframes;
ampdu_rx_flush(ni, rap);
}
-   rap->rxa_start = IEEE80211_SEQ_INC(rxseq);
+   if (amsdu_more)
+   rap->rxa_start = 
IEEE80211_SEQ_INC(rxseq);
return PROCESS;
}
} else {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362016 - head/sys/net80211

2020-06-10 Thread Adrian Chadd
Author: adrian
Date: Wed Jun 10 18:59:46 2020
New Revision: 362016
URL: https://svnweb.freebsd.org/changeset/base/362016

Log:
  [net80211] ok ok if_xname won't ever be NULL.
  
  Somewhere in net80211 if_xname is checked against NULL but it doesn't trigger
  a compiler warning, but this does.  So DTRT for FreeBSD and the other if_xname
  derefences can be converted to this function at a later time.

Modified:
  head/sys/net80211/ieee80211_freebsd.c

Modified: head/sys/net80211/ieee80211_freebsd.c
==
--- head/sys/net80211/ieee80211_freebsd.c   Wed Jun 10 18:50:46 2020
(r362015)
+++ head/sys/net80211/ieee80211_freebsd.c   Wed Jun 10 18:59:46 2020
(r362016)
@@ -1042,7 +1042,7 @@ wlan_iflladdr(void *arg __unused, struct ifnet *ifp)
 const char *
 ieee80211_get_vap_ifname(struct ieee80211vap *vap)
 {
-   if ((vap->iv_ifp == NULL) || (vap->iv_ifp->if_xname == NULL))
+   if (vap->iv_ifp == NULL)
return "(none)";
return vap->iv_ifp->if_xname;
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361886 - head/sys/dev/ath

2020-06-06 Thread Adrian Chadd
Author: adrian
Date: Sun Jun  7 05:08:44 2020
New Revision: 361886
URL: https://svnweb.freebsd.org/changeset/base/361886

Log:
  [if_ath] Don't update the beacon bits from beacon frames in hostapd mode.
  
  This logic is running the beacon receive bits in STA+AP mode on both the
  STA and AP side.  The STA side sees its beacons from the BSS fine; the
  AP side is seeing other beacons on the same channel but with the BSS
  node for some odd reason.  (I think it's a valid reason, but I currently
  forget what that valid reason is.)
  
  So, just to be cleaner about things, don't run the nexttbtt/etc bits
  at all if we're in hostap mode.  If I ever get mesh working then maybe
  I'll make sure it works right on mesh+ap and mesh+sta modes.
  
  Whilst here, log the VAP i'm being called on to make it clearer what
  is going on.  I may end up adding a VAP dprintf version of this at
  some point.
  
  Tested:
  
  * AR9380, STA (DWDS client) + hostap on the same NIC

Modified:
  head/sys/dev/ath/if_ath_rx.c

Modified: head/sys/dev/ath/if_ath_rx.c
==
--- head/sys/dev/ath/if_ath_rx.cSun Jun  7 04:57:48 2020
(r361885)
+++ head/sys/dev/ath/if_ath_rx.cSun Jun  7 05:08:44 2020
(r361886)
@@ -379,12 +379,12 @@ ath_recv_mgmt(struct ieee80211_node *ni, struct mbuf *
 * trying to sync / merge to BSSes that aren't
 * actually us.
 */
-   if (IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bss->ni_bssid)) {
+   if ((vap->iv_opmode != IEEE80211_M_HOSTAP) &&
+   IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bss->ni_bssid)) {
/* update rssi statistics for use by the hal */
/* XXX unlocked check against vap->iv_bss? */
ATH_RSSI_LPF(sc->sc_halstats.ns_avgbrssi, rssi);
 
-
tsf_beacon = ((uint64_t) le32dec(ni->ni_tstamp.data + 
4)) << 32;
tsf_beacon |= le32dec(ni->ni_tstamp.data);
 
@@ -427,8 +427,9 @@ ath_recv_mgmt(struct ieee80211_node *ni, struct mbuf *
tsf_remainder = (tsf_beacon - tsf_beacon_old) % 
tsf_intval;
}
 
-   DPRINTF(sc, ATH_DEBUG_BEACON, "%s: old_tsf=%llu (%u), 
new_tsf=%llu (%u), target_tsf=%llu (%u), delta=%lld, bmiss=%d, remainder=%d\n",
+   DPRINTF(sc, ATH_DEBUG_BEACON, "%s: %s: old_tsf=%llu 
(%u), new_tsf=%llu (%u), target_tsf=%llu (%u), delta=%lld, bmiss=%d, 
remainder=%d\n",
__func__,
+   ieee80211_get_vap_ifname(vap),
(unsigned long long) tsf_beacon_old,
(unsigned int) (tsf_beacon_old >> 10),
(unsigned long long) tsf_beacon,
@@ -439,8 +440,11 @@ ath_recv_mgmt(struct ieee80211_node *ni, struct mbuf *
tsf_delta_bmiss,
tsf_remainder);
 
-   DPRINTF(sc, ATH_DEBUG_BEACON, "%s: tsf=%llu (%u), 
nexttbtt=%llu (%u), delta=%d\n",
+   DPRINTF(sc, ATH_DEBUG_BEACON, "%s: %s: ni=%6D bssid=%6D 
tsf=%llu (%u), nexttbtt=%llu (%u), delta=%d\n",
__func__,
+   ieee80211_get_vap_ifname(vap),
+   ni->ni_bssid, ":",
+   vap->iv_bss->ni_bssid, ":",
(unsigned long long) tsf_beacon,
(unsigned int) (tsf_beacon >> 10),
(unsigned long long) nexttbtt,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361885 - head/sys/net80211

2020-06-06 Thread Adrian Chadd
Author: adrian
Date: Sun Jun  7 04:57:48 2020
New Revision: 361885
URL: https://svnweb.freebsd.org/changeset/base/361885

Log:
  [net80211] Add a method to return the vap's ifname.
  
  This removes the requirement to know what's in the ifp.
  
  (If someone wants a quick clean-up task, it'd be nice to convert instances
  of ifp dereferencing for if_xname over to this method.)

Modified:
  head/sys/net80211/ieee80211_freebsd.c
  head/sys/net80211/ieee80211_freebsd.h

Modified: head/sys/net80211/ieee80211_freebsd.c
==
--- head/sys/net80211/ieee80211_freebsd.c   Sun Jun  7 04:32:38 2020
(r361884)
+++ head/sys/net80211/ieee80211_freebsd.c   Sun Jun  7 04:57:48 2020
(r361885)
@@ -1034,6 +1034,20 @@ wlan_iflladdr(void *arg __unused, struct ifnet *ifp)
 }
 
 /*
+ * Fetch the VAP name.
+ *
+ * This returns a const char pointer suitable for debugging,
+ * but don't expect it to stick around for much longer.
+ */
+const char *
+ieee80211_get_vap_ifname(struct ieee80211vap *vap)
+{
+   if ((vap->iv_ifp == NULL) || (vap->iv_ifp->if_xname == NULL))
+   return "(none)";
+   return vap->iv_ifp->if_xname;
+}
+
+/*
  * Module glue.
  *
  * NB: the module name is "wlan" for compatibility with NetBSD.

Modified: head/sys/net80211/ieee80211_freebsd.h
==
--- head/sys/net80211/ieee80211_freebsd.h   Sun Jun  7 04:32:38 2020
(r361884)
+++ head/sys/net80211/ieee80211_freebsd.h   Sun Jun  7 04:57:48 2020
(r361885)
@@ -245,6 +245,7 @@ voidieee80211_drain_ifq(struct ifqueue *);
 void   ieee80211_flush_ifq(struct ifqueue *, struct ieee80211vap *);
 
 void   ieee80211_vap_destroy(struct ieee80211vap *);
+const char *   ieee80211_get_vap_ifname(struct ieee80211vap *);
 
 #defineIFNET_IS_UP_RUNNING(_ifp) \
(((_ifp)->if_flags & IFF_UP) && \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361878 - head/sys/net80211

2020-06-06 Thread Adrian Chadd
Author: adrian
Date: Sat Jun  6 22:25:00 2020
New Revision: 361878
URL: https://svnweb.freebsd.org/changeset/base/361878

Log:
  [net80211] Flip on A-MPDU, A-MSDU, A-MPDU+A-MSDU and Fast frames options.
  
  This updates the logic to allow:
  
  * A-MPDU if available;
  * A-MSDU if available and A-MPDU is off/NACKed;
  * A-MPDU+A-MSDU if it's available and negotiated;
  * Fast frames if the node is 11abg (and not HT/VHT.)
  
  This allows for things to fail back to A-MSDU or fast frames
  if A-MPDU isn't available rather than needing to be non-HT/non-VHT.
  It also allows A-MPDU+A-MSDU to work if it's negotiated.
  
  Tested:
  
  * AR9380, STA + AP mode (A-MPDU, A-MSDU, FF, A-MPDU+A-MSDU)
  * RT5350, STA mode (A-MSDU, FF)
  * AR9170, STA mode (A-MSDU, FF)

Modified:
  head/sys/net80211/ieee80211_output.c

Modified: head/sys/net80211/ieee80211_output.c
==
--- head/sys/net80211/ieee80211_output.cSat Jun  6 21:26:34 2020
(r361877)
+++ head/sys/net80211/ieee80211_output.cSat Jun  6 22:25:00 2020
(r361878)
@@ -125,6 +125,11 @@ ieee80211_vap_pkt_send_dest(struct ieee80211vap *vap, 
struct ieee80211com *ic = vap->iv_ic;
struct ifnet *ifp = vap->iv_ifp;
int mcast;
+   int do_ampdu = 0;
+   int do_amsdu = 0;
+   int do_ampdu_amsdu = 0;
+   int no_ampdu = 1; /* Will be set to 0 if ampdu is active */
+   int do_ff = 0;
 
if ((ni->ni_flags & IEEE80211_NODE_PWR_MGT) &&
(m->m_flags & M_PWR_SAV) == 0) {
@@ -169,7 +174,28 @@ ieee80211_vap_pkt_send_dest(struct ieee80211vap *vap, 
 
BPF_MTAP(ifp, m);   /* 802.3 tx */
 
+
/*
+* Figure out if we can do A-MPDU, A-MSDU or FF.
+*
+* A-MPDU depends upon vap/node config.
+* A-MSDU depends upon vap/node config.
+* FF depends upon vap config, IE and whether
+*  it's 11abg (and not 11n/11ac/etc.)
+*
+* Note that these flags indiciate whether we can do
+* it at all, rather than the situation (eg traffic type.)
+*/
+   do_ampdu = ((ni->ni_flags & IEEE80211_NODE_AMPDU_TX) &&
+   (vap->iv_flags_ht & IEEE80211_FHT_AMPDU_TX));
+   do_amsdu = ((ni->ni_flags & IEEE80211_NODE_AMSDU_TX) &&
+   (vap->iv_flags_ht & IEEE80211_FHT_AMSDU_TX));
+   do_ff =
+   ((ni->ni_flags & IEEE80211_NODE_HT) == 0) &&
+   ((ni->ni_flags & IEEE80211_NODE_VHT) == 0) &&
+   (IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_FF));
+
+   /*
 * Check if A-MPDU tx aggregation is setup or if we
 * should try to enable it.  The sta must be associated
 * with HT and A-MPDU enabled for use.  When the policy
@@ -186,8 +212,7 @@ ieee80211_vap_pkt_send_dest(struct ieee80211vap *vap, 
 * frames will always have sequence numbers allocated from the NON_QOS
 * TID.
 */
-   if ((ni->ni_flags & IEEE80211_NODE_AMPDU_TX) &&
-   (vap->iv_flags_ht & IEEE80211_FHT_AMPDU_TX)) {
+   if (do_ampdu) {
if ((m->m_flags & M_EAPOL) == 0 && (! mcast)) {
int tid = WME_AC_TO_TID(M_WME_GETAC(m));
struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[tid];
@@ -208,6 +233,23 @@ ieee80211_vap_pkt_send_dest(struct ieee80211vap *vap, 
ieee80211_ampdu_request(ni, tap);
/* XXX hold frame for reply? */
}
+   /*
+* Now update the no-ampdu flag.  A-MPDU may have been
+* started or administratively disabled above; so now we
+* know whether we're running yet or not.
+*
+* This will let us know whether we should be doing 
A-MSDU
+* at this point.  We only do A-MSDU if we're either not
+* doing A-MPDU, or A-MPDU is NACKed, or A-MPDU + A-MSDU
+* is available.
+*
+* Whilst here, update the amsdu-ampdu flag.  The above 
may
+* have also set or cleared the amsdu-in-ampdu txa_flags
+* combination so we can correctly do A-MPDU + A-MSDU.
+*/
+   no_ampdu = (! IEEE80211_AMPDU_RUNNING(tap)
+   || (IEEE80211_AMPDU_NACKED(tap)));
+   do_ampdu_amsdu = IEEE80211_AMPDU_RUNNING_AMSDU(tap);
}
}
 
@@ -222,15 +264,11 @@ ieee80211_vap_pkt_send_dest(struct ieee80211vap *vap, 
 * to really need to.  For A-MSDU we'd have to set the
 * A-MSDU QoS bit in the wifi header, so we just plain
 * can't do it.
-*
-* Strictly speaking, we could actually /do/ A-MSDU / FF
-* with A-MPDU together which for ce

svn commit: r361864 - head/sys/net80211

2020-06-05 Thread Adrian Chadd
Author: adrian
Date: Sat Jun  6 06:17:51 2020
New Revision: 361864
URL: https://svnweb.freebsd.org/changeset/base/361864

Log:
  [net80211] Fix this typo!
  
  I've just started using this macro in upcoming amsdu/ampdu/ff rework and
  yes, too many parens.  Oops!

Modified:
  head/sys/net80211/ieee80211_ht.h

Modified: head/sys/net80211/ieee80211_ht.h
==
--- head/sys/net80211/ieee80211_ht.hSat Jun  6 05:46:12 2020
(r361863)
+++ head/sys/net80211/ieee80211_ht.hSat Jun  6 06:17:51 2020
(r361864)
@@ -74,7 +74,7 @@ struct ieee80211_tx_ampdu {
  * A-MSDU in A-MPDU
  */
 #defineIEEE80211_AMPDU_RUNNING_AMSDU(tap) \
-   tap)->txa_flags & (IEEE80211_AGGR_RUNNING | IEEE80211_AGGR_AMSDU)) \
+   (((tap)->txa_flags & (IEEE80211_AGGR_RUNNING | IEEE80211_AGGR_AMSDU)) \
== (IEEE80211_AGGR_RUNNING | IEEE80211_AGGR_AMSDU))
 
 /* return non-zero if AMPDU tx for the TID was NACKed */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361863 - head/sys/net80211

2020-06-05 Thread Adrian Chadd
Author: adrian
Date: Sat Jun  6 05:46:12 2020
New Revision: 361863
URL: https://svnweb.freebsd.org/changeset/base/361863

Log:
  [net80211] Fix typo.
  
  Oops!

Modified:
  head/sys/net80211/ieee80211_node.c

Modified: head/sys/net80211/ieee80211_node.c
==
--- head/sys/net80211/ieee80211_node.c  Sat Jun  6 03:54:06 2020
(r361862)
+++ head/sys/net80211/ieee80211_node.c  Sat Jun  6 05:46:12 2020
(r361863)
@@ -2764,7 +2764,7 @@ ieee80211_node_join(struct ieee80211_node *ni, int res
ni->ni_flags & IEEE80211_NODE_HT ?
(ni->ni_chw == 40 ? ", HT40" : ", HT20") : "",
ni->ni_flags & IEEE80211_NODE_AMPDU ? " (+AMPDU)" : "",
-   ni->ni_flags & IEEE80211_NODE_AMSDU ? " (+ASPDU)" : "",
+   ni->ni_flags & IEEE80211_NODE_AMSDU ? " (+AMSDU)" : "",
ni->ni_flags & IEEE80211_NODE_MIMO_RTS ? " (+SMPS-DYN)" :
ni->ni_flags & IEEE80211_NODE_MIMO_PS ? " (+SMPS)" : "",
ni->ni_flags & IEEE80211_NODE_RIFS ? " (+RIFS)" : "",
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361834 - head/sys/net80211

2020-06-05 Thread Adrian Chadd
Author: adrian
Date: Fri Jun  5 14:17:19 2020
New Revision: 361834
URL: https://svnweb.freebsd.org/changeset/base/361834

Log:
  [net80211] Don't call ic_updateslot if it's not set.
  
  Turns out this isn't a required call. I didn't pick it up because my
  uncommitted changes involve new updateslot methods for cards I'm working
  on.
  
  Dunce hat to: adrian

Modified:
  head/sys/net80211/ieee80211_proto.c

Modified: head/sys/net80211/ieee80211_proto.c
==
--- head/sys/net80211/ieee80211_proto.c Fri Jun  5 13:54:13 2020
(r361833)
+++ head/sys/net80211/ieee80211_proto.c Fri Jun  5 14:17:19 2020
(r361834)
@@ -864,7 +864,8 @@ vap_update_slot(void *arg, int npending)
/*
 * Call the driver with our new global slot time flags.
 */
-   ic->ic_updateslot(ic);
+   if (ic->ic_updateslot != NULL)
+   ic->ic_updateslot(ic);
 }
 
 /*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361826 - head/sys/net80211

2020-06-05 Thread Adrian Chadd
Author: adrian
Date: Fri Jun  5 07:38:46 2020
New Revision: 361826
URL: https://svnweb.freebsd.org/changeset/base/361826

Log:
  [net80211] print out node A-MSDU state.
  
  Now that the node AMSDU TX/RX flags are correctly set in ieee80211_ht.c,
  we can print out the AMSDU state here.

Modified:
  head/sys/net80211/ieee80211_node.c
  head/sys/net80211/ieee80211_sta.c

Modified: head/sys/net80211/ieee80211_node.c
==
--- head/sys/net80211/ieee80211_node.c  Fri Jun  5 07:38:10 2020
(r361825)
+++ head/sys/net80211/ieee80211_node.c  Fri Jun  5 07:38:46 2020
(r361826)
@@ -2754,7 +2754,7 @@ ieee80211_node_join(struct ieee80211_node *ni, int res
 * XXX VHT - should log VHT channel width, etc
 */
IEEE80211_NOTE(vap, IEEE80211_MSG_ASSOC | IEEE80211_MSG_DEBUG, ni,
-   "station associated at aid %d: %s preamble, %s slot 
time%s%s%s%s%s%s%s%s",
+   "station associated at aid %d: %s preamble, %s slot 
time%s%s%s%s%s%s%s%s%s",
IEEE80211_NODE_AID(ni),
ic->ic_flags & IEEE80211_F_SHPREAMBLE ? "short" : "long",
vap->iv_flags & IEEE80211_F_SHSLOT ? "short" : "long",
@@ -2764,6 +2764,7 @@ ieee80211_node_join(struct ieee80211_node *ni, int res
ni->ni_flags & IEEE80211_NODE_HT ?
(ni->ni_chw == 40 ? ", HT40" : ", HT20") : "",
ni->ni_flags & IEEE80211_NODE_AMPDU ? " (+AMPDU)" : "",
+   ni->ni_flags & IEEE80211_NODE_AMSDU ? " (+ASPDU)" : "",
ni->ni_flags & IEEE80211_NODE_MIMO_RTS ? " (+SMPS-DYN)" :
ni->ni_flags & IEEE80211_NODE_MIMO_PS ? " (+SMPS)" : "",
ni->ni_flags & IEEE80211_NODE_RIFS ? " (+RIFS)" : "",

Modified: head/sys/net80211/ieee80211_sta.c
==
--- head/sys/net80211/ieee80211_sta.c   Fri Jun  5 07:38:10 2020
(r361825)
+++ head/sys/net80211/ieee80211_sta.c   Fri Jun  5 07:38:46 2020
(r361826)
@@ -1862,7 +1862,7 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *
ic->ic_flags &= ~IEEE80211_F_USEPROT;
IEEE80211_NOTE_MAC(vap,
IEEE80211_MSG_ASSOC | IEEE80211_MSG_DEBUG, wh->i_addr2,
-   "%sassoc success at aid %d: %s preamble, %s slot 
time%s%s%s%s%s%s%s%s",
+   "%sassoc success at aid %d: %s preamble, %s slot 
time%s%s%s%s%s%s%s%s%s",
ISREASSOC(subtype) ? "re" : "",
IEEE80211_NODE_AID(ni),
ic->ic_flags&IEEE80211_F_SHPREAMBLE ? "short" : "long",
@@ -1872,6 +1872,7 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *
ni->ni_flags & IEEE80211_NODE_HT ?
(ni->ni_chw == 40 ? ", HT40" : ", HT20") : "",
ni->ni_flags & IEEE80211_NODE_AMPDU ? " (+AMPDU)" : "",
+   ni->ni_flags & IEEE80211_NODE_AMSDU ? " (+AMSDU)" : "",
ni->ni_flags & IEEE80211_NODE_MIMO_RTS ? " (+SMPS-DYN)" :
ni->ni_flags & IEEE80211_NODE_MIMO_PS ? " (+SMPS)" : "",
ni->ni_flags & IEEE80211_NODE_RIFS ? " (+RIFS)" : "",
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361825 - head/sys/net80211

2020-06-05 Thread Adrian Chadd
Author: adrian
Date: Fri Jun  5 07:38:10 2020
New Revision: 361825
URL: https://svnweb.freebsd.org/changeset/base/361825

Log:
  [net80211] Add initial A-MSDU in A-MPDU negotation support.
  
  This is hopefully a big no-op unless you're running some extra
  patches to flip on A-MSDU options in a driver.
  
  802.11n supports sending A-MSDU in A-MPDU. That lets you do things
  like pack small frames into an A-MSDU and stuff /those/ into an A-MPDU.
  It allows for much more efficient airtime because you're not
  wasting time sending small frames - which is still a problem when
  doing A-MPDU as there's still per-frame overhead and minimum A-MPDU
  density requirements.
  
  It, however, is optional for 802.11n.  A lot of stuff doesn't advertise
  it (but does it, just wait!); and I know that ath10k does it and my
  ath(4) driver work supports it.
  
  Now, 802.11ac makes A-MSDU in A-MPDU something that can happen more
  frequently, because even though you can send very large A-MPDUs
  (like 1 megabyte and larger) you still have the small frame problem.
  So, 802.11ac NICs like ath10k and iwm will support A-MSDU in A-MPDU
  out of the box if it's enabled - and you can negotiate it.
  
  So, let's lay down the ground work to enable A-MSDU in A-MPDU.
  This will allow hardware like iwn(4) and ath(4) which supports
  software A-MSDU but hardware A-MPDU to be more efficient.
  
  Drivers that support A-MSDU in A-MPDU will set TX/RX htcap flags.
  Note this is separate from the software A-MSDU encap path; /that/
  dictates whether net80211 is doing A-MSDU encapsulation or not.
  These HTC flags control negotiation, NOT encapsulation.
  
  Once this negotiation and driver bits are done, hardware like
  rtwn(4), run(4), and others will be able to use A-MSDU even without
  A-MPDU working;  right now FF and A-MSDU aren't even attempted
  if you're an 11n node.  It's a small hold-over from the initial
  A-MPDU work and I know how to fix it, but to flip it on properly
  I need to be able to negotiate or ignore A-MSDU in A-MPDU.
  
  Oh and the fun part - some 11ac APs I've tested will quite happily
  decap A-MSDU in A-MPDU even though they don't negotiate it when
  doing 802.11n.  So hey, I know it works - I just want to properly
  handle things. :-)
  
  Tested:
  
  * AR9380, STA/AP mode

Modified:
  head/sys/net80211/_ieee80211.h
  head/sys/net80211/ieee80211_ht.c
  head/sys/net80211/ieee80211_ht.h

Modified: head/sys/net80211/_ieee80211.h
==
--- head/sys/net80211/_ieee80211.h  Fri Jun  5 07:37:52 2020
(r361824)
+++ head/sys/net80211/_ieee80211.h  Fri Jun  5 07:38:10 2020
(r361825)
@@ -529,10 +529,13 @@ struct ieee80211_mimo_info {
 #defineIEEE80211_HTC_TXUNEQUAL 0x0080  /* CAPABILITY: TX 
unequal MCS */
 #defineIEEE80211_HTC_TXMCS32   0x0100  /* CAPABILITY: MCS32 
support */
 #defineIEEE80211_HTC_TXLDPC0x0200  /* CAPABILITY: TX using 
LDPC */
+#defineIEEE80211_HTC_RX_AMSDU_AMPDU0x0400  /* CAPABILITY: 
RX A-MSDU in A-MPDU */
+#defineIEEE80211_HTC_TX_AMSDU_AMPDU0x0800  /* CAPABILITY: 
TX A-MSDU in A-MPDU */
 
 #defineIEEE80211_C_HTCAP_BITS \
"\20\1LDPC\2CHWIDTH40\5GREENFIELD\6SHORTGI20\7SHORTGI40\10TXSTBC" \
-   "\21AMPDU\22AMSDU\23HT\24SMPS\25RIFS\32TXLDPC"
+   "\21AMPDU\22AMSDU\23HT\24SMPS\25RIFS\32TXLDPC\33RXAMSDUAMPDU" \
+   "\34TXAMSDUAMPDU"
 
 /*
  * RX status notification - which fields are valid.

Modified: head/sys/net80211/ieee80211_ht.c
==
--- head/sys/net80211/ieee80211_ht.cFri Jun  5 07:37:52 2020
(r361824)
+++ head/sys/net80211/ieee80211_ht.cFri Jun  5 07:38:10 2020
(r361825)
@@ -592,6 +592,7 @@ static int
 ampdu_rx_start(struct ieee80211_node *ni, struct ieee80211_rx_ampdu *rap,
int baparamset, int batimeout, int baseqctl)
 {
+   struct ieee80211vap *vap = ni->ni_vap;
int bufsiz = MS(baparamset, IEEE80211_BAPS_BUFSIZ);
 
if (rap->rxa_flags & IEEE80211_AGGR_RUNNING) {
@@ -607,6 +608,13 @@ ampdu_rx_start(struct ieee80211_node *ni, struct ieee8
rap->rxa_start = MS(baseqctl, IEEE80211_BASEQ_START);
rap->rxa_flags |=  IEEE80211_AGGR_RUNNING | IEEE80211_AGGR_XCHGPEND;
 
+   /* XXX this should be a configuration flag */
+   if ((vap->iv_htcaps & IEEE80211_HTC_RX_AMSDU_AMPDU) &&
+   (MS(baparamset, IEEE80211_BAPS_AMSDU)))
+   rap->rxa_flags |= IEEE80211_AGGR_AMSDU;
+   else
+   rap->rxa_flags &= ~IEEE80211_AGGR_AMSDU;
+
return 0;
 }
 
@@ -642,6 +650,8 @@ ieee80211_ampdu_rx_start_ext(struct ieee80211_node *ni
}
rap->rxa_flags |=  IEEE80211_AGGR_RUNNING | IEEE80211_AGGR_XCHGPEND;
 
+   /* XXX TODO: no amsdu flag */
+
IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_11N, ni,
  

svn commit: r361822 - head/sys/net80211

2020-06-04 Thread Adrian Chadd
Author: adrian
Date: Fri Jun  5 06:21:23 2020
New Revision: 361822
URL: https://svnweb.freebsd.org/changeset/base/361822

Log:
  [net80211] Migrate short slot time configuration into per-vap and deferred 
taskqueue updates.
  
  The 11b/11g ERP and slot time update handling are two things which weren't
  migrated into the per-VAP state when Sam did the initial VAP work.
  That makes sense for a lot of setups where net80211 is driving radio state
  and the radio only cares about the shared state.
  
  However, as noted by a now deleted comment, the ERP and slot time updates
  aren't EXACTLY correct/accurate - they only take into account the most
  RECENTLY created VAP, and the state updates when one creates/destroys
  VAPs isn't exactly great.
  
  So:
  
  * track the short slot logic per VAP;
  * whenever the slot time configuration changes, just push it into a deferred
task queue update so drivers don't have to serialise it themselves;
  * if a driver registers a per-VAP slot time handler then it'll just get the
per VAP one;
  * .. if a driver registers a global one then the legacy behaviour is 
maintained -
a single slot time is calculated and pushed out.
  
  Note that the calculated slot time is better than the existing logic - if ANY
  of the VAPs require long slot then it's disabled for all VAPs rather than
  whatever the last configured VAP did.
  
  Now, this isn't entirely complete - the rest of ERP tracking around short/long
  slot capable station tracking needs to be converted into per-VAP, as well
  as the preamble/barker flags.  Luckily those also can be done in a similar
  fashion - keep per-VAP counters/flags and unify them before doing the driver
  update.  I'll defer that work until later.
  
  All the existing drivers can keep doing what they're doing with the global
  slot time flags as that is maintained. One driver (iwi) used the per-VAP
  flags instead of the ic flags, so now that driver will work properly.
  
  This unblocks some ath10k porting work as the firmware takes the slot time
  configuration per-VAP rather than globally, and some firmware handles
  STA+AP and STA+STA (on same/different channels) configurations where
  the firmware will switch slot time as appropriate.
  
  Tested:
  
  * AR9380, STA/AP mode
  * AR9880 (ath10k), STA mode

Modified:
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211_node.c
  head/sys/net80211/ieee80211_output.c
  head/sys/net80211/ieee80211_phy.h
  head/sys/net80211/ieee80211_proto.c
  head/sys/net80211/ieee80211_proto.h
  head/sys/net80211/ieee80211_sta.c
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/net80211/ieee80211.c
==
--- head/sys/net80211/ieee80211.c   Fri Jun  5 06:07:23 2020
(r361821)
+++ head/sys/net80211/ieee80211.c   Fri Jun  5 06:21:23 2020
(r361822)
@@ -645,6 +645,7 @@ ieee80211_vap_setup(struct ieee80211com *ic, struct ie
ieee80211_scan_vattach(vap);
ieee80211_regdomain_vattach(vap);
ieee80211_radiotap_vattach(vap);
+   ieee80211_vap_reset_erp(vap);
ieee80211_ratectl_set(vap, IEEE80211_RATECTL_NONE);
 
return 0;
@@ -2200,7 +2201,7 @@ ieee80211_setmode(struct ieee80211com *ic, enum ieee80
ieee80211_setbasicrates(&ic->ic_sup_rates[mode], mode);
 
ic->ic_curmode = mode;
-   ieee80211_reset_erp(ic);/* reset ERP state */
+   ieee80211_reset_erp(ic);/* reset global ERP state */
 
return 0;
 }

Modified: head/sys/net80211/ieee80211_node.c
==
--- head/sys/net80211/ieee80211_node.c  Fri Jun  5 06:07:23 2020
(r361821)
+++ head/sys/net80211/ieee80211_node.c  Fri Jun  5 06:21:23 2020
(r361822)
@@ -446,7 +446,7 @@ ieee80211_reset_bss(struct ieee80211vap *vap)
 
ieee80211_node_table_reset(&ic->ic_sta, vap);
/* XXX multi-bss: wrong */
-   ieee80211_reset_erp(ic);
+   ieee80211_vap_reset_erp(vap);
 
ni = ieee80211_alloc_node(&ic->ic_sta, vap, vap->iv_myaddr);
KASSERT(ni != NULL, ("unable to setup initial BSS node"));
@@ -682,7 +682,7 @@ ieee80211_ibss_merge(struct ieee80211_node *ni)
"%s: new bssid %s: %s preamble, %s slot time%s\n", __func__,
ether_sprintf(ni->ni_bssid),
ic->ic_flags&IEEE80211_F_SHPREAMBLE ? "short" : "long",
-   ic->ic_flags&IEEE80211_F_SHSLOT ? "short" : "long",
+   vap->iv_flags&IEEE80211_F_SHSLOT ? "short" : "long",
ic->ic_flags&IEEE80211_F_USEPROT ? ", protection" : ""
);
return ieee80211_sta_join1(ieee80211_ref_node(ni));
@@ -881,7 +881,7 @@ ieee80211_sta_join1(struct ieee80211_node *selbs)
 * the auto-select case; this should be redundant if the
 * mode is locked.
 */
-   ieee80211_reset_erp(ic);
+   ieee80211_vap_reset_erp(va

svn commit: r361821 - head/sys/net80211

2020-06-04 Thread Adrian Chadd
Author: adrian
Date: Fri Jun  5 06:07:23 2020
New Revision: 361821
URL: https://svnweb.freebsd.org/changeset/base/361821

Log:
  [net80211] Add some TODOs around A-MSDU in A-MPDU negotiation.
  
  net80211 currently doesn't negotiate A-MSDU in A-MPDU during ADDBA.
  I've added the field in net80211 and this commit:
  
  * Prints out the ADDBA field value during ADDBA;
  * Adds some comments around where I need to follow up with some
negotiation logic.
  
  Right now we don't have a driver flag anywhere which controls
  whether A-MSDU in A-MPDU is allowed.  I know it works (I have it
  manually turned on at home on a couple test APs, heh!) but
  I can't flip it on until we can negotiate it.
  
  Tested:
  
  * AR9380, STA/AP mode, printing out ADDBA requests

Modified:
  head/sys/net80211/ieee80211_ht.c

Modified: head/sys/net80211/ieee80211_ht.c
==
--- head/sys/net80211/ieee80211_ht.cFri Jun  5 04:24:34 2020
(r361820)
+++ head/sys/net80211/ieee80211_ht.cFri Jun  5 06:07:23 2020
(r361821)
@@ -2237,12 +2237,13 @@ ht_recv_action_ba_addba_request(struct ieee80211_node 
 
IEEE80211_NOTE(vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni,
"recv ADDBA request: dialogtoken %u baparamset 0x%x "
-   "(tid %d bufsiz %d) batimeout %d baseqctl %d:%d",
+   "(tid %d bufsiz %d) batimeout %d baseqctl %d:%d amsdu %d",
dialogtoken, baparamset,
tid, MS(baparamset, IEEE80211_BAPS_BUFSIZ),
batimeout,
MS(baseqctl, IEEE80211_BASEQ_START),
-   MS(baseqctl, IEEE80211_BASEQ_FRAG));
+   MS(baseqctl, IEEE80211_BASEQ_FRAG),
+   MS(baparamset, IEEE80211_BAPS_AMSDU));
 
rap = &ni->ni_rx_ampdu[tid];
 
@@ -2274,6 +2275,7 @@ ht_recv_action_ba_addba_request(struct ieee80211_node 
| SM(tid, IEEE80211_BAPS_TID)
| SM(rap->rxa_wnd, IEEE80211_BAPS_BUFSIZ)
;
+   /* XXX AMSDU in AMPDU? */
args[3] = 0;
args[4] = 0;
ic->ic_send_action(ni, IEEE80211_ACTION_CAT_BA,
@@ -2346,6 +2348,8 @@ ht_recv_action_ba_addba_response(struct ieee80211_node
return 0;
}
 #endif
+
+   /* XXX TODO: check AMSDU in AMPDU configuration */
IEEE80211_NOTE(vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni,
"recv ADDBA response: dialogtoken %u code %d "
"baparamset 0x%x (tid %d bufsiz %d) batimeout %d",
@@ -2506,6 +2510,8 @@ ieee80211_ampdu_request(struct ieee80211_node *ni,
| SM(tid, IEEE80211_BAPS_TID)
| SM(IEEE80211_AGGR_BAWMAX, IEEE80211_BAPS_BUFSIZ)
;
+   /* XXX TODO: check AMSDU in AMPDU configuration */
+
args[3] = 0;/* batimeout */
/* NB: do first so there's no race against reply */
if (!ic->ic_addba_request(ni, tap, dialogtoken, args[2], args[3])) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361820 - head/sys/dev/iwn

2020-06-04 Thread Adrian Chadd
Author: adrian
Date: Fri Jun  5 04:24:34 2020
New Revision: 361820
URL: https://svnweb.freebsd.org/changeset/base/361820

Log:
  [iwn] Set default ampdu parameters.
  
  These are from the linux iwlwifi driver ;the default use smaller
  maximum AMPDUs (8k) and a much smaller density (none.)  The latter
  could cause stability issues.
  
  Tested:
  
  * Tested on Intel 6300, STA mode.
  
  Differential Revision: https://reviews.freebsd.org/D25113

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Fri Jun  5 04:04:47 2020(r361819)
+++ head/sys/dev/iwn/if_iwn.c   Fri Jun  5 04:24:34 2020(r361820)
@@ -1351,6 +1351,8 @@ iwn_vap_create(struct ieee80211com *ic, const char nam
ivp->iv_newstate = vap->iv_newstate;
vap->iv_newstate = iwn_newstate;
sc->ivap[IWN_RXON_BSS_CTX] = vap;
+   vap->iv_ampdu_rxmax = IEEE80211_HTCAP_MAXRXAMPDU_64K;
+   vap->iv_ampdu_density = IEEE80211_HTCAP_MPDUDENSITY_4; /* 4uS */
 
ieee80211_ratectl_init(vap);
/* Complete setup. */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361819 - head/sys/net80211

2020-06-04 Thread Adrian Chadd
Author: adrian
Date: Fri Jun  5 04:04:47 2020
New Revision: 361819
URL: https://svnweb.freebsd.org/changeset/base/361819

Log:
  [net80211] Add field definition for A-MSDU inside A-MPDU.
  
  Now that I have A-MSDU and A-MPDU coexisting together, we need to actually
  announce if (a) it's permitted and (b) figure out if we should use it
  when transmitting.
  
  This just adds the field; it doesn't yet include it in ADDBA exchanges.

Modified:
  head/sys/net80211/ieee80211.h

Modified: head/sys/net80211/ieee80211.h
==
--- head/sys/net80211/ieee80211.h   Fri Jun  5 02:56:42 2020
(r361818)
+++ head/sys/net80211/ieee80211.h   Fri Jun  5 04:04:47 2020
(r361819)
@@ -430,6 +430,8 @@ struct ieee80211_action_ht_mimopowersave {
 #defineIEEE80211_BAPS_TID_S2
 #defineIEEE80211_BAPS_POLICY   0x0002  /* block ack policy */
 #defineIEEE80211_BAPS_POLICY_S 1
+#defineIEEE80211_BAPS_AMSDU0x0001  /* A-MSDU permitted */
+#defineIEEE80211_BAPS_AMSDU_S  0
 
 #defineIEEE80211_BAPS_POLICY_DELAYED   (0

svn commit: r361813 - head/sys/net80211

2020-06-04 Thread Adrian Chadd
Author: adrian
Date: Fri Jun  5 00:16:54 2020
New Revision: 361813
URL: https://svnweb.freebsd.org/changeset/base/361813

Log:
  [net80211] Add some more debugging during scanning
  
  I'm trying to chase down more weird "I am not doing an incremental scan
  when being asked" issues so these debugging statements help.
  Notably, I've added more debugging around reasons why the scan is skipped -
  eg because the cache is considered hot.
  
  This should be a no-op unless you care about the debugging output!

Modified:
  head/sys/net80211/ieee80211_scan_sta.c
  head/sys/net80211/ieee80211_scan_sw.c

Modified: head/sys/net80211/ieee80211_scan_sta.c
==
--- head/sys/net80211/ieee80211_scan_sta.c  Fri Jun  5 00:14:02 2020
(r361812)
+++ head/sys/net80211/ieee80211_scan_sta.c  Fri Jun  5 00:16:54 2020
(r361813)
@@ -1276,6 +1276,8 @@ sta_pick_bss(struct ieee80211_scan_state *ss, struct i
 * handle notification that this has completed.
 */
ss->ss_flags &= ~IEEE80211_SCAN_NOPICK;
+   IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
+   "%s: nopick; return 1\n", __func__);
return 1;
}
/*
@@ -1285,7 +1287,9 @@ sta_pick_bss(struct ieee80211_scan_state *ss, struct i
/* NB: unlocked read should be ok */
if (TAILQ_FIRST(&st->st_entry) == NULL) {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
-   "%s: no scan candidate\n", __func__);
+   "%s: no scan candidate, join=%d, return 0\n",
+   __func__,
+   !! (ss->ss_flags & IEEE80211_SCAN_NOJOIN));
if (ss->ss_flags & IEEE80211_SCAN_NOJOIN)
return 0;
 notfound:
@@ -1310,6 +1314,8 @@ notfound:
chan = demote11b(vap, chan);
if (!ieee80211_sta_join(vap, chan, &selbs->base))
goto notfound;
+   IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
+   "%s: terminate scan; return 1\n", __func__);
return 1;   /* terminate scan */
 }
 

Modified: head/sys/net80211/ieee80211_scan_sw.c
==
--- head/sys/net80211/ieee80211_scan_sw.c   Fri Jun  5 00:14:02 2020
(r361812)
+++ head/sys/net80211/ieee80211_scan_sw.c   Fri Jun  5 00:16:54 2020
(r361813)
@@ -298,6 +298,11 @@ ieee80211_swscan_check_scan(const struct ieee80211_sca
 * use.  Also discard any frames that might come
 * in while temporarily marked as scanning.
 */
+   IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
+   "cache hot; ic_lastscan=%d, scanvalid=%d, 
ticks=%d\n",
+   ic->ic_lastscan,
+   vap->iv_scanvalid,
+   ticks);
SCAN_PRIVATE(ss)->ss_iflags |= ISCAN_DISCARD;
ic->ic_flags |= IEEE80211_F_SCAN;
 
@@ -307,6 +312,8 @@ ieee80211_swscan_check_scan(const struct ieee80211_sca
 
ic->ic_flags &= ~IEEE80211_F_SCAN;
SCAN_PRIVATE(ss)->ss_iflags &= ~ISCAN_DISCARD;
+   IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
+   "%s: scan_end returned %d\n", __func__, result);
if (result) {
ieee80211_notify_scan_done(vap);
return 1;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361812 - head/sys/net80211

2020-06-04 Thread Adrian Chadd
Author: adrian
Date: Fri Jun  5 00:14:02 2020
New Revision: 361812
URL: https://svnweb.freebsd.org/changeset/base/361812

Log:
  [net80211] Print out a bad PN in both hex and decimal.
  
  I've been using this to visually identify when I'm getting corrupted PNs
  from the hardware. :(

Modified:
  head/sys/net80211/ieee80211_freebsd.c

Modified: head/sys/net80211/ieee80211_freebsd.c
==
--- head/sys/net80211/ieee80211_freebsd.c   Fri Jun  5 00:11:44 2020
(r361811)
+++ head/sys/net80211/ieee80211_freebsd.c   Fri Jun  5 00:14:02 2020
(r361812)
@@ -789,8 +789,11 @@ ieee80211_notify_replay_failure(struct ieee80211vap *v
struct ifnet *ifp = vap->iv_ifp;
 
IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_CRYPTO, wh->i_addr2,
-   "%s replay detected tid %d ",
-   k->wk_cipher->ic_name, tid, (intmax_t) rsc,
+   "%s replay detected tid %d ",
+   k->wk_cipher->ic_name, tid,
+   (intmax_t) rsc,
+   (intmax_t) rsc,
+   (intmax_t) k->wk_keyrsc[tid],
(intmax_t) k->wk_keyrsc[tid],
k->wk_keyix, k->wk_rxkeyix);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361811 - head/sys/net80211

2020-06-04 Thread Adrian Chadd
Author: adrian
Date: Fri Jun  5 00:11:44 2020
New Revision: 361811
URL: https://svnweb.freebsd.org/changeset/base/361811

Log:
  [net80211] Send a probe request after IBSS node discovery
  
  This sends a probe request after IBSS node discovery through
  beacon frames. This allows things like HT and VHT capabilities
  to be "negotiated" in adhoc mode.
  
  It is .. kinda fire and pray - this isn't retried after discovery
  so it's quite possible that nodes occasionally don't come up with
  HT/VHT rate upgrades. At some point it may be a fun side project
  to add support for retrying these probe requests/negotiations
  after IBSS node discovery.
  
  Tested:
  
  * tested with multiple ath(4) NICs in 11n mode.
  
  Differential Revision:https://reviews.freebsd.org/D24979

Modified:
  head/sys/net80211/ieee80211_adhoc.c

Modified: head/sys/net80211/ieee80211_adhoc.c
==
--- head/sys/net80211/ieee80211_adhoc.c Thu Jun  4 22:58:37 2020
(r361810)
+++ head/sys/net80211/ieee80211_adhoc.c Fri Jun  5 00:11:44 2020
(r361811)
@@ -715,6 +715,15 @@ adhoc_recv_mgmt(struct ieee80211_node *ni, struct mbuf
wh = mtod(m0, struct ieee80211_frame *);
frm = (uint8_t *)&wh[1];
efrm = mtod(m0, uint8_t *) + m0->m_len;
+
+   IEEE80211_DPRINTF(vap, IEEE80211_MSG_INPUT | IEEE80211_MSG_DEBUG,
+   "%s: recv mgmt frame, addr2=%6D, ni=%p (%6D) fc=%.02x %.02x\n",
+   __func__,
+   wh->i_addr2, ":",
+   ni,
+   ni->ni_macaddr, ":",
+   wh->i_fc[0],
+   wh->i_fc[1]);
switch (subtype) {
case IEEE80211_FC0_SUBTYPE_PROBE_RESP:
case IEEE80211_FC0_SUBTYPE_BEACON: {
@@ -788,6 +797,20 @@ adhoc_recv_mgmt(struct ieee80211_node *ni, struct mbuf
} else
ni = NULL;
 
+   /*
+* Send a probe request so we announce 11n
+* capabilities.
+*
+* Don't do this if we're scanning.
+*/
+   if (! (ic->ic_flags & IEEE80211_F_SCAN))
+   ieee80211_send_probereq(ni, /* node */
+   vap->iv_myaddr, /* SA */
+   ni->ni_macaddr, /* DA */
+   vap->iv_bss->ni_bssid, /* BSSID 
*/
+   vap->iv_bss->ni_essid,
+   vap->iv_bss->ni_esslen); /* 
SSID */
+
} else if (ni->ni_capinfo == 0) {
/*
 * Update faked node created on transmit.
@@ -936,11 +959,11 @@ adhoc_recv_mgmt(struct ieee80211_node *ni, struct mbuf
vap->iv_stats.is_rx_mgtdiscard++;
} else if (!IEEE80211_ADDR_EQ(vap->iv_myaddr, wh->i_addr1) &&
!IEEE80211_IS_MULTICAST(wh->i_addr1)) {
-   IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
+   IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT | 
IEEE80211_MSG_DEBUG,
wh, NULL, "%s", "not for us");
vap->iv_stats.is_rx_mgtdiscard++;
} else if (vap->iv_state != IEEE80211_S_RUN) {
-   IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
+   IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT | 
IEEE80211_MSG_DEBUG,
wh, NULL, "wrong state %s",
ieee80211_state_name[vap->iv_state]);
vap->iv_stats.is_rx_mgtdiscard++;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361778 - head/sys/dev/usb/wlan

2020-06-03 Thread Adrian Chadd
Author: adrian
Date: Wed Jun  3 22:30:44 2020
New Revision: 361778
URL: https://svnweb.freebsd.org/changeset/base/361778

Log:
  [run] Fix up tx/rx frame size.
  
  This specifically fixes that TX frames are large enough now to hold a 3900 odd
  byte AMSDU (the little ones); me flipping it on earlier messed up transmit!
  
  Tested:
  
  * if_run, STA mode, TX/RX TCP/UDP iperf.  TCP is now back to normal and
correctly does ~ 3200 byte AMSDU/fast frames (2x1600ish byte MSDUs).

Modified:
  head/sys/dev/usb/wlan/if_run.c
  head/sys/dev/usb/wlan/if_runvar.h

Modified: head/sys/dev/usb/wlan/if_run.c
==
--- head/sys/dev/usb/wlan/if_run.c  Wed Jun  3 22:19:52 2020
(r361777)
+++ head/sys/dev/usb/wlan/if_run.c  Wed Jun  3 22:30:44 2020
(r361778)
@@ -3050,10 +3050,11 @@ run_bulk_rx_callback(struct usb_xfer *xfer, usb_error_
 tr_setup:
if (sc->rx_m == NULL) {
sc->rx_m = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR,
-   MJUMPAGESIZE /* xfer can be bigger than MCLBYTES 
*/);
+   RUN_MAX_RXSZ);
}
if (sc->rx_m == NULL) {
-   RUN_DPRINTF(sc, RUN_DEBUG_RECV | RUN_DEBUG_RECV_DESC,
+   RUN_DPRINTF(sc, RUN_DEBUG_RECV |
+   RUN_DEBUG_RECV_DESC | RUN_DEBUG_USB,
"could not allocate mbuf - idle with stall\n");
counter_u64_add(ic->ic_ierrors, 1);
usbd_xfer_set_stall(xfer);

Modified: head/sys/dev/usb/wlan/if_runvar.h
==
--- head/sys/dev/usb/wlan/if_runvar.h   Wed Jun  3 22:19:52 2020
(r361777)
+++ head/sys/dev/usb/wlan/if_runvar.h   Wed Jun  3 22:30:44 2020
(r361778)
@@ -23,14 +23,15 @@
 #ifndef _IF_RUNVAR_H_
 #define_IF_RUNVAR_H_
 
+/* Support up to 4KB frames - useful for A-MSDU/FF. */
 #defineRUN_MAX_RXSZ\
MIN(4096, MJUMPAGESIZE)
 
-/* NB: "11" is the maximum number of padding bytes needed for Tx */
+/* Support up to 8KB frames - useful for A-MSDU/FF. */
 #defineRUN_MAX_TXSZ\
(sizeof (struct rt2870_txd) +   \
 sizeof (struct rt2860_txwi) +  \
-MCLBYTES + 11)
+8192 + 11)
 
 #defineRUN_TX_TIMEOUT  5000/* ms */
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361768 - head/sys/dev/otus

2020-06-03 Thread Adrian Chadd
Author: adrian
Date: Wed Jun  3 20:25:02 2020
New Revision: 361768
URL: https://svnweb.freebsd.org/changeset/base/361768

Log:
  [otus] enable 802.11n for 2GHz and 5GHz.
  
  This flips on basic 11n for 2GHz/5GHz station operation.
  
  * It flips on HT20 and MCS rates;
  * It enables A-MPDU decap - the payload format is a bit different;
  * It does do some basic checks for HT40 but I haven't yet flipped on
HT40 support;
  * It enables software A-MSDU transmit; I honestly don't want to make
A-MPDU TX work and there are apparently issues with QoS and A-MPDU TX.
So I totally am ignoring A-MPDU TX;
  * MCS rate transmit is fine.
  
  I haven't:
  
  * A-MPDU TX, as I said above;
  * made radiotap work fully;
  * HT40;
  * short-GI support;
  * lots of other stuff that honestly no-one is likely to use.
  
  But! Hey, this is another ye olde 11n USB NIC that now works pretty OK
  in 11n rates. A-MPDU receive seems fine enough given it's a draft-n
  device from before 2010.
  
  Tested:
  
  * Ye olde UB82 Test NIC (AR9170 + AR9104) - 2GHz/5GHz

Modified:
  head/sys/dev/otus/if_otus.c
  head/sys/dev/otus/if_otusreg.h

Modified: head/sys/dev/otus/if_otus.c
==
--- head/sys/dev/otus/if_otus.c Wed Jun  3 18:59:31 2020(r361767)
+++ head/sys/dev/otus/if_otus.c Wed Jun  3 20:25:02 2020(r361768)
@@ -91,6 +91,7 @@ SYSCTL_INT(_hw_usb_otus, OID_AUTO, debug, CTLFLAG_RWTU
 #defineOTUS_DEBUG_REGIO0x0200
 #defineOTUS_DEBUG_IRQ  0x0400
 #defineOTUS_DEBUG_TXCOMP   0x0800
+#defineOTUS_DEBUG_RX_BUFFER0x1000
 #defineOTUS_DEBUG_ANY  0x
 
 #defineOTUS_DPRINTF(sc, dm, ...) \
@@ -131,7 +132,6 @@ static device_attach_t otus_attach;
 static device_detach_t otus_detach;
 
 static int otus_attachhook(struct otus_softc *);
-void   otus_get_chanlist(struct otus_softc *);
 static voidotus_getradiocaps(struct ieee80211com *, int, int *,
struct ieee80211_channel[]);
 intotus_load_firmware(struct otus_softc *, const char *,
@@ -395,9 +395,8 @@ otus_vap_create(struct ieee80211com *ic, const char na
uvp->newstate = vap->iv_newstate;
vap->iv_newstate = otus_newstate;
 
-   /* XXX TODO: double-check */
-   vap->iv_ampdu_density = IEEE80211_HTCAP_MPDUDENSITY_16;
-   vap->iv_ampdu_rxmax = IEEE80211_HTCAP_MAXRXAMPDU_32K;
+   vap->iv_ampdu_density = IEEE80211_HTCAP_MPDUDENSITY_8;
+   vap->iv_ampdu_rxmax = IEEE80211_HTCAP_MAXRXAMPDU_64K;
 
ieee80211_ratectl_init(vap);
 
@@ -699,6 +698,16 @@ otus_attachhook(struct otus_softc *sc)
IEEE80211_ADDR_COPY(ic->ic_macaddr, sc->eeprom.baseEepHeader.macAddr);
sc->sc_led_newstate = otus_led_newstate_type3;  /* XXX */
 
+   if (sc->txmask == 0x5)
+   ic->ic_txstream = 2;
+   else
+   ic->ic_txstream = 1;
+
+   if (sc->rxmask == 0x5)
+   ic->ic_rxstream = 2;
+   else
+   ic->ic_rxstream = 1;
+
device_printf(sc->sc_dev,
"MAC/BBP AR9170, RF AR%X, MIMO %dT%dR, address %s\n",
(sc->capflags & AR5416_OPFLAGS_11A) ?
@@ -721,33 +730,21 @@ otus_attachhook(struct otus_softc *sc)
IEEE80211_C_WME |   /* WME/QoS */
IEEE80211_C_SHSLOT |/* Short slot time supported. */
IEEE80211_C_FF |/* Atheros fast-frames supported. */
-   IEEE80211_C_MONITOR |
+   IEEE80211_C_MONITOR |   /* Enable monitor mode */
+   IEEE80211_C_SWAMSDUTX | /* Do software A-MSDU TX */
IEEE80211_C_WPA;/* WPA/RSN. */
 
-   /* XXX TODO: 11n */
-
+   ic->ic_htcaps =
+   IEEE80211_HTC_HT |
 #if 0
-   if (sc->eeprom.baseEepHeader.opCapFlags & AR5416_OPFLAGS_11G) {
-   /* Set supported .11b and .11g rates. */
-   ic->ic_sup_rates[IEEE80211_MODE_11B] =
-   ieee80211_std_rateset_11b;
-   ic->ic_sup_rates[IEEE80211_MODE_11G] =
-   ieee80211_std_rateset_11g;
-   }
-   if (sc->eeprom.baseEepHeader.opCapFlags & AR5416_OPFLAGS_11A) {
-   /* Set supported .11a rates. */
-   ic->ic_sup_rates[IEEE80211_MODE_11A] =
-   ieee80211_std_rateset_11a;
-   }
+   IEEE80211_HTC_AMPDU |
 #endif
+   IEEE80211_HTC_AMSDU |
+   IEEE80211_HTCAP_MAXAMSDU_3839 |
+   IEEE80211_HTCAP_SMPS_OFF;
 
-#if 0
-   /* Build the list of supported channels. */
-   otus_get_chanlist(sc);
-#else
otus_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans,
ic->ic_channels);
-#endif
 
ieee80211_ifattach(ic);
ic->ic_raw_xmit = otus_raw_xmit;
@@ -780,38 +777,6 @@ otus_attachhook(struct otus_softc *sc)
return (0);
 }
 
-void
-otus_get_chanlist(struct otus_softc *sc)
-{
-   s

svn commit: r361738 - head/sys/dev/usb/wlan

2020-06-02 Thread Adrian Chadd
Author: adrian
Date: Tue Jun  2 22:37:53 2020
New Revision: 361738
URL: https://svnweb.freebsd.org/changeset/base/361738

Log:
  [run] note that PHY_HT is for mixed mode.
  
  Submitted by: Ashish Gupta 
  Differential Revision:https://reviews.freebsd.org/D25108

Modified:
  head/sys/dev/usb/wlan/if_run.c
  head/sys/dev/usb/wlan/if_runreg.h

Modified: head/sys/dev/usb/wlan/if_run.c
==
--- head/sys/dev/usb/wlan/if_run.c  Tue Jun  2 22:36:17 2020
(r361737)
+++ head/sys/dev/usb/wlan/if_run.c  Tue Jun  2 22:37:53 2020
(r361738)
@@ -3397,7 +3397,7 @@ run_set_tx_desc(struct run_softc *sc, struct run_tx_da
mcs |= RT2860_PHY_OFDM;
} else if (rt2860_rates[ridx].phy == IEEE80211_T_HT) {
/* XXX TODO: [adrian] set short preamble for MCS? */
-   mcs |= RT2860_PHY_HT; /* Mixed, not greenfield */
+   mcs |= RT2860_PHY_HT_MIX; /* Mixed, not greenfield */
}
txwi->phy = htole16(mcs);
 

Modified: head/sys/dev/usb/wlan/if_runreg.h
==
--- head/sys/dev/usb/wlan/if_runreg.h   Tue Jun  2 22:36:17 2020
(r361737)
+++ head/sys/dev/usb/wlan/if_runreg.h   Tue Jun  2 22:37:53 2020
(r361738)
@@ -781,7 +781,7 @@ struct rt2860_txwi {
 #defineRT2860_PHY_MODE 0xc000
 #defineRT2860_PHY_CCK  (0 << 14)
 #defineRT2860_PHY_OFDM (1 << 14)
-#defineRT2860_PHY_HT   (2 << 14)
+#defineRT2860_PHY_HT_MIX   (2 << 14)
 #defineRT2860_PHY_HT_GF(3 << 14)
 #defineRT2860_PHY_SGI  (1 << 8)
 #defineRT2860_PHY_BW40 (1 << 7)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361737 - head/sys/dev/usb/wlan

2020-06-02 Thread Adrian Chadd
Author: adrian
Date: Tue Jun  2 22:36:17 2020
New Revision: 361737
URL: https://svnweb.freebsd.org/changeset/base/361737

Log:
  [run] Set the number of HT chains.
  
  * Set the tx/rx chains based on the existing MIMO eeprom reads
  * Add 3-chain rates
  
  Tested:
  
  * MAC/BBP RT5390 (rev 0x0502), RF RT5370 (MIMO 1T1R), 2g/5g STA
  * MAC/BBP RT3593 (rev 0x0402), RF RT3053 (MIMO 3T3R), 2g/5g STA

Modified:
  head/sys/dev/usb/wlan/if_run.c

Modified: head/sys/dev/usb/wlan/if_run.c
==
--- head/sys/dev/usb/wlan/if_run.c  Tue Jun  2 20:42:45 2020
(r361736)
+++ head/sys/dev/usb/wlan/if_run.c  Tue Jun  2 22:36:17 2020
(r361737)
@@ -537,6 +537,7 @@ static const struct rt2860_rate {
{  0x85, 5, IEEE80211_T_HT, 4, 60, 60 },
{  0x86, 6, IEEE80211_T_HT, 4, 60, 60 },
{  0x87, 7, IEEE80211_T_HT, 4, 60, 60 },
+
/* MCS - 2 streams */
{  0x88, 8, IEEE80211_T_HT, 4, 60, 60 },
{  0x89, 9, IEEE80211_T_HT, 4, 60, 60 },
@@ -546,6 +547,16 @@ static const struct rt2860_rate {
{  0x8d, 13, IEEE80211_T_HT, 4, 60, 60 },
{  0x8e, 14, IEEE80211_T_HT, 4, 60, 60 },
{  0x8f, 15, IEEE80211_T_HT, 4, 60, 60 },
+
+   /* MCS - 3 streams */
+   {  0x90, 16, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x91, 17, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x92, 18, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x93, 19, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x94, 20, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x95, 21, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x96, 22, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x97, 23, IEEE80211_T_HT, 4, 60, 60 },
 };
 
 /* These are indexes into the above rt2860_rates[] array */
@@ -553,7 +564,7 @@ static const struct rt2860_rate {
 #defineRT2860_RIDX_CCK11   3
 #defineRT2860_RIDX_OFDM6   4
 #defineRT2860_RIDX_MCS012
-#defineRT2860_RIDX_MAX 28
+#defineRT2860_RIDX_MAX 36
 
 static const struct {
uint16_treg;
@@ -859,12 +870,8 @@ run_attach(device_t self)
IEEE80211_HTCAP_MAXAMSDU_3839 |
IEEE80211_HTCAP_SMPS_OFF;
 
-   /*
-* For now, just do 1 stream.  Later on we'll figure out
-* how many tx/rx streams a particular NIC supports.
-*/
-   ic->ic_rxstream = 1;
-   ic->ic_txstream = 1;
+   ic->ic_rxstream = sc->nrxchains;
+   ic->ic_txstream = sc->ntxchains;
}
 
ic->ic_cryptocaps =
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361726 - head/sys/dev/usb/wlan

2020-06-02 Thread Adrian Chadd
Author: adrian
Date: Tue Jun  2 16:40:58 2020
New Revision: 361726
URL: https://svnweb.freebsd.org/changeset/base/361726

Log:
  [run] Add 11NA flags for 5G NICs that support HT.
  
  Now that I'm a proud owner of an ASUS USB-N66, I can test 2G/5G and
  3-stream configurations.
  
  For now, just flip on 5G HT rates.  I've tested this in both
  5G HT20 and 5G 11a modes.  It's still one stream for now until
  we verify that the number of streams reported (ie the MIMO below)
  is actually the number of 11n streams, NOT the number of antennas.
  (They don't have to match! You can have more antennas than MIMO
  streams!)
  
  Tested:
  
  * run0: MAC/BBP RT3593 (rev 0x0402), RF RT3053 (MIMO 3T3R)

Modified:
  head/sys/dev/usb/wlan/if_run.c

Modified: head/sys/dev/usb/wlan/if_run.c
==
--- head/sys/dev/usb/wlan/if_run.c  Tue Jun  2 16:20:58 2020
(r361725)
+++ head/sys/dev/usb/wlan/if_run.c  Tue Jun  2 16:40:58 2020
(r361726)
@@ -4943,6 +4943,8 @@ run_getradiocaps(struct ieee80211com *ic,
sc->rf_rev == RT3070_RF_3052 || sc->rf_rev == RT3593_RF_3053 ||
sc->rf_rev == RT5592_RF_5592) {
setbit(bands, IEEE80211_MODE_11A);
+   if (sc->rf_rev != RT3070_RF_2020)
+   setbit(bands, IEEE80211_MODE_11NA);
/* Note: for now, only support HT20 channels */
ieee80211_add_channel_list_5ghz(chans, maxchans, nchans,
run_chan_5ghz, nitems(run_chan_5ghz), bands, 0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361687 - head/sys/dev/ath

2020-05-31 Thread Adrian Chadd
Author: adrian
Date: Mon Jun  1 06:10:25 2020
New Revision: 361687
URL: https://svnweb.freebsd.org/changeset/base/361687

Log:
  [ath] Don't re-program the beacon timers if we miss a beacon in 
software-beacon STA mode.
  
  This is something I added a few years ago to handle resyncing the beacon if
  we miss a beacon or need to sync after association/reassociation/powersave.
  
  However, if we're doing STA+AP mode (eg DWDS) then we don't want
  to reprogram the beacons here; this may upset normal AP operation.
  I missed checking for the sc->sc_swbmiss flag so I was reinitialising
  the beacon timers after every beacon miss / TSFOOR option, and
  that isn't likely good.
  
  This plus ensuring that STA's are created with "-beacon" to disable
  BMISS/TSFOOR processing will hopefully quieten some of the issues
  I've seen with missed beacons / TSFOOR (out of range) interrupts
  coming in when operating in STA mode.
  
  Tested:
  
  * AR9380/AR9580, STA+AP modes

Modified:
  head/sys/dev/ath/if_ath_rx.c

Modified: head/sys/dev/ath/if_ath_rx.c
==
--- head/sys/dev/ath/if_ath_rx.cMon Jun  1 05:14:01 2020
(r361686)
+++ head/sys/dev/ath/if_ath_rx.cMon Jun  1 06:10:25 2020
(r361687)
@@ -447,9 +447,17 @@ ath_recv_mgmt(struct ieee80211_node *ni, struct mbuf *
(unsigned int) (nexttbtt >> 10),
(int32_t) tsf_beacon - (int32_t) nexttbtt + 
tsf_intval);
 
-   /* We only do syncbeacon on STA VAPs; not on IBSS */
+   /*
+* We only do syncbeacon on STA VAPs; not on IBSS;
+* but don't do it with swbmiss enabled or we
+* may end up overwriting AP mode beacon config.
+*
+* The driver (and net80211) should be smarter about
+* this..
+*/
if (vap->iv_opmode == IEEE80211_M_STA &&
sc->sc_syncbeacon &&
+   (!sc->sc_swbmiss) &&
ni == vap->iv_bss &&
(vap->iv_state == IEEE80211_S_RUN || vap->iv_state 
== IEEE80211_S_SLEEP)) {
DPRINTF(sc, ATH_DEBUG_BEACON,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361637 - head/sys/dev/usb/wlan

2020-05-29 Thread Adrian Chadd
Author: adrian
Date: Sat May 30 00:07:42 2020
New Revision: 361637
URL: https://svnweb.freebsd.org/changeset/base/361637

Log:
  [run] Don't add 11ng channels (2GHz) for RF2020
  
  Don't also add the 11ng channels if we're not in 11n mode or net80211 will
  get super weird.

Modified:
  head/sys/dev/usb/wlan/if_run.c

Modified: head/sys/dev/usb/wlan/if_run.c
==
--- head/sys/dev/usb/wlan/if_run.c  Sat May 30 00:06:26 2020
(r361636)
+++ head/sys/dev/usb/wlan/if_run.c  Sat May 30 00:07:42 2020
(r361637)
@@ -4933,7 +4933,8 @@ run_getradiocaps(struct ieee80211com *ic,
memset(bands, 0, sizeof(bands));
setbit(bands, IEEE80211_MODE_11B);
setbit(bands, IEEE80211_MODE_11G);
-   setbit(bands, IEEE80211_MODE_11NG);
+   if (sc->rf_rev != RT3070_RF_2020)
+   setbit(bands, IEEE80211_MODE_11NG);
 
/* Note: for now, only support HT20 channels */
ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0);
@@ -4942,7 +4943,6 @@ run_getradiocaps(struct ieee80211com *ic,
sc->rf_rev == RT3070_RF_3052 || sc->rf_rev == RT3593_RF_3053 ||
sc->rf_rev == RT5592_RF_5592) {
setbit(bands, IEEE80211_MODE_11A);
-   setbit(bands, IEEE80211_MODE_11NA);
/* Note: for now, only support HT20 channels */
ieee80211_add_channel_list_5ghz(chans, maxchans, nchans,
run_chan_5ghz, nitems(run_chan_5ghz), bands, 0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361636 - head/sys/dev/usb/wlan

2020-05-29 Thread Adrian Chadd
Author: adrian
Date: Sat May 30 00:06:26 2020
New Revision: 361636
URL: https://svnweb.freebsd.org/changeset/base/361636

Log:
  [run] Set ampdu rxmax same as linux; RF2020 isn't an 11n NIC
  
  This is from the linux driver:
  
  * set the ampdu rx max to 32k for 1 stream devics like mine, and
64k for larger ones
  * Don't enable 11n bits for RF2020

Modified:
  head/sys/dev/usb/wlan/if_run.c

Modified: head/sys/dev/usb/wlan/if_run.c
==
--- head/sys/dev/usb/wlan/if_run.c  Fri May 29 19:44:18 2020
(r361635)
+++ head/sys/dev/usb/wlan/if_run.c  Sat May 30 00:06:26 2020
(r361636)
@@ -847,20 +847,26 @@ run_attach(device_t self)
IEEE80211_C_WME |   /* WME */
IEEE80211_C_WPA;/* WPA1|WPA2(RSN) */
 
-   ic->ic_htcaps =
-   IEEE80211_HTC_HT |
-   IEEE80211_HTC_AMPDU |
-   IEEE80211_HTC_AMSDU |
-   IEEE80211_HTCAP_MAXAMSDU_3839 |
-   IEEE80211_HTCAP_SMPS_OFF;
-
/*
-* For now, just do 1 stream.  Later on we'll figure out
-* how many tx/rx streams a particular NIC supports.
+* RF2020 is not an 11n device.
 */
-   ic->ic_rxstream = 1;
-   ic->ic_txstream = 1;
+   if (sc->rf_rev != RT3070_RF_2020) {
+   device_printf(sc->sc_dev, "[HT] Enabling 802.11n\n");
+   ic->ic_htcaps =
+   IEEE80211_HTC_HT |
+   IEEE80211_HTC_AMPDU |
+   IEEE80211_HTC_AMSDU |
+   IEEE80211_HTCAP_MAXAMSDU_3839 |
+   IEEE80211_HTCAP_SMPS_OFF;
 
+   /*
+* For now, just do 1 stream.  Later on we'll figure out
+* how many tx/rx streams a particular NIC supports.
+*/
+   ic->ic_rxstream = 1;
+   ic->ic_txstream = 1;
+   }
+
ic->ic_cryptocaps =
IEEE80211_CRYPTO_WEP |
IEEE80211_CRYPTO_AES_CCM |
@@ -1028,8 +1034,15 @@ run_vap_create(struct ieee80211com *ic, const char nam
vap->iv_update_beacon = run_update_beacon;
vap->iv_max_aid = RT2870_WCID_MAX;
 
-   vap->iv_ampdu_rxmax = IEEE80211_HTCAP_MAXRXAMPDU_64K;
-   vap->iv_ampdu_density = IEEE80211_HTCAP_MPDUDENSITY_2;
+   /*
+* The linux rt2800 driver limits 1 stream devices to a 32KB
+* RX AMPDU.
+*/
+   if (ic->ic_rxstream > 1)
+   vap->iv_ampdu_rxmax = IEEE80211_HTCAP_MAXRXAMPDU_64K;
+   else
+   vap->iv_ampdu_rxmax = IEEE80211_HTCAP_MAXRXAMPDU_32K;
+   vap->iv_ampdu_density = IEEE80211_HTCAP_MPDUDENSITY_2; /* 2uS */
 
/*
 * To delete the right key from h/w, we need wcid.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361626 - head/sys/dev/usb/wlan

2020-05-29 Thread Adrian Chadd
Author: adrian
Date: Fri May 29 15:56:44 2020
New Revision: 361626
URL: https://svnweb.freebsd.org/changeset/base/361626

Log:
  [run] Add initial 802.11n support.
  
  * Enable self-generated 11n frames
  * add MCS rates for 1-stream and 2-stream rates; will do 3-stream
once the rest of this tests out OK with other people.
  * Hard-code 1 stream for now
  * Add A-MPDU RX mbuf tagging
  * RTS/CTS if doing RTSCTS in HT protmode as well as legacy; they're
separate configuration flags
  * Update the amrr rate index stuff - walk the rates array like others
to find the right one - this now works for MCS and CCK/OFDM rates
  * Add support for atheros fast frames/AMSDU support as we can generate
those in net80211.
  
  TODO:
  
  * HT40 isn't enabled yet
  * No A-MPDU support just yet; that requires some more firmware research
and maybe porting some ath(4) A-MPDU support/tracking into net80211
  * Short preamble flags aren't set yet for MCS; need to check the linux
driver and see what's going on there
  * Add 3x3 rates and set tx/rx stream configuration appropriately
  * More 5GHz testing; I have a 3x3 dual band USB NIC coming soon that'll
let me test this.
  * Figure out why the RX path isn't performing as fast as it could -
there's only a single buffer loaded at a time for the receive path
in the USB bulk handler and this may not be super useful.
  
  Tested:
  
  * RT5390 usb, 1x1, RF5370 (2GHz radio), STA mode - A-MSDU TX, A-MPDU RX
  
  Submitted by: Ashish Gupta 
  Differential Revision:https://reviews.freebsd.org/D22840

Modified:
  head/sys/dev/usb/wlan/if_run.c
  head/sys/dev/usb/wlan/if_runreg.h
  head/sys/dev/usb/wlan/if_runvar.h

Modified: head/sys/dev/usb/wlan/if_run.c
==
--- head/sys/dev/usb/wlan/if_run.c  Fri May 29 13:07:52 2020
(r361625)
+++ head/sys/dev/usb/wlan/if_run.c  Fri May 29 15:56:44 2020
(r361626)
@@ -64,6 +64,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#ifdef IEEE80211_SUPPORT_SUPERG
+#include 
+#endif
 
 #include 
 #include 
@@ -495,6 +498,9 @@ static void run_adjust_freq_offset(struct run_softc *)
 static voidrun_init_locked(struct run_softc *);
 static voidrun_stop(void *);
 static voidrun_delay(struct run_softc *, u_int);
+static voidrun_update_chw(struct ieee80211com *ic);
+static int run_ampdu_enable(struct ieee80211_node *ni,
+   struct ieee80211_tx_ampdu *tap);
 
 static eventhandler_tag run_etag;
 
@@ -506,10 +512,13 @@ static const struct rt2860_rate {
uint16_tsp_ack_dur;
uint16_tlp_ack_dur;
 } rt2860_rates[] = {
+   /* CCK rates (11b) */
{   2, 0, IEEE80211_T_DS,   0, 314, 314 },
{   4, 1, IEEE80211_T_DS,   1, 258, 162 },
{  11, 2, IEEE80211_T_DS,   2, 223, 127 },
{  22, 3, IEEE80211_T_DS,   3, 213, 117 },
+
+   /* OFDM rates (11a / 11g) */
{  12, 0, IEEE80211_T_OFDM, 4,  60,  60 },
{  18, 1, IEEE80211_T_OFDM, 4,  52,  52 },
{  24, 2, IEEE80211_T_OFDM, 6,  48,  48 },
@@ -517,9 +526,35 @@ static const struct rt2860_rate {
{  48, 4, IEEE80211_T_OFDM, 8,  44,  44 },
{  72, 5, IEEE80211_T_OFDM, 8,  40,  40 },
{  96, 6, IEEE80211_T_OFDM, 8,  40,  40 },
-   { 108, 7, IEEE80211_T_OFDM, 8,  40,  40 }
+   { 108, 7, IEEE80211_T_OFDM, 8,  40,  40 },
+
+   /* MCS - single stream */
+   {  0x80, 0, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x81, 1, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x82, 2, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x83, 3, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x84, 4, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x85, 5, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x86, 6, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x87, 7, IEEE80211_T_HT, 4, 60, 60 },
+   /* MCS - 2 streams */
+   {  0x88, 8, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x89, 9, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x8a, 10, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x8b, 11, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x8c, 12, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x8d, 13, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x8e, 14, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x8f, 15, IEEE80211_T_HT, 4, 60, 60 },
 };
 
+/* These are indexes into the above rt2860_rates[] array */
+#defineRT2860_RIDX_CCK10
+#defineRT2860_RIDX_CCK11   3
+#defineRT2860_RIDX_OFDM6   4
+#defineRT2860_RIDX_MCS012
+#defineRT2860_RIDX_MAX 28
+
 static const struct {
uint16_treg;
uint32_tval;
@@ -807,9 +842,25 @@ run_attach(device_t self)
IEEE80211_C_MBSS |
IEEE80211_C_SHPREAMBLE |/* short preamble supported */
IEEE80211_C_SHSLOT |/* short slot time supported */
+   IEEE80211_C_SWAMSDUTX | /* Do software A-MSDU TX */

svn commit: r361612 - head/sys/mips/mips

2020-05-28 Thread Adrian Chadd
Author: adrian
Date: Fri May 29 00:05:43 2020
New Revision: 361612
URL: https://svnweb.freebsd.org/changeset/base/361612

Log:
  [mips] fix up the assembly generation of unaligned exception loads
  
  I noticed that unaligned accesses were returning garbage values.
  
  Give test data like this:
  
  char testdata[] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf1, 0x23, 
0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x5a };
  
  Iterating through uint32_t space 1 byte at a time should
  look like this:
  
  freebsd-carambola2:/mnt# ./test
  Hello, world!
  offset 0 pointer 0x410b00 value 0x12345678 0x12345678
  offset 1 pointer 0x410b01 value 0x3456789a 0x3456789a
  offset 2 pointer 0x410b02 value 0x56789abc 0x56789abc
  offset 3 pointer 0x410b03 value 0x789abcde 0x789abcde
  offset 4 pointer 0x410b04 value 0x9abcdef1 0x9abcdef1
  offset 5 pointer 0x410b05 value 0xbcdef123 0xbcdef123
  offset 6 pointer 0x410b06 value 0xdef12345 0xdef12345
  offset 7 pointer 0x410b07 value 0xf1234567 0xf1234567
  
  .. but to begin with it looked like this:
  
  offset 0 value 0x12345678
  offset 1 value 0x00410a9a
  offset 2 value 0x00419abc
  offset 3 value 0x009abcde
  offset 4 value 0x9abcdef1
  offset 5 value 0x00410a23
  offset 6 value 0x00412345
  offset 7 value 0x00234567
  
  The amusing reason? The compiler is generating the lwr/lwl incorrectly.
  Here's an example after I tried to replace the two macros with a single
  invocation and offset, rather than having the compiler compile in addiu
  to s3 - but the bug is the same:
  
  1044: 8a620003 lwl v0,0(s3)
  1048: 9a73 lwr s3,3(s3)
  
  .. which is just totally trashy and wrong.
  
  This explicitly tells the compiler to treat the output as being read
  and written to, which is what lwl/lwr does with the destination
  register.
  
  I think a subsequent commit should unify these macros to skip an addiu,
  but that can be a later commit.
  
  Reviewed by:  jhb
  Differential Revision:https://reviews.freebsd.org/D25040

Modified:
  head/sys/mips/mips/trap.c

Modified: head/sys/mips/mips/trap.c
==
--- head/sys/mips/mips/trap.c   Fri May 29 00:01:47 2020(r361611)
+++ head/sys/mips/mips/trap.c   Fri May 29 00:05:43 2020(r361612)
@@ -114,22 +114,22 @@ SYSCTL_INT(_machdep, OID_AUTO, trap_debug, CTLFLAG_RW,
 
 #definelwl_macro(data, addr)   
\
__asm __volatile ("lwl %0, 0x0(%1)" \
-   : "=r" (data)   /* outputs */   \
+   : "+r" (data)   /* outputs */   \
: "r" (addr));  /* inputs */
 
 #definelwr_macro(data, addr)   
\
__asm __volatile ("lwr %0, 0x0(%1)" \
-   : "=r" (data)   /* outputs */   \
+   : "+r" (data)   /* outputs */   \
: "r" (addr));  /* inputs */
 
 #defineldl_macro(data, addr)   
\
__asm __volatile ("ldl %0, 0x0(%1)" \
-   : "=r" (data)   /* outputs */   \
+   : "+r" (data)   /* outputs */   \
: "r" (addr));  /* inputs */
 
 #defineldr_macro(data, addr)   
\
__asm __volatile ("ldr %0, 0x0(%1)" \
-   : "=r" (data)   /* outputs */   \
+   : "+r" (data)   /* outputs */   \
: "r" (addr));  /* inputs */
 
 #definesb_macro(data, addr)
\
@@ -1528,7 +1528,7 @@ mips_unaligned_load_store(struct trapframe *frame, int
 {
register_t *reg = (register_t *) frame;
u_int32_t inst = *((u_int32_t *)(intptr_t)pc);
-   register_t value_msb, value;
+   register_t value_msb = 0, value = 0;
unsigned size;
 
/*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361566 - head/sys/dev/ath/ath_rate/sample

2020-05-27 Thread Adrian Chadd
Author: adrian
Date: Wed May 27 22:48:34 2020
New Revision: 361566
URL: https://svnweb.freebsd.org/changeset/base/361566

Log:
  [ath] Update ath_rate_sample to use the same base type as ticks.
  
  Until net80211 grows a specific ticks type that matches the system,
  manually use the same type as the kernel/net80211 'ticks' type
  (signed int.)
  
  Tested:
  
  * AR9380, STA mode

Modified:
  head/sys/dev/ath/ath_rate/sample/sample.h

Modified: head/sys/dev/ath/ath_rate/sample/sample.h
==
--- head/sys/dev/ath/ath_rate/sample/sample.h   Wed May 27 22:34:46 2020
(r361565)
+++ head/sys/dev/ath/ath_rate/sample/sample.h   Wed May 27 22:48:34 2020
(r361566)
@@ -105,7 +105,7 @@ struct sample_node {
 
int current_rix[NUM_PACKET_SIZE_BINS];
int packets_since_switch[NUM_PACKET_SIZE_BINS];
-   unsigned ticks_since_switch[NUM_PACKET_SIZE_BINS];
+   int ticks_since_switch[NUM_PACKET_SIZE_BINS];
 
int packets_since_sample[NUM_PACKET_SIZE_BINS];
unsigned sample_tt[NUM_PACKET_SIZE_BINS];
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361560 - head/sys/net80211

2020-05-27 Thread Adrian Chadd
Author: adrian
Date: Wed May 27 18:32:12 2020
New Revision: 361560
URL: https://svnweb.freebsd.org/changeset/base/361560

Log:
  [net80211] Fix interrupted scan logic and ticks comparison
  
  The scan task refactoring stuff circa 2014-2016 broke the blocking task
   into a taskqueue with some async bits, but it apparently broke scans
   being interrupted by traffic.
  
  Notably - the new "field" SCAN_PAUSE sets both SCAN_INTERRUPT and SCAN_CANCEL,
  and a bunch of existing code was checking for SCAN_CANCEL only and breaking
  the scan. Unfortunately it was then (a) cancelling the scan entirely and
  (b) not notifying userland that scan was done.
  
  So:
  * Update the calls to scan_end() to only pass in 1 (saying the scan is 
complete)
if SCAN_CANCEL is set WITHOUT SCAN_INTERRUPT. If both are set then yes,
the scan is interrupted, but it isn't canceled - it's just paused.
  * Update the "did the scan flags change whilst the driver was called" logic
to check for canceled scans, not interrupted scans.
  * The "scan done" logic now explicitly checks for either interrupted or
completed scans. This accounts for the situation where a scan is being
aborted via traffic but it ALSO happens to have finished (ie the last
channel was checked.)
  
  This doesn't ENTIRELY fix scanning as the resume function is broken
  due to incorrect ticks math. Thus, the second half of this patch
  changes the ieee80211_ticks_*() macros to use int instead of long,
  matching the logic that the TCP code does with ticks and handles
  wrapping / negative ticks values. If cast to long then the wrapping
  math wouldn't work right (ie, if ticks was actually negative,
  ie, after the system has been up for a while.)
  
  This allows contbgscan() to correctly calculate if a scan should
  continue based on ticks and ic->ic_lastdata .
  
  Reviewed by:  bz
  Differential Revision:https://reviews.freebsd.org/D25031

Modified:
  head/sys/net80211/ieee80211_freebsd.h
  head/sys/net80211/ieee80211_scan_sw.c

Modified: head/sys/net80211/ieee80211_freebsd.h
==
--- head/sys/net80211/ieee80211_freebsd.h   Wed May 27 18:26:10 2020
(r361559)
+++ head/sys/net80211/ieee80211_freebsd.h   Wed May 27 18:32:12 2020
(r361560)
@@ -254,9 +254,9 @@ voidieee80211_vap_destroy(struct ieee80211vap *);
 #defineticks_to_msecs(t)   TICKS_2_MSEC(t)
 #defineticks_to_secs(t)((t) / hz)
 
-#define ieee80211_time_after(a,b)  ((long)(b) - (long)(a) < 0)
+#define ieee80211_time_after(a,b)  ((int)(b) - (int)(a) < 0)
 #define ieee80211_time_before(a,b) ieee80211_time_after(b,a)
-#define ieee80211_time_after_eq(a,b)   ((long)(a) - (long)(b) >= 0)
+#define ieee80211_time_after_eq(a,b)   ((int)(a) - (int)(b) >= 0)
 #define ieee80211_time_before_eq(a,b)  ieee80211_time_after_eq(b,a)
 
 struct mbuf *ieee80211_getmgtframe(uint8_t **frm, int headroom, int pktlen);

Modified: head/sys/net80211/ieee80211_scan_sw.c
==
--- head/sys/net80211/ieee80211_scan_sw.c   Wed May 27 18:26:10 2020
(r361559)
+++ head/sys/net80211/ieee80211_scan_sw.c   Wed May 27 18:32:12 2020
(r361560)
@@ -675,19 +675,32 @@ scan_curchan_task(void *arg, int pending)
struct ieee80211com *ic = ss->ss_ic;
struct ieee80211_channel *chan;
unsigned long maxdwell;
-   int scandone;
+   int scandone, scanstop;
 
IEEE80211_LOCK(ic);
 end:
+   /*
+* Note: only /end/ the scan if we're CANCEL rather than
+* CANCEL+INTERRUPT (ie, 'PAUSE').
+*
+* We can stop the scan if we hit cancel, but we shouldn't
+* call scan_end(ss, 1) if we're just PAUSEing the scan.
+*/
scandone = (ss->ss_next >= ss->ss_last) ||
-   (ss_priv->ss_iflags & ISCAN_CANCEL) != 0;
+   ((ss_priv->ss_iflags & ISCAN_PAUSE) == ISCAN_CANCEL);
+   scanstop = (ss->ss_next >= ss->ss_last) ||
+   ((ss_priv->ss_iflags & ISCAN_CANCEL) != 0);
 
IEEE80211_DPRINTF(ss->ss_vap, IEEE80211_MSG_SCAN,
-   "%s: loop start; scandone=%d\n",
+   "%s: loop start; scandone=%d, scanstop=%d, ss_iflags=0x%x, 
ss_next=%u, ss_last=%u\n",
__func__,
-   scandone);
+   scandone,
+   scanstop,
+   (uint32_t) ss_priv->ss_iflags,
+   (uint32_t) ss->ss_next,
+   (uint32_t) ss->ss_last);
 
-   if (scandone || (ss->ss_flags & IEEE80211_SCAN_GOTPICK) ||
+   if (scanstop || (ss->ss_flags & IEEE80211_SCAN_GOTPICK) ||
(ss_priv->ss_iflags & ISCAN_ABORT) ||
 ieee80211_time_after(ticks + ss->ss_mindwell, 
ss_priv->ss_scanend)) {
ss_priv->ss_iflags &= ~ISCAN_RUNNING;
@@ -787,11 +800,12 @@ scan_end(struct ieee80211_scan_state *ss, int scandone
 * Since a cancellation may ha

svn commit: r361546 - head/sys/cam/ata

2020-05-26 Thread Adrian Chadd
Author: adrian
Date: Wed May 27 02:10:09 2020
New Revision: 361546
URL: https://svnweb.freebsd.org/changeset/base/361546

Log:
  [ata_da] remove duplicate definition; it trips up ye olde gcc-6 on mips32
  
  Checked first with: irc

Modified:
  head/sys/cam/ata/ata_da.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Wed May 27 01:35:46 2020(r361545)
+++ head/sys/cam/ata/ata_da.c   Wed May 27 02:10:09 2020(r361546)
@@ -836,7 +836,6 @@ static  voidadaasync(void *callback_arg, 
u_int32_t co
 static int adabitsysctl(SYSCTL_HANDLER_ARGS);
 static int adaflagssysctl(SYSCTL_HANDLER_ARGS);
 static int adazonesupsysctl(SYSCTL_HANDLER_ARGS);
-static int adazonesupsysctl(SYSCTL_HANDLER_ARGS);
 static voidadasysctlinit(void *context, int pending);
 static int adagetattr(struct bio *bp);
 static voidadasetflags(struct ada_softc *softc,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361486 - in head/sys: contrib/dev/ath/ath_hal/ar9300 dev/ath dev/ath/ath_hal/ar5416 dev/ath/ath_hal/ar9001 dev/ath/ath_hal/ar9002

2020-05-25 Thread Adrian Chadd
Author: adrian
Date: Mon May 25 22:31:45 2020
New Revision: 361486
URL: https://svnweb.freebsd.org/changeset/base/361486

Log:
  [ath] [ath_hal] Propagate the HAL_RESET_TYPE through to the chip reset; set 
it during ath_reset()
  
  Although I added the reset type field to ath_hal_reset() years ago,
  I never finished adding it both throughout the HALs and in if_ath.c.
  
  This will eventually deprecate the ath_hal force_full_reset option
  because it can be requested at the driver layer.
  
  So:
  
  * Teach ar5416ChipReset() and ar9300_chip_reset() about the HAL type
  * Use it in ar5416Reset() and ar9300_reset() when doing a full chip reset
  * Extend ath_reset() to include the HAL_RESET_TYPE parameter added in the 
above functions
  * Use HAL_RESET_NORMAL in most calls to ath_reset()
  * .. but use HAL_RESET_BBPANIC for the BB panics, and HAL_RESET_FORCE_COLD 
during fatal, beacon miss and other hardware related hangs.
  
  This should be a glorified no-op outside of actual hardware issues.
  I've tested things with ath_hal force_full_reset set to 1 for years now,
  so I know that feature and a full reset works (albeit much slower than
  a warm reset!) and it does unwedge hardware.
  
  The eventual aim is to use this for all the places where the driver
  detects a potential hang as well as if long calibration - ie, noise floor
  calibration - fails to complete. That's one of the big hardware related
  things that causes station mode operation to hang without easy recovery.
  
  Differential Revision:https://reviews.freebsd.org/D24981

Modified:
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.h
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_reset.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416.h
  head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
  head/sys/dev/ath/ath_hal/ar9001/ar9130_attach.c
  head/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c
  head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
  head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c
  head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_misc.h
  head/sys/dev/ath/if_ath_sysctl.c

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.h
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.hMon May 25 22:30:44 
2020(r361485)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.hMon May 25 22:31:45 
2020(r361486)
@@ -1390,7 +1390,7 @@ extern  void ar9300_wowoffload_download_ns_info(struct
 extern  HAL_BOOL ar9300_reset(struct ath_hal *ah, HAL_OPMODE opmode,
 struct ieee80211_channel *chan, HAL_HT_MACMODE macmode, u_int8_t 
txchainmask,
 u_int8_t rxchainmask, HAL_HT_EXTPROTSPACING extprotspacing,
-HAL_BOOL b_channel_change, HAL_STATUS *status, int is_scan);
+HAL_BOOL b_channel_change, HAL_STATUS *status, HAL_RESET_TYPE 
reset_type, int is_scan);
 extern HAL_BOOL ar9300_lean_channel_change(struct ath_hal *ah, HAL_OPMODE 
opmode, struct ieee80211_channel *chan,
 HAL_HT_MACMODE macmode, u_int8_t txchainmask, u_int8_t rxchainmask);
 extern  HAL_BOOL ar9300_set_reset_reg(struct ath_hal *ah, u_int32_t type);
@@ -1400,7 +1400,7 @@ extern  u_int16_t ar9300_is_single_ant_power_save_poss
 extern  void ar9300_set_operating_mode(struct ath_hal *ah, int opmode);
 extern  HAL_BOOL ar9300_phy_disable(struct ath_hal *ah);
 extern  HAL_BOOL ar9300_disable(struct ath_hal *ah);
-extern  HAL_BOOL ar9300_chip_reset(struct ath_hal *ah, struct 
ieee80211_channel *);
+extern  HAL_BOOL ar9300_chip_reset(struct ath_hal *ah, struct 
ieee80211_channel *, HAL_RESET_TYPE type);
 extern  HAL_BOOL ar9300_calibration(struct ath_hal *ah,  struct 
ieee80211_channel *chan,
 u_int8_t rxchainmask, HAL_BOOL longcal, HAL_BOOL *isIQdone, int 
is_scan, u_int32_t *sched_cals);
 extern  void ar9300_reset_cal_valid(struct ath_hal *ah,

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.cMon May 25 
22:30:44 2020(r361485)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.cMon May 25 
22:31:45 2020(r361486)
@@ -543,6 +543,7 @@ ar9300_reset_freebsd(struct ath_hal *ah, HAL_OPMODE op
HAL_HT_EXTPROTSPACING_20, /* always 20Mhz channel spacing */
bChannelChange,
status,
+   resetType,
AH_FALSE);   /* XXX should really extend ath_hal_reset() */
 
return (r);

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_reset.c
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_reset.c  Mon May 25 
22:30:44 2020(r361485)
+++ head/sys/contrib/dev/ath/ath_hal/ar

svn commit: r361321 - head/sys/dev/ath

2020-05-20 Thread Adrian Chadd
Author: adrian
Date: Thu May 21 04:35:12 2020
New Revision: 361321
URL: https://svnweb.freebsd.org/changeset/base/361321

Log:
  [ath] Hopefully recover better-er upon RX restart on AR9380.
  
  This is all very long-standing bug stuff that is touchy and still poorly
  documented. Ok, here goes.
  
  The basic bug:
  
  * deleting a VAP causes the RX path (and TX path too) to be restarted
without a full chip reset, which causes RX hangs on the AR9380 and later.
(ie, the ones with the newer DMA engine.)
  
  The basic fix:
  
  * do an RX flush when stopping RX in ath_vap_delete() to match what happens
when RX is stopped elsewhere.  This ensures any pending frames are completed
and we restart at the right spot; it also ensures we don't push new RX 
buffers
into the hardware if we're stopping receive.
  
  The other issues I found:
  
  * Don't bother checking the RX packet ring in the deferred read taskqueue;
that's specifically supposed to be for completing frames rather than
just yanking them off the receive ring.
  
  * Cancel/drain any pending deferred read taskqueue.  This isn't done inside
any locks so we should be super careful here.  This stops the hardware
being reprogrammed at the same time in another thread/CPU whilst we're
stopping RX.
  
  * .. (yes, this should be better serialised, but that's for another day. 
maybe.)
  
  * Add more debugging to trace what's going on here.
  
  And the fun bit:
  
  * Reinitialise the RX FIFO ONLY if we've been reset or stopped, rather than 
just
reset.  I noticed that after all the above was done I was STILL seeing 
RXEOL.
RXEOL isn't enabled on the AR9380 so I'd only see it if I was sending TX 
frames
(ie a ping where it'd be transmitted but never received) so I was not being
spammed by RXEOL.  So, as long as stuff is stopped, restart it.
  
  This seems to be doing the right thing in both AP and STA modes.
  
  What I should do next, if I ever get time:
  
  * as I said above, serialise the receive stop/start to include taskqueues
  * monitor RXEOL on the AR9380 and I keep seeing it spammed / lockups, just
go do a full chip reset to get things back on track. It sucks, but it
is better than nothing.
  
  Tested:
  
  * AR9380 AP/STA mode, adding/deleting a hostap VAP to trigger the TX/RX
queue stop/start; whilst also running an iperf through it.  Lots of times.
Lots.  Of.. Times.

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_rx_edma.c

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Thu May 21 04:26:20 2020(r361320)
+++ head/sys/dev/ath/if_ath.c   Thu May 21 04:35:12 2020(r361321)
@@ -1801,6 +1801,7 @@ ath_vap_delete(struct ieee80211vap *vap)
ath_hal_intrset(ah, 0); /* disable interrupts */
/* XXX Do all frames from all vaps/nodes need draining here? */
ath_stoprecv(sc, 1);/* stop recv side */
+   ath_rx_flush(sc);
ath_draintxq(sc, ATH_RESET_DEFAULT);/* stop hw xmit 
side */
}
 

Modified: head/sys/dev/ath/if_ath_rx_edma.c
==
--- head/sys/dev/ath/if_ath_rx_edma.c   Thu May 21 04:26:20 2020
(r361320)
+++ head/sys/dev/ath/if_ath_rx_edma.c   Thu May 21 04:35:12 2020
(r361321)
@@ -162,6 +162,9 @@ ath_edma_stoprecv(struct ath_softc *sc, int dodelay)
 {
struct ath_hal *ah = sc->sc_ah;
 
+   DPRINTF(sc, ATH_DEBUG_EDMA_RX, "%s: called, dodelay=%d\n",
+   __func__, dodelay);
+
ATH_RX_LOCK(sc);
 
ath_hal_stoppcurecv(ah);
@@ -191,6 +194,8 @@ ath_edma_stoprecv(struct ath_softc *sc, int dodelay)
sc->sc_rxedma[HAL_RX_QUEUE_LP].m_rxpending = NULL;
}
ATH_RX_UNLOCK(sc);
+
+   DPRINTF(sc, ATH_DEBUG_EDMA_RX, "%s: done\n", __func__);
 }
 
 /*
@@ -205,6 +210,8 @@ ath_edma_reinit_fifo(struct ath_softc *sc, HAL_RX_QUEU
struct ath_buf *bf;
int i, j;
 
+   DPRINTF(sc, ATH_DEBUG_EDMA_RX, "%s: called\n", __func__);
+
ATH_RX_LOCK_ASSERT(sc);
 
i = re->m_fifo_head;
@@ -227,6 +234,7 @@ ath_edma_reinit_fifo(struct ath_softc *sc, HAL_RX_QUEU
i,
re->m_fifo_tail);
}
+   DPRINTF(sc, ATH_DEBUG_EDMA_RX, "%s: done\n", __func__);
 }
 
 /*
@@ -237,6 +245,10 @@ ath_edma_startrecv(struct ath_softc *sc)
 {
struct ath_hal *ah = sc->sc_ah;
 
+   DPRINTF(sc, ATH_DEBUG_EDMA_RX,
+   "%s: called; resetted=%d, stopped=%d\n", __func__,
+   sc->sc_rx_resetted, sc->sc_rx_stopped);
+
ATH_RX_LOCK(sc);
 
/*
@@ -252,7 +264,7 @@ ath_edma_startrecv(struct ath_softc *sc)
/*
 * In theory the hardware has been initialised, right?
 */
-   if (sc->sc_rx_resetted == 1) {
+   if (sc-

svn commit: r361320 - head/sys/dev/ath

2020-05-20 Thread Adrian Chadd
Author: adrian
Date: Thu May 21 04:26:20 2020
New Revision: 361320
URL: https://svnweb.freebsd.org/changeset/base/361320

Log:
  [ath] reset hardware if this particular mac bug is seen.
  
  I have to dig into why I'm seeing it on chips as late as the AR9380 era
  stuff (as it's marked as an AR5416 bug, but who knows!) but i'm seeing
  aggregate TX frames complete with no blockack bit set.  So, everything
  should be treated as a failure and do a hardware reset for good measure.
  
  Tested:
  
  * AR9380, STA mode
  * AR9580 (5GHz), AP mode

Modified:
  head/sys/dev/ath/if_ath_tx.c

Modified: head/sys/dev/ath/if_ath_tx.c
==
--- head/sys/dev/ath/if_ath_tx.cThu May 21 03:53:45 2020
(r361319)
+++ head/sys/dev/ath/if_ath_tx.cThu May 21 04:26:20 2020
(r361320)
@@ -5011,7 +5011,11 @@ ath_tx_aggr_comp_aggr(struct ath_softc *sc, struct ath
"%s: AR5416 bug: hasba=%d; txok=%d, isaggr=%d, "
"seq_st=%d\n",
__func__, hasba, tx_ok, isaggr, seq_st);
-   /* XXX TODO: schedule an interface reset */
+   taskqueue_enqueue(sc->sc_tq, &sc->sc_fataltask);
+   /* And as we can't really trust the BA here .. */
+   ba[0] = 0;
+   ba[1] = 0;
+   seq_st = 0;
 #ifdef ATH_DEBUG
ath_printtxbuf(sc, bf_first,
sc->sc_ac2q[atid->ac]->axq_qnum, 0, 0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361319 - head/sys/dev/ath/ath_rate/sample

2020-05-20 Thread Adrian Chadd
Author: adrian
Date: Thu May 21 03:53:45 2020
New Revision: 361319
URL: https://svnweb.freebsd.org/changeset/base/361319

Log:
  [ath_rate_sample] Obey the maximum frame length even when using static rates.
  
  I wasn't enforcing the maximum packet length when using static rates
  so although the driver was enforcing it itself OK, the statistics were
  sometimes going into the wrong bin.
  
  Tested:
  
  * AR9380, STA mode

Modified:
  head/sys/dev/ath/ath_rate/sample/sample.c

Modified: head/sys/dev/ath/ath_rate/sample/sample.c
==
--- head/sys/dev/ath/ath_rate/sample/sample.c   Thu May 21 03:50:56 2020
(r361318)
+++ head/sys/dev/ath/ath_rate/sample/sample.c   Thu May 21 03:53:45 2020
(r361319)
@@ -165,6 +165,11 @@ static int ath_rate_sample_max_4ms_framelen[4][32] = {
  * MCS rate in the transmit schedule.
  *
  * Returns -1 if it's a legacy rate or no MRR.
+ *
+ * XXX TODO: this needs to be limited by the RTS/CTS AR5416 8KB bug limit!
+ * (by checking rts/cts flags and applying sc_rts_aggr_limit)
+ *
+ * XXX TODO: apply per-node max-ampdu size and driver ampdu size limits too.
  */
 static int
 ath_rate_sample_find_min_pktlength(struct ath_softc *sc,
@@ -693,6 +698,17 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_nod
if (sn->static_rix != -1) {
rix = sn->static_rix;
*try0 = ATH_TXMAXTRY;
+
+   /*
+* Ensure we limit max packet length here too!
+*/
+   max_pkt_len = ath_rate_sample_find_min_pktlength(sc, an,
+   sn->static_rix,
+   is_aggr);
+   if (max_pkt_len > 0) {
+   *maxpktlen = frameLen = MIN(frameLen, max_pkt_len);
+   size_bin = size_to_bin(frameLen);
+   }
goto done;
}
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361118 - head/sys/dev/ath/ath_rate/sample

2020-05-16 Thread Adrian Chadd
Author: adrian
Date: Sat May 16 21:59:41 2020
New Revision: 361118
URL: https://svnweb.freebsd.org/changeset/base/361118

Log:
  [ath_rate_sample] Fix correct status when completing frames with short 
failures.
  
  My preivous logic was a bit wrong.  This caused transmissions that failed due
  to a mix of short and long retries to count intermediate rates as OK if the
  LONG retry count indicated some retries had made it to this intermediate rate,
  but the SHORT retry count was the one that caused the whole transmit to fail.
  
  Now status is passed in again - and this is the status for the whole 
transmission -
  and then update_stats() does some quick math to see if the current 
transmission
  series hit its long retry count or not before updating things as a success
  or failure.

Modified:
  head/sys/dev/ath/ath_rate/sample/sample.c

Modified: head/sys/dev/ath/ath_rate/sample/sample.c
==
--- head/sys/dev/ath/ath_rate/sample/sample.c   Sat May 16 19:38:58 2020
(r361117)
+++ head/sys/dev/ath/ath_rate/sample/sample.c   Sat May 16 21:59:41 2020
(r361118)
@@ -933,6 +933,18 @@ ath_rate_setupxtxdesc(struct ath_softc *sc, struct ath
s3code, sched->t3); /* series 3 */
 }
 
+/*
+ * Update the current statistics.
+ *
+ * Note that status is for the FINAL transmit status, not this
+ * particular attempt.  So, check if tries > tries0 and if so
+ * assume this status failed.
+ *
+ * This is important because some failures are due to both
+ * short AND long retries; if the final issue was a short
+ * retry failure then we still want to account for the
+ * bad long retry attempts.
+ */
 static void
 update_stats(struct ath_softc *sc, struct ath_node *an, 
  int frame_size,
@@ -947,7 +959,7 @@ update_stats(struct ath_softc *sc, struct ath_node *an
 #endif
const int size_bin = size_to_bin(frame_size);
const int size = bin_to_size(size_bin);
-   int tt, tries_so_far;
+   int tt;
int is_ht40 = (an->an_node.ni_chw == 40);
int pct;
 
@@ -955,6 +967,15 @@ update_stats(struct ath_softc *sc, struct ath_node *an
return;
 
/*
+* Treat long retries as us exceeding retries, even
+* if the eventual attempt at some other MRR schedule
+* succeeded.
+*/
+   if (tries > tries0) {
+   status = HAL_TXERR_XRETRY;
+   }
+
+   /*
 * If status is FAIL then we treat all frames as bad.
 * This better accurately tracks EWMA and average TX time
 * because even if the eventual transmission succeeded,
@@ -971,7 +992,6 @@ update_stats(struct ath_softc *sc, struct ath_node *an
 */
tt = calc_usecs_unicast_packet(sc, size, rix0,
0 /* short_tries */, MIN(tries0, tries) - 1, is_ht40);
-   tries_so_far = tries0;
 
if (sn->stats[size_bin][rix0].total_packets < 
ssc->smoothing_minpackets) {
/* just average the first few packets */
@@ -1194,7 +1214,7 @@ ath_rate_tx_complete(struct ath_softc *sc, struct ath_
update_stats(sc, an, frame_size,
 rc[0].rix, rc[0].tries,
 short_tries, long_tries,
-long_tries > rc[0].tries,
+status,
 nframes, nbad);
long_tries -= rc[0].tries;
}
@@ -1203,7 +1223,7 @@ ath_rate_tx_complete(struct ath_softc *sc, struct ath_
update_stats(sc, an, frame_size,
 rc[1].rix, rc[1].tries,
 short_tries, long_tries,
-long_tries > rc[1].tries,
+status,
 nframes, nbad);
long_tries -= rc[1].tries;
}
@@ -1212,7 +1232,7 @@ ath_rate_tx_complete(struct ath_softc *sc, struct ath_
update_stats(sc, an, frame_size,
 rc[2].rix, rc[2].tries,
 short_tries, long_tries,
-long_tries > rc[2].tries,
+status,
 nframes, nbad);
long_tries -= rc[2].tries;
}
@@ -1221,7 +1241,7 @@ ath_rate_tx_complete(struct ath_softc *sc, struct ath_
update_stats(sc, an, frame_size,
 rc[3].rix, rc[3].tries,
 short_tries, long_tries,
-long_tries > rc[3].tries,
+status,
 nframes, nbad);
}
}
___

svn commit: r361115 - head/tools/tools/ath/athratestats

2020-05-16 Thread Adrian Chadd
Author: adrian
Date: Sat May 16 18:49:37 2020
New Revision: 361115
URL: https://svnweb.freebsd.org/changeset/base/361115

Log:
  [ath] Flip athratestats to use two columns for now.
  
  Yeah I have too many rates on the screen now...

Modified:
  head/tools/tools/ath/athratestats/main.c

Modified: head/tools/tools/ath/athratestats/main.c
==
--- head/tools/tools/ath/athratestats/main.cSat May 16 18:37:48 2020
(r361114)
+++ head/tools/tools/ath/athratestats/main.cSat May 16 18:49:37 2020
(r361115)
@@ -147,8 +147,11 @@ ath_sample_stats(struct ath_ratestats *r, struct ath_r
PRINTATTR_OFF(COLOR_PAIR(3) | A_BOLD);
}
PRINTMSG("   TX Rate  TXTOTAL:TXOK   EWMA  T/   F"
+   " avg last xmit  ");
+   PRINTMSG("   TX Rate  TXTOTAL:TXOK   EWMA  T/   F"
" avg last xmit\n");
for (mask = sn->ratemask, rix = 0; mask != 0; mask >>= 1, rix++) {
+   int c = 0;
if ((mask & 1) == 0)
continue;
for (y = 0; y < NUM_PACKET_SIZE_BINS; y++) {
@@ -165,7 +168,7 @@ ath_sample_stats(struct ath_ratestats *r, struct ath_r
PRINTATTR_ON(COLOR_PAIR(1) | A_BOLD);
 #endif
PRINTMSG("[%2u %s:%5u] %8ju:%-8ju "
-   "(%3d.%1d%%) %8ju/%4d %5uuS %u\n",
+   "(%3d.%1d%%) %8ju/%4d %5uuS %u ",
dot11rate(rt, rix),
dot11str(rt, rix),
bin_to_size(y),
@@ -187,7 +190,14 @@ ath_sample_stats(struct ath_ratestats *r, struct ath_r
else if (sn->stats[y][rix].ewma_pct / 10 < 75)
PRINTATTR_OFF(COLOR_PAIR(1) | A_BOLD);
 #endif
+   c++;
+   if (c == 2) {
+   PRINTMSG("\n");
+   c = 0;
+   }
}
+   if (c != 0)
+   PRINTMSG("\n");
}
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361107 - head/tools/tools/ath/athratestats

2020-05-15 Thread Adrian Chadd
Author: adrian
Date: Sat May 16 06:09:24 2020
New Revision: 361107
URL: https://svnweb.freebsd.org/changeset/base/361107

Log:
  [ath] ok ok, fix the indenting now that I have 5 column packet sizes.
  
  Now things line up nicely again.  There's a lot of them, and I don't have a 
long
  enough screen right now, but they at least line up right.

Modified:
  head/tools/tools/ath/athratestats/main.c

Modified: head/tools/tools/ath/athratestats/main.c
==
--- head/tools/tools/ath/athratestats/main.cSat May 16 05:07:45 2020
(r361106)
+++ head/tools/tools/ath/athratestats/main.cSat May 16 06:09:24 2020
(r361107)
@@ -146,7 +146,7 @@ ath_sample_stats(struct ath_ratestats *r, struct ath_r
sn->sample_tt[y]);
PRINTATTR_OFF(COLOR_PAIR(3) | A_BOLD);
}
-   PRINTMSG("   TX Rate TXTOTAL:TXOK   EWMA  T/   F"
+   PRINTMSG("   TX Rate  TXTOTAL:TXOK   EWMA  T/   F"
" avg last xmit\n");
for (mask = sn->ratemask, rix = 0; mask != 0; mask >>= 1, rix++) {
if ((mask & 1) == 0)
@@ -164,7 +164,7 @@ ath_sample_stats(struct ath_ratestats *r, struct ath_r
else if (sn->stats[y][rix].ewma_pct / 10 < 75)
PRINTATTR_ON(COLOR_PAIR(1) | A_BOLD);
 #endif
-   PRINTMSG("[%2u %s:%4u] %8ju:%-8ju "
+   PRINTMSG("[%2u %s:%5u] %8ju:%-8ju "
"(%3d.%1d%%) %8ju/%4d %5uuS %u\n",
dot11rate(rt, rix),
dot11str(rt, rix),
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361106 - in head/sys/dev/ath: . ath_rate/amrr ath_rate/onoe ath_rate/sample

2020-05-15 Thread Adrian Chadd
Author: adrian
Date: Sat May 16 05:07:45 2020
New Revision: 361106
URL: https://svnweb.freebsd.org/changeset/base/361106

Log:
  [ath_rate_sample] Limit the tx schedules for A-MPDU ; don't take short retries
  into account and remove the requirement that the MCS rate is "higher" if we're
   considering a new rate.
  
  Ok, another fun one.
  
  * In order for reliable non-software retried higher MCS rates, the TX 
schedules
(inconsistently!) use hard-coded lower rates at the end of the schedule.
Now, hard-coded is a problem because (a) it means that aggregate formation
is limited by the SLOWEST rate, so I never formed large AMDU frames for
3 stream rates, and (b) if the AP disables lower rates as base rates, it
complains about "unknown rix" every frame you transmit at that rate.
  
So, for now just disable the third and fourth schedule entry for AMPDUs.
Now I'm forming 32k and 64k aggregates for the higher density MCS rates
much more reliably.
  
It would be much nicer if the rate schedule stuff wasn't fixed but instead
I'd just populate ath_rc_series[] when I fetch the rates.  This is all a
holdover of ye olde pre-11n stuff and I really just need to nuke it.
  
But for now, ye hack.
  
  * The check for "is this MCS rate better" based on MCS itself is just garbage.
It meant things like going MCS0->7 would be fine, and say 0->8->16 is fine,
(as they're equivalent encoding but 1,2,3 spatial streams), BUT it meant
going something like MCS7->11 would fail even though it's likely that
MCS11 would just be better, both for EWMA/BER and throughput.
  
So for now just use the average tx time.  The "right" way for this 
comparison
would be to compare PHY bitrates rather than MCS / rate indexes, but I'm not
yet there.  The bit rates ARE available in the PHY index, but honestly
I have a lot of other cleaning up to here before I think about that.
  
  * Don't include the RTS/CTS retry count (and thus time) into the average tx 
time
caluation.  It just makes temporarily failures make the rate look bad by
QUITE A LOT, as RTS/CTS exchanges are (a) long, and (b) mostly irrelevant
to the actual rate being tried.  If we keep hitting RTS/CTS failures then
there's something ELSE wrong on the channel, not our selected rate.

Modified:
  head/sys/dev/ath/ath_rate/amrr/amrr.c
  head/sys/dev/ath/ath_rate/onoe/onoe.c
  head/sys/dev/ath/ath_rate/sample/sample.c
  head/sys/dev/ath/if_ath_tx.c
  head/sys/dev/ath/if_athrate.h

Modified: head/sys/dev/ath/ath_rate/amrr/amrr.c
==
--- head/sys/dev/ath/ath_rate/amrr/amrr.c   Sat May 16 04:52:29 2020
(r361105)
+++ head/sys/dev/ath/ath_rate/amrr/amrr.c   Sat May 16 05:07:45 2020
(r361106)
@@ -128,7 +128,7 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_nod
  */
 void
 ath_rate_getxtxrates(struct ath_softc *sc, struct ath_node *an,
-uint8_t rix0, struct ath_rc_series *rc)
+uint8_t rix0, int is_aggr, struct ath_rc_series *rc)
 {
struct amrr_node *amn = ATH_NODE_AMRR(an);
 

Modified: head/sys/dev/ath/ath_rate/onoe/onoe.c
==
--- head/sys/dev/ath/ath_rate/onoe/onoe.c   Sat May 16 04:52:29 2020
(r361105)
+++ head/sys/dev/ath/ath_rate/onoe/onoe.c   Sat May 16 05:07:45 2020
(r361106)
@@ -136,7 +136,7 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_nod
  */
 void
 ath_rate_getxtxrates(struct ath_softc *sc, struct ath_node *an,
-uint8_t rix0, struct ath_rc_series *rc)
+uint8_t rix0, int is_aggr, struct ath_rc_series *rc)
 {
struct onoe_node *on = ATH_NODE_ONOE(an);
 

Modified: head/sys/dev/ath/ath_rate/sample/sample.c
==
--- head/sys/dev/ath/ath_rate/sample/sample.c   Sat May 16 04:52:29 2020
(r361105)
+++ head/sys/dev/ath/ath_rate/sample/sample.c   Sat May 16 05:07:45 2020
(r361106)
@@ -168,7 +168,7 @@ static int ath_rate_sample_max_4ms_framelen[4][32] = {
  */
 static int
 ath_rate_sample_find_min_pktlength(struct ath_softc *sc,
-struct ath_node *an, uint8_t rix0)
+struct ath_node *an, uint8_t rix0, int is_aggr)
 {
 #defineMCS_IDX(ix) (rt->info[ix].dot11Rate)
const HAL_RATE_TABLE *rt = sc->sc_currates;
@@ -196,6 +196,24 @@ ath_rate_sample_find_min_pktlength(struct ath_softc *s
 * is not zero.
 *
 * Note: assuming all four PHYs are HT!
+*
+* XXX TODO: right now I hardcode here and in getxtxrates() that
+* rates 2 and 3 in the tx schedule are ignored.  This is important
+* for forming larger aggregates because right now (a) the tx schedule
+* per rate is fixed, and (b) reliable packet transmission at those
+* higher rates kinda needs a lower MCS rate in there somewhere.

svn commit: r361098 - head/sys/dev/ath/ath_rate/sample

2020-05-15 Thread Adrian Chadd
Author: adrian
Date: Sat May 16 01:56:06 2020
New Revision: 361098
URL: https://svnweb.freebsd.org/changeset/base/361098

Log:
  [ath_rate_sample] Fix logic for determining whether to bump up an MCS rate.
  
  * Fix formatting, cause reasons;
  * Put back the "and the chosen rate is within 90% of the current rate" logic;
  * Ensure the best rate and the current rate aren't the same; this ...
  * ... fixes the packets_since_switch[] tracking to actually conut how many
frames since the rate switched, so now I know how stable stuff is; and
  * Ensure that MCS can go up to a higher MCS at this or any other spatial 
stream.
My previous quick hack attempt was doing > rather than >= so you had to go
to both a higher root MCS rate (0..7) and spatial stream. Eg, you couldn't
go from MCS0 (1ss) to MCS8 (2ss) this way.
  
  The best rate and switching rate logic still have a bunch more work to do
  because they're still quite touchy when it comes to average tx time but at 
least
  now it's choosing higher rates correctly when it wants to try a higher rate.
  
  Tested:
  
  * AR9380, STA mode

Modified:
  head/sys/dev/ath/ath_rate/sample/sample.c

Modified: head/sys/dev/ath/ath_rate/sample/sample.c
==
--- head/sys/dev/ath/ath_rate/sample/sample.c   Sat May 16 01:50:28 2020
(r361097)
+++ head/sys/dev/ath/ath_rate/sample/sample.c   Sat May 16 01:56:06 2020
(r361098)
@@ -712,10 +712,13 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_nod
 * Limit the time measuring the performance of other tx
 * rates to sample_rate% of the total transmission time.
 */
-   if (sn->sample_tt[size_bin] < average_tx_time * 
(sn->packets_since_sample[size_bin]*ssc->sample_rate/100)) {
+   if (sn->sample_tt[size_bin] <
+   average_tx_time *
+   (sn->packets_since_sample[size_bin]*ssc->sample_rate/100)) {
rix = pick_sample_rate(ssc, an, rt, size_bin);
IEEE80211_NOTE(an->an_node.ni_vap, IEEE80211_MSG_RATECTL,
-&an->an_node, "att %d sample_tt %d size %u sample rate %d 
%s current rate %d %s",
+&an->an_node, "att %d sample_tt %d size %u "
+"sample rate %d %s current rate %d %s",
 average_tx_time,
 sn->sample_tt[size_bin],
 bin_to_size(size_bin),
@@ -776,12 +779,9 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_nod
printf("cur rix/att %x/%d, best rix/att %x/%d\n",
MCS(cur_rix), cur_att, MCS(best_rix), 
average_tx_time);
 #endif
-#if 0
-   if (((MCS(best_rix) & 0x7) > (MCS(cur_rix) & 0x7)) &&
-   (average_tx_time * 10) <= (cur_att * 10)) {
-#else
-   if ((average_tx_time * 10) <= (cur_att * 10)) {
-#endif
+   if ((best_rix != cur_rix) &&
+   ((MCS(best_rix) & 0x7) >= (MCS(cur_rix) & 0x7)) &&
+   (average_tx_time * 9) <= (cur_att * 10)) {
IEEE80211_NOTE(an->an_node.ni_vap,
IEEE80211_MSG_RATECTL, &an->an_node,
"%s: HT: size %d best_rix 0x%x > "
@@ -823,7 +823,9 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_nod
/* 
 * Set the visible txrate for this node.
 */
-   an->an_node.ni_txrate = (rt->info[best_rix].phy == 
IEEE80211_T_HT) ?  MCS(best_rix) : DOT11RATE(best_rix);
+   an->an_node.ni_txrate =
+   (rt->info[best_rix].phy == IEEE80211_T_HT) ?
+MCS(best_rix) : DOT11RATE(best_rix);
}
rix = sn->current_rix[size_bin];
sn->packets_since_switch[size_bin]++;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361087 - head/sys/dev/ath/ath_rate/sample

2020-05-15 Thread Adrian Chadd
Author: adrian
Date: Fri May 15 20:03:53 2020
New Revision: 361087
URL: https://svnweb.freebsd.org/changeset/base/361087

Log:
  [ath] [ath_rate_sample] le oops, trim out an #if 1 that I didn't fully delete.
  
  Cool, so now I know it's about 3 weeks between starting on freebsd coding
  and breaking the build again. Queue dunce cap.

Modified:
  head/sys/dev/ath/ath_rate/sample/sample.c

Modified: head/sys/dev/ath/ath_rate/sample/sample.c
==
--- head/sys/dev/ath/ath_rate/sample/sample.c   Fri May 15 20:01:30 2020
(r361086)
+++ head/sys/dev/ath/ath_rate/sample/sample.c   Fri May 15 20:03:53 2020
(r361087)
@@ -358,7 +358,6 @@ pick_best_rate(struct ath_node *an, const HAL_RATE_TAB
if (best_rate_pct > (pct + 50))
continue;
}
-#if 1
/*
 * For non-MCS rates, use the current average txtime for
 * comparison.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361085 - in head/sys/dev/ath: . ath_hal/ar5416 ath_rate/amrr ath_rate/onoe ath_rate/sample

2020-05-15 Thread Adrian Chadd
Author: adrian
Date: Fri May 15 18:51:20 2020
New Revision: 361085
URL: https://svnweb.freebsd.org/changeset/base/361085

Log:
  [ath] [ath_rate] Extend ath_rate_sample to better handle 11n rates and 
aggregates.
  
  My initial rate control code was .. suboptimal.  I wanted to at least get MCS
  rates sent, but it didn't do anywhere near enough to handle low signal level 
links
  or remotely keep accurate statistics.
  
  So, 8 years later, here's what I should've done back then.
  
  * Firstly, I wasn't at all tracking packet sizes other than the two buckets
(250 and 1600 bytes.)  So, extend it to include 4096, 8192, 16384, 32768 and
65536.  I may go add 2048 at some point if I find it's useful.
  
This is important for a few reasons.  First, when forming A-MPDU or AMSDU
aggregates the frame sizes are larger, and thus the TX time calculation
is woefully, increasingly wrong.  Secondly, the behaviour of 802.11 channels
isn't some fixed thing, both due to channel conditions and radios 
themselves.
Notably, there was some observations done a few years ago on 11n chipsets
which noticed longer aggregates showed an increase in failed A-MPDU 
sub-frame
reception as you got further along in the transmit time.  It could be due to
a variety of things - transmitter linearity, channel conditions changing,
frequency/phase drift, etc - but the observation was to potentially form
shorter aggregates to improve BER.
  
  * .. and then modify the ath TX path to report the length of the aggregate 
sent,
so as the statistics kept would line up with the correct bucket.
  
  * Then on the rate control look-up side - i was also only using the first 
frame
length for an A-MPDU rate control lookup which isn't good enough here.
So, add a new method that walks the TID software queue for that node to
find out what the likely length of data available is.  It isn't ALL of the
data in the queue because we'll only ever send enough data to fit inside the
block-ack window, so limit how many bytes we return to roughly what 
ath_tx_form_aggr()
would do.
  
  * .. and cache that in the first ath_buf in the aggregate so it and the 
eventual
AMPDU length can be returned to the rate control code.
  
  * THEN, modify the rate control code to look at them both when deciding which 
bucket
to attribute the sent frame on.  I'm erring on the side of caution and 
using the
size bucket that the lookup is based on.
  
  Ok, so now the rate lookups and statistics are "more correct".  However, MCS 
rates
  are not the same as 11abg rates in that they're not a monotonically 
incrementing
  set of faster rates and you can't assume that just because a given MCS rate 
fails,
  the next higher one wouldn't work better or be a lower average tx time.
  
  So, I had to do a bunch of surgery to the best rate and sample rate math.
  This is the bit that's a WIP.
  
  * First, simplify the statistics updates (update_stats()) to do a single pass 
on
all rates.
  * Next, make sure that each rate average tx time is updated based on /its/ 
failure/success.
Eg if you sent a frame with { MCS15, MCS12, MCS8 } and MCS8 succeeded, 
MCS15 and MCS
12 would have their average tx time updated for /their/ part of the 
transmission,
not the whole transmission.
  * Next, EWMA wasn't being fully calculated based on the /failures/ in each of 
the
rate attempts.  So, if MCS15, MCS12 failed above but MCS8 didn't, then 
ensure
that the statistics noted that /all/ subframes failed at those rates, 
rather than
the eventual set of transmitted/sent frames.   This ensures the EWMA /and/ 
average
TX time are updated correctly.
  * When picking a sample rate and initial rate, probe rates aroud the current 
MCS
but limit it to MCS0..7 /for all spatial streams/, rather than doing crazy 
things
like hitting MCS7 and then probing MCS8 - MCS8 is basically MCS0 but two 
spatial
streams.  It's a /lot/ slower than MCS7.  Also, the reverse is true - if 
we're at
MCS8 then don't probe MCS7 as part of it, it's not likely to succeed.
  * Fix bugs in pick_best_rate() where I was /immediately/ choosing the highest 
MCS
rate if there weren't any frames yet transmitted.  I was defaulting to 25% 
EWMA and
.. then each comparison would accept the higher rate.  Just skip those; 
sampling
will fill in the details.
  
  So, this seems to work a lot better.  It's not perfect; I'm still seeing a 
lot of
  instability around higher MCS rates because there are bursts of 
loss/retransmissions
  that aren't /too/ bad.  But i'll keep iterating over this and tidying up my 
hacks.
  
  Ok, so why this still something I'm poking at? rather than porting 
minstrel_ht?
  
  ath_rate_sample tries to minimise airtime, not maximise throughput.  I have
  extended it with an EWMA based on sub-frame success/failures - high MCS rates
  that have partially successful receptions still show 

svn commit: r361025 - head/tools/tools/ath/athratestats

2020-05-13 Thread Adrian Chadd
Author: adrian
Date: Thu May 14 05:01:18 2020
New Revision: 361025
URL: https://svnweb.freebsd.org/changeset/base/361025

Log:
  [ath] Extend the colours to 4, not 2.
  
  There's 8 bins in the upcoming changeset to ath/ath_rate, so I need
  more colours.  Yeah, I know.

Modified:
  head/tools/tools/ath/athratestats/main.c

Modified: head/tools/tools/ath/athratestats/main.c
==
--- head/tools/tools/ath/athratestats/main.cThu May 14 04:00:35 2020
(r361024)
+++ head/tools/tools/ath/athratestats/main.cThu May 14 05:01:18 2020
(r361025)
@@ -122,7 +122,7 @@ ath_sample_stats(struct ath_ratestats *r, struct ath_r
(long long) sn->ratemask);
 
for (y = 0; y < NUM_PACKET_SIZE_BINS; y++) {
-   PRINTATTR_ON(COLOR_PAIR(4 + (y % 2)) | A_BOLD);
+   PRINTATTR_ON(COLOR_PAIR(2 + (y % 4)) | A_BOLD);
PRINTMSG("[%4u] cur rate %d %s since switch: "
"packets %d ticks %u ",
bin_to_size(y),
@@ -132,17 +132,16 @@ ath_sample_stats(struct ath_ratestats *r, struct ath_r
sn->ticks_since_switch[y]);
 
PRINTMSG("last sample (%d %s) cur sample (%d %s) "
-   "packets sent %d\n",
+   "packets sent %d ",
dot11rate(rt, sn->last_sample_rix[y]),
dot11str(rt, sn->last_sample_rix[y]),
dot11rate(rt, sn->current_sample_rix[y]),
dot11str(rt, sn->current_sample_rix[y]),
sn->packets_sent[y]);
-   PRINTATTR_OFF(COLOR_PAIR(4 + (y % 2)) | A_BOLD);
+   PRINTATTR_OFF(COLOR_PAIR(2 + (y % 4)) | A_BOLD);

-   PRINTATTR_ON(COLOR_PAIR(3) | A_BOLD);
-   PRINTMSG("[%4u] packets since sample %d sample tt %u\n",
-   bin_to_size(y),
+   PRINTATTR_ON(COLOR_PAIR(1) | A_BOLD);
+   PRINTMSG("packets since sample %d sample tt %u\n",
sn->packets_since_sample[y],
sn->sample_tt[y]);
PRINTATTR_OFF(COLOR_PAIR(3) | A_BOLD);
@@ -156,9 +155,9 @@ ath_sample_stats(struct ath_ratestats *r, struct ath_r
if (sn->stats[y][rix].total_packets == 0)
continue;
if (rix == sn->current_rix[y])
-   PRINTATTR_ON(COLOR_PAIR(y+4) | A_BOLD);
+   PRINTATTR_ON(COLOR_PAIR(2 + (y % 4)) | A_BOLD);
else if (rix == sn->last_sample_rix[y])
-   PRINTATTR_ON(COLOR_PAIR(3) | A_BOLD);
+   PRINTATTR_ON(COLOR_PAIR(1) | A_BOLD);
 #if 0
else if (sn->stats[y][rix].ewma_pct / 10 < 50)
PRINTATTR_ON(COLOR_PAIR(2) | A_BOLD);
@@ -179,9 +178,9 @@ ath_sample_stats(struct ath_ratestats *r, struct ath_r
sn->stats[y][rix].average_tx_time,
sn->stats[y][rix].last_tx);
if (rix == sn->current_rix[y])
-   PRINTATTR_OFF(COLOR_PAIR(y+4) | A_BOLD);
+   PRINTATTR_OFF(COLOR_PAIR(2 + (y % 4)) | A_BOLD);
else if (rix == sn->last_sample_rix[y])
-   PRINTATTR_OFF(COLOR_PAIR(3) | A_BOLD);
+   PRINTATTR_OFF(COLOR_PAIR(1) | A_BOLD);
 #if 0
else if (sn->stats[y][rix].ewma_pct / 10 < 50)
PRINTATTR_OFF(COLOR_PAIR(2) | A_BOLD);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361009 - head/tools/tools/ath/athratestats

2020-05-13 Thread Adrian Chadd
Author: adrian
Date: Wed May 13 16:36:42 2020
New Revision: 361009
URL: https://svnweb.freebsd.org/changeset/base/361009

Log:
  [ath] Prepare for .. more sample rate control entries
  
  This is in preparation for me bumping how many size buckets are used
  for ath_rate_sample statistics.
  
  * Bump buffer size to 64k
  * Don't waste 4 lines per bucket size, condense it to two
  * Alternate colours; my logic made everything after the first two just
be black.  Oops.

Modified:
  head/tools/tools/ath/athratestats/main.c

Modified: head/tools/tools/ath/athratestats/main.c
==
--- head/tools/tools/ath/athratestats/main.cWed May 13 12:33:51 2020
(r361008)
+++ head/tools/tools/ath/athratestats/main.cWed May 13 16:36:42 2020
(r361009)
@@ -64,7 +64,7 @@ static int do_loop = 0;
  * This needs to be big enough to fit the two TLVs, the rate table
  * and the rate statistics table for a single node.
  */
-#defineSTATS_BUF_SIZE  8192
+#defineSTATS_BUF_SIZE  65536
 
 #definePRINTMSG(...) do {  \
if (do_loop == 0)   \
@@ -122,24 +122,23 @@ ath_sample_stats(struct ath_ratestats *r, struct ath_r
(long long) sn->ratemask);
 
for (y = 0; y < NUM_PACKET_SIZE_BINS; y++) {
-   PRINTATTR_ON(COLOR_PAIR(y+4) | A_BOLD);
+   PRINTATTR_ON(COLOR_PAIR(4 + (y % 2)) | A_BOLD);
PRINTMSG("[%4u] cur rate %d %s since switch: "
-   "packets %d ticks %u\n",
+   "packets %d ticks %u ",
bin_to_size(y),
dot11rate(rt, sn->current_rix[y]),
dot11str(rt, sn->current_rix[y]),
sn->packets_since_switch[y],
sn->ticks_since_switch[y]);
 
-   PRINTMSG("[%4u] last sample (%d %s) cur sample (%d %s) "
+   PRINTMSG("last sample (%d %s) cur sample (%d %s) "
"packets sent %d\n",
-   bin_to_size(y),
dot11rate(rt, sn->last_sample_rix[y]),
dot11str(rt, sn->last_sample_rix[y]),
dot11rate(rt, sn->current_sample_rix[y]),
dot11str(rt, sn->current_sample_rix[y]),
sn->packets_sent[y]);
-   PRINTATTR_OFF(COLOR_PAIR(y+4) | A_BOLD);
+   PRINTATTR_OFF(COLOR_PAIR(4 + (y % 2)) | A_BOLD);

PRINTATTR_ON(COLOR_PAIR(3) | A_BOLD);
PRINTMSG("[%4u] packets since sample %d sample tt %u\n",
@@ -147,7 +146,6 @@ ath_sample_stats(struct ath_ratestats *r, struct ath_r
sn->packets_since_sample[y],
sn->sample_tt[y]);
PRINTATTR_OFF(COLOR_PAIR(3) | A_BOLD);
-   PRINTMSG("\n");
}
PRINTMSG("   TX Rate TXTOTAL:TXOK   EWMA  T/   F"
" avg last xmit\n");
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r360998 - in head/sys/dev/ath: . ath_rate/amrr ath_rate/onoe ath_rate/sample

2020-05-12 Thread Adrian Chadd
Author: adrian
Date: Wed May 13 00:05:11 2020
New Revision: 360998
URL: https://svnweb.freebsd.org/changeset/base/360998

Log:
  [ath] [ath_rate] Add some extra data into the rate control lookup.
  
  Right now (well, since I did this in 2011/2012) the rate control code
  makes some super bad choices for 11n aggregates/rates, and it tracks
  statistics even more questionably.
  
  It's been long enough and I'm now trying to use it again daily, so let's
  start by:
  
  * telling the rate control code if it's an aggregate or not;
  * being clearer about the TID - yes it can be extracted from the
ath_buf but this way it can be overridden by the caller without
changing the TID itself.
  
(This is for doing experiments with voice/video QoS at some point..)
  
  * Return an optional field to limit how long the aggregate is in
microseconds.  Right now the rate control code supplies a rate table
and the ath aggr form code will look at the rate table and limit
the aggregate size to 4ms at the slowest rate.  Yeah, this is pretty
terrible.
  
  * Add some more TODO comments around handling txpower, rate and
handling filtered frames status so if I continue to have spoons for
this I can go poke at it.

Modified:
  head/sys/dev/ath/ath_rate/amrr/amrr.c
  head/sys/dev/ath/ath_rate/onoe/onoe.c
  head/sys/dev/ath/ath_rate/sample/sample.c
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_tx.c
  head/sys/dev/ath/if_athrate.h

Modified: head/sys/dev/ath/ath_rate/amrr/amrr.c
==
--- head/sys/dev/ath/ath_rate/amrr/amrr.c   Wed May 13 00:03:39 2020
(r360997)
+++ head/sys/dev/ath/ath_rate/amrr/amrr.c   Wed May 13 00:05:11 2020
(r360998)
@@ -104,8 +104,8 @@ ath_rate_node_cleanup(struct ath_softc *sc, struct ath
 
 void
 ath_rate_findrate(struct ath_softc *sc, struct ath_node *an,
-   int shortPreamble, size_t frameLen,
-   u_int8_t *rix, int *try0, u_int8_t *txrate)
+   int shortPreamble, size_t frameLen, int tid, bool is_aggr,
+   u_int8_t *rix, int *try0, u_int8_t *txrate, int *maxdur)
 {
struct amrr_node *amn = ATH_NODE_AMRR(an);
 
@@ -115,6 +115,7 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_nod
*txrate = amn->amn_tx_rate0sp;
else
*txrate = amn->amn_tx_rate0;
+   maxdur = -1;
 }
 
 /*

Modified: head/sys/dev/ath/ath_rate/onoe/onoe.c
==
--- head/sys/dev/ath/ath_rate/onoe/onoe.c   Wed May 13 00:03:39 2020
(r360997)
+++ head/sys/dev/ath/ath_rate/onoe/onoe.c   Wed May 13 00:05:11 2020
(r360998)
@@ -112,8 +112,8 @@ ath_rate_node_cleanup(struct ath_softc *sc, struct ath
 
 void
 ath_rate_findrate(struct ath_softc *sc, struct ath_node *an,
-   int shortPreamble, size_t frameLen,
-   u_int8_t *rix, int *try0, u_int8_t *txrate)
+   int shortPreamble, size_t frameLen, int tid, bool is_aggr,
+   u_int8_t *rix, int *try0, u_int8_t *txrate, int *maxdur)
 {
struct onoe_node *on = ATH_NODE_ONOE(an);
 
@@ -123,6 +123,7 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_nod
*txrate = on->on_tx_rate0sp;
else
*txrate = on->on_tx_rate0;
+   *maxdur = -1;
 }
 
 /*

Modified: head/sys/dev/ath/ath_rate/sample/sample.c
==
--- head/sys/dev/ath/ath_rate/sample/sample.c   Wed May 13 00:03:39 2020
(r360997)
+++ head/sys/dev/ath/ath_rate/sample/sample.c   Wed May 13 00:05:11 2020
(r360998)
@@ -482,8 +482,9 @@ ath_rate_pick_seed_rate_ht(struct ath_softc *sc, struc
 
 void
 ath_rate_findrate(struct ath_softc *sc, struct ath_node *an,
- int shortPreamble, size_t frameLen,
- u_int8_t *rix0, int *try0, u_int8_t *txrate)
+ int shortPreamble, size_t frameLen, int tid,
+ bool is_aggr, u_int8_t *rix0, int *try0,
+ u_int8_t *txrate, int *maxdur)
 {
 #defineDOT11RATE(ix)   (rt->info[ix].dot11Rate & IEEE80211_RATE_VAL)
 #defineMCS(ix) (rt->info[ix].dot11Rate | IEEE80211_RATE_MCS)
@@ -497,6 +498,10 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_nod
unsigned average_tx_time;
 
ath_rate_update_static_rix(sc, &an->an_node);
+
+   /* For now don't take TID, is_aggr into account */
+   /* Also for now don't calculate a max duration; that'll come later */
+   *maxdur = -1;
 
if (sn->currates != sc->sc_currates) {
device_printf(sc->sc_dev, "%s: currates != sc_currates!\n",

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Wed May 13 00:03:39 2020(r360997)
+++ head/sys/dev/ath/if_ath.c   Wed May 13 00:05:11 2020(r360998)
@@ -4312,6 +

svn commit: r360954 - head/sys/contrib/dev/ath/ath_hal/ar9300

2020-05-11 Thread Adrian Chadd
Author: adrian
Date: Tue May 12 02:23:11 2020
New Revision: 360954
URL: https://svnweb.freebsd.org/changeset/base/360954

Log:
  [ath_hal_ar9300] Ensure AH_BYTE_ORDER is defined before used.
  
  Same deal here - ensure endian bits are set here first!

Modified:
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_ap121.h
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_aphrodite.h
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_cus157.h
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_generic.h
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_hb112.h
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_hb116.h
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_osprey_k31.h
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_wasp_2.h
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_xb112.h
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_xb113.h

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_ap121.h
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_ap121.h  Tue May 
12 02:20:27 2020(r360953)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_ap121.h  Tue May 
12 02:23:11 2020(r360954)
@@ -25,6 +25,11 @@
 #ifndef __ar9300templateAP121_h__
 #define __ar9300templateAP121_h__
 
+/* Ensure that AH_BYTE_ORDER is defined */
+#ifndef AH_BYTE_ORDER
+#error AH_BYTE_ORDER needs to be defined!
+#endif
+
 static ar9300_eeprom_t ar9300_template_ap121=
 {
 

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_aphrodite.h
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_aphrodite.h  Tue May 
12 02:20:27 2020(r360953)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_aphrodite.h  Tue May 
12 02:23:11 2020(r360954)
@@ -26,6 +26,11 @@
 #ifndef __ar9300templateAphrodite_h__
 #define __ar9300templateAphrodite_h__
 
+/* Ensure that AH_BYTE_ORDER is defined */
+#ifndef AH_BYTE_ORDER
+#error AH_BYTE_ORDER needs to be defined!
+#endif
+
 static ar9300_eeprom_t ar9300_template_aphrodite=
 {
 

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_cus157.h
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_cus157.h Tue May 
12 02:20:27 2020(r360953)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_cus157.h Tue May 
12 02:23:11 2020(r360954)
@@ -25,6 +25,11 @@
 #ifndef __ar9300template_cus157_h__
 #define __ar9300template_cus157_h__
 
+/* Ensure that AH_BYTE_ORDER is defined */
+#ifndef AH_BYTE_ORDER
+#error AH_BYTE_ORDER needs to be defined!
+#endif
+
 static ar9300_eeprom_t Ar9300Template_cus157=
 {
 

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_generic.h
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_generic.hTue May 
12 02:20:27 2020(r360953)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_generic.hTue May 
12 02:23:11 2020(r360954)
@@ -25,6 +25,11 @@
 #ifndef __ar9300templateGeneric_h__
 #define __ar9300templateGeneric_h__
 
+/* Ensure that AH_BYTE_ORDER is defined */
+#ifndef AH_BYTE_ORDER
+#error AH_BYTE_ORDER needs to be defined!
+#endif
+
 static ar9300_eeprom_t ar9300_template_generic=
 {
 

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_hb112.h
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_hb112.h  Tue May 
12 02:20:27 2020(r360953)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_hb112.h  Tue May 
12 02:23:11 2020(r360954)
@@ -25,6 +25,11 @@
 #ifndef __ar9300templateHB112_h__
 #define __ar9300templateHB112_h__
 
+/* Ensure that AH_BYTE_ORDER is defined */
+#ifndef AH_BYTE_ORDER
+#error AH_BYTE_ORDER needs to be defined!
+#endif
+
 static ar9300_eeprom_t ar9300_template_hb112=
 {
 

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_hb116.h
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_hb116.h  Tue May 
12 02:20:27 2020(r360953)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_hb116.h  Tue May 
12 02:23:11 2020(r360954)
@@ -26,6 +26,11 @@
 #ifndef __ar9300templateHB116_h__
 #define __ar9300templateHB116_h__
 
+/* Ensure that AH_BYTE_ORDER is defined */
+#ifndef AH_BYTE_ORDER
+#error AH_BYTE_ORDER needs to be defined!
+#endif
+
 static ar9300_eeprom_t ar9300_template_hb116=
 {
 

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300template_osprey_k31.h
==
--- head/s

svn commit: r360953 - in head/sys: contrib/dev/ath/ath_hal/ar9300 dev/ath/ath_hal

2020-05-11 Thread Adrian Chadd
Author: adrian
Date: Tue May 12 02:20:27 2020
New Revision: 360953
URL: https://svnweb.freebsd.org/changeset/base/360953

Log:
  [ath_hal] [ath_hal_ar9300] Fix endian macros to work in and out of kernel 
tree.
  
  Yes, people shouldn't use bitfields in C for structure parsing.
  If someone ever wants a cleanup task then it'd be great to remove them
  from this vendor code and other places in the ar9285/ar9287 HALs.
  
  Alas, here we are.
  
  AH_BYTE_ORDER wasn't defined and neither were the two values it could be.
  So when compiling ath_ee_print_9300 it'd default to the big endian struct
  layout and get a WHOLE lot of stuff wrong.
  
  So:
  
  * move AH_BYTE_ORDER into ath_hal/ah.h where it can be used by everyone.
  * ensure that AH_BYTE_ORDER is actually defined before using it!
  
  This should work on both big and little endian platforms.

Modified:
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.h
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300eep.h
  head/sys/dev/ath/ath_hal/ah.h

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.h
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.hTue May 12 01:47:33 
2020(r360952)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.hTue May 12 02:20:27 
2020(r360953)
@@ -19,18 +19,14 @@
 
 #include "ar9300_freebsd_inc.h"
 
-#defineAH_BIG_ENDIAN   4321
-#defineAH_LITTLE_ENDIAN1234
-
-#if _BYTE_ORDER == _BIG_ENDIAN
-#defineAH_BYTE_ORDER   AH_BIG_ENDIAN
-#else
-#defineAH_BYTE_ORDER   AH_LITTLE_ENDIAN
-#endif
-
 /* XXX doesn't belong here */
 #defineAR_EEPROM_MODAL_SPURS   5
 
+/* Ensure that AH_BYTE_ORDER is defined */
+#ifndef AH_BYTE_ORDER
+#error AH_BYTE_ORDER needs to be defined!
+#endif
+
 /*
  * (a) this should be N(a),
  * (b) FreeBSD does define nitems,
@@ -43,9 +39,7 @@
 #include "ah_devid.h"
 #include "ar9300eep.h"  /* For Eeprom definitions */
 
-
 #define AR9300_MAGIC0x19741014
-
 
 /* MAC register values */
 

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300eep.h
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300eep.h Tue May 12 01:47:33 
2020(r360952)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300eep.h Tue May 12 02:20:27 
2020(r360953)
@@ -18,13 +18,17 @@
 #define _ATH_AR9300_EEP_H_
 
 #include "opt_ah.h"
-
 #include "ah.h"
 
 #if defined(WIN32) || defined(WIN64)
 #pragma pack (push, ar9300, 1)
 #endif
 
+/* Ensure that AH_BYTE_ORDER is defined */
+#ifndef AH_BYTE_ORDER
+#error AH_BYTE_ORDER needs to be defined!
+#endif
+
 /* FreeBSD extras - should be in ah_eeprom.h ? */
 #define AR_EEPROM_EEPCAP_COMPRESS_DIS   0x0001
 #define AR_EEPROM_EEPCAP_AES_DIS0x0002
@@ -345,11 +349,13 @@ typedef struct CalCtlEdgePwr {
 u_int8_t  flag  :2,
   t_power :6;
 } __packed CAL_CTL_EDGE_PWR;
-#else
+#elif AH_BYTE_ORDER == AH_LITTLE_ENDIAN
 typedef struct CalCtlEdgePwr {
 u_int8_t  t_power :6,
  flag   :2;
 } __packed CAL_CTL_EDGE_PWR;
+#else
+#error AH_BYTE_ORDER undefined!
 #endif
 
 typedef struct ospCalCtlData_5G {

Modified: head/sys/dev/ath/ath_hal/ah.h
==
--- head/sys/dev/ath/ath_hal/ah.h   Tue May 12 01:47:33 2020
(r360952)
+++ head/sys/dev/ath/ath_hal/ah.h   Tue May 12 02:20:27 2020
(r360953)
@@ -33,6 +33,18 @@
 #include "ah_osdep.h"
 
 /*
+ * Endianness macros; used by various structures and code.
+ */
+#define AH_BIG_ENDIAN   4321
+#define AH_LITTLE_ENDIAN1234
+
+#if _BYTE_ORDER == _BIG_ENDIAN
+#define AH_BYTE_ORDER   AH_BIG_ENDIAN
+#else
+#define AH_BYTE_ORDER   AH_LITTLE_ENDIAN
+#endif
+
+/*
  * The maximum number of TX/RX chains supported.
  * This is intended to be used by various statistics gathering operations
  * (NF, RSSI, EVM).
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r360951 - head/tools/tools/ath/ath_ee_9300_print

2020-05-11 Thread Adrian Chadd
Author: adrian
Date: Tue May 12 01:40:48 2020
New Revision: 360951
URL: https://svnweb.freebsd.org/changeset/base/360951

Log:
  [ar9300] Fix up this tool after test compiling it with LLVM.  Le oops.

Modified:
  head/tools/tools/ath/ath_ee_9300_print/main.c

Modified: head/tools/tools/ath/ath_ee_9300_print/main.c
==
--- head/tools/tools/ath/ath_ee_9300_print/main.c   Tue May 12 01:36:48 
2020(r360950)
+++ head/tools/tools/ath/ath_ee_9300_print/main.c   Tue May 12 01:40:48 
2020(r360951)
@@ -61,10 +61,10 @@ eeprom_9300_ctl_idx_to_regdomain(uint8_t idx)
case 0x10: return "FCC";
case 0x30: return "ETSI";
case 0x40: return "JP";
+   default: return "";
}
 }
 
-
 static void
 eeprom_9300_hdr_print(const uint16_t *buf)
 {
@@ -219,7 +219,7 @@ eeprom_9300_print_2g_target_ht20(const ar9300_eeprom_t
int i;
 
for (i = 0; i < OSPREY_NUM_2G_20_TARGET_POWERS; i++) {
-   printf("| Freq %u HT20  MCS0-7 pow2x %u %u %u %u %u %u %u %u 
%u\n",
+   printf("| Freq %u HT20  MCS0-7 pow2x %u %u %u %u %u %u %u %u\n",
FBIN2FREQ(ee->cal_target_freqbin_2g_ht20[i], 1),

ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_0_8_16],

ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_1_3_9_11_17_19],
@@ -229,7 +229,7 @@ eeprom_9300_print_2g_target_ht20(const ar9300_eeprom_t
ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_5],
ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_6],
ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_7]);
-   printf("| Freq %u HT20  MCS8-15 pow2x %u %u %u %u %u %u %u %u 
%u\n",
+   printf("| Freq %u HT20  MCS8-15 pow2x %u %u %u %u %u %u %u 
%u\n",
FBIN2FREQ(ee->cal_target_freqbin_2g_ht20[i], 1),

ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_0_8_16],

ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_1_3_9_11_17_19],
@@ -239,7 +239,7 @@ eeprom_9300_print_2g_target_ht20(const ar9300_eeprom_t
ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_13],
ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_14],
ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_15]);
-   printf("| Freq %u HT20  MCS16-23 pow2x %u %u %u %u %u %u %u %u 
%u\n",
+   printf("| Freq %u HT20  MCS16-23 pow2x %u %u %u %u %u %u %u 
%u\n",
FBIN2FREQ(ee->cal_target_freqbin_2g_ht20[i], 1),

ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_0_8_16],

ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_1_3_9_11_17_19],
@@ -258,7 +258,7 @@ eeprom_9300_print_2g_target_ht40(const ar9300_eeprom_t
int i;
 
for (i = 0; i < OSPREY_NUM_2G_40_TARGET_POWERS; i++) {
-   printf("| Freq %u HT40  MCS0-7 pow2x %u %u %u %u %u %u %u %u 
%u\n",
+   printf("| Freq %u HT40  MCS0-7 pow2x %u %u %u %u %u %u %u %u\n",
FBIN2FREQ(ee->cal_target_freqbin_2g_ht40[i], 1),

ee->cal_target_power_2g_ht40[i].t_pow2x[HT_TARGET_RATE_0_8_16],

ee->cal_target_power_2g_ht40[i].t_pow2x[HT_TARGET_RATE_1_3_9_11_17_19],
@@ -268,7 +268,7 @@ eeprom_9300_print_2g_target_ht40(const ar9300_eeprom_t
ee->cal_target_power_2g_ht40[i].t_pow2x[HT_TARGET_RATE_5],
ee->cal_target_power_2g_ht40[i].t_pow2x[HT_TARGET_RATE_6],
ee->cal_target_power_2g_ht40[i].t_pow2x[HT_TARGET_RATE_7]);
-   printf("| Freq %u HT40  MCS8-15 pow2x %u %u %u %u %u %u %u %u 
%u\n",
+   printf("| Freq %u HT40  MCS8-15 pow2x %u %u %u %u %u %u %u 
%u\n",
FBIN2FREQ(ee->cal_target_freqbin_2g_ht40[i], 1),

ee->cal_target_power_2g_ht40[i].t_pow2x[HT_TARGET_RATE_0_8_16],

ee->cal_target_power_2g_ht40[i].t_pow2x[HT_TARGET_RATE_1_3_9_11_17_19],
@@ -278,7 +278,7 @@ eeprom_9300_print_2g_target_ht40(const ar9300_eeprom_t
ee->cal_target_power_2g_ht40[i].t_pow2x[HT_TARGET_RATE_13],
ee->cal_target_power_2g_ht40[i].t_pow2x[HT_TARGET_RATE_14],
ee->cal_target_power_2g_ht40[i].t_pow2x[HT_TARGET_RATE_15]);
-   printf("| Freq %u HT40  MCS16-23 pow2x %u %u %u %u %u %u %u %u 
%u\n",
+   printf("| Freq %u HT40  MCS16-23 pow2x %u %u %u %u %u %u %u 
%u\n",
FBIN2FREQ(ee->cal_target_freqbin_2g_ht40[i], 1),

ee->cal_target_power_2g_ht40[i].t_pow2x[HT_TARGET_RATE_0_8_16],

ee->cal_target_power_2g_ht40[i].t_pow2x[HT_TARGET_RATE_1_3_9_11_17_19],
___
svn-src-head@freebsd.org m

svn commit: r360950 - head/tools/tools/ath/ath_ee_9300_print

2020-05-11 Thread Adrian Chadd
Author: adrian
Date: Tue May 12 01:36:48 2020
New Revision: 360950
URL: https://svnweb.freebsd.org/changeset/base/360950

Log:
  [ar9300] Update the ar9300 eeprom dump utility to include target power and 
CTL.
  
  This lets me easily see what the EEPROM target power and regulatory
  compliance table limits are.
  
  (Yeah, should've done this in 2013..)

Modified:
  head/tools/tools/ath/ath_ee_9300_print/main.c

Modified: head/tools/tools/ath/ath_ee_9300_print/main.c
==
--- head/tools/tools/ath/ath_ee_9300_print/main.c   Tue May 12 01:23:05 
2020(r360949)
+++ head/tools/tools/ath/ath_ee_9300_print/main.c   Tue May 12 01:36:48 
2020(r360950)
@@ -37,6 +37,34 @@ struct ath_hal;
 
 #include "ar9300/ar9300eep.h"
 
+static const char *
+eeprom_9300_ctl_idx_to_mode(uint8_t idx)
+{
+   switch (idx & 0xf) {
+   /* 2G CTLs */
+   case 1: return "CCK";
+   case 2: return "OFDM";
+   case 5: return "HT20";
+   case 7: return "HT40";
+   /* 5G CTLs */
+   case 0: return "OFDM";
+   case 6: return "HT20";
+   case 8: return "HT40";
+   default: return "";
+   }
+}
+
+static const char *
+eeprom_9300_ctl_idx_to_regdomain(uint8_t idx)
+{
+   switch (idx & 0xf0) {
+   case 0x10: return "FCC";
+   case 0x30: return "ETSI";
+   case 0x40: return "JP";
+   }
+}
+
+
 static void
 eeprom_9300_hdr_print(const uint16_t *buf)
 {
@@ -156,6 +184,246 @@ eeprom_9300_modal_print(const OSPREY_MODAL_EEP_HEADER 
 }
 
 static void
+eeprom_9300_print_2g_target_cck(const ar9300_eeprom_t *ee)
+{
+   int i;
+
+   for (i = 0; i < OSPREY_NUM_2G_CCK_TARGET_POWERS; i++) {
+   printf("| Freq %u CCK: pow2x 1/5L %u 5S %u 11L %u 11S %u\n",
+   FBIN2FREQ(ee->cal_target_freqbin_cck[i], 1),
+   
ee->cal_target_power_cck[i].t_pow2x[LEGACY_TARGET_RATE_1L_5L],
+   ee->cal_target_power_cck[i].t_pow2x[LEGACY_TARGET_RATE_5S],
+   ee->cal_target_power_cck[i].t_pow2x[LEGACY_TARGET_RATE_11L],
+   
ee->cal_target_power_cck[i].t_pow2x[LEGACY_TARGET_RATE_11S]);
+   }
+}
+
+static void
+eeprom_9300_print_2g_target_ofdm(const ar9300_eeprom_t *ee)
+{
+   int i;
+
+   for (i = 0; i < OSPREY_NUM_2G_20_TARGET_POWERS; i++) {
+   printf("| Freq %u OFDM: pow2x 6/12/18/24M %u 36M %u 48M %u 54M 
%u\n",
+   FBIN2FREQ(ee->cal_target_freqbin_2g[i], 1),
+   ee->cal_target_power_2g[i].t_pow2x[LEGACY_TARGET_RATE_6_24],
+   ee->cal_target_power_2g[i].t_pow2x[LEGACY_TARGET_RATE_36],
+   ee->cal_target_power_2g[i].t_pow2x[LEGACY_TARGET_RATE_48],
+   ee->cal_target_power_2g[i].t_pow2x[LEGACY_TARGET_RATE_54]);
+   }
+}
+
+static void
+eeprom_9300_print_2g_target_ht20(const ar9300_eeprom_t *ee)
+{
+   int i;
+
+   for (i = 0; i < OSPREY_NUM_2G_20_TARGET_POWERS; i++) {
+   printf("| Freq %u HT20  MCS0-7 pow2x %u %u %u %u %u %u %u %u 
%u\n",
+   FBIN2FREQ(ee->cal_target_freqbin_2g_ht20[i], 1),
+   
ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_0_8_16],
+   
ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_1_3_9_11_17_19],
+   
ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_1_3_9_11_17_19],
+   
ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_1_3_9_11_17_19],
+   ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_4],
+   ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_5],
+   ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_6],
+   ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_7]);
+   printf("| Freq %u HT20  MCS8-15 pow2x %u %u %u %u %u %u %u %u 
%u\n",
+   FBIN2FREQ(ee->cal_target_freqbin_2g_ht20[i], 1),
+   
ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_0_8_16],
+   
ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_1_3_9_11_17_19],
+   
ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_1_3_9_11_17_19],
+   
ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_1_3_9_11_17_19],
+   ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_12],
+   ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_13],
+   ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_14],
+   ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_15]);
+   printf("| Freq %u HT20  MCS16-23 pow2x %u %u %u %u %u %u %u %u 
%u\n",
+   FBIN2FREQ(ee->cal_target_freqbin_2g_ht20[i], 1),
+   
ee->cal_target_power_2g_ht20[i].t_pow2x[HT_TARGET_RATE_0_8_16],
+   
ee->cal_target_power_2g_ht20[i].t_pow2x[HT_T

  1   2   3   4   5   6   7   8   9   10   >