summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/link/fdbased/mmap.go
diff options
context:
space:
mode:
authorBhasker Hariharan <bhaskerh@google.com>2019-02-13 14:52:06 -0800
committerShentubot <shentubot@google.com>2019-02-13 14:53:03 -0800
commite0b3d3323fbb4b27280f0087427bb04c3e71238b (patch)
tree4ad81ee05445e0f11a9c1c6fe1227bf49ecbbbab /pkg/tcpip/link/fdbased/mmap.go
parent0e84ae72e086c77cea066000a898b7bc951ba790 (diff)
Add support for using PACKET_RX_RING to receive packets.
PACKET_RX_RING allows the use of an mmapped buffer to receive packets from the kernel. This should cut down the number of host syscalls that need to be made to receive packets when the underlying fd is a socket of the AF_PACKET type. PiperOrigin-RevId: 233834998 Change-Id: I8060025c6ced206986e94cc46b8f382b81bfa47f
Diffstat (limited to 'pkg/tcpip/link/fdbased/mmap.go')
-rw-r--r--pkg/tcpip/link/fdbased/mmap.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/pkg/tcpip/link/fdbased/mmap.go b/pkg/tcpip/link/fdbased/mmap.go
new file mode 100644
index 000000000..f1e71c233
--- /dev/null
+++ b/pkg/tcpip/link/fdbased/mmap.go
@@ -0,0 +1,33 @@
+// Copyright 2019 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// +build !linux !amd64
+
+package fdbased
+
+import "gvisor.googlesource.com/gvisor/pkg/tcpip"
+
+// Stubbed out versions for non-linux/non-amd64 platforms.
+
+func (e *endpoint) setupPacketRXRing() error {
+ return nil
+}
+
+func (e *endpoint) readMMappedPacket() ([]byte, *tcpip.Error) {
+ return nil, nil
+}
+
+func (e *endpoint) packetMMapDispatch() (bool, *tcpip.Error) {
+ return false, nil
+}