xref: /netbsd-src/share/man/man4/shmif.4 (revision e401b66b04d06ef1b0d516129cc9682a9a6260d3)
1*e401b66bSrin.\"	$NetBSD: shmif.4,v 1.5 2018/12/12 02:26:40 rin Exp $
278439d6cSpooka.\"
378439d6cSpooka.\" Copyright (c) 2010 Antti Kantee
478439d6cSpooka.\" All rights reserved.
578439d6cSpooka.\"
678439d6cSpooka.\" Redistribution and use in source and binary forms, with or without
778439d6cSpooka.\" modification, are permitted provided that the following conditions
878439d6cSpooka.\" are met:
978439d6cSpooka.\" 1. Redistributions of source code must retain the above copyright
1078439d6cSpooka.\"    notice, this list of conditions and the following disclaimer.
1178439d6cSpooka.\" 2. Redistributions in binary form must reproduce the above copyright
1278439d6cSpooka.\"    notice, this list of conditions and the following disclaimer in the
1378439d6cSpooka.\"    documentation and/or other materials provided with the distribution.
1478439d6cSpooka.\"
1578439d6cSpooka.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1678439d6cSpooka.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1778439d6cSpooka.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1878439d6cSpooka.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1978439d6cSpooka.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2078439d6cSpooka.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2178439d6cSpooka.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2278439d6cSpooka.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2378439d6cSpooka.\" INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2478439d6cSpooka.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2578439d6cSpooka.\"
26*e401b66bSrin.Dd December 12, 2018
2778439d6cSpooka.Dt SHMIF 4
2878439d6cSpooka.Os
2978439d6cSpooka.Sh NAME
3078439d6cSpooka.Nm shmif
31f9fe2348Spooka.Nd rump kernel shared memory network interface
3278439d6cSpooka.Sh SYNOPSIS
3378439d6cSpooka.In rump/rump.h
3478439d6cSpooka.Ft int
3578439d6cSpooka.Fo rump_pub_shmif_create
3678439d6cSpooka.Fa "const char *path" "int *ifnum"
3778439d6cSpooka.Fc
3878439d6cSpooka.Sh DESCRIPTION
3978439d6cSpookaThe
4078439d6cSpooka.Nm
4178439d6cSpookainterface uses a memory mapped regular file as a virtual Ethernet bus.
4278439d6cSpookaAll interfaces connected to the same bus see each others' traffic.
4378439d6cSpooka.Pp
4478439d6cSpookaUsing a memory mapped regular file as a bus has two implications:
45606383f1Swiz.Bl -enum
46606383f1Swiz.It
47606383f1SwizThe bus identifier is not in flat global namespace.
48606383f1Swiz.It
49606383f1SwizConfiguring and using the interface is possible without superuser
50606383f1Swizprivileges on the host (normal host file access permissions for
51606383f1Swizthe bus hold).
52606383f1Swiz.El
5378439d6cSpooka.Pp
5478439d6cSpookaIt is not possible to directly access the host networking
55f9fe2348Spookafacilities from a rump kernel using purely
5678439d6cSpooka.Nm .
5778439d6cSpookaHowever, traffic can be routed to another rump kernel instance which
5878439d6cSpookaprovides both
5978439d6cSpooka.Nm
6078439d6cSpookaand
6178439d6cSpooka.Xr virt 4
6278439d6cSpookanetworking.
6378439d6cSpooka.Pp
6478439d6cSpookaAn
6578439d6cSpooka.Nm
6678439d6cSpookainterface can be created in two ways:
6778439d6cSpooka.Bl -bullet
6878439d6cSpooka.It
6978439d6cSpookaProgrammatically by calling
7078439d6cSpooka.Fn rump_pub_shmif_create .
7178439d6cSpookaThe bus pathname is passed in
7278439d6cSpooka.Fa path .
73606383f1SwizThe number of the newly created interface is available after a successful
7478439d6cSpookacall by dereferencing
7578439d6cSpooka.Fa ifnum .
7678439d6cSpooka.It
7778439d6cSpookaDynamically at runtime with
7878439d6cSpooka.Xr ifconfig 8
7978439d6cSpookaor equivalent using the
8078439d6cSpooka.Em create
8178439d6cSpookacommand.
8278439d6cSpookaIn this case the bus path must be configured with
8378439d6cSpooka.Xr ifconfig 8
8478439d6cSpooka.Em linkstr
8578439d6cSpookabefore the interface address can be configured.
8678439d6cSpooka.El
87c3eed029Spooka.Pp
88c3eed029SpookaDestroying an
89c3eed029Spooka.Nm
90c3eed029Spookainterface is possible only via
91c3eed029Spooka.Xr ifconfig 8
92c3eed029Spooka.Em destroy .
93*e401b66bSrin.Pp
94*e401b66bSrinAn
95*e401b66bSrin.Nm
96*e401b66bSrininterface emulates TX/RX offload options in software.
97*e401b66bSrinThey are specified by
98*e401b66bSrin.Xr ifconfig 8 .
99*e401b66bSrinAlternatively, its
100*e401b66bSrin.Em if_capenable
101*e401b66bSrinflag is directly specified by
102*e401b66bSrinenvironment variable
103*e401b66bSrin.Ev RUMP_SHMIF_CAPENABLE ,
104*e401b66bSrinfor example:
105*e401b66bSrin.Bl -tag -width 0xfffff
106*e401b66bSrin.It Ar 0x7ff80
107*e401b66bSrinfor all TX/RX offload
108*e401b66bSrin.It Ar 0x6aa80
109*e401b66bSrinfor all TX offload
110*e401b66bSrin.It Ar 0x15500
111*e401b66bSrinfor all RX offload
112*e401b66bSrin.El
113*e401b66bSrin.Pp
114*e401b66bSrinSee
115*e401b66bSrin.Pa /usr/include/net/if.h
116*e401b66bSrinfor more details.
11778439d6cSpooka.Sh SEE ALSO
11878439d6cSpooka.Xr rump 3 ,
11978439d6cSpooka.Xr virt 4 ,
120606383f1Swiz.Xr ifconfig 8
121