summaryrefslogtreecommitdiff
path: root/proto_vlan.h
blob: dc31cfac98e4c7185c7430ba9d48e7fa6283bc2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
 * proto_vlan.h - VLAN proto helpers & declarations
 * Subject to the GPL, version 2.
 */

#ifndef PROTO_VLAN_H
#define PROTO_VLAN_H

#include <stdbool.h>
#include <inttypes.h>

static inline uint16_t vlan_tci2prio(uint16_t tci)
{
	return (tci & 0xe000) >> 13;
}

static inline uint16_t vlan_tci2cfi(uint16_t tci)
{
	return (tci & 0x1000) >> 12;
}

static inline uint16_t vlan_tci2vid(uint16_t tci)
{
	return tci & 0x0fff;
}

#endif
5a24edd6cf7cb0303c6dc9'>patch) tree585c31efc8dc614a7bc705f73cfb8c69ae728913 parent2d78aee426d821bbecbc80ee96ada5730ee68b6f (diff)
UBI: add an helper to check lnum validity
ubi_leb_valid() is here to replace the lnum < 0 || lnum >= vol->reserved_pebs checks. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat