WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-4.0-testing] Remus: make ebt_imq and sch_queue comp

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-4.0-testing] Remus: make ebt_imq and sch_queue compatible with pvops
From: "Xen patchbot-4.0-testing" <patchbot-4.0-testing@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 21 Jun 2010 23:35:23 -0700
Delivery-date: Mon, 21 Jun 2010 23:35:56 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1277187844 -3600
# Node ID 00d4809d461e2fcc3c16f002ff6df6739693e358
# Parent  c7c87b802d0b25c9c5434c8534adb069ab551539
Remus: make ebt_imq and sch_queue compatible with pvops

Signed-off-by: Brendan Cully <brendan@xxxxxxxxx>
xen-unstable changeset:   21174:373daaeb636e
xen-unstable date:        Thu Apr 15 08:42:08 2010 +0100
---
 tools/remus/kmod/Makefile    |    3 +
 tools/remus/kmod/ebt_imq.c   |   69 +++++++++++++++++++++++++++++++++++++------
 tools/remus/kmod/ebt_imq.h   |    6 +++
 tools/remus/kmod/sch_queue.c |   48 ++++++++++++++++++++++++-----
 4 files changed, 108 insertions(+), 18 deletions(-)

diff -r c7c87b802d0b -r 00d4809d461e tools/remus/kmod/Makefile
--- a/tools/remus/kmod/Makefile Mon Jun 21 19:20:15 2010 +0100
+++ b/tools/remus/kmod/Makefile Tue Jun 22 07:24:04 2010 +0100
@@ -8,6 +8,9 @@ endif
 endif
 ifeq ($(KERNELS),linux-2.6-xen0)
 LINUX_VER=2.6.18-xen0
+endif
+ifeq ($(KERNELS),linux-2.6-pvops)
+LINUX_VER=2.6-pvops
 endif
 
 KERNELDIR ?= $(XEN_ROOT)/build-linux-$(LINUX_VER)_$(XEN_TARGET_ARCH)
diff -r c7c87b802d0b -r 00d4809d461e tools/remus/kmod/ebt_imq.c
--- a/tools/remus/kmod/ebt_imq.c        Mon Jun 21 19:20:15 2010 +0100
+++ b/tools/remus/kmod/ebt_imq.c        Tue Jun 22 07:24:04 2010 +0100
@@ -1,8 +1,18 @@
+#include <linux/version.h>
+#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,18)
+#  define OLDKERNEL
+#endif
+
 #include <linux/module.h>
 #include <linux/skbuff.h>
+#ifndef OLDKERNEL
+#  include <linux/netfilter/x_tables.h>
+#endif
 #include <linux/netfilter_bridge/ebtables.h>
 #include <linux/netdevice.h>
 #include "ebt_imq.h"
+
+#ifdef OLDKERNEL
 
 static int ebt_target_imq(struct sk_buff **pskb, unsigned int hooknr,
    const struct net_device *in, const struct net_device *out,
@@ -21,25 +31,66 @@ static int ebt_target_imq_check(const ch
   return 0;
 }
 
-static struct ebt_target imq_target =
+static struct ebt_target ebt_imq_target =
 {
-  .name                = "imq",
-  .target       = ebt_target_imq,
+  .name        = EBT_IMQ_TARGET,
+  .target      = ebt_target_imq,
   .check       = ebt_target_imq_check,
   .me          = THIS_MODULE,
 };
 
-static int __init init(void)
+static int __init ebt_imq_init(void)
 {
-  return ebt_register_target(&imq_target);
+  return ebt_register_target(&ebt_imq_target);
 }
 
-static void __exit fini(void)
+static void __exit ebt_imq_fini(void)
 {
-  ebt_unregister_target(&imq_target);
+  ebt_unregister_target(&ebt_imq_target);
 }
 
+#else /* OLDKERNEL */
 
-module_init(init);
-module_exit(fini);
+static unsigned int
+ebt_imq_tg(struct sk_buff *skb, const struct xt_target_param *par)
+{
+  const struct ebt_imq_info *info = par->targinfo;
+
+  if (!skb_make_writable(skb, 0))
+    return EBT_DROP;
+
+  skb->imq_flags = info->todev | IMQ_F_ENQUEUE;
+
+  return EBT_CONTINUE;
+}
+
+static bool ebt_imq_tg_check(const struct xt_tgchk_param *par)
+{
+  return true;
+}
+
+static struct xt_target ebt_imq_target __read_mostly = {
+  .name                = EBT_IMQ_TARGET,
+  .revision    = 0,
+  .family       = NFPROTO_BRIDGE,
+  .target      = ebt_imq_tg,
+  .checkentry  = ebt_imq_tg_check,
+  .targetsize  = XT_ALIGN(sizeof(struct ebt_imq_info)),
+  .me          = THIS_MODULE,
+};
+
+static int __init ebt_imq_init(void)
+{
+  return xt_register_target(&ebt_imq_target);
+}
+
+static void __init ebt_imq_fini(void)
+{
+  xt_unregister_target(&ebt_imq_target);
+}
+
+#endif /* OLDKERNEL */
+
+module_init(ebt_imq_init);
+module_exit(ebt_imq_fini);
 MODULE_LICENSE("GPL");
diff -r c7c87b802d0b -r 00d4809d461e tools/remus/kmod/ebt_imq.h
--- a/tools/remus/kmod/ebt_imq.h        Mon Jun 21 19:20:15 2010 +0100
+++ b/tools/remus/kmod/ebt_imq.h        Tue Jun 22 07:24:04 2010 +0100
@@ -1,10 +1,14 @@
 #ifndef __LINUX_BRIDGE_EBT_IMQ_H
 #define __LINUX_BRIDGE_EBT_IMQ_H
 
-#define IMQ_F_ENQUEUE 0x80
+#ifdef OLDKERNEL
+#  define IMQ_F_ENQUEUE 0x80
+#endif
 
 struct ebt_imq_info
 {
   unsigned int todev;
 };
+#define EBT_IMQ_TARGET "imq"
+
 #endif
diff -r c7c87b802d0b -r 00d4809d461e tools/remus/kmod/sch_queue.c
--- a/tools/remus/kmod/sch_queue.c      Mon Jun 21 19:20:15 2010 +0100
+++ b/tools/remus/kmod/sch_queue.c      Tue Jun 22 07:24:04 2010 +0100
@@ -16,7 +16,14 @@
  * So it supports two operations, barrier and release.
  */
 
-#include <linux/config.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,18)
+#  define OLDKERNEL
+#endif
+
+#ifdef OLDKERNEL
+#  include <linux/config.h>
+#endif
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
@@ -25,6 +32,17 @@
 #include <linux/skbuff.h>
 #include <net/pkt_sched.h>
 
+#ifdef OLDKERNEL
+#  define compatnlattr rtattr
+#  define compatnllen RTA_PAYLOAD
+#  define compatnldata RTA_DATA
+#else
+#  include <xen/features.h>
+#  define compatnlattr nlattr
+#  define compatnllen nla_len
+#  define compatnldata nla_data
+#endif
+
 /* xenbus directory */
 #define FIFO_BUF    (10*1024*1024)
 
@@ -43,6 +61,7 @@ struct tc_queue_qopt {
   int action;
 };
 
+#ifdef OLDKERNEL
 /* borrowed from drivers/xen/netback/loopback.c */
 #ifdef CONFIG_X86
 static int is_foreign(unsigned long pfn)
@@ -88,6 +107,12 @@ static int skb_remove_foreign_references
 
   return 1;
 }
