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