1.\" -*- nroff -*- 2.\" 3.\" $NetBSD: bpfjit.4,v 1.3 2024/09/07 20:33:53 rillig Exp $ 4.\" 5.\" Copyright (c) 2014 Alexander Nasonov. 6.\" All rights reserved. 7.\" 8.\" Redistribution and use in source and binary forms, with or without 9.\" modification, are permitted provided that the following conditions 10.\" are met: 11.\" 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in 16.\" the documentation and/or other materials provided with the 17.\" distribution. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 22.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 23.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 24.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, 25.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 27.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 29.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.Dd July 24, 2014 33.Dt BPFJIT 4 34.Os 35.Sh NAME 36.Nm bpfjit 37.Nd Just-In-Time compiler for Berkeley Packet Filter 38.Sh SYNOPSIS 39.Cd "options BPFJIT" 40.Cd "options SLJIT" 41.Sh DESCRIPTION 42The 43.Nm 44kernel interface adds 45.Sy Just-In-Time 46compilation of filter programs sent to a 47.Xr bpf 4 48device. 49Instead of being interpreted for every packet, 50these filter programs are compiled into native code 51and the code is being executed for every packet. 52.Pp 53The implementation of 54.Nm 55is based on the 56.Sy Stack-Less Just-In-Time 57library, or 58.Nm sljit 59for short. 60The library supports multiple platforms including 61.Bl -bullet -offset indent -compact 62.It 63AMD-x86 64 64.It 65ARM 32 (ARM-v5, ARM-v7 and Thumb2 instruction sets) 66.It 67Intel-x86 32 68.It 69MIPS 32 (III, R1) 70.It 71MIPS 64 (III, R1) 72.It 73PowerPC 32 74.It 75PowerPC 64 76.It 77SPARC 32 78.El 79.Pp 80.Nm 81supports all architectures listed above. 82.Pp 83.Nm 84is also available as a module in modular kernels. 85.Sh SYSCTLS 86The following sysctl is available when 87.Nm 88is enabled: 89.Bl -tag -width "XnetXbpfXjitXX" 90.It Li net.bpf.jit 91Toggle 92.Sy Just-In-Time 93compilation of new filter programs. 94Changing a value of this sysctl doesn't affect 95existing filter programs. 96.El 97.Sh SEE ALSO 98.Xr bpf 4 , 99.Xr modload 8 100.Pp 101.Lk https://zherczeg.github.io/sljit/ sljit library 102.Sh HISTORY 103The 104.Nm 105interface first appeared in 106.Nx 7.0 . 107.Sh AUTHORS 108The 109.Nm 110code was written by 111.An Alexander Nasonov Aq Mt alnsn@NetBSD.org . 112.Pp 113The 114.Nm sljit 115library was written by 116.An Zoltan Herczeg Aq Mt hzmester@freemail.hu . 117