Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
ethernet_vlan.h
Go to the documentation of this file.
1
7/*
8 * Copyright (c) 2018 Intel Corporation
9 *
10 * SPDX-License-Identifier: Apache-2.0
11 */
12
13#ifndef ZEPHYR_INCLUDE_NET_ETHERNET_VLAN_H_
14#define ZEPHYR_INCLUDE_NET_ETHERNET_VLAN_H_
15
25#include <zephyr/types.h>
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
32#define NET_VLAN_TAG_UNSPEC 0x0fff
33
42{
43 return tci & 0x0fff;
44}
45
54{
55 return (tci >> 12) & 0x01;
56}
57
66{
67 return (tci >> 13) & 0x07;
68}
69
79{
80 return (tci & 0xf000) | (vid & 0x0fff);
81}
82
91static inline uint16_t net_eth_vlan_set_dei(uint16_t tci, bool dei)
92{
93 return (tci & 0xefff) | ((!!dei) << 12);
94}
95
105{
106 return (tci & 0x1fff) | ((pcp & 0x07) << 13);
107}
108
109#ifdef __cplusplus
110}
111#endif
112
118#endif /* ZEPHYR_INCLUDE_NET_ETHERNET_VLAN_H_ */
static uint16_t net_eth_vlan_set_vid(uint16_t tci, uint16_t vid)
Set VLAN identifier to TCI.
Definition ethernet_vlan.h:78
static uint8_t net_eth_vlan_get_dei(uint16_t tci)
Get Drop Eligible Indicator from TCI.
Definition ethernet_vlan.h:53
static uint16_t net_eth_vlan_set_dei(uint16_t tci, bool dei)
Set Drop Eligible Indicator to TCI.
Definition ethernet_vlan.h:91
static uint16_t net_eth_vlan_get_vid(uint16_t tci)
Get VLAN identifier from TCI.
Definition ethernet_vlan.h:41
static uint16_t net_eth_vlan_set_pcp(uint16_t tci, uint8_t pcp)
Set Priority Code Point to TCI.
Definition ethernet_vlan.h:104
static uint8_t net_eth_vlan_get_pcp(uint16_t tci)
Get Priority Code Point from TCI.
Definition ethernet_vlan.h:65
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89