OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [net/] [inet_ecn.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
#ifndef _INET_ECN_H_
2
#define _INET_ECN_H_
3
 
4
static inline int INET_ECN_is_ce(__u8 dsfield)
5
{
6
        return (dsfield&3) == 3;
7
}
8
 
9
static inline int INET_ECN_is_not_ce(__u8 dsfield)
10
{
11
        return (dsfield&3) == 2;
12
}
13
 
14
static inline int INET_ECN_is_capable(__u8 dsfield)
15
{
16
        return (dsfield&2);
17
}
18
 
19
static inline __u8 INET_ECN_encapsulate(__u8 outer, __u8 inner)
20
{
21
        outer &= ~3;
22
        if (INET_ECN_is_capable(inner))
23
                outer |= (inner & 3);
24
        return outer;
25
}
26
 
27
#define INET_ECN_xmit(sk) do { (sk)->protinfo.af_inet.tos |= 2; } while (0)
28
#define INET_ECN_dontxmit(sk) do { (sk)->protinfo.af_inet.tos &= ~3; } while (0)
29
 
30
#define IP6_ECN_flow_init(label) do {   \
31
      (label) &= ~htonl(3<<20);         \
32
    } while (0)
33
 
34
#define IP6_ECN_flow_xmit(sk, label) do {                       \
35
        if (INET_ECN_is_capable((sk)->protinfo.af_inet.tos))    \
36
                (label) |= __constant_htons(2 << 4);            \
37
    } while (0)
38
 
39
static inline void IP_ECN_set_ce(struct iphdr *iph)
40
{
41
        u32 check = iph->check;
42
        check += __constant_htons(0xFFFE);
43
        iph->check = check + (check>=0xFFFF);
44
        iph->tos |= 1;
45
}
46
 
47
struct ipv6hdr;
48
 
49
static inline void IP6_ECN_set_ce(struct ipv6hdr *iph)
50
{
51
        *(u32*)iph |= htonl(1<<20);
52
}
53
 
54
#define ip6_get_dsfield(iph) ((ntohs(*(u16*)(iph)) >> 4) & 0xFF)
55
 
56
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.