From owner-freebsd-net@FreeBSD.ORG Wed Oct 6 00:27:51 2010 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4FDF6106566C; Wed, 6 Oct 2010 00:27:51 +0000 (UTC) (envelope-from onemda@gmail.com) Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com [209.85.216.175]) by mx1.freebsd.org (Postfix) with ESMTP id B0D3F8FC14; Wed, 6 Oct 2010 00:27:50 +0000 (UTC) Received: by qyk4 with SMTP id 4so34738qyk.13 for ; Tue, 05 Oct 2010 17:27:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=GWVsKOTmy7TcjFlvBFT3uNhQyJK6AQF99+016EiJdEI=; b=S6OOKVSOM5dLLnDLGj20taYo1PTtGWVmf0/HNLnLOBKQQ7dIh9wa/xrAMPYVdeD9YS Vslx+nKV58aFc1eAV7BiICFDapGYSbGYt7Zb92/Y2qEsxkFp2cNxWb/iv3e1RhBNumAA 3ZE+gWzmIXHxC2WzDN5jDCh1dDyLrFlut1ezM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=PsBOhttu52lAvMKUbKjrlEKGoOoTidIMcsmmvwMTqYlTDpw+hGr4Jx/ThYR+38xLQu 5FGD/zbE7JTKX4+2d/4ijMw29kzH7/AhN3KkPrMUo9KzjNK4NOuN3QMRMB4QeNMODDiW cZjXIZeD3kKE5baW6bFSmr5cq1nrmvgSjCAy0= MIME-Version: 1.0 Received: by 10.220.167.194 with SMTP id r2mr444330vcy.247.1286324864720; Tue, 05 Oct 2010 17:27:44 -0700 (PDT) Received: by 10.220.187.194 with HTTP; Tue, 5 Oct 2010 17:27:44 -0700 (PDT) In-Reply-To: <4CAB9212.4010203@freebsd.org> References: <4CAB9212.4010203@freebsd.org> Date: Wed, 6 Oct 2010 00:27:44 +0000 Message-ID: From: Paul B Mahol To: Julian Elischer Content-Type: multipart/mixed; boundary=001636284556a0a0e90491e7d894 Cc: freebsd-net@freebsd.org Subject: Re: ndis: fix ugly code X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Oct 2010 00:27:51 -0000 --001636284556a0a0e90491e7d894 Content-Type: text/plain; charset=ISO-8859-1 On 10/5/10, Julian Elischer wrote: > On 10/5/10 1:19 PM, Paul B Mahol wrote: >> Hi, >> >> If clang did not complain, I would probbaly never spot it. >> >> Patch attached. > > personally I think you could use kproc_kthread_add so that a single > NDIS process had three threads. Patch attached. Now we have single "ndis" kernel process with own threads. --001636284556a0a0e90491e7d894 Content-Type: text/plain; charset=US-ASCII; name="diff.txt" Content-Disposition: attachment; filename="diff.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: file0 ZGlmZiAtLWdpdCBhL3N5cy9jb21wYXQvbmRpcy9zdWJyX250b3Nrcm5sLmMgYi9zeXMvY29tcGF0 L25kaXMvc3Vicl9udG9za3JubC5jCmluZGV4IDcxNGZjZDguLmVhZmJiN2MgMTAwNjQ0Ci0tLSBh L3N5cy9jb21wYXQvbmRpcy9zdWJyX250b3Nrcm5sLmMKKysrIGIvc3lzL2NvbXBhdC9uZGlzL3N1 YnJfbnRvc2tybmwuYwpAQCAtMjU0LDYgKzI1NCw3IEBAIHN0YXRpYyBpbnQzMl90IEtlRGVsYXlF eGVjdXRpb25UaHJlYWQodWludDhfdCwgdWludDhfdCwgaW50NjRfdCAqKTsKIHN0YXRpYyBpbnQz Ml90IEtlU2V0UHJpb3JpdHlUaHJlYWQoc3RydWN0IHRocmVhZCAqLCBpbnQzMl90KTsKI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