iPXE
vlan.h
Go to the documentation of this file.
1 #ifndef _IPXE_VLAN_H
2 #define _IPXE_VLAN_H
3 
4 /**
5  * @file
6  *
7  * Virtual LANs
8  *
9  */
10 
11 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
12 
13 #include <ipxe/netdevice.h>
14 
15 /** A VLAN header */
16 struct vlan_header {
17  /** Tag control information */
19  /** Encapsulated protocol */
21 } __attribute__ (( packed ));
22 
23 /**
24  * Extract VLAN tag from tag control information
25  *
26  * @v tci Tag control information
27  * @ret tag VLAN tag
28  */
29 #define VLAN_TAG( tci ) ( (tci) & 0x0fff )
30 
31 /**
32  * Extract VLAN priority from tag control information
33  *
34  * @v tci Tag control information
35  * @ret priority Priority
36  */
37 #define VLAN_PRIORITY( tci ) ( (tci) >> 13 )
38 
39 /**
40  * Construct VLAN tag control information
41  *
42  * @v tag VLAN tag
43  * @v priority Priority
44  * @ret tci Tag control information
45  */
46 #define VLAN_TCI( tag, priority ) ( ( (priority) << 13 ) | (tag) )
47 
48 /**
49  * Check VLAN tag is valid
50  *
51  * @v tag VLAN tag
52  * @ret is_valid VLAN tag is valid
53  */
54 #define VLAN_TAG_IS_VALID( tag ) ( (tag) < 0xfff )
55 
56 /**
57  * Check VLAN priority is valid
58  *
59  * @v priority VLAN priority
60  * @ret is_valid VLAN priority is valid
61  */
62 #define VLAN_PRIORITY_IS_VALID( priority ) ( (priority) <= 7 )
63 
64 extern unsigned int vlan_tag ( struct net_device *netdev );
65 extern int vlan_can_be_trunk ( struct net_device *trunk );
66 extern int vlan_create ( struct net_device *trunk, unsigned int tag,
67  unsigned int priority );
68 extern int vlan_destroy ( struct net_device *netdev );
69 extern void vlan_netdev_rx ( struct net_device *netdev, unsigned int tag,
70  struct io_buffer *iobuf );
71 extern void vlan_netdev_rx_err ( struct net_device *netdev, unsigned int tag,
72  struct io_buffer *iobuf, int rc );
73 
74 #endif /* _IPXE_VLAN_H */
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
#define __attribute__(x)
Definition: compiler.h:10
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
unsigned short uint16_t
Definition: stdint.h:11
uint16_t tci
Tag control information.
Definition: vlan.h:18
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)
Definition: netdevice.c:1135
uint16_t net_proto
Encapsulated protocol.
Definition: vlan.h:20
int vlan_create(struct net_device *trunk, unsigned int tag, unsigned int priority)
Create VLAN device.
Definition: vlan.c:338
A VLAN header.
Definition: vlan.h:16
static struct net_device * netdev
Definition: gdbudp.c:52
int vlan_can_be_trunk(struct net_device *trunk)
Check if network device can be used as a VLAN trunk device.
Definition: vlan.c:324
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)
Definition: netdevice.c:1153
A network device.
Definition: netdevice.h:348
Network device management.
uint16_t priority
Priotity.
Definition: stp.h:12
int vlan_destroy(struct net_device *netdev)
Destroy VLAN device.
Definition: vlan.c:428
uint64_t tag
Identity tag.
Definition: edd.h:30
unsigned int vlan_tag(struct net_device *netdev)
Get the VLAN tag.
Definition: vlan.c:296
A persistent I/O buffer.
Definition: iobuf.h:32