Skip to content

Commit

Permalink
datapath: Support for Linux kernel 3.9.
Browse files Browse the repository at this point in the history
In certain cases we need to ensure we save off skb->cb before
calling __skb_gso_segment() since in kernels >= 3.9 skb->cb is
used by this routine.

Signed-off-by: Pravin B Shelar <[email protected]>
Signed-off-by: Kyle Mestery <[email protected]>
Signed-off-by: Jesse Gross <[email protected]>
  • Loading branch information
mestery authored and jessegross committed Jul 31, 2013
1 parent 6a69010 commit 7ceda29
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion FAQ
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ A: The following table lists the Linux kernel versions against which the
1.9.x 2.6.18 to 3.8
1.10.x 2.6.18 to 3.8
1.11.x 2.6.18 to 3.8
1.12.x 2.6.18 to 3.8
1.12.x 2.6.18 to 3.9

Open vSwitch userspace should also work with the Linux kernel module
built into Linux 3.3 and later.
Expand Down
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ v1.12.0 - xx xxx xxxx
through database paths (e.g. Private key option with the database name
should look like "--private-key=db:Open_vSwitch,SSL,private_key").
- Added ovs-dev.py, a utility script helpful for Open vSwitch developers.
- Support for Linux kernels up to 3.9


v1.11.0 - xx xxx xxxx
Expand Down
4 changes: 2 additions & 2 deletions datapath/datapath.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
#include "vport-netdev.h"

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) || \
LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)
#error Kernels before 2.6.18 or after 3.8 are not supported by this version of Open vSwitch.
LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
#error Kernels before 2.6.18 or after 3.9 are not supported by this version of Open vSwitch.
#endif

#define REHASH_FLOW_INTERVAL (10 * 60 * HZ)
Expand Down
6 changes: 6 additions & 0 deletions datapath/linux/compat/gso.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ static struct sk_buff *tnl_skb_gso_segment(struct sk_buff *skb,
struct sk_buff *skb1 = skb;
struct sk_buff *segs;
__be16 proto = skb->protocol;
char cb[sizeof(skb->cb)];

/* setup whole inner packet to get protocol. */
__skb_pull(skb, mac_offset);
Expand All @@ -76,6 +77,10 @@ static struct sk_buff *tnl_skb_gso_segment(struct sk_buff *skb,
skb_reset_network_header(skb);
skb_reset_transport_header(skb);

/* From 3.9 kernel skb->cb is used by skb gso. Therefore
* make copy of it to restore it back. */
memcpy(cb, skb->cb, sizeof(cb));

segs = __skb_gso_segment(skb, 0, tx_path);
if (!segs || IS_ERR(segs))
goto free;
Expand All @@ -89,6 +94,7 @@ static struct sk_buff *tnl_skb_gso_segment(struct sk_buff *skb,
skb->mac_len = 0;

memcpy(ip_hdr(skb), iph, pkt_hlen);
memcpy(skb->cb, cb, sizeof(cb));
if (OVS_GSO_CB(skb)->fix_segment)
OVS_GSO_CB(skb)->fix_segment(skb);

Expand Down
7 changes: 7 additions & 0 deletions datapath/tunnel.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ static struct sk_buff *handle_offloads(struct sk_buff *skb)

if (skb_is_gso(skb)) {
struct sk_buff *nskb;
char cb[sizeof(skb->cb)];

memcpy(cb, skb->cb, sizeof(cb));

nskb = __skb_gso_segment(skb, 0, false);
if (IS_ERR(nskb)) {
Expand All @@ -153,6 +156,10 @@ static struct sk_buff *handle_offloads(struct sk_buff *skb)

consume_skb(skb);
skb = nskb;
while (nskb) {
memcpy(nskb->cb, cb, sizeof(cb));
nskb = nskb->next;
}
} else if (get_ip_summed(skb) == OVS_CSUM_PARTIAL) {
/* Pages aren't locked and could change at any time.
* If this happens after we compute the checksum, the
Expand Down
1 change: 1 addition & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ openvswitch (1.12.0-1) unstable; urgency=low
through database paths (e.g. Private key option with the database name
should look like "--private-key=db:Open_vSwitch,SSL,private_key").
- Added ovs-dev.py, a utility script helpful for Open vSwitch developers.
- Support for Linux kernels up to 3.9

-- Open vSwitch team <[email protected]> Tue, 03 Jul 2013 15:02:34 -0700

Expand Down

0 comments on commit 7ceda29

Please sign in to comment.