Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Sep 2011 18:28:49 +0200
From:      "K. Macy" <kmacy@freebsd.org>
To:        Naresh <gbal.naresh@gmail.com>
Cc:        Robert Watson <rwatson@freebsd.org>, freebsd-drivers@freebsd.org
Subject:   Re: Multiple TX queue support in nic driver
Message-ID:  <CAHM0Q_PUGHmtJnf6Y5Nw3QUrPmJaEVQenZOHkWfJLurP4mQaQQ@mail.gmail.com>
In-Reply-To: <6C998B08-9053-49F4-B918-B88331AE4D17@gmail.com>
References:  <201109190813.37817.jhb@freebsd.org> <CAHM0Q_MHjXu8Z0-0Zw4Lovgx0H=WAtVRGe1nGp9F7sdfcDwLtg@mail.gmail.com> <6C998B08-9053-49F4-B918-B88331AE4D17@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
(added -drivers back to the CC for your mail's educational value)

On Tue, Sep 20, 2011 at 5:02 PM, Naresh <gbal.naresh@gmail.com> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHM0Q_PUGHmtJnf6Y5Nw3QUrPmJaEVQenZOHkWfJLurP4mQaQQ>