]> git.proxmox.com Git - ovs.git/blob - lib/odp-execute.c
vswitchd: Allow modifying ICMP type and code.
[ovs.git] / lib / odp-execute.c
1 /*
2 * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
3 * Copyright (c) 2013 Simon Horman
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 #include <config.h>
19 #include "odp-execute.h"
20 #include <arpa/inet.h>
21 #include <netinet/in.h>
22 #include <netinet/icmp6.h>
23 #include <netinet/ip6.h>
24 #include <stdlib.h>
25 #include <string.h>
26
27 #include "dp-packet.h"
28 #include "dpif.h"
29 #include "netlink.h"
30 #include "odp-netlink.h"
31 #include "odp-util.h"
32 #include "packets.h"
33 #include "flow.h"
34 #include "unaligned.h"
35 #include "util.h"
36
37 /* Masked copy of an ethernet address. 'src' is already properly masked. */
38 static void
39 ether_addr_copy_masked(struct eth_addr *dst, const struct eth_addr src,
40 const struct eth_addr mask)
41 {
42 int i;
43
44 for (i = 0; i < ARRAY_SIZE(dst->be16); i++) {
45 dst->be16[i] = src.be16[i] | (dst->be16[i] & ~mask.be16[i]);
46 }
47 }
48
49 static void
50 odp_eth_set_addrs(struct dp_packet *packet, const struct ovs_key_ethernet *key,
51 const struct ovs_key_ethernet *mask)
52 {
53 struct eth_header *eh = dp_packet_l2(packet);
54
55 if (eh) {
56 if (!mask) {
57 eh->eth_src = key->eth_src;
58 eh->eth_dst = key->eth_dst;
59 } else {
60 ether_addr_copy_masked(&eh->eth_src, key->eth_src, mask->eth_src);
61 ether_addr_copy_masked(&eh->eth_dst, key->eth_dst, mask->eth_dst);
62 }
63 }
64 }
65
66 static void
67 odp_set_ipv4(struct dp_packet *packet, const struct ovs_key_ipv4 *key,
68 const struct ovs_key_ipv4 *mask)
69 {
70 struct ip_header *nh = dp_packet_l3(packet);
71
72 packet_set_ipv4(
73 packet,
74 key->ipv4_src | (get_16aligned_be32(&nh->ip_src) & ~mask->ipv4_src),
75 key->ipv4_dst | (get_16aligned_be32(&nh->ip_dst) & ~mask->ipv4_dst),
76 key->ipv4_tos | (nh->ip_tos & ~mask->ipv4_tos),
77 key->ipv4_ttl | (nh->ip_ttl & ~mask->ipv4_ttl));
78 }
79
80 static const ovs_be32 *
81 mask_ipv6_addr(const ovs_16aligned_be32 *old, const ovs_be32 *addr,
82 const ovs_be32 *mask, ovs_be32 *masked)
83 {
84 for (int i = 0; i < 4; i++) {
85 masked[i] = addr[i] | (get_16aligned_be32(&old[i]) & ~mask[i]);
86 }
87
88 return masked;
89 }
90
91 static void
92 odp_set_ipv6(struct dp_packet *packet, const struct ovs_key_ipv6 *key,
93 const struct ovs_key_ipv6 *mask)
94 {
95 struct ovs_16aligned_ip6_hdr *nh = dp_packet_l3(packet);
96 ovs_be32 sbuf[4], dbuf[4];
97 uint8_t old_tc = ntohl(get_16aligned_be32(&nh->ip6_flow)) >> 20;
98 ovs_be32 old_fl = get_16aligned_be32(&nh->ip6_flow) & htonl(0xfffff);
99
100 packet_set_ipv6(
101 packet,
102 key->ipv6_proto,
103 mask_ipv6_addr(nh->ip6_src.be32, key->ipv6_src, mask->ipv6_src, sbuf),
104 mask_ipv6_addr(nh->ip6_dst.be32, key->ipv6_dst, mask->ipv6_dst, dbuf),
105 key->ipv6_tclass | (old_tc & ~mask->ipv6_tclass),
106 key->ipv6_label | (old_fl & ~mask->ipv6_label),
107 key->ipv6_hlimit | (nh->ip6_hlim & ~mask->ipv6_hlimit));
108 }
109
110 static void
111 odp_set_tcp(struct dp_packet *packet, const struct ovs_key_tcp *key,
112 const struct ovs_key_tcp *mask)
113 {
114 struct tcp_header *th = dp_packet_l4(packet);
115
116 if (OVS_LIKELY(th && dp_packet_get_tcp_payload(packet))) {
117 packet_set_tcp_port(packet,
118 key->tcp_src | (th->tcp_src & ~mask->tcp_src),
119 key->tcp_dst | (th->tcp_dst & ~mask->tcp_dst));
120 }
121 }
122
123 static void
124 odp_set_udp(struct dp_packet *packet, const struct ovs_key_udp *key,
125 const struct ovs_key_udp *mask)
126 {
127 struct udp_header *uh = dp_packet_l4(packet);
128
129 if (OVS_LIKELY(uh && dp_packet_get_udp_payload(packet))) {
130 packet_set_udp_port(packet,
131 key->udp_src | (uh->udp_src & ~mask->udp_src),
132 key->udp_dst | (uh->udp_dst & ~mask->udp_dst));
133 }
134 }
135
136 static void
137 odp_set_sctp(struct dp_packet *packet, const struct ovs_key_sctp *key,
138 const struct ovs_key_sctp *mask)
139 {
140 struct sctp_header *sh = dp_packet_l4(packet);
141
142 if (OVS_LIKELY(sh && dp_packet_get_sctp_payload(packet))) {
143 packet_set_sctp_port(packet,
144 key->sctp_src | (sh->sctp_src & ~mask->sctp_src),
145 key->sctp_dst | (sh->sctp_dst & ~mask->sctp_dst));
146 }
147 }
148
149 static void
150 odp_set_tunnel_action(const struct nlattr *a, struct flow_tnl *tun_key)
151 {
152 enum odp_key_fitness fitness;
153
154 fitness = odp_tun_key_from_attr(a, true, tun_key);
155 ovs_assert(fitness != ODP_FIT_ERROR);
156 }
157
158 static void
159 set_arp(struct dp_packet *packet, const struct ovs_key_arp *key,
160 const struct ovs_key_arp *mask)
161 {
162 struct arp_eth_header *arp = dp_packet_l3(packet);
163
164 if (!mask) {
165 arp->ar_op = key->arp_op;
166 arp->ar_sha = key->arp_sha;
167 put_16aligned_be32(&arp->ar_spa, key->arp_sip);
168 arp->ar_tha = key->arp_tha;
169 put_16aligned_be32(&arp->ar_tpa, key->arp_tip);
170 } else {
171 ovs_be32 ar_spa = get_16aligned_be32(&arp->ar_spa);
172 ovs_be32 ar_tpa = get_16aligned_be32(&arp->ar_tpa);
173
174 arp->ar_op = key->arp_op | (arp->ar_op & ~mask->arp_op);
175 ether_addr_copy_masked(&arp->ar_sha, key->arp_sha, mask->arp_sha);
176 put_16aligned_be32(&arp->ar_spa,
177 key->arp_sip | (ar_spa & ~mask->arp_sip));
178 ether_addr_copy_masked(&arp->ar_tha, key->arp_tha, mask->arp_tha);
179 put_16aligned_be32(&arp->ar_tpa,
180 key->arp_tip | (ar_tpa & ~mask->arp_tip));
181 }
182 }
183
184 static void
185 odp_set_nd(struct dp_packet *packet, const struct ovs_key_nd *key,
186 const struct ovs_key_nd *mask)
187 {
188 const struct ovs_nd_msg *ns = dp_packet_l4(packet);
189 const struct ovs_nd_opt *nd_opt = dp_packet_get_nd_payload(packet);
190
191 if (OVS_LIKELY(ns && nd_opt)) {
192 int bytes_remain = dp_packet_l4_size(packet) - sizeof(*ns);
193 ovs_be32 tgt_buf[4];
194 struct eth_addr sll_buf = eth_addr_zero;
195 struct eth_addr tll_buf = eth_addr_zero;
196
197 while (bytes_remain >= ND_OPT_LEN && nd_opt->nd_opt_len != 0) {
198 if (nd_opt->nd_opt_type == ND_OPT_SOURCE_LINKADDR
199 && nd_opt->nd_opt_len == 1) {
200 sll_buf = nd_opt->nd_opt_mac;
201 ether_addr_copy_masked(&sll_buf, key->nd_sll, mask->nd_sll);
202
203 /* A packet can only contain one SLL or TLL option */
204 break;
205 } else if (nd_opt->nd_opt_type == ND_OPT_TARGET_LINKADDR
206 && nd_opt->nd_opt_len == 1) {
207 tll_buf = nd_opt->nd_opt_mac;
208 ether_addr_copy_masked(&tll_buf, key->nd_tll, mask->nd_tll);
209
210 /* A packet can only contain one SLL or TLL option */
211 break;
212 }
213
214 nd_opt += nd_opt->nd_opt_len;
215 bytes_remain -= nd_opt->nd_opt_len * ND_OPT_LEN;
216 }
217
218 packet_set_nd(packet,
219 mask_ipv6_addr(ns->target.be32,
220 key->nd_target, mask->nd_target, tgt_buf),
221 sll_buf,
222 tll_buf);
223 }
224 }
225
226 static void
227 odp_execute_set_action(struct dp_packet *packet, const struct nlattr *a)
228 {
229 enum ovs_key_attr type = nl_attr_type(a);
230 const struct ovs_key_ipv4 *ipv4_key;
231 const struct ovs_key_ipv6 *ipv6_key;
232 struct pkt_metadata *md = &packet->md;
233
234 switch (type) {
235 case OVS_KEY_ATTR_PRIORITY:
236 md->skb_priority = nl_attr_get_u32(a);
237 break;
238
239 case OVS_KEY_ATTR_TUNNEL:
240 odp_set_tunnel_action(a, &md->tunnel);
241 break;
242
243 case OVS_KEY_ATTR_SKB_MARK:
244 md->pkt_mark = nl_attr_get_u32(a);
245 break;
246
247 case OVS_KEY_ATTR_ETHERNET:
248 odp_eth_set_addrs(packet, nl_attr_get(a), NULL);
249 break;
250
251 case OVS_KEY_ATTR_IPV4:
252 ipv4_key = nl_attr_get_unspec(a, sizeof(struct ovs_key_ipv4));
253 packet_set_ipv4(packet, ipv4_key->ipv4_src,
254 ipv4_key->ipv4_dst, ipv4_key->ipv4_tos,
255 ipv4_key->ipv4_ttl);
256 break;
257
258 case OVS_KEY_ATTR_IPV6:
259 ipv6_key = nl_attr_get_unspec(a, sizeof(struct ovs_key_ipv6));
260 packet_set_ipv6(packet, ipv6_key->ipv6_proto,
261 ipv6_key->ipv6_src, ipv6_key->ipv6_dst,
262 ipv6_key->ipv6_tclass, ipv6_key->ipv6_label,
263 ipv6_key->ipv6_hlimit);
264 break;
265
266 case OVS_KEY_ATTR_TCP:
267 if (OVS_LIKELY(dp_packet_get_tcp_payload(packet))) {
268 const struct ovs_key_tcp *tcp_key
269 = nl_attr_get_unspec(a, sizeof(struct ovs_key_tcp));
270
271 packet_set_tcp_port(packet, tcp_key->tcp_src,
272 tcp_key->tcp_dst);
273 }
274 break;
275
276 case OVS_KEY_ATTR_UDP:
277 if (OVS_LIKELY(dp_packet_get_udp_payload(packet))) {
278 const struct ovs_key_udp *udp_key
279 = nl_attr_get_unspec(a, sizeof(struct ovs_key_udp));
280
281 packet_set_udp_port(packet, udp_key->udp_src,
282 udp_key->udp_dst);
283 }
284 break;
285
286 case OVS_KEY_ATTR_SCTP:
287 if (OVS_LIKELY(dp_packet_get_sctp_payload(packet))) {
288 const struct ovs_key_sctp *sctp_key
289 = nl_attr_get_unspec(a, sizeof(struct ovs_key_sctp));
290
291 packet_set_sctp_port(packet, sctp_key->sctp_src,
292 sctp_key->sctp_dst);
293 }
294 break;
295
296 case OVS_KEY_ATTR_MPLS:
297 set_mpls_lse(packet, nl_attr_get_be32(a));
298 break;
299
300 case OVS_KEY_ATTR_ARP:
301 set_arp(packet, nl_attr_get(a), NULL);
302 break;
303
304 case OVS_KEY_ATTR_ICMP:
305 case OVS_KEY_ATTR_ICMPV6:
306 if (OVS_LIKELY(dp_packet_get_icmp_payload(packet))) {
307 const struct ovs_key_icmp *icmp_key
308 = nl_attr_get_unspec(a, sizeof(struct ovs_key_icmp));
309
310 packet_set_icmp(packet, icmp_key->icmp_type, icmp_key->icmp_code);
311 }
312 break;
313
314 case OVS_KEY_ATTR_ND:
315 if (OVS_LIKELY(dp_packet_get_nd_payload(packet))) {
316 const struct ovs_key_nd *nd_key
317 = nl_attr_get_unspec(a, sizeof(struct ovs_key_nd));
318 packet_set_nd(packet, nd_key->nd_target, nd_key->nd_sll,
319 nd_key->nd_tll);
320 }
321 break;
322
323 case OVS_KEY_ATTR_DP_HASH:
324 md->dp_hash = nl_attr_get_u32(a);
325 break;
326
327 case OVS_KEY_ATTR_RECIRC_ID:
328 md->recirc_id = nl_attr_get_u32(a);
329 break;
330
331 case OVS_KEY_ATTR_UNSPEC:
332 case OVS_KEY_ATTR_ENCAP:
333 case OVS_KEY_ATTR_ETHERTYPE:
334 case OVS_KEY_ATTR_IN_PORT:
335 case OVS_KEY_ATTR_VLAN:
336 case OVS_KEY_ATTR_TCP_FLAGS:
337 case OVS_KEY_ATTR_CT_STATE:
338 case OVS_KEY_ATTR_CT_ZONE:
339 case OVS_KEY_ATTR_CT_MARK:
340 case OVS_KEY_ATTR_CT_LABELS:
341 case __OVS_KEY_ATTR_MAX:
342 default:
343 OVS_NOT_REACHED();
344 }
345 }
346
347 #define get_mask(a, type) ((const type *)(const void *)(a + 1) + 1)
348
349 static void
350 odp_execute_masked_set_action(struct dp_packet *packet,
351 const struct nlattr *a)
352 {
353 struct pkt_metadata *md = &packet->md;
354 enum ovs_key_attr type = nl_attr_type(a);
355 struct mpls_hdr *mh;
356
357 switch (type) {
358 case OVS_KEY_ATTR_PRIORITY:
359 md->skb_priority = nl_attr_get_u32(a)
360 | (md->skb_priority & ~*get_mask(a, uint32_t));
361 break;
362
363 case OVS_KEY_ATTR_SKB_MARK:
364 md->pkt_mark = nl_attr_get_u32(a)
365 | (md->pkt_mark & ~*get_mask(a, uint32_t));
366 break;
367
368 case OVS_KEY_ATTR_ETHERNET:
369 odp_eth_set_addrs(packet, nl_attr_get(a),
370 get_mask(a, struct ovs_key_ethernet));
371 break;
372
373 case OVS_KEY_ATTR_IPV4:
374 odp_set_ipv4(packet, nl_attr_get(a),
375 get_mask(a, struct ovs_key_ipv4));
376 break;
377
378 case OVS_KEY_ATTR_IPV6:
379 odp_set_ipv6(packet, nl_attr_get(a),
380 get_mask(a, struct ovs_key_ipv6));
381 break;
382
383 case OVS_KEY_ATTR_TCP:
384 odp_set_tcp(packet, nl_attr_get(a),
385 get_mask(a, struct ovs_key_tcp));
386 break;
387
388 case OVS_KEY_ATTR_UDP:
389 odp_set_udp(packet, nl_attr_get(a),
390 get_mask(a, struct ovs_key_udp));
391 break;
392
393 case OVS_KEY_ATTR_SCTP:
394 odp_set_sctp(packet, nl_attr_get(a),
395 get_mask(a, struct ovs_key_sctp));
396 break;
397
398 case OVS_KEY_ATTR_MPLS:
399 mh = dp_packet_l2_5(packet);
400 if (mh) {
401 put_16aligned_be32(&mh->mpls_lse, nl_attr_get_be32(a)
402 | (get_16aligned_be32(&mh->mpls_lse)
403 & ~*get_mask(a, ovs_be32)));
404 }
405 break;
406
407 case OVS_KEY_ATTR_ARP:
408 set_arp(packet, nl_attr_get(a),
409 get_mask(a, struct ovs_key_arp));
410 break;
411
412 case OVS_KEY_ATTR_ND:
413 odp_set_nd(packet, nl_attr_get(a),
414 get_mask(a, struct ovs_key_nd));
415 break;
416
417 case OVS_KEY_ATTR_DP_HASH:
418 md->dp_hash = nl_attr_get_u32(a)
419 | (md->dp_hash & ~*get_mask(a, uint32_t));
420 break;
421
422 case OVS_KEY_ATTR_RECIRC_ID:
423 md->recirc_id = nl_attr_get_u32(a)
424 | (md->recirc_id & ~*get_mask(a, uint32_t));
425 break;
426
427 case OVS_KEY_ATTR_TUNNEL: /* Masked data not supported for tunnel. */
428 case OVS_KEY_ATTR_UNSPEC:
429 case OVS_KEY_ATTR_CT_STATE:
430 case OVS_KEY_ATTR_CT_ZONE:
431 case OVS_KEY_ATTR_CT_MARK:
432 case OVS_KEY_ATTR_CT_LABELS:
433 case OVS_KEY_ATTR_ENCAP:
434 case OVS_KEY_ATTR_ETHERTYPE:
435 case OVS_KEY_ATTR_IN_PORT:
436 case OVS_KEY_ATTR_VLAN:
437 case OVS_KEY_ATTR_ICMP:
438 case OVS_KEY_ATTR_ICMPV6:
439 case OVS_KEY_ATTR_TCP_FLAGS:
440 case __OVS_KEY_ATTR_MAX:
441 default:
442 OVS_NOT_REACHED();
443 }
444 }
445
446 static void
447 odp_execute_sample(void *dp, struct dp_packet *packet, bool steal,
448 const struct nlattr *action,
449 odp_execute_cb dp_execute_action)
450 {
451 const struct nlattr *subactions = NULL;
452 const struct nlattr *a;
453 size_t left;
454
455 NL_NESTED_FOR_EACH_UNSAFE (a, left, action) {
456 int type = nl_attr_type(a);
457
458 switch ((enum ovs_sample_attr) type) {
459 case OVS_SAMPLE_ATTR_PROBABILITY:
460 if (random_uint32() >= nl_attr_get_u32(a)) {
461 if (steal) {
462 dp_packet_delete(packet);
463 }
464 return;
465 }
466 break;
467
468 case OVS_SAMPLE_ATTR_ACTIONS:
469 subactions = a;
470 break;
471
472 case OVS_SAMPLE_ATTR_UNSPEC:
473 case __OVS_SAMPLE_ATTR_MAX:
474 default:
475 OVS_NOT_REACHED();
476 }
477 }
478
479 odp_execute_actions(dp, &packet, 1, steal, nl_attr_get(subactions),
480 nl_attr_get_size(subactions), dp_execute_action);
481 }
482
483 static bool
484 requires_datapath_assistance(const struct nlattr *a)
485 {
486 enum ovs_action_attr type = nl_attr_type(a);
487
488 switch (type) {
489 /* These only make sense in the context of a datapath. */
490 case OVS_ACTION_ATTR_OUTPUT:
491 case OVS_ACTION_ATTR_TUNNEL_PUSH:
492 case OVS_ACTION_ATTR_TUNNEL_POP:
493 case OVS_ACTION_ATTR_USERSPACE:
494 case OVS_ACTION_ATTR_RECIRC:
495 case OVS_ACTION_ATTR_CT:
496 return true;
497
498 case OVS_ACTION_ATTR_SET:
499 case OVS_ACTION_ATTR_SET_MASKED:
500 case OVS_ACTION_ATTR_PUSH_VLAN:
501 case OVS_ACTION_ATTR_POP_VLAN:
502 case OVS_ACTION_ATTR_SAMPLE:
503 case OVS_ACTION_ATTR_HASH:
504 case OVS_ACTION_ATTR_PUSH_MPLS:
505 case OVS_ACTION_ATTR_POP_MPLS:
506 return false;
507
508 case OVS_ACTION_ATTR_UNSPEC:
509 case __OVS_ACTION_ATTR_MAX:
510 OVS_NOT_REACHED();
511 }
512
513 return false;
514 }
515
516 void
517 odp_execute_actions(void *dp, struct dp_packet **packets, int cnt, bool steal,
518 const struct nlattr *actions, size_t actions_len,
519 odp_execute_cb dp_execute_action)
520 {
521 const struct nlattr *a;
522 unsigned int left;
523 int i;
524
525 NL_ATTR_FOR_EACH_UNSAFE (a, left, actions, actions_len) {
526 int type = nl_attr_type(a);
527 bool last_action = (left <= NLA_ALIGN(a->nla_len));
528
529 if (requires_datapath_assistance(a)) {
530 if (dp_execute_action) {
531 /* Allow 'dp_execute_action' to steal the packet data if we do
532 * not need it any more. */
533 bool may_steal = steal && last_action;
534
535 dp_execute_action(dp, packets, cnt, a, may_steal);
536
537 if (last_action) {
538 /* We do not need to free the packets. dp_execute_actions()
539 * has stolen them */
540 return;
541 }
542 }
543 continue;
544 }
545
546 switch ((enum ovs_action_attr) type) {
547 case OVS_ACTION_ATTR_HASH: {
548 const struct ovs_action_hash *hash_act = nl_attr_get(a);
549
550 /* Calculate a hash value directly. This might not match the
551 * value computed by the datapath, but it is much less expensive,
552 * and the current use case (bonding) does not require a strict
553 * match to work properly. */
554 if (hash_act->hash_alg == OVS_HASH_ALG_L4) {
555 struct flow flow;
556 uint32_t hash;
557
558 for (i = 0; i < cnt; i++) {
559 flow_extract(packets[i], &flow);
560 hash = flow_hash_5tuple(&flow, hash_act->hash_basis);
561
562 packets[i]->md.dp_hash = hash;
563 }
564 } else {
565 /* Assert on unknown hash algorithm. */
566 OVS_NOT_REACHED();
567 }
568 break;
569 }
570
571 case OVS_ACTION_ATTR_PUSH_VLAN: {
572 const struct ovs_action_push_vlan *vlan = nl_attr_get(a);
573
574 for (i = 0; i < cnt; i++) {
575 eth_push_vlan(packets[i], vlan->vlan_tpid, vlan->vlan_tci);
576 }
577 break;
578 }
579
580 case OVS_ACTION_ATTR_POP_VLAN:
581 for (i = 0; i < cnt; i++) {
582 eth_pop_vlan(packets[i]);
583 }
584 break;
585
586 case OVS_ACTION_ATTR_PUSH_MPLS: {
587 const struct ovs_action_push_mpls *mpls = nl_attr_get(a);
588
589 for (i = 0; i < cnt; i++) {
590 push_mpls(packets[i], mpls->mpls_ethertype, mpls->mpls_lse);
591 }
592 break;
593 }
594
595 case OVS_ACTION_ATTR_POP_MPLS:
596 for (i = 0; i < cnt; i++) {
597 pop_mpls(packets[i], nl_attr_get_be16(a));
598 }
599 break;
600
601 case OVS_ACTION_ATTR_SET:
602 for (i = 0; i < cnt; i++) {
603 odp_execute_set_action(packets[i], nl_attr_get(a));
604 }
605 break;
606
607 case OVS_ACTION_ATTR_SET_MASKED:
608 for (i = 0; i < cnt; i++) {
609 odp_execute_masked_set_action(packets[i], nl_attr_get(a));
610 }
611 break;
612
613 case OVS_ACTION_ATTR_SAMPLE:
614 for (i = 0; i < cnt; i++) {
615 odp_execute_sample(dp, packets[i], steal && last_action, a,
616 dp_execute_action);
617 }
618
619 if (last_action) {
620 /* We do not need to free the packets. odp_execute_sample() has
621 * stolen them*/
622 return;
623 }
624 break;
625
626 case OVS_ACTION_ATTR_OUTPUT:
627 case OVS_ACTION_ATTR_TUNNEL_PUSH:
628 case OVS_ACTION_ATTR_TUNNEL_POP:
629 case OVS_ACTION_ATTR_USERSPACE:
630 case OVS_ACTION_ATTR_RECIRC:
631 case OVS_ACTION_ATTR_CT:
632 case OVS_ACTION_ATTR_UNSPEC:
633 case __OVS_ACTION_ATTR_MAX:
634 OVS_NOT_REACHED();
635 }
636 }
637
638 if (steal) {
639 for (i = 0; i < cnt; i++) {
640 dp_packet_delete(packets[i]);
641 }
642 }
643 }