From owner-freebsd-drivers@FreeBSD.ORG Mon Sep 19 18:10:20 2011 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E76C106566C for ; Mon, 19 Sep 2011 18:10:20 +0000 (UTC) (envelope-from kmacybsd@gmail.com) Received: from mail-ew0-f48.google.com (mail-ew0-f48.google.com [209.85.215.48]) by mx1.freebsd.org (Postfix) with ESMTP id AAE888FC19 for ; Mon, 19 Sep 2011 18:10:18 +0000 (UTC) Received: by ewy23 with SMTP id 23so864643ewy.7 for ; Mon, 19 Sep 2011 11:10:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; bh=BL2HsWz0ub7xCaogZuokjo8yrazvtOtB7V9MUA09aE8=; b=gpwF3e7TpW2JUXiXQfCSDCzlPqSBg8mx4E7wXAvOL75yOSX1G+Y0NG8w6mNrCnGNQI LrjC7VdJ1Eci0oSUDBSdqgVfZc+PEgkr4Rp0B4C6gXaX5lorXuF/3R8VoWcTkaUC62in DeDExPET/2jl05i2QiSpf7utA8WJQ/kk216wc= MIME-Version: 1.0 Received: by 10.52.96.166 with SMTP id dt6mr2550023vdb.345.1316454224550; Mon, 19 Sep 2011 10:43:44 -0700 (PDT) Sender: kmacybsd@gmail.com Received: by 10.52.113.202 with HTTP; Mon, 19 Sep 2011 10:43:44 -0700 (PDT) In-Reply-To: References: <201109190813.37817.jhb@freebsd.org> Date: Mon, 19 Sep 2011 19:43:44 +0200 X-Google-Sender-Auth: O9Ou1KTry7WwWcirPzK6C5qIVhc Message-ID: From: "K. Macy" To: freebsd-drivers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Fwd: Multiple TX queue support in nic driver X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2011 18:10:20 -0000 forwarding response to the list > ---------- Forwarded message ---------- > From:=A0Naresh > To:=A0"freebsd-drivers@freebsd.org" > Date:=A0Thu, 15 Sep 2011 20:26:16 +0530 > Subject:=A0Multiple TX queue support in nic driver > Hi All, > > I am working on a 10G Ethernet driver. =A0I have a requirement to support= multiple TX queues. I looked into IXGBE and CXGB drivers for reference, I = have some questions regarding the implementation. > > 1) For supporting multiple TXQs, I see the above mentioned drivers create= a ring buffer in the driver for each hardware TX queue, and queue the pack= ets from stack to the ring buffer before queueing on the hardware queue. I = don't understand why to create a ring buffer for supporting multiple TXQS. = There might be a very good reason for them to do that way, but I am unable = to get that. The software queues are only used if the txq lock is already held by another thread. What alternative are you thinking of? Waiting for the txq lock would be much slower than a simple ring buffer enqueue. A global queue where threads randomly pulled off and put on an available txq would cause packet reording within individual flows. > Is it ok to queue the packets to hardware queue directly based on the flo= wid supplied in the mbuf =A0packet header in if_transmit routine ? Yes. This is what those drivers already do if the txq lock is not held. > 2) Regarding flowid, for the first TX packet the flowid is not set and th= e packet goes out on the default TX queue and when the corresponding RX res= ponse comes to hardware it queues =A0 the packet to appropriate RXQ based o= n the rss hash. The driver then before posting RX packet to stack it should= set the flowid in packet to RXQ index. > After that the TX packets from stack for that TCP connection will come wi= th flowid supplied by us. Is this understanding correct ? Yes. For using multiple queues with UDP unidirectionally one needs to either use the flowtable or change the inpcb creation routine. Cheers From owner-freebsd-drivers@FreeBSD.ORG Tue Sep 20 16:28:51 2011 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 179AF106564A; Tue, 20 Sep 2011 16:28:51 +0000 (UTC) (envelope-from kmacybsd@gmail.com) Received: from mail-qw0-f44.google.com (mail-qw0-f44.google.com [209.85.216.44]) by mx1.freebsd.org (Postfix) with ESMTP id 9D74B8FC14; Tue, 20 Sep 2011 16:28:50 +0000 (UTC) Received: by qwb8 with SMTP id 8so1865092qwb.3 for ; Tue, 20 Sep 2011 09:28:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=Sqx60PAa/QkmWBOvji3NtghHdDLO8ARf6F6j8nv9VZs=; b=nSBM5/CSSUQN6LCKOvTMyOfCpzSsvVODNCsOMtImIZ9cKiWFNaCJZf9wgZUVHPP1jh 8o6u14al6jZOLMhsKYBLvpJ4US0X0ImPx2Dh15rWkM4zikdAEKg4yi3oI4a6cY0g+dyN 99LfOOzNtUh6uDrATmgHm0aMlYYEbwFQ6/HIQ= MIME-Version: 1.0 Received: by 10.52.89.36 with SMTP id bl4mr1031544vdb.10.1316536129994; Tue, 20 Sep 2011 09:28:49 -0700 (PDT) Sender: kmacybsd@gmail.com Received: by 10.52.113.202 with HTTP; Tue, 20 Sep 2011 09:28:49 -0700 (PDT) In-Reply-To: <6C998B08-9053-49F4-B918-B88331AE4D17@gmail.com> References: <201109190813.37817.jhb@freebsd.org> <6C998B08-9053-49F4-B918-B88331AE4D17@gmail.com> Date: Tue, 20 Sep 2011 18:28:49 +0200 X-Google-Sender-Auth: ttwbndhl2uPTTKHCAZgfh89pBBw Message-ID: From: "K. Macy" To: Naresh Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Robert Watson , freebsd-drivers@freebsd.org Subject: Re: Multiple TX queue support in nic driver X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2011 16:28:51 -0000 (added -drivers back to the CC for your mail's educational value) On Tue, Sep 20, 2011 at 5:02 PM, Naresh wrote: > Hi Macy, > > Thanks a lot for the detailed explanation, Now I understand why the ring = buffer is used. > > In Linux all these things are maintained in the stack, is there any advan= tage of FreeBSD moving these things in to drivers? I doubt it. When I ported Chelsio's T3 10G Linux driver to FreeBSD (cxgb) FreeBSD had no support for multiple transmit queues. At that time all packets were relayed to the driver by a per-driver instance linked list (IFQ) and then calling ifp->if_start(ifp). After some discussion with others I extended the API with if_transmit to allow the caller to do direct transmit if possible or defer transmission in a driver specific fashion. By adding buf_ring I provided drivers with a much faster queueing mechanism without enforcing any sort of policy. At the time I hadn't done much work in the network stack beyond updating some of the wireless drivers so my only real objective was getting the network stack out of the way of the driver. At this point we've established a sufficiently consistent driver programming model with if_transmit that it would make sense to move a lot of that out of the driver and in to the stack. > During module attach, Linux drivers report number of TX queues they suppo= rt and based on that value stack creates that many software queues. These a= llocated queues reference is stored in netdev structure, so that they can b= e accessible by both driver and stack. In XMIT routine, skbuff indicates wh= ich queue to use and based on that value packet is transmitted on appropria= te hardware TX queue. > > Both the approaches of the OS's are similar, Only difference is in Linux = these are taken care by stack. I think that is the right approach, it simply hasn't reached the front of anyone's priority queue. For my non-work hours I'm busy with fleshing out my user level network stack, and the others who might do the work are themselves busier still. > Once again thanks a lot for you help. > Cheers From owner-freebsd-drivers@FreeBSD.ORG Tue Sep 20 17:47:58 2011 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6831F106566C; Tue, 20 Sep 2011 17:47:58 +0000 (UTC) (envelope-from gbal.naresh@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id DBECE8FC16; Tue, 20 Sep 2011 17:47:57 +0000 (UTC) Received: by ywp17 with SMTP id 17so695523ywp.13 for ; Tue, 20 Sep 2011 10:47:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=references:in-reply-to:mime-version:content-transfer-encoding :content-type:message-id:cc:x-mailer:from:subject:date:to; bh=0mq/IYf2ubnyTIPv7VleDRU7f3tmWemYRch4A/54vLU=; b=pY2VT490urB3ez2DYqyARNDaPxPMNOZoLe+8PcEOR52Fhkd8awQV5vCrj2BSAMKBuK ordYla52H4Agvi4KL4yMULXSQXv5yye1QsL8dxNBwdYgk80RxKNtcoHR1CwQSIH7ebuc aqu8U2Vwfsd/ruUA9MDm7wsqjHAShEmAL2qHM= Received: by 10.68.51.136 with SMTP id k8mr6141571pbo.404.1316540876673; Tue, 20 Sep 2011 10:47:56 -0700 (PDT) Received: from [192.168.1.4] ([123.236.149.59]) by mx.google.com with ESMTPS id q10sm7923886pbn.9.2011.09.20.10.47.52 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 20 Sep 2011 10:47:55 -0700 (PDT) References: <201109190813.37817.jhb@freebsd.org> <6C998B08-9053-49F4-B918-B88331AE4D17@gmail.com> In-Reply-To: Mime-Version: 1.0 (iPhone Mail 8H7) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Message-Id: <5FB5EDF5-8716-495C-856C-2CC87DDF8CE6@gmail.com> X-Mailer: iPhone Mail (8H7) From: Naresh Date: Tue, 20 Sep 2011 23:17:50 +0530 To: "K. Macy" Cc: Robert Watson , "freebsd-drivers@freebsd.org" Subject: Re: Multiple TX queue support in nic driver X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2011 17:47:58 -0000 Thanks a lot Macy. On 20-Sep-2011, at 9:58 PM, "K. Macy" wrote: > (added -drivers back to the CC for your mail's educational value) >=20 > On Tue, Sep 20, 2011 at 5:02 PM, Naresh wrote: >> Hi Macy, >>=20 >> Thanks a lot for the detailed explanation, Now I understand why the ring b= uffer is used. >>=20 >> In Linux all these things are maintained in the stack, is there any advan= tage of FreeBSD moving these things in to drivers? >=20 > I doubt it. When I ported Chelsio's T3 10G Linux driver to FreeBSD > (cxgb) FreeBSD had no support for multiple transmit queues. At that > time all packets were relayed to the driver by a per-driver instance > linked list (IFQ) and then calling ifp->if_start(ifp). After some > discussion with others I extended the API with if_transmit to allow > the caller to do direct transmit if possible or defer transmission in > a driver specific fashion. By adding buf_ring I provided drivers with > a much faster queueing mechanism without enforcing any sort of policy. > At the time I hadn't done much work in the network stack beyond > updating some of the wireless drivers so my only real objective was > getting the network stack out of the way of the driver. At this point > we've established a sufficiently consistent driver programming model > with if_transmit that it would make sense to move a lot of that out of > the driver and in to the stack. >=20 >=20 >> During module attach, Linux drivers report number of TX queues they suppo= rt and based on that value stack creates that many software queues. These al= located queues reference is stored in netdev structure, so that they can be a= ccessible by both driver and stack. In XMIT routine, skbuff indicates which q= ueue to use and based on that value packet is transmitted on appropriate har= dware TX queue. >>=20 >> Both the approaches of the OS's are similar, Only difference is in Linux t= hese are taken care by stack. >=20 > I think that is the right approach, it simply hasn't reached the front > of anyone's priority queue. For my non-work hours I'm busy with > fleshing out my user level network stack, and the others who might do > the work are themselves busier still. >=20 >> Once again thanks a lot for you help. >>=20 >=20 > Cheers From owner-freebsd-drivers@FreeBSD.ORG Thu Sep 22 17:46:33 2011 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 469A31065673; Thu, 22 Sep 2011 17:46:33 +0000 (UTC) (envelope-from david.somayajulu@qlogic.com) Received: from TX2EHSOBE001.bigfish.com (tx2ehsobe001.messaging.microsoft.com [65.55.88.11]) by mx1.freebsd.org (Postfix) with ESMTP id ED2168FC0A; Thu, 22 Sep 2011 17:46:32 +0000 (UTC) Received: from mail162-tx2-R.bigfish.com (10.9.14.246) by TX2EHSOBE001.bigfish.com (10.9.40.21) with Microsoft SMTP Server id 14.1.225.22; Thu, 22 Sep 2011 17:31:26 +0000 Received: from mail162-tx2 (localhost.localdomain [127.0.0.1]) by mail162-tx2-R.bigfish.com (Postfix) with ESMTP id 8D5CD16B0246; Thu, 22 Sep 2011 17:31:26 +0000 (UTC) X-SpamScore: -6 X-BigFish: VPS-6(zzc85fh14ffOzz1202hzz8275bh8275dhz2ei2a8h668h839h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: CIP:198.70.193.64; KIP:(null); UIP:(null); IPVD:NLI; H:avexcashub1.qlogic.com; RD:avexcashub2.qlogic.com; EFVD:NLI Received-SPF: neutral (mail162-tx2: 198.70.193.64 is neither permitted nor denied by domain of qlogic.com) client-ip=198.70.193.64; envelope-from=david.somayajulu@qlogic.com; helo=avexcashub1.qlogic.com ; 1.qlogic.com ; Received: from mail162-tx2 (localhost.localdomain [127.0.0.1]) by mail162-tx2 (MessageSwitch) id 1316712685878289_22446; Thu, 22 Sep 2011 17:31:25 +0000 (UTC) Received: from TX2EHSMHS045.bigfish.com (unknown [10.9.14.235]) by mail162-tx2.bigfish.com (Postfix) with ESMTP id C76329F004E; Thu, 22 Sep 2011 17:31:25 +0000 (UTC) Received: from avexcashub1.qlogic.com (198.70.193.64) by TX2EHSMHS045.bigfish.com (10.9.99.145) with Microsoft SMTP Server (TLS) id 14.1.225.22; Thu, 22 Sep 2011 17:31:18 +0000 Received: from avexmb1.qlogic.org ([fe80::9545:3a4f:c131:467d]) by avexcashub2.qlogic.org ([::1]) with mapi; Thu, 22 Sep 2011 10:31:17 -0700 From: David Somayajulu To: "freebsd-current@freebsd.org" , "freebsd-drivers@freebsd.org" Date: Thu, 22 Sep 2011 10:31:15 -0700 Thread-Topic: Recommended methods to upgrade firmware on HBAs Thread-Index: Acx5TW4ghoylo64wQjGQ7FegAezJ7g== Message-ID: <75E1A2A7D185F841A975979B0906BBA67BCCAB75FA@AVEXMB1.qlogic.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 X-OriginatorOrg: qlogic.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: Recommended methods to upgrade firmware on HBAs X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2011 17:46:33 -0000 Hi All, 1. What is the current recommended method for upgrading firmware for = HBAs? 2. Is there a mechanism wherein the firmware binary can be provided a= s a separate file, which is then made accessible to the corresponding devi= ce driver during device initialization? 3. Is there a restriction on the size of driver.ko file? If not, is i= t acceptable to provide the firmware as fw_file.c which is then compiled in= to the driver. Thanks david S. ________________________________ This message and any attached documents contain information from QLogic Cor= poration or its wholly-owned subsidiaries that may be confidential. If you = are not the intended recipient, you may not read, copy, distribute, or use = this information. If you have received this transmission in error, please n= otify the sender immediately by reply e-mail and then delete this message. From owner-freebsd-drivers@FreeBSD.ORG Thu Sep 22 17:56:01 2011 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC7F7106566B; Thu, 22 Sep 2011 17:56:01 +0000 (UTC) (envelope-from david.somayajulu@qlogic.com) Received: from DB3EHSOBE003.bigfish.com (db3ehsobe003.messaging.microsoft.com [213.199.154.141]) by mx1.freebsd.org (Postfix) with ESMTP id 0D2A18FC12; Thu, 22 Sep 2011 17:56:00 +0000 (UTC) Received: from mail118-db3-R.bigfish.com (10.3.81.251) by DB3EHSOBE003.bigfish.com (10.3.84.23) with Microsoft SMTP Server id 14.1.225.22; Thu, 22 Sep 2011 17:55:56 +0000 Received: from mail118-db3 (localhost.localdomain [127.0.0.1]) by mail118-db3-R.bigfish.com (Postfix) with ESMTP id 862651B38466; Thu, 22 Sep 2011 17:55:56 +0000 (UTC) X-SpamScore: 1 X-BigFish: VPS1(zzc85fhzz1202hzz8275bh8275dhz2ei2a8h668h839h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: CIP:198.70.193.64; KIP:(null); UIP:(null); IPVD:NLI; H:avexcashub1.qlogic.com; RD:avexcashub2.qlogic.com; EFVD:NLI X-FB-SS: 0,0, Received-SPF: neutral (mail118-db3: 198.70.193.64 is neither permitted nor denied by domain of qlogic.com) client-ip=198.70.193.64; envelope-from=david.somayajulu@qlogic.com; helo=avexcashub1.qlogic.com ; 1.qlogic.com ; Received: from mail118-db3 (localhost.localdomain [127.0.0.1]) by mail118-db3 (MessageSwitch) id 1316714127740340_16124; Thu, 22 Sep 2011 17:55:27 +0000 (UTC) Received: from DB3EHSMHS005.bigfish.com (unknown [10.3.81.254]) by mail118-db3.bigfish.com (Postfix) with ESMTP id A65D716B804F; Thu, 22 Sep 2011 17:55:27 +0000 (UTC) Received: from avexcashub1.qlogic.com (198.70.193.64) by DB3EHSMHS005.bigfish.com (10.3.87.105) with Microsoft SMTP Server (TLS) id 14.1.225.22; Thu, 22 Sep 2011 17:55:26 +0000 Received: from avexmb1.qlogic.org ([fe80::9545:3a4f:c131:467d]) by avexcashub2.qlogic.org ([::1]) with mapi; Thu, 22 Sep 2011 10:55:24 -0700 From: David Somayajulu To: "freebsd-current@freebsd.org" , "freebsd-drivers@freebsd.org" Date: Thu, 22 Sep 2011 10:55:23 -0700 Thread-Topic: Choosing between DELAY(useconds) and pause() Thread-Index: Acx5UM0zVf9+7OruR7GrAyAHGLy0DA== Message-ID: <75E1A2A7D185F841A975979B0906BBA67BCCAB7609@AVEXMB1.qlogic.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 X-OriginatorOrg: qlogic.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: Choosing between DELAY(useconds) and pause() X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2011 17:56:01 -0000 It appears that the pause() function cannot be used in driver functions whi= ch are invoked early in the boot process. Is there is a kernel api which a = device driver can use to determine whether to use pause() or DELAY(), for d= elays which are say greater than 10hz - may be even 1 hz ? Cheers, David S. ________________________________ This message and any attached documents contain information from QLogic Cor= poration or its wholly-owned subsidiaries that may be confidential. If you = are not the intended recipient, you may not read, copy, distribute, or use = this information. If you have received this transmission in error, please n= otify the sender immediately by reply e-mail and then delete this message. From owner-freebsd-drivers@FreeBSD.ORG Thu Sep 22 18:16:47 2011 Return-Path: Delivered-To: freebsd-drivers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9662106566B; Thu, 22 Sep 2011 18:16:47 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 4ACF68FC15; Thu, 22 Sep 2011 18:16:44 +0000 (UTC) Received: from [10.30.101.53] ([209.117.142.2]) (authenticated bits=0) by harmony.bsdimp.com (8.14.4/8.14.3) with ESMTP id p8MI9ABe030791 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Thu, 22 Sep 2011 12:09:11 -0600 (MDT) (envelope-from imp@bsdimp.com) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: <75E1A2A7D185F841A975979B0906BBA67BCCAB7609@AVEXMB1.qlogic.org> Date: Thu, 22 Sep 2011 12:08:55 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <99C858FB-B215-4EFF-9EF1-09C5242091D4@bsdimp.com> References: <75E1A2A7D185F841A975979B0906BBA67BCCAB7609@AVEXMB1.qlogic.org> To: David Somayajulu X-Mailer: Apple Mail (2.1084) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (harmony.bsdimp.com [10.0.0.6]); Thu, 22 Sep 2011 12:09:11 -0600 (MDT) Cc: "freebsd-current@freebsd.org" , "freebsd-drivers@freebsd.org" Subject: Re: Choosing between DELAY(useconds) and pause() X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2011 18:16:47 -0000 if (cold) DELAY() else pause() On Sep 22, 2011, at 11:55 AM, David Somayajulu wrote: > It appears that the pause() function cannot be used in driver = functions which are invoked early in the boot process. Is there is a = kernel api which a device driver can use to determine whether to use = pause() or DELAY(), for delays which are say greater than 10hz - may be = even 1 hz ? >=20 > Cheers, > David S. >=20 >=20 > ________________________________ > This message and any attached documents contain information from = QLogic Corporation or its wholly-owned subsidiaries that may be = confidential. If you are not the intended recipient, you may not read, = copy, distribute, or use this information. If you have received this = transmission in error, please notify the sender immediately by reply = e-mail and then delete this message. > _______________________________________________ > freebsd-drivers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-drivers > To unsubscribe, send any mail to = "freebsd-drivers-unsubscribe@freebsd.org" >=20 >=20 From owner-freebsd-drivers@FreeBSD.ORG Thu Sep 22 18:20:15 2011 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E16D106564A for ; Thu, 22 Sep 2011 18:20:15 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe07.c2i.net [212.247.154.194]) by mx1.freebsd.org (Postfix) with ESMTP id E75808FC0C for ; Thu, 22 Sep 2011 18:20:14 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=G3me67YS4qRPZcaDO6kWttTShkFAyiMG89AbsUJ8MxU= c=1 sm=1 a=SvYTsOw2Z4kA:10 a=uUbFkVXVqUkA:10 a=WQU8e4WWZSUA:10 a=8nJEP1OIZ-IA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=qTTFKvau-as4jHQ0dEMA:9 a=wPNLvfGTeEIA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe07.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 182798277; Thu, 22 Sep 2011 20:10:11 +0200 From: Hans Petter Selasky To: freebsd-current@freebsd.org Date: Thu, 22 Sep 2011 20:07:19 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <75E1A2A7D185F841A975979B0906BBA67BCCAB7609@AVEXMB1.qlogic.org> In-Reply-To: <75E1A2A7D185F841A975979B0906BBA67BCCAB7609@AVEXMB1.qlogic.org> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201109222007.19182.hselasky@c2i.net> Cc: "freebsd-drivers@freebsd.org" Subject: Re: Choosing between DELAY(useconds) and pause() X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2011 18:20:15 -0000 On Thursday 22 September 2011 19:55:23 David Somayajulu wrote: > It appears that the pause() function cannot be used in driver functions > which are invoked early in the boot process. Is there is a kernel api > which a device driver can use to determine whether to use pause() or > DELAY(), for delays which are say greater than 10hz - may be even 1 hz ? Maybe you want to use something like this: if (cold) DELAY() else pause() In your code. --HPS From owner-freebsd-drivers@FreeBSD.ORG Thu Sep 22 18:57:01 2011 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F84F106564A for ; Thu, 22 Sep 2011 18:57:01 +0000 (UTC) (envelope-from mj@feral.com) Received: from ns1.feral.com (ns1.feral.com [192.67.166.1]) by mx1.freebsd.org (Postfix) with ESMTP id 1304D8FC12 for ; Thu, 22 Sep 2011 18:57:00 +0000 (UTC) Received: from ns1.feral.com (localhost [127.0.0.1]) by ns1.feral.com (8.14.4/8.14.4) with ESMTP id p8MIemjJ089528 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 22 Sep 2011 11:40:48 -0700 (PDT) (envelope-from mj@feral.com) Received: from localhost (mjacob@localhost) by ns1.feral.com (8.14.4/8.14.4/Submit) with ESMTP id p8MIelV8089525; Thu, 22 Sep 2011 11:40:47 -0700 (PDT) (envelope-from mj@feral.com) X-Authentication-Warning: ns1.feral.com: mjacob owned process doing -bs Date: Thu, 22 Sep 2011 11:40:47 -0700 (PDT) From: Matthew Jacob To: David Somayajulu In-Reply-To: <75E1A2A7D185F841A975979B0906BBA67BCCAB75FA@AVEXMB1.qlogic.org> Message-ID: References: <75E1A2A7D185F841A975979B0906BBA67BCCAB75FA@AVEXMB1.qlogic.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (ns1.feral.com [127.0.0.1]); Thu, 22 Sep 2011 11:40:48 -0700 (PDT) Cc: "freebsd-current@freebsd.org" , "freebsd-drivers@freebsd.org" Subject: Re: Recommended methods to upgrade firmware on HBAs X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: mj@feral.com List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2011 18:57:01 -0000 The current firmware(9) mechanism might work for you. The QLogic FC/SCSI cards in FreeBSD use that for loading firmware images to download to the cards, albeit to just load and reset, to update flash. This allows the drivers themselves to request updates. Note that the root filesystem has to be mounted for this mechanism to work. Other mechanisms include ioctl mechanisms as per what the LSI cards do via the mpiutil and mfiutil programs. On Thu, 22 Sep 2011, David Somayajulu wrote: > Hi All, > > 1. What is the current recommended method for upgrading firmware for HBAs? > > 2. Is there a mechanism wherein the firmware binary can be provided as a separate file, which is then made accessible to the corresponding device driver during device initialization? > > 3. Is there a restriction on the size of driver.ko file? If not, is it acceptable to provide the firmware as fw_file.c which is then compiled into the driver. > Thanks > david S. > > > ________________________________ > This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message. > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" > > From owner-freebsd-drivers@FreeBSD.ORG Thu Sep 22 18:57:02 2011 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C5071065670 for ; Thu, 22 Sep 2011 18:57:02 +0000 (UTC) (envelope-from mj@feral.com) Received: from ns1.feral.com (ns1.feral.com [192.67.166.1]) by mx1.freebsd.org (Postfix) with ESMTP id C4B718FC14 for ; Thu, 22 Sep 2011 18:57:01 +0000 (UTC) Received: from ns1.feral.com (localhost [127.0.0.1]) by ns1.feral.com (8.14.4/8.14.4) with ESMTP id p8MIgq5g089540 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 22 Sep 2011 11:42:53 -0700 (PDT) (envelope-from mj@feral.com) Received: from localhost (mjacob@localhost) by ns1.feral.com (8.14.4/8.14.4/Submit) with ESMTP id p8MIgqMh089537; Thu, 22 Sep 2011 11:42:52 -0700 (PDT) (envelope-from mj@feral.com) X-Authentication-Warning: ns1.feral.com: mjacob owned process doing -bs Date: Thu, 22 Sep 2011 11:42:52 -0700 (PDT) From: Matthew Jacob To: Matthew Jacob In-Reply-To: Message-ID: References: <75E1A2A7D185F841A975979B0906BBA67BCCAB75FA@AVEXMB1.qlogic.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (ns1.feral.com [127.0.0.1]); Thu, 22 Sep 2011 11:42:53 -0700 (PDT) Cc: "freebsd-current@freebsd.org" , "freebsd-drivers@freebsd.org" Subject: Re: Recommended methods to upgrade firmware on HBAs X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: mj@feral.com List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2011 18:57:02 -0000 > > The current firmware(9) mechanism might work for you. The QLogic FC/SCSI > cards in FreeBSD use that for loading firmware images to download to the > cards, albeit to just load and reset, to update flash. "not to update flash" (locations in flash where to put firmware are not documented by Qlogic) From owner-freebsd-drivers@FreeBSD.ORG Fri Sep 23 15:38:40 2011 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59EE4106564A; Fri, 23 Sep 2011 15:38:40 +0000 (UTC) (envelope-from gavin.atkinson@ury.york.ac.uk) Received: from ixe-mta-27.emailfiltering.com (ixe-mta-27-tx.emailfiltering.com [194.116.199.158]) by mx1.freebsd.org (Postfix) with ESMTP id 881F38FC12; Fri, 23 Sep 2011 15:38:39 +0000 (UTC) Received: from mail-gw14.york.ac.uk ([144.32.129.164]) by ixe-mta-27.emailfiltering.com with emfmta (version 4.8.3.54) by TLS id 1295691174 for hselasky@c2i.net; 3a0a1a60edd1a086; Fri, 23 Sep 2011 16:21:08 +0100 Received: from buffy-128.york.ac.uk ([144.32.128.160]:24806) by mail-gw14.york.ac.uk with esmtpsa (SSL3.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1R77Yo-0005mq-VN; Fri, 23 Sep 2011 16:21:06 +0100 X-Authenticated-User: ga9 From: Gavin Atkinson To: Hans Petter Selasky In-Reply-To: <201109222007.19182.hselasky@c2i.net> References: <75E1A2A7D185F841A975979B0906BBA67BCCAB7609@AVEXMB1.qlogic.org> <201109222007.19182.hselasky@c2i.net> Content-Type: text/plain; charset="ASCII" Date: Fri, 23 Sep 2011 16:21:06 +0100 Message-ID: <1316791266.39972.3.camel@buffy.york.ac.uk> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: freebsd-current@freebsd.org, "freebsd-drivers@freebsd.org" Subject: Re: Choosing between DELAY(useconds) and pause() X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2011 15:38:40 -0000 On Thu, 2011-09-22 at 20:07 +0200, Hans Petter Selasky wrote: > On Thursday 22 September 2011 19:55:23 David Somayajulu wrote: > > It appears that the pause() function cannot be used in driver functions > > which are invoked early in the boot process. Is there is a kernel api > > which a device driver can use to determine whether to use pause() or > > DELAY(), for delays which are say greater than 10hz - may be even 1 hz ? > > Maybe you want to use something like this: > > if (cold) > DELAY() > else > pause() > > In your code. Note that this still shouldn't be done in your suspend/resume paths, as "cold" isn't set there, however there also appears to be no guarantee that pause() will ever return (as you could be running after the timer has been suspended, or before it resumes). I'm not sure what the correct answer is for suspend/resume code. Gavin