Date: Tue, 2 Jul 2013 15:38:27 +0200 From: Luigi Rizzo <rizzo@iet.unipi.it> To: Takuya ASADA <syuu@dokukino.com> Cc: FreeBSD Net <freebsd-net@freebsd.org> Subject: Re: Multiqueue support for bpf Message-ID: <CA%2BhQ2%2BgwW6FOQS79xmWVLSWWHrZMFnhaUM98Kp6aDVaUePNfTA@mail.gmail.com> In-Reply-To: <CALG4x-V-OLoqMXQarSNy5Lv3kNVu01AiN4A49Nv7t-Ysfr1DBg@mail.gmail.com> References: <CALG4x-V-OLoqMXQarSNy5Lv3kNVu01AiN4A49Nv7t-Ysfr1DBg@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jul 1, 2013 at 2:01 PM, Takuya ASADA <syuu@dokukino.com> wrote: > Hi all, > > I'd like to propose multiqueue support for bpf. > It's result of GSoC'11, and proposed on freebsd-net at Aug.2011 but not yet > merged: > > http://www.google-melange.com/gsoc/proposal/review/google/gsoc2011/syuu1228/1 > http://lists.freebsd.org/pipermail/freebsd-net/2011-August/029585.html Do you have an updated URL for the diffs ? The link below from your original message seems not working now (NXDOMAIN) http://www.dokukino.com/mq_bpf_20110813.diff Specifically, I am curious about the type of mbuf changes, because there are many pending changes to the mbufs we'd like to have (such as some local room/leading space to store metadata instead of using expensive mtags), and in the interest of API stability we should try and make those changes at once. ifnet changes are also a concern but less important (they are only a compile time issue, whereas mbuf changes potentially have an impact on runtime) cheers luigi > > The objectives of the patch is to support multiqueue NICs on BPF, and > provide interfaces for multithreaded packet processing using BPF. > To get optimal performance and to reduce lock contention, multiqueue BPF > provides a feature to specify hardware queues. > Following is basic usage of multiqueue BPF: > > void *bpf_thread(void *arg) { > cpu = (int)arg; > CPU_ZERO(&cpuset); > CPU_SET(cpu, &cpuset); > cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, -1, sizeof(cpuset), > &cpuset); > fd = open("/dev/bpf0", O_RDWR); > ioctl(fd, BIOCSTRXQMASK, &cpu); > ioctl(fd, BIOCSTTXQMASK, &cpu); > /* actual works */ > } > > int main(void) > { > for (i = 0; i < maxcpus; i++) > pthread_create(&threads[i], NULL, bpf_thread, (void *)i); > for (i = 0; i < maxcpus; i++) > pthread_join(&threads[i], NULL); > } > > In this example, threads[n] bind to CPUn, receives packets from rxqueue n > and txqueue n. > > To implement it, the patch modifies bpf_*tap*() and extends struct ifnet, > struct mbuf to notify hardware queue information. > > The changes are in this branch: > http://svnweb.freebsd.org/base/user/syuu/mq_bpf/ > > API descriptions and benchmark results are on previous post: > http://lists.freebsd.org/pipermail/freebsd-net/2011-August/029585.html > > Benchmark program is on this repository: > https://github.com/syuu1228/mq_bpf_test > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" > -- -----------------------------------------+------------------------------- Prof. Luigi RIZZO, rizzo@iet.unipi.it . Dip. di Ing. dell'Informazione http://www.iet.unipi.it/~luigi/ . Universita` di Pisa TEL +39-050-2211611 . via Diotisalvi 2 Mobile +39-338-6809875 . 56122 PISA (Italy) -----------------------------------------+-------------------------------
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2BhQ2%2BgwW6FOQS79xmWVLSWWHrZMFnhaUM98Kp6aDVaUePNfTA>