|
iPXE
|
The TAP driver. More...
#include <errno.h>#include <string.h>#include <stdio.h>#include <ipxe/linux_api.h>#include <ipxe/list.h>#include <ipxe/linux.h>#include <ipxe/malloc.h>#include <ipxe/device.h>#include <ipxe/netdevice.h>#include <ipxe/iobuf.h>#include <ipxe/ethernet.h>#include <ipxe/settings.h>#include <ipxe/socket.h>#include <linux/socket.h>#include <linux/if.h>#include <linux/if_ether.h>#include <linux/if_tun.h>Go to the source code of this file.
Data Structures | |
| struct | tap_nic |
Macros | |
| #define | _SYS_SOCKET_H |
| #define | __GLIBC__ 2 |
| #define | RX_BUF_SIZE 1536 |
| #define | RX_QUOTA 4 |
Functions | |
| static int | tap_open (struct net_device *netdev) |
| Open the TAP device. | |
| static void | tap_close (struct net_device *netdev) |
| Close the TAP device. | |
| static int | tap_transmit (struct net_device *netdev, struct io_buffer *iobuf) |
| Transmit an ethernet packet. | |
| static void | tap_poll (struct net_device *netdev) |
| Poll for new packets. | |
| static void | tap_irq (struct net_device *netdev, int enable) |
| Set irq. | |
| static int | tap_probe (struct linux_device *device, struct linux_device_request *request) |
| Handle a device request for the tap driver. | |
| static void | tap_remove (struct linux_device *device) |
| Remove the device. | |
| LINUX_ROM ("tap", "Linux TUN/TAP NIC") | |
Variables | |
| static const uint8_t | tap_default_mac [ETH_ALEN] |
| Default MAC address. | |
| static struct net_device_operations | tap_operations |
| Tap operations. | |
| struct linux_driver tap_driver | __linux_driver |
| Tap linux_driver. | |
| #define RX_QUOTA 4 |
Definition at line 43 of file tap.c.
Referenced by tap_poll().
|
static |
Open the TAP device.
Definition at line 64 of file tap.c.
References DBGC, linux_close(), linux_errno, linux_fcntl(), linux_ioctl(), linux_open(), linux_strerror(), memset(), netdev, and strncpy().
|
static |
|
static |
Transmit an ethernet packet.
The packet can be written to the TAP device and marked as complete immediately.
Definition at line 114 of file tap.c.
References io_buffer::data, DBGC2, ETH_ZLEN, iob_pad(), linux_write(), netdev, netdev_tx_complete(), rc, and io_buffer::tail.
|
static |
Poll for new packets.
Definition at line 130 of file tap.c.
References alloc_iob(), io_buffer::data, DBGC, DBGC2, free_iob(), iob_put, linux_errno, linux_poll(), linux_read(), linux_strerror(), netdev, netdev_rx(), r, RX_BUF_SIZE, and RX_QUOTA.
|
static |
|
static |
Handle a device request for the tap driver.
Definition at line 194 of file tap.c.
References alloc_etherdev(), linux_setting::applied, device_description::bus_type, BUS_TYPE_TAP, device::desc, EINVAL, ENOMEM, ETH_ALEN, linux_apply_settings(), linux_find_setting(), linux_set_drvdata(), memcpy(), memset(), device::name, netdev, netdev_init(), netdev_link_up(), netdev_nullify(), netdev_put(), printf(), rc, register_netdev(), request, snprintf(), tap_default_mac, tap_operations, unregister_netdev(), and linux_setting::value.
|
static |
Remove the device.
Definition at line 248 of file tap.c.
References linux_get_drvdata(), netdev, netdev_nullify(), netdev_put(), and unregister_netdev().
| LINUX_ROM | ( | "tap" | , |
| "Linux TUN/TAP NIC" | ) |
Default MAC address.
Definition at line 60 of file tap.c.
Referenced by tap_probe().
|
static |
Tap operations.
Definition at line 185 of file tap.c.
Referenced by tap_probe().
| struct linux_driver tap_driver __linux_driver |
Tap linux_driver.