iPXE
|
Virtual LANs. More...
#include <ipxe/netdevice.h>
Go to the source code of this file.
Data Structures | |
struct | vlan_header |
A VLAN header. More... | |
Macros | |
#define | VLAN_TAG(tci) ( (tci) & 0x0fff ) |
Extract VLAN tag from tag control information. More... | |
#define | VLAN_PRIORITY(tci) ( (tci) >> 13 ) |
Extract VLAN priority from tag control information. More... | |
#define | VLAN_TCI(tag, priority) ( ( (priority) << 13 ) | (tag) ) |
Construct VLAN tag control information. More... | |
#define | VLAN_TAG_IS_VALID(tag) ( (tag) < 0xfff ) |
Check VLAN tag is valid. More... | |
#define | VLAN_PRIORITY_IS_VALID(priority) ( (priority) <= 7 ) |
Check VLAN priority is valid. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
unsigned int | vlan_tci (struct net_device *netdev) |
Get the VLAN tag control information. More... | |
static unsigned int | vlan_tag (struct net_device *netdev) |
Get the VLAN tag. More... | |
struct net_device * | vlan_find (struct net_device *trunk, unsigned int tag) |
Identify VLAN device. More... | |
int | vlan_can_be_trunk (struct net_device *trunk) |
Check if network device can be used as a VLAN trunk device. More... | |
int | vlan_create (struct net_device *trunk, unsigned int tag, unsigned int priority) |
Create VLAN device. More... | |
int | vlan_destroy (struct net_device *netdev) |
Destroy VLAN device. More... | |
void | vlan_auto (const void *ll_addr, unsigned int tag) |
Configure automatic VLAN device. More... | |
void | vlan_netdev_rx (struct net_device *netdev, unsigned int tag, struct io_buffer *iobuf) |
Add VLAN tag-stripped packet to queue (when VLAN support is not present) More... | |
void | vlan_netdev_rx_err (struct net_device *netdev, unsigned int tag, struct io_buffer *iobuf, int rc) |
Discard received VLAN tag-stripped packet (when VLAN support is not present) More... | |
Virtual LANs.
Definition in file vlan.h.
#define VLAN_TAG | ( | tci | ) | ( (tci) & 0x0fff ) |
#define VLAN_PRIORITY | ( | tci | ) | ( (tci) >> 13 ) |
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
unsigned int vlan_tci | ( | struct net_device * | netdev | ) |
Get the VLAN tag control information.
netdev | Network device |
tci | VLAN tag control information, or 0 if not a VLAN device |
Definition at line 301 of file vlan.c.
References netdev, net_device::op, vlan_device::priority, net_device::priv, vlan_device::tag, vlan_operations, and VLAN_TCI.
Referenced by vlan_tag().
|
inlinestatic |
Get the VLAN tag.
netdev | Network device |
tag | VLAN tag, or 0 if device is not a VLAN device |
Definition at line 73 of file vlan.h.
References netdev, VLAN_TAG, and vlan_tci().
Referenced by cachedhcp_apply(), efi_netdev_path(), ibft_fill_nic(), and is_autoboot_ll_addr().
struct net_device* vlan_find | ( | struct net_device * | trunk, |
unsigned int | tag | ||
) |
Identify VLAN device.
trunk | Trunk network device |
tag | VLAN tag |
netdev | VLAN device, if any |
Definition at line 208 of file vlan.c.
References for_each_netdev, netdev, NULL, net_device::op, net_device::priv, tag, vlan_device::tag, vlan_device::trunk, and vlan_operations.
Referenced by efi_vlan_find(), efi_vlan_remove(), vlan_create(), vlan_netdev_rx(), vlan_netdev_rx_err(), and vlan_rx().
int vlan_can_be_trunk | ( | struct net_device * | trunk | ) |
Check if network device can be used as a VLAN trunk device.
trunk | Trunk network device |
is_ok | Trunk network device is usable |
VLAN devices will be created as Ethernet devices. (We cannot simply clone the link layer of the trunk network device, because this link layer may expect the network device structure to contain some link-layer-private data.) The trunk network device must therefore have a link layer that is in some sense 'compatible' with Ethernet; specifically, it must have link-layer addresses that are the same length as Ethernet link-layer addresses.
As an additional check, and primarily to assist with the sanity of the FCoE code, we refuse to allow nested VLANs.
Definition at line 329 of file vlan.c.
References ETH_ALEN, ll_protocol::ll_addr_len, net_device::ll_protocol, net_device::op, vlan_device::trunk, and vlan_operations.
Referenced by fcoe_expired(), fcoe_reset(), vlan_create(), and vlan_probe().
int vlan_create | ( | struct net_device * | trunk, |
unsigned int | tag, | ||
unsigned int | priority | ||
) |
Create VLAN device.
trunk | Trunk network device |
tag | VLAN tag |
priority | Default VLAN priority |
rc | Return status code |
Definition at line 343 of file vlan.c.
References alloc_etherdev(), DBGC, net_device::dev, EINVAL, ENOMEM, ENOTTY, ETH_ALEN, net_device::hw_addr, net_device::ll_addr, memcpy(), net_device::name, netdev, netdev_get(), netdev_init(), netdev_irq_supported(), NETDEV_IRQ_UNSUPPORTED, netdev_nullify(), netdev_put(), NULL, priority, vlan_device::priority, net_device::priv, rc, register_netdev(), snprintf(), net_device::state, strerror(), tag, vlan_device::tag, vlan_device::trunk, unregister_netdev(), vlan_can_be_trunk(), vlan_find(), vlan_operations, VLAN_PRIORITY_IS_VALID, vlan_sync(), and VLAN_TAG_IS_VALID.
Referenced by efi_vlan_set(), fcoe_fip_rx_vlan(), vcreate_exec(), and vlan_probe().
int vlan_destroy | ( | struct net_device * | netdev | ) |
Destroy VLAN device.
netdev | Network device |
rc | Return status code |
Definition at line 433 of file vlan.c.
References DBGC, ENOTTY, net_device::name, netdev, netdev_nullify(), netdev_put(), net_device::op, net_device::priv, vlan_device::trunk, unregister_netdev(), and vlan_operations.
Referenced by efi_vlan_remove(), vdestroy_exec(), and vlan_remove_first().
void vlan_auto | ( | const void * | ll_addr, |
unsigned int | tag | ||
) |
Configure automatic VLAN device.
ll_addr | Link-layer address |
tag | VLAN tag |
Definition at line 462 of file vlan.c.
References ETH_ALEN, net_device::ll_addr, memcpy(), tag, vlan_auto_ll_addr, and vlan_auto_tag.
Referenced by efi_set_autoboot_ll_addr().
void vlan_netdev_rx | ( | struct net_device * | netdev, |
unsigned int | tag, | ||
struct io_buffer * | iobuf | ||
) |
Add VLAN tag-stripped packet to queue (when VLAN support is not present)
netdev | Network device |
tag | VLAN tag, or zero |
iobuf | I/O buffer |
Add VLAN tag-stripped packet to queue (when VLAN support is not present)
netdev | Network device |
tag | VLAN tag, or zero |
iobuf | I/O buffer |
Definition at line 1160 of file netdevice.c.
References ENODEV, netdev, netdev_rx(), netdev_rx_err(), NULL, tag, and vlan_find().
Referenced by hermon_eth_complete_recv(), and intelxl_poll_rx().
void vlan_netdev_rx_err | ( | struct net_device * | netdev, |
unsigned int tag | , | ||
struct io_buffer * | iobuf, | ||
int | rc | ||
) |
Discard received VLAN tag-stripped packet (when VLAN support is not present)
netdev | Network device |
tag | VLAN tag, or zero |
iobuf | I/O buffer, or NULL |
rc | Packet status code |
Discard received VLAN tag-stripped packet (when VLAN support is not present)
netdev | Network device |
tag | VLAN tag, or zero |
iobuf | I/O buffer, or NULL |
rc | Packet status code |
Definition at line 1178 of file netdevice.c.
References netdev, netdev_rx_err(), NULL, rc, tag, and vlan_find().
Referenced by hermon_eth_complete_recv(), and intelxl_poll_rx().