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

next in thread | previous in thread | raw e-mail | index | archive | help
Thanks a lot Macy.

On 20-Sep-2011, at 9:58 PM, "K. Macy" <kmacy@freebsd.org> wrote:

> (added -drivers back to the CC for your mail's educational value)
>=20
> On Tue, Sep 20, 2011 at 5:02 PM, Naresh <gbal.naresh@gmail.com> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5FB5EDF5-8716-495C-856C-2CC87DDF8CE6>