xref: /openbmc/linux/include/linux/ppp_defs.h (revision 46126db9)
1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
21da177e4SLinus Torvalds /*
31da177e4SLinus Torvalds  * ppp_defs.h - PPP definitions.
41da177e4SLinus Torvalds  *
5784db3f0SPaul Mackerras  * Copyright 1994-2000 Paul Mackerras.
61da177e4SLinus Torvalds  */
71da177e4SLinus Torvalds #ifndef _PPP_DEFS_H_
81da177e4SLinus Torvalds #define _PPP_DEFS_H_
91da177e4SLinus Torvalds 
102c88f4a8SDavid Woodhouse #include <linux/crc-ccitt.h>
11607ca46eSDavid Howells #include <uapi/linux/ppp_defs.h>
12607ca46eSDavid Howells 
131da177e4SLinus Torvalds #define PPP_FCS(fcs, c) crc_ccitt_byte(fcs, c)
14*46126db9SWojciech Drewek 
15*46126db9SWojciech Drewek /**
16*46126db9SWojciech Drewek  * ppp_proto_is_valid - checks if PPP protocol is valid
17*46126db9SWojciech Drewek  * @proto: PPP protocol
18*46126db9SWojciech Drewek  *
19*46126db9SWojciech Drewek  * Assumes proto is not compressed.
20*46126db9SWojciech Drewek  * Protocol is valid if the value is odd and the least significant bit of the
21*46126db9SWojciech Drewek  * most significant octet is 0 (see RFC 1661, section 2).
22*46126db9SWojciech Drewek  */
ppp_proto_is_valid(u16 proto)23*46126db9SWojciech Drewek static inline bool ppp_proto_is_valid(u16 proto)
24*46126db9SWojciech Drewek {
25*46126db9SWojciech Drewek 	return !!((proto & 0x0101) == 0x0001);
26*46126db9SWojciech Drewek }
27*46126db9SWojciech Drewek 
281da177e4SLinus Torvalds #endif /* _PPP_DEFS_H_ */
29