Skip to content

Commit

Permalink
datapath: Drop support for kernel older than 3.10
Browse files Browse the repository at this point in the history
Currently OVS out of tree datapath supports a large number of kernel
versions. From 2.6.32 to 4.3 and various distribution-specific
kernels. But at this point major features are only available on more
recent kernels.  For example, stateful services are only available
starting in kernel 3.10 and STT is available on starting with 3.5.

Since these features are becoming essential to many OVS deployments,
and the effort of maintaining the backports is high. We have decided
to drop support for older kernel. Following patch drops supports
for kernel older than 3.10.

Signed-off-by: Pravin B Shelar <[email protected]>
Acked-by: Jesse Gross <[email protected]>
  • Loading branch information
pshelar committed Mar 14, 2016
1 parent 0bac716 commit 8063e09
Show file tree
Hide file tree
Showing 33 changed files with 139 additions and 591 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ env:
- KERNEL=3.14.60
- KERNEL=3.12.53
- KERNEL=3.10.96
- KERNEL=3.4.110
- KERNEL=3.2.76
- KERNEL=2.6.32.70

script: ./.travis/build.sh $OPTS

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Testing is also important:

- A patch that modifies Linux kernel code should be at least
build-tested on various Linux kernel versions before
submission. I suggest versions 2.6.32 and whatever
submission. I suggest versions 3.10 and whatever
the current latest release version is at the time.

- A patch that modifies the ofproto or vswitchd code should be
Expand Down
3 changes: 2 additions & 1 deletion FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ A: Open vSwitch is a production quality open source software switch
### Q: What virtualization platforms can use Open vSwitch?

A: Open vSwitch can currently run on any Linux-based virtualization
platform (kernel 2.6.32 and newer), including: KVM, VirtualBox, Xen,
platform (kernel 3.10 and newer), including: KVM, VirtualBox, Xen,
Xen Cloud Platform, XenServer. As of Linux 3.3 it is part of the
mainline kernel. The bulk of the code is written in platform-
independent C and is easily ported to other environments. We welcome
Expand Down Expand Up @@ -157,6 +157,7 @@ A: The following table lists the Linux kernel versions against which the
| 2.3.x | 2.6.32 to 3.14
| 2.4.x | 2.6.32 to 4.0
| 2.5.x | 2.6.32 to 4.3
| 2.6.x | 3.10 to 4.3

Open vSwitch userspace should also work with the Linux kernel module
built into Linux 3.3 and later.
Expand Down
43 changes: 2 additions & 41 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,13 @@ install the following:
- A supported Linux kernel version. Please refer to [README.md] for a
list of supported versions.

