1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * ppp_defs.h - PPP definitions.
4  *
5  * Copyright 1994-2000 Paul Mackerras.
6  */
7 #ifndef _PPP_DEFS_H_
8 #define _PPP_DEFS_H_
9 
10 #include <linux/crc-ccitt.h>
11 #include <uapi/linux/ppp_defs.h>
12 
13 #define PPP_FCS(fcs, c) crc_ccitt_byte(fcs, c)
14 
15 /**
16  * ppp_proto_is_valid - checks if PPP protocol is valid
17  * @proto: PPP protocol
18  *
19  * Assumes proto is not compressed.
20  * Protocol is valid if the value is odd and the least significant bit of the
21  * most significant octet is 0 (see RFC 1661, section 2).
22  */
ppp_proto_is_valid(u16 proto)23 static inline bool ppp_proto_is_valid(u16 proto)
24 {
25 	return !!((proto & 0x0101) == 0x0001);
26 }
27 
28 #endif /* _PPP_DEFS_H_ */
29