vswitch: Use ovsdb_idl_get() to avoid O(n) in get_ovsrec_key_value().
[openvswitch] / datapath / actions.c
index fed9830fe773c1244970a56cab232f4331364529..f7e51d925152d09a17bd0d92b10079c37e3fa5e4 100644 (file)
@@ -113,6 +113,8 @@ modify_vlan_tci(struct datapath *dp, struct sk_buff *skb,
                                                ~skb->csum);
                }
        } else {
+               int err;
+
                /* Add vlan header */
 
                /* Set up checksumming pointers for checksum-deferred packets
@@ -120,7 +122,11 @@ modify_vlan_tci(struct datapath *dp, struct sk_buff *skb,
                 * when we send the packet out on the wire, and it will fail at
                 * that point because skb_checksum_setup() will not look inside
                 * an 802.1Q header. */
-               vswitch_skb_checksum_setup(skb);
+               err = vswitch_skb_checksum_setup(skb);
+               if (unlikely(err)) {
+                       kfree_skb(skb);
+                       return ERR_PTR(err);
+               }       
 
                /* GSO is not implemented for packets with an 802.1Q header, so
                 * we have to do segmentation before we add that header.
@@ -444,6 +450,7 @@ int execute_actions(struct datapath *dp, struct sk_buff *skb,
         * then freeing the original skbuff is wasteful.  So the following code
         * is slightly obscure just to avoid that. */
        int prev_port = -1;
+       u32 priority = skb->priority;
        int err;
 
        if (dp->sflow_probability) {
@@ -516,6 +523,14 @@ int execute_actions(struct datapath *dp, struct sk_buff *skb,
                case ODPAT_SET_TP_DST:
                        skb = set_tp_port(skb, key, &a->tp_port, gfp);
                        break;
+
+               case ODPAT_SET_PRIORITY:
+                       skb->priority = a->priority.priority;
+                       break;
+
+               case ODPAT_POP_PRIORITY:
+                       skb->priority = priority;
+                       break;
                }
                if (!skb)
                        return -ENOMEM;