From: Ben Pfaff Date: Tue, 5 May 2009 20:59:17 +0000 (-0700) Subject: datapath: Remove hardware table support. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f62684fe233aee5e6452c584440c0f6e254e77bf;p=openvswitch datapath: Remove hardware table support. This support was broken anyhow. We have no immediate plans to fix it, so it's better not to claim to support it. --- diff --git a/INSTALL b/INSTALL index c4a8081c..fb2dab9b 100644 --- a/INSTALL +++ b/INSTALL @@ -176,9 +176,6 @@ distribution in the ordinary way using "configure" and "make". - datapath/linux-2.6/openflow_mod.ko - - datapath/linux-2.6/hwtable__mod.ko for each
- specified on --enable-hw-tables (if any). - 3. Run "make install" to install the executables and manpages into the running system, by default under /usr/local. @@ -186,10 +183,6 @@ distribution in the ordinary way using "configure" and "make". % insmod datapath/linux-2.6/openflow_mod.ko - After you load the openflow module, you may load one hardware switch - table module (if any were built) to enable support for that hardware - switching table. - The insmod program must be run as root. You may need to specify a full path to insmod, e.g. /sbin/insmod. To verify that the modules have been loaded, run "/sbin/lsmod" and check that openflow_mod is @@ -220,20 +213,6 @@ configure script. For example, to build OpenFlow for MIPS with Linux % ./configure --with-l24=/path/to/linux-2.6 KARCH=mips -If you have hardware that supports accelerated OpenFlow switching, and -you have obtained a hardware table module for your hardware and -extracted it into the OpenFlow reference distribution source tree, -then you may also enable building support for the hardware switching -table with --enable-hw-tables. For example, if your hardware -switching table is in a directory named datapath/hwtable-foomatic, you -could compile support for it with the running Linux 2.6 kernel like -so: - - % ./configure --with-l26=/lib/modules/`uname -r`/build \ - --enable-hw-tables=foomatic - -For more information about hardware table modules, please read -README.hwtables at the root of the OpenFlow distribution tree. Building Debian Packages ======================== @@ -493,10 +472,6 @@ The OpenFlow kernel module must be loaded, as described under bridged to the physical switch ports by the secchan, for use in in-band control. - If you built a support module for hardware accelerated OpenFlow - switching and you want to use it, you must load it before creating - the datapath with "dpctl adddp". - 2. Use dpctl to attach the datapath to physical interfaces on the machine. Say, for example, you want to create a trivial 2-port switch using interfaces eth1 and eth2, you would issue the following diff --git a/MISSING b/MISSING index b318cfd8..c985fe03 100644 --- a/MISSING +++ b/MISSING @@ -1,8 +1,6 @@ The following features are temporarily missing, pending time to reimplement them with the new architecture: -- Hardware table support in the kernel datapath. - - STP support in secchan (note that this is distinct from STP support in vswitchd). diff --git a/Makefile.am b/Makefile.am index 97721295..c3847178 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,7 +46,7 @@ noinst_LIBRARIES = noinst_PROGRAMS = noinst_SCRIPTS = -EXTRA_DIST += README.hwtables soexpand.pl +EXTRA_DIST += soexpand.pl ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */' diff --git a/README.hwtables b/README.hwtables deleted file mode 100644 index 2b005539..00000000 --- a/README.hwtables +++ /dev/null @@ -1,38 +0,0 @@ -Hardware Table Support -*- text -*- ----------------------- - -The OpenFlow reference implementation in this distribution provides a -mechanism to support hardware that can accelerate OpenFlow switching. -The mechanism consists of the ability to add a "hardware acceleration" -switching table ahead of the software switching tables implemented by -the reference implementation. The hardware switching table is -expected to handle any incoming packets that it can on its own. Any -packets that it cannot handle itself it may pass up to the software -table implementations. - -Hardware table implementation are built as separate kernel modules -that may be loaded after the openflow module. At most one hardware -table module may be loaded at a time. Only datapaths created after a -hardware table module is loaded (and before it is unloaded) will take -advantage of hardware switching features. - -Creating a hardware table module is straightforward. Create a -directory in the openflow source tree named datapath/hwtable_NAME, -where NAME identifies the hardware that the module supports. Populate -that directory with the C source files that comprise the module, plus -a file named Modules.mk that specifies how to build the module. This -distribution includes a "dummy" hardware module that demonstrates how -this works. - -Even though only one may be loaded at a given time, any number of -hardware table modules may be built along with the OpenFlow kernel -modules. Specify each NAME that identifies a module to be built on -the OpenFlow configure script command as the argument to ---enable-hw-tables, e.g.: - ./configure --enable-hw-tables=NAME - -Each hardware table module's code is encapsulated in a directory, so -it is easy to separate a hardware table implementation from OpenFlow. -Simply package up the contents of the hwtable_NAME directory and -distribute it for builders to extract into their distribution -directory. diff --git a/acinclude.m4 b/acinclude.m4 index a31c7283..96648845 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -147,34 +147,6 @@ AC_DEFUN([OFP_CHECK_LINUX26_COMPAT], [ fi ]) -dnl Checks for --enable-hw-tables and substitutes HW_TABLES to any -dnl requested hardware table modules. -AC_DEFUN([OFP_CHECK_HWTABLES], - [AC_ARG_ENABLE( - [hw-tables], - [AC_HELP_STRING([--enable-hw-tables=MODULE...], - [Configure and build the specified externally supplied - hardware table support modules])]) - case "${enable_hw_tables}" in # ( - yes) - AC_MSG_ERROR([--enable-hw-tables has a required argument]) - ;; # ( - ''|no) - hw_tables= - ;; # ( - *) - hw_tables=`echo "$enable_hw_tables" | sed 's/,/ /g'` - ;; - esac - for d in $hw_tables; do - mk=datapath/hwtable_$d/Modules.mk - if test ! -e $srcdir/$mk; then - AC_MSG_ERROR([--enable-hw-tables=$d specified but $mk is missing]) - fi - HW_TABLES="$HW_TABLES \$(top_srcdir)/$mk" - done - AC_SUBST(HW_TABLES)]) - dnl Checks for net/if_packet.h. AC_DEFUN([OFP_CHECK_IF_PACKET], [AC_CHECK_HEADER([net/if_packet.h], diff --git a/configure.ac b/configure.ac index 39b669f3..5f382a51 100644 --- a/configure.ac +++ b/configure.ac @@ -33,7 +33,7 @@ AC_PREREQ(2.60) AC_INIT(openflow, 0.8.9~1, info@openflowswitch.org) NX_BUILDNR -AC_CONFIG_SRCDIR([README.hwtables]) +AC_CONFIG_SRCDIR([datapath/datapath.c]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_HEADERS([config.h]) @@ -53,7 +53,6 @@ fi OFP_CHECK_LIBOPENFLOW OFP_CHECK_IF_PACKET -OFP_CHECK_HWTABLES AC_SYS_LARGEFILE AC_CHECK_FUNCS([strsignal]) diff --git a/datapath/Makefile.am b/datapath/Makefile.am index 4c1f5b9b..71e2dc48 100644 --- a/datapath/Makefile.am +++ b/datapath/Makefile.am @@ -4,7 +4,6 @@ SUBDIRS += linux-2.6 endif EXTRA_DIST = $(dist_headers) $(dist_sources) -EXTRA_DIST += hwtable_dummy/Modules.mk hwtable_dummy/hwtable_dummy.c # Suppress warnings about GNU extensions in Modules.mk files. AUTOMAKE_OPTIONS = -Wno-portability diff --git a/datapath/datapath.c b/datapath/datapath.c index 34172027..7edc683c 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -76,8 +76,7 @@ EXPORT_SYMBOL(dp_del_if_hook); * dp_mutex. */ static struct datapath *dps[ODP_MAX]; -DEFINE_MUTEX(dp_mutex); -EXPORT_SYMBOL(dp_mutex); +static DEFINE_MUTEX(dp_mutex); /* Number of milliseconds between runs of the maintenance thread. */ #define MAINT_SLEEP_MSECS 1000 diff --git a/datapath/datapath.h b/datapath/datapath.h index 71831ebd..08485b28 100644 --- a/datapath/datapath.h +++ b/datapath/datapath.h @@ -97,7 +97,6 @@ struct net_bridge_port { struct list_head node; /* Element in datapath.ports. */ }; -extern struct mutex dp_mutex; extern struct notifier_block dp_device_notifier; extern int (*dp_ioctl_hook)(struct net_device *dev, struct ifreq *rq, int cmd); extern int (*dp_add_dp_hook)(struct datapath *dp); diff --git a/datapath/flow.c b/datapath/flow.c index c9a6e9d0..8a531e03 100644 --- a/datapath/flow.c +++ b/datapath/flow.c @@ -116,7 +116,6 @@ void flow_free(struct sw_flow *flow) kfree(flow->sf_acts); kmem_cache_free(flow_cache, flow); } -EXPORT_SYMBOL(flow_free); /* RCU callback used by flow_deferred_free. */ static void rcu_free_flow_callback(struct rcu_head *rcu) @@ -131,7 +130,6 @@ void flow_deferred_free(struct sw_flow *flow) { call_rcu(&flow->rcu, rcu_free_flow_callback); } -EXPORT_SYMBOL(flow_deferred_free); /* RCU callback used by flow_deferred_free_acts. */ static void rcu_free_acts_callback(struct rcu_head *rcu) @@ -147,7 +145,6 @@ void flow_deferred_free_acts(struct sw_flow_actions *sf_acts) { call_rcu(&sf_acts->rcu, rcu_free_acts_callback); } -EXPORT_SYMBOL(flow_deferred_free_acts); #define SNAP_OUI_LEN 3 diff --git a/datapath/hwtable_dummy/Modules.mk b/datapath/hwtable_dummy/Modules.mk deleted file mode 100644 index 7f6b86ba..00000000 --- a/datapath/hwtable_dummy/Modules.mk +++ /dev/null @@ -1,7 +0,0 @@ -# Specify the module to build. -build_modules += hwtable_dummy - -# Specify the source files that comprise the module. -hwtable_dummy_sources = \ - hwtable_dummy/hwtable_dummy.c - diff --git a/datapath/hwtable_dummy/hwtable_dummy.c b/datapath/hwtable_dummy/hwtable_dummy.c deleted file mode 100644 index 1e41437f..00000000 --- a/datapath/hwtable_dummy/hwtable_dummy.c +++ /dev/null @@ -1,285 +0,0 @@ -/* Copyright (c) 2008, 2009 The Board of Trustees of The Leland Stanford - * Junior University - * - * We are making the OpenFlow specification and associated documentation - * (Software) available for public use and benefit with the expectation - * that others will use, modify and enhance the Software and contribute - * those enhancements back to the community. However, since we would - * like to make the Software available for broadest use, with as few - * restrictions as possible permission is hereby granted, free of - * charge, to any person obtaining a copy of this Software to deal in - * the Software under the copyrights without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * The name and trademarks of copyright holder(s) may NOT be used in - * advertising or publicity pertaining to the Software or any - * derivatives without specific, written prior permission. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "chain.h" -#include "table.h" -#include "flow.h" -#include "datapath.h" - - -/* Max number of flow entries supported by the hardware */ -#define DUMMY_MAX_FLOW 8192 - - -/* sw_flow private data for dummy table entries. */ -struct sw_flow_dummy { - struct list_head node; - - /* xxx If per-entry data is needed, define it here. */ -}; - -struct sw_table_dummy { - struct sw_table swt; - - unsigned int max_flows; - unsigned int n_flows; - struct list_head flows; - struct list_head iter_flows; - unsigned long int next_serial; -}; - - -static struct sw_flow *table_dummy_lookup(struct sw_table *swt, - const struct odp_flow_key *key) -{ - struct sw_table_dummy *td = (struct sw_table_dummy *) swt; - struct sw_flow *flow; - list_for_each_entry (flow, &td->flows, node) { - if (flow_matches_1wild(key, &flow->key)) { - return flow; - } - } - return NULL; -} - -static int table_dummy_insert(struct sw_table *swt, struct sw_flow *flow) -{ - /* xxx Use a data cache? */ - flow->private = kzalloc(sizeof(struct sw_flow_dummy), GFP_ATOMIC); - if (flow->private == NULL) - return 0; - - /* xxx Do whatever needs to be done to insert an entry in hardware. - * xxx If the entry can't be inserted, return 0. This stub code - * xxx doesn't do anything yet, so we're going to return 0...you - * xxx shouldn't (and you should update n_flows in struct - * xxx sw_table_dummy, too). - */ - kfree(flow->private); - return 0; -} - -static int table_dummy_modify(struct sw_table *swt, - const struct odp_flow_key *key, uint16_t priority, int strict, - const struct ofp_action_header *actions, size_t actions_len) -{ - struct sw_table_dummy *td = (struct sw_table_dummy *) swt; - struct sw_flow *flow; - unsigned int count = 0; - - list_for_each_entry (flow, &td->flows, node) { - if (flow_matches_desc(&flow->key, key, strict) - && (!strict || (flow->priority == priority))) { - flow_replace_acts(flow, actions, actions_len); - /* xxx Do whatever is necessary to modify the entry in hardware */ - count++; - } - } - return count; -} - - -static int do_delete(struct sw_table *swt, struct sw_flow *flow) -{ - /* xxx Remove the entry from hardware. If you need to do any other - * xxx clean-up associated with the entry, do it here. - */ - list_del_rcu(&flow->node); - list_del_rcu(&flow->iter_node); - flow_deferred_free(flow); - return 1; -} - -static int table_dummy_delete(struct sw_table *swt, - const struct odp_flow_key *key, uint16_t priority, int strict) -{ - struct sw_table_dummy *td = (struct sw_table_dummy *) swt; - struct sw_flow *flow; - unsigned int count = 0; - - list_for_each_entry (flow, &td->flows, node) { - if (flow_matches_desc(&flow->key, key, strict) - && (!strict || (flow->priority == priority))) - count += do_delete(swt, flow); - } - td->n_flows -= count; - return count; -} - - -static int table_dummy_timeout(struct datapath *dp, struct sw_table *swt) -{ - struct sw_table_dummy *td = (struct sw_table_dummy *) swt; - struct sw_flow *flow; - int del_count = 0; - uint64_t packet_count = 0; - uint64_t byte_count = 0; - int reason; - - mutex_lock(&dp_mutex); - list_for_each_entry (flow, &td->flows, node) { - /* xxx Retrieve the packet and byte counts associated with this - * entry xxx and store them in "packet_count" and "byte_count". - */ - - if (packet_count != flow->packet_count) { - flow->packet_count = packet_count; - flow->byte_count = byte_count; - flow->used = jiffies; - } - - reason = flow_timeout(flow); - if (reason >= 0) { - if (dp->flags & OFPC_SEND_FLOW_EXP) { - /* xxx Get byte count */ - flow->byte_count = 0; - dp_send_flow_expired(dp, flow, reason); - } - del_count += do_delete(swt, flow); - } - } - mutex_unlock(&dp_mutex); - - td->n_flows -= del_count; - return del_count; -} - - -static void table_dummy_destroy(struct sw_table *swt) -{ - struct sw_table_dummy *td = (struct sw_table_dummy *)swt; - - - /* xxx This table is being destroyed, so free any data that you - * xxx don't want to leak. - */ - - - if (td) { - while (!list_empty(&td->flows)) { - struct sw_flow *flow = list_entry(td->flows.next, - struct sw_flow, node); - list_del(&flow->node); - flow_free(flow); - } - kfree(td); - } -} - -static int table_dummy_iterate(struct sw_table *swt, - const struct odp_flow_key *key, - struct sw_table_position *position, - int (*callback)(struct sw_flow *, void *), - void *private) -{ - struct sw_table_dummy *td = (struct sw_table_dummy *) swt; - struct sw_flow *flow; - unsigned long start; - - start = ~position->private[0]; - list_for_each_entry (flow, &td->iter_flows, iter_node) { - if (flow->serial <= start && flow_matches_2wild(key, - &flow->key)) { - int error = callback(flow, private); - if (error) { - position->private[0] = ~flow->serial; - return error; - } - } - } - return 0; -} - -static void table_dummy_stats(struct sw_table *swt, - struct sw_table_stats *stats) -{ - struct sw_table_dummy *td = (struct sw_table_dummy *) swt; - stats->name = "dummy"; - stats->wildcards = OFPFW_ALL; /* xxx Set this appropriately */ - stats->n_flows = td->n_flows; - stats->max_flows = td->max_flows; - stats->n_matched = swt->n_matched; -} - - -static struct sw_table *table_dummy_create(void) -{ - struct sw_table_dummy *td; - struct sw_table *swt; - - td = kzalloc(sizeof *td, GFP_KERNEL); - if (td == NULL) - return NULL; - - swt = &td->swt; - swt->lookup = table_dummy_lookup; - swt->insert = table_dummy_insert; - swt->modify = table_dummy_modify; - swt->delete = table_dummy_delete; - swt->timeout = table_dummy_timeout; - swt->destroy = table_dummy_destroy; - swt->iterate = table_dummy_iterate; - swt->stats = table_dummy_stats; - - td->max_flows = DUMMY_MAX_FLOW; - td->n_flows = 0; - INIT_LIST_HEAD(&td->flows); - INIT_LIST_HEAD(&td->iter_flows); - td->next_serial = 0; - - return swt; -} - -static int __init dummy_init(void) -{ - return chain_set_hw_hook(table_dummy_create, THIS_MODULE); -} -module_init(dummy_init); - -static void dummy_cleanup(void) -{ - chain_clear_hw_hook(); -} -module_exit(dummy_cleanup); - -MODULE_DESCRIPTION("Dummy hardware table driver"); -MODULE_AUTHOR("Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University"); -MODULE_LICENSE("Stanford License"); diff --git a/datapath/linux-2.6/Kbuild.in b/datapath/linux-2.6/Kbuild.in index 4e03a078..350f241b 100644 --- a/datapath/linux-2.6/Kbuild.in +++ b/datapath/linux-2.6/Kbuild.in @@ -7,7 +7,6 @@ export BUILDNR = @BUILDNR@ include $(srcdir)/../Modules.mk include $(srcdir)/Modules.mk -include @HW_TABLES@ EXTRA_CFLAGS := -DVERSION=\"$(VERSION)\" EXTRA_CFLAGS += -I$(srcdir)/.. diff --git a/datapath/linux-2.6/Makefile.main.in b/datapath/linux-2.6/Makefile.main.in index ddf32ab1..0005ec4f 100644 --- a/datapath/linux-2.6/Makefile.main.in +++ b/datapath/linux-2.6/Makefile.main.in @@ -8,7 +8,6 @@ export BUILD_VETH = @BUILD_VETH@ include $(srcdir)/../Modules.mk include $(srcdir)/Modules.mk -include @HW_TABLES@ default: $(build_links) @@ -57,7 +56,7 @@ endif ################################################################################ # # Intel PRO/1000 Linux driver -# Copyright(c) 1999 - 2007 Intel Corporation. +# Copyright(c) 1999 - 2007, 2009 Intel Corporation. # # This program is free software; you can redistribute it and/or modify it # under the terms and conditions of the GNU General Public License, diff --git a/datapath/linux-2.6/compat-2.6/random32.c b/datapath/linux-2.6/compat-2.6/random32.c index 981b55c1..b0dd2a32 100644 --- a/datapath/linux-2.6/compat-2.6/random32.c +++ b/datapath/linux-2.6/compat-2.6/random32.c @@ -91,7 +91,6 @@ u32 random32(void) { return __random32(&net_rand_state[smp_processor_id()]); } -EXPORT_SYMBOL(random32); /** * srandom32 - add entropy to pseudo random number generator @@ -105,7 +104,6 @@ void srandom32(u32 entropy) struct rnd_state *state = &net_rand_state[smp_processor_id()]; __set_random32(state, state->s1 ^ entropy); } -EXPORT_SYMBOL(srandom32); static int __init random32_reseed(void);