Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.4.1 /net/sched/sch_dsmark.c

Filename:/net/sched/sch_dsmark.c
Lines Added:14
Lines Deleted:8
Also changed in: (Previous) 2.4.1-pre12  2.4.1-pre11  2.4.1-pre10  2.4.0-ac12 
(Following) 2.4.1-ac9  2.4.1-ac10  2.4.1-ac11  2.4.1-ac12  2.4.1-ac13  2.4.1-ac14 

Location
[  2.4.1
  [  net
    [  sched
       o  sch_dsmark.c

Patch

diff -u --recursive --new-file v2.4.0/linux/net/sched/sch_dsmark.c linux/net/sched/sch_dsmark.c
--- v2.4.0/linux/net/sched/sch_dsmark.c   Mon Feb 21 16:32:27 2000
+++ linux/net/sched/sch_dsmark.c   Mon Jan 22 13:30:21 2001
@@ -39,16 +39,22 @@
  *   x:y y>0    y+1      use entry [y]
  *   ...    ...      ...
  * x:indices-1   indices      use entry [indices-1]
+ *   ...    ...      ...
+ *   x:y    y+1      use entry [y & (indices-1)]
+ *   ...    ...      ...
+ * 0xffff   0x10000      use entry [indices-1]
  */
 
 
+#define NO_DEFAULT_INDEX   (1 << 16)
+
 struct dsmark_qdisc_data {
    struct Qdisc      *q;
    struct tcf_proto   *filter_list;
    __u8         *mask;   /* "owns" the array */
    __u8         *value;
    __u16         indices;
-   __u16         default_index;
+   __u32         default_index;   /* index range is 0...0xffff */
    int         set_tc_index;
 };
 
@@ -217,7 +223,7 @@
          case TC_POLICE_UNSPEC:
             /* fall through */
          default:
-            if (p->default_index)
+            if (p->default_index != NO_DEFAULT_INDEX)
                skb->tc_index = p->default_index;
             break;
       };
@@ -325,14 +331,12 @@
       if (tmp & 1)
          return -EINVAL;
    }
-   p->default_index = 0;
+   p->default_index = NO_DEFAULT_INDEX;
    if (tb[TCA_DSMARK_DEFAULT_INDEX-1]) {
       if (RTA_PAYLOAD(tb[TCA_DSMARK_DEFAULT_INDEX-1]) < sizeof(__u16))
          return -EINVAL;
       p->default_index =
           *(__u16 *) RTA_DATA(tb[TCA_DSMARK_DEFAULT_INDEX-1]);
-      if (!p->default_index || p->default_index >= p->indices)
-         return -EINVAL;
    }
    p->set_tc_index = !!tb[TCA_DSMARK_SET_TC_INDEX-1];
    p->mask = kmalloc(p->indices*2,GFP_KERNEL);
@@ -411,9 +415,11 @@
    rta = (struct rtattr *) b;
    RTA_PUT(skb,TCA_OPTIONS,0,NULL);
    RTA_PUT(skb,TCA_DSMARK_INDICES,sizeof(__u16),&p->indices);
-   if (p->default_index)
-      RTA_PUT(skb,TCA_DSMARK_DEFAULT_INDEX, sizeof(__u16),
-         &p->default_index);
+   if (p->default_index != NO_DEFAULT_INDEX) {
+      __u16 tmp = p->default_index;
+
+      RTA_PUT(skb,TCA_DSMARK_DEFAULT_INDEX, sizeof(__u16), &tmp);
+   }
    if (p->set_tc_index)
       RTA_PUT(skb, TCA_DSMARK_SET_TC_INDEX, 0, NULL);
    rta->rta_len = skb->tail-b;


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.