Zephyr Project API 3.7.0
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
23#include <zephyr/types.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
30#define NET_VLAN_TAG_UNSPEC 0x0fff
31
40{
41 return tci & 0x0fff;
42}
43
52{
53 return (tci >> 12) & 0x01;
54}
55
64{
65 return (tci >> 13) & 0x07;
66}
67
77{
78 return (tci & 0xf000) | (vid & 0x0fff);
79}
80
89static inline uint16_t net_eth_vlan_set_dei(uint16_t tci, bool dei)
90{
91 return (tci & 0xefff) | ((!!dei) << 12);
92}
93
103{
104 return (tci & 0x1fff) | ((pcp & 0x07) << 13);
105}
106
107#ifdef __cplusplus
108}
109#endif
110
116#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:76
static uint8_t net_eth_vlan_get_dei(uint16_t tci)
Get Drop Eligible Indicator from TCI.
Definition ethernet_vlan.h:51
static uint16_t net_eth_vlan_set_dei(uint16_t tci, bool dei)
Set Drop Eligible Indicator to TCI.
Definition ethernet_vlan.h:89
static uint16_t net_eth_vlan_get_vid(uint16_t tci)
Get VLAN identifier from TCI.
Definition ethernet_vlan.h:39
static uint16_t net_eth_vlan_set_pcp(uint16_t tci, uint8_t pcp)
Set Priority Code Point to TCI.
Definition ethernet_vlan.h:102
static uint8_t net_eth_vlan_get_pcp(uint16_t tci)
Get Priority Code Point from TCI.
Definition ethernet_vlan.h:63
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89