103 const void *ll_source;
112 DBGC (
netdev,
"VLAN %s could not parse link-layer header: " 120 vlanhdr =
iob_push ( iobuf,
sizeof ( *vlanhdr ) );
129 ll_dest_copy, ll_source_copy ) ) != 0 ) {
130 DBGC (
netdev,
"VLAN %s could not transmit: %s\n",
233 const void *ll_dest,
const void *ll_source,
244 if (
iob_len ( iobuf ) <
sizeof ( *vlanhdr ) ) {
245 DBGC ( trunk,
"VLAN %s received underlength packet (%zd " 255 DBGC2 ( trunk,
"VLAN %s received packet for unknown VLAN " 262 iob_pull ( iobuf,
sizeof ( *vlanhdr ) );
272 DBGC (
netdev,
"VLAN %s could not reconstruct link-layer " 353 DBGC (
netdev,
"VLAN %s priority changed from %d to " 362 DBGC (
trunk,
"VLAN %s cannot create VLAN on non-trunk " 368 DBGC (
trunk,
"VLAN %s cannot create VLAN with invalid tag " 374 DBGC (
trunk,
"VLAN %s cannot create VLAN with invalid " 384 goto err_alloc_etherdev;
404 DBGC (
netdev,
"VLAN %s could not register: %s\n",
412 DBGC (
netdev,
"VLAN %s created with tag %d and priority %d\n",
439 DBGC (
netdev,
"VLAN %s cannot destroy non-VLAN device\n",
#define iob_pull(iobuf, len)
#define VLAN_TAG(tci)
Extract VLAN tag from tag control information.
#define EINVAL
Invalid argument.
struct arbelprm_rc_send_wqe rc
const char * name
Protocol name.
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
unsigned int vlan_tci(struct net_device *netdev)
Get the VLAN tag control information.
struct net_device * trunk
Trunk network device.
uint8_t ll_addr_len
Link-layer address length.
static struct net_device_operations vlan_operations
VLAN device operations.
#define FEATURE_PROTOCOL
Network protocols.
int(* open)(struct net_device *netdev)
Open network device.
#define VLAN_TCI(tag, priority)
Construct VLAN tag control information.
void vlan_netdev_rx_err(struct net_device *netdev, unsigned int tag, struct io_buffer *iobuf, int rc)
Discard received VLAN tag-stripped packet.
struct net_protocol vlan_protocol __net_protocol
VLAN protocol.
#define iob_push(iobuf, len)
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
#define EPIPE
Broken pipe.
VLAN device private data.
unsigned int state
Current device state.
#define VLAN_TAG_IS_VALID(tag)
Check VLAN tag is valid.
static void vlan_notify(struct net_device *trunk, void *priv __unused)
Handle trunk network device link state change.
struct net_device_operations * op
Network device operations.
A network upper-layer driver.
static int vlan_remove_first(struct net_device *trunk)
Destroy first VLAN device for a given trunk.
int vlan_create(struct net_device *trunk, unsigned int tag, unsigned int priority)
Create VLAN device.
struct net_device * vlan_find(struct net_device *trunk, unsigned int tag)
Identify VLAN device.
int(* push)(struct net_device *netdev, struct io_buffer *iobuf, const void *ll_dest, const void *ll_source, uint16_t net_proto)
Add link-layer header.
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
static int vlan_rx(struct io_buffer *iobuf, struct net_device *trunk, const void *ll_dest, const void *ll_source, unsigned int flags __unused)
Process incoming VLAN packet.
#define list_del(list)
Delete an entry from a list.
#define ENOMEM
Not enough space.
#define iob_disown(iobuf)
Disown an I/O buffer.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static int netdev_is_open(struct net_device *netdev)
Check whether or not network device is open.
void vlan_auto(const void *ll_addr, unsigned int tag)
Configure automatic VLAN device.
int link_rc
Link status code.
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
#define VLAN_PRIORITY_IS_VALID(priority)
Check VLAN priority is valid.
static void vlan_poll(struct net_device *netdev)
Poll VLAN device.
void * priv
Driver private data.
static int vlan_probe(struct net_device *trunk, void *priv __unused)
Create automatic VLAN device.
#define __unused
Declare a variable or data structure as unused.
static void vlan_sync(struct net_device *netdev)
Synchronise VLAN device.
static struct net_device * netdev
void unregister_netdev(struct net_device *netdev)
Unregister network device.
void netdev_poll(struct net_device *netdev)
Poll for completed and received packets on network device.
char * strerror(int errno)
Retrieve string representation of error number.
static void vlan_close(struct net_device *netdev)
Close VLAN device.
static uint8_t vlan_auto_ll_addr[ETH_ALEN]
Automatic VLAN device link-layer address.
#define for_each_netdev(netdev)
Iterate over all network devices.
int register_netdev(struct net_device *netdev)
Register network device.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
FEATURE(FEATURE_PROTOCOL, "VLAN", DHCP_EB_FEATURE_VLAN, 1)
void netdev_irq(struct net_device *netdev, int enable)
Enable or disable interrupts.
void netdev_link_err(struct net_device *netdev, int rc)
Mark network device as having a specific link state.
#define ENODEV
No such device.
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
static struct net_device * netdev_get(struct net_device *netdev)
Get reference to network device.
int vlan_destroy(struct net_device *netdev)
Destroy VLAN device.
Network device operations.
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
struct device * dev
Underlying hardware device.
void netdev_close(struct net_device *netdev)
Close network device.
A network-layer protocol.
Network device management.
unsigned int tag
VLAN tag.
int vlan_can_be_trunk(struct net_device *trunk)
Check if network device can be used as a VLAN trunk device.
int(* pull)(struct net_device *netdev, struct io_buffer *iobuf, const void **ll_dest, const void **ll_source, uint16_t *net_proto, unsigned int *flags)
Remove link-layer header.
char name[NETDEV_NAME_LEN]
Name of this network device.
struct list_head list
List of which this buffer is a member.
int net_tx(struct io_buffer *iobuf, struct net_device *netdev, struct net_protocol *net_protocol, const void *ll_dest, const void *ll_source)
Transmit network-layer packet.
static struct tlan_private * priv
#define ENOTTY
Inappropriate I/O control operation.
static void vlan_irq(struct net_device *netdev, int enable)
Enable/disable interrupts on VLAN device.
uint16_t priority
Priotity.
struct net_driver vlan_driver __net_driver
VLAN driver.
void * data
Start of data.
static int vlan_open(struct net_device *netdev)
Open VLAN device.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
static void vlan_remove(struct net_device *trunk, void *priv __unused)
Destroy all VLAN devices for a given trunk.
void vlan_netdev_rx(struct net_device *netdev, unsigned int tag, struct io_buffer *iobuf)
Add VLAN tag-stripped packet to receive queue.
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
unsigned int priority
Default priority.
static int vlan_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet on VLAN device.
uint64_t tag
Identity tag.
#define NETDEV_IRQ_UNSUPPORTED
Network device interrupts are unsupported.
#define DHCP_EB_FEATURE_VLAN
VLAN support.
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
#define NULL
NULL pointer (VOID *)
static unsigned int vlan_auto_tag
Automatic VLAN tag.
static int netdev_irq_supported(struct net_device *netdev)
Check whether or not network device supports interrupts.
int netdev_open(struct net_device *netdev)
Open network device.
struct ll_protocol * ll_protocol
Link-layer protocol.