The Open vSwitch datapath requires bridging support
(CONFIG_BRIDGE) to be built as a kernel module. (This is common
in kernels provided by Linux distributions.) The bridge module
must not be loaded or in use. If the bridge module is running
(check with "lsmod | grep bridge"), you must remove it ("rmmod
bridge") before starting the datapath.

For optional support of ingress policing, you must enable kernel
configuration options NET_CLS_BASIC, NET_SCH_INGRESS, and
NET_ACT_POLICE, either built-in or as modules. (NET_CLS_POLICE is
obsolete and not needed.)

To use GRE tunneling on Linux 2.6.37 or newer, kernel support
for GRE demultiplexing (CONFIG_NET_IPGRE_DEMUX) must be compiled
in or available as a module. Also, on kernels before 3.11, the
ip_gre module, for GRE tunnels over IP (NET_IPGRE), must not be
loaded or compiled in.
On kernels before 3.11, the ip_gre module, for GRE tunnels over IP
(NET_IPGRE), must not be loaded or compiled in.

To configure HTB or HFSC quality of service with Open vSwitch,
you must enable the respective configuration options.
Expand Down Expand Up @@ -301,23 +291,6 @@ Building the Sources
If the `modprobe` operation fails, look at the last few kernel log
messages (e.g. with `dmesg | tail`):

- The message "openvswitch: exports duplicate symbol
br_should_route_hook (owned by bridge)" means that the bridge
module is loaded. Run `/sbin/rmmod bridge` to remove it.

If `/sbin/rmmod bridge` fails with "ERROR: Module bridge does
not exist in /proc/modules", then the bridge is compiled into
the kernel, rather than as a module. Open vSwitch does not
support this configuration (see "Build Requirements", above).

- The message "openvswitch: exports duplicate symbol
dp_ioctl_hook (owned by ofdatapath)" means that the ofdatapath
module from the OpenFlow reference implementation is loaded.
Run `/sbin/rmmod ofdatapath` to remove it. (You might have to
delete any existing datapaths beforehand, using the "dpctl"
program included with the OpenFlow reference implementation.
"ovs-dpctl" will not work.)

- Otherwise, the most likely problem is that Open vSwitch was
built for a kernel different from the one into which you are
trying to load it. Run `modinfo` on openvswitch.ko and on
Expand All @@ -335,18 +308,6 @@ Building the Sources
module loading, please include the output from the `dmesg` and
`modinfo` commands mentioned above.

There is an optional module parameter to openvswitch.ko called
vlan_tso that enables TCP segmentation offload over VLANs on NICs
that support it. Many drivers do not expose support for TSO on VLANs
in a way that Open vSwitch can use but there is no way to detect
whether this is the case. If you know that your particular driver can
handle it (for example by testing sending large TCP packets over VLANs)
then passing in a value of 1 may improve performance. Modules built for
Linux kernels 2.6.37 and later, as well as specially patched versions
of earlier kernels, do not need this and do not have this parameter. If
you do not understand what this means or do not know if your driver
will work, do not set this.

6. Initialize the configuration database using ovsdb-tool, e.g.:

`% mkdir -p /usr/local/etc/openvswitch`
Expand Down
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Post-v2.5.0
for 2.7+.
- SELinux:
* Introduced SELinux policy package.
- Datapath Linux kernel compatibility.
* Dropped support for kernel older than 3.10.

v2.5.0 - xx xxx xxxx
---------------------
Expand Down
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ vSwitch supports the following features:
* Transactional configuration database with C and Python bindings
* High-performance forwarding using a Linux kernel module

The included Linux kernel module supports Linux 2.6.32 and up, with
testing focused on 2.6.32 with Centos and Xen patches. Open vSwitch
also has special support for Citrix XenServer and Red Hat Enterprise
Linux hosts.
The included Linux kernel module supports Linux 3.10 and up.

Open vSwitch can also operate, at a cost in performance, entirely in
userspace, without assistance from a kernel module. This userspace
Expand Down
21 changes: 7 additions & 14 deletions acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,10 @@ AC_DEFUN([OVS_CHECK_LINUX], [
else
AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version newer than 4.3.x is not supported (please refer to the FAQ for advice)])
fi
elif test "$version" = 3; then
elif test "$version" = 3 && test "$patchlevel" -ge 10; then
: # Linux 3.x
else
if test "$version" -le 1 || test "$patchlevel" -le 5 || test "$sublevel" -le 31; then
AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version 2.6.32 or later is required])
else
: # Linux 2.6.x
fi
AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version 3.10 or later is required])
fi
if (test ! -e "$KBUILD"/include/linux/version.h && \
test ! -e "$KBUILD"/include/generated/uapi/linux/version.h)|| \
Expand Down Expand Up @@ -307,7 +303,7 @@ AC_DEFUN([OVS_DEFINE], [

dnl OVS_CHECK_LINUX_COMPAT
dnl
dnl Runs various Autoconf checks on the Linux 2.6 kernel source in
dnl Runs various Autoconf checks on the Linux kernel source in
dnl the directory in $KBUILD.
AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
rm -f datapath/linux/kcompat.h.new
Expand Down Expand Up @@ -381,11 +377,10 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [can_checksum_protocol])
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [ndo_get_iflink])
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [netdev_features_t])
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [pcpu_sw_netstats])
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [netdev_rx_handler_register])
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [net_device_extended])
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [rx_handler_func_t.*pskb],
[OVS_DEFINE([HAVE_RX_HANDLER_PSKB])])
dnl Ubuntu kernel 3.13 has defined this struct but not used for netdev->tstats.
dnl So check type of tstats.
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [pcpu_sw_netstats.*tstats],
[OVS_DEFINE([HAVE_PCPU_SW_NETSTATS])])
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [netif_needs_gso.*net_device],
[OVS_DEFINE([HAVE_NETIF_NEEDS_GSO_NETDEV])])
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [udp_offload])
Expand Down Expand Up @@ -530,8 +525,6 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
OVS_GREP_IFELSE([$KSRC/include/linux/u64_stats_sync.h], [u64_stats_fetch_begin_irq])
OVS_GREP_IFELSE([$KSRC/include/linux/openvswitch.h], [openvswitch_handle_frame_hook],
[OVS_DEFINE([HAVE_RHEL_OVS_HOOK])])
OVS_GREP_IFELSE([$KSRC/include/net/vxlan.h], [struct vxlan_metadata],
[OVS_DEFINE([HAVE_VXLAN_METADATA])])
OVS_GREP_IFELSE([$KSRC/include/net/vxlan.h], [VXLAN_HF_RCO])
Expand Down
28 changes: 7 additions & 21 deletions datapath/actions.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include "datapath.h"
#include "conntrack.h"
#include "gso.h"
#include "vlan.h"
#include "vport.h"

