All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@redhat.com>
Cc: jamal <hadi@cyberus.ca>, netdev@oss.sgi.com
Subject: [PATCH] Fix IPv6 ECN marking in RED
Date: Sat, 06 Mar 2004 01:30:20 +0100	[thread overview]
Message-ID: <40491B9C.4040203@trash.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 190 bytes --]

Hi Dave,

this patch fixes IPv6 ECN marking in RED and changes it to use the
functions from net/inet_ecn.h. Currently a local variable is marked
instead of the packet.

Best regards
Patrick

[-- Attachment #2: red-ecn-marking.diff --]
[-- Type: text/x-patch, Size: 1309 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/03/06 01:06:26+01:00 kaber@trash.net 
#   Fix IPv6 ECN marking in RED
# 
# net/sched/sch_red.c
#   2004/03/06 01:03:45+01:00 kaber@trash.net +4 -19
#   Fix IPv6 ECN marking in RED
# 
diff -Nru a/net/sched/sch_red.c b/net/sched/sch_red.c
--- a/net/sched/sch_red.c	Sat Mar  6 01:07:33 2004
+++ b/net/sched/sch_red.c	Sat Mar  6 01:07:33 2004
@@ -41,9 +41,6 @@
 #include <net/pkt_sched.h>
 #include <net/inet_ecn.h>
 
-#define RED_ECN_ECT  0x02
-#define RED_ECN_CE   0x01
-
 
 /*	Random Early Detection (RED) algorithm.
 	=======================================
@@ -165,28 +162,16 @@
 
 	switch (skb->protocol) {
 	case __constant_htons(ETH_P_IP):
-	{
-		u8 tos = skb->nh.iph->tos;
-
-		if (!(tos & RED_ECN_ECT))
+		if (!INET_ECN_is_capable(skb->nh.iph->tos))
 			return 0;
-
-		if (!(tos & RED_ECN_CE))
+		if (INET_ECN_is_not_ce(skb->nh.iph->tos))
 			IP_ECN_set_ce(skb->nh.iph);
-
 		return 1;
-	}
-
 	case __constant_htons(ETH_P_IPV6):
-	{
-		u32 label = *(u32*)skb->nh.raw;
-
-		if (!(label & __constant_htonl(RED_ECN_ECT<<20)))
+		if (!INET_ECN_is_capable(ip6_get_dsfield(skb->nh.ipv6h)))
 			return 0;
-		label |= __constant_htonl(RED_ECN_CE<<20);
+		IP6_ECN_set_ce(skb->nh.ipv6h);
 		return 1;
-	}
-
 	default:
 		return 0;
 	}

             reply	other threads:[~2004-03-06  0:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-06  0:30 Patrick McHardy [this message]
2004-03-06  7:26 ` [PATCH] Fix IPv6 ECN marking in RED David S. Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40491B9C.4040203@trash.net \
    --to=kaber@trash.net \
    --cc=davem@redhat.com \
    --cc=hadi@cyberus.ca \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.