[00:02.820 --> 00:08.860] Hello all and welcome to the last and most exciting day at the Wireless Village. My name [00:08.860 --> 00:13.600] is Zero and on behalf of the Wireless Village team I'm very happy to introduce Adrian Chad. [00:13.600 --> 00:19.980] Adrian came up to us during our training class at B-Sides in Las Vegas and said, oh, hi guys, [00:19.980 --> 00:26.640] I worked on the Atheros HAL code and it's my fault that it's all open source now. He's [00:26.760 --> 00:31.100] a B-S-D developer. We're not going to hold that against him for right now. So without [00:31.100 --> 00:35.020] further ado, I'm going to introduce the man who said, if I wanted to, I could win your [00:35.020 --> 00:37.000] CTF, but I don't want to. [00:38.280 --> 00:47.660] It's true. Hi, I'm Adrian. I, as a brief introduction, I worked at Atheros about the time they got [00:47.660 --> 00:51.780] bought by Qualcomm so I got to experience both the happy side of it and the not so happy [00:51.780 --> 00:58.640] side of it. So before we begin, I'm one of the dirty bastards who signed the NDA to get [00:58.640 --> 01:02.640] access to all the shiny toys. So everything that I'm about to tell you, you can actually [01:02.640 --> 01:05.520] figure out for yourself. I'm not going to tell you anything that you shouldn't be able [01:05.520 --> 01:10.220] to figure out by reading the available source code and all of their patent filings. And [01:10.220 --> 01:15.340] if you really want to dig into it, there's a bunch of IEEE presentations from the silicon [01:15.340 --> 01:20.580] people talking about the interesting crap they do in silicon. And I really hate writing [01:20.580 --> 01:27.040] slides and I really hate drawing diagrams. And all the diagrams I have are under NDA. [01:27.040 --> 01:32.060] So I suggest if you're actually interested in a picture representation of how the chip [01:32.060 --> 01:36.980] looks, do some Google searches of your own. I went and did some Google searches and there's [01:36.980 --> 01:40.520] some stuff out there, but they're in leaked data sheets. And for obvious reasons, I'm [01:40.520 --> 01:46.220] not going to post linked data sheets on a recorded talk. But it's all out there. [01:46.220 --> 01:55.020] So the Atheros hardware, the first thing that people think is going on inside it is [01:55.020 --> 01:59.140] that there's a CPU doing all the cool shit. And back in the day of the Prism and Prism [01:59.140 --> 02:03.680] 2 chips, there actually is a DSP in them that's actually doing a large part of the Mac and [02:03.680 --> 02:10.560] Fire related activity for the DSSS and the CCK encoding and decoding. However, there [02:10.560 --> 02:15.840] is no CPU in the core of the Atheros chips. By design, they put everything into silicon [02:15.840 --> 02:22.000] and anything that would run in a CPU, they punt to the host operating system driver, [02:22.000 --> 02:26.600] which gives us all the shiny toys that we have. So the bits that are interesting is [02:26.600 --> 02:32.580] the Mac, which implements all the 802.11 data level bits, like generating frames, doing [02:33.200 --> 02:39.320] RTS, CTS, contention, back off, all the timer related stuff. And you can see this is a great [02:39.320 --> 02:44.600] big DMA engine with thousands of little timers implementing 802.11. There's the fire that [02:44.600 --> 02:50.040] does all of the actual physical layer encoding. So that's doing CCK, OFDM, encoding and decoding. [02:50.040 --> 02:56.880] It has multiple radio, sorry, multiple spatial streams for 11N stuff. And there's the radio [02:56.880 --> 03:02.900] that does all the actual RF bits. And so the fire takes in and out like a 20, 40 or 80 [03:02.900 --> 03:09.580] megahertz wide baseband signal. And the radio is the thing that steps it up and down to [03:09.580 --> 03:14.580] 2 and 5 gig. The real time clock is clocking and also power control. So that's the bit [03:14.580 --> 03:20.020] of the chip that's bringing everything, bringing power on and off and handling clock generation. [03:20.840 --> 03:27.640] And then there's the host interface, which is the PCI, PCIe, the SDIO, inside the little [03:27.640 --> 03:32.560] tiny SOCs that you can get all those TP link and D link access points. They'll have a single [03:32.560 --> 03:39.980] chip with a Wi‑Fi chip on board. And the chip internal to the SOC is actually connected [03:39.980 --> 03:45.540] via a standardized industry protocol called AHB, which means something that I don't remember. [03:46.720 --> 03:54.140] So the MAC consists of some bits that do DMA. So in ETHEROS terms, the PCU handles the received [03:54.140 --> 04:02.300] DMA and the DCU handles TXDMA. The Q control unit handles implementing all the 802.11 crap. [04:02.300 --> 04:06.080] So if you want to fiddle with timing, I'll explain that in a minute. The QCU is the thing [04:06.080 --> 04:11.300] that you program to modify how 802.11 behavior works. And the DCU is the bit that just takes [04:11.300 --> 04:17.640] packets in and DMAs them into the TX50 and sends them out. All of the stuff that's time [04:17.640 --> 04:24.600] sensitive gets handled by the MAC. So AC generation, for example, can be done in hardware. There [04:24.600 --> 04:28.640] are timers to program how long it will wait for an AC on the received side. And you can [04:28.640 --> 04:33.560] disable sending AC if you really want to. And you can disable expecting an AC as well. [04:33.560 --> 04:39.440] RTS and CTS, AMPDU for 802.11 block AC, all of that crap is time sensitive. There's no [04:39.440 --> 04:45.580] point doing it in CPU. If you're a CPU's interrupt handler, it takes too long, then you'd miss [04:45.580 --> 04:51.160] your AC window and crap would be silly. So all of the time sensitive bits are done in [04:51.160 --> 04:56.420] hardware and nothing more. The PHY handles all of the bits that actually do 802.11 data. [04:57.060 --> 05:00.840] So it handles stuff that goes over the air. So it does the clear channel detection to [05:00.840 --> 05:05.800] figure out when it can transmit. It does signal detection and signal sizing, antenna [05:05.800 --> 05:12.880] selection, all the encoding and decoding. It handles all the MIMO stuff. The important [05:12.880 --> 05:18.460] thing here is there's one massive PHY in the 11N chips. And for each physical radio, there's [05:18.460 --> 05:23.780] one set of FFTs and IFFTs going on. And then it funnels all of that crap into one ginormous [05:23.780 --> 05:30.540] PHY that's doing all of the signal correlation and processing in silicon inside the PHY. [05:30.840 --> 05:35.920] And it's kind of scary to look at. The radio handles all the RF synthesis and there's some [05:35.920 --> 05:40.260] back chat between the PHY and the radio that I can't talk about. But most of that's to [05:40.260 --> 05:44.440] do with automatic gain control and signal sizing. So every time that you receive a packet, [05:44.440 --> 05:49.660] the first thing the receiver needs to do is figure out how to size the packet to size [05:49.660 --> 05:56.100] the signal so that it fills the dynamic range of the ADC but it doesn't saturate it to the [05:56.100 --> 06:00.620] point of distorting and screw up receiving it. So there's a lot of fine and coarse grain [06:01.280 --> 06:06.820] automatic gain control going on per packet and per antenna as well on the earlier chips. [06:07.320 --> 06:11.400] There's some filtering going on, and I'll talk about that later. In the earlier chips, [06:11.400 --> 06:16.340] if you've ever popped off the metal shield, there will be two chips. And the first one [06:16.340 --> 06:21.740] is like the AR5212, which implements everything except the radio. And then they put the radio [06:21.740 --> 06:28.220] in an external part. So you have a 2 gig part and a 5 gig part and then a 2 and a 5 gig part. [06:28.620 --> 06:33.360] And the really early stuff actually generated 2 gig first and then upscaled 2 gig to 5 gig [06:33.360 --> 06:38.800] in a separate part. And all of that's gone away now. So with improvements with figuring [06:38.800 --> 06:44.820] out how to do analog crap inside the same chip, they have one die that has either one [06:44.820 --> 06:51.000] or more bits of silicon inside the packaging that does all of the stuff, including base [06:51.000 --> 07:00.800] band resistance and RF. So anything that's 11N after the AR9160 is all one chip. And [07:00.800 --> 07:05.940] that leads to quite a lot better sensitivity. So just as a side note, the chips get more [07:05.940 --> 07:10.080] sensitive on the receive side the further up the chain you go. So I do my wireless sniffing [07:10.080 --> 07:16.700] with AR9280 and AR9380. They have ridiculously sensitive receive sides. And the only thing [07:16.700 --> 07:22.180] that the radio communicator updates, you can program the radio directly, but you only [07:22.180 --> 07:27.320] do that to configure the synth. You don't actually touch it after that. And the RTC [07:27.320 --> 07:36.600] handles all the crap dealing with clock generation. What the hell just happened there? Tech support. [07:37.660 --> 07:50.180] Swipe. So the RTC handles only clock generation. So that handles if it's in 5 meg, 10 meg, [07:51.600 --> 07:57.100] keep going, yeah. You know, the chips can do 5 meg, 10 meg, 20 meg, 40 meg channels. [07:57.100 --> 08:00.800] And so one of the parts of figuring out how to do that is they actually clock the chip [08:00.800 --> 08:06.140] at a different rate. And that can happen dynamically as well when you're doing 20 meg to 40 [08:06.140 --> 08:12.040] meg dynamic packet stuff in 11n. So the only thing that you can program when you put the [08:12.040 --> 08:15.820] chip to sleep is the RTC. And the only thing you can tell the RTC to do is wake up the [08:15.820 --> 08:21.240] chip. And so when you're actually a laptop doing power save and you want to put the chip [08:21.240 --> 08:25.340] to sleep and have the chip wake up when the access point says there's something for it, [08:25.340 --> 08:29.760] this is the thing you're fiddling with. And the host interface glues all that crap together. [08:29.760 --> 08:33.520] So it's probably not interesting for most of the stuff that people are doing with these [08:33.520 --> 08:38.560] things. But a lot of the bugs that pop up is because there's issues with the PCIe power [08:38.560 --> 08:43.720] save on the chip and the laptop getting out of whack and causing the device to go away. [08:44.580 --> 08:53.740] So the Mac in detail. No one uses anything before the AR5212 these days. And so I'm not [08:53.740 --> 08:57.320] going to worry about the early stuff. But the new stuff has 10 transmit queues and one [08:57.320 --> 09:03.240] receive queue. And the new and newer stuff has two receive queues. They're implemented [09:03.240 --> 09:08.960] in a priority scheme. So the lowest transmit queue has the lowest priority and gets preempted [09:08.960 --> 09:17.060] by successively higher queues. Q9 is always for multicast traffic that happens after beaconing [09:17.060 --> 09:21.860] and Q10 is always the beacon queue and you can't change that. And as I said before, they're [09:21.860 --> 09:25.460] split into two halves. There's the control unit and the queue control unit and the data [09:25.460 --> 09:30.240] control unit. The QCU handles all the stuff that has to do with timing and 802.11. So [09:30.240 --> 09:35.900] if you're doing things like wanting to have long transmit bursts, you program the QCU [09:35.900 --> 09:41.680] and that handles starting, like, gating the DMA to start, doing the 802.11 stuff to say [09:41.680 --> 09:47.420] I want to start transmitting, programming the nav in the air to reserve the air time [09:47.420 --> 09:52.750] so you can actually do an 802.11 QOS transmit burst. That's all done by the QCU. And the [09:52.750 --> 09:59.190] QCU is just gated and doing the DMA. And the receive side is pretty simple. You program [09:59.190 --> 10:05.110] in where you want the DMA descriptors to and it just happily DMAs received packets in ‑‑ [10:05.110 --> 10:08.050] the thing I haven't mentioned here that I should is that there's a filter for filtering [10:08.050 --> 10:11.550] out packets. This is one of the first things that gets interesting for what you guys are [10:11.550 --> 10:15.850] doing with this stuff. Because the filter bits let you do interesting things like give [10:15.850 --> 10:20.990] me only stuff for my associated station, but you can also just say give me everything. [10:20.990 --> 10:25.270] Which is actually kind of useful, especially with what you guys are doing. You can also [10:25.270 --> 10:30.770] say give me everything including management traffic, which means you see RTS and CTS and [10:30.770 --> 10:35.850] ACK frames, which you wouldn't normally see because that sort of stuff is not data related. [10:35.850 --> 10:41.510] But if you're doing, like, driver development like me or spoofing crap like you guys, you [10:41.510 --> 10:46.550] may want to actually see RTS, CTS, you may want to generate ACK frames, see ACK frames [10:46.550 --> 10:51.650] come in. On the later chips, they have a high priority queue and a low priority queue. Not [10:51.650 --> 10:55.410] very interesting for most people. The reason the high priority queue exists is so that [10:55.410 --> 11:01.070] low latency frames like power save data frames can preempt, like, having a large backlog [11:01.070 --> 11:04.830] of, you know, bulk received data frames coming in another queue. So unless you're writing [11:05.030 --> 11:09.150] a station driver, it's probably not that important. So the fire is where things get a little bit [11:09.150 --> 11:14.250] more interesting. Because it's all done in hardware, and once the chip ships, they can't [11:14.250 --> 11:21.370] change it. There's, like, a thousand registers in the damn thing, and some of them per radio. [11:21.370 --> 11:27.310] So you end up being able to tune pretty much every piece of behavior of the fire. And as [11:27.310 --> 11:30.770] they figure out that there's more weird shit going on in the real world, they'll add more [11:30.770 --> 11:35.850] registers to give you the ability to twiddle things so that when they deliver the chip [11:35.850 --> 11:40.670] and they find that stuff in the real world starts acting nasty, they can actually modify [11:40.670 --> 11:45.790] the fire behavior by shipping a driver update. So the interesting things for people wanting [11:45.790 --> 11:51.830] to screw with Wi‑Fi is being able to do things like override signal levels. So when [11:51.830 --> 11:56.310] people are doing long distance links, they're always going to hear weak signals. They may [11:56.310 --> 12:02.230] want to have fine grained control over making the AGC sensitive to far away low level packets. [12:02.230 --> 12:07.550] But if you're in an environment like this, you may only want to receive packets that [12:07.550 --> 12:11.610] are close by and not spend time trying to figure out if the packet is far away. So you [12:12.010 --> 12:19.070] can program that and the chip will actually implement gain control based on stepping sizes [12:19.070 --> 12:23.890] and timing. CCA is something I keep being asked how you disable. So you can just transmit [12:23.890 --> 12:27.690] whenever the hell you want. There's a register. If you read the driver, you'll figure out [12:27.690 --> 12:31.170] which register you programmed to have it disable clear channel. But I'm not going to tell you [12:31.170 --> 12:38.830] how to do it. But you can actually set the CCA threshold for exactly what level it should [12:38.830 --> 12:43.690] be considering the air that's busy. And that has actually changed over time. So it is configurable. [12:44.650 --> 12:50.070] You can do per packet transmit power. So you can actually set the card to transmit at a [12:50.070 --> 12:54.290] high power. But for things that are close by, you can actually lower the transmit power [12:54.290 --> 12:57.990] per packet. So you can do things like confuse people doing Wi‑Fi positioning. Because [12:57.990 --> 13:02.170] they're typically doing, if you're doing it using open source tools, they'll be doing [13:02.170 --> 13:06.330] it using signal strength. And if someone's screwing with their transmit power, all of [13:06.330 --> 13:10.570] that stuff breaks down. The interesting things if you're looking to [13:10.570 --> 13:14.470] twiddle with a lot of this stuff is looking at the calibration and the noise immunity [13:14.470 --> 13:19.170] code. If you read the patents on those and the code, you'll actually get a pretty good [13:19.170 --> 13:27.090] description of how the Atheros FI works. Because all the pre‑core patents cover the FI design [13:27.090 --> 13:31.150] in quite good detail. So I recommend anyone that's interested to read that. [13:31.310 --> 13:38.170] And the RF synth is the final bit here. It does, well, the RF bits. The stuff pre‑Merlin [13:38.170 --> 13:43.270] or pre‑AR9280, you don't get to pick which frequencies you tune to. You only get to tune [13:43.270 --> 13:49.390] to what are pretty much the 802.11 channel offsets. The latest stuff, so AR9280 and later, [13:49.390 --> 13:55.910] let you tune to very, very small fractional increments. The thing to keep in mind is, [13:55.910 --> 13:59.750] and I'll cover this soon, is just because you can tune to those frequencies doesn't [13:59.750 --> 14:06.390] mean that you can actually use them. It also has a configurable width filter for both receive [14:06.390 --> 14:10.630] and transmit. So on the receive side, so it filters out crap from adjacent channels. And [14:10.630 --> 14:15.650] on the transmit side, it actually prevents the transmitter from spewing crap outside [14:15.650 --> 14:20.050] the configured channel width. And when you're trying to do half and quarter rate stuff for [14:20.050 --> 14:22.830] really long distance links, this stuff is actually pretty important. [14:23.650 --> 14:29.350] So now we get to the why. Why do people like these things? And in short, everything inside [14:29.350 --> 14:34.790] is exposed. And because they needed to make it so that they could ship software driver [14:34.790 --> 14:40.030] updates to modify behavior, the chip pretty much lets you get away with bloody murder. [14:40.410 --> 14:46.050] So the only thing that happens is the stuff that offloading would be a pain in the ass. [14:46.050 --> 14:53.310] So you pretty much get the raw 802.11 frames going in and out of the device. There's no [14:53.310 --> 15:01.690] DSP, there's no CPU in the non-mobile products. So everything has to be done locally. So on [15:01.690 --> 15:08.130] the transmit side, you do give it a raw 802.11 frame. Everything from the source MAC address [15:08.130 --> 15:13.970] onwards gets dumped into memory and that will just appear on the air. The chip doesn't care [15:13.970 --> 15:19.310] what you put into it. The only thing you have to worry about is the magic alignment constraints. [15:19.310 --> 15:24.430] But you could pick a random MAC address to transmit from and it will dutifully send that. [15:24.590 --> 15:29.390] So this is why these things are good for injection because they're not enforcing any kind of [15:29.390 --> 15:34.730] source address verification inside the chip. So if you screw up, then you're screwed. But [15:34.730 --> 15:38.870] if you want to specifically spoof other things, you can. And people have used this for all [15:38.870 --> 15:44.830] kinds of interesting things. One common thing that people don't do when they want to be [15:45.210 --> 15:49.050] a naughty device is they won't disable ACK generation. So if I want to go out and see [15:49.050 --> 15:55.330] if there are anything nasty out there, I can actually send probe requests to station MAC [15:55.330 --> 16:00.790] addresses and the hardware will ACK it for you. And you won't know because you're just [16:00.790 --> 16:06.010] simply a driver and the driver doesn't handle ACKs. You can turn off ACKing in the chip. [16:06.010 --> 16:10.230] So if someone tries sending you a packet, even if the driver tosses it later, you still [16:10.230 --> 16:16.550] don't want to necessarily ACK the packet and tell someone you're there. You can also disable [16:16.550 --> 16:21.490] FCS checks so you don't have to opt to the receive side thing. It's no big deal. And [16:21.490 --> 16:27.830] you get to do things like per packet transmit control. Interesting. Okay. On the receive [16:27.830 --> 16:33.350] side, you get everything. So it's all based on what you get with what you configure in [16:33.350 --> 16:37.230] the filter. But if you turn on the promiscuous and the mismanagement bits in the driver, [16:37.230 --> 16:41.990] you get every frame. And if you disable FCS checks, it will give you every frame including [16:41.990 --> 16:46.150] all the errors in the frame. And there have been research papers that actually look at [16:46.150 --> 16:51.830] what kinds of bit errors occur in packets and they all use a Theros stuff because it's [16:51.830 --> 16:56.670] the only chips you get that let you do this kind of tricky shit. So what other things [16:56.670 --> 17:02.130] can the chips do that are interesting? So I'm going to gloss over them because I only [17:02.130 --> 17:07.570] have like 30 minutes to talk about this stuff. And there are a lot of other stuff that I [17:08.590 --> 17:13.030] if you want to find out, come and see me. But the chips have to be both a station chip [17:13.030 --> 17:17.570] and an access point chip. And later chips want to be a station chip and an access point [17:17.570 --> 17:23.790] chip and do ad hoc for P2P Wi-Fi stuff. So in order for all of that crap to exist, there [17:23.790 --> 17:29.150] has to be support in the chip for things like tracking multiple TSF counters. So if you're [17:29.150 --> 17:35.110] trying to do ad hoc and station, you need to have one TSF counter synced to the access [17:35.110 --> 17:39.910] point and a second one running your ad hoc network. The more interesting stuff for people [17:39.910 --> 17:44.930] doing naughty things is things like the AN9280 spectrum analysis mode where you can [17:44.930 --> 17:50.770] actually get the chip to give you per OFDM bin power readings. So a lot of the enterprise [17:50.770 --> 17:57.290] products will actually have a nick in there specifically to pull out the spectrum data [17:57.290 --> 18:02.230] from the current channel so they can make decisions about how dirty the channel is. If [18:02.230 --> 18:07.910] you're doing it based on RSSI only, you're only getting an idea of how much Wi-Fi traffic [18:07.910 --> 18:11.190] there is on a particular channel. But if you use the spectrum node, you can see things [18:11.190 --> 18:18.190] like microwaves and cordless phones and other kinds of noise generation devices that the [18:18.190 --> 18:24.690] chip will treat as noise but won't give you a receive packet for anything. So I use this [18:24.690 --> 18:28.770] for a lot of debugging and it's good to see things like microwaves in action. And the [18:28.770 --> 18:33.130] later chips actually have Wi-Fi positioning hacks so you can do fine grain packet time [18:33.130 --> 18:37.130] stamping and actually do time delay between transmitting a packet and getting the act [18:37.130 --> 18:41.790] back so you can actually estimate distance down to a few feet. And that's the kind of [18:41.790 --> 18:46.410] crap that powers your enterprise APs tracking you walking around. It's all in these things. [18:47.550 --> 18:51.790] Now the things that you're not supposed to do, and I'm not going to tell you how, they're [18:51.790 --> 18:56.590] required for regulatory compliance. So you're all pretty spoiled. You buy a laptop and it [18:56.590 --> 19:00.330] works and you don't necessarily see the crap that goes on behind the scenes. And what goes [19:00.330 --> 19:04.690] on behind the scenes is submitting it to the FCC and getting the thing verified that it's [19:04.690 --> 19:09.310] actually behaving correctly or correctly. So one of the things that happens is you need [19:09.310 --> 19:13.910] to be able to verify that your chip is transmitting on a particular center frequency and not drifting [19:13.910 --> 19:19.150] over time. Otherwise it's not going to interoperate well with other devices. So you can actually [19:19.150 --> 19:24.890] put the chip into a just blurs crap out mode and just blurs out a tone. Now if you did [19:24.890 --> 19:27.990] this in the real world, the Wi-Fi in your area shuts down. It's actually kind of pretty [19:27.990 --> 19:31.730] to watch. The minute you transmit a carrier tone at maximum frequency, you don't care [19:31.730 --> 19:38.010] about distortion, no one else's Wi-Fi works. Don't do it. I'm just telling you don't do [19:38.010 --> 19:41.730] it. What you do is your own problem, but don't do it. You need to know how to do these if [19:41.730 --> 19:45.810] you're submitting your equipment for FCC testing. And I'm pretty sure most of the crap that [19:45.810 --> 19:50.410] we buy where they just take a Theros nick and shove it into an existing design like [19:50.550 --> 19:54.970] a board and make it work, that's not actually being FCC tested. Getting something FCC tested [19:54.970 --> 19:59.710] isn't getting an FCC tested nick, it's actually getting the enclosure and the antenna tested [19:59.710 --> 20:03.850] as part of a product. So they end up having to implement this stuff and then prove it. [20:03.930 --> 20:08.570] The other interesting thing is you actually get to put the nick into debug modes where [20:08.570 --> 20:13.790] you get to inject and receive raw ADC data. It's useful for doing calibration, but it's [20:13.790 --> 20:18.130] not useful for doing any other kind of spoofing, at least not from what I've been doing. And [20:18.130 --> 20:23.150] so most of the time you're feeding the chip a sine wave and you're trying to calibrate [20:23.150 --> 20:27.810] the chip to make sure that what the DAC gets back is an accurate sine wave. And so we put [20:27.810 --> 20:32.090] the chip in the debug mode, feed it a constant sine wave, pull out 4K of sample data at a [20:32.090 --> 20:38.590] time and make sure the chip is doing its thing. Now I'm going to cover a couple of things [20:38.590 --> 20:41.630] that people keep asking me about doing and why it's a good idea and why it's not a good [20:41.630 --> 20:45.370] idea. And the most common question I get asked is how the fuck do I break regulatory [20:45.370 --> 20:49.650] requirements? You know, I have this chip, it can do a lot more power, it's the regulatory [20:49.650 --> 20:54.550] requirements and the chip calibration limits me to transmitting to quite a few dB less [20:54.550 --> 21:00.530] than what the chip is apparently capable of doing. Why is this a problem? The main reason [21:00.530 --> 21:06.930] is you don't have the equipment. Who here has an actual 6 gig spectrum analyzer and [21:06.930 --> 21:15.530] power meter? Anyone? Right. That's a minimum 30 grand entry fee to actually screwing with [21:15.530 --> 21:19.850] transmit power. Because if you don't have that, you don't know if your device is actually [21:19.850 --> 21:24.390] distorting when it transmits. So the first thing is that you got to have the right equipment [21:24.390 --> 21:28.930] to actually measure this. The main reason is that people think about is the regulatory [21:28.930 --> 21:32.830] requirements. The two parts are there's a maximum amount of power you can inject into [21:32.910 --> 21:39.410] a channel and because Wi-Fi looks like that funny, like, spectrum, that has like a defined [21:39.410 --> 21:43.570] mask when you look at it on a spectrum analyzer, you need to make sure you don't transmit power [21:43.570 --> 21:49.270] into an adjacent channel that's higher than a certain level. And the specs, the 802.11 [21:49.270 --> 21:53.470] and the regulatory specs typically say what the maximum amount of power you can inject [21:53.470 --> 21:58.630] in adjacent channels before your device is out of compliance. The other thing is that [21:59.150 --> 22:05.190] RF is really weird. And at 5 gig, RF is extremely weird. And one of the weird things is that [22:05.190 --> 22:10.910] trying to find components that will stay linear over 1 gigahertz worth of 5 gig bandwidth [22:11.350 --> 22:16.470] is exceedingly hard to do. And trying to design an RF circuit that's linear over that requirement [22:16.470 --> 22:23.470] is exceedingly hard to do. So trying to make sure that your design has both 2 gig and 5 [22:23.470 --> 22:29.810] gig amplifiers that remain linear over the course of that entire bandwidth is actually [22:29.810 --> 22:36.010] hard. And what tends to happen when you look at the output distortion is it's not straight. [22:36.010 --> 22:41.070] It does this or it does this or it's wavy. And so as part of the card calibration, they'll [22:41.070 --> 22:47.570] actually pick the maximum transmit power that you can do per channel based on what the actual [22:47.570 --> 22:51.590] card when you test it gives you distortion wise. They'll say anything more than this [22:51.590 --> 22:56.010] much power at this frequency drives the transmitters into nonlinear, some kind of nonlinear behavior [22:56.010 --> 23:04.170] that have to drop the transmit power. The third thing is that transmitting on 3 antennas [23:04.170 --> 23:09.730] like half a watt is actually pretty power hungry. And most of the stuff that you're [23:09.730 --> 23:15.870] plugging into isn't designed for lots of periodic bursts of a couple of amps worth of power. [23:15.870 --> 23:22.230] And so the power that your slot can provide you is typically less than what you're using [23:22.230 --> 23:29.530] to transmit. And the power requirements change based on the channel and what kind of thing [23:29.530 --> 23:35.850] you're transmitting. And this is all the crap that gets looked at in the lab. So the power [23:35.850 --> 23:43.170] consumption varies quite a lot and decoupling caps only work so well. And so when figuring [23:43.170 --> 23:49.190] out can I overclock, the answer is maybe. Even inside regulatory, even if your card [23:49.190 --> 23:53.150] is doing 2 or 3 dB less than the regulatory requirements say, sure. That doesn't mean [23:53.150 --> 23:58.570] that the card can actually do it. So I highly recommend that you get some, loan some equipment. [23:58.750 --> 24:03.590] And the other thing is all of the high powered NICs I've seen, they'll actually have a 5 [24:03.590 --> 24:07.970] volt input on them specifically coming from some external source that's not the USB or [24:07.970 --> 24:14.250] the PCIe slot. And so you know you have a real high powered NIC if it actually has some [24:14.250 --> 24:18.490] external source. You plug it into a mini PCIe slot, the card says it can do half a watt, [24:18.490 --> 24:24.910] it's probably distorting. The next thing people ask me to do is can I make it tune to like [24:24.910 --> 24:32.130] 6 gig or 4.8 gig or like can I pick a tuning that isn't the channels to tune on. And the [24:32.130 --> 24:37.490] short answer is sure. The long answer is we only calibrated the NICs for specific channels. [24:37.490 --> 24:42.870] For all the reasons I just talked about. And yeah, you can pick arbitrary frequencies to [24:42.870 --> 24:47.690] tune the chips to, but not only has it not been tested and you may damage things, the [24:47.690 --> 24:53.490] RF synth, RF is weird and as you change the RF synth, it's doing digital, like there's [24:53.570 --> 24:57.870] a PLL and it's doing digital upscaling and it may generate noise spurs all over the place [24:57.870 --> 25:02.030] based on the current setting of the RF synth and what the devices are and which bits you've [25:02.030 --> 25:06.770] turned on or off. So they actually test this stuff in the lab to say okay, this particular [25:08.190 --> 25:13.270] synthesis setting for this particular Wi-Fi channel meets the requirements of low spurs [25:13.270 --> 25:17.970] and low distortion and it's actually accurate. And you could tune it to arbitrary frequencies, [25:17.970 --> 25:22.130] but unless you test it, what you may actually be doing is damaging things, you may be actually [25:22.130 --> 25:26.750] generating more noise and the thing may actually be drifting more than you'd like. So if you [25:26.750 --> 25:31.610] get a fiddle with this for fun, get a spectrum analyzer and actually test this stuff. [25:33.230 --> 25:37.550] The next thing that people ask me is how do I make my NIC work with the microwaves on [25:37.550 --> 25:41.930] or how do I have it do a long distance link? And all I'm going to tell you here is read [25:41.930 --> 25:47.370] the noise immunity code because it actually twiddles all of the hardware inside the thing [25:47.370 --> 25:54.510] for tuning signal sensitivity. And so the NIC gets a handful of microseconds during [25:54.510 --> 26:00.770] the preamble to lock on to the Wi-Fi signal and figure out the right signal size. If you're [26:00.770 --> 26:06.050] trying to do things like receive long distance traffic and local traffic which is quite high, [26:06.050 --> 26:09.870] the NIC doesn't have a lot of time to figure out what the right gain settings are. So when [26:09.870 --> 26:15.310] I'm doing this stuff, and I know that I have a mix of long and far traffic, I'll have a [26:15.310 --> 26:19.950] NIC doing long only traffic and I'll have a NIC doing local only traffic so that I have [26:19.950 --> 26:27.070] a higher percentage of being able to see far away packets before the preamble stops and [26:27.070 --> 26:32.690] the packet starts and reception sucks. So if you're experimenting with noisy environments [26:32.690 --> 26:38.130] and long distance weak signals, look at the ANI code and read the patent. And I think [26:38.130 --> 26:42.310] this is the last thing on the playing around bits. So a couple of years ago when I was [26:42.310 --> 26:46.550] working there, we actually got the spectrum analysis stuff open source. So it's in BSD [26:46.550 --> 26:50.110] and it's in Linux. There are open source tools for pulling the stuff out. So all those pretty [26:50.110 --> 26:55.010] waterfall things you get from like the ubiquity access points, we put them into waterfall [26:55.010 --> 26:59.610] mode and you get a channel thing. All it's doing is it's putting the NIC into spectrum [26:59.610 --> 27:06.230] mode and scanning over all the channels. And so if you want to actually do it on a Theros [27:06.230 --> 27:10.510] NIC without needing to have any other equipment, you can get a pretty good coarse grain idea [27:10.510 --> 27:14.670] of what channels are busy, what channels are worth looking at, what's Wi-Fi and what's [27:14.670 --> 27:21.410] not Wi-Fi. And as I said, it's all open source. The thing to keep in mind is the same block [27:21.410 --> 27:26.150] doing FFT is used for RX and spectral mode. So you can't receive packets at the same time [27:26.150 --> 27:30.310] you're actually doing FFT investigations. When you trigger an FFT, sorry, when you trigger [27:30.470 --> 27:35.030] a spectrum sample, it doesn't do receive for that period. So I'll use two NICs. And a lot [27:35.030 --> 27:39.750] of the enterprise hardware will actually put a second NIC in there, cheaper NIC, specifically [27:39.750 --> 27:45.190] to do spectrum analysis in order to pick the right channel to work on. And I don't think [27:45.190 --> 27:48.710] any of the open source access point products currently do this, but all the source code [27:48.710 --> 27:53.430] is there. If you want to play, then have a play. Now, I see a lot of people walking [27:53.430 --> 27:58.630] around with a Theros NICs hanging out of their laptops. And so I figured I'd talk a bit briefly [27:58.630 --> 28:03.550] about what's actually going on under the hood in these things. So all the HTC parts have [28:03.730 --> 28:09.930] a little 10 silica CPU that's sort of MIPSy and a normal bonafide, honest to God, a Theros [28:09.930 --> 28:15.970] Wi-Fi chip in it. So all the crap I just talked about, you can do with the USB NICs. So yes, [28:15.970 --> 28:20.610] you can do spectrum analysis with the HTC NICs. Yes, you can vary transmit power. Yes, [28:20.610 --> 28:27.810] you can do all the fiddling with it. The early, the first USB stuff had an actual separate [28:27.810 --> 28:34.290] CPU and PCIe NIC, the AR9280. And the one that I think everyone has is the single band, [28:34.290 --> 28:39.330] single antenna AR9271, which is slightly cut down, but it still does all the same stuff. [28:39.330 --> 28:46.330] You can still do spectrum analysis, radar, not radar detection without 5 gig, all the [28:46.330 --> 28:57.270] same debug modes, all the same signal level stuff. So the driver in Linux mostly treats [28:57.270 --> 29:01.670] the USB widget as a dumb DMA pipe and it knows a little bit about station stuff so it can [29:01.670 --> 29:08.290] do frame retransmission in the NIC for doing TX aggregation and rate control, but we're [29:08.290 --> 29:13.030] trying to strip that out because the number one reason why you can't run more than 8 stations [29:13.030 --> 29:15.950] on one of those NICs in access point mode is because there's a limited amount of RAM [29:15.950 --> 29:22.290] on the NIC. But again, the CPU can act as a dumb DMA pipe and the plan is to do that [29:22.290 --> 29:27.630] and then we can have as many stations as the driver allows you. And that's actually open [29:27.630 --> 29:31.450] source now. The firmware is open source. So if people are interested in doing things like [29:31.450 --> 29:36.770] running custom code inside the firmware on the USB NIC, you can actually do that. It [29:36.770 --> 29:42.630] uses the open source, tens of GCC tools. I'll put the GitHub repo up here soon. You can [29:42.630 --> 29:47.190] build it, you can install it, you can fiddle with it. If people have questions about what [29:47.190 --> 29:52.690] kind of weird crap they want to do with their NICs, please let me know. I was going to do [29:53.050 --> 29:56.510] like a walk through the hell and show you guys how the thing holds together and what [29:56.510 --> 30:00.150] to look at, but unfortunately there have been some significant technical issues in getting [30:00.150 --> 30:06.170] things to work. So I'll finish by putting up where the source [30:06.170 --> 30:12.410] code is. And everyone takes photos. So Qualcomm and Theros actually put up a GitHub repo a [30:12.410 --> 30:17.370] couple of years ago that they're putting all of their projects inside. And everything except [30:17.370 --> 30:23.490] the cell phone software firmware and the 11AC firmware is currently up there. Including [30:23.490 --> 30:30.350] firmware for their pre-11N USB NICs. I think it was a 5523, yeah. None of us have actually [30:30.350 --> 30:34.370] used it. Like, the hardware's out there and there's a driver for it. The firmware's out [30:34.370 --> 30:39.450] there. It's a normal Theros device with a little MIPS CPU in there. So it's all documented. [30:39.690 --> 30:44.590] The only thing that they haven't opened up is Bluetooth, mobile, and 11AC. And the common [30:44.590 --> 30:48.730] question I then get at this point is, what the hell are we going to do about 11AC? Well, [30:48.730 --> 30:53.810] I don't work there. So I decided to sign the NDA to get source code access. So I have source [30:53.810 --> 30:59.350] code access, but it's not public. The source code isn't public, but if you sign the NDA, [30:59.350 --> 31:04.270] you can get access to the firmware source and it looks like a Theros chip with a little [31:04.270 --> 31:11.390] CPU inside, as everything else does. The aim behind a bunch of us that are looking at this [31:11.390 --> 31:15.550] and admittedly I haven't done very much, but I plan on stepping this up around September [31:15.550 --> 31:19.190] is instead of there being, what we don't want to see is a lot of little individual companies [31:19.190 --> 31:23.270] publishing their own firmware blobs and suddenly it's like, I have to use company A for station [31:23.270 --> 31:28.170] mode and company B for access point mode and company C for mesh mode and there's a dozen [31:28.170 --> 31:32.070] different firmware blobs and a dozen different versions of the Linux driver to support things. [31:32.070 --> 31:37.210] Our plan is to have one tree that we all share internally inside the little NDA enabled group [31:37.210 --> 31:44.270] and ship one binary firmware image so that we're not duplicating effort. The 11AC hardware [31:44.270 --> 31:50.870] is actually pretty cool. So if people here are interested in doing 11AC product developments, [31:50.870 --> 31:53.830] the hardware will do meshing if you want to spend some time doing it, the hardware will [31:53.830 --> 31:58.410] do all the other stuff that you guys are used to, please contact me and I'll bump you [31:58.410 --> 32:04.870] over to the open source group and you can sign in and have a chat with them. So the [32:04.870 --> 32:10.670] NDA program, I get a lot of cool hardware. Mostly because I import free BSD for fun. [32:11.770 --> 32:15.550] There's an open source NDA program where you get access to their internal reference drivers [32:15.550 --> 32:20.030] and if you're really nice and not jerk faces, they'll give you data sheet access and you [32:20.030 --> 32:25.750] can talk to the developers. But they're all pretty busy people, so I don't recommend shouting [32:25.750 --> 32:31.470] them too many questions. If you can talk to the other people like me who have NDA access, [32:31.470 --> 32:37.170] we're quite happy to solve problems that would normally take time away from the hardware [32:37.170 --> 32:41.530] developers. If you're really, really nice, then they'll actually give you reference design [32:41.530 --> 32:48.930] boards. So they actually want to see, there's a group inside of QCA that actually wants [32:48.930 --> 32:54.250] to see more open source stuff. They have a pretty heavy OpenWRT group inside of there, [32:54.710 --> 33:00.470] bringing their stuff up with OpenWRT and pushing things upstream. So if anyone here is actually [33:00.470 --> 33:04.030] looking at doing new product development and thinking of a thorough stuff, the place to [33:04.030 --> 33:08.330] start is by talking to these peeps, getting them to, getting a good relation with them. [33:08.330 --> 33:12.230] They're down in San Jose, near the San Jose airport, so it's worthwhile having lunch with [33:12.230 --> 33:15.630] them and actually talking about the sort of stuff that you're doing and they're doing. [33:15.630 --> 33:19.950] And then lawyers are actually kind of cool. All the lawyers inside of Atheros that I worked [33:19.950 --> 33:24.230] with and still do here and there, they're the ones that got us access to all of this. [33:24.390 --> 33:28.550] They're the ones that approved all of this firmware access and source code access. So [33:28.550 --> 33:33.590] they're pretty clued in about open source and working with the community. So if you'd [33:33.590 --> 33:38.070] like to join, let me know. You can find me on the internet, it's not that hard. And we'll [33:38.070 --> 33:45.390] set stuff up inside of QCA for you to talk to them about stuff. I am trying to get together [33:45.490 --> 33:49.310] a group of people to actually do open source Wi-Fi development stuff in the Bay Area because [33:49.310 --> 33:54.450] there seems to be a lot of interest, but lots of little disparate groups, you know, groping [33:54.450 --> 33:58.210] around in the dark and not necessarily knowing what's going on. So if anyone is interested [33:58.210 --> 34:02.470] in coming to the Bay Area sometime later on this year and actually meeting some of the [34:02.470 --> 34:06.350] people involved in this and collaborating on learning how the hardware works and what [34:06.350 --> 34:10.310] you can do with it and the open source drivers and Linux and other operating systems, let [34:10.310 --> 34:16.730] me know. And if there's enough interest, I'll finish putting it together. Any questions? [34:19.870 --> 34:32.140] It's either a good sign or a bad sign. We ran out of time. Cool. Well, you know, the [34:32.140 --> 34:36.920] hardware is open and it's a long cry from how it looked 15 years ago. Yes? [34:40.680 --> 34:52.190] Okay. So the reason why, if you're doing 802.11 stuff, this is good for doing data stuff [34:52.190 --> 34:58.370] because it's this big. And anyone who's tried doing actual 802.11 MIMO 11N decoding in SDR, [34:58.830 --> 35:04.150] your entry level is an actual FPGA board. And like the FPGA boards that we use, there [35:04.770 --> 35:11.050] are like two of these sized FPGA boards running the Wi-Fi bit set quite a lot slower because [35:11.050 --> 35:19.190] they're FPGAs. So if you're trying to do like 20, 40, 80MHz 11AC stuff using an SDR, you're [35:19.190 --> 35:24.190] probably not going to be doing it at full speed, not with current hardware. The thing [35:24.190 --> 35:28.370] to keep in mind is, you know, if you want to be doing a 20MHz channel, your SDR has [35:28.370 --> 35:34.410] to be sampling at at least 40 and maybe more. And so, you know, 11AC starts at 40 and goes [35:34.410 --> 35:40.150] up to 80. And when you're doing 160MHz, suddenly you're going to have to have like 320MHz wide [35:41.930 --> 35:46.950] stuff. And that's a lot of data. And then you have I and Q and you split that off and [35:46.950 --> 35:52.110] you get two streams of data and then you have IQ per radio chain and that spirals off into [35:52.110 --> 35:58.430] hell, right? So for doing 802.11 sniffing, these chips are pretty good. If you're doing [35:58.430 --> 36:03.770] general signal analysis, these chips are not designed for doing general signal analysis. [36:04.550 --> 36:11.570] But they're like $2 on eBay. So, yeah. Any other questions? [36:12.710 --> 36:14.590] Cool. Well, thanks.