From owner-svn-src-all@FreeBSD.ORG Sat Jul 26 18:36:39 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C1CDA794; Sat, 26 Jul 2014 18:36:39 +0000 (UTC) Received: from mail-qg0-x235.google.com (mail-qg0-x235.google.com [IPv6:2607:f8b0:400d:c04::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5045924AA; Sat, 26 Jul 2014 18:36:39 +0000 (UTC) Received: by mail-qg0-f53.google.com with SMTP id q107so6465148qgd.26 for ; Sat, 26 Jul 2014 11:36:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=bU33ZMwydXcPo0JNN5WkCZFN1zCza581hhYFrqAXcuE=; b=Q4rYdbKnTPOWsowxMfHXkvEcNm2e53dpoXBP6D4i7gw16KtuEKrUuO50Z3G0rw8VMk wVpLzO+t0tCls/twgKSmbXILtJoSi9pKZCbOHO2fwp+bEnYirATgKF7YOjM2jbnum1m7 X2ROkjnJ1VOK4iD/zJikQN6BTVrt5SFwt6aDtQdRz/vb/19jNd3XClGOxsDFxk6/zfKm y8k33LEksdFYMmfyDk0VvdQRR3U49ms+VEnAYPIzv6yDs1oTEiGC+3bTYQswYsyEgHKy nR2RkKDM4diR293SJ6ieBGxNwhQl6bcHyRaoKmJ3wVUe7N9VTjlk+Oz+nWHK+0SS/Z9K 8RjA== MIME-Version: 1.0 X-Received: by 10.140.41.133 with SMTP id z5mr40140009qgz.99.1406399797873; Sat, 26 Jul 2014 11:36:37 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.224.1.6 with HTTP; Sat, 26 Jul 2014 11:36:37 -0700 (PDT) In-Reply-To: <201407261606.s6QG61le092895@svn.freebsd.org> References: <201407261606.s6QG61le092895@svn.freebsd.org> Date: Sat, 26 Jul 2014 11:36:37 -0700 X-Google-Sender-Auth: BAS5PSv_0_WHSXTefd2LCR3oxxE Message-ID: Subject: Re: svn commit: r269127 - head/sys/dev/usb/wlan From: Adrian Chadd To: Hans Petter Selasky Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jul 2014 18:36:39 -0000 Hi, We should likely review how the PLCP bits are being used and why it's getting a rate of 0 in the first place. So, why's it getting a rate of 0 passed into the transmit path? -a On 26 July 2014 09:06, Hans Petter Selasky wrote: > Author: hselasky > Date: Sat Jul 26 16:06:01 2014 > New Revision: 269127 > URL: http://svnweb.freebsd.org/changeset/base/269127 > > Log: > Fix for division by zero. > > MFC after: 3 days > > Modified: > head/sys/dev/usb/wlan/if_rum.c > head/sys/dev/usb/wlan/if_ural.c > head/sys/dev/usb/wlan/if_zyd.c > head/sys/dev/usb/wlan/if_zydreg.h > > Modified: head/sys/dev/usb/wlan/if_rum.c > ============================================================================== > --- head/sys/dev/usb/wlan/if_rum.c Sat Jul 26 15:46:41 2014 (r269126) > +++ head/sys/dev/usb/wlan/if_rum.c Sat Jul 26 16:06:01 2014 (r269127) > @@ -1035,6 +1035,8 @@ rum_setup_tx_desc(struct rum_softc *sc, > desc->plcp_length_hi = plcp_length >> 6; > desc->plcp_length_lo = plcp_length & 0x3f; > } else { > + if (rate == 0) > + rate = 2; /* avoid division by zero */ > plcp_length = (16 * len + rate - 1) / rate; > if (rate == 22) { > remainder = (16 * len) % 22; > > Modified: head/sys/dev/usb/wlan/if_ural.c > ============================================================================== > --- head/sys/dev/usb/wlan/if_ural.c Sat Jul 26 15:46:41 2014 (r269126) > +++ head/sys/dev/usb/wlan/if_ural.c Sat Jul 26 16:06:01 2014 (r269127) > @@ -1038,6 +1038,8 @@ ural_setup_tx_desc(struct ural_softc *sc > desc->plcp_length_hi = plcp_length >> 6; > desc->plcp_length_lo = plcp_length & 0x3f; > } else { > + if (rate == 0) > + rate = 2; /* avoid division by zero */ > plcp_length = (16 * len + rate - 1) / rate; > if (rate == 22) { > remainder = (16 * len) % 22; > > Modified: head/sys/dev/usb/wlan/if_zyd.c > ============================================================================== > --- head/sys/dev/usb/wlan/if_zyd.c Sat Jul 26 15:46:41 2014 (r269126) > +++ head/sys/dev/usb/wlan/if_zyd.c Sat Jul 26 16:06:01 2014 (r269127) > @@ -2480,7 +2480,7 @@ zyd_tx_start(struct zyd_softc *sc, struc > const struct ieee80211_txparam *tp; > struct ieee80211_key *k; > int rate, totlen; > - static uint8_t ratediv[] = ZYD_TX_RATEDIV; > + static const uint8_t ratediv[] = ZYD_TX_RATEDIV; > uint8_t phy; > uint16_t pktlen; > uint32_t bits; > > Modified: head/sys/dev/usb/wlan/if_zydreg.h > ============================================================================== > --- head/sys/dev/usb/wlan/if_zydreg.h Sat Jul 26 15:46:41 2014 (r269126) > +++ head/sys/dev/usb/wlan/if_zydreg.h Sat Jul 26 16:06:01 2014 (r269127) > @@ -970,7 +970,7 @@ > > #define ZYD_TX_RATEDIV \ > { \ > - 0x1, 0x2, 0xb, 0xb, 0x0, 0x0, 0x0, 0x0, 0x30, 0x18, 0xc, 0x6, \ > + 0x1, 0x2, 0xb, 0xb, 0x1, 0x1, 0x1, 0x1, 0x30, 0x18, 0xc, 0x6, \ > 0x36, 0x24, 0x12, 0x9 \ > } > >