From owner-freebsd-wireless@FreeBSD.ORG Mon Jul 29 21:15:54 2013 Return-Path: Delivered-To: freebsd-wireless@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 21437F1; Mon, 29 Jul 2013 21:15:54 +0000 (UTC) (envelope-from jmg@h2.funkthat.com) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E8E7D2141; Mon, 29 Jul 2013 21:15:53 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id r6TLFeV2037401 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 29 Jul 2013 14:15:40 -0700 (PDT) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id r6TLFe26037400; Mon, 29 Jul 2013 14:15:40 -0700 (PDT) (envelope-from jmg) Date: Mon, 29 Jul 2013 14:15:40 -0700 From: John-Mark Gurney To: Hans Petter Selasky Subject: Re: My WLI-UC-GNM up crash Message-ID: <20130729211540.GZ26412@funkthat.com> Mail-Followup-To: Hans Petter Selasky , Warner Losh , Adrian Chadd , freebsd-arm , "freebsd-wireless@freebsd.org" References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Mon, 29 Jul 2013 14:15:40 -0700 (PDT) Cc: "freebsd-wireless@freebsd.org" , freebsd-arm , Warner Losh X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.14 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: Mon, 29 Jul 2013 21:15:54 -0000 Hans Petter Selasky wrote this message on Mon, Jul 29, 2013 at 19:58 +0200: > The aligned will make sure that the structure gets padded properly to the size specified. Only on ARM/MIPS etc, structures get automatically aligned according to the element in the structure requiring the greatest alignment. I've test-compiled the USB WLAN drivers, and the aligned makes a difference. The problem is that the radiotap header skews some following elements, so that they are no longer aligned. The radiotap header itself is packed, and this is not a problem. Ouch, has anyone looked at the code that caused this? in ieee80211_radiotap.c, it looks like the original fault was in either set_channel, or set_xchannel, and both do (the equivalent of): struct { uint16_t freq; uint16_t flags; } *rc = p; rc->freq = htole16(c->ic_freq); rc->flags = htole16(c->ic_flags); And then there is complicated code that calculates offsets, etc, in radiotap_offset.. What we probably really need is to mark the above as __packed or equiv so that we don't assume that the passed in pointer is aligned... The whole management of this radiochan and radiotap_offset is pretty nasty... If marking the structures __packed works, it's probably because two bugs are offsetting, and magicly making things align again... > -----Original message----- > > From:Warner Losh > > > Sent: Monday 29th July 2013 17:04 > > To: Adrian Chadd > > > Cc: Hans Petter Selasky >; freebsd-arm >; freebsd-wireless@freebsd.org > > Subject: Re: My WLI-UC-GNM up crash > > > > Aren't structures already aligned to 4 bytes when placed inside other structures (unless marked __packed)? > > > > Warner > > > > On Jul 28, 2013, at 11:50 AM, Adrian Chadd wrote: > > > > > As long as that results in the radiotap structures being 4 or 8 byte > > > padded when it's embedded in the softc - then yes, indeed. > > > > > > Xiao, can you try? > > > > > > > > > -adrian > > > > > > On 28 July 2013 03:35, Hans Petter Selasky > wrote: > > >> Hi, > > >> > > >> Can you try the attached patch? > > >> > > >> --HPS > > > _______________________________________________ > > > freebsd-arm@freebsd.org mailing list > > > http://lists.freebsd.org/mailman/listinfo/freebsd-arm > > > To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org " > > > > > > _______________________________________________ > freebsd-arm@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arm > To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org" -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."