Staging: brcm80211: remove unneeded #ifdef checks
[deliverable/linux.git] / drivers / staging / brcm80211 / include / proto / bcmip.h
CommitLineData
cf2b4488
HP
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _bcmip_h_
18#define _bcmip_h_
19
cf2b4488 20#include <typedefs.h>
cf2b4488
HP
21#include <packed_section_start.h>
22
23#define IP_VER_OFFSET 0x0
24#define IP_VER_MASK 0xf0
25#define IP_VER_SHIFT 4
26#define IP_VER_4 4
27#define IP_VER_6 6
28
29#define IP_VER(ip_body) \
30 ((((uint8 *)(ip_body))[IP_VER_OFFSET] & IP_VER_MASK) >> IP_VER_SHIFT)
31
cf2b4488 32#define IPV4_TOS_OFFSET 1
cf2b4488
HP
33
34#define IPV4_ADDR_LEN 4
35
cf2b4488
HP
36#define IPV4_TOS(ipv4_body) (((uint8 *)(ipv4_body))[IPV4_TOS_OFFSET])
37
38#define IPV4_TOS_PREC_MASK 0xe0
39#define IPV4_TOS_PREC_SHIFT 5
40
cf2b4488
HP
41BWL_PRE_PACKED_STRUCT struct ipv4_addr {
42 uint8 addr[IPV4_ADDR_LEN];
43} BWL_POST_PACKED_STRUCT;
44
cf2b4488
HP
45#define IPV6_TRAFFIC_CLASS(ipv6_body) \
46 (((((uint8 *)(ipv6_body))[0] & 0x0f) << 4) | \
47 ((((uint8 *)(ipv6_body))[1] & 0xf0) >> 4))
48
cf2b4488
HP
49#ifndef IP_TOS
50#define IP_TOS(ip_body) \
51 (IP_VER(ip_body) == IP_VER_4 ? IPV4_TOS(ip_body) : \
52 IP_VER(ip_body) == IP_VER_6 ? IPV6_TRAFFIC_CLASS(ip_body) : 0)
53#endif
54
55#include <packed_section_end.h>
56
57#endif /* _bcmip_h_ */
This page took 0.032297 seconds and 5 git commands to generate.