datapath: Remove redundant checks on SKBs.
authorJesse Gross <jesse@nicira.com>
Fri, 30 Jul 2010 02:01:02 +0000 (19:01 -0700)
committerJesse Gross <jesse@nicira.com>
Fri, 30 Jul 2010 20:35:20 +0000 (13:35 -0700)
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
datapath/datapath.c
datapath/vport-netdev.c

index 1a6cc35705e36328552e5af2aeb6c049071d4201..a6771b6c58c4d97c49725dde8dd2a82244259fad 100644 (file)
@@ -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;
index 54c9fa36bc5684c56ce4d38788720d471f80dfee..50c7f6ec2064dc956c8c84ffa82054b73399a751 100644 (file)
@@ -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)) {
index f172ac4edf0ba89cecd1ae2d00ac27da66f25951..1773a09b98ce6418062b3220fd9b1d741be71300 100644 (file)
@@ -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);