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

2018-05-24 Thread Adrian Chadd
Author: adrian
Date: Fri May 25 01:27:39 2018
New Revision: 334197
URL: https://svnweb.freebsd.org/changeset/base/334197

Log:
  [ath_hal] migrate the shared HAL_RESET_* pieces out into ath_hal.
  
  I'm in the process of reworking how the reset path works with an eye
  to better recovery when the chips hang and/or go RF/PHY deaf.
  This is the first step in a lot of unification and API changes.

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

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.h
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.hFri May 25 00:00:00 
2018(r334196)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.hFri May 25 01:27:39 
2018(r334197)
@@ -100,12 +100,6 @@ enum GAIN_PARAMS_2133 {
 GP_PWD_130,
 };
 
-enum {
-HAL_RESET_POWER_ON,
-HAL_RESET_WARM,
-HAL_RESET_COLD,
-};
-
 typedef struct _gain_opt_step {
 int16_t paramVal[NUM_CORNER_FIX_BITS_2133];
 int32_t stepGain;

Modified: head/sys/dev/ath/ath_hal/ah.h
==
--- head/sys/dev/ath/ath_hal/ah.h   Fri May 25 00:00:00 2018
(r334196)
+++ head/sys/dev/ath/ath_hal/ah.h   Fri May 25 01:27:39 2018
(r334197)
@@ -763,6 +763,12 @@ typedef enum {
HAL_RESET_FORCE_COLD= 2,/* Force full reset */
 } HAL_RESET_TYPE;
 
+enum {
+   HAL_RESET_POWER_ON,
+   HAL_RESET_WARM,
+   HAL_RESET_COLD
+};
+
 typedef struct {
uint8_t kv_type;/* one of HAL_CIPHER */
uint8_t kv_apsd;/* Mask for APSD enabled ACs */

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416.hFri May 25 00:00:00 2018
(r334196)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416.hFri May 25 01:27:39 2018
(r334197)
@@ -27,12 +27,6 @@
 
 #defineAR5416_MAGIC0x20065416
 
-enum {
-   HAL_RESET_POWER_ON,
-   HAL_RESET_WARM,
-   HAL_RESET_COLD,
-};
-
 typedef struct {
uint16_tsynth_center;
uint16_tctl_center;
___
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: r334848 - in head/sys/dev/ath/ath_hal: ar5212 ar5416

2018-06-08 Thread Adrian Chadd
Author: adrian
Date: Fri Jun  8 18:15:23 2018
New Revision: 334848
URL: https://svnweb.freebsd.org/changeset/base/334848

Log:
  [ath_hal] Don't do ANI processing if we've reset.
  
  If we've reset then we can't trust the current state of the ANI tracking,
  so just wait until next time.
  
  Tested:
  
  * AR5424, STA mode (2GHz)

Modified:
  head/sys/dev/ath/ath_hal/ar5212/ar5212_ani.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_ani.c
==
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_ani.cFri Jun  8 18:09:19 
2018(r334847)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_ani.cFri Jun  8 18:15:23 
2018(r334848)
@@ -1000,6 +1000,9 @@ ar5212AniPoll(struct ath_hal *ah, const struct ieee802
ahp->ah_stats.ast_ani_lneg++;
/* restart ANI period if listenTime is invalid */
ar5212AniRestart(ah, aniState);
+
+   /* Don't do any further ANI processing here */
+   return;
}
/* XXX beware of overflow? */
aniState->listenTime += listenTime;

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.cFri Jun  8 18:09:19 
2018(r334847)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.cFri Jun  8 18:15:23 
2018(r334848)
@@ -950,6 +950,9 @@ ar5416AniPoll(struct ath_hal *ah, const struct ieee802
HALDEBUG(ah, HAL_DEBUG_ANI, "%s: invalid listenTime\n",
__func__);
ar5416AniRestart(ah, aniState);
+
+   /* Don't do any further processing */
+   return;
}
/* XXX beware of overflow? */
aniState->listenTime += listenTime;
___
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: r334849 - in head/sys: contrib/dev/ath/ath_hal/ar9300 dev/ath/ath_hal/ar5416

2018-06-08 Thread Adrian Chadd
Author: adrian
Date: Fri Jun  8 18:21:57 2018
New Revision: 334849
URL: https://svnweb.freebsd.org/changeset/base/334849

Log:
  [ath_hal] Return failure if noise floor calibration fails.
  
  If we fail noise floor calibration then we may end up with a deaf NIC
  which we can't recover without a full chip reset.
  
  Earlier chips seem to get less stuck in this condition versus AR9280/later
  and AR9300/later, but whilst here just fix up the AR5212 era chips to also
  return NF calibration failures.
  
  This HAL routine would only return failure if the channel was not configured.
  
  This is a no-op until the driver side code for doing resets and the HAL
  code for being told about the reset type (and then handling it!) is
  implemented.
  
  Tested:
  
  * AR9280, STA mode
  * AR2425, STA mode
  * AR9380, STA mode

Modified:
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.c
  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_cal.c

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.c
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.cFri Jun  8 
18:15:23 2018(r334848)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.cFri Jun  8 
18:21:57 2018(r334849)
@@ -1188,6 +1188,15 @@ ar9300_ani_ar_poll(struct ath_hal *ah, const HAL_NODE_
 cck_phy_err_cnt - ani_state->cck_phy_err_count;
 ani_state->cck_phy_err_count = cck_phy_err_cnt;
 
+/*
+ * Note - the ANI code is using the aggregate listen time.
+ * The AR_PHY_CNT1/AR_PHY_CNT2 registers here are also
+ * free running, not clear-on-read and are free-running.
+ *
+ * So, ofdm_phy_err_rate / cck_phy_err_rate are accumulating
+ * the same as listenTime is accumulating.
+ */
+
 #if HAL_ANI_DEBUG
 HALDEBUG(ah, HAL_DEBUG_ANI,
 "%s: Errors: OFDM=0x%08x-0x0=%d   CCK=0x%08x-0x0=%d\n",

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.cFri Jun  8 
18:15:23 2018(r334848)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.cFri Jun  8 
18:21:57 2018(r334849)
@@ -704,11 +704,16 @@ ar9300_proc_rx_desc_freebsd(struct ath_hal *ah, struct
(void *) ds));
 }
 
+/*
+ * This is the primary way the ANI code gets the node statistics per packet.
+ */
 void
 ar9300_ani_rxmonitor_freebsd(struct ath_hal *ah, const HAL_NODE_STATS *stats,
 const struct ieee80211_channel *chan)
 {
+   struct ath_hal_9300 *ahp = AH9300(ah);
 
+   ahp->ah_stats.ast_nodestats.ns_avgbrssi = stats->ns_avgbrssi;
 }
 
 void

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_reset.c
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_reset.c  Fri Jun  8 
18:15:23 2018(r334848)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_reset.c  Fri Jun  8 
18:21:57 2018(r334849)
@@ -2493,15 +2493,23 @@ ar9300_calibration(struct ath_hal *ah, struct ieee8021
 chan->ic_state &= ~IEEE80211_CHANSTATE_CWINT;
 
 if (nf_done) {
+int ret;
 /*
  * Load the NF from history buffer of the current channel.
  * NF is slow time-variant, so it is OK to use a historical value.
  */
 ar9300_get_nf_hist_base(ah, ichan, is_scan, nf_buf);
-ar9300_load_nf(ah, nf_buf);
-
+
+ret = ar9300_load_nf(ah, nf_buf);
 /* start NF calibration, without updating BB NF register*/
-ar9300_start_nf_cal(ah);   
+ar9300_start_nf_cal(ah);
+
+/*
+ * If we failed the NF cal then tell the upper layer that we
+ * failed so we can do a full reset
+ */
+if (! ret)
+return AH_FALSE;
 }
 }
 return AH_TRUE;
@@ -4479,6 +4487,7 @@ First_NFCal(struct ath_hal *ah, HAL_CHANNEL_INTERNAL *
 ar9300_reset_nf_hist_buff(ah, ichan);
 ar9300_get_nf_hist_base(ah, ichan, is_scan, nf_buf);
 ar9300_load_nf(ah, nf_buf);
+/* XXX TODO: handle failure from load_nf */
 stats = 0;
} else {
 stats = 1; 
@@ -5303,6 +5312,7 @@ ar9300_reset(struct ath_hal *ah, HAL_OPMODE opmode, st
 /* XXX FreeBSD is ichan appropariate? It was curchan.. */
 ar9300_get_nf_hist_base(ah, ichan, is_scan, nf_buf);
 ar9300_load_nf(ah, nf_buf);
+/* XXX TODO: handle NF load failure */
 if (nf_hist_buff_reset == 1)
 {
 nf_hist_buff_reset = 0;

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
==
--- head/sy

svn commit: r326737 - head/sys/net80211

2017-12-09 Thread Adrian Chadd
Author: adrian
Date: Sat Dec  9 23:16:02 2017
New Revision: 326737
URL: https://svnweb.freebsd.org/changeset/base/326737

Log:
  [net80211] add a method for checking if a VAP WME AC has a NOACK policy or 
not.
  
  A subsequent set of commits will introduce this instead of a whole lot of
  gymnastics to check the WME category.

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

Modified: head/sys/net80211/ieee80211_proto.c
==
--- head/sys/net80211/ieee80211_proto.c Sat Dec  9 21:55:19 2017
(r326736)
+++ head/sys/net80211/ieee80211_proto.c Sat Dec  9 23:16:02 2017
(r326737)
@@ -1308,6 +1308,12 @@ ieee80211_wme_updateparams(struct ieee80211vap *vap)
}
 }
 
+/*
+ * Fetch the WME parameters for the given VAP.
+ *
+ * When net80211 grows p2p, etc support, this may return different
+ * parameters for each VAP.
+ */
 void
 ieee80211_wme_vap_getparams(struct ieee80211vap *vap, struct chanAccParams *wp)
 {
@@ -1315,11 +1321,37 @@ ieee80211_wme_vap_getparams(struct ieee80211vap *vap, 
memcpy(wp, &vap->iv_ic->ic_wme.wme_chanParams, sizeof(*wp));
 }
 
+/*
+ * For NICs which only support one set of WME paramaters (ie, softmac NICs)
+ * there may be different VAP WME parameters but only one is "active".
+ * This returns the "NIC" WME parameters for the currently active
+ * context.
+ */
 void
 ieee80211_wme_ic_getparams(struct ieee80211com *ic, struct chanAccParams *wp)
 {
 
memcpy(wp, &ic->ic_wme.wme_chanParams, sizeof(*wp));
+}
+
+/*
+ * Return whether to use QoS on a given WME queue.
+ *
+ * This is intended to be called from the transmit path of softmac drivers
+ * which are setting NoAck bits in transmit descriptors.
+ *
+ * Ideally this would be set in some transmit field before the packet is
+ * queued to the driver but net80211 isn't quite there yet.
+ */
+int
+ieee80211_wme_vap_ac_is_noack(struct ieee80211vap *vap, int ac)
+{
+   /* Bounds/sanity check */
+   if (ac < 0 || ac >= WME_NUM_AC)
+   return (0);
+
+   /* Again, there's only one global context for now */
+   return (!! 
vap->iv_ic->ic_wme.wme_chanParams.cap_wmeParams[ac].wmep_noackPolicy);
 }
 
 static void

Modified: head/sys/net80211/ieee80211_proto.h
==
--- head/sys/net80211/ieee80211_proto.h Sat Dec  9 21:55:19 2017
(r326736)
+++ head/sys/net80211/ieee80211_proto.h Sat Dec  9 23:16:02 2017
(r326737)
@@ -298,6 +298,7 @@ voidieee80211_wme_vap_getparams(struct ieee80211vap 
*
struct chanAccParams *);
 void   ieee80211_wme_ic_getparams(struct ieee80211com *ic,
struct chanAccParams *);
+intieee80211_wme_vap_ac_is_noack(struct ieee80211vap *vap, int ac);
 
 /*
  * Return the WME TID from a QoS frame.  If no TID
___
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: r326758 - in head/sys/i386: conf include

2017-12-20 Thread Adrian Chadd
Hi,

I kinda bet that this will just get worse over time, so maybe it's
time we revisited figuring out a better way of dispatching work
instead of (a) lots of kernel threads for different subsystems and (b)
lots of deep stack frames.

eg - NFS over wifi == hilarious pain




-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: r327479 - in head/sys/dev: ath bwn iwi iwm iwn mwl otus ral rtwn usb/wlan wpi

2018-01-01 Thread Adrian Chadd
Author: adrian
Date: Tue Jan  2 00:07:28 2018
New Revision: 327479
URL: https://svnweb.freebsd.org/changeset/base/327479

Log:
  [net80211] convert all of the WME use over to a temporary copy of WME info.
  
  This removes the direct WME info access in the ieee80211com struct and instead
  provides a method of fetching the data.  Right now it's a no-op but eventually
  it'll turn into a per-VAP method for drivers that support it (eg iwn, iwm,
  upcoming ath10k work) as things like p2p support require this kind of 
behaviour.
  
  Tested:
  
  * ath(4), STA and AP mode
  
  TODO:
  
  * yes, this is slightly stack size-y, but it is an important first step
to get drivers migrated over to a sensible WME API.  A lot of per-phy things
need to be converted to per-VAP before P2P, 11ac firmware, etc stuff shows 
up.

Modified:
  head/sys/dev/ath/if_ath_beacon.c
  head/sys/dev/ath/if_ath_tx.c
  head/sys/dev/bwn/if_bwn.c
  head/sys/dev/iwi/if_iwi.c
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/mwl/if_mwl.c
  head/sys/dev/otus/if_otus.c
  head/sys/dev/ral/rt2661.c
  head/sys/dev/ral/rt2860.c
  head/sys/dev/rtwn/if_rtwn.c
  head/sys/dev/usb/wlan/if_rum.c
  head/sys/dev/usb/wlan/if_run.c
  head/sys/dev/wpi/if_wpi.c

Modified: head/sys/dev/ath/if_ath_beacon.c
==
--- head/sys/dev/ath/if_ath_beacon.cTue Jan  2 00:02:36 2018
(r327478)
+++ head/sys/dev/ath/if_ath_beacon.cTue Jan  2 00:07:28 2018
(r327479)
@@ -150,8 +150,12 @@ ath_beaconq_config(struct ath_softc *sc)
qi.tqi_cwmin = ATH_BEACON_CWMIN_DEFAULT;
qi.tqi_cwmax = ATH_BEACON_CWMAX_DEFAULT;
} else {
-   struct wmeParams *wmep =
-   &ic->ic_wme.wme_chanParams.cap_wmeParams[WME_AC_BE];
+   struct chanAccParams chp;
+   struct wmeParams *wmep;
+
+   ieee80211_wme_ic_getparams(ic, &chp);
+   wmep = &chp.cap_wmeParams[WME_AC_BE];
+
/*
 * Adhoc mode; important thing is to use 2x cwmin.
 */

Modified: head/sys/dev/ath/if_ath_tx.c
==
--- head/sys/dev/ath/if_ath_tx.cTue Jan  2 00:02:36 2018
(r327478)
+++ head/sys/dev/ath/if_ath_tx.cTue Jan  2 00:07:28 2018
(r327479)
@@ -1554,7 +1554,6 @@ ath_tx_normal_setup(struct ath_softc *sc, struct ieee8
 {
struct ieee80211vap *vap = ni->ni_vap;
struct ieee80211com *ic = &sc->sc_ic;
-   const struct chanAccParams *cap = &ic->ic_wme.wme_chanParams;
int error, iswep, ismcast, isfrag, ismrr;
int keyix, hdrlen, pktlen, try0 = 0;
u_int8_t rix = 0, txrate = 0;
@@ -1697,7 +1696,11 @@ ath_tx_normal_setup(struct ath_softc *sc, struct ieee8
ismrr = 1;
bf->bf_state.bfs_doratelookup = 1;
}
-   if (cap->cap_wmeParams[pri].wmep_noackPolicy)
+
+   /*
+* Check whether to set NOACK for this WME category or not.
+*/
+   if (ieee80211_wme_vap_ac_is_noack(vap, pri))
flags |= HAL_TXDESC_NOACK;
break;
default:

Modified: head/sys/dev/bwn/if_bwn.c
==
--- head/sys/dev/bwn/if_bwn.c   Tue Jan  2 00:02:36 2018(r327478)
+++ head/sys/dev/bwn/if_bwn.c   Tue Jan  2 00:07:28 2018(r327479)
@@ -1755,15 +1755,18 @@ bwn_wme_update(struct ieee80211com *ic)
 {
struct bwn_softc *sc = ic->ic_softc;
struct bwn_mac *mac = sc->sc_curmac;
+   struct chanAccParams chp;
struct wmeParams *wmep;
int i;
 
+   ieee80211_wme_ic_getparams(ic, &chp);
+
BWN_LOCK(sc);
mac = sc->sc_curmac;
if (mac != NULL && mac->mac_status >= BWN_MAC_STATUS_INITED) {
bwn_mac_suspend(mac);
for (i = 0; i < N(sc->sc_wmeParams); i++) {
-   wmep = &ic->ic_wme.wme_chanParams.cap_wmeParams[i];
+   wmep = &chp.cap_wmeParams[i];
bwn_wme_loadparams(mac, wmep, bwn_wme_shm_offsets[i]);
}
bwn_mac_enable(mac);

Modified: head/sys/dev/iwi/if_iwi.c
==
--- head/sys/dev/iwi/if_iwi.c   Tue Jan  2 00:02:36 2018(r327478)
+++ head/sys/dev/iwi/if_iwi.c   Tue Jan  2 00:07:28 2018(r327479)
@@ -1050,12 +1050,15 @@ static int
 iwi_wme_setparams(struct iwi_softc *sc)
 {
struct ieee80211com *ic = &sc->sc_ic;
+   struct chanAccParams chp;
const struct wmeParams *wmep;
int ac;
 
+   ieee80211_wme_ic_getparams(ic, &chp);
+
for (ac = 0; ac < WME_NUM_AC; ac++) {
/* set WME values for current operati

Re: svn commit: r327559 - in head: . sys/net

2018-01-04 Thread Adrian Chadd
does it also happen when you actually enable RSS in the kernel? Since
like I went through a whole lot of pain to assign a flowid at
connection setup time.



-a


On 4 January 2018 at 15:37, Steven Hartland  wrote:
>
>
> On 04/01/2018 22:42, hiren panchasara wrote:
>
> On 01/04/18 at 09:52P, Steven Hartland wrote:
>
> On 04/01/2018 20:50, Eugene Grosbein wrote:
>
> 05.01.2018 3:05, Steven Hartland wrote:
>
> Author: smh
> Date: Thu Jan  4 20:05:47 2018
> New Revision: 327559
> URL: https://svnweb.freebsd.org/changeset/base/327559
>
> Log:
>Disabled the use of flowid for lagg by default
>
>Disabled the use of RSS hash from the network card aka flowid for
>lagg(4) interfaces by default as it's currently incompatible with
>the lacp and loadbalance protocols.
>
>The incompatibility is due to the fact that the flowid isn't know
>for the first packet of a new outbound stream which can result in
>the hash calculation method changing and hence a stream being
>incorrectly split across multiple interfaces during normal
>operation.
>
>This can be re-enabled by setting the following in loader.conf:
>net.link.lagg.default_use_flowid="1"
>
>Discussed with: kmacy
>Sponsored by:  Multiplay
>
> RSS by definition has meaning to received stream. What is "outbound" stream
> in this context, why can the hash calculatiom method change and what exactly
> does it mean "a stream being incorrectly split"?
>
> Yes RSS is indeed a received stream but that is used by lagg for lacp
> and loadbalance protocols to decide which port of the lagg to "send" the
> packet out of. As the flowid is not known when a new "output" stream is
> instigated the current code falls back to manual hash calculation to
> determine which port to send the initial packet from. Once a response is
> received a tx then uses the flowid. This change of hash calculation
> method can result in the initial packet being sent from a different port
> than the rest of the stream; this is what I meant by "incorrectly split".
>
> For my understanding, is this just an issue for the first packet when we
> originate the flow? Once we have a response and if flowid is there, we'd
> use it, right? OR am I missing something?
>
> Initially yes, but that can cause a whole cascading set of problems. If the
> source machine sends from two different ports then flow can traverse across
> the network using different paths and hence arrive at the destination on
> different ports too, causing the corresponding  issue on the other side.
>
> And with this change, we'd always go and do manual calculation even when
> we have a valid flowid (i.e. we didn't initiate a connection)?
>
> Correct, but there's potentially no easy way to correctly determine what the
> flowid and hence hash should be in this case, likely impossible if the lagg
> consists of different interface types.
>
> In addition if the hardware hash doesn't match the requested one as per
> laggproto then additional issues could also be triggered.
>
> Our TCP stack seems fragile during setup to out of order packets which this
> multipath behavior causes, we've seen this on our loadbalancers which is
> what triggered the investigation. The concrete result is many aborted TCP
> connections, over 300k ~2% on the machine I'm looking at.
>
> I hope there's some improvements that can be made, for example if we can
> determine the stream was instigated remotely then flowid would always be
> valid hence we can use it assuming it matches the requested spec or if we
> can make it clear to the user that laggproto is not the one they requested,
> I'm open to ideas?
>
> Regards
> Steve
>
___
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: r327783 - head/share/mk

2018-01-12 Thread Adrian Chadd
hi,

can we just flip the switch back for now until it's figured out?

Some of us have to like, do development on -HEAD for fun. :)



-a


On 12 January 2018 at 17:46, John Baldwin  wrote:
> On Wednesday, January 10, 2018 08:28:01 PM Ed Maste wrote:
>> Author: emaste
>> Date: Wed Jan 10 20:28:01 2018
>> New Revision: 327783
>> URL: https://svnweb.freebsd.org/changeset/base/327783
>>
>> Log:
>>   Enable ld.lld as bootstrap linker by default on amd64
>>
>>   For some time we have been planning to migrate to LLVM's lld linker.
>>   Having a man page was the last blocking issue for using ld.lld to link
>>   the base system kernel + userland, now addressed by r327770.  Link the
>>   kernel and userland libraries and binaries with ld.lld by default, for
>>   additional test coverage.
>>
>>   This has been a long time in the making.  On 2013-04-13 I submitted an
>>   upstream tracking issue in LLVM PR 23214: [META] Using LLD as FreeBSD's
>>   system linker.  Since then 85 individual issues were identified, and
>>   submitted as dependencies.  These have been addressed along with two
>>   and a half years of other lld development and improvement.
>>
>>   I'd like to express deep gratitude to upstream lld developers Rui
>>   Ueyama, Rafael Espindola, George Rimar and Davide Italiano.  They put in
>>   substantial effort in addressing the issues we found affecting
>>   FreeBSD/amd64.
>>
>>   To revert to using ld.bfd as the bootstrap linker, in /etc/src.conf set
>>
>>   WITHOUT_LLD_BOOTSTRAP=yes
>>
>>   If you need to set this, please follow up with a PR or post to the
>>   freebsd-toolchain mailing list explaining how default WITH_LLD_BOOTSTRAP
>>   failed for your use case.
>>
>>   Note that GNU ld.bfd is still installed as /usr/bin/ld, and will still
>>   be used for linking ports.  ld.lld can be installed as /usr/bin/ld by
>>   setting in /etc/src.conf
>>
>>   WITH_LLD_IS_LLD=yes
>>
>>   A followup commit will set WITH_LLD_IS_LD by default, possibly after
>>   Clang/LLVM/lld 6.0 is merged to FreeBSD.
>>
>>   Release notes:  Yes
>>   Sponsored by:   The FreeBSD Foundation
>
> FYI, due to a quirk of how we load kernel modules on amd64 in such a way that
> doesn't really honor the ELF spec (but is self-consistent in the kernel and
> loader) and the fact that LLD doesn't sort sections the way BFD does, this
> change has confused kgdb such that it can compute different address for
> symbols.  I dont think i386 is affected, only amd64.  I've started on a fix,
> but my first attempt to boot it resulted in no modules loading anymore and
> it's time to go home for the day. :-P  I'll try to resolve this early next
> week.  If you need to use kgdb on amd64 with kernel modules, you will have
> to build with an external toolchain (the old ld.bfd can't cope with the
> kernel ifunc stuff).
>
> --
> John Baldwin
>
___
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: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules

2018-01-27 Thread Adrian Chadd
Hi,

Find the middle ground. Don't dissuade the developer too much.

Here's an example:

Make the driver follow DTS, allow a tunable/kenv check for it to
override whether it needs to be in the DTS or not (the "keep phk happy
for now" compromise) and have it default to obeying the device tree.

That way phk is kept happy and the defaults are the same as normal-ish
ARM /and/ you have a springboard to experiment with extending FDT
overlays at runtime for people who wish to do so.

(I personally hate having to edit the dts/recompile/reboot for every
test hardware change; it makes breadboarding things up kinda
hilariously annoying.)



-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: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules

2018-01-28 Thread Adrian Chadd
[snip]

And this is the root bit that's missing - dynamic pinmux/pinctrl stuff
at runtime.

Warner's already said he's WIP'ing it and phk seems like a good test
case for kicking those tyres, so it sounds like those tyres are about
to be kicked.

In the meantime, hacks allow people to make some progress, and as long
as they're not on by default, it's okay. The challenge is finding the
middle ground between "right" and "working". Some people are happy to
do the legwork to do things right first; others are happy to do the
end bits and then backfill the supporting infrastructure.

Fun times, fun times! I'm just happy to see more RPI support. That
platform still isn't dying.

-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: r328988 - in head/sys: conf modules/ipfw netinet netpfil/ipfw

2018-03-23 Thread Adrian Chadd
Hi!

It looks like this broke on mips32. I posted in -net on this.

In addition i can't even build the concurrencykit regression suite
from github. It just plainly fails to build, so I can't even attempt
to cross compile it for mips to test things.

Did you test this on any platform besides 64 bit intel?

Thanks!



-adrian


On 7 February 2018 at 10:59, Andrey V. Elsukov  wrote:
> Author: ae
> Date: Wed Feb  7 18:59:54 2018
> New Revision: 328988
> URL: https://svnweb.freebsd.org/changeset/base/328988
>
> Log:
>   Rework ipfw dynamic states implementation to be lockless on fast path.
>
>   o added struct ipfw_dyn_info that keeps all needed for ipfw_chk and
> for dynamic states implementation information;
>   o added DYN_LOOKUP_NEEDED() macro that can be used to determine the
> need of new lookup of dynamic states;
>   o ipfw_dyn_rule now becomes obsolete. Currently it used to pass
> information from kernel to userland only.
>   o IPv4 and IPv6 states now described by different structures
> dyn_ipv4_state and dyn_ipv6_state;
>   o IPv6 scope zones support is added;
>   o ipfw(4) now depends from Concurrency Kit;
>   o states are linked with "entry" field using CK_SLIST. This allows
> lockless lookup and protected by mutex modifications.
>   o the "expired" SLIST field is used for states expiring.
>   o struct dyn_data is used to keep generic information for both IPv4
> and IPv6;
>   o struct dyn_parent is used to keep O_LIMIT_PARENT information;
>   o IPv4 and IPv6 states are stored in different hash tables;
>   o O_LIMIT_PARENT states now are kept separately from O_LIMIT and
> O_KEEP_STATE states;
>   o per-cpu dyn_hp pointers are used to implement hazard pointers and they
> prevent freeing states that are locklessly used by lookup threads;
>   o mutexes to protect modification of lists in hash tables now kept in
> separate arrays. 65535 limit to maximum number of hash buckets now
> removed.
>   o Separate lookup and install functions added for IPv4 and IPv6 states
> and for parent states.
>   o By default now is used Jenkinks hash function.
>
>   Obtained from:Yandex LLC
>   MFC after:42 days
>   Sponsored by: Yandex LLC
>   Differential Revision:https://reviews.freebsd.org/D12685
>
> Modified:
>   head/sys/conf/files
>   head/sys/modules/ipfw/Makefile
>   head/sys/netinet/ip_fw.h
>   head/sys/netpfil/ipfw/ip_fw2.c
>   head/sys/netpfil/ipfw/ip_fw_dynamic.c
>   head/sys/netpfil/ipfw/ip_fw_private.h
>   head/sys/netpfil/ipfw/ip_fw_sockopt.c
>
> Modified: head/sys/conf/files
> ==
> --- head/sys/conf/files Wed Feb  7 18:50:36 2018(r328987)
> +++ head/sys/conf/files Wed Feb  7 18:59:54 2018(r328988)
> @@ -4374,7 +4374,8 @@ netpfil/ipfw/ip_dn_io.c   optional inet dummynet
>  netpfil/ipfw/ip_dn_glue.c  optional inet dummynet
>  netpfil/ipfw/ip_fw2.c  optional inet ipfirewall
>  netpfil/ipfw/ip_fw_bpf.c   optional inet ipfirewall
> -netpfil/ipfw/ip_fw_dynamic.c   optional inet ipfirewall
> +netpfil/ipfw/ip_fw_dynamic.c   optional inet ipfirewall \
> +   compile-with "${NORMAL_C} -I$S/contrib/ck/include"
>  netpfil/ipfw/ip_fw_eaction.c   optional inet ipfirewall
>  netpfil/ipfw/ip_fw_log.c   optional inet ipfirewall
>  netpfil/ipfw/ip_fw_pfil.c  optional inet ipfirewall
>
> Modified: head/sys/modules/ipfw/Makefile
> ==
> --- head/sys/modules/ipfw/Makefile  Wed Feb  7 18:50:36 2018
> (r328987)
> +++ head/sys/modules/ipfw/Makefile  Wed Feb  7 18:59:54 2018
> (r328988)
> @@ -9,7 +9,7 @@ SRCS+=  ip_fw_sockopt.c ip_fw_table.c ip_fw_table_algo.
>  SRCS+= ip_fw_table_value.c
>  SRCS+= opt_inet.h opt_inet6.h opt_ipdivert.h opt_ipfw.h
>
> -CFLAGS+= -DIPFIREWALL
> +CFLAGS+= -DIPFIREWALL -I${SRCTOP}/sys/contrib/ck/include
>  #
>  #If you want it verbose
>  #CFLAGS+= -DIPFIREWALL_VERBOSE
>
> Modified: head/sys/netinet/ip_fw.h
> ==
> --- head/sys/netinet/ip_fw.hWed Feb  7 18:50:36 2018(r328987)
> +++ head/sys/netinet/ip_fw.hWed Feb  7 18:59:54 2018(r328988)
> @@ -671,7 +671,7 @@ struct ipfw_flow_id {
> uint32_tsrc_ip;
> uint16_tdst_port;
> uint16_tsrc_port;
> -   uint8_t fib;
> +   uint8_t fib;/* XXX: must be uint16_t */
> uint8_t proto;
> uint8_t _flags; /* protocol-specific flags */
> uint8_t addr_type; /* 4=ip4, 6=ip6, 1=ether ? */
> @@ -682,6 +682,7 @@ struct ipfw_flow_id {
>  };
>  #endif
>
> +#defineIS_IP4_FLOW_ID(id)  ((id)->addr_type == 4)
>  #define IS_IP6_FLOW_ID(id) ((id)->addr_type == 6)
>
>  /*
>
> Modified: head/sys/netpfil/ipfw/ip_fw2.c
> ===

Re: svn commit: r331898 - in head/sys/contrib/ck: . include include/gcc include/gcc/sparcv9 include/gcc/x86 include/gcc/x86_64 include/spinlock src

2018-04-02 Thread Adrian Chadd
hi!

woohoo!

what about CACHE_LINE_SIZE ?


-a
___
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: r318226 - head/sys/dev/iwm

2017-05-11 Thread Adrian Chadd
Author: adrian
Date: Fri May 12 06:30:06 2017
New Revision: 318226
URL: https://svnweb.freebsd.org/changeset/base/318226

Log:
  [iwm] Switch arguments from iwm_node* to iwm_vap* in if_iwm_power.c.
  
  * Power management handling is per-vap, not per-node, so we should pass
the iwm_vap in these arguments.
  
  Obtained from:dragonflybsd.git 
62a4e7957a736b4de38938b02fa7eb9b45bc5d0d

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_power.c
  head/sys/dev/iwm/if_iwm_power.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Fri May 12 06:21:03 2017(r318225)
+++ head/sys/dev/iwm/if_iwm.c   Fri May 12 06:30:06 2017(r318226)
@@ -4462,7 +4462,7 @@ iwm_newstate(struct ieee80211vap *vap, e
"%s: failed to update MAC: %d\n", __func__, error);
}
 
-   iwm_mvm_enable_beacon_filter(sc, in);
+   iwm_mvm_enable_beacon_filter(sc, ivp);
iwm_mvm_power_update_mac(sc);
iwm_mvm_update_quotas(sc, ivp);
iwm_setrates(sc, in);

Modified: head/sys/dev/iwm/if_iwm_power.c
==
--- head/sys/dev/iwm/if_iwm_power.c Fri May 12 06:21:03 2017
(r318225)
+++ head/sys/dev/iwm/if_iwm_power.c Fri May 12 06:30:06 2017
(r318226)
@@ -201,7 +201,7 @@ iwm_mvm_beacon_filter_send_cmd(struct iw
 
 static void
 iwm_mvm_beacon_filter_set_cqm_params(struct iwm_softc *sc,
-   struct iwm_node *in, struct iwm_beacon_filter_cmd *cmd)
+   struct iwm_vap *ivp, struct iwm_beacon_filter_cmd *cmd)
 {
cmd->ba_enable_beacon_abort = htole32(sc->sc_bf.ba_enabled);
 }
@@ -278,15 +278,14 @@ iwm_mvm_power_config_skip_dtim(struct iw
 }
 
 static void
-iwm_mvm_power_build_cmd(struct iwm_softc *sc, struct iwm_node *in,
+iwm_mvm_power_build_cmd(struct iwm_softc *sc, struct iwm_vap *ivp,
struct iwm_mac_power_cmd *cmd)
 {
-   struct ieee80211_node *ni = &in->in_ni;
+   struct ieee80211_node *ni = ivp->iv_vap.iv_bss;
int dtimper, dtimper_msec;
int keep_alive;
struct ieee80211com *ic = &sc->sc_ic;
struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
-   struct iwm_vap *ivp = IWM_VAP(vap);
 
cmd->id_and_color = htole32(IWM_FW_CMD_ID_AND_COLOR(ivp->id,
ivp->color));
@@ -319,11 +318,11 @@ iwm_mvm_power_build_cmd(struct iwm_softc
 }
 
 static int
-iwm_mvm_power_send_cmd(struct iwm_softc *sc, struct iwm_node *in)
+iwm_mvm_power_send_cmd(struct iwm_softc *sc, struct iwm_vap *ivp)
 {
struct iwm_mac_power_cmd cmd = {};
 
-   iwm_mvm_power_build_cmd(sc, in, &cmd);
+   iwm_mvm_power_build_cmd(sc, ivp, &cmd);
iwm_mvm_power_log(sc, &cmd);
 
return iwm_mvm_send_cmd_pdu(sc, IWM_MAC_PM_POWER_TABLE, 0,
@@ -331,12 +330,12 @@ iwm_mvm_power_send_cmd(struct iwm_softc 
 }
 
 static int
-_iwm_mvm_enable_beacon_filter(struct iwm_softc *sc, struct iwm_node *in,
+_iwm_mvm_enable_beacon_filter(struct iwm_softc *sc, struct iwm_vap *ivp,
struct iwm_beacon_filter_cmd *cmd)
 {
int ret;
 
-   iwm_mvm_beacon_filter_set_cqm_params(sc, in, cmd);
+   iwm_mvm_beacon_filter_set_cqm_params(sc, ivp, cmd);
ret = iwm_mvm_beacon_filter_send_cmd(sc, cmd);
 
if (!ret)
@@ -346,14 +345,14 @@ _iwm_mvm_enable_beacon_filter(struct iwm
 }
 
 int
-iwm_mvm_enable_beacon_filter(struct iwm_softc *sc, struct iwm_node *in)
+iwm_mvm_enable_beacon_filter(struct iwm_softc *sc, struct iwm_vap *ivp)
 {
struct iwm_beacon_filter_cmd cmd = {
IWM_BF_CMD_CONFIG_DEFAULTS,
.bf_enable_beacon_filter = htole32(1),
};
 
-   return _iwm_mvm_enable_beacon_filter(sc, in, &cmd);
+   return _iwm_mvm_enable_beacon_filter(sc, ivp, &cmd);
 }
 
 int
@@ -398,7 +397,7 @@ iwm_mvm_power_set_ps(struct iwm_softc *s
 }
 
 static int
-iwm_mvm_power_set_ba(struct iwm_softc *sc, struct iwm_node *in)
+iwm_mvm_power_set_ba(struct iwm_softc *sc, struct iwm_vap *ivp)
 {
struct iwm_beacon_filter_cmd cmd = {
IWM_BF_CMD_CONFIG_DEFAULTS,
@@ -410,7 +409,7 @@ iwm_mvm_power_set_ba(struct iwm_softc *s
 
sc->sc_bf.ba_enabled = !sc->sc_ps_disabled;
 
-   return _iwm_mvm_enable_beacon_filter(sc, in, &cmd);
+   return _iwm_mvm_enable_beacon_filter(sc, ivp, &cmd);
 }
 
 int
@@ -424,7 +423,7 @@ iwm_mvm_power_update_ps(struct iwm_softc
return ret;
 
if (vap != NULL)
-   return iwm_mvm_power_set_ba(sc, IWM_NODE(vap->iv_bss));
+   return iwm_mvm_power_set_ba(sc, IWM_VAP(vap));
 
return 0;
 }
@@ -440,13 +439,13 @@ iwm_mvm_power_update_mac(struct iwm_soft
return ret;
 
if (vap != NULL) {
-   ret = iwm_mvm_power_send_cmd(sc, IWM_NODE(vap->iv_bss));
+   ret = iwm_mvm_power_send_cmd(sc, IWM_V

svn commit: r318227 - head/sys/dev/iwm

2017-05-11 Thread Adrian Chadd
Author: adrian
Date: Fri May 12 06:30:50 2017
New Revision: 318227
URL: https://svnweb.freebsd.org/changeset/base/318227

Log:
  [iwm] Clean up if_iwm_power.c a bit. Fix iwm_power_scheme debug print.
  
  Obtained from:dragonflybsd.git 
52c3adbee676d8558065618e5ad694ea5c6697e0

Modified:
  head/sys/dev/iwm/if_iwm_power.c

Modified: head/sys/dev/iwm/if_iwm_power.c
==
--- head/sys/dev/iwm/if_iwm_power.c Fri May 12 06:30:06 2017
(r318226)
+++ head/sys/dev/iwm/if_iwm_power.c Fri May 12 06:30:50 2017
(r318227)
@@ -212,7 +212,7 @@ iwm_mvm_power_log(struct iwm_softc *sc, 
IWM_DPRINTF(sc, IWM_DEBUG_PWRSAVE | IWM_DEBUG_CMD,
"Sending power table command on mac id 0x%X for "
"power level %d, flags = 0x%X\n",
-   cmd->id_and_color, IWM_POWER_SCHEME_CAM, le16toh(cmd->flags));
+   cmd->id_and_color, iwm_power_scheme, le16toh(cmd->flags));
IWM_DPRINTF(sc, IWM_DEBUG_PWRSAVE | IWM_DEBUG_CMD,
"Keep alive = %u sec\n", le16toh(cmd->keep_alive_seconds));
 
@@ -281,11 +281,10 @@ static void
 iwm_mvm_power_build_cmd(struct iwm_softc *sc, struct iwm_vap *ivp,
struct iwm_mac_power_cmd *cmd)
 {
-   struct ieee80211_node *ni = ivp->iv_vap.iv_bss;
+   struct ieee80211vap *vap = &ivp->iv_vap;
+   struct ieee80211_node *ni = vap->iv_bss;
int dtimper, dtimper_msec;
int keep_alive;
-   struct ieee80211com *ic = &sc->sc_ic;
-   struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
 
cmd->id_and_color = htole32(IWM_FW_CMD_ID_AND_COLOR(ivp->id,
ivp->color));
___
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: r318228 - head/sys/dev/iwm

2017-05-11 Thread Adrian Chadd
Author: adrian
Date: Fri May 12 06:31:57 2017
New Revision: 318228
URL: https://svnweb.freebsd.org/changeset/base/318228

Log:
  [iwm] Make powersaving more similar to Linux iwlwifi behaviour.
  
  * Add a per-vap ps_disabled flag, and use it for a workaround which fixes
an association issue when powersaving is enabled.
  
  * Compute flag that should correpsond to the mvmif->bss_conf.ps flag in
Linux's iwlwifi (e.g. this disallows powersaving when not associated
yet).
  
  Inspired-By: Linux iwlwifi
  
  Obtained from:dragonflybsd.git 
dc2e69bdfe8c9d7049c8a28da0adffbfbc6de5c0

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_power.c
  head/sys/dev/iwm/if_iwmvar.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Fri May 12 06:30:50 2017(r318227)
+++ head/sys/dev/iwm/if_iwm.c   Fri May 12 06:31:57 2017(r318228)
@@ -4044,7 +4044,15 @@ iwm_auth(struct ieee80211vap *vap, struc
"%s: binding update cmd\n", __func__);
goto out;
}
-   if ((error = iwm_mvm_power_update_mac(sc)) != 0) {
+   /*
+* Authentication becomes unreliable when powersaving is left enabled
+* here. Powersaving will be activated again when association has
+* finished or is aborted.
+*/
+   iv->ps_disabled = TRUE;
+   error = iwm_mvm_power_update_mac(sc);
+   iv->ps_disabled = FALSE;
+   if (error != 0) {
device_printf(sc->sc_dev,
"%s: failed to update power management\n",
__func__);
@@ -6277,6 +6285,7 @@ iwm_vap_create(struct ieee80211com *ic, 
ivp->color = IWM_DEFAULT_COLOR;
 
ivp->have_wme = FALSE;
+   ivp->ps_disabled = FALSE;
 
ieee80211_ratectl_init(vap);
/* Complete setup. */

Modified: head/sys/dev/iwm/if_iwm_power.c
==
--- head/sys/dev/iwm/if_iwm_power.c Fri May 12 06:30:50 2017
(r318227)
+++ head/sys/dev/iwm/if_iwm_power.c Fri May 12 06:31:57 2017
(r318228)
@@ -285,6 +285,7 @@ iwm_mvm_power_build_cmd(struct iwm_softc
struct ieee80211_node *ni = vap->iv_bss;
int dtimper, dtimper_msec;
int keep_alive;
+   boolean_t bss_conf_ps = FALSE;
 
cmd->id_and_color = htole32(IWM_FW_CMD_ID_AND_COLOR(ivp->id,
ivp->color));
@@ -306,6 +307,14 @@ iwm_mvm_power_build_cmd(struct iwm_softc
return;
 
cmd->flags |= htole16(IWM_POWER_FLAGS_POWER_SAVE_ENA_MSK);
+
+   if (IWM_NODE(ni)->in_assoc &&
+   (vap->iv_flags & IEEE80211_F_PMGTON) != 0) {
+   bss_conf_ps = TRUE;
+   }
+   if (!bss_conf_ps)
+   return;
+
cmd->flags |= htole16(IWM_POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK);
 
iwm_mvm_power_config_skip_dtim(sc, cmd);
@@ -370,15 +379,18 @@ iwm_mvm_disable_beacon_filter(struct iwm
 static int
 iwm_mvm_power_set_ps(struct iwm_softc *sc)
 {
-   struct ieee80211vap *vap = TAILQ_FIRST(&sc->sc_ic.ic_vaps);
+   struct ieee80211vap *vap;
boolean_t disable_ps;
int ret;
 
/* disable PS if CAM */
disable_ps = (iwm_power_scheme == IWM_POWER_SCHEME_CAM);
/* ...or if any of the vifs require PS to be off */
-   if (vap != NULL && (vap->iv_flags & IEEE80211_F_PMGTON) == 0)
-   disable_ps = TRUE;
+   TAILQ_FOREACH(vap, &sc->sc_ic.ic_vaps, iv_next) {
+   struct iwm_vap *ivp = IWM_VAP(vap);
+   if (ivp->phy_ctxt != NULL && ivp->ps_disabled)
+   disable_ps = TRUE;
+   }
 
/* update device power state if it has changed */
if (sc->sc_ps_disabled != disable_ps) {
@@ -402,11 +414,18 @@ iwm_mvm_power_set_ba(struct iwm_softc *s
IWM_BF_CMD_CONFIG_DEFAULTS,
.bf_enable_beacon_filter = htole32(1),
};
+   struct ieee80211vap *vap = &ivp->iv_vap;
+   struct ieee80211_node *ni = vap->iv_bss;
+   boolean_t bss_conf_ps = FALSE;
 
if (!sc->sc_bf.bf_enabled)
return 0;
 
-   sc->sc_bf.ba_enabled = !sc->sc_ps_disabled;
+   if (ni != NULL && IWM_NODE(ni)->in_assoc &&
+   (vap->iv_flags & IEEE80211_F_PMGTON) != 0) {
+   bss_conf_ps = TRUE;
+   }
+   sc->sc_bf.ba_enabled = !sc->sc_ps_disabled && bss_conf_ps;
 
return _iwm_mvm_enable_beacon_filter(sc, ivp, &cmd);
 }

Modified: head/sys/dev/iwm/if_iwmvar.h
==
--- head/sys/dev/iwm/if_iwmvar.hFri May 12 06:30:50 2017
(r318227)
+++ head/sys/dev/iwm/if_iwmvar.hFri May 12 06:31:57 2017
(r318228)
@@ -390,6 +390,9 @@ struct iwm_vap {
uint16_t edca_txop;
uint8_t aifsn;
} queue_params[WME_NUM_AC];
+
+   /

svn commit: r318229 - head/sys/dev/iwm

2017-05-11 Thread Adrian Chadd
Author: adrian
Date: Fri May 12 06:33:07 2017
New Revision: 318229
URL: https://svnweb.freebsd.org/changeset/base/318229

Log:
  [iwm] Adjust if_iwm_sta.h prototypes, don't pass iwm_node to rm_sta().
  
  * Since a RUN -> INIT/SCAN transition seems to immediately destroy the
ieee80211_node for the AP, we can't read the in_assoc value from there.
Instead just directly pass that information via a boolean_t argument.
  
  * Adds iwm_mvm_rm_sta_id() function, which just unconditionally removes
the station from the firmware.
  
  * The iwm_mvm_rm_sta() function shouldn't actually remove the station from
firmware when we are still associated (i.e. during a RUN -> INIT/SCAN
transition).
  
   * So when disassociating we will first call iwm_mvm_rm_sta() to drain the
 queues/fifos. Later during disassociation we will then use
 iwm_mvm_rm_sta_id() to actually remove the station.
  
  Inspired-By: Linux iwlwifi
  
  Obtained from:dragonflybsd.git 
81b3c1fe9122fa22f33d97103039cc375f656231

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_sta.c
  head/sys/dev/iwm/if_iwm_sta.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Fri May 12 06:31:57 2017(r318228)
+++ head/sys/dev/iwm/if_iwm.c   Fri May 12 06:33:07 2017(r318229)
@@ -4396,8 +4396,7 @@ iwm_newstate(struct ieee80211vap *vap, e
myerr = ivp->iv_newstate(vap, nstate, arg);
IEEE80211_UNLOCK(ic);
IWM_LOCK(sc);
-   in = IWM_NODE(vap->iv_bss);
-   error = iwm_mvm_rm_sta(sc, vap, in);
+   error = iwm_mvm_rm_sta(sc, vap, FALSE);
 if (error) {
 device_printf(sc->sc_dev,
"%s: Failed to remove station: %d\n",

Modified: head/sys/dev/iwm/if_iwm_sta.c
==
--- head/sys/dev/iwm/if_iwm_sta.c   Fri May 12 06:31:57 2017
(r318228)
+++ head/sys/dev/iwm/if_iwm_sta.c   Fri May 12 06:33:07 2017
(r318229)
@@ -213,10 +213,9 @@ iwm_mvm_update_sta(struct iwm_softc *sc,
 }
 
 int
-iwm_mvm_drain_sta(struct iwm_softc *sc, struct iwm_node *in, boolean_t drain)
+iwm_mvm_drain_sta(struct iwm_softc *sc, struct iwm_vap *ivp, boolean_t drain)
 {
struct iwm_mvm_add_sta_cmd cmd = {};
-   struct iwm_vap *ivp = IWM_VAP(in->in_ni.ni_vap);
int ret;
uint32_t status;
 
@@ -275,13 +274,13 @@ iwm_mvm_rm_sta_common(struct iwm_softc *
 
 int
 iwm_mvm_rm_sta(struct iwm_softc *sc, struct ieee80211vap *vap,
-   struct iwm_node *in)
+   boolean_t is_assoc)
 {
uint32_t tfd_queue_msk = 0;
int ret;
int ac;
 
-   ret = iwm_mvm_drain_sta(sc, in, TRUE);
+   ret = iwm_mvm_drain_sta(sc, IWM_VAP(vap), TRUE);
if (ret)
return ret;
mbufq_drain(&sc->sc_snd); /* XXX needed ? */
@@ -297,13 +296,12 @@ iwm_mvm_rm_sta(struct iwm_softc *sc, str
if (ret)
return ret;
 #endif
-   ret = iwm_mvm_drain_sta(sc, in, FALSE);
+   ret = iwm_mvm_drain_sta(sc, IWM_VAP(vap), FALSE);
 
-#if 0
/* if we are associated - we can't remove the AP STA now */
-   if (sta->assoc)
+   if (is_assoc)
return ret;
-#endif
+
/* XXX wait until STA is drained */
 
ret = iwm_mvm_rm_sta_common(sc);
@@ -311,6 +309,14 @@ iwm_mvm_rm_sta(struct iwm_softc *sc, str
return ret;
 }
 
+int
+iwm_mvm_rm_sta_id(struct iwm_softc *sc, struct ieee80211vap *vap)
+{
+   /* XXX wait until STA is drained */
+
+   return iwm_mvm_rm_sta_common(sc);
+}
+
 static int
 iwm_mvm_add_int_sta_common(struct iwm_softc *sc, struct iwm_int_sta *sta,
const uint8_t *addr, uint16_t mac_id, uint16_t color)

Modified: head/sys/dev/iwm/if_iwm_sta.h
==
--- head/sys/dev/iwm/if_iwm_sta.h   Fri May 12 06:31:57 2017
(r318228)
+++ head/sys/dev/iwm/if_iwm_sta.h   Fri May 12 06:33:07 2017
(r318229)
@@ -211,12 +211,13 @@ externint iwm_mvm_sta_send_to_fw(struct
 extern int iwm_mvm_add_sta(struct iwm_softc *sc, struct iwm_node *in);
 extern int iwm_mvm_update_sta(struct iwm_softc *sc, struct iwm_node *in);
 extern int iwm_mvm_rm_sta(struct iwm_softc *sc, struct ieee80211vap *vap,
-  struct iwm_node *in);
+  boolean_t is_assoc);
+extern int iwm_mvm_rm_sta_id(struct iwm_softc *sc, struct ieee80211vap *vap);
 
 extern int iwm_mvm_add_aux_sta(struct iwm_softc *sc);
 extern void iwm_mvm_del_aux_sta(struct iwm_softc *sc);
 
-extern int iwm_mvm_drain_sta(struct iwm_softc *sc, struct iwm_node *in,
+extern int iwm_mvm_drain_sta(struct iwm_softc *sc, struct iwm_vap *ivp,

svn commit: r318230 - head/sys/dev/iwm

2017-05-11 Thread Adrian Chadd
Author: adrian
Date: Fri May 12 06:33:55 2017
New Revision: 318230
URL: https://svnweb.freebsd.org/changeset/base/318230

Log:
  [iwm] Fix iwm_mvm_send_cmd_pdu(_status) declarations. Make id a uint32_t.
  
  * This fixes cases where the group id of wide commands got lost, e.g. this
happened to the IWM_SCAN_ABORT_UMAC command.
  
  Obtained from:dragonflybsd.git 
71310fab0caca79bb5da43d9d642e77a4c27eea2

Modified:
  head/sys/dev/iwm/if_iwm_util.c
  head/sys/dev/iwm/if_iwm_util.h

Modified: head/sys/dev/iwm/if_iwm_util.c
==
--- head/sys/dev/iwm/if_iwm_util.c  Fri May 12 06:33:07 2017
(r318229)
+++ head/sys/dev/iwm/if_iwm_util.c  Fri May 12 06:33:55 2017
(r318230)
@@ -346,7 +346,7 @@ iwm_send_cmd(struct iwm_softc *sc, struc
 
 /* iwlwifi: mvm/utils.c */
 int
-iwm_mvm_send_cmd_pdu(struct iwm_softc *sc, uint8_t id,
+iwm_mvm_send_cmd_pdu(struct iwm_softc *sc, uint32_t id,
uint32_t flags, uint16_t len, const void *data)
 {
struct iwm_host_cmd cmd = {
@@ -402,7 +402,7 @@ iwm_mvm_send_cmd_status(struct iwm_softc
 
 /* iwlwifi/mvm/utils.c */
 int
-iwm_mvm_send_cmd_pdu_status(struct iwm_softc *sc, uint8_t id,
+iwm_mvm_send_cmd_pdu_status(struct iwm_softc *sc, uint32_t id,
uint16_t len, const void *data, uint32_t *status)
 {
struct iwm_host_cmd cmd = {

Modified: head/sys/dev/iwm/if_iwm_util.h
==
--- head/sys/dev/iwm/if_iwm_util.h  Fri May 12 06:33:07 2017
(r318229)
+++ head/sys/dev/iwm/if_iwm_util.h  Fri May 12 06:33:55 2017
(r318230)
@@ -107,12 +107,12 @@
 #define__IF_IWM_UTIL_H__
 
 extern int iwm_send_cmd(struct iwm_softc *sc, struct iwm_host_cmd *hcmd);
-extern int iwm_mvm_send_cmd_pdu(struct iwm_softc *sc, uint8_t id,
+extern int iwm_mvm_send_cmd_pdu(struct iwm_softc *sc, uint32_t id,
uint32_t flags, uint16_t len, const void *data);
 
 extern int iwm_mvm_send_cmd_status(struct iwm_softc *sc,
struct iwm_host_cmd *cmd, uint32_t *status);
-extern int iwm_mvm_send_cmd_pdu_status(struct iwm_softc *sc, uint8_t id,
+extern int iwm_mvm_send_cmd_pdu_status(struct iwm_softc *sc, uint32_t id,
uint16_t len, const void *data, uint32_t *status);
 extern void iwm_free_resp(struct iwm_softc *sc, struct iwm_host_cmd *hcmd);
 
___
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: r318231 - head/sys/dev/iwm

2017-05-11 Thread Adrian Chadd
Author: adrian
Date: Fri May 12 06:34:43 2017
New Revision: 318231
URL: https://svnweb.freebsd.org/changeset/base/318231

Log:
  [iwm] Revert "if_iwm - SCAN_ABORT_UMAC response doesn't use a wide id"
  
  This reverts commit cef47a9cbb0a3ce5f18369fed9403d2764884bc2.
  
  Obtained from:dragonflybsd.git 
f62d325820ee7f7c2bcf721ada9cef8b70f74471

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Fri May 12 06:33:55 2017(r318230)
+++ head/sys/dev/iwm/if_iwm.c   Fri May 12 06:34:43 2017(r318231)
@@ -5450,7 +5450,7 @@ iwm_handle_rxb(struct iwm_softc *sc, str
case IWM_TIME_EVENT_CMD:
case IWM_WIDE_ID(IWM_ALWAYS_LONG_GROUP, IWM_SCAN_CFG_CMD):
case IWM_WIDE_ID(IWM_ALWAYS_LONG_GROUP, IWM_SCAN_REQ_UMAC):
-   case IWM_SCAN_ABORT_UMAC:
+   case IWM_WIDE_ID(IWM_ALWAYS_LONG_GROUP, IWM_SCAN_ABORT_UMAC):
case IWM_SCAN_OFFLOAD_REQUEST_CMD:
case IWM_SCAN_OFFLOAD_ABORT_CMD:
case IWM_REPLY_BEACON_FILTERING_CMD:
___
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: r318232 - head/sys/dev/iwm

2017-05-11 Thread Adrian Chadd
Author: adrian
Date: Fri May 12 06:35:20 2017
New Revision: 318232
URL: https://svnweb.freebsd.org/changeset/base/318232

Log:
  [iwm] Recognize IWM_FW_PAGING_BLOCK_CMD wide cmd response correctly.
  
  Obtained from:dragonflybsd.git 
ef688cebb9b29b67f7a011846589971987949e0d

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Fri May 12 06:34:43 2017(r318231)
+++ head/sys/dev/iwm/if_iwm.c   Fri May 12 06:35:20 2017(r318232)
@@ -5459,7 +5459,8 @@ iwm_handle_rxb(struct iwm_softc *sc, str
case IWM_REMOVE_STA:
case IWM_TXPATH_FLUSH:
case IWM_LQ_CMD:
-   case IWM_FW_PAGING_BLOCK_CMD:
+   case IWM_WIDE_ID(IWM_ALWAYS_LONG_GROUP,
+IWM_FW_PAGING_BLOCK_CMD):
case IWM_BT_CONFIG:
case IWM_REPLY_THERMAL_MNG_BACKOFF:
cresp = (void *)pkt->data;
___
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: r318413 - head/sys/net80211

2017-05-17 Thread Adrian Chadd
Author: adrian
Date: Wed May 17 19:34:36 2017
New Revision: 318413
URL: https://svnweb.freebsd.org/changeset/base/318413

Log:
  [net80211] initial VHT radiotap implementation defines from upstream radiotap.

Modified:
  head/sys/net80211/ieee80211_radiotap.h

Modified: head/sys/net80211/ieee80211_radiotap.h
==
--- head/sys/net80211/ieee80211_radiotap.h  Wed May 17 16:32:24 2017
(r318412)
+++ head/sys/net80211/ieee80211_radiotap.h  Wed May 17 19:34:36 2017
(r318413)
@@ -178,6 +178,30 @@ struct ieee80211_radiotap_header {
  *  finally the maximum regulatory transmit power cap in .5 dBm
  *  units.  This property supersedes IEEE80211_RADIOTAP_CHANNEL
  *  and only one of the two should be present.
+ * IEEE80211_RADIOTAP_RX_FLAGS  guint16   bitmap
+ *
+ * Properties of received frames. See flags defined below.
+ *
+ * IEEE80211_RADIOTAP_TX_FLAGS  guint16   bitmap
+ *
+ * Properties of transmitted frames. See flags defined below.
+ *
+ * IEEE80211_RADIOTAP_RTS_RETRIES   u8   data
+ *
+ * Number of rts retries a transmitted frame used.
+ *
+ * IEEE80211_RADIOTAP_DATA_RETRIES  u8   data
+ *
+ * Number of unicast retries a transmitted frame used.
+ *
+ * IEEE80211_RADIOTAP_MCS   u8, u8, u8  unitless
+ *
+ * Contains a bitmap of known fields/flags, the flags, and
+ * the MCS index.
+ *
+ * IEEE80211_RADIOTAP_AMPDU_STATUS  u32, u16, u8, u8unitlesss
+ *
+ *  Contains the AMPDU information for the subframe.
  */
 enum ieee80211_radiotap_type {
IEEE80211_RADIOTAP_TSFT = 0,
@@ -206,6 +230,7 @@ enum ieee80211_radiotap_type {
IEEE80211_RADIOTAP_XCHANNEL = 18,
IEEE80211_RADIOTAP_MCS = 19,
IEEE80211_RADIOTAP_AMPDU_STATUS = 20,
+   IEEE80211_RADIOTAP_VHT = 21,
 
 IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29,
IEEE80211_RADIOTAP_VENDOREXT = 30,
@@ -250,4 +275,95 @@ enum ieee80211_radiotap_type {
 #defineIEEE80211_RADIOTAP_F_BADFCS 0x40/* does not pass FCS 
check */
 #defineIEEE80211_RADIOTAP_F_SHORTGI0x80/* HT short GI */
 
+/* For IEEE80211_RADIOTAP_RX_FLAGS */
+#defineIEEE80211_RADIOTAP_F_RX_BADPLCP 0x0002  /* bad PLCP */
+
+/* For IEEE80211_RADIOTAP_TX_FLAGS */
+#defineIEEE80211_RADIOTAP_F_TX_FAIL0x0001  /* failed due to 
excessive
+* retries */
+#defineIEEE80211_RADIOTAP_F_TX_CTS 0x0002  /* used cts 
'protection' */
+#defineIEEE80211_RADIOTAP_F_TX_RTS 0x0004  /* used rts/cts 
handshake */
+
+
+/* For IEEE80211_RADIOTAP_MCS */
+#defineIEEE80211_RADIOTAP_MCS_HAVE_BW  0x01
+#defineIEEE80211_RADIOTAP_MCS_HAVE_MCS 0x02
+#defineIEEE80211_RADIOTAP_MCS_HAVE_GI  0x04
+#defineIEEE80211_RADIOTAP_MCS_HAVE_FMT 0x08
+#defineIEEE80211_RADIOTAP_MCS_HAVE_FEC 0x10
+#defineIEEE80211_RADIOTAP_MCS_HAVE_STBC0x20
+#defineIEEE80211_RADIOTAP_MCS_HAVE_NESS0x40
+#defineIEEE80211_RADIOTAP_MCS_NESS_BIT10x80
+
+#defineIEEE80211_RADIOTAP_MCS_BW_MASK  0x03
+#defineIEEE80211_RADIOTAP_MCS_BW_200
+#defineIEEE80211_RADIOTAP_MCS_BW_401
+#define IEEE80211_RADIOTAP_MCS_BW_20L  2
+#defineIEEE80211_RADIOTAP_MCS_BW_20U   3
+#defineIEEE80211_RADIOTAP_MCS_SGI  0x04
+#defineIEEE80211_RADIOTAP_MCS_FMT_GF   0x08
+#defineIEEE80211_RADIOTAP_MCS_FEC_LDPC 0x10
+#defineIEEE80211_RADIOTAP_MCS_STBC_MASK0x60
+#defineIEEE80211_RADIOTAP_MCS_STBC_SHIFT   5
+#defineIEEE80211_RADIOTAP_MCS_STBC_1   1
+#defineIEEE80211_RADIOTAP_MCS_STBC_2   2
+#defineIEEE80211_RADIOTAP_MCS_STBC_3   3
+#defineIEEE80211_RADIOTAP_MCS_NESS_BIT00x80
+
+/* For IEEE80211_RADIOTAP_AMPDU_STATUS */
+#defineIEEE80211_RADIOTAP_AMPDU_REPORT_ZEROLEN 0x0001
+#defineIEEE80211_RADIOTAP_AMPDU_IS_ZEROLEN 0x0002
+#defineIEEE80211_RADIOTAP_AMPDU_LAST_KNOWN 0x0004
+#defineIEEE80211_RADIOTAP_AMPDU_IS_LAST0x0008
+#defineIEEE80211_RADIOTAP_AMPDU_DELIM_CRC_ERR  0x0010
+#defineIEEE80211_RADIOTAP_AMPDU_DELIM_CRC_KNOWN0x0020
+
+/* For IEEE80211_RADIOTAP_VHT */
+#defineIEEE80211_RADIOTAP_VHT_HAVE_STBC0x0001
+#defineIEEE80211_RADIOTAP_VHT_HAVE_TXOP_PS 0x0002
+#defineIEEE80211_RADIOTAP_VHT_HAVE_GI  0x0004
+#defineIEEE80211_RADIOTAP_VHT_HAVE_SGI_NSYM_DA 0x0008
+#defineIEEE80211_RADIOTAP_VHT_HAVE_LDPC_EXTRA  0x0010
+#defineIEEE80211_RADIOTAP_VHT_HAVE_BF  0x0020
+#defineIEEE80211_RADIOTAP_VHT_HAVE_BW  

svn commit: r318566 - head/sys/net80211

2017-05-19 Thread Adrian Chadd
Author: adrian
Date: Sat May 20 00:43:52 2017
New Revision: 318566
URL: https://svnweb.freebsd.org/changeset/base/318566

Log:
  [net80211] prepare for A-MSDU/A-MPDU offload crypto / sequence number 
checking.
  
  When doing AMSDU offload, the driver (for now!) presents 802.11 frames with
  the same sequence number and crypto sequence number / IV values up to the 
stack.
  But, this will trip afoul over the sequence number detection.
  
  So drivers now have a way to signify that a frame is part of an offloaded
  AMSDU group, so we can just ensure that we pass those frames up to the
  stack.
  
  The logic will be a bit messy - the TL;DR will be that if it's part of
  the previously seen sequence number then it belongs in the same burst.
  But if we get a repeat of the same sequence number (eg we sent an ACK
  but the receiver didn't hear it) then we shouldn't be passing those frames
  up.  So, we can't just say "all subframes go up", we need to track
  whether we've seen the end of a burst of frames for the given sequence
  number or not, so we know whether to actually pass them up or not.
  
  The first part of doing all of this is to ensure the ieee80211_rx_stats
  struct is available in the RX sequence number check path and the
  RX ampdu reorder path.  So, start by passing the pointer into these
  functions to avoid doing another lookup.
  
  The actual support will come in a subsequent commit once I know the
  functionality actually works!

Modified:
  head/sys/net80211/ieee80211_adhoc.c
  head/sys/net80211/ieee80211_hostap.c
  head/sys/net80211/ieee80211_ht.c
  head/sys/net80211/ieee80211_ht.h
  head/sys/net80211/ieee80211_input.h
  head/sys/net80211/ieee80211_mesh.c
  head/sys/net80211/ieee80211_sta.c
  head/sys/net80211/ieee80211_wds.c

Modified: head/sys/net80211/ieee80211_adhoc.c
==
--- head/sys/net80211/ieee80211_adhoc.c Sat May 20 00:42:47 2017
(r318565)
+++ head/sys/net80211/ieee80211_adhoc.c Sat May 20 00:43:52 2017
(r318566)
@@ -448,7 +448,7 @@ adhoc_input(struct ieee80211_node *ni, s
if (IEEE80211_QOS_HAS_SEQ(wh) &&
TID_TO_WME_AC(tid) >= WME_AC_VI)
ic->ic_wme.wme_hipri_traffic++;
-   if (! ieee80211_check_rxseq(ni, wh, bssid))
+   if (! ieee80211_check_rxseq(ni, wh, bssid, rxs))
goto out;
}
}
@@ -479,7 +479,7 @@ adhoc_input(struct ieee80211_node *ni, s
 * and we should do nothing more with it.
 */
if ((m->m_flags & M_AMPDU) &&
-   ieee80211_ampdu_reorder(ni, m) != 0) {
+   ieee80211_ampdu_reorder(ni, m, rxs) != 0) {
m = NULL;
goto out;
}

Modified: head/sys/net80211/ieee80211_hostap.c
==
--- head/sys/net80211/ieee80211_hostap.cSat May 20 00:42:47 2017
(r318565)
+++ head/sys/net80211/ieee80211_hostap.cSat May 20 00:43:52 2017
(r318566)
@@ -577,7 +577,7 @@ hostap_input(struct ieee80211_node *ni, 
if (IEEE80211_QOS_HAS_SEQ(wh) &&
TID_TO_WME_AC(tid) >= WME_AC_VI)
ic->ic_wme.wme_hipri_traffic++;
-   if (! ieee80211_check_rxseq(ni, wh, bssid))
+   if (! ieee80211_check_rxseq(ni, wh, bssid, rxs))
goto out;
}
}
@@ -665,7 +665,7 @@ hostap_input(struct ieee80211_node *ni, 
 * and we should do nothing more with it.
 */
if ((m->m_flags & M_AMPDU) &&
-   ieee80211_ampdu_reorder(ni, m) != 0) {
+   ieee80211_ampdu_reorder(ni, m, rxs) != 0) {
m = NULL;
goto out;
}

Modified: head/sys/net80211/ieee80211_ht.c
==
--- head/sys/net80211/ieee80211_ht.cSat May 20 00:42:47 2017
(r318565)
+++ head/sys/net80211/ieee80211_ht.cSat May 20 00:43:52 2017
(r318566)
@@ -849,7 +849,8 @@ ampdu_rx_flush_upto(struct ieee80211_nod
  * the frame should be processed normally by the caller.
  */
 int
-ieee80211_ampdu_reorder(struct ieee80211_node *ni, struct mbuf *m)
+ieee80211_ampdu_reorder(struct ieee80211_node *ni, struct mbuf *m,
+const struct ieee80211_rx_stats *rxs)
 {
 #definePROCESS 0   /* caller should process frame */
 #defineCONSUMED1   /* frame consumed, caller does nothing 
*/

Modified: head/sys/net80211/ieee80211_ht.h
==
--- head/sys/net80211/ieee80211_ht.hSat Ma

svn commit: r318601 - in head: contrib/compiler-rt/lib/builtins lib/libcompiler_rt

2017-05-21 Thread Adrian Chadd
Author: adrian
Date: Sun May 21 23:15:32 2017
New Revision: 318601
URL: https://svnweb.freebsd.org/changeset/base/318601

Log:
  [libcompiler-rt] add bswapdi2/bswapsi2
  
  This is required for mips gcc 6.3 userland to build/run.
  
  Reviewed by:  emaste, dim
  Approved by:  emaste
  Differential Revision:https://reviews.freebsd.org/D10838

Added:
  head/contrib/compiler-rt/lib/builtins/bswapdi2.c   (contents, props changed)
  head/contrib/compiler-rt/lib/builtins/bswapsi2.c   (contents, props changed)
Modified:
  head/contrib/compiler-rt/lib/builtins/README.txt
  head/lib/libcompiler_rt/Makefile.inc

Modified: head/contrib/compiler-rt/lib/builtins/README.txt
==
--- head/contrib/compiler-rt/lib/builtins/README.txtSun May 21 22:28:28 
2017(r318600)
+++ head/contrib/compiler-rt/lib/builtins/README.txtSun May 21 23:15:32 
2017(r318601)
@@ -57,8 +57,8 @@ si_int __popcountsi2(si_int a);  // bit 
 si_int __popcountdi2(di_int a);  // bit population
 si_int __popcountti2(ti_int a);  // bit population
 
-uint32_t __bswapsi2(uint32_t a);   // a byteswapped, arm only
-uint64_t __bswapdi2(uint64_t a);   // a byteswapped, arm only
+uint32_t __bswapsi2(uint32_t a);   // a byteswapped, arm/mips only
+uint64_t __bswapdi2(uint64_t a);   // a byteswapped, arm/mips only
 
 // Integral arithmetic
 

Added: head/contrib/compiler-rt/lib/builtins/bswapdi2.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/compiler-rt/lib/builtins/bswapdi2.cSun May 21 23:15:32 
2017(r318601)
@@ -0,0 +1,28 @@
+/* ===-- bswapdi2.c - Implement __bswapdi2 -===
+ *
+ *   The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ * ===--===
+ *
+ * This file implements __bswapdi2 for the compiler_rt library.
+ *
+ * ===--===
+ */
+
+#include "int_lib.h"
+
+COMPILER_RT_ABI uint64_t
+__bswapdi2 (uint64_t u)
+{
+   return u) & 0xff00ULL) >> 56)
+   | (((u) & 0x00ffULL) >> 40)
+   | (((u) & 0xff00ULL) >> 24)
+   | (((u) & 0x00ffULL) >>  8)
+   | (((u) & 0xff00ULL) <<  8)
+   | (((u) & 0x00ffULL) << 24)
+   | (((u) & 0xff00ULL) << 40)
+   | (((u) & 0x00ffULL) << 56));
+}

Added: head/contrib/compiler-rt/lib/builtins/bswapsi2.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/compiler-rt/lib/builtins/bswapsi2.cSun May 21 23:15:32 
2017(r318601)
@@ -0,0 +1,25 @@
+/* ===-- bswapsi2.c - Implement __bswapsi2 -===
+ *
+ *   The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ * ===--===
+ *
+ * This file implements __bswapsi2 for the compiler_rt library.
+ *
+ * ===--===
+ */
+
+#include "int_lib.h"
+
+COMPILER_RT_ABI uint32_t
+__bswapsi2 (uint32_t u)
+{
+
+   return u) & 0xff00) >> 24)
+   | (((u) & 0x00ff) >>  8)
+   | (((u) & 0xff00) <<  8)
+   | (((u) & 0x00ff) << 24));
+}

Modified: head/lib/libcompiler_rt/Makefile.inc
==
--- head/lib/libcompiler_rt/Makefile.incSun May 21 22:28:28 2017
(r318600)
+++ head/lib/libcompiler_rt/Makefile.incSun May 21 23:15:32 2017
(r318601)
@@ -224,3 +224,10 @@ SRCS+= switch8.S
 SRCS+= switchu8.S
 SRCS+= sync_synchronize.S
 .endif
+
+# GCC-6.3 on mips32 requires bswap32 built-in.
+.if ${MACHINE_CPUARCH} == "mips"
+SRCS+= bswapdi2.c
+SRCS+= bswapsi2.c
+.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: r318602 - head/sys/mips/atheros

2017-05-21 Thread Adrian Chadd
Author: adrian
Date: Sun May 21 23:55:58 2017
New Revision: 318602
URL: https://svnweb.freebsd.org/changeset/base/318602

Log:
  [ar71xx] fix up dump space a la what jhb@ did elsewhere a while ago.

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

Modified: head/sys/mips/atheros/ar71xx_machdep.c
==
--- head/sys/mips/atheros/ar71xx_machdep.c  Sun May 21 23:15:32 2017
(r318601)
+++ head/sys/mips/atheros/ar71xx_machdep.c  Sun May 21 23:55:58 2017
(r318602)
@@ -383,8 +383,8 @@ platform_start(__register_t a0 __unused,
phys_avail[0] = MIPS_KSEG0_TO_PHYS(kernel_kseg0_end);
phys_avail[1] = ctob(realmem);
 
-   dump_avail[0] = phys_avail[0];
-   dump_avail[1] = phys_avail[1] - phys_avail[0];
+   dump_avail[0] = 0;
+   dump_avail[1] = phys_avail[1];
 
physmem = realmem;
 
___
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: r318690 - head/sys/dev/etherswitch/arswitch

2017-05-22 Thread Adrian Chadd
Author: adrian
Date: Tue May 23 03:48:42 2017
New Revision: 318690
URL: https://svnweb.freebsd.org/changeset/base/318690

Log:
  [arswitch] add phy debugging to the internal PHY read/write functions.

Modified:
  head/sys/dev/etherswitch/arswitch/arswitch_phy.c

Modified: head/sys/dev/etherswitch/arswitch/arswitch_phy.c
==
--- head/sys/dev/etherswitch/arswitch/arswitch_phy.cTue May 23 00:13:27 
2017(r318689)
+++ head/sys/dev/etherswitch/arswitch/arswitch_phy.cTue May 23 03:48:42 
2017(r318690)
@@ -151,10 +151,20 @@ arswitch_readphy_internal(device_t dev, 
data = arswitch_readreg_lsb(dev, a) &
AR8X16_MDIO_CTRL_DATA_MASK;
ARSWITCH_UNLOCK(sc);
+
+   DPRINTF(sc, ARSWITCH_DBG_PHYIO,
+   "%s: phy=0x%08x, reg=0x%08x, ret=0x%08x\n",
+   __func__, phy, reg, data);
+
return (data);
 
 fail:
ARSWITCH_UNLOCK(sc);
+
+   DPRINTF(sc, ARSWITCH_DBG_PHYIO,
+   "%s: phy=0x%08x, reg=0x%08x, fail; err=%d\n",
+   __func__, phy, reg, err);
+
return (-1);
 }
 
@@ -194,6 +204,11 @@ arswitch_writephy_internal(device_t dev,
}
if (timeout < 0)
err = EIO;
+
+   DPRINTF(sc, ARSWITCH_DBG_PHYIO,
+   "%s: phy=0x%08x, reg=0x%08x, data=0x%08x, err=%d\n",
+   __func__, phy, reg, data, err);
+
 out:
DEVERR(dev, err, "arswitch_writephy()=%d: phy=%d.%02x\n", phy, reg);
ARSWITCH_UNLOCK(sc);
___
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: r318696 - head/sys/mips/atheros

2017-05-22 Thread Adrian Chadd
Author: adrian
Date: Tue May 23 06:20:06 2017
New Revision: 318696
URL: https://svnweb.freebsd.org/changeset/base/318696

Log:
  [ar71xx] add a very simple early boot driver called "caldata" to commit 
cross-layer atrocities.
  
  The (eventually) upcoming ath(4) changes will include being able to load
  ath(4) devices on the AHB bus (ie the on-die wifi part of the SoC)
  as modules.
  
  In order for this to happen, a copy of the calibration data needs to be
  copied away before the SPI driver runs or the memory map access hack
  won't work.
  
  Now, ideally (!) there'd be some driver that can come up after the MTD
  pieces (eg, SPI, NAND, etc) and load into a firmware chunk the calibration
  data.
  
  (Or, really really nicely, would be an actual async firmware API that
  would lead itself to having a driver schedule a file read - or a raw device
  read - to get to the calibration data.)
  
  Now, until all of the above is done - I'm going to perpetuate the layer
  breaking atrocity here by simply doing the PCI bus fixup EEPROM/calibration
  data hack here.  This will work for any AR71xx (and later on, AR231x/AR531x)
  device, as well as the handful of QCA MIPS + QCA9880v2 802.11ac boards with
  NOR flash.
  
  To use, this goes into the kernel config:
  
  # Enable EEPROM hacks
  options AR71XX_ATH_EEPROM
  device ar71xx_caldata
  device firmware
  
  # This enables the ath_ahb driver (when I commit the change!) to
  # pull data out of the firmware hack.
  options ATH_EEPROM_FIRMWARE
  
  In the hints file:
  
  # ART calibration data mapping device
  hint.ar71xx_caldata.0.at="nexus0"
  hint.ar71xx_caldata.0.order=0
  
  # Where the ART is - last 64k in the first 8MB of flash
  hint.ar71xx_caldata.0.map.0.ath_fixup_addr=0x1fff
  hint.ar71xx_caldata.0.map.0.ath_fixup_size=16384
  
  # And now tell the ath(4) driver where to look!
  hint.ath.0.eeprom_firmware="ar71xx_caldata.0.map.0.eeprom_firmware"
  
  Tested:
  
  * carambola2, AR933x SoC, using a set of ath and ath_hal modules to load
  
  TODO:
  
  * unify this bit of firmware loading code, as I will definitely need
to include both the PCI bus firmware version (for PCI ID fixups too!)
as well as AHB/on-chip calibration data.
  
  * Commit the ath_ahb bus code
  
  * Convert .. everything over.  That'll take the majority of the time.

Added:
  head/sys/mips/atheros/ar71xx_caldata.c   (contents, props changed)
Modified:
  head/sys/mips/atheros/files.ar71xx

Added: head/sys/mips/atheros/ar71xx_caldata.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/mips/atheros/ar71xx_caldata.c  Tue May 23 06:20:06 2017
(r318696)
@@ -0,0 +1,176 @@
+/*-
+ * Copyright (c) 2017, Adrian Chadd .
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice unmodified, this list of conditions, and the following
+ *disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "opt_ar71xx.h"
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+struct ar71xx_caldata_softc {
+   device_tsc_dev;
+};
+
+static int
+ar71xx_caldata_probe(device_t dev)
+{
+
+   return (BUS_PROBE_NOWILDCARD);
+}
+
+/* XXX TODO: unify with what's in ar71xx_fixup.c */
+
+/*
+ * Create a calibration block from memory mapped SPI data for use by
+ * various drivers.  Right now it's just ath(4) but later board support
+ * will include 802.11ac NICs with calibration data in NOR flash.
+ *
+ * (Yes, there are a h

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

2017-05-22 Thread Adrian Chadd
Author: adrian
Date: Tue May 23 06:20:24 2017
New Revision: 318697
URL: https://svnweb.freebsd.org/changeset/base/318697

Log:
  [ar71xx] remove dead code!

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

Modified: head/sys/mips/atheros/ar71xx_fixup.c
==
--- head/sys/mips/atheros/ar71xx_fixup.cTue May 23 06:20:06 2017
(r318696)
+++ head/sys/mips/atheros/ar71xx_fixup.cTue May 23 06:20:24 2017
(r318697)
@@ -110,43 +110,3 @@ ar71xx_pci_slot_create_eeprom_firmware(d
}
device_printf(dev, "device EEPROM '%s' registered\n", buf);
 }
-
-#if 0
-static void
-ar71xx_pci_slot_fixup(device_t dev, u_int bus, u_int slot, u_int func)
-{
-   long int flash_addr;
-   char buf[64];
-   int size;
-
-   /*
-* Check whether the given slot has a hint to poke.
-*/
-   if (bootverbose)
-   device_printf(dev, "%s: checking dev %s, %d/%d/%d\n",
-   __func__, device_get_nameunit(dev), bus, slot, func);
-
-   snprintf(buf, sizeof(buf), "bus.%d.%d.%d.ath_fixup_addr",
-   bus, slot, func);
-
-   if (resource_long_value(device_get_name(dev), device_get_unit(dev),
-   buf, &flash_addr) == 0) {
-   snprintf(buf, sizeof(buf), "bus.%d.%d.%d.ath_fixup_size",
-   bus, slot, func);
-   if (resource_int_value(device_get_name(dev),
-   device_get_unit(dev), buf, &size) != 0) {
-   device_printf(dev,
-   "%s: missing hint '%s', aborting EEPROM\n",
-   __func__, buf);
-   return;
-   }
-
-
-   device_printf(dev, "found EEPROM at 0x%lx on %d.%d.%d\n",
-   flash_addr, bus, slot, func);
-   ar71xx_pci_fixup(dev, bus, slot, func, flash_addr, size);
-   ar71xx_pci_slot_create_eeprom_firmware(dev, bus, slot, func,
-   flash_addr, size);
-   }
-}
-#endif /* 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: r318768 - head/sys/dev/ath

2017-05-23 Thread Adrian Chadd
Author: adrian
Date: Wed May 24 01:02:35 2017
New Revision: 318768
URL: https://svnweb.freebsd.org/changeset/base/318768

Log:
  [ath] begin migration of AHB support to use the PCI style board data API for 
calibration data.
  
  This brings the AHB support in line with the PCI support - now other "things"
  can wrap up the calibration / board data into a firmware blob and have them
  probe/attach after the system has finished booting.
  
  Note that this change requires /all/ of the AHB using kernel configurations
  to change - so until I drop those changes in, this breaks AHB.
  
  Fear not, I'll do that soon.
  
  TODO:
  
  * the above stuff.
  
  Tested:
  
  * AR9331, carambola 2, loading if_ath / wlan as modules at run time

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

Modified: head/sys/dev/ath/if_ath_ahb.c
==
--- head/sys/dev/ath/if_ath_ahb.c   Wed May 24 01:01:57 2017
(r318767)
+++ head/sys/dev/ath/if_ath_ahb.c   Wed May 24 01:02:35 2017
(r318768)
@@ -66,6 +66,12 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+/* For EEPROM firmware */
+#ifdef ATH_EEPROM_FIRMWARE
+#include 
+#include 
+#endif /* ATH_EEPROM_FIRMWARE */
+
 /*
  * bus glue.
  */
@@ -77,7 +83,6 @@ struct ath_ahb_softc {
struct ath_softcsc_sc;
struct resource *sc_sr; /* memory resource */
struct resource *sc_irq;/* irq resource */
-   struct resource *sc_eeprom; /* eeprom location */
void*sc_ih; /* interrupt handler */
 };
 
@@ -132,10 +137,11 @@ ath_ahb_attach(device_t dev)
struct ath_softc *sc = &psc->sc_sc;
int error = ENXIO;
int rid;
-   long eepromaddr;
-   int eepromsize;
-   uint8_t *p;
int device_id, vendor_id;
+#ifdef ATH_EEPROM_FIRMWARE
+   const struct firmware *fw = NULL;
+   const char *buf;
+#endif
 
sc->sc_dev = dev;
 
@@ -146,44 +152,6 @@ ath_ahb_attach(device_t dev)
goto bad;
}
 
-   if (resource_long_value(device_get_name(dev), device_get_unit(dev),
-   "eepromaddr", &eepromaddr) != 0) {
-   device_printf(dev, "cannot fetch 'eepromaddr' from hints\n");
-   goto bad0;
-   }
-
-   /*
-* The default EEPROM size is 2048 * 16 bit words.
-* Later EEPROM/OTP/flash regions may be quite a bit bigger.
-*/
-   if (resource_int_value(device_get_name(dev), device_get_unit(dev),
-   "eepromsize", &eepromsize) != 0) {
-   eepromsize = ATH_EEPROM_DATA_SIZE * 2;
-   }
-
-   rid = 0;
-   device_printf(sc->sc_dev, "eeprom @ %p (%d bytes)\n",
-   (void *) eepromaddr, eepromsize);
-   /*
-* XXX this assumes that the parent device is the nexus
-* and will just pass through requests for all of memory.
-*
-* Later on, when this has to attach off of the actual
-* AHB, this won't work.
-*
-* Ideally this would be done in machdep code in mips/atheros/
-* and it'd expose the EEPROM via the firmware interface,
-* so the ath/ath_ahb drivers can be loaded as modules
-* after boot-time.
-*/
-   psc->sc_eeprom = bus_alloc_resource(dev, SYS_RES_MEMORY,
-   &rid, (uintptr_t) eepromaddr,
-   (uintptr_t) eepromaddr + (uintptr_t) (eepromsize - 1), 0, 
RF_ACTIVE);
-   if (psc->sc_eeprom == NULL) {
-   device_printf(dev, "cannot map eeprom space\n");
-   goto bad0;
-   }
-
sc->sc_st = (HAL_BUS_TAG) rman_get_bustag(psc->sc_sr);
sc->sc_sh = (HAL_BUS_HANDLE) rman_get_bushandle(psc->sc_sr);
/*
@@ -192,22 +160,35 @@ ath_ahb_attach(device_t dev)
 */
sc->sc_invalid = 1;
 
-   /* Copy the EEPROM data out */
-   sc->sc_eepromdata = malloc(eepromsize, M_TEMP, M_NOWAIT | M_ZERO);
-   if (sc->sc_eepromdata == NULL) {
-   device_printf(dev, "cannot allocate memory for eeprom data\n");
-   goto bad1;
+#ifdef ATH_EEPROM_FIRMWARE
+   /*
+* If there's an EEPROM firmware image, load that in.
+*/
+   if (resource_string_value(device_get_name(dev), device_get_unit(dev),
+   "eeprom_firmware", &buf) == 0) {
+   device_printf(dev, "%s: looking up firmware @ '%s'\n",
+   __func__, buf);
+
+   fw = firmware_get(buf);
+   if (fw == NULL) {
+   device_printf(dev, "%s: couldn't find firmware\n",
+   __func__);
+   goto bad1;
+   }
+
+   device_printf(dev, "%s: EEPROM firmware @ %p\n",
+   __func__, fw->data);
+   sc->sc_eepromdata =
+   malloc(fw->datasize, M_TEMP, M_WAITOK | M_ZERO);
+   if (! sc->sc_eepromdata) {
+  

svn commit: r318856 - in head/sys: dev/ath dev/ath/ath_dfs/null dev/ath/ath_hal dev/ath/ath_rate/sample modules modules/ath modules/ath_dfs modules/ath_hal modules/ath_hal_ar5210 modules/ath_hal_ar...

2017-05-24 Thread Adrian Chadd
changed)
  head/sys/dev/ath/ah_osdep_ar5416.c   (contents, props changed)
  head/sys/dev/ath/ah_osdep_ar9300.c   (contents, props changed)
  head/sys/dev/ath/if_ath_dfs.c   (contents, props changed)
  head/sys/dev/ath/if_ath_drv.c   (contents, props changed)
  head/sys/dev/ath/if_ath_rate.c   (contents, props changed)
  head/sys/modules/ath_dfs/
  head/sys/modules/ath_dfs/Makefile   (contents, props changed)
  head/sys/modules/ath_hal/
  head/sys/modules/ath_hal/Makefile   (contents, props changed)
  head/sys/modules/ath_hal_ar5210/
  head/sys/modules/ath_hal_ar5210/Makefile   (contents, props changed)
  head/sys/modules/ath_hal_ar5211/
  head/sys/modules/ath_hal_ar5211/Makefile   (contents, props changed)
  head/sys/modules/ath_hal_ar5212/
  head/sys/modules/ath_hal_ar5212/Makefile   (contents, props changed)
  head/sys/modules/ath_hal_ar5416/
  head/sys/modules/ath_hal_ar5416/Makefile   (contents, props changed)
  head/sys/modules/ath_hal_ar9300/
  head/sys/modules/ath_hal_ar9300/Makefile   (contents, props changed)
  head/sys/modules/ath_main/
  head/sys/modules/ath_main/Makefile   (contents, props changed)
  head/sys/modules/ath_rate/
  head/sys/modules/ath_rate/Makefile   (contents, props changed)
Modified:
  head/sys/dev/ath/ah_osdep.c
  head/sys/dev/ath/ath_dfs/null/dfs_null.c
  head/sys/dev/ath/ath_hal/ah.c
  head/sys/dev/ath/ath_hal/ah_internal.h
  head/sys/dev/ath/ath_rate/sample/sample.c
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_ahb.c
  head/sys/dev/ath/if_ath_pci.c
  head/sys/modules/Makefile
  head/sys/modules/ath/Makefile

Modified: head/sys/dev/ath/ah_osdep.c
==
--- head/sys/dev/ath/ah_osdep.c Thu May 25 02:00:37 2017(r318855)
+++ head/sys/dev/ath/ah_osdep.c Thu May 25 04:18:46 2017(r318856)
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -420,3 +421,31 @@ ath_hal_assert_failed(const char* filena
panic("ath_hal_assert");
 }
 #endif /* AH_ASSERT */
+
+static int
+ath_hal_modevent(module_t mod __unused, int type, void *data __unused)
+{
+   int error = 0;
+
+   switch (type) {
+   case MOD_LOAD:
+   printf("[ath_hal] loaded\n");
+   break;
+
+   case MOD_UNLOAD:
+   printf("[ath_hal] unloaded\n");
+   break;
+
+   case MOD_SHUTDOWN:
+   break;
+
+   default:
+   error = EOPNOTSUPP;
+   break;
+
+   }
+   return (error);
+}
+
+DEV_MODULE(ath_hal, ath_hal_modevent, NULL);
+MODULE_VERSION(ath_hal, 1);

Added: head/sys/dev/ath/ah_osdep_ar5210.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/ath/ah_osdep_ar5210.c  Thu May 25 04:18:46 2017
(r318856)
@@ -0,0 +1,74 @@
+/*-
+ * Copyright 2017 Adrian Chadd .
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ *
+ */
+
+#include "opt_ah.h"
+#include "opt_wlan.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+extern struct ath_hal_chip AR5210_chip;
+
+static int
+ath_hal_ar5210_modevent(module_t mod __unused, int type, void *data __unused)
+{
+   int error = 0;
+
+   switch (type) {
+   case MOD_LOAD:
+   ath_hal_add_chip(&AR5210_chip);
+   printf("[ar5210] loaded\n");
+   break;
+
+   case MOD_UNLOAD:
+   ath_hal_remove_chip(&AR5210_chip);
+   printf("[ar5210] unloaded\n");
+   break;
+
+   case MOD_SHUTD

svn commit: r318857 - in head/sys/dev/ath: . ath_hal

2017-05-24 Thread Adrian Chadd
Author: adrian
Date: Thu May 25 04:26:26 2017
New Revision: 318857
URL: https://svnweb.freebsd.org/changeset/base/318857

Log:
  [ath] [ath_hal] retire AH_SUPPORT_AR5416 changing anything.
  
  Yes, the memory bloat is large, but it's 2017 and I'll fix it later
  by making it runtime configurable / per-chip configurable if I ever need to.

Modified:
  head/sys/dev/ath/ath_hal/ah.c
  head/sys/dev/ath/ath_hal/ah_desc.h
  head/sys/dev/ath/ath_hal/ah_internal.h
  head/sys/dev/ath/if_ath_rx.c

Modified: head/sys/dev/ath/ath_hal/ah.c
==
--- head/sys/dev/ath/ath_hal/ah.c   Thu May 25 04:18:46 2017
(r318856)
+++ head/sys/dev/ath/ath_hal/ah.c   Thu May 25 04:26:26 2017
(r318857)
@@ -1188,7 +1188,6 @@ ath_hal_get_mimo_chan_noise(struct ath_h
 const struct ieee80211_channel *chan, int16_t *nf_ctl,
 int16_t *nf_ext)
 {
-#ifdef AH_SUPPORT_AR5416
HAL_CHANNEL_INTERNAL *ichan;
int i;
 
@@ -1243,9 +1242,6 @@ ath_hal_get_mimo_chan_noise(struct ath_h
}
return 1;
}
-#else
-   return 0;
-#endif /* AH_SUPPORT_AR5416 */
 }
 
 /*

Modified: head/sys/dev/ath/ath_hal/ah_desc.h
==
--- head/sys/dev/ath/ath_hal/ah_desc.h  Thu May 25 04:18:46 2017
(r318856)
+++ head/sys/dev/ath/ath_hal/ah_desc.h  Thu May 25 04:26:26 2017
(r318857)
@@ -20,21 +20,6 @@
 #ifndef _DEV_ATH_DESC_H
 #define _DEV_ATH_DESC_H
 
-#include "opt_ah.h"/* NB: required for AH_SUPPORT_AR5416 */
-
-/*
- * For now, define this for the structure definitions.
- * Because of how the HAL / driver module currently builds,
- * it's not very feasible to build the module without
- * this defined.  The rest of the code (eg in the driver
- * body) can work fine with these fields being uninitialised;
- * they'll be initialised to 0 anyway.
- */
-
-#ifndefAH_SUPPORT_AR5416
-#defineAH_SUPPORT_AR5416   1
-#endif
-
 /*
  * Transmit descriptor status.  This structure is filled
  * in only after the tx descriptor process method finds a
@@ -56,7 +41,6 @@ struct ath_tx_status {
uint8_t ts_virtcol; /* virtual collision count */
uint8_t ts_antenna; /* antenna information */
uint8_t ts_finaltsi;/* final transmit series index */
-#ifdef AH_SUPPORT_AR5416
/* 802.11n status */
uint8_t ts_flags;   /* misc flags */
uint8_t ts_queue_id;/* AR9300: TX queue id */
@@ -71,7 +55,6 @@ struct ath_tx_status {
int8_t  ts_rssi_ctl[3]; /* tx ack RSSI [ctl, chain 0-2] */
int8_t  ts_rssi_ext[3]; /* tx ack RSSI [ext, chain 0-2] */
uint8_t ts_pad[2];
-#endif /* AH_SUPPORT_AR5416 */
 };
 
 /* bits found in ts_status */
@@ -121,7 +104,6 @@ struct ath_rx_status {
uint8_t rs_more;/* more descriptors follow */
uint32_trs_tstamp;  /* h/w assigned timestamp */
uint32_trs_antenna; /* antenna information */
-#ifdef AH_SUPPORT_AR5416
/* 802.11n status */
int8_t  rs_rssi_ctl[3]; /* rx frame RSSI [ctl, chain 0-2] */
int8_t  rs_rssi_ext[3]; /* rx frame RSSI [ext, chain 0-2] */
@@ -138,7 +120,6 @@ struct ath_rx_status {
uint32_trs_evm2;
uint32_trs_evm3;/* needed for ar9300 and later */
uint32_trs_evm4;/* needed for ar9300 and later */
-#endif /* AH_SUPPORT_AR5416 */
 };
 
 /* bits found in rs_status */
@@ -241,11 +222,7 @@ enum {
  * to complete the work.  Status for completed frames is returned
  * in a device-independent format.
  */
-#ifdef AH_SUPPORT_AR5416
 #defineHAL_DESC_HW_SIZE20
-#else
-#defineHAL_DESC_HW_SIZE4
-#endif /* AH_SUPPORT_AR5416 */
 
 struct ath_desc {
/*

Modified: head/sys/dev/ath/ath_hal/ah_internal.h
==
--- head/sys/dev/ath/ath_hal/ah_internal.h  Thu May 25 04:18:46 2017
(r318856)
+++ head/sys/dev/ath/ath_hal/ah_internal.h  Thu May 25 04:26:26 2017
(r318857)
@@ -29,11 +29,6 @@
 
 #include 
 #include  /* XXX for reasons */
-#include "opt_ah.h"/* needed for AH_SUPPORT_AR5416 */
-
-#ifndefAH_SUPPORT_AR5416
-#defineAH_SUPPORT_AR5416   1
-#endif
 
 #ifndef NBBY
 #defineNBBY8   /* number of bits/byte */
@@ -201,10 +196,8 @@ typedef struct {
int8_t  qCoff;
int16_t rawNoiseFloor;
int16_t noiseFloorAdjust;
-#ifdef AH_SUPPORT_AR5416
int16_t noiseFloorCtl[AH_MAX_CHAINS];
int16_t noiseFloorExt[AH_MAX_CHAINS];
-#endif /* AH_SUPPORT_AR5416 */
  

svn commit: r318858 - head

2017-05-24 Thread Adrian Chadd
Author: adrian
Date: Thu May 25 05:01:44 2017
New Revision: 318858
URL: https://svnweb.freebsd.org/changeset/base/318858

Log:
  Bump UPDATING to cover the ath shuffle.

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Thu May 25 04:26:26 2017(r318857)
+++ head/UPDATING   Thu May 25 05:01:44 2017(r318858)
@@ -51,6 +51,31 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12
 
 ** SPECIAL WARNING: **
 
+20170524:
+   The ath(4) and ath_hal(4) modules now build piecemeal to allow for
+   smaller runtime footprint builds.  This is useful for embedded systems
+   which only require one chipset support.
+
+   If you load it as a module, make sure this is in /boot/loader.conf:
+
+   if_ath_load="YES"
+
+   This will load the HAL, all chip/RF backends and if_ath_pci.
+   If you have if_ath_pci in /boot/loader.conf, ensure it is after
+   if_ath or it will not load any HAL chipset support.
+
+   If you want to selectively load things (eg on ye cheape ARM/MIPS
+   platforms where RAM is at a premium) you should:
+
+   * load ath_hal
+   * load the chip modules in question
+   * load ath_rate, ath_dfs
+   * load ath_main
+   * load if_ath_pci and/or if_ath_ahb depending upon your particular
+ bus bind type - this is where probe/attach is done.
+
+   For further comments/feedback, poke adrian@ .
+
 20170523:
The "ino64" 64-bit inode project has been committed, which extends
a number of types to 64 bits.  Upgrading in place requires care and
___
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: r318859 - head/lib

2017-05-24 Thread Adrian Chadd
Author: adrian
Date: Thu May 25 05:02:43 2017
New Revision: 318859
URL: https://svnweb.freebsd.org/changeset/base/318859

Log:
  [lib] disable libc++experimental on mips platforms for now.
  
  This breaks at least mips32 platform builds.
  
  Reviewed by:  dim

Modified:
  head/lib/Makefile

Modified: head/lib/Makefile
==
--- head/lib/Makefile   Thu May 25 05:01:44 2017(r318858)
+++ head/lib/Makefile   Thu May 25 05:02:43 2017(r318859)
@@ -157,7 +157,7 @@ _libclang_rt=   libclang_rt
 .if ${MK_LIBCPLUSPLUS} != "no"
 _libcxxrt= libcxxrt
 _libcplusplus= libc++
-.if ${MACHINE_CPUARCH} != "arm"
+.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
 _libcplusplus+=libc++experimental
 .endif
 .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: r318911 - head/sys/dev/ath

2017-05-25 Thread Adrian Chadd
Author: adrian
Date: Fri May 26 00:48:21 2017
New Revision: 318911
URL: https://svnweb.freebsd.org/changeset/base/318911

Log:
  [ath] fix short-GI wireshark flag.
  
  Yes, HAL_RX_GI means "short guard interval."

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.cFri May 26 00:26:08 2017
(r318910)
+++ head/sys/dev/ath/if_ath_rx.cFri May 26 00:48:21 2017
(r318911)
@@ -593,7 +593,8 @@ ath_rx_tap(struct ath_softc *sc, struct 
sc->sc_rx_th.wr_chan_flags |= CHAN_HT40U;
else
sc->sc_rx_th.wr_chan_flags |= CHAN_HT40D;
-   if ((rs->rs_flags & HAL_RX_GI) == 0)
+
+   if (rs->rs_flags & HAL_RX_GI)
sc->sc_rx_th.wr_flags |= IEEE80211_RADIOTAP_F_SHORTGI;
}
 
___
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: r319055 - head/sys/mips/atheros

2017-05-28 Thread Adrian Chadd
Author: adrian
Date: Sun May 28 07:44:55 2017
New Revision: 319055
URL: https://svnweb.freebsd.org/changeset/base/319055

Log:
  [ar71xx] undo read-after-write to flush; some bus devices dislike this.
  
  This broke the PCI fixup on at least the AR7240 + AR9280 reference design
  board that I have.
  
  Tested:
  
  * Atheros AP93 reference design - AR7240 + AR9280

Modified:
  head/sys/mips/atheros/ar71xxreg.h

Modified: head/sys/mips/atheros/ar71xxreg.h
==
--- head/sys/mips/atheros/ar71xxreg.h   Sun May 28 07:40:42 2017
(r319054)
+++ head/sys/mips/atheros/ar71xxreg.h   Sun May 28 07:44:55 2017
(r319055)
@@ -528,13 +528,14 @@ typedef enum {
 #defineAR71XX_SPI_RDS  0x0C
 
 #define ATH_READ_REG(reg) \
-*((volatile uint32_t *)MIPS_PHYS_TO_KSEG1((reg)))
-
+   *((volatile uint32_t *)MIPS_PHYS_TO_KSEG1((reg)))
+/*
+ * Note: Don't put a flush read here; some users (eg the AR724x PCI fixup code)
+ * requires write-only space to certain registers.  Doing the read afterwards
+ * causes things to break.
+ */
 #define ATH_WRITE_REG(reg, val) \
-do { \
-  *((volatile uint32_t *)MIPS_PHYS_TO_KSEG1((reg))) = (val); \
-  (void) ATH_READ_REG(reg); \
-} while (0)
+  *((volatile uint32_t *)MIPS_PHYS_TO_KSEG1((reg))) = (val)
 
 static inline void
 ar71xx_ddr_flush(uint32_t reg)
___
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: r319100 - head/sys/mips/conf

2017-05-29 Thread Adrian Chadd
Author: adrian
Date: Mon May 29 07:27:08 2017
New Revision: 319100
URL: https://svnweb.freebsd.org/changeset/base/319100

Log:
  Update AP93 support to the new world order.
  
  * Map change: create a combined kernel+rootfs image.  The instructions I'll 
post
on the wiki (which will be for a very outdated dev board, but at least will
explain the what/why for posterity) will include how to reset the boot 
command.
  
  Tested:
  
  * AP93 dev board (AR7240 + AR9280)

Modified:
  head/sys/mips/conf/AP93.hints

Modified: head/sys/mips/conf/AP93.hints
==
--- head/sys/mips/conf/AP93.hints   Mon May 29 07:15:28 2017
(r319099)
+++ head/sys/mips/conf/AP93.hints   Mon May 29 07:27:08 2017
(r319100)
@@ -94,29 +94,15 @@ hint.map.1.readonly=1
 
 hint.map.2.at="flash/spi0"
 hint.map.2.start=0x0008
-# hint.map.2.end=0x0038
-hint.map.2.end=0x0078
-# hint.map.2.name="spare-rootfs"
-hint.map.2.name="rootfs"
-hint.map.2.readonly=1
-
-#hint.map.3.at="flash/spi0"
-#hint.map.3.start=0x0038
-#hint.map.3.end=0x0048
-#hint.map.3.name="spare-uImage"
-#hint.map.3.readonly=1
-
-#hint.map.4.at="flash/spi0"
-#hint.map.4.start=0x0048
-#hint.map.4.end=0x0078
-#hint.map.4.name="rootfs"
-#hint.map.4.readonly=1
+hint.map.2.end="search:0x0008:0x1:.!/bin/sh"
+hint.map.2.name="kernel"
+hint.map.2.readonly=0
 
 hint.map.3.at="flash/spi0"
-hint.map.3.start=0x0078
+hint.map.3.start="search:0x0008:0x1:.!/bin/sh"
 hint.map.3.end=0x0088
-hint.map.3.name="uImage"
-hint.map.3.readonly=1
+hint.map.3.name="rootfs"
+hint.map.3.readonly=0
 
 hint.map.4.at="flash/spi0"
 hint.map.4.start=0x0088
___
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: r319101 - head/sys/mips/conf

2017-05-29 Thread Adrian Chadd
Author: adrian
Date: Mon May 29 07:30:07 2017
New Revision: 319101
URL: https://svnweb.freebsd.org/changeset/base/319101

Log:
  [ar71xx] [ar724x] update to work
  
  * add EARLY_PRINTF for debugging
  * update module list to be much larger
  * add random, otherwise well, stuff doesn't work.
  * IPFIREWALL_DEFAULT_TO_ACCEPT
  
  Tested:
  
  * AP93 (AR7240 + AR9280)
  
  TODO:
  
  * rename to std.AR724X
  * unify the built module list between all of the mips24k/mips74k atheros 
config files -
now that the HAL, hwpmc, USB, etc are per-chip/per-arch modules it is easy 
to just
compile them all and only include the ones you care about.

Modified:
  head/sys/mips/conf/AR724X_BASE

Modified: head/sys/mips/conf/AR724X_BASE
==
--- head/sys/mips/conf/AR724X_BASE  Mon May 29 07:27:08 2017
(r319100)
+++ head/sys/mips/conf/AR724X_BASE  Mon May 29 07:30:07 2017
(r319101)
@@ -25,13 +25,14 @@ makeoptions DEBUG=-g#Build kernel with
 
 # Build these as modules so small platform builds will have the
 # modules already built.
-makeoptionsMODULES_OVERRIDE="gpio ar71xx if_gif if_gre if_bridge bridgestp 
usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt 
wlan_amrr ath ath_pci hwpmc cam"
+makeoptionsMODULES_OVERRIDE="gpio ar71xx if_gif if_gre if_tap if_tun 
libalias ipfw ipfw_nat ipfw_nptv6 if_vlan if_bridge bridgestp usb wlan 
wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt wlan_amrr 
ath_main ath_pci ath_hal ath_hal_ar5212 ath_hal_ar5416 ath_hal_ar9300 ath_rate 
ath_dfs hwpmc hwpmc_mips24k cam"
 
 # For small memory footprints
 optionsVM_KMEM_SIZE_SCALE=1
 
 optionsDDB
 optionsKDB
+optionsEARLY_PRINTF
 
 optionsSCHED_4BSD  #4BSD scheduler
 optionsINET#InterNETworking
@@ -59,11 +60,16 @@ options NO_SYSCTL_DESCR
 
 options FFS #Berkeley Fast Filesystem
 optionsNO_FFS_SNAPSHOT
+
+optionsIPFIREWALL_DEFAULT_TO_ACCEPT
+
 # options SOFTUPDATES #Enable FFS soft updates support
 # options UFS_ACL #Support for access control lists
 # options UFS_DIRHASH #Improve performance on big 
directories
 # options  MSDOSFS # Read MSDOS filesystems; useful for 
USB/CF
 
+optionsUMTX_CHAINS=16
+
 device pci
 device ar724x_pci
 
@@ -129,7 +135,7 @@ device  loop
 device ether
 device md
 device bpf
-#devicerandom
+device random
 #deviceif_bridge
 #devicegif # ip[46] in ip[46] tunneling protocol
 #devicegre # generic encapsulation - only for IPv4 
in IPv4 though atm
___
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: r319102 - head/sys/mips/conf

2017-05-29 Thread Adrian Chadd
Author: adrian
Date: Mon May 29 07:57:01 2017
New Revision: 319102
URL: https://svnweb.freebsd.org/changeset/base/319102

Log:
  [AP93] fix up the arge0/arge1 hints.

Modified:
  head/sys/mips/conf/AP93.hints

Modified: head/sys/mips/conf/AP93.hints
==
--- head/sys/mips/conf/AP93.hints   Mon May 29 07:30:07 2017
(r319101)
+++ head/sys/mips/conf/AP93.hints   Mon May 29 07:57:01 2017
(r319102)
@@ -15,12 +15,14 @@ hint.argemdio.0.order=0
 hint.arge.0.phymask=0x10   # PHY 4
 # hint.arge.0.miimode=2# MII
 hint.arge.0.mdio=mdioproxy1# Hanging off the arswitch MDIO bus
+hint.arge.0.eeprommac=0x1fff
 
 # arge1: connected to the LAN switch MAC, at 1000BaseTX / GMII.
 hint.arge.1.phymask=0x0
 # hint.arge.1.miimode=1# GMII
 hint.arge.1.media=1000 # Force to 1000BaseTX/full
 hint.arge.1.fduplex=1
+hint.arge.1.eeprommac=0x1fff0006
 
 #
 # AR7240 switch config
___
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: r319343 - head/sys/mips/conf

2017-05-31 Thread Adrian Chadd
Author: adrian
Date: Wed May 31 16:32:33 2017
New Revision: 319343
URL: https://svnweb.freebsd.org/changeset/base/319343

Log:
  [ar71xx] rename AR724X_BASE -> std.AR724X

Added:
  head/sys/mips/conf/std.AR724X
 - copied, changed from r319342, head/sys/mips/conf/AR724X_BASE
Deleted:
  head/sys/mips/conf/AR724X_BASE
Modified:
  head/sys/mips/conf/AP91
  head/sys/mips/conf/AP93
  head/sys/mips/conf/ENH200
  head/sys/mips/conf/PICOSTATION_M2HP
  head/sys/mips/conf/ROCKET_M2HP
  head/sys/mips/conf/WZR-300HP

Modified: head/sys/mips/conf/AP91
==
--- head/sys/mips/conf/AP91 Wed May 31 16:28:29 2017(r319342)
+++ head/sys/mips/conf/AP91 Wed May 31 16:32:33 2017(r319343)
@@ -14,7 +14,7 @@
 
 #NO_UNIVERSE
 
-include"AR724X_BASE"
+include"std.AR724X"
 ident  "AP91"
 hints  "AP91.hints"
 

Modified: head/sys/mips/conf/AP93
==
--- head/sys/mips/conf/AP93 Wed May 31 16:28:29 2017(r319342)
+++ head/sys/mips/conf/AP93 Wed May 31 16:32:33 2017(r319343)
@@ -14,7 +14,7 @@
 
 #NO_UNIVERSE
 
-include"AR724X_BASE"
+include"std.AR724X"
 ident  "AP93"
 hints  "AP93.hints"
 

Modified: head/sys/mips/conf/ENH200
==
--- head/sys/mips/conf/ENH200   Wed May 31 16:28:29 2017(r319342)
+++ head/sys/mips/conf/ENH200   Wed May 31 16:32:33 2017(r319343)
@@ -14,7 +14,7 @@
 
 #NO_UNIVERSE
 
-include"AR724X_BASE"
+include"std.AR724X"
 ident  "ENH200"
 hints  "ENH200.hints"
 

Modified: head/sys/mips/conf/PICOSTATION_M2HP
==
--- head/sys/mips/conf/PICOSTATION_M2HP Wed May 31 16:28:29 2017
(r319342)
+++ head/sys/mips/conf/PICOSTATION_M2HP Wed May 31 16:32:33 2017
(r319343)
@@ -14,7 +14,7 @@
 
 #NO_UNIVERSE
 
-include"AR724X_BASE"
+include"std.AR724X"
 ident  "PICOSTATION_M2HP"
 hints  "PICOSTATION_M2HP.hints"
 

Modified: head/sys/mips/conf/ROCKET_M2HP
==
--- head/sys/mips/conf/ROCKET_M2HP  Wed May 31 16:28:29 2017
(r319342)
+++ head/sys/mips/conf/ROCKET_M2HP  Wed May 31 16:32:33 2017
(r319343)
@@ -14,7 +14,7 @@
 
 #NO_UNIVERSE
 
-include"AR724X_BASE"
+include"std.AR724X"
 ident  "ROCKET_M2HP"
 hints  "ROCKET_M2HP.hints"
 

Modified: head/sys/mips/conf/WZR-300HP
==
--- head/sys/mips/conf/WZR-300HPWed May 31 16:28:29 2017
(r319342)
+++ head/sys/mips/conf/WZR-300HPWed May 31 16:32:33 2017
(r319343)
@@ -14,7 +14,7 @@
 
 #NO_UNIVERSE
 
-include"AR724X_BASE"
+include"std.AR724X"
 ident  "WZR-300HP"
 hints  "WZR-300HP.hints"
 

Copied and modified: head/sys/mips/conf/std.AR724X (from r319342, 
head/sys/mips/conf/AR724X_BASE)
==
--- head/sys/mips/conf/AR724X_BASE  Wed May 31 16:28:29 2017
(r319342, copy source)
+++ head/sys/mips/conf/std.AR724X   Wed May 31 16:32:33 2017
(r319343)
@@ -9,7 +9,7 @@
 #
 
 machinemips mips
-ident  AR724X_BASE
+#ident AR724X_BASE
 cpuCPU_MIPS24K
 makeoptionsKERNLOADADDR=0x8005
 optionsHZ=1000
___
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: r319577 - in head/sys: conf dev/iwm modules/iwm

2017-06-04 Thread Adrian Chadd
Author: adrian
Date: Sun Jun  4 21:05:58 2017
New Revision: 319577
URL: https://svnweb.freebsd.org/changeset/base/319577

Log:
  [iwm] Move Smart Fifo handling into if_iwm_sf.c, sync with Linux iwlwifi.
  
  * This change also fixes a possible issue in the existing smart-fifo code,
which set the IWM_SF_CFG_DUMMY_NOTIF_OFF bit on AC8260 chipsets, although
that's only used in iwlwifi for Family 8000 chipsets connected via SDIO
interface.
  
  Obtained from:Dragonflybsd.git 
cb650b01526b0aeef3c4307d926e7f1428997d50

Added:
  head/sys/dev/iwm/if_iwm_sf.c   (contents, props changed)
  head/sys/dev/iwm/if_iwm_sf.h   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_binding.c
  head/sys/dev/iwm/if_iwmvar.h
  head/sys/modules/iwm/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Sun Jun  4 21:02:48 2017(r319576)
+++ head/sys/conf/files Sun Jun  4 21:05:58 2017(r319577)
@@ -1864,6 +1864,7 @@ dev/iwm/if_iwm_phy_ctxt.c optional iwm
 dev/iwm/if_iwm_phy_db.coptional iwm
 dev/iwm/if_iwm_power.c optional iwm
 dev/iwm/if_iwm_scan.c  optional iwm
+dev/iwm/if_iwm_sf.coptional iwm
 dev/iwm/if_iwm_sta.c   optional iwm
 dev/iwm/if_iwm_time_event.coptional iwm
 dev/iwm/if_iwm_util.c  optional iwm

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Sun Jun  4 21:02:48 2017(r319576)
+++ head/sys/dev/iwm/if_iwm.c   Sun Jun  4 21:05:58 2017(r319577)
@@ -164,6 +164,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -354,10 +355,6 @@ static voidiwm_setrates(struct iwm_softc *, struct 
iw
 static int iwm_media_change(struct ifnet *);
 static int iwm_newstate(struct ieee80211vap *, enum ieee80211_state, int);
 static voidiwm_endscan_cb(void *, int);
-static voidiwm_mvm_fill_sf_command(struct iwm_softc *,
-   struct iwm_sf_cfg_cmd *,
-   struct ieee80211_node *);
-static int iwm_mvm_sf_config(struct iwm_softc *, enum iwm_sf_state);
 static int iwm_send_bt_init_conf(struct iwm_softc *);
 static int iwm_send_update_mcc_cmd(struct iwm_softc *, const char *);
 static voidiwm_mvm_tt_tx_backoff(struct iwm_softc *, uint32_t);
@@ -2989,11 +2986,6 @@ iwm_run_init_mvm_ucode(struct iwm_softc *sc, int justn
goto error;
}
 
-   /* Init Smart FIFO. */
-   ret = iwm_mvm_sf_config(sc, IWM_SF_INIT_OFF);
-   if (ret)
-   goto error;
-
/* Send TX valid antennas before triggering calibrations */
ret = iwm_send_tx_ant_cfg(sc, iwm_mvm_get_valid_tx_ant(sc));
if (ret) {
@@ -3991,10 +3983,6 @@ iwm_auth(struct ieee80211vap *vap, struct iwm_softc *s
goto out;
}
 
-   error = iwm_mvm_sf_config(sc, IWM_SF_FULL_ON);
-   if (error != 0)
-   return error;
-
error = iwm_allow_mcast(vap, sc);
if (error) {
device_printf(sc->sc_dev,
@@ -4469,6 +4457,7 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_
"%s: failed to update MAC: %d\n", __func__, error);
}
 
+   iwm_mvm_sf_update(sc, vap, FALSE);
iwm_mvm_enable_beacon_filter(sc, ivp);
iwm_mvm_power_update_mac(sc);
iwm_mvm_update_quotas(sc, ivp);
@@ -4506,143 +4495,7 @@ iwm_endscan_cb(void *arg, int pending)
ieee80211_scan_done(TAILQ_FIRST(&ic->ic_vaps));
 }
 
-/*
- * Aging and idle timeouts for the different possible scenarios
- * in default configuration
- */
-static const uint32_t
-iwm_sf_full_timeout_def[IWM_SF_NUM_SCENARIO][IWM_SF_NUM_TIMEOUT_TYPES] = {
-   {
-   htole32(IWM_SF_SINGLE_UNICAST_AGING_TIMER_DEF),
-   htole32(IWM_SF_SINGLE_UNICAST_IDLE_TIMER_DEF)
-   },
-   {
-   htole32(IWM_SF_AGG_UNICAST_AGING_TIMER_DEF),
-   htole32(IWM_SF_AGG_UNICAST_IDLE_TIMER_DEF)
-   },
-   {
-   htole32(IWM_SF_MCAST_AGING_TIMER_DEF),
-   htole32(IWM_SF_MCAST_IDLE_TIMER_DEF)
-   },
-   {
-   htole32(IWM_SF_BA_AGING_TIMER_DEF),
-   htole32(IWM_SF_BA_IDLE_TIMER_DEF)
-   },
-   {
-   htole32(IWM_SF_TX_RE_AGING_TIMER_DEF),
-   htole32(IWM_SF_TX_RE_IDLE_TIMER_DEF)
-   },
-};
-
-/*
- * Aging and idle timeouts for the different possible scenarios
- * in single BSS MAC configuration.
- */
-static const uint32_t
-iwm_sf_full_timeout[IWM_SF_NUM_SCENARIO][IWM_SF_NUM_TIMEOUT_TYPES] = {
-   {
-   htole32(IWM_SF_SINGLE_UNICAST_AGING_TIMER),
-   htole32(IWM_SF_SINGLE_UNICAST_IDLE_TIMER

svn commit: r319578 - head/sys/dev/iwm

2017-06-04 Thread Adrian Chadd
Author: adrian
Date: Sun Jun  4 21:10:14 2017
New Revision: 319578
URL: https://svnweb.freebsd.org/changeset/base/319578

Log:
  [iwm] Check for lar_disable tunable, and lar_enabled flag from NVM.
  
  * LAR can be disabled with the hw.iwm.lar.disable tunable now.
  
  * On Family 8000 devices we need to check the lar_enabled flag from
nvm_data in addition to the TLV_CAPA_LAR_SUPPORT flag from the firmware.
  
  * Add a separate IWM_DEBUG_LAR debugging flag.
  
  Obtained from:dragonflybsd.git 
0593e39cb295aa996ecf789ed4990c3b255f1770

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_debug.h
  head/sys/dev/iwm/if_iwmvar.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Sun Jun  4 21:05:58 2017(r319577)
+++ head/sys/dev/iwm/if_iwm.c   Sun Jun  4 21:10:14 2017(r319578)
@@ -356,6 +356,8 @@ static int  iwm_media_change(struct ifnet *);
 static int iwm_newstate(struct ieee80211vap *, enum ieee80211_state, int);
 static voidiwm_endscan_cb(void *, int);
 static int iwm_send_bt_init_conf(struct iwm_softc *);
+static boolean_t iwm_mvm_is_lar_supported(struct iwm_softc *);
+static boolean_t iwm_mvm_is_wifi_mcc_supported(struct iwm_softc *);
 static int iwm_send_update_mcc_cmd(struct iwm_softc *, const char *);
 static voidiwm_mvm_tt_tx_backoff(struct iwm_softc *, uint32_t);
 static int iwm_init_hw(struct iwm_softc *);
@@ -394,6 +396,9 @@ static void iwm_scan_curchan(struct ieee80211_scan_sta
 static voidiwm_scan_mindwell(struct ieee80211_scan_state *);
 static int iwm_detach(device_t);
 
+static int iwm_lar_disable = 0;
+TUNABLE_INT("hw.iwm.lar.disable", &iwm_lar_disable);
+
 /*
  * Firmware parser.
  */
@@ -2186,6 +2191,7 @@ iwm_parse_nvm_data(struct iwm_softc *sc,
 {
struct iwm_nvm_data *data;
uint32_t sku, radio_cfg;
+   uint16_t lar_config;
 
if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) {
data = malloc(sizeof(*data) +
@@ -2211,6 +2217,16 @@ iwm_parse_nvm_data(struct iwm_softc *sc,
 
data->n_hw_addrs = iwm_get_n_hw_addrs(sc, nvm_sw);
 
+   if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000) {
+   uint16_t lar_offset = data->nvm_version < 0xE39 ?
+  IWM_NVM_LAR_OFFSET_8000_OLD :
+  IWM_NVM_LAR_OFFSET_8000;
+
+   lar_config = le16_to_cpup(regulatory + lar_offset);
+   data->lar_enabled = !!(lar_config &
+  IWM_NVM_LAR_ENABLED_8000);
+   }
+
/* If no valid mac address was found - bail out */
if (iwm_set_hw_address(sc, data, nvm_hw, mac_override)) {
free(data, M_DEVBUF);
@@ -4507,6 +4523,35 @@ iwm_send_bt_init_conf(struct iwm_softc *sc)
&bt_cmd);
 }
 
+static boolean_t
+iwm_mvm_is_lar_supported(struct iwm_softc *sc)
+{
+   boolean_t nvm_lar = sc->nvm_data->lar_enabled;
+   boolean_t tlv_lar = fw_has_capa(&sc->ucode_capa,
+   IWM_UCODE_TLV_CAPA_LAR_SUPPORT);
+
+   if (iwm_lar_disable)
+   return FALSE;
+
+   /*
+* Enable LAR only if it is supported by the FW (TLV) &&
+* enabled in the NVM
+*/
+   if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000)
+   return nvm_lar && tlv_lar;
+   else
+   return tlv_lar;
+}
+
+static boolean_t
+iwm_mvm_is_wifi_mcc_supported(struct iwm_softc *sc)
+{
+   return fw_has_api(&sc->ucode_capa,
+ IWM_UCODE_TLV_API_WIFI_MCC_UPDATE) ||
+  fw_has_capa(&sc->ucode_capa,
+  IWM_UCODE_TLV_CAPA_LAR_MULTI_MCC);
+}
+
 static int
 iwm_send_update_mcc_cmd(struct iwm_softc *sc, const char *alpha2)
 {
@@ -4527,10 +4572,15 @@ iwm_send_update_mcc_cmd(struct iwm_softc *sc, const ch
int resp_v2 = fw_has_capa(&sc->ucode_capa,
IWM_UCODE_TLV_CAPA_LAR_SUPPORT_V2);
 
+   if (!iwm_mvm_is_lar_supported(sc)) {
+   IWM_DPRINTF(sc, IWM_DEBUG_LAR, "%s: no LAR support\n",
+   __func__);
+   return 0;
+   }
+
memset(&mcc_cmd, 0, sizeof(mcc_cmd));
mcc_cmd.mcc = htole16(alpha2[0] << 8 | alpha2[1]);
-   if (fw_has_api(&sc->ucode_capa, IWM_UCODE_TLV_API_WIFI_MCC_UPDATE) ||
-   fw_has_capa(&sc->ucode_capa, IWM_UCODE_TLV_CAPA_LAR_MULTI_MCC))
+   if (iwm_mvm_is_wifi_mcc_supported(sc))
mcc_cmd.source_id = IWM_MCC_SOURCE_GET_CURRENT;
else
mcc_cmd.source_id = IWM_MCC_SOURCE_OLD_FW;
@@ -4540,7 +4590,7 @@ iwm_send_update_mcc_cmd(struct iwm_softc *sc, const ch
else
hcmd.len[0] = sizeof(struct iwm_mcc_update_cmd_v1);
 
-   IWM_DPRINTF(sc, IWM_DEBUG_NODE,
+   IWM_DPRINTF(sc, IWM_DEBUG_LAR,
"send MCC update to FW with '%c%c' src = %d\n",
  

svn commit: r319579 - head/sys/dev/iwm

2017-06-04 Thread Adrian Chadd
Author: adrian
Date: Sun Jun  4 21:11:28 2017
New Revision: 319579
URL: https://svnweb.freebsd.org/changeset/base/319579

Log:
  [iwm] Remove dead code from iwm_pcie_load_cpu_sections().
  
  * If device family is 8000 then iwm_pcie_load_cpu_sections()
won't be called at all (iwm_pcie_load_cpu_sections_8000() is
called in that case) so this piece of code never gets called.
  
  Obtained from:dragonflybsd.git 
3e9aaef308100a4d630feffc131e3aca2ae12f8a

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwmreg.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Sun Jun  4 21:10:14 2017(r319578)
+++ head/sys/dev/iwm/if_iwm.c   Sun Jun  4 21:11:28 2017(r319579)
@@ -2571,14 +2571,6 @@ iwm_pcie_load_cpu_sections(struct iwm_softc *sc,
return ret;
}
 
-   if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000)
-   iwm_set_bits_prph(sc,
- IWM_CSR_UCODE_LOAD_STATUS_ADDR,
- (IWM_LMPM_CPU_UCODE_LOADING_COMPLETED |
-  IWM_LMPM_CPU_HDRS_LOADING_COMPLETED |
-  IWM_LMPM_CPU_UCODE_LOADING_STARTED) <<
-   shift_param);
-
*first_ucode_section = last_read_idx;
 
return 0;

Modified: head/sys/dev/iwm/if_iwmreg.h
==
--- head/sys/dev/iwm/if_iwmreg.hSun Jun  4 21:10:14 2017
(r319578)
+++ head/sys/dev/iwm/if_iwmreg.hSun Jun  4 21:11:28 2017
(r319579)
@@ -439,23 +439,11 @@ enum iwm_secure_boot_status_reg {
 };
 
 #define IWM_FH_UCODE_LOAD_STATUS   0x1af0
-#define IWM_CSR_UCODE_LOAD_STATUS_ADDR 0x1e70
-enum iwm_secure_load_status_reg {
-   IWM_LMPM_CPU_UCODE_LOADING_STARTED  = 0x0001,
-   IWM_LMPM_CPU_HDRS_LOADING_COMPLETED = 0x0003,
-   IWM_LMPM_CPU_UCODE_LOADING_COMPLETED= 0x0007,
-   IWM_LMPM_CPU_STATUS_NUM_OF_LAST_COMPLETED   = 0x00F8,
-   IWM_LMPM_CPU_STATUS_NUM_OF_LAST_LOADED_BLOCK= 0xFF00,
-};
 #define IWM_FH_MEM_TB_MAX_LENGTH   0x2
 
-#define IWM_LMPM_SECURE_INSPECTOR_CODE_ADDR0x1e38
-#define IWM_LMPM_SECURE_INSPECTOR_DATA_ADDR0x1e3c
 #define IWM_LMPM_SECURE_UCODE_LOAD_CPU1_HDR_ADDR   0x1e78
 #define IWM_LMPM_SECURE_UCODE_LOAD_CPU2_HDR_ADDR   0x1e7c
 
-#define IWM_LMPM_SECURE_INSPECTOR_CODE_MEM_SPACE   0x40
-#define IWM_LMPM_SECURE_INSPECTOR_DATA_MEM_SPACE   0x402000
 #define IWM_LMPM_SECURE_CPU1_HDR_MEM_SPACE 0x42
 #define IWM_LMPM_SECURE_CPU2_HDR_MEM_SPACE 0x420400
 
___
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: r319580 - head/sys/dev/iwm

2017-06-04 Thread Adrian Chadd
Author: adrian
Date: Sun Jun  4 21:12:11 2017
New Revision: 319580
URL: https://svnweb.freebsd.org/changeset/base/319580

Log:
  [iwm] Set correct state in smart-fifo configuration.
  
  Obtained from:dragonflybsd.git 
666737f64b4f6dd42ffd9f0ace9fc46ccc1ebaab

Modified:
  head/sys/dev/iwm/if_iwm_sf.c

Modified: head/sys/dev/iwm/if_iwm_sf.c
==
--- head/sys/dev/iwm/if_iwm_sf.cSun Jun  4 21:11:28 2017
(r319579)
+++ head/sys/dev/iwm/if_iwm_sf.cSun Jun  4 21:12:11 2017
(r319580)
@@ -248,7 +248,7 @@ iwm_mvm_sf_config(struct iwm_softc *sc, struct ieee802
enum iwm_sf_state new_state)
 {
struct iwm_sf_cfg_cmd sf_cmd = {
-   .state = htole32(IWM_SF_FULL_ON),
+   .state = htole32(new_state),
};
int ret = 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: r319581 - head/sys/dev/iwm

2017-06-04 Thread Adrian Chadd
Author: adrian
Date: Sun Jun  4 21:13:13 2017
New Revision: 319581
URL: https://svnweb.freebsd.org/changeset/base/319581

Log:
  [iwm] Set command code for PHY_DB as well.
  
  Obtained from:dragonflybsd.git 
58318c956a74382d1286ccabaf767012fdcfe1a2

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_phy_db.c
  head/sys/dev/iwm/if_iwmreg.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Sun Jun  4 21:12:11 2017(r319580)
+++ head/sys/dev/iwm/if_iwm.c   Sun Jun  4 21:13:13 2017(r319581)
@@ -5370,7 +5370,7 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m)
break;
 
/* ignore */
-   case 0x6c: /* IWM_PHY_DB_CMD, no idea why it's not in fw-api.h 
*/
+   case IWM_PHY_DB_CMD:
break;
 
case IWM_INIT_COMPLETE_NOTIF:

Modified: head/sys/dev/iwm/if_iwm_phy_db.c
==
--- head/sys/dev/iwm/if_iwm_phy_db.cSun Jun  4 21:12:11 2017
(r319580)
+++ head/sys/dev/iwm/if_iwm_phy_db.cSun Jun  4 21:13:13 2017
(r319581)
@@ -195,7 +195,7 @@ enum iwm_phy_db_section_type {
IWM_PHY_DB_MAX
 };
 
-#define PHY_DB_CMD 0x6c/* TEMP API - The actual is 0x8c */
+#define PHY_DB_CMD 0x6c
 
 /*
  * phy db - configure operational ucode

Modified: head/sys/dev/iwm/if_iwmreg.h
==
--- head/sys/dev/iwm/if_iwmreg.hSun Jun  4 21:12:11 2017
(r319580)
+++ head/sys/dev/iwm/if_iwmreg.hSun Jun  4 21:13:13 2017
(r319581)
@@ -1806,7 +1806,7 @@ enum {
/* Phy */
IWM_PHY_CONFIGURATION_CMD = 0x6a,
IWM_CALIB_RES_NOTIF_PHY_DB = 0x6b,
-   /* IWM_PHY_DB_CMD = 0x6c, */
+   IWM_PHY_DB_CMD = 0x6c,
 
/* Power - legacy power table command */
IWM_POWER_TABLE_CMD = 0x77,
___
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: r319582 - head/sys/dev/iwm

2017-06-04 Thread Adrian Chadd
Author: adrian
Date: Sun Jun  4 21:14:23 2017
New Revision: 319582
URL: https://svnweb.freebsd.org/changeset/base/319582

Log:
  [iwm] Ignore IWM_DEBUG_LOG_MSG notifications.
  
  * Firmware versions 21 and 22 generate some IWM_DEBUG_LOG_MSG notifications,
which seem to be harmless. Avoid spamming the system log with
"frame ... UNHANDLED (this should not happen)" messages.
  
  Obtained from:dragonflybsd.git 
dda889ac57d8e5b46bb1b1ecf53c17a18481c7c8

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Sun Jun  4 21:13:13 2017(r319581)
+++ head/sys/dev/iwm/if_iwm.c   Sun Jun  4 21:14:23 2017(r319582)
@@ -5190,7 +5190,7 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m)
"rx packet qid=%d idx=%d type=%x\n",
qid & ~0x80, pkt->hdr.idx, code);
 
-   len = le32toh(pkt->len_n_flags) & IWM_FH_RSCSR_FRAME_SIZE_MSK;
+   len = iwm_rx_packet_len(pkt);
len += sizeof(uint32_t); /* account for status word */
nextoff = offset + roundup2(len, IWM_FH_RSCSR_FRAME_ALIGN);
 
@@ -5428,6 +5428,13 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m)
notif->status, notif->action);
break;
}
+
+   /*
+* Firmware versions 21 and 22 generate some DEBUG_LOG_MSG
+* messages. Just ignore them for now.
+*/
+   case IWM_DEBUG_LOG_MSG:
+   break;
 
case IWM_MCAST_FILTER_CMD:
break;
___
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: r319583 - head/sys/contrib/dev/ath/ath_hal/ar9300

2017-06-04 Thread Adrian Chadd
Author: adrian
Date: Sun Jun  4 21:21:44 2017
New Revision: 319583
URL: https://svnweb.freebsd.org/changeset/base/319583

Log:
  [ath_hal] add USB reset PLL work around for AR9331/AR9344 (Hornet/Wasp.)
  
  It turns out that this is useful on hornet and wasp SoCs but it isn't
  enabled in ye olde HAL /unless/ you were using a version from one of the
  business units building USB targetted devices.  It eventually got fixed
  for all of them as people started wanting to use the USB ports on their
  SoCs (eg for flash storage, bluetooth, 4G/LTE widgets, etc.)
  
  This is actually a fix from ath9k but I'm merging it with the available-but-
  disabled code in the QCA reference HAL.
  
  Tested:
  
  * AR9331 SoC

Modified:
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_reset.c

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_reset.c
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_reset.c  Sun Jun  4 
21:14:23 2017(r319582)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_reset.c  Sun Jun  4 
21:21:44 2017(r319583)
@@ -90,6 +90,29 @@ do { \
 #define WAR_USB_DISABLE_PLL_LOCK_DETECT(__ah)
 #endif
 
+/*
+ * Note: the below is the version that ships with ath9k.
+ * The original HAL version is above.
+ */
+
+static void
+ar9300_disable_pll_lock_detect(struct ath_hal *ah)
+{
+   /*
+* On AR9330 and AR9340 devices, some PHY registers must be
+* tuned to gain better stability/performance. These registers
+* might be changed while doing wlan reset so the registers must
+* be reprogrammed after each reset.
+*/
+   if (AR_SREV_HORNET(ah) || AR_SREV_WASP(ah)) {
+   HALDEBUG(ah, HAL_DEBUG_RESET, "%s: called\n", __func__);
+   OS_REG_CLR_BIT(ah, AR_PHY_USB_CTRL1, (1 << 20));
+   OS_REG_RMW(ah, AR_PHY_USB_CTRL2,
+   (1 << 21) | (0xf << 22),
+   (1 << 21) | (0x3 << 22));
+   }
+}
+
 static inline void
 ar9300_attach_hw_platform(struct ath_hal *ah)
 {
@@ -1850,6 +1873,7 @@ ar9300_set_reset(struct ath_hal *ah, int type)
 
 /* Clear AHB reset */
 OS_REG_WRITE(ah, AR_HOSTIF_REG(ah, AR_RC), 0);
+ar9300_disable_pll_lock_detect(ah);
 
 ar9300_attach_hw_platform(ah);
 
@@ -1984,6 +2008,7 @@ ar9300_phy_disable(struct ath_hal *ah)
 
 
 ar9300_init_pll(ah, AH_NULL);
+ar9300_disable_pll_lock_detect(ah);
 
 return AH_TRUE;
 }
@@ -4774,7 +4799,7 @@ ar9300_reset(struct ath_hal *ah, HAL_OPMODE opmode, st
  * successfully - skip the rest of reset
  */
 if (AH9300(ah)->ah_dma_stuck != AH_TRUE) {
-WAR_USB_DISABLE_PLL_LOCK_DETECT(ah);
+ar9300_disable_pll_lock_detect(ah);
 #if ATH_SUPPORT_MCI
 if (AH_PRIVATE(ah)->ah_caps.halMciSupport && ahp->ah_mci_ready)
 {
@@ -5350,7 +5375,7 @@ ar9300_reset(struct ath_hal *ah, HAL_OPMODE opmode, st
 #undef REG_WRITE
 #endif  /* ATH_LOW_POWER_ENABLE */
 
-WAR_USB_DISABLE_PLL_LOCK_DETECT(ah);
+ar9300_disable_pll_lock_detect(ah);
 
 /* H/W Green TX */
 ar9300_control_signals_for_green_tx_mode(ah);
___
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: r319584 - head/sys/contrib/dev/iwm

2017-06-04 Thread Adrian Chadd
Author: adrian
Date: Sun Jun  4 21:26:31 2017
New Revision: 319584
URL: https://svnweb.freebsd.org/changeset/base/319584

Log:
  [iwmfw] add 7265D-22 firmware

Added:
  head/sys/contrib/dev/iwm/iwm-7265D-22.fw.uu   (contents, props changed)

Added: head/sys/contrib/dev/iwm/iwm-7265D-22.fw.uu
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/contrib/dev/iwm/iwm-7265D-22.fw.uu Sun Jun  4 21:26:31 2017
(r319584)
@@ -0,0 +1,22855 @@
+begin 644 iwm-7265D-22.fw
+M`$E73`IS=')E86TZ0V]R94-Y8VQE,3E?"`(```"*8@$`'!``
+M&P0!,PP```"3
+M!(`!@```%@2$!0```0```'C#@`#4-(``]/N``(CL
+M@`#T'8``@.Z``&P@P!`/&PDBW!W`
+M$`H`&T`@`!MN"@``88``&VX\``!A``$;;CT``&$``AMN/@``81``&VX!``!A
+M7```85<``&$``!LD(``;)>0=P!&(!^$8'P`(8@``&R4!`!LD```%)0$`!20`
+M"`4Y`0`%8H@@P!$"``4D``@%.0$`!6*,(,`1!``%)``(!3D!``5BD"#`$0@`
+M!20`"`4Y`0`%8I0@P!$0``4D``@%.0$`!6*8(,`1(``%)``(!3D!``5BG"#`
+M$4``!20`"`4Y`0`%8J`@P!$```@E```()(@'X1F$!^$90`?`$@$`&W`(``!A
+M#QP=(@0`'2;H'<`0`0`;,.@=P!&"!!LD"``;)00HP!&^#P!A```;)(``&R7D
+M'<`1```;)``!&R7D'<`1```;)``"&R7D'<`1"`!?<`P``&'8'<`0__X;,M@=
+MP!'.[@TE@ID-)`\--R)L(,`0#QLW(O__#24._PTD#PTW(J__`#(<``!D`(`3)`$`$R4X',`1#W<3
+M(N`Q,B`0`3,`0HP!$/%!4B`@`5)@]-
+M$R($$,41`@`3)/`^^K=[OOJW>[[ZMW@``"```
+M```!
+M
+M
+M
+M
+M
+M
+M
+M
+M
+M
+M
+M
+M
+M
+M
+M
+M
+M
+M``!$`(`D*"PP-```
+M`#@\0&0```!H;'!T>'P```"`
+MA(@```",D)4```"9G0```*$```"9G0```*$```"E
+M*@```#H```!J>@```(H```";GP($!@0`
+M```,$P```!LC*P```"T!``0%
+M_P#_``$!`P`!!00``@(#```#_P``_@8!`/\!`0``_P$!`?\!`@+_
+M`0`$!0$!!?\!`0,'`@#_`@(``/\"`0'_`@("_P("!?\"`@,'```$`.0&`0`.
+M`#`-!0`D`M@'!@!0`/P)!P"H`60*"`"X``P,"0!8`,0,"@!X`.@&"P!X`&`'
+M#P`4`!P-$0`8`$P*$@"D`0``$P`,`$`-%``$`$P-%0`$`%`-
+M'@```!Z('HA:
+M5@```%:(5H@"`0``J@```*J(JHC^`0``C`H``%2,5(RD'P``
+M`/X```$`_P`"`?\!`/\!`0#^`@$#`O\!`0#_`0$!_P(`_P,"`/X$`@,"_P("
+M`/\"`@'_`P#_!0,`_@8#``/_`P,`_P,#`?\```"`-0``"@``
+M``0```"(Q8``X#4```4$B,6`
+M```!I'4$`+!W!``0=P0`@'<$`$AR!`!`
+M<@0`B!8$`)04!`#D%`0`O)4!"_\```0"```&_P``
+M`/\```S_```'_P``"/\```G_```*_P```O\!`/\``0(`#P$!`@$!`0/_`0$$
+M`@$!!@,!`0<$`0$(!0$!"0T!`0H.`0`,_P$`_O\"`/\&`@$!_P("`@<"`@,(
+M`@($"0("!@H"`@<+`@((#`(""0P"`@H+`@`,_P(`_A``
+M``#_!P```/\```?_``$)"```"O\!`@```0,!_P$#`O\!`P/_`0$$_P$"
+M!0`!`0O_`0(,_P$$!@8!`0?_`0`(_P$`"O\"`@#_`@,!_P(#`O\"`P/_`@$$
+M`0("!0`"`0L!`@(,`0($!@8"`@<``@`(`0(`"@$#`/\"`P,`_P,#`?\#`P+_
+M`P,#!`,!!`4#`@4``P$+!0,"#`4#!`8&`P,'_P,`"`4#``H%`P#^`P0$`/\$
+M!`'_!`0"_P0$`_\$!`3_!`0%_P0$"_\$!`S_!`0&!@0$!P8$``C_!``*_P``
+M``#_`0,``@("``,``@``!?\```;_```$_P``!P0```C_`0#_
+M`0$!``,!`@$"`0("`@$`!/\!`0<$`0`(_P(#``8"`@(&`@`%_P(`!O\"``0'
+M`@`'!P(`"`<#`P`&`P`!!0,"`@8#`07_`P`&_P,`!`<#``<'`P`(!P``
+M`0#_`0#_``$``?\!`@+_`@#_`0(``?\"`0/_`@,$_P(""O\"`@G_`@((_P,`
+M`?\#`0,)`P4%"0,$!O\#!@H'`P,)_P0`_P,$``'_!`$#"@0"!PH$`@@*!`,$
+M_P0""@@$!`G_!`0&_P4`_P(%!`;_!0$#!04``?\%!0K_!04)!`8`__\&!`;_
+M!@$#!08``?\&`P3_!@8)!@8&"O\`
+ME+^``!X``905`0`!``0``-BH@``$``%T[8``#``!```\O(```0`#.+R`
+M``$``_0=@``!``$@OX```0`#)+^```$``U@5`0`"``0```!54@``1T4`
+M`$Q)``!.0P``1$D``%-5``!:6@``6EH``%I:``!:6@``6EH``%I:``!:6@``
+M6EH``%I:``!:6@`(!`P""@8.`0D%#0,+!P\!D0```3\```*1```^
+M/0```Y$``#T]```$D0``/P,```61```)$```!I$``!8<```'D0``'Q\```B1
+M```<%@``"9$``!`)```*D0```S\```N1```]/0``#)$``#T^```-D0``/P$`
+M`!$0/DA(`

svn commit: r319588 - in head/sys/modules/iwmfw: iwm7265Dfw iwm8000Cfw

2017-06-04 Thread Adrian Chadd
Author: adrian
Date: Sun Jun  4 21:28:03 2017
New Revision: 319588
URL: https://svnweb.freebsd.org/changeset/base/319588

Log:
  [iwmfw] bump built firmware now to version 22 for 7265D and 8000C.

Modified:
  head/sys/modules/iwmfw/iwm7265Dfw/Makefile
  head/sys/modules/iwmfw/iwm8000Cfw/Makefile

Modified: head/sys/modules/iwmfw/iwm7265Dfw/Makefile
==
--- head/sys/modules/iwmfw/iwm7265Dfw/Makefile  Sun Jun  4 21:27:50 2017
(r319587)
+++ head/sys/modules/iwmfw/iwm7265Dfw/Makefile  Sun Jun  4 21:28:03 2017
(r319588)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 
 KMOD=  iwm7265Dfw
-IMG=   iwm-7265D-17
+IMG=   iwm-7265D-22
 
 .include 

Modified: head/sys/modules/iwmfw/iwm8000Cfw/Makefile
==
--- head/sys/modules/iwmfw/iwm8000Cfw/Makefile  Sun Jun  4 21:27:50 2017
(r319587)
+++ head/sys/modules/iwmfw/iwm8000Cfw/Makefile  Sun Jun  4 21:28:03 2017
(r319588)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 
 KMOD=  iwm8000Cfw
-IMG=   iwm-8000C-16
+IMG=   iwm-8000C-22
 
 .include 
___
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: r319586 - head/sys/contrib/dev/iwm

2017-06-04 Thread Adrian Chadd
Author: adrian
Date: Sun Jun  4 21:27:39 2017
New Revision: 319586
URL: https://svnweb.freebsd.org/changeset/base/319586

Log:
  [iwmfw] 8000C ver 22 firmware.

Added:
  head/sys/contrib/dev/iwm/iwm-8000C-22.fw.uu   (contents, props changed)

Added: head/sys/contrib/dev/iwm/iwm-8000C-22.fw.uu
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/contrib/dev/iwm/iwm-8000C-22.fw.uu Sun Jun  4 21:27:39 2017
(r319586)
@@ -0,0 +1,47134 @@
+begin 644 iwm-8000C-22.fw
+M`$E73`IS=')E86TZ0V]R94-Y8VQE,3E?"`$"'@@"
+MCWX#`!P0`!L$`@```"`$
+M`*`!`#,,@```@`$`,PP!``"(``"`
+M```S#`(``$```(`&`!,```"\`@```$!```8```"A```!
+M``"&@P<6(+[/`0!`0`$$A`4`
+M
+MU7?1O$KMC1P!
+M%L)AM`1@'DT[FA#1OWMZR()DJ-L;GQEBIN9H[A^ZS%KH6MG.(:=CV\&$V<0:'I[5@L7
+M;]O#+S6])Q;OTUZ`@Q9O#\ZQZUROU1XL3>@GIX0A'ZLQS3.]EM]`#)-:.@LH
+M#44.K^C\7[\`!P3DY4F9W;8[]70ZRI8T>H?6RDCG3OM8]KY^9H/)$3]O$5[-'Q&B.Y@DA?.@%-O*2PZO`YB\^`DJ%ID&U^
+MU;IA,PR_`>K^.AN312;7&VK/A1B]+LQ(V3P\*UQ5Z=;M)')C]J\?K/@J:98N
+MJQOM?UA7<.[NM3[WW_V:XN&4IC\K8WM>$7?2$@*@8=[LZ\%::.OKRW[IDOCD
+MA+=T'/X2ZUEGV6^`(6"B0,R)YR**TD[=T/MKV(*&U3I^_OZ\&[4V>#XE=`DE
+M._=^`P<(@`$```"```"``0`'"``%``4`!P```$B\
+M@$0`0+P``!,$@`$```"6!(0%```!:-J`
+M`#PH@`!``8$`Q/B``)P4@`"`<($`
+M;"#`$`\;"2+<'<`0"@`;0"``&VX,``!A@``;;D```&$``1MN4P``80`"&VYC
+M``!A``0;;GX``&$0`!MN`0``88```&%[``!A```;)"``&R7D'<`12`GA&!\`
+M"&(``!LE`0`;)```!24!``4D``@%.0$`!6*((,`1`@`%)``(!3D!``5BC"#`
+M$00`!20`"`4Y`0`%8I`@P!$(``4D``@%.0$`!6*4(,`1$``%)``(!3D!``5B
+MF"#`$2``!20`"`4Y`0`%8IP@P!%```4D``@%.0$`!6*@(,`1```()0``""1(
+M">$91`GA&10)P!(!`!MP"@``80\<'2($`!TF)`G`$@$;(R+H'<`0`0`C<`$`
+M`&$1`!LP`0`;,.@=P!&Z#P!A```;)(``&R7D'<`1"`!?<`D``&'0",`2``D;
+M*,P(@($``,`7U`C`$@`)&RC("("!``#`%ZP/`&',",`2X`B`@0``P!?(",`2
+MW`B`@0``P!>E#P!A```;)``!&R7D'<`1"`!?<*`/`&$```4EX@0%)-0(P!(`
+M"1LH``4;*=P(@($``,`7T`C`$@`)&R@`!1LIX`B`@0``P!>3#P!A```;)``"
+M&R7D'<`1"`!?<`P``&'L'\`0__\;,^P?P!'.[@TE@ID-)`\--R)L(,`0#QLW
+M(O__#24._PTD#PTW(H(/`&'L'\`0```;,>P?P!'.[@TE@ID-)`\--R)L(,`0
+M#QLW(O__#26._PTD#PTW(G8/`&$```!A```;)2``&R1<',`18=P=P!``
+M`!TD(0$`6#'.[@TE`8$-)`\--R(/1#$7`$`$`$W`,``!A"`!8,-@>
+MP!`*`!-``@`3;@0``&$!``@D```()40)X1D!``!A`(!8,`@`9#$```!A"`!8
+M;N,/`&$``!,E```3)"00P!$`@!,D```3)3@!,B``#&$0,``20```$E#T4`(@!<`#GO_P`R%P``9`"`$R0!
+M`!,E.!S`$0]W$R+@',`1`@`!8@\!$R($",`1?`S`$LA)QQ&0"\`2`0`!;@,`
+M$S`,`,T1"`!8,0\4%2($`!4F`P`3)```$R4$",`1```3)#A%P!$%``!A``!8
+M.`0`6#$``!,D`0`3)3@P!`*`!-``@`3;@0``&$!``@D```(
+M)40)X1D$``!A`(!8,`(``&$`(%@P8>@=P!#F_Q,R__\3,^@=P!$```$D
+M"``!)0\!8R(!`%(D"``';@(``&$``!4D#P``80X``&'H'<`0^^K=[OOJW>[[ZMWN^^
+MK=[OOJW>[[ZMWN^^K=[OOJW>[[ZMWN^^K=[OOJW>[[ZMWN^^K=X`
+M
+M
+M`-`'``$!`0$!`0$!O1\``&,N``#_
+M```(
+M```!`0``
+M
+M
+M
+M
+M
+M
+M
+M
+M
+M
+M
+M```S,```
+M$1HH
+M
+M
+M
+M
+M
+M`$0`@"0H+```
+M`#`T.#P```!`1$@```!,4%0```!8
+M7&!D:&P```!P='@```!\@(0```"(
+MC)"5F0```)T```"AI0```*D```"ML0```"H`
+M```Z2@```%H```!J>@```(H```";JP($!@``
+M``,+$P```!LC*P```#,Z0@$`
+M!`4``/\```#^`0```O\```/_``$`_P$``0(!
+M`@+_`@#_`P(`_@0"``/_>.\```H$M-V`
+M`(SO`

svn commit: r319589 - head/sys/dev/iwm

2017-06-04 Thread Adrian Chadd
Author: adrian
Date: Sun Jun  4 21:28:52 2017
New Revision: 319589
URL: https://svnweb.freebsd.org/changeset/base/319589

Log:
  [iwm] Remove support for fw older than -17 and -22
  
  * iwm(4) didn't use any of these definitions yet, anyway.
  
  Obtained from:dragonflybsd.git 
f95003b8f1f7382c8396a6d408e3072632afdd3d

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwmreg.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Sun Jun  4 21:28:03 2017(r319588)
+++ head/sys/dev/iwm/if_iwm.c   Sun Jun  4 21:28:52 2017(r319589)
@@ -3451,8 +3451,7 @@ iwm_update_sched(struct iwm_softc *sc, int qid, int id
scd_bc_tbl = sc->sched_dma.vaddr;
 
len += 8; /* magic numbers came naturally from paris */
-   if (sc->sc_capaflags & IWM_UCODE_TLV_FLAGS_DW_BC_TABLE)
-   len = roundup(len, 4) / 4;
+   len = roundup(len, 4) / 4;
 
w_val = htole16(sta_id << 12 | len);
 

Modified: head/sys/dev/iwm/if_iwmreg.h
==
--- head/sys/dev/iwm/if_iwmreg.hSun Jun  4 21:28:03 2017
(r319588)
+++ head/sys/dev/iwm/if_iwmreg.hSun Jun  4 21:28:52 2017
(r319589)
@@ -594,8 +594,6 @@ enum iwm_dtd_diode_reg {
  * @IWM_UCODE_TLV_FLAGS_NEWSCAN: new uCode scan behaviour on hidden SSID,
  * treats good CRC threshold as a boolean
  * @IWM_UCODE_TLV_FLAGS_MFP: This uCode image supports MFP (802.11w).
- * @IWM_UCODE_TLV_FLAGS_P2P: This uCode image supports P2P.
- * @IWM_UCODE_TLV_FLAGS_DW_BC_TABLE: The SCD byte count table is in DWORDS
  * @IWM_UCODE_TLV_FLAGS_UAPSD: This uCode image supports uAPSD
  * @IWM_UCODE_TLV_FLAGS_SHORT_BL: 16 entries of black list instead of 64 in 
scan
  * offload profile config command.
@@ -605,35 +603,24 @@ enum iwm_dtd_diode_reg {
  * from the probe request template.
  * @IWM_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL: new NS offload (small version)
  * @IWM_UCODE_TLV_FLAGS_NEW_NSOFFL_LARGE: new NS offload (large version)
- * @IWM_UCODE_TLV_FLAGS_P2P_PS: P2P client power save is supported (only on a
- * single bound interface).
  * @IWM_UCODE_TLV_FLAGS_UAPSD_SUPPORT: General support for uAPSD
  * @IWM_UCODE_TLV_FLAGS_EBS_SUPPORT: this uCode image supports EBS.
  * @IWM_UCODE_TLV_FLAGS_P2P_PS_UAPSD: P2P client supports uAPSD power save
  * @IWM_UCODE_TLV_FLAGS_BCAST_FILTERING: uCode supports broadcast filtering.
- * @IWM_UCODE_TLV_FLAGS_GO_UAPSD: AP/GO interfaces support uAPSD clients
- *
  */
 enum iwm_ucode_tlv_flag {
IWM_UCODE_TLV_FLAGS_PAN = (1 << 0),
IWM_UCODE_TLV_FLAGS_NEWSCAN = (1 << 1),
IWM_UCODE_TLV_FLAGS_MFP = (1 << 2),
-   IWM_UCODE_TLV_FLAGS_P2P = (1 << 3),
-   IWM_UCODE_TLV_FLAGS_DW_BC_TABLE = (1 << 4),
IWM_UCODE_TLV_FLAGS_SHORT_BL= (1 << 7),
IWM_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS = (1 << 10),
IWM_UCODE_TLV_FLAGS_NO_BASIC_SSID   = (1 << 12),
IWM_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL= (1 << 15),
IWM_UCODE_TLV_FLAGS_NEW_NSOFFL_LARGE= (1 << 16),
-   IWM_UCODE_TLV_FLAGS_P2P_PS  = (1 << 21),
-   IWM_UCODE_TLV_FLAGS_BSS_P2P_PS_DCM  = (1 << 22),
-   IWM_UCODE_TLV_FLAGS_BSS_P2P_PS_SCM  = (1 << 23),
IWM_UCODE_TLV_FLAGS_UAPSD_SUPPORT   = (1 << 24),
IWM_UCODE_TLV_FLAGS_EBS_SUPPORT = (1 << 25),
IWM_UCODE_TLV_FLAGS_P2P_PS_UAPSD= (1 << 26),
IWM_UCODE_TLV_FLAGS_BCAST_FILTERING = (1 << 29),
-   IWM_UCODE_TLV_FLAGS_GO_UAPSD= (1 << 30),
-   IWM_UCODE_TLV_FLAGS_LTE_COEX= (1 << 31),
 };
 
 #define IWM_UCODE_TLV_FLAG_BITS \
@@ -647,22 +634,14 @@ P2P_PS_SCM\31UAPSD_SUPPORT\32EBS\33P2P_PS_UAPSD\36BCAS
  * @IWM_UCODE_TLV_API_FRAGMENTED_SCAN: This ucode supports active dwell time
  * longer than the passive one, which is essential for fragmented scan.
  * @IWM_UCODE_TLV_API_WIFI_MCC_UPDATE: ucode supports MCC updates with source.
- * @IWM_UCODE_TLV_API_WIDE_CMD_HDR: ucode supports wide command header
  * @IWM_UCODE_TLV_API_LQ_SS_PARAMS: Configure STBC/BFER via LQ CMD ss_params
- * @IWM_UCODE_TLV_API_EXT_SCAN_PRIORITY: scan APIs use 8-level priority
- * instead of 3.
- * @IWM_UCODE_TLV_API_TX_POWER_CHAIN: TX power API has larger command size
- * (command version 3) that supports per-chain limits
  *
  * @IWM_NUM_UCODE_TLV_API: number of bits used
  */
 enum iwm_ucode_tlv_api {
IWM_UCODE_TLV_API_FRAGMENTED_SCAN   = 8,
IWM_UCODE_TLV_API_WIFI_MCC_UPDATE   = 9,
-   IWM_UCODE_TLV_API_WIDE_CMD_HDR  = 14,
IWM_UCODE_TLV_API_LQ_SS_PARAMS  = 18,
-   IWM_UCODE_TLV_API_EXT_SCAN_PRIORITY = 24,
-   IWM_UCODE_TLV_API_TX_POWER_CHAIN= 27,
 
IWM_NUM_UCODE_TLV_API = 32
 };
@@ -4144,7 +4123,6 @@ struct iwm_l

svn commit: r319994 - head/sys/mips/conf

2017-06-15 Thread Adrian Chadd
Author: adrian
Date: Fri Jun 16 00:44:23 2017
New Revision: 319994
URL: https://svnweb.freebsd.org/changeset/base/319994

Log:
  [ar71xx] migrate all of the duplicate configuration out into a shared config 
file.
  
  This brings the default configurations (drivers, net80211 settings, etc) and 
some
  of the shared configuration into std.AR_MIPS_BASE.  I haven't yet moved the
  -current settings (witness, memguard, etc) into it.
  
  This should simplify building a lot of the same test images for my MIPS AP 
board
  development and testing.
  
  This is a work in progress; it's not designed to be perfect!

Added:
  head/sys/mips/conf/std.AR_MIPS_BASE   (contents, props changed)
Modified:
  head/sys/mips/conf/AP135
  head/sys/mips/conf/AR71XX_BASE
  head/sys/mips/conf/QCA953X_BASE
  head/sys/mips/conf/std.AR724X
  head/sys/mips/conf/std.AR91XX
  head/sys/mips/conf/std.AR933X
  head/sys/mips/conf/std.AR934X
  head/sys/mips/conf/std.QCA955X

Modified: head/sys/mips/conf/AP135
==
--- head/sys/mips/conf/AP135Fri Jun 16 00:00:01 2017(r319993)
+++ head/sys/mips/conf/AP135Fri Jun 16 00:44:23 2017(r319994)
@@ -58,13 +58,9 @@ device  geom_map
 device pci
 device qca955x_pci
 
-device ath_pci
-optionsAR71XX_ATH_EEPROM
 device firmware# Used by the above
+optionsAR71XX_ATH_EEPROM
 optionsATH_EEPROM_FIRMWARE
 
 # Boot off of the rootfs, as defined in the geom_map setup.
 optionsROOTDEVNAME=\"ufs:map/rootfs.uzip\"
-
-# Default to accept
-optionsIPFIREWALL_DEFAULT_TO_ACCEPT

Modified: head/sys/mips/conf/AR71XX_BASE
==
--- head/sys/mips/conf/AR71XX_BASE  Fri Jun 16 00:00:01 2017
(r319993)
+++ head/sys/mips/conf/AR71XX_BASE  Fri Jun 16 00:44:23 2017
(r319994)
@@ -22,13 +22,6 @@ hints"AR71XX_BASE.hints"
 
 makeoptionsDEBUG=-g#Build kernel with gdb(1) debug symbols
 
-# Build these as modules so small platform builds will have the
-# modules already built.
-makeoptionsMODULES_OVERRIDE="gpio ar71xx if_gif if_gre if_bridge bridgestp 
usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt 
wlan_amrr ath ath_pci"
-
-# For small memory footprints
-options VM_KMEM_SIZE_SCALE=1
-
 optionsDDB
 optionsKDB
 
@@ -57,75 +50,19 @@ options FFS #Berkeley Fast
 # options UFS_DIRHASH #Improve performance on big 
directories
 # options  MSDOSFS # Read MSDOS filesystems; useful for 
USB/CF
 
+include"std.AR_MIPS_BASE"
+makeoptionsMODULES_OVERRIDE+="hwpmc_mips24k"
+
 device pci
 device ar71xx_pci
 
-# 802.11 framework
-optionsIEEE80211_DEBUG
-optionsIEEE80211_ALQ
-optionsIEEE80211_SUPPORT_MESH
-optionsIEEE80211_SUPPORT_TDMA
-optionsIEEE80211_AMPDU_AGE
-device wlan# 802.11 support
-device wlan_wep# 802.11 WEP support
-device wlan_ccmp   # 802.11 CCMP support
-device wlan_tkip   # 802.11 TKIP support
-device wlan_xauth  # 802.11 hostap support
-
-# Atheros wireless NICs
-device ath # Atheros interface support
-device ath_pci # Atheros PCI/Cardbus bus
-optionsATH_DEBUG
-optionsATH_DIAGAPI
-optionsATH_ENABLE_11N
-optionsAH_DEBUG
-optionsAH_DEBUG_ALQ
-optionsALQ
-device ath_hal
-option AH_SUPPORT_AR5416
-device ath_rate_sample
-option AH_RXCFG_SDMAMW_4BYTES
-option AH_AR5416_INTERRUPT_MITIGATION
-# There's no DFS radar detection support yet so this won't actually
-# detect radars.  It however does enable the rest of the channel change
-# machinery so DFS can be debugged.
-option ATH_ENABLE_DFS
-
-device mii
-device arge
-
 device usb
-optionsUSB_EHCI_BIG_ENDIAN_DESC# handle big-endian byte order
-optionsUSB_DEBUG
-optionsUSB_HOST_ALIGN=32   # AR71XX (MIPS in general?) 
requires this
 device ehci
 
 device scbus
 device umass
 device da
 
-# On-board SPI flash
-device spibus
-device ar71xx_spi
-device mx25l
 device ar71xx_wdog
-
-device uart
 device uart_ar71xx
-
 device ar71xx_apb
-
-device loop
-device ether
-device md
-device bpf
-device random
-device if_bridge
-device gif # ip[46] in ip[46] tunneling protocol
-device gre # generic encapsulation - only for IPv4 in IPv4 
though atm
-
-optionsARGE_DEBUG  # Enable if_arge debugging for now
-
-# Enable GPIO
-device gpio
-device gp

svn commit: r320464 - head/sys/mips/conf

2017-06-28 Thread Adrian Chadd
Author: adrian
Date: Thu Jun 29 03:57:22 2017
New Revision: 320464
URL: https://svnweb.freebsd.org/changeset/base/320464

Log:
  [mips] make this compile again after all of the config changes.

Modified:
  head/sys/mips/conf/DIR-825C1

Modified: head/sys/mips/conf/DIR-825C1
==
--- head/sys/mips/conf/DIR-825C1Thu Jun 29 02:19:30 2017
(r320463)
+++ head/sys/mips/conf/DIR-825C1Thu Jun 29 03:57:22 2017
(r320464)
@@ -24,12 +24,6 @@ hints   "DIR-825C1.hints"
 # Force the board memory - the base DB120 has 128MB RAM
 options AR71XX_REALMEM=(128*1024*1024)
 
-# i2c GPIO bus
-device gpioiic
-device iicbb
-device iicbus
-device iic
-
 # Options required for miiproxy and mdiobus
 optionsARGE_MDIO   # Export an MDIO bus separate from arge
 device miiproxy# MDIO bus <-> MII PHY rendezvous
@@ -52,7 +46,6 @@ options   GEOM_UZIP
 options GEOM_PART_GPT
 
 # yes, this board has a PCI connected atheros device
-device  ath_pci
 options AR71XX_ATH_EEPROM
 device  firmware# Used by the above
 options ATH_EEPROM_FIRMWARE
___
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: r320465 - head/sys/mips/conf

2017-06-28 Thread Adrian Chadd
Author: adrian
Date: Thu Jun 29 03:58:01 2017
New Revision: 320465
URL: https://svnweb.freebsd.org/changeset/base/320465

Log:
  [mips] [ar71xx] Since the wlan/ath drivers use ALQ, ensure we build the module
  here otherwise we can't load said module.

Modified:
  head/sys/mips/conf/std.AR_MIPS_BASE

Modified: head/sys/mips/conf/std.AR_MIPS_BASE
==
--- head/sys/mips/conf/std.AR_MIPS_BASE Thu Jun 29 03:57:22 2017
(r320464)
+++ head/sys/mips/conf/std.AR_MIPS_BASE Thu Jun 29 03:58:01 2017
(r320465)
@@ -23,6 +23,7 @@ options   NO_SYSCTL_DESCR
 
 makeoptionsMODULES_OVERRIDE+="gpio ar71xx if_gif if_vlan if_gre if_tap"
 makeoptionsMODULES_OVERRIDE+="if_tun if_bridge bridgestp usb"
+makeoptionsMODULES_OVERRIDE+="alq"
 
 # Random - required during early boot!
 device random
___
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: r320466 - head/sys/dev/ath

2017-06-28 Thread Adrian Chadd
Author: adrian
Date: Thu Jun 29 03:59:02 2017
New Revision: 320466
URL: https://svnweb.freebsd.org/changeset/base/320466

Log:
  [ath_hal] if building with ALQ, ensure we actually depend upon ALQ.

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

Modified: head/sys/dev/ath/ah_osdep.c
==
--- head/sys/dev/ath/ah_osdep.c Thu Jun 29 03:58:01 2017(r320465)
+++ head/sys/dev/ath/ah_osdep.c Thu Jun 29 03:59:02 2017(r320466)
@@ -449,3 +449,6 @@ ath_hal_modevent(module_t mod __unused, int type, void
 
 DEV_MODULE(ath_hal, ath_hal_modevent, NULL);
 MODULE_VERSION(ath_hal, 1);
+#ifdefined(AH_DEBUG_ALQ)
+MODULE_DEPEND(ath_hal, alq, 1, 1, 1);
+#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: r320700 - head/sys/mips/conf

2017-07-05 Thread Adrian Chadd
Author: adrian
Date: Thu Jul  6 04:06:25 2017
New Revision: 320700
URL: https://svnweb.freebsd.org/changeset/base/320700

Log:
  [ar71xx] Start migrating the AR934x based boards over to the new world order.
  
  This unifies the PCI hints with the AHB/NOR hint syntax.
  
  Tested:
  
  * DIR825C1, AR9344 SoC / 2x2 2G + AR9580 PCI 2x2 5G

Modified:
  head/sys/mips/conf/AR934X_BASE.hints
  head/sys/mips/conf/std.AR934X

Modified: head/sys/mips/conf/AR934X_BASE.hints
==
--- head/sys/mips/conf/AR934X_BASE.hintsThu Jul  6 04:03:21 2017
(r320699)
+++ head/sys/mips/conf/AR934X_BASE.hintsThu Jul  6 04:06:25 2017
(r320700)
@@ -9,6 +9,10 @@
 hint.apb.0.at="nexus0"
 hint.apb.0.irq=4
 
+# ART calibration data mapping device
+hint.ar71xx_caldata.0.at="nexus0"
+hint.ar71xx_caldata.0.order=0
+
 # uart0
 hint.uart.0.at="apb0"
 # NB: This isn't an ns8250 UART
@@ -46,6 +50,13 @@ hint.ath.0.device_id=0x0031
 # Set this to define where the ath calibration data
 # should be fetched from in physical memory.
 # hint.ath.0.eepromaddr=0x1fff1000
+
+# Where the ART is - last 64k in the first 8MB of flash
+#hint.ar71xx_caldata.0.map.0.ath_fixup_addr=0x1fff
+#hint.ar71xx_caldata.0.map.0.ath_fixup_size=16384
+
+# And now tell the ath(4) driver where to look!
+#hint.ath.0.eeprom_firmware="ar71xx_caldata.0.map.0.eeprom_firmware"
 
 # SPI flash
 hint.spi.0.at="nexus0"

Modified: head/sys/mips/conf/std.AR934X
==
--- head/sys/mips/conf/std.AR934X   Thu Jul  6 04:03:21 2017
(r320699)
+++ head/sys/mips/conf/std.AR934X   Thu Jul  6 04:06:25 2017
(r320700)
@@ -51,7 +51,16 @@ options  NO_FFS_SNAPSHOT # We don't require 
snapshot 
 include"std.AR_MIPS_BASE"
 makeoptionsMODULES_OVERRIDE+="hwpmc_mips24k"
 
+# EEPROM caldata for AHB connected device
+optionsAR71XX_ATH_EEPROM
+device ar71xx_caldata
+device firmware
+
+# Support AR9340 support in AR9300 HAL
 optionsAH_SUPPORT_AR9340
+
+# Support EEPROM caldata in AHB devices
+optionsATH_EEPROM_FIRMWARE
 
 device pci
 device ar724x_pci
___
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: r320704 - head/sys/mips/atheros

2017-07-05 Thread Adrian Chadd
Author: adrian
Date: Thu Jul  6 04:56:23 2017
New Revision: 320704
URL: https://svnweb.freebsd.org/changeset/base/320704

Log:
  [ar724x] put in explicit memory barriers now that read/write register no 
longer
  implicitly do them.
  
  They were removed as part of my "fix this to actually work" a few commits
  ago in this file.
  
  Tested:
  
  * AP93, AR7240 + AR9280 PCI

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

Modified: head/sys/mips/atheros/ar724x_pci.c
==
--- head/sys/mips/atheros/ar724x_pci.c  Thu Jul  6 04:30:06 2017
(r320703)
+++ head/sys/mips/atheros/ar724x_pci.c  Thu Jul  6 04:56:23 2017
(r320704)
@@ -104,10 +104,12 @@ ar724x_pci_write(uint32_t reg, uint32_t offset, uint32
else
mask = 0x;
 
+   rmb();
val = ATH_READ_REG(reg + (offset & ~3));
val &= ~(mask << shift);
val |= ((data & mask) << shift);
ATH_WRITE_REG(reg + (offset & ~3), val);
+   wmb();
 
dprintf("%s: %#x/%#x addr=%#x, data=%#x(%#x), bytes=%d\n", __func__, 
reg, reg + (offset & ~3), offset, data, val, bytes);
@@ -133,6 +135,7 @@ ar724x_pci_read_config(device_t dev, u_int bus, u_int 
dprintf("%s: tag (%x, %x, %x) reg %d(%d)\n", __func__, bus, slot,
func, reg, bytes);
 
+   rmb();
if ((bus == 0) && (slot == 0) && (func == 0))
data = ATH_READ_REG(AR724X_PCI_CFG_BASE + (reg & ~3));
else
@@ -166,6 +169,9 @@ ar724x_pci_write_config(device_t dev, u_int bus, u_int
 * map is for this device.  Without it, it'll think the memory
 * map is 32 bits wide, the PCI code will then end up thinking
 * the register window is '0' and fail to allocate resources.
+*
+* Note: Test on AR7241/AR7242/AR9344! Those use a WAR value of
+* 0x1000.
 */
if (reg == PCIR_BAR(0) && bytes == 4
&& ar71xx_soc == AR71XX_SOC_AR7240
@@ -284,6 +290,7 @@ ar724x_pci_fixup(device_t dev, long flash_addr, int le
bar0 = ar724x_pci_read_config(dev, 0, 0, 0, PCIR_BAR(0), 4);
 
/* Write temporary BAR0 to map the NIC into a fixed location */
+   /* XXX AR7240: 0x; 7241/7242/9344: 0x1000 */
ar724x_pci_write_config(dev, 0, 0, 0, PCIR_BAR(0),
AR71XX_PCI_MEM_BASE, 4);
 
@@ -299,7 +306,7 @@ ar724x_pci_fixup(device_t dev, long flash_addr, int le
val |= (*cal_data++) << 16;
 
if (bootverbose)
-   printf("0x%08x=0x%04x\n", reg, val);
+   printf("0x%08x=0x%08x\n", reg, val);
 
/* Write eeprom fixup data to device memory */
ATH_WRITE_REG(AR71XX_PCI_MEM_BASE + reg, val);
___
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: r307470 - head/sys/net80211

2016-10-16 Thread Adrian Chadd
Author: adrian
Date: Mon Oct 17 04:30:10 2016
New Revision: 307470
URL: https://svnweb.freebsd.org/changeset/base/307470

Log:
  [net80211] add some more RX flags.

Modified:
  head/sys/net80211/ieee80211_freebsd.h

Modified: head/sys/net80211/ieee80211_freebsd.h
==
--- head/sys/net80211/ieee80211_freebsd.h   Mon Oct 17 04:07:13 2016
(r307469)
+++ head/sys/net80211/ieee80211_freebsd.h   Mon Oct 17 04:30:10 2016
(r307470)
@@ -652,6 +652,12 @@ intieee80211_get_xmit_params(struct mbu
 #defineIEEE80211_RX_F_AMSDU_MORE   0x0008 /* This is another 
decap AMSDU frame in the batch */
 #defineIEEE80211_RX_F_AMPDU0x0010 /* This is the start 
of an decap AMPDU list */
 #defineIEEE80211_RX_F_AMPDU_MORE   0x0020 /* This is another 
decap AMPDU frame in the batch */
+#defineIEEE80211_RX_F_FAIL_FCSCRC  0x0040 /* Failed CRC/FCS */
+#defineIEEE80211_RX_F_FAIL_MIC 0x0080 /* Failed MIC check 
*/
+#defineIEEE80211_RX_F_DECRYPTED0x0100 /* Hardware 
decrypted */
+#defineIEEE80211_RX_F_IV_STRIP 0x0200 /* Decrypted; IV 
stripped */
+#defineIEEE80211_RX_F_MMIC_STRIP   0x0400 /* Decrypted; MMIC 
stripped */
+#defineIEEE80211_RX_F_SHORTGI  0x0800 /* This is a 
short-GI frame */
 
 /* Channel width */
 #defineIEEE80211_RX_FW_20MHZ   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: r307602 - head/sys/net80211

2016-10-18 Thread Adrian Chadd
Author: adrian
Date: Wed Oct 19 05:03:46 2016
New Revision: 307602
URL: https://svnweb.freebsd.org/changeset/base/307602

Log:
  [net80211] Initial full-offload scan support.
  
  This is a very simple addition to the net80211 scan support.
  
  It doesn't implement a replacement scan interface - it just disables
  the pieces that we should disable to make this lifecycle a bit
  more managable.
  
  There's more work to come before full scan offload support is available
  but it should be good enough for driver work.
  
  * add a flag to say "full offload"
  * don't do probe requests when scanning full-offload - firmware can do that
  * don't do powersave transitions and buffering - firmware can do that
  
  tested:
  
  * iwm(4) - STA mode
  * ath10k port (local, not in freebsd-head yet)
  
  Reviewed by:  avos
  Differential Revision:https://reviews.freebsd.org/D8262

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

Modified: head/sys/net80211/ieee80211_scan_sw.c
==
--- head/sys/net80211/ieee80211_scan_sw.c   Wed Oct 19 02:39:24 2016
(r307601)
+++ head/sys/net80211/ieee80211_scan_sw.c   Wed Oct 19 05:03:46 2016
(r307602)
@@ -412,6 +412,12 @@ ieee80211_swscan_bg_scan(const struct ie
return (ic->ic_flags & IEEE80211_F_SCAN);
 }
 
+/*
+ * Taskqueue work to cancel a scan.
+ *
+ * Note: for offload scan devices, we may want to call into the
+ * driver to try and cancel scanning, however it may not be cancelable.
+ */
 static void
 cancel_scan(struct ieee80211vap *vap, int any, const char *func)
 {
@@ -512,6 +518,12 @@ ieee80211_swscan_probe_curchan(struct ie
int i;
 
/*
+* Full-offload scan devices don't require this.
+*/
+   if (vap->iv_flags_ext & IEEE80211_FEXT_SCAN_OFFLOAD)
+   return;
+
+   /*
 * Send directed probe requests followed by any
 * broadcast probe request.
 * XXX remove dependence on ic/vap->iv_bss
@@ -617,7 +629,14 @@ scan_start(void *arg, int pending)
return;
}
 
-   if (vap->iv_opmode == IEEE80211_M_STA &&
+   /*
+* Put the station into power save mode.
+*
+* This is only required if we're not a full-offload devices;
+* those devices manage scan/traffic differently.
+*/
+   if (((vap->iv_flags_ext & IEEE80211_FEXT_SCAN_OFFLOAD) == 0) &&
+   vap->iv_opmode == IEEE80211_M_STA &&
vap->iv_state == IEEE80211_S_RUN) {
if ((vap->iv_bss->ni_flags & IEEE80211_NODE_PWR_MGT) == 0) {
/* Enable station power save mode */
@@ -870,7 +889,12 @@ scan_done(struct ieee80211_scan_state *s
 * waiting for us.
 */
if (scandone) {
-   vap->iv_sta_ps(vap, 0);
+   /*
+* If we're not a scan offload device, come back out of
+* station powersave.  Offload devices handle this themselves.
+*/
+   if ((vap->iv_flags_ext & IEEE80211_FEXT_SCAN_OFFLOAD) == 0)
+   vap->iv_sta_ps(vap, 0);
if (ss->ss_next >= ss->ss_last)
ic->ic_flags_ext &= ~IEEE80211_FEXT_BGSCAN;
 

Modified: head/sys/net80211/ieee80211_var.h
==
--- head/sys/net80211/ieee80211_var.h   Wed Oct 19 02:39:24 2016
(r307601)
+++ head/sys/net80211/ieee80211_var.h   Wed Oct 19 05:03:46 2016
(r307602)
@@ -601,11 +601,12 @@ MALLOC_DECLARE(M_80211_VAP);
 #defineIEEE80211_FEXT_WDSLEGACY 0x0001 /* CONF: legacy WDS 
operation */
 #defineIEEE80211_FEXT_PROBECHAN 0x0002 /* CONF: probe passive 
channel*/
 #defineIEEE80211_FEXT_UNIQMAC   0x0004 /* CONF: user or 
computed mac */
+#defineIEEE80211_FEXT_SCAN_OFFLOAD 0x0008  /* CONF: scan 
is fully offloaded */
 
 #defineIEEE80211_FEXT_BITS \
"\20\2INACT\3SCANWAIT\4BGSCAN\5WPS\6TSN\7SCANREQ\10RESUME" \
"\0114ADDR\12NONEPR_PR\13SWBMISS\14DFS\15DOTD\16STATEWAIT\17REINIT" \
-   "\20BPF\21WDSLEGACY\22PROBECHAN\23UNIQMAC"
+   "\20BPF\21WDSLEGACY\22PROBECHAN\23UNIQMAC\24SCAN_OFFLOAD"
 
 /* ic_flags_ht/iv_flags_ht */
 #defineIEEE80211_FHT_NONHT_PR   0x0001 /* STATUS: non-HT sta 
present */
___
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: r307818 - head/sys/net80211

2016-10-23 Thread Adrian Chadd
Author: adrian
Date: Sun Oct 23 08:19:43 2016
New Revision: 307818
URL: https://svnweb.freebsd.org/changeset/base/307818

Log:
  [net80211] Add a macro to see if a frame is a management frame or not.

Modified:
  head/sys/net80211/ieee80211.h

Modified: head/sys/net80211/ieee80211.h
==
--- head/sys/net80211/ieee80211.h   Sun Oct 23 02:25:06 2016
(r307817)
+++ head/sys/net80211/ieee80211.h   Sun Oct 23 08:19:43 2016
(r307818)
@@ -162,6 +162,10 @@ struct ieee80211_qosframe_addr4 {
 #defineIEEE80211_FC0_SUBTYPE_QOS_CFACKPOLL 0xb0
 #defineIEEE80211_FC0_SUBTYPE_QOS_NULL  0xc0
 
+#defineIEEE80211_IS_MGMT(wh)   \
+   (!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK)  \
+   == IEEE80211_FC0_TYPE_MGT))
+
 #defineIEEE80211_FC0_QOSDATA \

(IEEE80211_FC0_TYPE_DATA|IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_VERSION_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: r307819 - head/sys/net80211

2016-10-23 Thread Adrian Chadd
Author: adrian
Date: Sun Oct 23 08:21:35 2016
New Revision: 307819
URL: https://svnweb.freebsd.org/changeset/base/307819

Log:
  [net80211] Add a variant on ieee80211_get_rx_params() that returns a pointer.
  
  Be careful when calling this, as the underlying mbuf may change
  afterwards - common in the RX path.

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 Oct 23 08:19:43 2016
(r307818)
+++ head/sys/net80211/ieee80211_freebsd.c   Sun Oct 23 08:21:35 2016
(r307819)
@@ -529,6 +529,21 @@ ieee80211_get_rx_params(struct mbuf *m, 
return (0);
 }
 
+const struct ieee80211_rx_stats *
+ieee80211_get_rx_params_ptr(struct mbuf *m)
+{
+   struct m_tag *mtag;
+   struct ieee80211_rx_params *rx;
+
+   mtag = m_tag_locate(m, MTAG_ABI_NET80211, NET80211_TAG_RECV_PARAMS,
+   NULL);
+   if (mtag == NULL)
+   return (NULL);
+   rx = (struct ieee80211_rx_params *)(mtag + 1);
+   return (&rx->params);
+}
+
+
 /*
  * Add TOA parameters to the given mbuf.
  */

Modified: head/sys/net80211/ieee80211_freebsd.h
==
--- head/sys/net80211/ieee80211_freebsd.h   Sun Oct 23 08:19:43 2016
(r307818)
+++ head/sys/net80211/ieee80211_freebsd.h   Sun Oct 23 08:21:35 2016
(r307819)
@@ -713,6 +713,7 @@ int ieee80211_add_rx_params(struct mbuf 
const struct ieee80211_rx_stats *rxs);
 intieee80211_get_rx_params(struct mbuf *m,
struct ieee80211_rx_stats *rxs);
+const struct ieee80211_rx_stats * ieee80211_get_rx_params_ptr(struct mbuf *m);
 
 struct ieee80211_toa_params {
int request_id;
___
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: r307831 - head/lib/librss

2016-10-23 Thread Adrian Chadd
Author: adrian
Date: Sun Oct 23 20:41:25 2016
New Revision: 307831
URL: https://svnweb.freebsd.org/changeset/base/307831

Log:
  [rss] install the header file.
  
  Submitted by: gallatin

Modified:
  head/lib/librss/Makefile

Modified: head/lib/librss/Makefile
==
--- head/lib/librss/MakefileSun Oct 23 19:59:56 2016(r307830)
+++ head/lib/librss/MakefileSun Oct 23 20:41:25 2016(r307831)
@@ -5,6 +5,7 @@ SHLIBDIR?=  /lib
 
 .include 
 
+INCS=  librss.h
 LIB=   rss
 SHLIB_MAJOR=   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: r307832 - head/lib/librss

2016-10-23 Thread Adrian Chadd
Author: adrian
Date: Sun Oct 23 20:42:32 2016
New Revision: 307832
URL: https://svnweb.freebsd.org/changeset/base/307832

Log:
  [rss] manpage improvements.
  
  Submitted by: gallatin

Modified:
  head/lib/librss/librss.3

Modified: head/lib/librss/librss.3
==
--- head/lib/librss/librss.3Sun Oct 23 20:41:25 2016(r307831)
+++ head/lib/librss/librss.3Sun Oct 23 20:42:32 2016(r307832)
@@ -1,6 +1,6 @@
 .\" $FreeBSD$
 .\"
-.Dd September 29, 2016
+.Dd October 23, 2016
 .Dt LIBRSS 3
 .Os
 .Sh NAME
@@ -9,6 +9,8 @@
 .Sh LIBRARY
 .Lb librss
 .Sh SYNOPSIS
+.In sys/param.h
+.In sys/cpuset.h
 .In librss.h
 .Ft struct rss_config *
 .Fn rss_config_get "void"
@@ -17,6 +19,8 @@
 .Ft int
 .Fn rss_config_get_bucket_count "struct rss_config *cfg"
 .Ft int
+.Fn rss_get_bucket_cpuset "struct rss_config *rc" "rss_bucket_type_t btype" 
"int bucket" "cpuset_t *cs"
+.Ft int
 .Fn rss_set_bucket_rebalance_cb "rss_bucket_rebalance_cb_t *cb" "void *cbdata"
 .Ft int
 .Fn rss_sock_set_bindmulti "int fd" "int af" "int val"
___
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: r308007 - head/sys/net80211

2016-10-27 Thread Adrian Chadd
Author: adrian
Date: Fri Oct 28 02:09:45 2016
New Revision: 308007
URL: https://svnweb.freebsd.org/changeset/base/308007

Log:
  [net80211] don't abort a background scan upon reception of a single packet.
  
  Full offload drivers don't need this behaviour - they do it in firmware.

Modified:
  head/sys/net80211/ieee80211_scan_sw.c

Modified: head/sys/net80211/ieee80211_scan_sw.c
==
--- head/sys/net80211/ieee80211_scan_sw.c   Fri Oct 28 00:04:04 2016
(r308006)
+++ head/sys/net80211/ieee80211_scan_sw.c   Fri Oct 28 02:09:45 2016
(r308007)
@@ -467,6 +467,11 @@ ieee80211_swscan_cancel_scan(struct ieee
 static void
 ieee80211_swscan_cancel_anyscan(struct ieee80211vap *vap)
 {
+
+   /* XXX for now - just don't do this per packet. */
+   if (vap->iv_flags_ext & IEEE80211_FEXT_SCAN_OFFLOAD)
+   return;
+
cancel_scan(vap, 1, __func__);
 }
 
___
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: r308008 - head/sys/net80211

2016-10-27 Thread Adrian Chadd
Author: adrian
Date: Fri Oct 28 02:10:07 2016
New Revision: 308008
URL: https://svnweb.freebsd.org/changeset/base/308008

Log:
  [net80211] add comments!

Modified:
  head/sys/net80211/ieee80211_scan.c

Modified: head/sys/net80211/ieee80211_scan.c
==
--- head/sys/net80211/ieee80211_scan.c  Fri Oct 28 02:09:45 2016
(r308007)
+++ head/sys/net80211/ieee80211_scan.c  Fri Oct 28 02:10:07 2016
(r308008)
@@ -443,6 +443,9 @@ ieee80211_cancel_scan(struct ieee80211va
 
 /*
  * Cancel any scan currently going on.
+ *
+ * This is called during normal 802.11 data path to cancel
+ * a scan so a newly arrived normal data packet can be sent.
  */
 void
 ieee80211_cancel_anyscan(struct ieee80211vap *vap)
___
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: r308267 - head/sys/dev/ath

2016-11-03 Thread Adrian Chadd
Author: adrian
Date: Thu Nov  3 23:05:39 2016
New Revision: 308267
URL: https://svnweb.freebsd.org/changeset/base/308267

Log:
  [ath] add the MIMO per-chain RSSI and noise floor information.
  
  This is a long time coming.  The general pieces have been floating around
  in a local repo since circa 2012 when I dropped the net80211 support
  into the tree.
  
  This allows the per-chain RSSI and NF to show up in 'ifconfig wlanX list sta'.
  I haven't yet implemented the EVM hookups so that'll show up; that'll come
  later.
  
  Thanks to Susie Hellings  who did the original work
  on this a looong time ago for a company we both worked at.

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.cThu Nov  3 22:51:38 2016
(r308266)
+++ head/sys/dev/ath/if_ath_rx.cThu Nov  3 23:05:39 2016
(r308267)
@@ -635,7 +635,9 @@ ath_rx_pkt(struct ath_softc *sc, struct 
 struct mbuf *m)
 {
uint64_t rstamp;
-   int len, type;
+   /* XXX TODO: make this an mbuf tag? */
+   struct ieee80211_rx_stats rxs;
+   int len, type, i;
struct ieee80211com *ic = &sc->sc_ic;
struct ieee80211_node *ni;
int is_good = 0;
@@ -904,6 +906,33 @@ rx_accept:
sc->sc_stats.ast_rx_agg++;
 #endif /* AH_SUPPORT_AR5416 */
 
+
+   /*
+* Populate the per-chain RSSI values where appropriate.
+*/
+   bzero(&rxs, sizeof(rxs));
+   rxs.r_flags |= IEEE80211_R_NF | IEEE80211_R_RSSI |
+   IEEE80211_R_C_CHAIN |
+   IEEE80211_R_C_NF |
+   IEEE80211_R_C_RSSI |
+   IEEE80211_R_TSF64 |
+   IEEE80211_R_TSF_START;  /* XXX TODO: validate */
+   rxs.c_rssi = rs->rs_rssi;
+   rxs.c_nf = nf;
+   rxs.c_chain = 3;/* XXX TODO: check */
+   rxs.c_rx_tsf = rstamp;
+
+   for (i = 0; i < 3; i++) {
+   rxs.c_rssi_ctl[i] = rs->rs_rssi_ctl[i];
+   rxs.c_rssi_ext[i] = rs->rs_rssi_ext[i];
+   /*
+* XXX note: we currently don't track
+* per-chain noisefloor.
+*/
+   rxs.c_nf_ctl[i] = nf;
+   rxs.c_nf_ext[i] = nf;
+   }
+
if (ni != NULL) {
/*
 * Only punt packets for ampdu reorder processing for
@@ -916,7 +945,8 @@ rx_accept:
/*
 * Sending station is known, dispatch directly.
 */
-   type = ieee80211_input(ni, m, rs->rs_rssi, nf);
+   (void) ieee80211_add_rx_params(m, &rxs);
+   type = ieee80211_input_mimo(ni, m);
ieee80211_free_node(ni);
m = NULL;
/*
@@ -929,7 +959,8 @@ rx_accept:
rs->rs_keyix != HAL_RXKEYIX_INVALID)
is_good = 1;
} else {
-   type = ieee80211_input_all(ic, m, rs->rs_rssi, nf);
+   (void) ieee80211_add_rx_params(m, &rxs);
+   type = ieee80211_input_mimo_all(ic, m);
m = NULL;
}
 
___
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: r308268 - head/sys/x86/x86

2016-11-03 Thread Adrian Chadd
Author: adrian
Date: Thu Nov  3 23:11:33 2016
New Revision: 308268
URL: https://svnweb.freebsd.org/changeset/base/308268

Log:
  Add a witness check to enforce that no non-sleeping locks are held when
  they shouldn't be.
  
  I used this during driver bring-up to find that the Linux driver holds a
  whole lot of locks whilst doing their equivalent of busdma operations.
  
  If this works out well, it should be added to the other architecture busdma
  implementations to aid in similar debugging.
  
  Tested:
  
  * bounce buffer and dmar busdma, Lenovo X230 laptop, all the internal
hardware
  * ath(4) too
  
  Discussed with: jhb

Modified:
  head/sys/x86/x86/busdma_machdep.c

Modified: head/sys/x86/x86/busdma_machdep.c
==
--- head/sys/x86/x86/busdma_machdep.c   Thu Nov  3 23:05:39 2016
(r308267)
+++ head/sys/x86/x86/busdma_machdep.c   Thu Nov  3 23:11:33 2016
(r308268)
@@ -197,6 +197,8 @@ bus_dma_tag_create(bus_dma_tag_t parent,
struct bus_dma_tag_common *tc;
int error;
 
+   WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "%s", __func__);
+
if (parent == NULL) {
error = bus_dma_bounce_impl.tag_create(parent, alignment,
boundary, lowaddr, highaddr, filter, filterarg, maxsize,
@@ -228,6 +230,8 @@ bus_dmamap_create(bus_dma_tag_t dmat, in
 {
struct bus_dma_tag_common *tc;
 
+   WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "%s", __func__);
+
tc = (struct bus_dma_tag_common *)dmat;
return (tc->impl->map_create(dmat, flags, mapp));
 }
@@ -257,6 +261,8 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi
 {
struct bus_dma_tag_common *tc;
 
+   WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "%s", __func__);
+
tc = (struct bus_dma_tag_common *)dmat;
return (tc->impl->mem_alloc(dmat, vaddr, flags, mapp));
 }
___
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: r308354 - head/sys/net80211

2016-11-05 Thread Adrian Chadd
Author: adrian
Date: Sat Nov  5 22:41:22 2016
New Revision: 308354
URL: https://svnweb.freebsd.org/changeset/base/308354

Log:
  [net80211] begin fleshing out new hardware crypto offload features.
  
  * extend the keycache flag word to be 32 bits, not 16 bits
  * add new key flags for transmit:
+ IEEE80211_KEY_NOIV: Don't insert IV in the payload when transmitting data 
frames;
+ IEEE80211_KEY_NOIVMGT:  Don't insert IV in the payload when transmitting 
MIC frames;
+ IEEE80211_KEY_NOMIC: Don't insert MIC in the payload when transmitting 
data frames;
+ IEEE80211_KEY_NOMICMGT: don't insert MIC in the payload when transmitting 
management
  frames.
  
  * teach ieee80211_crypto_demic() about hardware decrypted frames:
+ if frames are hardware decrypted and the frame has failed MIC, treat it 
as a
   michael failure.
+ if frames are hardware decrypted and the frame has stripped MIC, we can't 
check the
  MIC in the payload - we don't have anything to compare it against.
  
  This is only part of the work required to successfully transmit/receive
  hardware crypto frames such as the qualcomm atheros 11ac offload chips.
  
  There will be further work in the transmit and receive path before this
  can be done by default.
  
  Reviewed by:  avos
  Differential Revision:https://reviews.freebsd.org/D8364

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

Modified: head/sys/net80211/ieee80211_crypto.c
==
--- head/sys/net80211/ieee80211_crypto.cSat Nov  5 22:09:21 2016
(r308353)
+++ head/sys/net80211/ieee80211_crypto.cSat Nov  5 22:41:22 2016
(r308354)
@@ -633,6 +633,61 @@ ieee80211_crypto_decap(struct ieee80211_
 #undef IEEE80211_WEP_HDRLEN
 }
 
+
+/*
+ * Check and remove any MIC.
+ */
+int
+ieee80211_crypto_demic(struct ieee80211vap *vap, struct ieee80211_key *k,
+struct mbuf *m, int force)
+{
+   const struct ieee80211_cipher *cip;
+   const struct ieee80211_rx_stats *rxs;
+   struct ieee80211_frame *wh;
+
+   rxs = ieee80211_get_rx_params_ptr(m);
+   wh = mtod(m, struct ieee80211_frame *);
+
+   /*
+* Handle demic / mic errors from hardware-decrypted offload devices.
+*/
+   if ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_DECRYPTED)) {
+   if (rxs->c_pktflags & IEEE80211_RX_F_FAIL_MIC) {
+   /*
+* Hardware has said MIC failed.  We don't care about
+* whether it was stripped or not.
+*
+* Eventually - teach the demic methods in crypto
+* modules to handle a NULL key and not to dereference
+* it.
+*/
+   ieee80211_notify_michael_failure(vap, wh, -1);
+   return (0);
+   }
+
+   if (rxs->c_pktflags & IEEE80211_RX_F_MMIC_STRIP) {
+   /*
+* Hardware has decrypted and not indicated a
+* MIC failure and has stripped the MIC.
+* We may not have a key, so for now just
+* return OK.
+*/
+   return (1);
+   }
+   }
+
+   /*
+* If we don't have a key at this point then we don't
+* have to demic anything.
+*/
+   if (k == NULL)
+   return (1);
+
+   cip = k->wk_cipher;
+   return (cip->ic_miclen > 0 ? cip->ic_demic(k, m, force) : 1);
+}
+
+
 static void
 load_ucastkey(void *arg, struct ieee80211_node *ni)
 {

Modified: head/sys/net80211/ieee80211_crypto.h
==
--- head/sys/net80211/ieee80211_crypto.hSat Nov  5 22:09:21 2016
(r308353)
+++ head/sys/net80211/ieee80211_crypto.hSat Nov  5 22:41:22 2016
(r308354)
@@ -73,19 +73,25 @@ typedef uint16_t ieee80211_keyix;   /* h/w
 
 struct ieee80211_key {
uint8_t wk_keylen;  /* key length in bytes */
-   uint8_t wk_pad;
-   uint16_twk_flags;
-#defineIEEE80211_KEY_XMIT  0x0001  /* key used for xmit */
-#defineIEEE80211_KEY_RECV  0x0002  /* key used for recv */
-#defineIEEE80211_KEY_GROUP 0x0004  /* key used for WPA group 
operation */
-#defineIEEE80211_KEY_NOREPLAY  0x0008  /* ignore replay failures */
-#defineIEEE80211_KEY_SWENCRYPT 0x0010  /* host-based encrypt */
-#defineIEEE80211_KEY_SWDECRYPT 0x0020  /* host-based decrypt */
-#defineIEEE80211_KEY_SWENMIC   0x0040  /* host-based enmic */
-#defineIEEE80211_KEY_SWDEMIC   0x0080  /* host-based demic */
-#defineIEEE80211_KEY_DEVKEY0x0100  /* device key request completed 
*/
-#def

svn commit: r308383 - head/sys/net80211

2016-11-06 Thread Adrian Chadd
Author: adrian
Date: Sun Nov  6 19:16:46 2016
New Revision: 308383
URL: https://svnweb.freebsd.org/changeset/base/308383

Log:
  [net80211] add a method to also explicitly tear down RX A-MPDU.
  
  The ath10k firmware API doesn't pass up the ADDBA/DELBA frames, only
  WMI firmware notifications.
  
  Tested:
  
  * ath10k (QCA9880), doing actual (ha!) 11n!

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.cSun Nov  6 18:40:12 2016
(r308382)
+++ head/sys/net80211/ieee80211_ht.cSun Nov  6 19:16:46 2016
(r308383)
@@ -597,6 +597,19 @@ ieee80211_ampdu_rx_start_ext(struct ieee
 }
 
 /*
+ * Public function; manually stop the RX AMPDU state.
+ */
+void
+ieee80211_ampdu_rx_stop_ext(struct ieee80211_node *ni, int tid)
+{
+   struct ieee80211_rx_ampdu *rap;
+
+   /* XXX TODO: sanity check tid, seq, baw */
+   rap = &ni->ni_rx_ampdu[tid];
+   ampdu_rx_stop(ni, rap);
+}
+
+/*
  * Stop A-MPDU rx processing for the specified TID.
  */
 static void

Modified: head/sys/net80211/ieee80211_ht.h
==
--- head/sys/net80211/ieee80211_ht.hSun Nov  6 18:40:12 2016
(r308382)
+++ head/sys/net80211/ieee80211_ht.hSun Nov  6 19:16:46 2016
(r308383)
@@ -220,6 +220,7 @@ voidieee80211_ht_update_beacon(struct i
struct ieee80211_beacon_offsets *);
 intieee80211_ampdu_rx_start_ext(struct ieee80211_node *ni, int tid,
int seq, int baw);
+void   ieee80211_ampdu_rx_stop_ext(struct ieee80211_node *ni, int tid);
 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);
___
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: r308385 - head/sys/net80211

2016-11-06 Thread Adrian Chadd
Author: adrian
Date: Sun Nov  6 19:18:25 2016
New Revision: 308385
URL: https://svnweb.freebsd.org/changeset/base/308385

Log:
  [net80211] extend the net80211 ALQ code to support variable payloads.
  
  Also - allow driver specific bits to be added, rather than just net80211.
  
  This still isn't as useful as it should be by default; it needs to
  be a standalone struct/instance so it can be done before net80211
  registration occurs, and it can log per-device items.
  
  But, it's getting there.

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

Modified: head/sys/net80211/ieee80211_alq.c
==
--- head/sys/net80211/ieee80211_alq.c   Sun Nov  6 19:17:39 2016
(r308384)
+++ head/sys/net80211/ieee80211_alq.c   Sun Nov  6 19:18:25 2016
(r308385)
@@ -79,14 +79,13 @@ ieee80211_alq_setlogging(int enable)
ieee80211_alq_logfile,
curthread->td_ucred,
ALQ_DEFAULT_CMODE,
-   sizeof (struct ieee80211_alq_rec),
-   ieee80211_alq_qsize);
+   ieee80211_alq_qsize, 0);
ieee80211_alq_lost = 0;
ieee80211_alq_logged = 0;
printf("net80211: logging to %s enabled; "
"struct size %d bytes\n",
ieee80211_alq_logfile,
-   sizeof(struct ieee80211_alq_rec));
+   (int) sizeof(struct ieee80211_alq_rec));
} else {
if (ieee80211_alq)
alq_close(ieee80211_alq);
@@ -113,18 +112,19 @@ sysctl_ieee80211_alq_log(SYSCTL_HANDLER_
 SYSCTL_PROC(_net_wlan, OID_AUTO, alq, CTLTYPE_INT|CTLFLAG_RW,
0, 0, sysctl_ieee80211_alq_log, "I", "Enable net80211 alq logging");
 SYSCTL_INT(_net_wlan, OID_AUTO, alq_size, CTLFLAG_RW,
-   &ieee80211_alq_qsize, 0, "In-memory log size (#records)");
+   &ieee80211_alq_qsize, 0, "In-memory log size (bytes)");
 SYSCTL_INT(_net_wlan, OID_AUTO, alq_lost, CTLFLAG_RW,
&ieee80211_alq_lost, 0, "Debugging operations not logged");
 SYSCTL_INT(_net_wlan, OID_AUTO, alq_logged, CTLFLAG_RW,
&ieee80211_alq_logged, 0, "Debugging operations logged");
 
 static struct ale *
-ieee80211_alq_get(void)
+ieee80211_alq_get(size_t len)
 {
struct ale *ale;
 
-   ale = alq_get(ieee80211_alq, ALQ_NOWAIT);
+   ale = alq_getn(ieee80211_alq, len + sizeof(struct ieee80211_alq_rec),
+   ALQ_NOWAIT);
if (!ale)
ieee80211_alq_lost++;
else
@@ -132,25 +132,44 @@ ieee80211_alq_get(void)
return ale;
 }
 
-void
-ieee80211_alq_log(struct ieee80211vap *vap, uint8_t op, u_char *p, int l)
+int
+ieee80211_alq_log(struct ieee80211com *ic, struct ieee80211vap *vap,
+uint32_t op, uint32_t flags, uint16_t srcid, const uint8_t *src,
+size_t len)
 {
struct ale *ale;
struct ieee80211_alq_rec *r;
+   char *dst;
 
+   /* Don't log if we're disabled */
if (ieee80211_alq == NULL)
-   return;
+   return (0);
 
-   ale = ieee80211_alq_get();
+   if (len > IEEE80211_ALQ_MAX_PAYLOAD)
+   return (ENOMEM);
+
+   ale = ieee80211_alq_get(len);
if (! ale)
-   return;
+   return (ENOMEM);
 
r = (struct ieee80211_alq_rec *) ale->ae_data;
-   r->r_timestamp = htonl(ticks);
-   r->r_version = 1;
-   r->r_wlan = htons(vap->iv_ifp->if_dunit);
-   r->r_op = op;
-   r->r_threadid = htonl((uint32_t) curthread->td_tid);
-   memcpy(&r->r_payload, p, MIN(l, sizeof(r->r_payload)));
+   dst = ((char *) r) + sizeof(struct ieee80211_alq_rec);
+   r->r_timestamp = htobe64(ticks);
+   if (vap != NULL) {
+   r->r_wlan = htobe16(vap->iv_ifp->if_dunit);
+   } else {
+   r->r_wlan = 0x;
+   }
+   r->r_src = htobe16(srcid);
+   r->r_flags = htobe32(flags);
+   r->r_op = htobe32(op);
+   r->r_len = htobe32(len + sizeof(struct ieee80211_alq_rec));
+   r->r_threadid = htobe32((uint32_t) curthread->td_tid);
+
+   if (src != NULL)
+   memcpy(dst, src, len);
+
alq_post(ieee80211_alq, ale);
+
+   return (0);
 }

Modified: head/sys/net80211/ieee80211_alq.h
==
--- head/sys/net80211/ieee80211_alq.h   Sun Nov  6 19:17:39 2016
(r308384)
+++ head/sys/net80211/ieee80211_alq.h   Sun Nov  6 19:18:25 2016
(r308385)
@@ -27,7 +27,7 @@
 #ifndef__IEEE80211_ALQ_H__
 #define__IEEE80211_ALQ_H__
 
-#defineIEEE80211_ALQ_PAYLOAD_SIZE  24
+#defineIEEE80211_ALQ_MAX_PAYLOAD   1024
 
 /*
  * timestamp
@@ -36,18 +36,24 @@
  * sub-operation
  * rest of structure - operation specific
  */
+
+#defineIEEE80211_ALQ_SRC_NET80211  0x0001
+/* Drivers define their own numbers ab

svn commit: r308485 - head/sys/net80211

2016-11-10 Thread Adrian Chadd
Author: adrian
Date: Thu Nov 10 18:36:40 2016
New Revision: 308485
URL: https://svnweb.freebsd.org/changeset/base/308485

Log:
  [net80211] implement "first RX defines the BAW" hack.
  
  Unfortunately (sigh) some firmware doesn't provide the RX BA starting point,
  so we need to cope and set a "close enough" sequence number so we (hopefully!)
  don't discard frames as duplicates.
  
  Tested:
  
  * QCA9880v2, athp driver (under development), STA 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.cThu Nov 10 16:27:34 2016
(r308484)
+++ head/sys/net80211/ieee80211_ht.cThu Nov 10 18:36:40 2016
(r308485)
@@ -582,7 +582,13 @@ ieee80211_ampdu_rx_start_ext(struct ieee
memset(rap, 0, sizeof(*rap));
rap->rxa_wnd = (baw== 0) ?
IEEE80211_AGGR_BAWMAX : min(baw, IEEE80211_AGGR_BAWMAX);
-   rap->rxa_start = seq;
+   if (seq == -1) {
+   /* Wait for the first RX frame, use that as BAW */
+   rap->rxa_start = 0;
+   rap->rxa_flags |= IEEE80211_AGGR_WAITRX;
+   } else {
+   rap->rxa_start = seq;
+   }
rap->rxa_flags |=  IEEE80211_AGGR_RUNNING | IEEE80211_AGGR_XCHGPEND;
 
IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_11N, ni,
@@ -617,7 +623,9 @@ ampdu_rx_stop(struct ieee80211_node *ni,
 {
 
ampdu_rx_purge(rap);
-   rap->rxa_flags &= ~(IEEE80211_AGGR_RUNNING | IEEE80211_AGGR_XCHGPEND);
+   rap->rxa_flags &= ~(IEEE80211_AGGR_RUNNING
+   | IEEE80211_AGGR_XCHGPEND
+   | IEEE80211_AGGR_WAITRX);
 }
 
 /*
@@ -842,6 +850,16 @@ ieee80211_ampdu_reorder(struct ieee80211
}
rxseq >>= IEEE80211_SEQ_SEQ_SHIFT;
rap->rxa_nframes++;
+
+   /*
+* Handle waiting for the first frame to define the BAW.
+* Some firmware doesn't provide the RX of the starting point
+* of the BAW and we have to cope.
+*/
+   if (rap->rxa_flags & IEEE80211_AGGR_WAITRX) {
+   rap->rxa_flags &= ~IEEE80211_AGGR_WAITRX;
+   rap->rxa_start = rxseq;
+   }
 again:
if (rxseq == rap->rxa_start) {
/*

Modified: head/sys/net80211/ieee80211_ht.h
==
--- head/sys/net80211/ieee80211_ht.hThu Nov 10 16:27:34 2016
(r308484)
+++ head/sys/net80211/ieee80211_ht.hThu Nov 10 18:36:40 2016
(r308485)
@@ -44,6 +44,7 @@ struct ieee80211_tx_ampdu {
 #defineIEEE80211_AGGR_SETUP0x0008  /* deferred state setup 
*/
 #defineIEEE80211_AGGR_NAK  0x0010  /* peer NAK'd ADDBA 
request */
 #defineIEEE80211_AGGR_BARPEND  0x0020  /* BAR response pending 
*/
+#defineIEEE80211_AGGR_WAITRX   0x0040  /* Wait for first RX 
frame to define BAW */
uint8_t txa_tid;
uint8_t txa_token;  /* dialog token */
int txa_lastsample; /* ticks @ last traffic sample */
___
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: r308130 - in head: . gnu/lib/libgcc gnu/usr.bin/binutils gnu/usr.bin/binutils/ld gnu/usr.bin/binutils/libbfd gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb lib/libc lib/libc/mip

2016-11-10 Thread Adrian Chadd
hi,

This fails to boot on actual mips24k hardware, no hardfloat:

COP1_UNUSABLE: pid 1 tid 11 (init), uid 0: pc 0x404237c0 ra 0x404224d4
Trapframe Register Dump:
zero: 0at: 0xffe0v0: 0x404471b8v1:
0x

.. lots of that the moment we boot userland.



-adrian


On 3 November 2016 at 13:10, Ruslan Bukin  wrote:
> On Thu, Nov 03, 2016 at 12:39:48PM -0700, Bryan Drewery wrote:
>> On 10/31/16 8:33 AM, Ruslan Bukin wrote:
>> > Modified: head/share/mk/bsd.cpu.mk
>> > ==
>> > --- head/share/mk/bsd.cpu.mkMon Oct 31 15:11:55 2016
>> > (r308129)
>> > +++ head/share/mk/bsd.cpu.mkMon Oct 31 15:33:58 2016
>> > (r308130)
>> > @@ -303,6 +303,9 @@ MACHINE_CPU = v9 ultrasparc ultrasparc3
>> >
>> >  .if ${MACHINE_CPUARCH} == "mips"
>> >  CFLAGS += -G0
>> > +.if ${TARGET_ARCH:Mmips*hf}
>>
>> TARGET_ARCH is not valid here.  This broke building ports.  Fixed in
>> r308262.
>>
>
> Thank you!
>
> Ruslan
>
___
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: r308130 - in head: . gnu/lib/libgcc gnu/usr.bin/binutils gnu/usr.bin/binutils/ld gnu/usr.bin/binutils/libbfd gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb lib/libc lib/libc/mip

2016-11-10 Thread Adrian Chadd
ok, so there are two problems with mips now.

* COP1_UNUSABLE - which is now being logged, and we were likely
triggering it before. The problem: we always turned it on. If I
comment out flipping on the COP1 bits in the .S files, those
exceptions go away.

* Page faults, but that may be me with an older userland:

BAD_PAGE_FAULT: pid 1 tid 11 (init), uid 0: pc 0x404237c0 got a
read fault (type 0x2) at 0x8
Trapframe Register Dump:
zero: 0at: 0xffe0v0: 0x404471b8v1:
0x
a0: 0x404471b8a1: 0x7ffeea50a2: 0x16ca3: 0
t0: 0t1: 0t2: 0t3: 0x7011
t4: 0x11t5: 0x7013t6: 0x3t7: 0
t8: 0t9: 0x4041c940s0: 0s1: 0x40417000
s2: 0x7fffeee0s3: 0xs4: 0xcs5: 0x40427000
s6: 0x7fffeeccs7: 0x7ffeea50k0: 0k1: 0
gp: 0x4044e630sp: 0x7ffee838s8: 0x2ra: 0x404224d4
sr: 0xfc13mullo: 0mulhi: 0badvaddr: 0x8
cause: 0x8pc: 0x404237c0
Page table info for pc address 0x404237c0: pde = 0x809aa000, pte = 0xa001ba9a
Dumping 4 words starting at pc address 0x404237c0:
8e18 1600fff1 8f828070 10a3



-adrian


On 10 November 2016 at 12:49, Adrian Chadd  wrote:
> hi,
>
> This fails to boot on actual mips24k hardware, no hardfloat:
>
> COP1_UNUSABLE: pid 1 tid 11 (init), uid 0: pc 0x404237c0 ra 0x404224d4
> Trapframe Register Dump:
> zero: 0at: 0xffe0v0: 0x404471b8v1:
> 0x
>
> .. lots of that the moment we boot userland.
>
>
>
> -adrian
>
>
> On 3 November 2016 at 13:10, Ruslan Bukin  wrote:
>> On Thu, Nov 03, 2016 at 12:39:48PM -0700, Bryan Drewery wrote:
>>> On 10/31/16 8:33 AM, Ruslan Bukin wrote:
>>> > Modified: head/share/mk/bsd.cpu.mk
>>> > ==
>>> > --- head/share/mk/bsd.cpu.mkMon Oct 31 15:11:55 2016
>>> > (r308129)
>>> > +++ head/share/mk/bsd.cpu.mkMon Oct 31 15:33:58 2016
>>> > (r308130)
>>> > @@ -303,6 +303,9 @@ MACHINE_CPU = v9 ultrasparc ultrasparc3
>>> >
>>> >  .if ${MACHINE_CPUARCH} == "mips"
>>> >  CFLAGS += -G0
>>> > +.if ${TARGET_ARCH:Mmips*hf}
>>>
>>> TARGET_ARCH is not valid here.  This broke building ports.  Fixed in
>>> r308262.
>>>
>>
>> Thank you!
>>
>> Ruslan
>>
___
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: r305843 - in head/sys/mips: include mips

2016-11-10 Thread Adrian Chadd
hi,

This patch breaks stuff on my mips24k SoCs (ie, all the atheros chips.)

BAD_PAGE_FAULT: pid 1 tid 11 (init), uid 0: pc 0x4002a4 got a read
fault (type 0x2) at 0
Trapframe Register Dump:
zero: 0at: 0v0: 0v1: 0
a0: 0x7fffeecca1: 0a2: 0a3: 0
t0: 0t1: 0t2: 0t3: 0
t4: 0t5: 0t6: 0t7: 0
t8: 0t9: 0x400260s0: 0x10s1: 0x2
s2: 0x7fffeed0s3: 0s4: 0s5: 0
s6: 0s7: 0k0: 0k1: 0
gp: 0x4d55d0sp: 0x7ffeee90s8: 0ra: 0
sr: 0xfc13mullo: 0mulhi: 0badvaddr: 0
cause: 0x8pc: 0x4002a4
Page table info for pc address 0x4002a4: pde = 0x809a8000, pte = 0xa001b35a
Dumping 4 words starting at pc address 0x4002a4:
8c42 1443 00908021 8f828024
Page table info for bad address 0: pde = 0, pte = 0




-adrian


On 15 September 2016 at 10:25, Brooks Davis  wrote:
> Author: brooks
> Date: Thu Sep 15 17:25:52 2016
> New Revision: 305843
> URL: https://svnweb.freebsd.org/changeset/base/305843
>
> Log:
>   The TLS offset is a property of the process ABI.
>
>   Move to a per-proc TLS offset rather than incorrectly keying off the
>   presense of freebsd32 compability in the kernel.
>
>   Reviewed by:  adrian, sbruno
>   Obtained from:CheriBSD
>   Sponsored by: DARPA, AFRL
>   Differential Revision:https://reviews.freebsd.org/D7843
>
> Modified:
>   head/sys/mips/include/proc.h
>   head/sys/mips/mips/cpu.c
>   head/sys/mips/mips/freebsd32_machdep.c
>   head/sys/mips/mips/genassym.c
>   head/sys/mips/mips/pm_machdep.c
>   head/sys/mips/mips/swtch.S
>   head/sys/mips/mips/sys_machdep.c
>   head/sys/mips/mips/trap.c
>   head/sys/mips/mips/vm_machdep.c
>
> Modified: head/sys/mips/include/proc.h
> ==
> --- head/sys/mips/include/proc.hThu Sep 15 17:25:11 2016
> (r305842)
> +++ head/sys/mips/include/proc.hThu Sep 15 17:25:52 2016
> (r305843)
> @@ -62,6 +62,7 @@ struct mdthread {
> int md_pc_count;/* performance counter */
> int md_pc_spill;/* performance counter spill */
> void*md_tls;
> +   size_t  md_tls_tcb_offset;  /* TCB offset */
>  #ifdef CPU_CNMIPS
> struct octeon_cop2_state*md_cop2; /* kernel context */
> struct octeon_cop2_state*md_ucop2; /* userland context */
>
> Modified: head/sys/mips/mips/cpu.c
> ==
> --- head/sys/mips/mips/cpu.cThu Sep 15 17:25:11 2016(r305842)
> +++ head/sys/mips/mips/cpu.cThu Sep 15 17:25:52 2016(r305843)
> @@ -71,13 +71,12 @@ struct mips_cpuinfo cpuinfo;
>  #   define _LOAD_T0_MDTLS_A1 \
>  _ENCODE_INSN(OP_LD, A1, T0, 0, offsetof(struct thread, td_md.md_tls))
>
> -#   if defined(COMPAT_FREEBSD32)
> -#   define _ADDIU_V0_T0_TLS_OFFSET \
> -_ENCODE_INSN(OP_DADDIU, T0, V0, 0, (TLS_TP_OFFSET + TLS_TCB_SIZE32))
> -#   else
> -#   define _ADDIU_V0_T0_TLS_OFFSET \
> -_ENCODE_INSN(OP_DADDIU, T0, V0, 0, (TLS_TP_OFFSET + TLS_TCB_SIZE))
> -#   endif /* ! COMPAT_FREEBSD32 */
> +#   define _LOAD_T0_MDTLS_TCV_OFFSET_A1 \
> +_ENCODE_INSN(OP_LD, A1, T1, 0, \
> +offsetof(struct thread, td_md.md_tls_tcb_offset))
> +
> +#   define _ADDU_V0_T0_T1 \
> +_ENCODE_INSN(0, T0, T1, V0, OP_DADDU)
>
>  #   define _MTC0_V0_USERLOCAL \
>  _ENCODE_INSN(OP_COP0, OP_DMT, V0, 4, 2)
> @@ -86,8 +85,14 @@ struct mips_cpuinfo cpuinfo;
>
>  #   define _LOAD_T0_MDTLS_A1 \
>  _ENCODE_INSN(OP_LW, A1, T0, 0, offsetof(struct thread, td_md.md_tls))
> -#   define _ADDIU_V0_T0_TLS_OFFSET \
> -_ENCODE_INSN(OP_ADDIU, T0, V0, 0, (TLS_TP_OFFSET + TLS_TCB_SIZE))
> +
> +#   define _LOAD_T0_MDTLS_TCV_OFFSET_A1 \
> +_ENCODE_INSN(OP_LW, A1, T1, 0, \
> +offsetof(struct thread, td_md.md_tls_tcb_offset))
> +
> +#   define _ADDU_V0_T0_T1 \
> +_ENCODE_INSN(0, T0, T1, V0, OP_ADDU)
> +
>  #   define _MTC0_V0_USERLOCAL \
>  _ENCODE_INSN(OP_COP0, OP_MT, V0, 4, 2)
>
> @@ -111,8 +116,9 @@ remove_userlocal_code(uint32_t *cpu_swit
> if (instructp[0] == _JR_RA)
> panic("%s: Unable to patch cpu_switch().", __func__);
> if (instructp[0] == _LOAD_T0_MDTLS_A1 &&
> -   instructp[1] == _ADDIU_V0_T0_TLS_OFFSET &&
> -   instructp[2] == _MTC0_V0_USERLOCAL) {
> +   instructp[1] == _LOAD_T0_MDTLS_TCV_OFFSET_A1 &&
> +   instructp[2] == _ADDU_V0_T0_T1 &&
> +   instructp[3] == _MTC0_V0_USERLOCAL) {
> instructp[0] = _JR_RA;
> instructp[1] = _NOP;
> break;
>
> Modified: head/sys/mips/mips/freebsd32_machdep.c
> ==
> --- head/sys/mips/mips/freebs

Re: svn commit: r308130 - in head: . gnu/lib/libgcc gnu/usr.bin/binutils gnu/usr.bin/binutils/ld gnu/usr.bin/binutils/libbfd gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb lib/libc lib/libc/mip

2016-11-10 Thread Adrian Chadd
The places where we set MIPS_SR_COP_1_BIT in locore.S, exception.S.



-adrian


On 10 November 2016 at 13:34, Ruslan Bukin  wrote:
> Hi, Adrian,
>
> thanks, but I have lack of ideas yet.
>
> I just tested this on Ingenic X1000 (mips.mipsel) and it works fine,
> as well as mips.mipselhf (this hardware has FPU).
>
> I have no hardware without FPU.
>
> What exactly COP_1 bits you have commented to get rid of COP1_UNUSABLE?
>
> Ruslan
>
> On Thu, Nov 10, 2016 at 01:09:20PM -0800, Adrian Chadd wrote:
>> ok, so there are two problems with mips now.
>>
>> * COP1_UNUSABLE - which is now being logged, and we were likely
>> triggering it before. The problem: we always turned it on. If I
>> comment out flipping on the COP1 bits in the .S files, those
>> exceptions go away.
>>
>> * Page faults, but that may be me with an older userland:
>>
>> BAD_PAGE_FAULT: pid 1 tid 11 (init), uid 0: pc 0x404237c0 got a
>> read fault (type 0x2) at 0x8
>> Trapframe Register Dump:
>> zero: 0at: 0xffe0v0: 0x404471b8v1:
>> 0x
>> a0: 0x404471b8a1: 0x7ffeea50a2: 0x16ca3: 0
>> t0: 0t1: 0t2: 0t3: 0x7011
>> t4: 0x11t5: 0x7013t6: 0x3t7: 0
>> t8: 0t9: 0x4041c940s0: 0s1: 0x40417000
>> s2: 0x7fffeee0s3: 0xs4: 0xcs5: 0x40427000
>> s6: 0x7fffeeccs7: 0x7ffeea50k0: 0k1: 0
>> gp: 0x4044e630sp: 0x7ffee838s8: 0x2ra: 0x404224d4
>> sr: 0xfc13mullo: 0mulhi: 0badvaddr: 0x8
>> cause: 0x8pc: 0x404237c0
>> Page table info for pc address 0x404237c0: pde = 0x809aa000, pte = 0xa001ba9a
>> Dumping 4 words starting at pc address 0x404237c0:
>> 8e18 1600fff1 8f828070 10a3
>>
>>
>>
>> -adrian
>>
>>
>> On 10 November 2016 at 12:49, Adrian Chadd  wrote:
>> > hi,
>> >
>> > This fails to boot on actual mips24k hardware, no hardfloat:
>> >
>> > COP1_UNUSABLE: pid 1 tid 11 (init), uid 0: pc 0x404237c0 ra 0x404224d4
>> > Trapframe Register Dump:
>> > zero: 0at: 0xffe0v0: 0x404471b8v1:
>> > 0x
>> >
>> > .. lots of that the moment we boot userland.
>> >
>> >
>> >
>> > -adrian
>> >
>> >
>> > On 3 November 2016 at 13:10, Ruslan Bukin  
>> > wrote:
>> >> On Thu, Nov 03, 2016 at 12:39:48PM -0700, Bryan Drewery wrote:
>> >>> On 10/31/16 8:33 AM, Ruslan Bukin wrote:
>> >>> > Modified: head/share/mk/bsd.cpu.mk
>> >>> > ==
>> >>> > --- head/share/mk/bsd.cpu.mkMon Oct 31 15:11:55 2016
>> >>> > (r308129)
>> >>> > +++ head/share/mk/bsd.cpu.mkMon Oct 31 15:33:58 2016
>> >>> > (r308130)
>> >>> > @@ -303,6 +303,9 @@ MACHINE_CPU = v9 ultrasparc ultrasparc3
>> >>> >
>> >>> >  .if ${MACHINE_CPUARCH} == "mips"
>> >>> >  CFLAGS += -G0
>> >>> > +.if ${TARGET_ARCH:Mmips*hf}
>> >>>
>> >>> TARGET_ARCH is not valid here.  This broke building ports.  Fixed in
>> >>> r308262.
>> >>>
>> >>
>> >> Thank you!
>> >>
>> >> Ruslan
>> >>
___
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: r306224 - head/sys/kern

2016-11-12 Thread Adrian Chadd
This causes the AR9331 / Carambola2 kernel to just plainly not start. :(



-adrian


On 22 September 2016 at 21:45, Mateusz Guzik  wrote:
> Author: mjg
> Date: Fri Sep 23 04:45:11 2016
> New Revision: 306224
> URL: https://svnweb.freebsd.org/changeset/base/306224
>
> Log:
>   cache: get rid of the global lock
>
>   Add a table of vnode locks and use them along with bucketlocks to provide
>   concurrent modification support. The approach taken is to preserve the
>   current behaviour of the namecache and just lock all relevant parts before
>   any changes are made.
>
>   Lookups still require the relevant bucket to be locked.
>
>   Discussed with:   kib
>   Tested by:pho
>
> Modified:
>   head/sys/kern/subr_witness.c
>   head/sys/kern/vfs_cache.c
>
> Modified: head/sys/kern/subr_witness.c
> ==
> --- head/sys/kern/subr_witness.cFri Sep 23 03:21:40 2016
> (r306223)
> +++ head/sys/kern/subr_witness.cFri Sep 23 04:45:11 2016
> (r306224)
> @@ -625,7 +625,7 @@ static struct witness_order_list_entry o
> /*
>  * VFS namecache
>  */
> -   { "ncglobal", &lock_class_rw },
> +   { "ncvn", &lock_class_mtx_sleep },
> { "ncbuc", &lock_class_rw },
> { "vnode interlock", &lock_class_mtx_sleep },
> { "ncneg", &lock_class_mtx_sleep },
>
> Modified: head/sys/kern/vfs_cache.c
> ==
> --- head/sys/kern/vfs_cache.c   Fri Sep 23 03:21:40 2016(r306223)
> +++ head/sys/kern/vfs_cache.c   Fri Sep 23 04:45:11 2016(r306224)
> @@ -151,21 +151,35 @@ structnamecache_ts {
>   * name is located in the cache, it will be dropped.
>   *
>   * These locks are used (in the order in which they can be taken):
> - * NAME TYPEROLE
> - * cache_lock   rwlock  global, needed for all modifications
> - * bucketlock   rwlock  for access to given hash bucket
> - * ncneg_mtxmtx negative entry LRU management
> + * NAMETYPEROLE
> + * vnodelock   mtx vnode lists and v_cache_dd field protection
> + * bucketlock  rwlock  for access to given set of hash buckets
> + * ncneg_mtx   mtx negative entry LRU management
>   *
> - * A name -> vnode lookup can be safely performed by either locking 
> cache_lock
> - * or the relevant hash bucket.
> + * Additionally, ncneg_shrink_lock mtx is used to have at most one thread
> + * shrinking the LRU list.
>   *
> - * ".." and vnode -> name lookups require cache_lock.
> + * It is legal to take multiple vnodelock and bucketlock locks. The locking
> + * order is lower address first. Both are recursive.
>   *
> - * Modifications require both cache_lock and relevant bucketlock taken for
> - * writing.
> + * "." lookups are lockless.
>   *
> - * Negative entry LRU management requires ncneg_mtx taken on top of either
> - * cache_lock or bucketlock.
> + * ".." and vnode -> name lookups require vnodelock.
> + *
> + * name -> vnode lookup requires the relevant bucketlock to be held for 
> reading.
> + *
> + * Insertions and removals of entries require involved vnodes and bucketlocks
> + * to be write-locked to prevent other threads from seeing the entry.
> + *
> + * Some lookups result in removal of the found entry (e.g. getting rid of a
> + * negative entry with the intent to create a positive one), which poses a
> + * problem when multiple threads reach the state. Similarly, two different
> + * threads can purge two different vnodes and try to remove the same name.
> + *
> + * If the already held vnode lock is lower than the second required lock, we
> + * can just take the other lock. However, in the opposite case, this could
> + * deadlock. As such, this is resolved by trylocking and if that fails 
> unlocking
> + * the first node, locking everything in order and revalidating the state.
>   */
>
>  /*
> @@ -196,15 +210,9 @@ SYSCTL_UINT(_vfs, OID_AUTO, ncsizefactor
>
>  struct nchstatsnchstats;   /* cache effectiveness 
> statistics */
>
> -static struct rwlock cache_lock;
> -RW_SYSINIT(vfscache, &cache_lock, "ncglobal");
> -
> -#defineCACHE_TRY_WLOCK()   rw_try_wlock(&cache_lock)
> -#defineCACHE_UPGRADE_LOCK()rw_try_upgrade(&cache_lock)
> -#defineCACHE_RLOCK()   rw_rlock(&cache_lock)
> -#defineCACHE_RUNLOCK() rw_runlock(&cache_lock)
> -#defineCACHE_WLOCK()   rw_wlock(&cache_lock)
> -#defineCACHE_WUNLOCK() rw_wunlock(&cache_lock)
> +static struct mtx   ncneg_shrink_lock;
> +MTX_SYSINIT(vfscache_shrink_neg, &ncneg_shrink_lock, "Name Cache shrink neg",
> +MTX_DEF);
>
>  static struct mtx_padalign ncneg_mtx;
>  MTX_SYSINIT(vfscache_neg, &ncneg_mtx, "ncneg", MTX_DEF);
> @@ -214,6 +222,19 @@ static struct rwlock_padalign  *bucketlo
>  #defineHASH2BUCKETLOCK(hash) \
> ((struct rwlock *)(&bucketl

Re: svn commit: r307626 - head/sys/ufs/ffs

2016-11-12 Thread Adrian Chadd
hi!

This broke freebsd on mips24k.

BAD_PAGE_FAULT: pid 1 tid 11 (init), uid 0: pc 0x4002a4 got a read
fault (type 0x2) at 0
Trapframe Register Dump:
zero: 0at: 0v0: 0v1: 0
a0: 0x7fffeecca1: 0a2: 0a3: 0
t0: 0t1: 0t2: 0t3: 0
t4: 0t5: 0t6: 0t7: 0
t8: 0t9: 0x400260s0: 0x10s1: 0x2
s2: 0x7fffeed0s3: 0s4: 0s5: 0
s6: 0s7: 0k0: 0k1: 0
gp: 0x4d55d0sp: 0x7ffeee90s8: 0ra: 0
sr: 0xfc13mullo: 0mulhi: 0badvaddr: 0
cause: 0x8pc: 0x4002a4
Page table info for pc address 0x4002a4: pde = 0x809be000, pte = 0xa001acda
Dumping 4 words starting at pc address 0x4002a4:
8c42 1443 00908021 8f828024
Page table info for bad address 0: pde = 0, pte = 0

.. and yes, I've spent three days bisecting everything to get to this
particular commit.




-adrian


On 19 October 2016 at 04:09, Konstantin Belousov  wrote:
> Author: kib
> Date: Wed Oct 19 11:09:29 2016
> New Revision: 307626
> URL: https://svnweb.freebsd.org/changeset/base/307626
>
> Log:
>   Add FFS pager, which uses buffer cache read operation to validate pages.
>   See the comments for more detailed description of the algorithm.
>
>   The pager is used unconditionally when the block size of the
>   underlying device is larger than the machine page size, since local
>   vnode pager cannot handle the configuration [1].  Otherwise, the
>   vfs.ffs.use_buf_pager sysctl allows to switch to the local pager.
>
>   Measurements demonstrated no regression in the ever-important
>   buildworld benchmark, and small (~5%) throughput improvements in the
>   special microbenchmark configuration for dbench over swap-backed
>   md(4).
>
>   Code can be generalized and reused for other filesystems which use
>   buffer cache.
>
>   Reported by:  Anton Yuzhaninov  [1]
>   Tested by:pho
>   Benchmarked by:   mjg, pho
>   Reviewed by:  alc, markj, mckusick (previous version)
>   Sponsored by: The FreeBSD Foundation
>   MFC after:2 weeks
>   Differential revision:https://reviews.freebsd.org/D8198
>
> Modified:
>   head/sys/ufs/ffs/ffs_vnops.c
>
> Modified: head/sys/ufs/ffs/ffs_vnops.c
> ==
> --- head/sys/ufs/ffs/ffs_vnops.cWed Oct 19 10:01:04 2016
> (r307625)
> +++ head/sys/ufs/ffs/ffs_vnops.cWed Oct 19 11:09:29 2016
> (r307626)
> @@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$");
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>
> @@ -86,6 +87,7 @@ __FBSDID("$FreeBSD$");
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>
>  #include 
> @@ -102,8 +104,9 @@ __FBSDID("$FreeBSD$");
>  #ifdef DIRECTIO
>  extern int ffs_rawread(struct vnode *vp, struct uio *uio, int *workdone);
>  #endif
> -static vop_fsync_t ffs_fsync;
>  static vop_fdatasync_t ffs_fdatasync;
> +static vop_fsync_t ffs_fsync;
> +static vop_getpages_t  ffs_getpages;
>  static vop_lock1_t ffs_lock;
>  static vop_read_t  ffs_read;
>  static vop_write_t ffs_write;
> @@ -119,13 +122,12 @@ static vop_openextattr_t  ffs_openextattr
>  static vop_setextattr_tffs_setextattr;
>  static vop_vptofh_tffs_vptofh;
>
> -
>  /* Global vfs data structures for ufs. */
>  struct vop_vector ffs_vnodeops1 = {
> .vop_default =  &ufs_vnodeops,
> .vop_fsync =ffs_fsync,
> .vop_fdatasync =ffs_fdatasync,
> -   .vop_getpages = vnode_pager_local_getpages,
> +   .vop_getpages = ffs_getpages,
> .vop_getpages_async =   vnode_pager_local_getpages_async,
> .vop_lock1 =ffs_lock,
> .vop_read = ffs_read,
> @@ -147,7 +149,7 @@ struct vop_vector ffs_vnodeops2 = {
> .vop_default =  &ufs_vnodeops,
> .vop_fsync =ffs_fsync,
> .vop_fdatasync =ffs_fdatasync,
> -   .vop_getpages = vnode_pager_local_getpages,
> +   .vop_getpages = ffs_getpages,
> .vop_getpages_async =   vnode_pager_local_getpages_async,
> .vop_lock1 =ffs_lock,
> .vop_read = ffs_read,
> @@ -1784,3 +1786,165 @@ vop_vptofh {
> ufhp->ufid_gen = ip->i_gen;
> return (0);
>  }
> +
> +SYSCTL_DECL(_vfs_ffs);
> +static int use_buf_pager = 1;
> +SYSCTL_INT(_vfs_ffs, OID_AUTO, use_buf_pager, CTLFLAG_RWTUN, &use_buf_pager, 
> 0,
> +"Always use buffer pager instead of bmap");
> +static int buf_pager_relbuf;
> +SYSCTL_INT(_vfs_ffs, OID_AUTO, buf_pager_relbuf, CTLFLAG_RWTUN,
> +&buf_pager_relbuf, 0,
> +"Make buffer pager release buffers after reading");
> +
> +/*
> + * The FFS pager.  It uses buffer reads to validate pages.
> + *
> + * In contrast to the generic local pager from vm/vnode_pager.c, this
> + * pager correctly and easily handles volumes where the underlying
> + * device block size is greater t

Re: svn commit: r308493 - in head: contrib/amd contrib/amd/amd contrib/amd/amq contrib/amd/conf/checkmount contrib/amd/conf/mtab contrib/amd/conf/nfs_prot contrib/amd/conf/transp contrib/amd/conf/umou

2016-11-12 Thread Adrian Chadd
Fails to build on -mips:

/usr/home/adrian/work/freebsd/head-embedded/src/contrib/amd/amd/readdir.c:
In function 'amfs_generic_readdir':
/usr/home/adrian/work/freebsd/head-embedded/src/contrib/amd/amd/readdir.c:947:42:
error: cast from pointer to integer of different size
[-Werror=pointer-to-int-cast]
   return amfs_readdir3_browsable(mp, (am_cookie3) cookie, dp, ep,
count, full);
  ^



-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: r308493 - in head: contrib/amd contrib/amd/amd contrib/amd/amq contrib/amd/conf/checkmount contrib/amd/conf/mtab contrib/amd/conf/nfs_prot contrib/amd/conf/transp contrib/amd/conf/umou

2016-11-12 Thread Adrian Chadd
After looking at this, i'm not sure how this is supposed to work on a
32 bit platform at all.

Is there some vendor patch to fix compilation on 32 bit platforms? If
not, can we back this out until we get it compiling on 32 bit
platforms?

Thanks,


-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: r307626 - head/sys/ufs/ffs

2016-11-12 Thread Adrian Chadd
That disappeared from the file in a later commit?



-a


On 12 November 2016 at 22:58, Konstantin Belousov  wrote:
> On Sat, Nov 12, 2016 at 03:19:13PM -0800, Adrian Chadd wrote:
>> hi!
>>
>> This broke freebsd on mips24k.
>>
>> BAD_PAGE_FAULT: pid 1 tid 11 (init), uid 0: pc 0x4002a4 got a read
>> fault (type 0x2) at 0
>> Trapframe Register Dump:
>> zero: 0at: 0v0: 0v1: 0
>> a0: 0x7fffeecca1: 0a2: 0a3: 0
>> t0: 0t1: 0t2: 0t3: 0
>> t4: 0t5: 0t6: 0t7: 0
>> t8: 0t9: 0x400260s0: 0x10s1: 0x2
>> s2: 0x7fffeed0s3: 0s4: 0s5: 0
>> s6: 0s7: 0k0: 0k1: 0
>> gp: 0x4d55d0sp: 0x7ffeee90s8: 0ra: 0
>> sr: 0xfc13mullo: 0mulhi: 0badvaddr: 0
>> cause: 0x8pc: 0x4002a4
>> Page table info for pc address 0x4002a4: pde = 0x809be000, pte = 0xa001acda
>> Dumping 4 words starting at pc address 0x4002a4:
>> 8c42 1443 00908021 8f828024
>> Page table info for bad address 0: pde = 0, pte = 0
> MIPS24k has split I/D caches, and both are VIPT, am I right ?
> I was not able to find the handling of cache aliasing in mips/pmap.c.
>
> Still, I am curious whether setting the loader tunable vfs.buf_pager_relbuf
> to 1 change anything.
>
>>
>> .. and yes, I've spent three days bisecting everything to get to this
>> particular commit.
___
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: r307626 - head/sys/ufs/ffs

2016-11-12 Thread Adrian Chadd
On 12 November 2016 at 23:12, Warner Losh  wrote:
> On Sat, Nov 12, 2016 at 11:58 PM, Konstantin Belousov
>  wrote:
>> On Sat, Nov 12, 2016 at 03:19:13PM -0800, Adrian Chadd wrote:
>>> hi!
>>>
>>> This broke freebsd on mips24k.
>>>
>>> BAD_PAGE_FAULT: pid 1 tid 11 (init), uid 0: pc 0x4002a4 got a read
>>> fault (type 0x2) at 0
>>> Trapframe Register Dump:
>>> zero: 0at: 0v0: 0v1: 0
>>> a0: 0x7fffeecca1: 0a2: 0a3: 0
>>> t0: 0t1: 0t2: 0t3: 0
>>> t4: 0t5: 0t6: 0t7: 0
>>> t8: 0t9: 0x400260s0: 0x10s1: 0x2
>>> s2: 0x7fffeed0s3: 0s4: 0s5: 0
>>> s6: 0s7: 0k0: 0k1: 0
>>> gp: 0x4d55d0sp: 0x7ffeee90s8: 0ra: 0
>>> sr: 0xfc13mullo: 0mulhi: 0badvaddr: 0
>>> cause: 0x8pc: 0x4002a4
>>> Page table info for pc address 0x4002a4: pde = 0x809be000, pte = 0xa001acda
>>> Dumping 4 words starting at pc address 0x4002a4:
>>> 8c42 1443 00908021 8f828024
>>> Page table info for bad address 0: pde = 0, pte = 0
>> MIPS24k has split I/D caches, and both are VIPT, am I right ?
>> I was not able to find the handling of cache aliasing in mips/pmap.c.
>>
>> Still, I am curious whether setting the loader tunable vfs.buf_pager_relbuf
>> to 1 change anything.
>
> MIPS caches are such that creating two virtual mappings to the same
> physical page will cause corruption. It's simply not allowed, at least
> for the class of MIPS machines I used to bring up the port originally.

Hi,

Right - the bulk of MIPS hardware (including 24k/74k) are VIPT, and
we're not allowed to do cache aliasing in that manner.



-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: r307626 - head/sys/ufs/ffs

2016-11-12 Thread Adrian Chadd
On 12 November 2016 at 23:16, Konstantin Belousov  wrote:
> On Sat, Nov 12, 2016 at 11:10:43PM -0800, Adrian Chadd wrote:
>> That disappeared from the file in a later commit?
> From which commit did it disappeared ?
>
> The tunable is present since sys/kern/vfs_bio.c r308026.  I did not removed
> it, and did not see any commit removing the code by somebody else.

I'll go look tomorrow. I could've sworn I only saw one sysctl in there
in -head when i did my last bisect (up to head.)

If it's there I'll go try it out.


-adrian

>
>>
>>
>>
>> -a
>>
>>
>> On 12 November 2016 at 22:58, Konstantin Belousov  
>> wrote:
>> > On Sat, Nov 12, 2016 at 03:19:13PM -0800, Adrian Chadd wrote:
>> >> hi!
>> >>
>> >> This broke freebsd on mips24k.
>> >>
>> >> BAD_PAGE_FAULT: pid 1 tid 11 (init), uid 0: pc 0x4002a4 got a read
>> >> fault (type 0x2) at 0
>> >> Trapframe Register Dump:
>> >> zero: 0at: 0v0: 0v1: 0
>> >> a0: 0x7fffeecca1: 0a2: 0a3: 0
>> >> t0: 0t1: 0t2: 0t3: 0
>> >> t4: 0t5: 0t6: 0t7: 0
>> >> t8: 0t9: 0x400260s0: 0x10s1: 0x2
>> >> s2: 0x7fffeed0s3: 0s4: 0s5: 0
>> >> s6: 0s7: 0k0: 0k1: 0
>> >> gp: 0x4d55d0sp: 0x7ffeee90s8: 0ra: 0
>> >> sr: 0xfc13mullo: 0mulhi: 0badvaddr: 0
>> >> cause: 0x8pc: 0x4002a4
>> >> Page table info for pc address 0x4002a4: pde = 0x809be000, pte = 
>> >> 0xa001acda
>> >> Dumping 4 words starting at pc address 0x4002a4:
>> >> 8c42 1443 00908021 8f828024
>> >> Page table info for bad address 0: pde = 0, pte = 0
>> > MIPS24k has split I/D caches, and both are VIPT, am I right ?
>> > I was not able to find the handling of cache aliasing in mips/pmap.c.
>> >
>> > Still, I am curious whether setting the loader tunable vfs.buf_pager_relbuf
>> > to 1 change anything.
>> >
>> >>
>> >> .. and yes, I've spent three days bisecting everything to get to this
>> >> particular commit.
___
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: r308661 - in head/sys: conf kern

2016-11-14 Thread Adrian Chadd
Author: adrian
Date: Tue Nov 15 01:34:38 2016
New Revision: 308661
URL: https://svnweb.freebsd.org/changeset/base/308661

Log:
  [mips] make UMTX_CHAINS configurable at compile time.
  
  The default (512) wastes quite a bit of space which doesn't really buy
  us much on highly embedded systems which don't take a lot of locks in
  parallel.
  
  This makes it at least build time configurable so people can experiment.

Modified:
  head/sys/conf/options
  head/sys/kern/kern_umtx.c

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Tue Nov 15 01:20:36 2016(r308660)
+++ head/sys/conf/options   Tue Nov 15 01:34:38 2016(r308661)
@@ -220,6 +220,7 @@ SYSVSHM opt_sysvipc.h
 SW_WATCHDOGopt_watchdog.h
 TURNSTILE_PROFILING
 UMTX_PROFILING
+UMTX_CHAINSopt_global.h
 VERBOSE_SYSINIT
 
 # POSIX kernel options
@@ -996,3 +997,4 @@ GPIO_SPI_DEBUG  opt_gpio.h
 EVDEV_SUPPORT  opt_evdev.h
 EVDEV_DEBUGopt_evdev.h
 UINPUT_DEBUG   opt_evdev.h
+

Modified: head/sys/kern/kern_umtx.c
==
--- head/sys/kern/kern_umtx.c   Tue Nov 15 01:20:36 2016(r308660)
+++ head/sys/kern/kern_umtx.c   Tue Nov 15 01:34:38 2016(r308661)
@@ -198,7 +198,9 @@ struct umtxq_chain {
 PRI_MAX_TIMESHARE : (td)->td_user_pri)
 
 #defineGOLDEN_RATIO_PRIME  2654404609U
+#ifndefUMTX_CHAINS
 #defineUMTX_CHAINS 512
+#endif
 #defineUMTX_SHIFTS (__WORD_BIT - 9)
 
 #defineGET_SHARE(flags)\
___
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: r308662 - head/sys/kern

2016-11-14 Thread Adrian Chadd
Author: adrian
Date: Tue Nov 15 01:41:45 2016
New Revision: 308662
URL: https://svnweb.freebsd.org/changeset/base/308662

Log:
  [mips] enable relbuf on mips for now to work around page aliasing in mips 
hardware.
  
  Although the higher end MIPS hardware handles cache aliasing issues in
  hardware, the older cores (r4k, etc) and some compile versions of the
  newer cores (mips24k, mips34k, mips74k) don't have this feature.
  This means we end up with some very unfortunate behaviour that was
  made very obvious by some recent changes to the FFS pager by kib.
  
  So, flip this off until we get our MIPS pmap/cache code upgraded to
  handle aliased pages in software.
  
  Discussed with: kib, bsdimp, juli

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Tue Nov 15 01:34:38 2016(r308661)
+++ head/sys/kern/vfs_bio.c Tue Nov 15 01:41:45 2016(r308662)
@@ -4655,7 +4655,24 @@ bdata2bio(struct buf *bp, struct bio *bi
}
 }
 
-static int buf_pager_relbuf;
+/*
+ * The MIPS pmap code currently doesn't handle aliased pages.
+ * The VIPT caches may not handle page aliasing themselves, leading
+ * to data corruption.
+ *
+ * As such, this code makes a system extremely unhappy if said
+ * system doesn't support unaliasing the above situation in hardware.
+ * Some "recent" systems (eg some mips24k/mips74k cores) don't enable
+ * this feature at build time, so it has to be handled in software.
+ *
+ * Once the MIPS pmap/cache code grows to support this function on
+ * earlier chips, it should be flipped back off.
+ */
+#ifdef __mips__
+static int buf_pager_relbuf = 1;
+#else
+static int buf_pager_relbuf = 0;
+#endif
 SYSCTL_INT(_vfs, OID_AUTO, buf_pager_relbuf, CTLFLAG_RWTUN,
 &buf_pager_relbuf, 0,
 "Make buffer pager release buffers after reading");
___
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: r308663 - head/sys/net80211

2016-11-14 Thread Adrian Chadd
Author: adrian
Date: Tue Nov 15 01:47:37 2016
New Revision: 308663
URL: https://svnweb.freebsd.org/changeset/base/308663

Log:
  [net80211] announce 11n capabilities in probe requests in IBSS mode.
  
  The 802.11-2012 specification notes that a subset of IEs should be present
  in IBSS probe requests.  This is what (initially) allows nodes to discover
  that other nodes are 11n capable.  Notably - HTCAP, but not HTINFO.
  
  This isn't everything required to reliably enable 11n between net80211
  peers; there's more work to come.
  
  Tested:
  
  * AR9380, IBSS+11n mode

Modified:
  head/sys/net80211/ieee80211_output.c

Modified: head/sys/net80211/ieee80211_output.c
==
--- head/sys/net80211/ieee80211_output.cTue Nov 15 01:41:45 2016
(r308662)
+++ head/sys/net80211/ieee80211_output.cTue Nov 15 01:47:37 2016
(r308663)
@@ -2074,6 +2074,7 @@ ieee80211_send_probereq(struct ieee80211
 {
struct ieee80211vap *vap = ni->ni_vap;
struct ieee80211com *ic = ni->ni_ic;
+   struct ieee80211_node *bss;
const struct ieee80211_txparam *tp;
struct ieee80211_bpf_params params;
const struct ieee80211_rateset *rs;
@@ -2081,10 +2082,13 @@ ieee80211_send_probereq(struct ieee80211
uint8_t *frm;
int ret;
 
+   bss = ieee80211_ref_node(vap->iv_bss);
+
if (vap->iv_state == IEEE80211_S_CAC) {
IEEE80211_NOTE(vap, IEEE80211_MSG_OUTPUT, ni,
"block %s frame in CAC state", "probe request");
vap->iv_stats.is_tx_badstate++;
+   ieee80211_free_node(bss);
return EIO; /* XXX */
}
 
@@ -2106,6 +2110,7 @@ ieee80211_send_probereq(struct ieee80211
 *  [tlv] supported rates
 *  [tlv] RSN (optional)
 *  [tlv] extended supported rates
+*  [tlv] HT cap (optional)
 *  [tlv] WPA (optional)
 *  [tlv] user-specified ie's
 */
@@ -2113,6 +2118,8 @@ ieee80211_send_probereq(struct ieee80211
 ic->ic_headroom + sizeof(struct ieee80211_frame),
 2 + IEEE80211_NWID_LEN
   + 2 + IEEE80211_RATE_SIZE
+  + sizeof(struct ieee80211_ie_htcap)
+  + sizeof(struct ieee80211_ie_htinfo)
   + sizeof(struct ieee80211_ie_wpa)
   + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE)
   + sizeof(struct ieee80211_ie_wpa)
@@ -2122,6 +2129,7 @@ ieee80211_send_probereq(struct ieee80211
if (m == NULL) {
vap->iv_stats.is_tx_nobuf++;
ieee80211_free_node(ni);
+   ieee80211_free_node(bss);
return ENOMEM;
}
 
@@ -2130,6 +2138,27 @@ ieee80211_send_probereq(struct ieee80211
frm = ieee80211_add_rates(frm, rs);
frm = ieee80211_add_rsn(frm, vap);
frm = ieee80211_add_xrates(frm, rs);
+
+   /*
+* Note: we can't use bss; we don't have one yet.
+*
+* So, we should announce our capabilities
+* in this channel mode (2g/5g), not the
+* channel details itself.
+*/
+   if ((vap->iv_opmode == IEEE80211_M_IBSS) &&
+   (vap->iv_flags_ht & IEEE80211_FHT_HT)) {
+   struct ieee80211_channel *c;
+
+   /*
+* Get the HT channel that we should try upgrading to.
+* If we can do 40MHz then this'll upgrade it appropriately.
+*/
+   c = ieee80211_ht_adjust_channel(ic, ic->ic_curchan,
+   vap->iv_flags_ht);
+   frm = ieee80211_add_htcap_ch(frm, vap, c);
+   }
+
frm = ieee80211_add_wpa(frm, vap);
if (vap->iv_appie_probereq != NULL)
frm = add_appie(frm, vap->iv_appie_probereq);
@@ -2141,6 +2170,7 @@ ieee80211_send_probereq(struct ieee80211
if (m == NULL) {
/* NB: cannot happen */
ieee80211_free_node(ni);
+   ieee80211_free_node(bss);
return ENOMEM;
}
 
@@ -2157,8 +2187,11 @@ ieee80211_send_probereq(struct ieee80211
IEEE80211_NODE_STAT(ni, tx_mgmt);
 
IEEE80211_DPRINTF(vap, IEEE80211_MSG_DEBUG | IEEE80211_MSG_DUMPPKTS,
-   "send probe req on channel %u bssid %s ssid \"%.*s\"\n",
-   ieee80211_chan2ieee(ic, ic->ic_curchan), ether_sprintf(bssid),
+   "send probe req on channel %u bssid %s sa %6D da %6D ssid 
\"%.*s\"\n",
+   ieee80211_chan2ieee(ic, ic->ic_curchan),
+   ether_sprintf(bssid),
+   sa, ":",
+   da, ":",
ssidlen, ssid);
 
memset(¶ms, 0, sizeof(params));
@@ -2173,6 +2206,7 @@ ieee80211_send_probereq(struct ieee80211
params.ibp_power = ni->ni_txpower;
ret = ieee80211_raw_output(vap, ni, m, ¶ms);
IEEE80211_TX_UNLOCK(ic);
+   ieee80211_free_node(bss);
ret

Re: svn commit: r308746 - in head/sys/gnu/dts: include/dt-bindings/dma include/dt-bindings/net mips/ingenic

2016-11-17 Thread Adrian Chadd
heh, as someone with the ye older board / boot loader, I'll see about
adding a comment somewhere that the console is .. not what dts says.
:)


-a
___
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: r308811 - head/sys/net80211

2016-11-18 Thread Adrian Chadd
Author: adrian
Date: Fri Nov 18 21:12:13 2016
New Revision: 308811
URL: https://svnweb.freebsd.org/changeset/base/308811

Log:
  [net80211] shuffle IEEE80211_C and HTC bits over to _ieee80211.h so userland 
can use this.
  
  Reviewed by:  avos
  Differential Revision:https://reviews.freebsd.org/D8553

Modified:
  head/sys/net80211/_ieee80211.h
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/net80211/_ieee80211.h
==
--- head/sys/net80211/_ieee80211.h  Fri Nov 18 21:09:57 2016
(r308810)
+++ head/sys/net80211/_ieee80211.h  Fri Nov 18 21:12:13 2016
(r308811)
@@ -402,4 +402,71 @@ struct ieee80211_mimo_info {
uint8_t pad[2];
uint32_tevm[3]; /* EVM data */
 };
+
+/*
+ * ic_caps/iv_caps: device driver capabilities
+ */
+/* 0x2e available */
+#defineIEEE80211_C_STA 0x0001  /* CAPABILITY: STA 
available */
+#defineIEEE80211_C_8023ENCAP   0x0002  /* CAPABILITY: 802.3 
encap */
+#defineIEEE80211_C_FF  0x0040  /* CAPABILITY: ATH FF 
avail */
+#defineIEEE80211_C_TURBOP  0x0080  /* CAPABILITY: ATH 
Turbo avail*/
+#defineIEEE80211_C_IBSS0x0100  /* CAPABILITY: IBSS 
available */
+#defineIEEE80211_C_PMGT0x0200  /* CAPABILITY: Power 
mgmt */
+#defineIEEE80211_C_HOSTAP  0x0400  /* CAPABILITY: HOSTAP 
avail */
+#defineIEEE80211_C_AHDEMO  0x0800  /* CAPABILITY: Old 
Adhoc Demo */
+#defineIEEE80211_C_SWRETRY 0x1000  /* CAPABILITY: sw tx 
retry */
+#defineIEEE80211_C_TXPMGT  0x2000  /* CAPABILITY: tx power 
mgmt */
+#defineIEEE80211_C_SHSLOT  0x4000  /* CAPABILITY: short 
slottime */
+#defineIEEE80211_C_SHPREAMBLE  0x8000  /* CAPABILITY: short 
preamble */
+#defineIEEE80211_C_MONITOR 0x0001  /* CAPABILITY: monitor 
mode */
+#defineIEEE80211_C_DFS 0x0002  /* CAPABILITY: 
DFS/radar avail*/
+#defineIEEE80211_C_MBSS0x0004  /* CAPABILITY: MBSS 
available */
+#defineIEEE80211_C_SWSLEEP 0x0008  /* CAPABILITY: do sleep 
here */
+#defineIEEE80211_C_SWAMSDUTX   0x0010  /* CAPABILITY: software 
A-MSDU TX */
+/* 0x7c available */
+#defineIEEE80211_C_WPA10x0080  /* CAPABILITY: WPA1 
avail */
+#defineIEEE80211_C_WPA20x0100  /* CAPABILITY: WPA2 
avail */
+#defineIEEE80211_C_WPA 0x0180  /* CAPABILITY: 
WPA1+WPA2 avail*/
+#defineIEEE80211_C_BURST   0x0200  /* CAPABILITY: frame 
bursting */
+#defineIEEE80211_C_WME 0x0400  /* CAPABILITY: WME 
avail */
+#defineIEEE80211_C_WDS 0x0800  /* CAPABILITY: 4-addr 
support */
+/* 0x1000 reserved */
+#defineIEEE80211_C_BGSCAN  0x2000  /* CAPABILITY: bg 
scanning */
+#defineIEEE80211_C_TXFRAG  0x4000  /* CAPABILITY: tx 
fragments */
+#defineIEEE80211_C_TDMA0x8000  /* CAPABILITY: TDMA 
avail */
+/* XXX protection/barker? */
+
+#defineIEEE80211_C_OPMODE \
+   (IEEE80211_C_STA | IEEE80211_C_IBSS | IEEE80211_C_HOSTAP | \
+IEEE80211_C_AHDEMO | IEEE80211_C_MONITOR | IEEE80211_C_WDS | \
+IEEE80211_C_TDMA | IEEE80211_C_MBSS)
+
+#defineIEEE80211_C_BITS \
+   "\20\1STA\002803ENCAP\7FF\10TURBOP\11IBSS\12PMGT" \
+   "\13HOSTAP\14AHDEMO\15SWRETRY\16TXPMGT\17SHSLOT\20SHPREAMBLE" \
+   "\21MONITOR\22DFS\23MBSS\30WPA1\31WPA2\32BURST\33WME\34WDS\36BGSCAN" \
+   "\37TXFRAG\40TDMA"
+
+/*
+ * ic_htcaps/iv_htcaps: HT-specific device/driver capabilities
+ *
+ * NB: the low 16-bits are the 802.11 definitions, the upper
+ * 16-bits are used to define s/w/driver capabilities.
+ */
+#defineIEEE80211_HTC_AMPDU 0x0001  /* CAPABILITY: A-MPDU 
tx */
+#defineIEEE80211_HTC_AMSDU 0x0002  /* CAPABILITY: A-MSDU 
tx */
+/* NB: HT40 is implied by IEEE80211_HTCAP_CHWIDTH40 */
+#defineIEEE80211_HTC_HT0x0004  /* CAPABILITY: HT 
operation */
+#defineIEEE80211_HTC_SMPS  0x0008  /* CAPABILITY: MIMO 
power save*/
+#defineIEEE80211_HTC_RIFS  0x0010  /* CAPABILITY: RIFS 
support */
+#defineIEEE80211_HTC_RXUNEQUAL 0x0020  /* CAPABILITY: RX 
unequal MCS */
+#defineIEEE80211_HTC_RXMCS32   0x0040  /* CAPABILITY: MCS32 
support */
+#defineIEEE80211_HTC_TXUNEQUAL 0x0080  /* CAPABILITY: TX 
unequal MCS */
+#defineIEEE80211_HTC_TXMCS32   0x0100  /* CAPABILITY: MCS32 
support */
+
+#defineIEEE80211_C_HTCAP_BITS \
+   "\20\1LDPC\2CHWIDTH40\5GREENFIELD\6SHORTGI20\7SHORTGI40\10TXSTBC" \
+   "\21AMPDU\22AMSDU\23HT\24SMPS\25RI

svn commit: r308812 - head/sbin/ifconfig

2016-11-18 Thread Adrian Chadd
Author: adrian
Date: Fri Nov 18 21:12:36 2016
New Revision: 308812
URL: https://svnweb.freebsd.org/changeset/base/308812

Log:
  [ifconfig] remove now duplicate IEEE80211_C_BITS definition; it's now in 
_ieee80211.h .
  
  Reviewed by:  avos
  Differential Revision:https://reviews.freebsd.org/D8553

Modified:
  head/sbin/ifconfig/ifieee80211.c

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cFri Nov 18 21:12:13 2016
(r308811)
+++ head/sbin/ifconfig/ifieee80211.cFri Nov 18 21:12:36 2016
(r308812)
@@ -3785,12 +3785,6 @@ list_keys(int s)
 {
 }
 
-#defineIEEE80211_C_BITS \
-   "\20\1STA\002803ENCAP\7FF\10TURBOP\11IBSS\12PMGT" \
-   "\13HOSTAP\14AHDEMO\15SWRETRY\16TXPMGT\17SHSLOT\20SHPREAMBLE" \
-   "\21MONITOR\22DFS\23MBSS\30WPA1\31WPA2\32BURST\33WME\34WDS\36BGSCAN" \
-   "\37TXFRAG\40TDMA"
-
 static void
 list_capabilities(int s)
 {
___
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: r308810 - head/bin/dd

2016-11-18 Thread Adrian Chadd
fwiw, this breaks -head compilation.



-a


On 18 November 2016 at 13:09, Bartek Rutkowski  wrote:
> Author: robak (ports committer)
> Date: Fri Nov 18 21:09:57 2016
> New Revision: 308810
> URL: https://svnweb.freebsd.org/changeset/base/308810
>
> Log:
>   Capsicum support for dd(1)
>
>   Adds Capsicum sandboxing to dd utility.
>
>   Submitted by: Pawel Biernacki 
>   Reviewed by:  allanjude, emaste, oshogbo
>   Approved by:  oshogbo
>   Sponsored by: Mysterious Code Ltd.
>   Differential Revision:https://reviews.freebsd.org/D8543
>
> Modified:
>   head/bin/dd/dd.c
>
> Modified: head/bin/dd/dd.c
> ==
> --- head/bin/dd/dd.cFri Nov 18 17:18:05 2016(r308809)
> +++ head/bin/dd/dd.cFri Nov 18 21:09:57 2016(r308810)
> @@ -48,10 +48,13 @@ __FBSDID("$FreeBSD$");
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
> +#include 
>
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -92,6 +95,10 @@ main(int argc __unused, char *argv[])
> jcl(argv);
> setup();
>
> +   caph_cache_catpages();
> +   if (cap_enter() == -1 && errno != ENOSYS)
> +   err(1, "unable to enter capability mode");
> +
> (void)signal(SIGINFO, siginfo_handler);
> (void)signal(SIGINT, terminate);
>
> @@ -125,6 +132,8 @@ static void
>  setup(void)
>  {
> u_int cnt;
> +   cap_rights_t rights;
> +   unsigned long cmds[] = { FIODTYPE, MTIOCTOP };
>
> if (in.name == NULL) {
> in.name = "stdin";
> @@ -133,13 +142,20 @@ setup(void)
> in.fd = open(in.name, O_RDONLY, 0);
> if (in.fd == -1)
> err(1, "%s", in.name);
> +   if (caph_limit_stdin() == -1)
> +   err(1, "unable to limit capability rights");
> }
>
> getfdtype(&in);
>
> +   cap_rights_init(&rights, CAP_READ, CAP_SEEK);
> +   if (cap_rights_limit(in.fd, &rights) == -1 && errno != ENOSYS)
> +   err(1, "unable to limit capability rights");
> +
> if (files_cnt > 1 && !(in.flags & ISTAPE))
> errx(1, "files is not supported for non-tape devices");
>
> +   cap_rights_set(&rights, CAP_WRITE, CAP_FTRUNCATE, CAP_IOCTL);
> if (out.name == NULL) {
> /* No way to check for read access here. */
> out.fd = STDOUT_FILENO;
> @@ -156,13 +172,27 @@ setup(void)
> if (out.fd == -1) {
> out.fd = open(out.name, O_WRONLY | OFLAGS, 
> DEFFILEMODE);
> out.flags |= NOREAD;
> +   cap_rights_clear(&rights, CAP_READ);
> }
> if (out.fd == -1)
> err(1, "%s", out.name);
> +   if (caph_limit_stdout() == -1)
> +   err(1, "unable to limit capability rights");
> }
>
> getfdtype(&out);
>
> +   if (cap_rights_limit(out.fd, &rights) == -1 && errno != ENOSYS)
> +   err(1, "unable to limit capability rights");
> +   if (cap_ioctls_limit(out.fd, cmds, nitems(cmds)) == -1 &&
> +   errno != ENOSYS)
> +   err(1, "unable to limit capability rights");
> +
> +   if (in.fd != STDERR_FILENO && out.fd != STDERR_FILENO) {
> +   if (caph_limit_stderr() == -1)
> +   err(1, "unable to limit capability rights");
> +   }
> +
> /*
>  * Allocate space for the input and output buffers.  If not doing
>  * record oriented I/O, only need a single buffer.
>
___
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: r308823 - head/sys/net80211

2016-11-18 Thread Adrian Chadd
Author: adrian
Date: Sat Nov 19 02:00:24 2016
New Revision: 308823
URL: https://svnweb.freebsd.org/changeset/base/308823

Log:
  [net80211] handle hardware encryption offload in the receive path
  
  * teach the crypto modules about receive offload - although I have
to do some further reviewing in places where we /can't/ have an RX key
  * teach the RX data path about receive offload encryption - check the flag,
handle NULL key, do decap and checking as appropriate.
  
  Tested:
  
  * iwn(4), STA mode
  * ath(4), STA and AP mode
  * ath10k port, STA mode (hardware encryption)
  
  Reviewed by:  avos
  Differential Revision:https://reviews.freebsd.org/D8533

Modified:
  head/sys/net80211/ieee80211_adhoc.c
  head/sys/net80211/ieee80211_crypto.c
  head/sys/net80211/ieee80211_crypto.h
  head/sys/net80211/ieee80211_crypto_ccmp.c
  head/sys/net80211/ieee80211_crypto_tkip.c
  head/sys/net80211/ieee80211_hostap.c
  head/sys/net80211/ieee80211_sta.c
  head/sys/net80211/ieee80211_wds.c

Modified: head/sys/net80211/ieee80211_adhoc.c
==
--- head/sys/net80211/ieee80211_adhoc.c Sat Nov 19 01:51:56 2016
(r308822)
+++ head/sys/net80211/ieee80211_adhoc.c Sat Nov 19 02:00:24 2016
(r308823)
@@ -316,6 +316,16 @@ adhoc_input(struct ieee80211_node *ni, s
int hdrspace, need_tap = 1; /* mbuf need to be tapped. */   
uint8_t dir, type, subtype, qos;
uint8_t *bssid;
+   int is_hw_decrypted = 0;
+   int has_decrypted = 0;
+
+   /*
+* Some devices do hardware decryption all the way through
+* to pretending the frame wasn't encrypted in the first place.
+* So, tag it appropriately so it isn't discarded inappropriately.
+*/
+   if ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_DECRYPTED))
+   is_hw_decrypted = 1;
 
if (m->m_flags & M_AMPDU_MPDU) {
/*
@@ -479,7 +489,7 @@ adhoc_input(struct ieee80211_node *ni, s
 * crypto cipher modules used to do delayed update
 * of replay sequence numbers.
 */
-   if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) {
+   if (is_hw_decrypted || wh->i_fc[1] & IEEE80211_FC1_PROTECTED) {
if ((vap->iv_flags & IEEE80211_F_PRIVACY) == 0) {
/*
 * Discard encrypted frames when privacy is off.
@@ -490,14 +500,14 @@ adhoc_input(struct ieee80211_node *ni, s
IEEE80211_NODE_STAT(ni, rx_noprivacy);
goto out;
}
-   key = ieee80211_crypto_decap(ni, m, hdrspace);
-   if (key == NULL) {
+   if (ieee80211_crypto_decap(ni, m, hdrspace, &key) == 0) 
{
/* NB: stats+msgs handled in crypto_decap */
IEEE80211_NODE_STAT(ni, rx_wepfail);
goto out;
}
wh = mtod(m, struct ieee80211_frame *);
wh->i_fc[1] &= ~IEEE80211_FC1_PROTECTED;
+   has_decrypted = 1;
} else {
/* XXX M_WEP and IEEE80211_F_PRIVACY */
key = NULL;
@@ -528,7 +538,7 @@ adhoc_input(struct ieee80211_node *ni, s
/*
 * Next strip any MSDU crypto bits.
 */
-   if (key != NULL && !ieee80211_crypto_demic(vap, key, m, 0)) {
+   if (!ieee80211_crypto_demic(vap, key, m, 0)) {
IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT,
ni->ni_macaddr, "data", "%s", "demic error");
vap->iv_stats.is_rx_demicfail++;
@@ -582,7 +592,8 @@ adhoc_input(struct ieee80211_node *ni, s
 * any non-PAE frames received without encryption.
 */
if ((vap->iv_flags & IEEE80211_F_DROPUNENC) &&
-   (key == NULL && (m->m_flags & M_WEP) == 0) &&
+   ((has_decrypted == 0) && (m->m_flags & M_WEP) == 0) 
&&
+   (is_hw_decrypted == 0) &&
eh->ether_type != htons(ETHERTYPE_PAE)) {
/*
 * Drop unencrypted frames.

Modified: head/sys/net80211/ieee80211_crypto.c
==
--- head/sys/net80211/ieee80211_crypto.cSat Nov 19 01:51:56 2016
(r308822)
+++ head/sys/net80211/ieee80211_crypto.cSat Nov 19 02:00:24 2016
(r308823)
@@ -580,8 +580,9 @@ ieee80211_crypto_encap(struct ieee80211_
  * Validate and strip privacy headers (and trailer) for a
  * received frame that has the WEP/Privacy bit s

svn commit: r308860 - head/bin/dd

2016-11-19 Thread Adrian Chadd
Author: adrian
Date: Sat Nov 19 18:19:21 2016
New Revision: 308860
URL: https://svnweb.freebsd.org/changeset/base/308860

Log:
  [dd] Revert the capsicum bits for now until it gets fixed.
  
  dd is a bootstrap tool and that header isn't installed as part of the
  bootstrap environment for previous releases (eg freebsd-10.)
  
  We'll figure it out in post and then re-commit it.

Modified:
  head/bin/dd/dd.c

Modified: head/bin/dd/dd.c
==
--- head/bin/dd/dd.cSat Nov 19 18:03:46 2016(r308859)
+++ head/bin/dd/dd.cSat Nov 19 18:19:21 2016(r308860)
@@ -48,13 +48,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
-#include 
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -95,10 +92,6 @@ main(int argc __unused, char *argv[])
jcl(argv);
setup();
 
-   caph_cache_catpages();
-   if (cap_enter() == -1 && errno != ENOSYS)
-   err(1, "unable to enter capability mode");
-
(void)signal(SIGINFO, siginfo_handler);
(void)signal(SIGINT, terminate);
 
@@ -132,8 +125,6 @@ static void
 setup(void)
 {
u_int cnt;
-   cap_rights_t rights;
-   unsigned long cmds[] = { FIODTYPE, MTIOCTOP };
 
if (in.name == NULL) {
in.name = "stdin";
@@ -142,20 +133,13 @@ setup(void)
in.fd = open(in.name, O_RDONLY, 0);
if (in.fd == -1)
err(1, "%s", in.name);
-   if (caph_limit_stdin() == -1)
-   err(1, "unable to limit capability rights");
}
 
getfdtype(&in);
 
-   cap_rights_init(&rights, CAP_READ, CAP_SEEK);
-   if (cap_rights_limit(in.fd, &rights) == -1 && errno != ENOSYS)
-   err(1, "unable to limit capability rights");
-
if (files_cnt > 1 && !(in.flags & ISTAPE))
errx(1, "files is not supported for non-tape devices");
 
-   cap_rights_set(&rights, CAP_WRITE, CAP_FTRUNCATE, CAP_IOCTL);
if (out.name == NULL) {
/* No way to check for read access here. */
out.fd = STDOUT_FILENO;
@@ -172,27 +156,13 @@ setup(void)
if (out.fd == -1) {
out.fd = open(out.name, O_WRONLY | OFLAGS, DEFFILEMODE);
out.flags |= NOREAD;
-   cap_rights_clear(&rights, CAP_READ);
}
if (out.fd == -1)
err(1, "%s", out.name);
-   if (caph_limit_stdout() == -1)
-   err(1, "unable to limit capability rights");
}
 
getfdtype(&out);
 
-   if (cap_rights_limit(out.fd, &rights) == -1 && errno != ENOSYS)
-   err(1, "unable to limit capability rights");
-   if (cap_ioctls_limit(out.fd, cmds, nitems(cmds)) == -1 &&
-   errno != ENOSYS)
-   err(1, "unable to limit capability rights");
-
-   if (in.fd != STDERR_FILENO && out.fd != STDERR_FILENO) {
-   if (caph_limit_stderr() == -1)
-   err(1, "unable to limit capability rights");
-   }
-
/*
 * Allocate space for the input and output buffers.  If not doing
 * record oriented I/O, only need a single buffer.
___
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: r306186 - head/sys/kern

2016-11-21 Thread Adrian Chadd
Hi,

For reference - this breaks sooptcopyin() on MIPS32 BE. Undoing this
commit fixes things. :)

(it breaks ipfw. )



-adrian


On 22 September 2016 at 05:41, Ruslan Bukin  wrote:
> Author: br
> Date: Thu Sep 22 12:41:53 2016
> New Revision: 306186
> URL: https://svnweb.freebsd.org/changeset/base/306186
>
> Log:
>   Adjust the sopt_val pointer on bigendian systems (e.g. MIPS64EB).
>
>   sooptcopyin() checks if size of data provided by user is <= than we can
>   accept, else it strips down the size. On bigendian platforms we have to
>   move pointer as well so we copy the actual data.
>
>   Reviewed by:  gnn
>   Sponsored by: DARPA, AFRL
>   Sponsored by: HEIF5
>   Differential Revision:https://reviews.freebsd.org/D7980
>
> Modified:
>   head/sys/kern/uipc_socket.c
>
> Modified: head/sys/kern/uipc_socket.c
> ==
> --- head/sys/kern/uipc_socket.c Thu Sep 22 12:08:26 2016(r306185)
> +++ head/sys/kern/uipc_socket.c Thu Sep 22 12:41:53 2016(r306186)
> @@ -2455,8 +2455,12 @@ sooptcopyin(struct sockopt *sopt, void *
>  */
> if ((valsize = sopt->sopt_valsize) < minlen)
> return EINVAL;
> -   if (valsize > len)
> +   if (valsize > len) {
> +#if _BYTE_ORDER == _BIG_ENDIAN
> +   sopt->sopt_val = (void *)((uintptr_t)sopt->sopt_val + 
> (valsize - len));
> +#endif
> sopt->sopt_valsize = valsize = len;
> +   }
>
> if (sopt->sopt_td != NULL)
> return (copyin(sopt->sopt_val, buf, valsize));
>
___
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: r308949 - head/sys/net80211

2016-11-21 Thread Adrian Chadd
Author: adrian
Date: Tue Nov 22 01:22:54 2016
New Revision: 308949
URL: https://svnweb.freebsd.org/changeset/base/308949

Log:
  [net80211] flesh out more IBSS 11n support
  
  * Pepper comments around which describe what state(s) we're in when faking
up 11n nodes.
  * By default don't fake it up as 11n until we properly negotiate the 11n
capabilities using probe request/response frames.
  * Send a probe request with our HT information, as the 802.11-2012 spec
suggests.
  * Reassociate with the driver if we've been promoted.
  
  This is done because although learning a peer via beacons can learn 11n
  state, learning peers via hearing probe frames and broadcast frames
  does not.  Thus, sometimes you end up with an 11n peer in the peer
  table and sometimes you don't.
  
  Note that the probe request/response exchange may not actually succeed.
  Ideally we'd put the peer into some blocking state until we've exchanged
  probe request/reponse to learn capabilities, or we timeout and just
  stay non-11n.
  
  This is more an experiment to get 11n IBSS nodes actually discovering
  each other and be able to transmit.  There are other issues that creep
  up which I'll attempt to address in future commits.
  
  Tested:
  
  * AR9380 NICs in 11n mode.
  
  Reviewed by:  avos
  Differential Revision:https://reviews.freebsd.org/D8365

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

Modified: head/sys/net80211/ieee80211_adhoc.c
==
--- head/sys/net80211/ieee80211_adhoc.c Tue Nov 22 01:02:59 2016
(r308948)
+++ head/sys/net80211/ieee80211_adhoc.c Tue Nov 22 01:22:54 2016
(r308949)
@@ -427,8 +427,12 @@ adhoc_input(struct ieee80211_node *ni, s
goto err;
}
/*
-* Fake up a node for this newly
-* discovered member of the IBSS.
+* Fake up a node for this newly discovered member
+* of the IBSS.
+*
+* Note: This doesn't "upgrade" the node to 11n;
+* that will happen after a probe request/response
+* exchange.
 */
ni = ieee80211_fakeup_adhoc_node(vap, wh->i_addr2);
if (ni == NULL) {
@@ -773,12 +777,35 @@ adhoc_recv_mgmt(struct ieee80211_node *n
ni = ieee80211_add_neighbor(vap, wh, 
&scan);
else
ni = NULL;
+
+   /*
+* Send a probe request so we announce 11n
+* capabilities.
+*/
+   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.
 * Note this also updates the tsf.
 */
ieee80211_init_neighbor(ni, wh, &scan);
+
+   /*
+* Send a probe request so we announce 11n
+* capabilities.
+*/
+   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 {
/*
 * Record tsf for potential resync.
@@ -889,6 +916,12 @@ adhoc_recv_mgmt(struct ieee80211_node *n
 */
ieee80211_send_proberesp(vap, wh->i_addr2,
is11bclient(rates, xrates) ? IEEE80211_SEND_LEGACY_11B : 0);
+
+   /*
+* Note: we don't benefit from stashing the probe request
+* IEs away to use for IBSS negotiation, because we
+* typically don't get all of the IEs.
+*/
break;
 
case IEEE80211_FC0_SUBTYPE_ACTION:

Modified: head/sys/net80211/ieee80211_n

svn commit: r308950 - head/sys/net80211

2016-11-21 Thread Adrian Chadd
Author: adrian
Date: Tue Nov 22 02:02:13 2016
New Revision: 308950
URL: https://svnweb.freebsd.org/changeset/base/308950

Log:
  [net80211] Remove extra \n.

Modified:
  head/sys/net80211/ieee80211_ht.c

Modified: head/sys/net80211/ieee80211_ht.c
==
--- head/sys/net80211/ieee80211_ht.cTue Nov 22 01:22:54 2016
(r308949)
+++ head/sys/net80211/ieee80211_ht.cTue Nov 22 02:02:13 2016
(r308950)
@@ -592,7 +592,7 @@ ieee80211_ampdu_rx_start_ext(struct ieee
rap->rxa_flags |=  IEEE80211_AGGR_RUNNING | IEEE80211_AGGR_XCHGPEND;
 
IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_11N, ni,
-   "%s: tid=%d, start=%d, wnd=%d, flags=0x%08x\n",
+   "%s: tid=%d, start=%d, wnd=%d, flags=0x%08x",
__func__,
tid,
seq,
___
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: r308951 - head/sys/dev/ath

2016-11-21 Thread Adrian Chadd
Author: adrian
Date: Tue Nov 22 02:42:00 2016
New Revision: 308951
URL: https://svnweb.freebsd.org/changeset/base/308951

Log:
  [ath] obey the peer A-MPDU density and max-size.
  
  * Obey the peer A-MPDU density if it's larger than the currently configured
one.
  
  * Pay attention to the peer A-MPDU max-size and don't assume we can transmit
a full A-MPDU (64k!) if the peer announces smaller values.
  
  Relnotes: ath(4): Fix A-MPDU transmit; obey A-MPDU density and max size.

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

Modified: head/sys/dev/ath/if_ath_tx_ht.c
==
--- head/sys/dev/ath/if_ath_tx_ht.c Tue Nov 22 02:02:13 2016
(r308950)
+++ head/sys/dev/ath/if_ath_tx_ht.c Tue Nov 22 02:42:00 2016
(r308951)
@@ -319,8 +319,8 @@ ath_tx_rate_fill_rcflags(struct ath_soft
 * and we're not doing positioning, enable STBC.
 */
if (ic->ic_htcaps & IEEE80211_HTCAP_TXSTBC &&
-   ni->ni_vap->iv_flags_ht & IEEE80211_FHT_STBC_TX &&
-   ni->ni_htcap & IEEE80211_HTCAP_RXSTBC_1STREAM &&
+   (ni->ni_vap->iv_flags_ht & IEEE80211_FHT_STBC_TX) &&
+   (ni->ni_htcap & IEEE80211_HTCAP_RXSTBC) &&
(sc->sc_cur_txchainmask > 1) &&
(HT_RC_2_STREAMS(rate) == 1) &&
(bf->bf_flags & ATH_BUF_TOA_PROBE) == 0) {
@@ -404,24 +404,40 @@ static int
 ath_compute_num_delims(struct ath_softc *sc, struct ath_buf *first_bf,
 uint16_t pktlen)
 {
+#defineMS(_v, _f)  (((_v) & _f) >> _f##_S)
const HAL_RATE_TABLE *rt = sc->sc_currates;
struct ieee80211_node *ni = first_bf->bf_node;
struct ieee80211vap *vap = ni->ni_vap;
int ndelim, mindelim = 0;
-   int mpdudensity; /* in 1/100'th of a microsecond */
+   int mpdudensity;/* in 1/100'th of a microsecond */
+   int peer_mpdudensity;   /* net80211 value */
uint8_t rc, rix, flags;
int width, half_gi;
uint32_t nsymbits, nsymbols;
uint16_t minlen;
 
/*
-* vap->iv_ampdu_density is a value, rather than the actual
-* density.
+* Get the advertised density from the node.
 */
-   if (vap->iv_ampdu_density > IEEE80211_HTCAP_MPDUDENSITY_16)
+   peer_mpdudensity = MS(ni->ni_htparam, IEEE80211_HTCAP_MPDUDENSITY);
+
+   /*
+* vap->iv_ampdu_density is a net80211 value, rather than the actual
+* density.  Larger values are longer A-MPDU density spacing values,
+* and we want to obey larger configured / negotiated density values
+* per station if we get it.
+*/
+   if (vap->iv_ampdu_density > peer_mpdudensity)
+   peer_mpdudensity = vap->iv_ampdu_density;
+
+   /*
+* Convert the A-MPDU density net80211 value to a 1/100 microsecond
+* value for subsequent calculations.
+*/
+   if (peer_mpdudensity > IEEE80211_HTCAP_MPDUDENSITY_16)
mpdudensity = 1600; /* maximum density */
else
-   mpdudensity = ieee80211_mpdudensity_map[vap->iv_ampdu_density];
+   mpdudensity = ieee80211_mpdudensity_map[peer_mpdudensity];
 
/* Select standard number of delimiters based on frame length */
ndelim = ATH_AGGR_GET_NDELIM(pktlen);
@@ -509,22 +525,49 @@ ath_compute_num_delims(struct ath_softc 
__func__, pktlen, minlen, rix, rc, width, half_gi, ndelim);
 
return ndelim;
+#undef MS
 }
 
 /*
  * Fetch the aggregation limit.
  *
  * It's the lowest of the four rate series 4ms frame length.
+ *
+ * Also take into account the hardware specific limits (8KiB on AR5416)
+ * and per-peer limits in non-STA mode.
  */
 static int
-ath_get_aggr_limit(struct ath_softc *sc, struct ath_buf *bf)
+ath_get_aggr_limit(struct ath_softc *sc, struct ieee80211_node *ni,
+struct ath_buf *bf)
 {
+#defineMS(_v, _f)  (((_v) & _f) >> _f##_S)
int amin = ATH_AGGR_MAXSIZE;
int i;
 
+   /* Extract out the maximum configured driver A-MPDU limit */
if (sc->sc_aggr_limit > 0 && sc->sc_aggr_limit < ATH_AGGR_MAXSIZE)
amin = sc->sc_aggr_limit;
 
+   /*
+* Check the HTCAP field for the maximum size the node has
+* negotiated.  If it's smaller than what we have, cap it there.
+*/
+   switch (MS(ni->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU)) {
+   case IEEE80211_HTCAP_MAXRXAMPDU_16K:
+   amin = MIN(amin, 16384);
+   break;
+   case IEEE80211_HTCAP_MAXRXAMPDU_32K:
+   amin = MIN(amin, 32768);
+   break;
+   case IEEE80211_HTCAP_MAXRXAMPDU_64K:
+   amin = MIN(amin, 65536);
+   break;
+   case IEEE80211_HTCAP_MAXRXAMPDU_8K:
+

svn commit: r308952 - head/sys/net80211

2016-11-21 Thread Adrian Chadd
Author: adrian
Date: Tue Nov 22 02:51:06 2016
New Revision: 308952
URL: https://svnweb.freebsd.org/changeset/base/308952

Log:
  [net80211] store references to VHT and related IEs.
  
  This just stores pointers to the IE; it doesn't yet parse anything.
  
  Note: it blows out the size of ieee80211_node, so this will require
  ye olde kernel/modules recompile.

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

Modified: head/sys/net80211/ieee80211_node.c
==
--- head/sys/net80211/ieee80211_node.c  Tue Nov 22 02:42:00 2016
(r308951)
+++ head/sys/net80211/ieee80211_node.c  Tue Nov 22 02:51:06 2016
(r308952)
@@ -896,6 +896,10 @@ ieee80211_sta_join(struct ieee80211vap *
if (ni->ni_ies.tdma_ie != NULL)
ieee80211_parse_tdma(ni, ni->ni_ies.tdma_ie);
 #endif
+
+   /* XXX parse VHT IEs */
+   /* XXX parse BSSLOAD IE */
+   /* XXX parse APCHANREP IE */
}
 
vap->iv_dtim_period = se->se_dtimperiod;
@@ -1055,6 +1059,21 @@ ieee80211_ies_expand(struct ieee80211_ie
ies->meshid_ie = ie;
break;
 #endif
+   case IEEE80211_ELEMID_VHT_CAP:
+   ies->vhtcap_ie = ie;
+   break;
+   case IEEE80211_ELEMID_VHT_OPMODE:
+   ies->vhtopmode_ie = ie;
+   break;
+   case IEEE80211_ELEMID_VHT_PWR_ENV:
+   ies->vhtpwrenv_ie = ie;
+   break;
+   case IEEE80211_ELEMID_BSSLOAD:
+   ies->bssload_ie = ie;
+   break;
+   case IEEE80211_ELEMID_APCHANREP:
+   ies->apchanrep_ie = ie;
+   break;
}
ielen -= 2 + ie[1];
ie += 2 + ie[1];

Modified: head/sys/net80211/ieee80211_node.h
==
--- head/sys/net80211/ieee80211_node.h  Tue Nov 22 02:42:00 2016
(r308951)
+++ head/sys/net80211/ieee80211_node.h  Tue Nov 22 02:51:06 2016
(r308952)
@@ -83,6 +83,11 @@ struct ieee80211_ies {
uint8_t *htinfo_ie; /* captured HTINFO ie */
uint8_t *tdma_ie;   /* captured TDMA ie */
uint8_t *meshid_ie; /* captured MESH ID ie */
+   uint8_t *vhtcap_ie; /* captured VHTCAP ie */
+   uint8_t *vhtopmode_ie;  /* captured VHTOPMODE ie */
+   uint8_t *vhtpwrenv_ie;  /* captured VHTPWRENV ie */
+   uint8_t *apchanrep_ie;  /* captured APCHANREP ie */
+   uint8_t *bssload_ie;/* captured BSSLOAD ie */
uint8_t *spare[4];
/* NB: these must be the last members of this structure */
uint8_t *data;  /* frame data > 802.11 header */
___
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: r308956 - head/sys/net80211

2016-11-21 Thread Adrian Chadd
Author: adrian
Date: Tue Nov 22 06:53:52 2016
New Revision: 308956
URL: https://svnweb.freebsd.org/changeset/base/308956

Log:
  [net80211] Only send out a probe request if we see an unknown IBSS node that 
matches our SSID.

Modified:
  head/sys/net80211/ieee80211_adhoc.c

Modified: head/sys/net80211/ieee80211_adhoc.c
==
--- head/sys/net80211/ieee80211_adhoc.c Tue Nov 22 06:29:08 2016
(r308955)
+++ head/sys/net80211/ieee80211_adhoc.c Tue Nov 22 06:53:52 2016
(r308956)
@@ -773,22 +773,21 @@ adhoc_recv_mgmt(struct ieee80211_node *n
 * filling the node table with nodes that
 * aren't ours.
 */
-   if (ieee80211_ibss_node_check_new(ni, &scan))
+   if (ieee80211_ibss_node_check_new(ni, &scan)) {
ni = ieee80211_add_neighbor(vap, wh, 
&scan);
-   else
+   /*
+* Send a probe request so we announce 
11n
+* capabilities.
+*/
+   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
ni = NULL;
 
-   /*
-* Send a probe request so we announce 11n
-* capabilities.
-*/
-   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.
___
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: r309014 - head/sys/net80211

2016-11-22 Thread Adrian Chadd
Author: adrian
Date: Tue Nov 22 17:36:16 2016
New Revision: 309014
URL: https://svnweb.freebsd.org/changeset/base/309014

Log:
  [net80211] high oops on the high seas, or "god damnit compilers, it's 2016 
and you're supposed to save me from this."
  
  TODO:
  
  * drink real coffee before committing in the morning, or there's a high
risk of more obviously self-evident commits being turned into attempts
at humour.
  
  Reported by:  cem, Coverity CID 1366219

Modified:
  head/sys/net80211/ieee80211_crypto_ccmp.c

Modified: head/sys/net80211/ieee80211_crypto_ccmp.c
==
--- head/sys/net80211/ieee80211_crypto_ccmp.c   Tue Nov 22 17:14:09 2016
(r309013)
+++ head/sys/net80211/ieee80211_crypto_ccmp.c   Tue Nov 22 17:36:16 2016
(r309014)
@@ -241,7 +241,7 @@ ccmp_decap(struct ieee80211_key *k, stru
 
rxs = ieee80211_get_rx_params_ptr(m);
 
-   if ((rxs != NULL) & (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP))
+   if ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP))
goto finish;
 
/*
@@ -286,7 +286,7 @@ finish:
/*
 * Copy up 802.11 header and strip crypto bits.
 */
-   if (! ((rxs != NULL) & (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP))) {
+   if (! ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP))) {
ovbcopy(mtod(m, void *), mtod(m, uint8_t *) + ccmp.ic_header,
hdrlen);
m_adj(m, ccmp.ic_header);
@@ -295,13 +295,13 @@ finish:
/*
 * XXX TODO: see if MMIC_STRIP also covers CCMP MIC trailer.
 */
-   if (! ((rxs != NULL) & (rxs->c_pktflags & IEEE80211_RX_F_MMIC_STRIP)))
+   if (! ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_MMIC_STRIP)))
m_adj(m, -ccmp.ic_trailer);
 
/*
 * Ok to update rsc now.
 */
-   if (! ((rxs != NULL) & (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP))) {
+   if (! ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP))) {
k->wk_keyrsc[tid] = pn;
}
 
___
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: r309215 - head/sys/dev/ath

2016-11-27 Thread Adrian Chadd
Author: adrian
Date: Sun Nov 27 18:34:29 2016
New Revision: 309215
URL: https://svnweb.freebsd.org/changeset/base/309215

Log:
  [ath] Begin to lay the groundwork for btcoex related ioctl controls.

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

Modified: head/sys/dev/ath/if_ath_ioctl.c
==
--- head/sys/dev/ath/if_ath_ioctl.c Sun Nov 27 18:06:03 2016
(r309214)
+++ head/sys/dev/ath/if_ath_ioctl.c Sun Nov 27 18:34:29 2016
(r309215)
@@ -296,6 +296,8 @@ ath_ioctl(struct ieee80211com *ic, u_lon
return (ath_ioctl_spectral(sc, data));
case SIOCGATHNODERATESTATS:
return (ath_ioctl_ratestats(sc, data));
+   case SIOCGATHBTCOEX:
+   return (ath_btcoex_ioctl(sc, data));
default:
/*
 * This signals the net80211 layer that we didn't handle this

Modified: head/sys/dev/ath/if_athioctl.h
==
--- head/sys/dev/ath/if_athioctl.h  Sun Nov 27 18:06:03 2016
(r309214)
+++ head/sys/dev/ath/if_athioctl.h  Sun Nov 27 18:34:29 2016
(r309215)
@@ -447,4 +447,9 @@ struct ath_tx_radiotap_header {
 #defineSPECTRAL_CONTROL_ENABLE_AT_RESET8
 #defineSPECTRAL_CONTROL_DISABLE_AT_RESET   9
 
+/*
+ * Bluetooth coexistence control parameters
+ */
+#defineSIOCGATHBTCOEX  _IOWR('i', 152, struct ath_diag)
+
 #endif /* _DEV_ATH_ATHIOCTL_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: r309222 - head/sys/dev/ath

2016-11-27 Thread Adrian Chadd
Author: adrian
Date: Mon Nov 28 02:51:55 2016
New Revision: 309222
URL: https://svnweb.freebsd.org/changeset/base/309222

Log:
  [ath] include logging of TU versions of the TSF values.
  
  The beacon programming side of things deals in TUs and 1/8th TUs, so
  it's good to se the TU value here when debugging beaconing issues.

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 Nov 27 20:52:52 2016
(r309221)
+++ head/sys/dev/ath/if_ath_rx.cMon Nov 28 02:51:55 2016
(r309222)
@@ -420,19 +420,24 @@ ath_recv_mgmt(struct ieee80211_node *ni,
tsf_remainder = (tsf_beacon - tsf_beacon_old) % 
tsf_intval;
}
 
-   DPRINTF(sc, ATH_DEBUG_BEACON, "%s: old_tsf=%llu, 
new_tsf=%llu, target_tsf=%llu, delta=%lld, bmiss=%d, remainder=%d\n",
+   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",
__func__,
(unsigned long long) tsf_beacon_old,
+   (unsigned int) (tsf_beacon_old >> 10),
(unsigned long long) tsf_beacon,
+   (unsigned int ) (tsf_beacon >> 10),
(unsigned long long) tsf_beacon_target,
+   (unsigned int) (tsf_beacon_target >> 10),
(long long) tsf_delta,
tsf_delta_bmiss,
tsf_remainder);
 
-   DPRINTF(sc, ATH_DEBUG_BEACON, "%s: tsf=%llu, 
nexttbtt=%llu, delta=%d\n",
+   DPRINTF(sc, ATH_DEBUG_BEACON, "%s: tsf=%llu (%u), 
nexttbtt=%llu (%u), delta=%d\n",
__func__,
(unsigned long long) tsf_beacon,
+   (unsigned int) (tsf_beacon >> 10),
(unsigned long long) nexttbtt,
+   (unsigned int) (nexttbtt >> 10),
(int32_t) tsf_beacon - (int32_t) nexttbtt + 
tsf_intval);
 
/* We only do syncbeacon on STA VAPs; not on IBSS */
___
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: r309223 - head/sys/dev/ath

2016-11-27 Thread Adrian Chadd
Author: adrian
Date: Mon Nov 28 02:59:33 2016
New Revision: 309223
URL: https://svnweb.freebsd.org/changeset/base/309223

Log:
  [ath] fix target beacon interval programming for STA mode when in powersave.
  
  This bug has been bugging me for quite some time.  I finally sat down
  with enough coffee to figure it out.
  
  The short of it - rounding up to the next intval multiple of the TSF value
  only works if the AP is transmitting all its beacons on an interval of
  the TSF.  If it isn't - for example, doing staggered beacons on a multi-VAP
  setup with a single hardware TSF - then weird things occur.
  
  The long of it -
  
  When powersave is enabled, the MAC and PHY are partially powered off.
  They can't receive any packets (or transmit, for that matter.)
  The target beacon timer programming will wake up the MAC/PHY just before
  the beacon is supposed to be received (well, strictly speaking, at DTIM
  so it can see the TIM - traffic information map - telling the STA whether
  any traffic is there for it) and it happens automatically.
  
  However, this relies on the target beacon time being programmed correctly.
  If it isn't then the hardware will wake up and not hear any beacons -
  and then it'll be asleep for said beacons.  After enough of this, net80211
  will give up and assume the AP went away.
  
  This should fix both TSFOOR interrupts and disconnects from APs with powersave
  enabled.
  
  The annoying bit is that it only happens if APs stagger things or start
  on a non-zero TSF.  So, this would sometimes be fine and sometimes not be
  fine.
  
  What:
  
  * I don't know (yet) why the code rounds up to the next intval.
For now, just disable rounding it and trust the value we get.
  
  TODO:
  
  * If we do see a beacon miss in STA mode then we should transition
out of sleep for a while so we can hear beacons to resync against.
I'd love a patch from someone to enable that particular behaviour.
Note - that doesn't require that net80211 brings the chip out of
sleep state - only that we wake the chip up through to full-on and
then let it go to sleep again when we've seen a beacon.  The wifi
stack and AP can still completely just stay believing we're in sleep
mode.
  
  Tested:
  
  * AR9485, STA mode, powersave enabled
  
  MFC after:1 week
  Relnotes: Yes

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

Modified: head/sys/dev/ath/if_ath_beacon.c
==
--- head/sys/dev/ath/if_ath_beacon.cMon Nov 28 02:51:55 2016
(r309222)
+++ head/sys/dev/ath/if_ath_beacon.cMon Nov 28 02:59:33 2016
(r309223)
@@ -964,10 +964,30 @@ ath_beacon_config(struct ath_softc *sc, 
/* NB: the beacon interval is kept internally in TU's */
intval = ni->ni_intval & HAL_BEACON_PERIOD;
}
+
+
+   /*
+* Note: rounding up to the next intval can cause problems.
+*
+* In STA mode with powersave enabled, beacons are only received
+* whenever the beacon timer fires to wake up the hardware.
+* Now, if this is rounded up to the next intval, it assumes
+* that the AP has started transmitting beacons at TSF values that
+* are multiples of intval, versus say being 25 TU off.
+*
+* I'm not sure why nexttbtt is rounded up to the intval.
+* If we sync against a beacon that is way out, we should
+* take a beacon miss and re-sync against the next beacon.
+*
+* So for now - don't round up if we're in STA mode.
+* Maybe later (when someone eventually does powersave+IBSS,
+* powersave+MBSS) this can be flipped on for those too.
+*/
if (nexttbtt == 0)  /* e.g. for ap mode */
nexttbtt = intval;
-   else if (intval)/* NB: can be 0 for monitor mode */
+   else if ((ic->ic_opmode != IEEE80211_M_STA) && intval)  /* NB: 
can be 0 for monitor mode */
nexttbtt = roundup(nexttbtt, intval);
+
DPRINTF(sc, ATH_DEBUG_BEACON, "%s: nexttbtt %u intval %u (%u)\n",
__func__, nexttbtt, intval, ni->ni_intval);
if (ic->ic_opmode == IEEE80211_M_STA && !sc->sc_swbmiss) {
___
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: r309246 - head/sys/dev/ath

2016-11-28 Thread Adrian Chadd
Author: adrian
Date: Mon Nov 28 08:13:20 2016
New Revision: 309246
URL: https://svnweb.freebsd.org/changeset/base/309246

Log:
  [ath] wake up the hardware from power-save before doing transmit completion 
checking.
  
  This was being done in the pre-AR9380 case, but not for AR9380 and later.
  When powersave in STA mode is enabled, this may have lead to the transmit
  completion code doing this:
  
  * call the task, which doesn't wake up the hardware
  * complete the frames, which doesn't touch the hardware
  * schedule pending frames on the hardware queue, which DOES touch the
hardware, and this will be ignored
  
  This would show up in the logs like this:
  
  (with debugging enabled):
  Nov 27 23:03:56 lovelace kernel: Q1[  0] (nseg=1) (DS.V:0xfe011bd57300 
DS.P:0x49b57300) I: 168cc117 L: F:0005
  ...
  (in general, doesn't require debugging enabled):
  Nov 27 23:03:56 lovelace kernel: ath_hal_reg_write: reg=0x0804, 
val=0x49b57300, pm=2
  
  That register is a EDMA TX FIFO register (queue 1), and the val is the 
descriptor
  being written.
  
  Whilst here, make sure the software queue gets kicked here.
  
  Tested;
  
  * AR9485, STA mode + powersave

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

Modified: head/sys/dev/ath/if_ath_tx_edma.c
==
--- head/sys/dev/ath/if_ath_tx_edma.c   Mon Nov 28 07:56:03 2016
(r309245)
+++ head/sys/dev/ath/if_ath_tx_edma.c   Mon Nov 28 08:13:20 2016
(r309246)
@@ -755,11 +755,30 @@ ath_edma_tx_proc(void *arg, int npending
 {
struct ath_softc *sc = (struct ath_softc *) arg;
 
+   ATH_PCU_LOCK(sc);
+   sc->sc_txproc_cnt++;
+   ATH_PCU_UNLOCK(sc);
+
+   ATH_LOCK(sc);
+   ath_power_set_power_state(sc, HAL_PM_AWAKE);
+   ATH_UNLOCK(sc);
+
 #if 0
DPRINTF(sc, ATH_DEBUG_TX_PROC, "%s: called, npending=%d\n",
__func__, npending);
 #endif
ath_edma_tx_processq(sc, 1);
+
+
+   ATH_PCU_LOCK(sc);
+   sc->sc_txproc_cnt--;
+   ATH_PCU_UNLOCK(sc);
+
+   ATH_LOCK(sc);
+   ath_power_restore_power_state(sc);
+   ATH_UNLOCK(sc);
+
+   ath_tx_kick(sc);
 }
 
 /*
___
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: r309253 - head/sys/dev/ath

2016-11-28 Thread Adrian Chadd
Author: adrian
Date: Mon Nov 28 17:06:35 2016
New Revision: 309253
URL: https://svnweb.freebsd.org/changeset/base/309253

Log:
  [ath] revert the previous commit, after reading the 802.11-2012 spec a bit 
more.
  
  The 802.11-2012 spec talks about this - section 10.1.3.2 - Beacon Generation
  in Infrastructure Networks.  So yes, we should be expecting beacons to be
  going out in multiples of intval.
  
  Silly adrian.
  
  So:
  
  * fix the FreeBSD APs that are sending beacons at incorrect TBTTs (target
beacon transmit time); and
  * yes indeed we will have to wake up out of network sleep until we sync
a beacon.

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

Modified: head/sys/dev/ath/if_ath_beacon.c
==
--- head/sys/dev/ath/if_ath_beacon.cMon Nov 28 16:25:05 2016
(r309252)
+++ head/sys/dev/ath/if_ath_beacon.cMon Nov 28 17:06:35 2016
(r309253)
@@ -965,9 +965,9 @@ ath_beacon_config(struct ath_softc *sc, 
intval = ni->ni_intval & HAL_BEACON_PERIOD;
}
 
-
/*
-* Note: rounding up to the next intval can cause problems.
+* Note: rounding up to the next intval can cause problems with
+* bad APs when we're in powersave mode.
 *
 * In STA mode with powersave enabled, beacons are only received
 * whenever the beacon timer fires to wake up the hardware.
@@ -975,17 +975,14 @@ ath_beacon_config(struct ath_softc *sc, 
 * that the AP has started transmitting beacons at TSF values that
 * are multiples of intval, versus say being 25 TU off.
 *
-* I'm not sure why nexttbtt is rounded up to the intval.
-* If we sync against a beacon that is way out, we should
-* take a beacon miss and re-sync against the next beacon.
-*
-* So for now - don't round up if we're in STA mode.
-* Maybe later (when someone eventually does powersave+IBSS,
-* powersave+MBSS) this can be flipped on for those too.
+* The specification (802.11-2012 10.1.3.2 - Beacon Generation in
+* Infrastructure Networks) requires APs be beaconing at a
+* mutiple of intval.  So, if bintval=100, then we shouldn't
+* get beacons at intervals other than around multiples of 100.
 */
if (nexttbtt == 0)  /* e.g. for ap mode */
nexttbtt = intval;
-   else if ((ic->ic_opmode != IEEE80211_M_STA) && intval)  /* NB: 
can be 0 for monitor mode */
+   else
nexttbtt = roundup(nexttbtt, intval);
 
DPRINTF(sc, ATH_DEBUG_BEACON, "%s: nexttbtt %u intval %u (%u)\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"


  1   2   3   4   5   6   7   8   9   10   >