From owner-freebsd-wireless@freebsd.org Thu Oct 31 20:15:39 2019 Return-Path: Delivered-To: freebsd-wireless@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB36816517A for ; Thu, 31 Oct 2019 20:15:39 +0000 (UTC) (envelope-from ashafer@badland.io) Received: from badland.io (badland.io [178.128.156.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 473xQg0kNpz3Hlx for ; Thu, 31 Oct 2019 20:15:38 +0000 (UTC) (envelope-from ashafer@badland.io) Received: from [10.155.4.85] (unknown [152.7.255.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by badland.io (Postfix) with ESMTPSA id 09552B43B0; Thu, 31 Oct 2019 16:05:32 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: Best way to explore the 802.11 rtwn source code? From: Austin Shafer In-Reply-To: Date: Thu, 31 Oct 2019 16:05:33 -0400 Cc: freebsd-wireless@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <512B62A4-CCB7-4C05-A988-0E19443A2DD0@badland.io> References: <1F9F7008-59C4-42DF-AF1E-0028BD9576F5@badland.io> To: Farhan Khan X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 473xQg0kNpz3Hlx X-Spamd-Bar: ++++++++ X-Spamd-Result: default: False [8.85 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(0.00)[badland.io:s=dkim]; GREYLIST(0.00)[pass,body]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(0.00)[+mx:c]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.37)[asn: 14061(1.91), country: US(-0.05)]; RECEIVED_SPAMHAUS_XBL(5.00)[194.255.7.152.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.4]; BAD_REP_POLICIES(0.10)[]; NEURAL_SPAM_MEDIUM(0.98)[0.981,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[badland.io:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(0.00)[badland.io,reject]; NEURAL_SPAM_LONG(1.00)[1.000,0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; SUBJECT_ENDS_QUESTION(1.00)[]; ASN(0.00)[asn:14061, ipnet:178.128.144.0/20, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-Spam: Yes X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2019 20:15:39 -0000 Hi Farhan, Thanks for the reply! > rtwn is a bit more complicated than other drivers. Any rtwn device = will > require at least three drivers: The PCI or USB driver, the general = rtwn > driver which contains shared code, and the device-specific driver. = While > I'm sure you can follow the code, I would suggest starting with = something > a bit simpler. I learned the hard way :) Yep I=E2=80=99ve noticed that pattern in other drivers, particularly the = i2c hid driver I messed around with. What's a good example of a "simple" driver? > One good approach would be to take a simple driver, look at its = ieee802com > object, and see what avenues the ieee80211 stack has to interact with = the driver. > I would learn about the powering on process, setting up DMA, = initializing the interrupt > code, and seeing how interrupts are handled. =46rom there I would look = into Rx, Tx > and then the rest of it. Following through the rtwn_attach function I agree that following the ieee80211com object is a good idea. If anyone else finds this useful the r21au_attach function is also informative as it adds the interface methods to the softc. The man pages are great as usual. Is ieee80211_ifattach a good point to start reading? It seems to kick off a cascade of *_attach methods which is a little tricky to keep track of. Reading all this does make me realize there are many 802.11 features I don't know about, so if you have a good 802.11 reference I'd love to hear it. > Please let me know if this helps. Also, if you have any more specific > questions, please let us know. What are your objectives? My adapter has frequent times when it will have crippling packet loss (40% to 100%) for 5 ish minutes until things all of a sudden return to normal. I'd love to be able to figure out what's actually going wrong. Also I'd enjoy some 802.11ac support, so if there is any grunt work which a newbie can help with I am glad to chip in. > I was writing an introduction on this very topic, but $LIFE and other > projects got in the way. Maybe I should get back into it? I'm not sure about others, but I would definitely read it. Thanks! Austin