From owner-p4-projects@FreeBSD.ORG Fri Aug 12 05:18:02 2011 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4259B1065670; Fri, 12 Aug 2011 05:18:02 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5E2E106566B for ; Fri, 12 Aug 2011 05:18:01 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id C4B738FC19 for ; Fri, 12 Aug 2011 05:18:01 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id p7C5I1Al009037 for ; Fri, 12 Aug 2011 05:18:01 GMT (envelope-from syuu@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id p7C5I1Qu009034 for perforce@freebsd.org; Fri, 12 Aug 2011 05:18:01 GMT (envelope-from syuu@FreeBSD.org) Date: Fri, 12 Aug 2011 05:18:01 GMT Message-Id: <201108120518.p7C5I1Qu009034@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to syuu@FreeBSD.org using -f From: Takuya ASADA To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 197533 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Aug 2011 05:18:02 -0000 http://p4web.freebsd.org/@@197533?ac=10 Change 197533 by syuu@kikurage on 2011/08/12 05:17:00 mq_bpf document added on bpf(4) netintro(4) Affected files ... .. //depot/projects/soc2011/mq_bpf/src/share/man/man4/bpf.4#2 edit .. //depot/projects/soc2011/mq_bpf/src/share/man/man4/netintro.4#2 edit Differences ... ==== //depot/projects/soc2011/mq_bpf/src/share/man/man4/bpf.4#2 (text+ko) ==== @@ -47,7 +47,7 @@ .\" This document is derived in part from the enet man page (enet.4) .\" distributed with 4.3BSD Unix. .\" -.\" $FreeBSD: src/share/man/man4/bpf.4,v 1.56 2010/10/08 12:40:16 uqs Exp $ +.\" $FreeBSD$ .\" .Dd June 15, 2010 .Dt BPF 4 @@ -631,6 +631,46 @@ .Vt bzh_kernel_gen against .Vt bzh_user_gen . +.It Dv BIOCENAQMASK +Enables multiqueue filter on the descriptor. + +.It Dv BIOCDISQMASK +Disables multiqueue filter on the descriptor. + +.It Dv BIOCSTRXQMASK +.Pq Li uint32_t +Set mask bit on specified RX queue. + +.It Dv BIOCCRRXQMASK +.Pq Li uint32_t +Clear mask bit on specified RX queue. + +.It Dv BIOCGTRXQMASK +.Pq Li uint32_t +Get mask bit on specified RX queue. + +.It Dv BIOCSTTXQMASK +.Pq Li uint32_t +Set mask bit on specified TX queue. + +.It Dv BIOCCRTXQMASK +.Pq Li uint32_t +Clear mask bit on specified TX queue. + +.It Dv BIOCGTTXQMASK +.Pq Li uint32_t +Get mask bit on specified TX queue. + +.It Dv BIOCSTOTHERMASK +Set mask bit for the packets which not tied with any queues. + +.It Dv BIOCCROTHERMASK +Clear mask bit for the packets which not tied with any queues. + +.It Dv BIOCGTOTHERMASK +.Pq Li uint32_t +Get mask bit for the packets which not tied with any queues. + .El .Sh BPF HEADER One of the following structures is prepended to each packet returned by @@ -1014,6 +1054,24 @@ BPF_STMT(BPF_RET+BPF_K, 0), }; .Ed +.Sh MULTIQUEUE SUPPORT +Multiqueue network interface support function provides interfaces for +multithreaded packet processing using bpf. + +Normal bpf can receive packets from specified interface, multiqueue support +function can receive packets from specified hardware queue. + +This distributes bpf workload on multiple threads, also reduces lock +contention on bpf. + +To make your program multithreaded, you'll need to open bpf descriptor on each +thread, enable multiqueue support by BIOCENAQMASK ioctl, and set queue mask by +BIOCSTRXQMASK / BIOCSTTXQMASK / BIOCSTOTHERMASK ioctls. + +Queue length and queue affinity information may useful to optimize setting +queue mask on bpf descriptor, see +.Xr netintro 4 . + .Sh SEE ALSO .Xr tcpdump 1 , .Xr ioctl 2 , ==== //depot/projects/soc2011/mq_bpf/src/share/man/man4/netintro.4#2 (text+ko) ==== @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)netintro.4 8.2 (Berkeley) 11/30/93 -.\" $FreeBSD: src/share/man/man4/netintro.4,v 1.30 2010/10/08 12:40:16 uqs Exp $ +.\" $FreeBSD$ .\" .Dd April 14, 2010 .Dt NETINTRO 4 @@ -213,6 +213,9 @@ int ifru_media; caddr_t ifru_data; int ifru_cap[2]; + u_int ifru_fib; + int ifru_queue_len[2]; + int ifru_queue_affinity[2]; } ifr_ifru; #define ifr_addr ifr_ifru.ifru_addr /* address */ #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ @@ -228,6 +231,11 @@ #define ifr_reqcap ifr_ifru.ifru_cap[0] /* requested capabilities */ #define ifr_curcap ifr_ifru.ifru_cap[1] /* current capabilities */ #define ifr_index ifr_ifru.ifru_index /* interface index */ +#define ifr_fib ifr_ifru.ifru_fib /* interface fib */ +#define ifr_rxqueue_len ifr_ifru.ifru_queue_len[0] /* rxqueue len */ +#define ifr_txqueue_len ifr_ifru.ifru_queue_len[1] /* txqueue len */ +#define ifr_queue_affinity_index ifr_ifru.ifru_queue_affinity[0] /* queue id */ +#define ifr_queue_affinity_cpu ifr_ifru.ifru_queue_affinity[1] /* cpu id */ }; .Ed .Pp @@ -332,6 +340,12 @@ field will contain the new interface name. .It Dv SIOCIFDESTROY Attempt to destroy the specified interface. +.It Dv SIOCGIFQLEN +Get interface RX/TX queue length. +.It Dv SIOCGIFRXQAFFINITY +Get interface RX queue affinity. +.It Dv SIOCGIFTXQAFFINITY +Get interface TX queue affinity. .El .Pp There are two requests that make use of a new structure: