Skip to content

Commit

Permalink
Merge branch 'red' of 84.73.165.173:/home/tgr/repos/net-2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaldo Carvalho de Melo committed Nov 6, 2005
2 parents 6df7163 + bdc450a commit 2d43f11
Show file tree
Hide file tree
Showing 5 changed files with 891 additions and 771 deletions.
50 changes: 24 additions & 26 deletions include/linux/pkt_sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ struct tc_fifo_qopt
/* PRIO section */

#define TCQ_PRIO_BANDS 16
#define TCQ_MIN_PRIO_BANDS 2

struct tc_prio_qopt
{
Expand Down Expand Up @@ -169,6 +170,7 @@ struct tc_red_qopt
unsigned char Scell_log; /* cell size for idle damping */
unsigned char flags;
#define TC_RED_ECN 1
#define TC_RED_HARDDROP 2
};

struct tc_red_xstats
Expand All @@ -194,38 +196,34 @@ enum

#define TCA_GRED_MAX (__TCA_GRED_MAX - 1)

#define TCA_SET_OFF TCA_GRED_PARMS
struct tc_gred_qopt
{
__u32 limit; /* HARD maximal queue length (bytes)
*/
__u32 qth_min; /* Min average length threshold (bytes)
*/
__u32 qth_max; /* Max average length threshold (bytes)
*/
__u32 DP; /* upto 2^32 DPs */
__u32 backlog;
__u32 qave;
__u32 forced;
__u32 early;
__u32 other;
__u32 pdrop;

unsigned char Wlog; /* log(W) */
unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */
unsigned char Scell_log; /* cell size for idle damping */
__u8 prio; /* prio of this VQ */
__u32 packets;
__u32 bytesin;
__u32 limit; /* HARD maximal queue length (bytes) */
__u32 qth_min; /* Min average length threshold (bytes) */
__u32 qth_max; /* Max average length threshold (bytes) */
__u32 DP; /* upto 2^32 DPs */
__u32 backlog;
__u32 qave;
__u32 forced;
__u32 early;
__u32 other;
__u32 pdrop;
__u8 Wlog; /* log(W) */
__u8 Plog; /* log(P_max/(qth_max-qth_min)) */
__u8 Scell_log; /* cell size for idle damping */
__u8 prio; /* prio of this VQ */
__u32 packets;
__u32 bytesin;
};

/* gred setup */
struct tc_gred_sopt
{
__u32 DPs;
__u32 def_DP;
__u8 grio;
__u8 pad1;
__u16 pad2;
__u32 DPs;
__u32 def_DP;
__u8 grio;
__u8 flags;
__u16 pad1;
};

/* HTB section */
Expand Down
28 changes: 24 additions & 4 deletions include/net/inet_ecn.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define _INET_ECN_H_

#include <linux/ip.h>
#include <linux/skbuff.h>
#include <net/dsfield.h>

enum {
Expand Down Expand Up @@ -48,7 +49,7 @@ static inline __u8 INET_ECN_encapsulate(__u8 outer, __u8 inner)
(label) |= __constant_htons(INET_ECN_ECT_0 << 4); \
} while (0)

static inline void IP_ECN_set_ce(struct iphdr *iph)
static inline int IP_ECN_set_ce(struct iphdr *iph)
{
u32 check = iph->check;
u32 ecn = (iph->tos + 1) & INET_ECN_MASK;
Expand All @@ -61,7 +62,7 @@ static inline void IP_ECN_set_ce(struct iphdr *iph)
* INET_ECN_CE => 00
*/
if (!(ecn & 2))
return;
return !ecn;

/*
* The following gives us:
Expand All @@ -72,6 +73,7 @@ static inline void IP_ECN_set_ce(struct iphdr *iph)

iph->check = check + (check>=0xFFFF);
iph->tos |= INET_ECN_CE;
return 1;
}

static inline void IP_ECN_clear(struct iphdr *iph)
Expand All @@ -87,11 +89,12 @@ static inline void ipv4_copy_dscp(struct iphdr *outer, struct iphdr *inner)

struct ipv6hdr;

static inline void IP6_ECN_set_ce(struct ipv6hdr *iph)
static inline int IP6_ECN_set_ce(struct ipv6hdr *iph)
{
if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph)))
return;
return 0;
*(u32*)iph |= htonl(INET_ECN_CE << 20);
return 1;
}

static inline void IP6_ECN_clear(struct ipv6hdr *iph)
Expand All @@ -105,4 +108,21 @@ static inline void ipv6_copy_dscp(struct ipv6hdr *outer, struct ipv6hdr *inner)
ipv6_change_dsfield(inner, INET_ECN_MASK, dscp);
}

static inline int INET_ECN_set_ce(struct sk_buff *skb)
{
switch (skb->protocol) {
case __constant_htons(ETH_P_IP):
if (skb->nh.raw + sizeof(struct iphdr) <= skb->tail)
return IP_ECN_set_ce(skb->nh.iph);
break;

case __constant_htons(ETH_P_IPV6):
if (skb->nh.raw + sizeof(struct ipv6hdr) <= skb->tail)
return IP6_ECN_set_ce(skb->nh.ipv6h);
break;
}

return 0;
}

#endif
Loading

0 comments on commit 2d43f11

Please sign in to comment.