From owner-freebsd-wireless@freebsd.org Tue Nov 3 15:31:19 2015 Return-Path: Delivered-To: freebsd-wireless@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05734A2527A for ; Tue, 3 Nov 2015 15:31:19 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-io0-x232.google.com (mail-io0-x232.google.com [IPv6:2607:f8b0:4001:c06::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C8DBD1E6A; Tue, 3 Nov 2015 15:31:18 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by iofz202 with SMTP id z202so22125166iof.2; Tue, 03 Nov 2015 07:31:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=jWwNf2BrMMKeZJLQNl/Dg1weq4VYKP3Gxhdyfc5NtsA=; b=R2HddsE/Rv1zdFwmNNrwTVs3HUKxz+fi+PzL8eK2/sL5DIOUHQl2Bd20ruH7RHn97T ygbn3j8b0gRKF0bJTl4mma29EnJ55ZQAGgAuUhtMa5fzYdyPjR6vK4wyy6lPPbxWMUrH Um7BF9JKCYo3EA2n3gCDoFn/K4n3SBoSgv3BjAi2nM4i1QXRluEipSYx6M964l0PCRDi YT4QruhJEsg3bEJRlhhvM+vruUPZUR69JRXHXX03hjQlNwaaaBIr+DS0uN76BO8Gk7Cd HNl9Q9E9FSEHXFfkK3QXm3mT6hXlFEez2J3xXHVH9QEFGi3Gp8H0SwHrzfsqiwXXuE/R 0e9A== MIME-Version: 1.0 X-Received: by 10.107.152.2 with SMTP id a2mr27041152ioe.123.1446564678236; Tue, 03 Nov 2015 07:31:18 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.36.46.66 with HTTP; Tue, 3 Nov 2015 07:31:18 -0800 (PST) Date: Tue, 3 Nov 2015 07:31:18 -0800 X-Google-Sender-Auth: C19cE4p8_zYfrxYpiISOfg8SHG4 Message-ID: Subject: (untested) ath fix upon error From: Adrian Chadd To: "freebsd-wireless@freebsd.org" , Mark Felder Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.20 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: Tue, 03 Nov 2015 15:31:19 -0000 hiya, what do people think about this to fix ath(4) transmit errors: adrian@victoria:~/work/freebsd/head-embedded/src % svn diff sys/dev/ath Index: sys/dev/ath/if_ath.c =================================================================== --- sys/dev/ath/if_ath.c (revision 290048) +++ sys/dev/ath/if_ath.c (working copy) @@ -3320,6 +3320,9 @@ * * Note: if this fails, then the mbufs are freed but * not the node reference. + * + * So, we now have to free the node reference ourselves here + * and return OK up to the stack. */ next = m->m_nextpkt; if (ath_tx_start(sc, ni, bf, m)) { @@ -3336,7 +3339,14 @@ */ ath_txfrag_cleanup(sc, &frags, ni); ATH_TXBUF_UNLOCK(sc); - retval = ENOBUFS; + + /* + * XXX: And free the node/return OK; ath_tx_start() may have + * modified the buffer. We currently have no way to + * signify that the mbuf was freed but there was an error. + */ + ieee80211_node_free(ni); + retval = 0; goto finish; } .. the idea is that we can't return failure once we've called ath_tx_start(), as the mbuf needs to be consumed. So we return OK and just count an error. -adrian