From owner-freebsd-net@FreeBSD.ORG Tue Jul 2 13:38:29 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 317491D2 for ; Tue, 2 Jul 2013 13:38:29 +0000 (UTC) (envelope-from rizzo.unipi@gmail.com) Received: from mail-lb0-x229.google.com (mail-lb0-x229.google.com [IPv6:2a00:1450:4010:c04::229]) by mx1.freebsd.org (Postfix) with ESMTP id AFB781E22 for ; Tue, 2 Jul 2013 13:38:28 +0000 (UTC) Received: by mail-lb0-f169.google.com with SMTP id d10so3389572lbj.0 for ; Tue, 02 Jul 2013 06:38:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=5EIiI5qx0Yy8oxhHcM2LzWrOZvJ+/RJWkcr0lGlKeSU=; b=i1fMkIN777Y9KTj+Sti11gZgayyyfHqJt/Le+8l3GnpPMDm90pRbv5Zn7ZXkgW2CSM TEVkN1XKbw15Nkg8h+MQgNOaJuuYmP24Ljumu0YszoiODLRhJ1O+RG+RvFAUWdS6GAH7 vdqrE0GKVYaht6H42fs0LEGzTstCGuHKCiKPyvqzEXiKi3G3WQYDaxkq0rZq2wBEG+1w nL+uIlaKCFZa0XtMq9v77LJI87UH24wwrnUJynqrfvpc1PTmDQDg8X+8cMQRiHPsWeNK n3K2NMxbbe4B7DrQ76oOf5pe36IncrH+hFthc7KXLRTqf/NGnQOC1MwizlIP66KhsreM xbJA== MIME-Version: 1.0 X-Received: by 10.112.5.199 with SMTP id u7mr13995356lbu.67.1372772307636; Tue, 02 Jul 2013 06:38:27 -0700 (PDT) Sender: rizzo.unipi@gmail.com Received: by 10.114.200.15 with HTTP; Tue, 2 Jul 2013 06:38:27 -0700 (PDT) In-Reply-To: References: Date: Tue, 2 Jul 2013 15:38:27 +0200 X-Google-Sender-Auth: cK4N2xZ3u5qM4QnifWhdIf3mO4I Message-ID: Subject: Re: Multiqueue support for bpf From: Luigi Rizzo To: Takuya ASADA Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: FreeBSD Net X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jul 2013 13:38:29 -0000 On Mon, Jul 1, 2013 at 2:01 PM, Takuya ASADA 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) -----------------------------------------+-------------------------------