+#else /* OLDKERNEL */
+static int skb_remove_foreign_references(struct sk_buff *skb)
+{
+  return !skb_linearize(skb);
+}
+#endif /* OLDKERNEL */
 
 static int queue_enqueue(struct sk_buff *skb, struct Qdisc* sch)
 {
@@ -112,7 +137,7 @@ static int queue_enqueue(struct sk_buff 
 
 /* dequeue doesn't actually dequeue until the release command is
  * received. */
-static inline struct sk_buff *queue_dequeue(struct Qdisc* sch)
+static struct sk_buff *queue_dequeue(struct Qdisc* sch)
 {
   struct queue_sched_data *q = qdisc_priv(sch);
   struct sk_buff* peek;
@@ -145,7 +170,7 @@ static inline struct sk_buff *queue_dequ
   return qdisc_dequeue_head(sch);
 }
 
-static int queue_init(struct Qdisc *sch, struct rtattr *opt)
+static int queue_init(struct Qdisc *sch, struct compatnlattr *opt)
 {
   sch->flags |= TCQ_F_THROTTLED;
 
@@ -155,7 +180,7 @@ static int queue_init(struct Qdisc *sch,
 /* receives two messages:
  *   0: checkpoint queue (set stop to next packet)
  *   1: dequeue until stop */
-static int queue_change(struct Qdisc* sch, struct rtattr* opt)
+static int queue_change(struct Qdisc* sch, struct compatnlattr* opt)
 {
   struct queue_sched_data *q = qdisc_priv(sch);
   struct tc_queue_qopt* msg;
@@ -163,10 +188,10 @@ static int queue_change(struct Qdisc* sc
   struct timeval tv;
   */
 
-  if (!opt || RTA_PAYLOAD(opt) < sizeof(*msg))
+  if (!opt || compatnllen(opt) < sizeof(*msg))
     return -EINVAL;
 
-  msg = RTA_DATA(opt);
+  msg = compatnldata(opt);
 
   if (msg->action == TCQ_CHECKPOINT) {
     /* reset stop */
@@ -174,7 +199,11 @@ static int queue_change(struct Qdisc* sc
   } else if (msg->action == TCQ_DEQUEUE) {
     /* dequeue */
     sch->flags &= ~TCQ_F_THROTTLED;
+#ifdef OLDKERNEL
     netif_schedule(sch->dev);
+#else
+    netif_schedule_queue(sch->dev_queue);
+#endif
     /*
     do_gettimeofday(&tv);
     printk("queue release at %lu.%06lu (%d bytes)\n", tv.tv_sec, tv.tv_usec,
@@ -192,8 +221,11 @@ struct Qdisc_ops queue_qdisc_ops = {
   .priv_size   =       sizeof(struct queue_sched_data),
   .enqueue     =       queue_enqueue,
   .dequeue     =       queue_dequeue,
-  .init                =       queue_init,
-  .change       =      queue_change,
+#ifndef OLDKERNEL
+  .peek        =       qdisc_peek_head,
+#endif
+  .init        =       queue_init,
+  .change      =       queue_change,
   .owner       =       THIS_MODULE,
 };
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-4.0-testing] Remus: make ebt_imq and sch_queue compatible with pvops, Xen patchbot-4.0-testing <=