static int do_execute_actions(struct datapath *dp, struct sk_buff *skb,
Expand All @@ -68,9 +67,7 @@ struct ovs_frag_data {
u8 l2_data[MAX_L2_LEN];
};

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
static DEFINE_PER_CPU(struct ovs_frag_data, ovs_frag_data_storage);
#endif

#define DEFERRED_ACTION_FIFO_SIZE 10
struct action_fifo {
Expand Down Expand Up @@ -149,7 +146,7 @@ static int push_mpls(struct sk_buff *skb, struct sw_flow_key *key,
struct ethhdr *hdr;

/* Networking stack do not allow simultaneous Tunnel and MPLS GSO. */
if (skb_encapsulation(skb))
if (skb->encapsulation)
return -ENOTSUPP;

if (skb_cow_head(skb, MPLS_HLEN) < 0)
Expand Down Expand Up @@ -302,14 +299,14 @@ static void update_ip_l4_checksum(struct sk_buff *skb, struct iphdr *nh,
if (nh->protocol == IPPROTO_TCP) {
if (likely(transport_len >= sizeof(struct tcphdr)))
inet_proto_csum_replace4(&tcp_hdr(skb)->check, skb,
addr, new_addr, 1);
addr, new_addr, true);
} else if (nh->protocol == IPPROTO_UDP) {
if (likely(transport_len >= sizeof(struct udphdr))) {
struct udphdr *uh = udp_hdr(skb);

if (uh->check || skb->ip_summed == CHECKSUM_PARTIAL) {
inet_proto_csum_replace4(&uh->check, skb,
addr, new_addr, 1);
addr, new_addr, true);
if (!uh->check)
uh->check = CSUM_MANGLED_0;
}
Expand All @@ -335,22 +332,22 @@ static void update_ipv6_checksum(struct sk_buff *skb, u8 l4_proto,
if (l4_proto == NEXTHDR_TCP) {
if (likely(transport_len >= sizeof(struct tcphdr)))
inet_proto_csum_replace16(&tcp_hdr(skb)->check, skb,
addr, new_addr, 1);
addr, new_addr, true);
} else if (l4_proto == NEXTHDR_UDP) {
if (likely(transport_len >= sizeof(struct udphdr))) {
struct udphdr *uh = udp_hdr(skb);

if (uh->check || skb->ip_summed == CHECKSUM_PARTIAL) {
inet_proto_csum_replace16(&uh->check, skb,
addr, new_addr, 1);
addr, new_addr, true);
if (!uh->check)
uh->check = CSUM_MANGLED_0;
}
}
} else if (l4_proto == NEXTHDR_ICMP) {
if (likely(transport_len >= sizeof(struct icmp6hdr)))
inet_proto_csum_replace16(&icmp6_hdr(skb)->icmp6_cksum,
skb, addr, new_addr, 1);
skb, addr, new_addr, true);
}
}

Expand Down Expand Up @@ -518,7 +515,7 @@ static int set_ipv6(struct sk_buff *skb, struct sw_flow_key *flow_key,
static void set_tp_port(struct sk_buff *skb, __be16 *port,
__be16 new_port, __sum16 *check)
{
inet_proto_csum_replace2(check, skb, *port, new_port, 0);
inet_proto_csum_replace2(check, skb, *port, new_port, false);
*port = new_port;
}

Expand Down Expand Up @@ -625,7 +622,6 @@ static int set_sctp(struct sk_buff *skb, struct sw_flow_key *flow_key,
return 0;
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
static int ovs_vport_output(OVS_VPORT_OUTPUT_PARAMS)
{
struct ovs_frag_data *data = get_pcpu_ptr(ovs_frag_data_storage);
Expand Down Expand Up @@ -740,16 +736,6 @@ static void ovs_fragment(struct vport *vport, struct sk_buff *skb, u16 mru,
err:
kfree_skb(skb);
}
#else /* < 3.10 */
static void ovs_fragment(struct vport *vport, struct sk_buff *skb, u16 mru,
__be16 ethertype)
{
WARN_ONCE(1, "Fragment unavailable ->%s: eth=%04x, MRU=%d, MTU=%d.",
ovs_vport_name(vport), ntohs(ethertype), mru,
vport->dev->mtu);
kfree_skb(skb);
}
#endif

static void do_output(struct datapath *dp, struct sk_buff *skb, int out_port,
struct sw_flow_key *key)
Expand Down
23 changes: 2 additions & 21 deletions datapath/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,14 @@
#include <net/xfrm.h>
#include <net/netfilter/ipv6/nf_defrag_ipv6.h>

/* Even though vanilla 3.10 kernel has grp->id, RHEL 7 kernel is missing
* this field. */
#ifdef HAVE_GENL_MULTICAST_GROUP_WITH_ID
#define GROUP_ID(grp) ((grp)->id)
#else
#define GROUP_ID(grp) 0
#endif

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
#define rt_dst(rt) (rt->dst)
#else
#define rt_dst(rt) (rt->u.dst)
#endif

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
#define inet_sport(sk) (inet_sk(sk)->sport)
#else
#define inet_sport(sk) (inet_sk(sk)->inet_sport)
#endif

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
static inline bool skb_encapsulation(struct sk_buff *skb)
{
return skb->encapsulation;
}
#else
#define skb_encapsulation(skb) false
#endif

#ifdef OVS_FRAGMENT_BACKPORT
#ifdef HAVE_NF_IPV6_OPS_FRAGMENT
static inline int __init ip6_output_init(void) { return 0; }
Expand Down
5 changes: 2 additions & 3 deletions datapath/conntrack.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
#include <linux/kconfig.h>
#include <linux/version.h>

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) && \
IS_ENABLED(CONFIG_NF_CONNTRACK)
#if IS_ENABLED(CONFIG_NF_CONNTRACK)

#include <linux/module.h>
#include <linux/openvswitch.h>
Expand Down Expand Up @@ -799,4 +798,4 @@ void ovs_ct_exit(struct net *net)
nf_connlabels_put(net);
}

#endif /* CONFIG_NF_CONNTRACK && LINUX > 3.10 */
#endif /* CONFIG_NF_CONNTRACK */
2 changes: 1 addition & 1 deletion datapath/conntrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
struct ovs_conntrack_info;
enum ovs_key_attr;

#if IS_ENABLED(CONFIG_NF_CONNTRACK) && LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
#if IS_ENABLED(CONFIG_NF_CONNTRACK)
void ovs_ct_init(struct net *);
void ovs_ct_exit(struct net *);
bool ovs_ct_verify(struct net *, enum ovs_key_attr attr);
Expand Down
7 changes: 1 addition & 6 deletions datapath/datapath.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
#include "flow_table.h"
#include "flow_netlink.h"
#include "gso.h"
#include "vlan.h"
#include "vport-internal_dev.h"
#include "vport-netdev.h"

Expand Down Expand Up @@ -450,12 +449,10 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
if (!nskb)
return -ENOMEM;

nskb = vlan_insert_tag_set_proto(nskb, nskb->vlan_proto, skb_vlan_tag_get(nskb));
nskb = __vlan_hwaccel_push_inside(nskb);
if (!nskb)
return -ENOMEM;

vlan_set_tci(nskb, 0);

skb = nskb;
}

Expand Down Expand Up @@ -2316,8 +2313,6 @@ static struct pernet_operations ovs_net_ops = {
.size = sizeof(struct ovs_net),
};

DEFINE_COMPAT_PNET_REG_FUNC(device);

static int __init dp_init(void)
{
int err;
Expand Down
1 change: 0 additions & 1 deletion datapath/datapath.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "compat.h"
#include "flow.h"
#include "flow_table.h"
#include "vlan.h"

#define DP_MAX_PORTS USHRT_MAX
#define DP_VPORT_HASH_BUCKETS 1024
Expand Down
3 changes: 1 addition & 2 deletions datapath/flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
#include "flow.h"
#include "flow_netlink.h"
#include "vport.h"
#include "vlan.h"

u64 ovs_flow_used_time(unsigned long flow_jiffies)
{
Expand Down Expand Up @@ -477,7 +476,7 @@ static int key_extract(struct sk_buff *skb, struct sw_flow_key *key)

key->eth.tci = 0;
if (skb_vlan_tag_present(skb))
key->eth.tci = htons(vlan_get_tci(skb));
key->eth.tci = htons(skb->vlan_tci);
else if (eth->h_proto == htons(ETH_P_8021Q))
if (unlikely(parse_vlan(skb, key)))
return -ENOMEM;
Expand Down
Loading

0 comments on commit 8063e09

Please sign in to comment.