From 67c74f7515867fb8b3a4d23af98dacd3d547ebdd Mon Sep 17 00:00:00 2001 From: Jesse Gross Date: Thu, 29 Jul 2010 19:01:02 -0700 Subject: [PATCH] datapath: Remove redundant checks on SKBs. On vport ingress we already check for shared SKBs but then later warn in several other places. In a similar vein, we check every packet to see if it is LRO but only certain vports can produce these packets. Remove and consolidate checks to the places where they are needed. --- datapath/actions.c | 3 +-- datapath/datapath.c | 3 --- datapath/vport-netdev.c | 4 +++- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/datapath/actions.c b/datapath/actions.c index 1a6cc357..a6771b6c 100644 --- a/datapath/actions.c +++ b/datapath/actions.c @@ -26,7 +26,7 @@ static struct sk_buff *make_writable(struct sk_buff *skb, unsigned min_headroom, gfp_t gfp) { - if (skb_shared(skb) || skb_cloned(skb)) { + if (skb_cloned(skb)) { struct sk_buff *nskb; unsigned headroom = max(min_headroom, skb_headroom(skb)); @@ -420,7 +420,6 @@ int execute_actions(struct datapath *dp, struct sk_buff *skb, OVS_CB(skb)->tun_id = 0; for (; n_actions > 0; a++, n_actions--) { - WARN_ON_ONCE(skb_shared(skb)); if (prev_port != -1) { do_output(dp, skb_clone(skb, gfp), prev_port); prev_port = -1; diff --git a/datapath/datapath.c b/datapath/datapath.c index 54c9fa36..50c7f6ec 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -522,9 +522,6 @@ void dp_process_received_packet(struct dp_port *p, struct sk_buff *skb) struct odp_flow_key key; struct tbl_node *flow_node; - WARN_ON_ONCE(skb_shared(skb)); - skb_warn_if_lro(skb); - OVS_CB(skb)->dp_port = p; if (flow_extract(skb, p ? p->port_no : ODPP_NONE, &key)) { diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c index f172ac4e..1773a09b 100644 --- a/datapath/vport-netdev.c +++ b/datapath/vport-netdev.c @@ -251,9 +251,11 @@ static void netdev_port_receive(struct net_bridge_port *p, struct sk_buff *skb) * (No one comes after us, since we tell handle_bridge() that we took * the packet.) */ skb = skb_share_check(skb, GFP_ATOMIC); - if (!skb) + if (unlikely(!skb)) return; + skb_warn_if_lro(skb); + /* Push the Ethernet header back on. */ skb_push(skb, ETH_HLEN); skb_reset_mac_header(skb); -- 2.30.2