e808e791b6c37fd93136ac32ec3921b2439ba1ec
[dpdk.git] / examples / ip_pipeline / pipeline / pipeline_flow_classification_be.c
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
5  *   All rights reserved.
6  *
7  *   Redistribution and use in source and binary forms, with or without
8  *   modification, are permitted provided that the following conditions
9  *   are met:
10  *
11  *     * Redistributions of source code must retain the above copyright
12  *       notice, this list of conditions and the following disclaimer.
13  *     * Redistributions in binary form must reproduce the above copyright
14  *       notice, this list of conditions and the following disclaimer in
15  *       the documentation and/or other materials provided with the
16  *       distribution.
17  *     * Neither the name of Intel Corporation nor the names of its
18  *       contributors may be used to endorse or promote products derived
19  *       from this software without specific prior written permission.
20  *
21  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33
34 #include <string.h>
35
36 #include <rte_common.h>
37 #include <rte_malloc.h>
38 #include <rte_table_hash.h>
39 #include <rte_byteorder.h>
40 #include <pipeline.h>
41
42 #include "pipeline_flow_classification_be.h"
43 #include "pipeline_actions_common.h"
44 #include "hash_func.h"
45
46 struct pipeline_flow_classification {
47         struct pipeline p;
48         pipeline_msg_req_handler custom_handlers[PIPELINE_FC_MSG_REQS];
49
50         uint32_t n_flows;
51         uint32_t key_size;
52         uint32_t flow_id;
53
54         uint32_t key_offset;
55         uint32_t hash_offset;
56         uint8_t *key_mask;
57         uint32_t flow_id_offset;
58
59 } __rte_cache_aligned;
60
61 static void *
62 pipeline_fc_msg_req_custom_handler(struct pipeline *p, void *msg);
63
64 static pipeline_msg_req_handler handlers[] = {
65         [PIPELINE_MSG_REQ_PING] =
66                 pipeline_msg_req_ping_handler,
67         [PIPELINE_MSG_REQ_STATS_PORT_IN] =
68                 pipeline_msg_req_stats_port_in_handler,
69         [PIPELINE_MSG_REQ_STATS_PORT_OUT] =
70                 pipeline_msg_req_stats_port_out_handler,
71         [PIPELINE_MSG_REQ_STATS_TABLE] =
72                 pipeline_msg_req_stats_table_handler,
73         [PIPELINE_MSG_REQ_PORT_IN_ENABLE] =
74                 pipeline_msg_req_port_in_enable_handler,
75         [PIPELINE_MSG_REQ_PORT_IN_DISABLE] =
76                 pipeline_msg_req_port_in_disable_handler,
77         [PIPELINE_MSG_REQ_CUSTOM] =
78                 pipeline_fc_msg_req_custom_handler,
79 };
80
81 static void *
82 pipeline_fc_msg_req_add_handler(struct pipeline *p, void *msg);
83
84 static void *
85 pipeline_fc_msg_req_add_bulk_handler(struct pipeline *p, void *msg);
86
87 static void *
88 pipeline_fc_msg_req_del_handler(struct pipeline *p, void *msg);
89
90 static void *
91 pipeline_fc_msg_req_add_default_handler(struct pipeline *p, void *msg);
92
93 static void *
94 pipeline_fc_msg_req_del_default_handler(struct pipeline *p, void *msg);
95
96 static pipeline_msg_req_handler custom_handlers[] = {
97         [PIPELINE_FC_MSG_REQ_FLOW_ADD] =
98                 pipeline_fc_msg_req_add_handler,
99         [PIPELINE_FC_MSG_REQ_FLOW_ADD_BULK] =
100                 pipeline_fc_msg_req_add_bulk_handler,
101         [PIPELINE_FC_MSG_REQ_FLOW_DEL] =
102                 pipeline_fc_msg_req_del_handler,
103         [PIPELINE_FC_MSG_REQ_FLOW_ADD_DEFAULT] =
104                 pipeline_fc_msg_req_add_default_handler,
105         [PIPELINE_FC_MSG_REQ_FLOW_DEL_DEFAULT] =
106                 pipeline_fc_msg_req_del_default_handler,
107 };
108
109 /*
110  * Flow table
111  */
112 struct flow_table_entry {
113         struct rte_pipeline_table_entry head;
114
115         uint32_t flow_id;
116         uint32_t pad;
117 };
118
119 rte_table_hash_op_hash hash_func[] = {
120         hash_default_key8,
121         hash_default_key16,
122         hash_default_key24,
123         hash_default_key32,
124         hash_default_key40,
125         hash_default_key48,
126         hash_default_key56,
127         hash_default_key64
128 };
129
130 /*
131  * Flow table AH - Write flow_id to packet meta-data
132  */
133 static inline void
134 pkt_work_flow_id(
135         struct rte_mbuf *pkt,
136         struct rte_pipeline_table_entry *table_entry,
137         void *arg)
138 {
139         struct pipeline_flow_classification *p_fc = arg;
140         uint32_t *flow_id_ptr =
141                 RTE_MBUF_METADATA_UINT32_PTR(pkt, p_fc->flow_id_offset);
142         struct flow_table_entry *entry =
143                 (struct flow_table_entry *) table_entry;
144
145         /* Read */
146         uint32_t flow_id = entry->flow_id;
147
148         /* Compute */
149
150         /* Write */
151         *flow_id_ptr = flow_id;
152 }
153
154 static inline void
155 pkt4_work_flow_id(
156         struct rte_mbuf **pkts,
157         struct rte_pipeline_table_entry **table_entries,
158         void *arg)
159 {
160         struct pipeline_flow_classification *p_fc = arg;
161
162         uint32_t *flow_id_ptr0 =
163                 RTE_MBUF_METADATA_UINT32_PTR(pkts[0], p_fc->flow_id_offset);
164         uint32_t *flow_id_ptr1 =
165                 RTE_MBUF_METADATA_UINT32_PTR(pkts[1], p_fc->flow_id_offset);
166         uint32_t *flow_id_ptr2 =
167                 RTE_MBUF_METADATA_UINT32_PTR(pkts[2], p_fc->flow_id_offset);
168         uint32_t *flow_id_ptr3 =
169                 RTE_MBUF_METADATA_UINT32_PTR(pkts[3], p_fc->flow_id_offset);
170
171         struct flow_table_entry *entry0 =
172                 (struct flow_table_entry *) table_entries[0];
173         struct flow_table_entry *entry1 =
174                 (struct flow_table_entry *) table_entries[1];
175         struct flow_table_entry *entry2 =
176                 (struct flow_table_entry *) table_entries[2];
177         struct flow_table_entry *entry3 =
178                 (struct flow_table_entry *) table_entries[3];
179
180         /* Read */
181         uint32_t flow_id0 = entry0->flow_id;
182         uint32_t flow_id1 = entry1->flow_id;
183         uint32_t flow_id2 = entry2->flow_id;
184         uint32_t flow_id3 = entry3->flow_id;
185
186         /* Compute */
187
188         /* Write */
189         *flow_id_ptr0 = flow_id0;
190         *flow_id_ptr1 = flow_id1;
191         *flow_id_ptr2 = flow_id2;
192         *flow_id_ptr3 = flow_id3;
193 }
194
195 PIPELINE_TABLE_AH_HIT(fc_table_ah_hit,
196                 pkt_work_flow_id, pkt4_work_flow_id);
197
198 static rte_pipeline_table_action_handler_hit
199 get_fc_table_ah_hit(struct pipeline_flow_classification *p)
200 {
201         if (p->flow_id)
202                 return fc_table_ah_hit;
203
204         return NULL;
205 }
206
207 /*
208  * Argument parsing
209  */
210 static int
211 pipeline_fc_parse_args(struct pipeline_flow_classification *p,
212         struct pipeline_params *params)
213 {
214         uint32_t n_flows_present = 0;
215         uint32_t key_offset_present = 0;
216         uint32_t key_size_present = 0;
217         uint32_t hash_offset_present = 0;
218         uint32_t key_mask_present = 0;
219         uint32_t flow_id_offset_present = 0;
220
221         uint32_t i;
222         char *key_mask_str = NULL;
223
224         p->hash_offset = 0;
225
226         /* default values */
227         p->flow_id = 0;
228
229         for (i = 0; i < params->n_args; i++) {
230                 char *arg_name = params->args_name[i];
231                 char *arg_value = params->args_value[i];
232
233                 /* n_flows */
234                 if (strcmp(arg_name, "n_flows") == 0) {
235                         if (n_flows_present)
236                                 goto error_parse;
237                         n_flows_present = 1;
238
239                         p->n_flows = atoi(arg_value);
240                         if (p->n_flows == 0)
241                                 goto error_parse;
242
243                         continue;
244                 }
245
246                 /* key_offset */
247                 if (strcmp(arg_name, "key_offset") == 0) {
248                         if (key_offset_present)
249                                 goto error_parse;
250
251                         key_offset_present = 1;
252
253                         p->key_offset = atoi(arg_value);
254
255                         continue;
256                 }
257
258                 /* key_size */
259                 if (strcmp(arg_name, "key_size") == 0) {
260                         if (key_size_present)
261                                 goto error_parse;
262                         key_size_present = 1;
263
264                         p->key_size = atoi(arg_value);
265                         if ((p->key_size == 0) ||
266                                 (p->key_size > PIPELINE_FC_FLOW_KEY_MAX_SIZE) ||
267                                 (p->key_size % 8))
268                                 goto error_parse;
269
270                         continue;
271                 }
272
273                 /* key_mask */
274                 if (strcmp(arg_name, "key_mask") == 0) {
275                         if (key_mask_present)
276                                 goto error_parse;
277
278                         key_mask_str = strdup(arg_value);
279                         if (key_mask_str == NULL)
280                                 goto error_parse;
281
282                         key_mask_present = 1;
283
284                         continue;
285                 }
286
287                 /* hash_offset */
288                 if (strcmp(arg_name, "hash_offset") == 0) {
289                         if (hash_offset_present)
290                                 goto error_parse;
291                         hash_offset_present = 1;
292
293                         p->hash_offset = atoi(arg_value);
294
295                         continue;
296                 }
297
298                 /* flow_id_offset */
299                 if (strcmp(arg_name, "flowid_offset") == 0) {
300                         if (flow_id_offset_present)
301                                 goto error_parse;
302                         flow_id_offset_present = 1;
303
304                         p->flow_id = 1;
305                         p->flow_id_offset = atoi(arg_value);
306
307                         continue;
308                 }
309
310                 /* Unknown argument */
311                 goto error_parse;
312         }
313
314         /* Check that mandatory arguments are present */
315         if ((n_flows_present == 0) ||
316                 (key_offset_present == 0) ||
317                 (key_size_present == 0))
318                 goto error_parse;
319
320         if (key_mask_present) {
321                 p->key_mask = rte_malloc(NULL, p->key_size, 0);
322                 if (p->key_mask == NULL)
323                         goto error_parse;
324
325                 if (parse_hex_string(key_mask_str, p->key_mask, &p->key_size)
326                         != 0) {
327                         goto error_parse;
328                 }
329
330                 free(key_mask_str);
331         }
332
333         return 0;
334
335 error_parse:
336         if (key_mask_str != NULL)
337                 free(key_mask_str);
338         if (p->key_mask != NULL)
339                 free(p->key_mask);
340         return -1;
341 }
342
343 static void *pipeline_fc_init(struct pipeline_params *params,
344         __rte_unused void *arg)
345 {
346         struct pipeline *p;
347         struct pipeline_flow_classification *p_fc;
348         uint32_t size, i;
349
350         /* Check input arguments */
351         if (params == NULL)
352                 return NULL;
353
354         /* Memory allocation */
355         size = RTE_CACHE_LINE_ROUNDUP(
356                 sizeof(struct pipeline_flow_classification));
357         p = rte_zmalloc(NULL, size, RTE_CACHE_LINE_SIZE);
358         if (p == NULL)
359                 return NULL;
360         p_fc = (struct pipeline_flow_classification *) p;
361
362         strcpy(p->name, params->name);
363         p->log_level = params->log_level;
364
365         PLOG(p, HIGH, "Flow classification");
366
367         /* Parse arguments */
368         if (pipeline_fc_parse_args(p_fc, params))
369                 return NULL;
370
371         /* Pipeline */
372         {
373                 struct rte_pipeline_params pipeline_params = {
374                         .name = params->name,
375                         .socket_id = params->socket_id,
376                         .offset_port_id = 0,
377                 };
378
379                 p->p = rte_pipeline_create(&pipeline_params);
380                 if (p->p == NULL) {
381                         rte_free(p);
382                         return NULL;
383                 }
384         }
385
386         /* Input ports */
387         p->n_ports_in = params->n_ports_in;
388         for (i = 0; i < p->n_ports_in; i++) {
389                 struct rte_pipeline_port_in_params port_params = {
390                         .ops = pipeline_port_in_params_get_ops(
391                                 &params->port_in[i]),
392                         .arg_create = pipeline_port_in_params_convert(
393                                 &params->port_in[i]),
394                         .f_action = NULL,
395                         .arg_ah = NULL,
396                         .burst_size = params->port_in[i].burst_size,
397                 };
398
399                 int status = rte_pipeline_port_in_create(p->p,
400                         &port_params,
401                         &p->port_in_id[i]);
402
403                 if (status) {
404                         rte_pipeline_free(p->p);
405                         rte_free(p);
406                         return NULL;
407                 }
408         }
409
410         /* Output ports */
411         p->n_ports_out = params->n_ports_out;
412         for (i = 0; i < p->n_ports_out; i++) {
413                 struct rte_pipeline_port_out_params port_params = {
414                         .ops = pipeline_port_out_params_get_ops(
415                                 &params->port_out[i]),
416                         .arg_create = pipeline_port_out_params_convert(
417                                 &params->port_out[i]),
418                         .f_action = NULL,
419                         .f_action_bulk = NULL,
420                         .arg_ah = NULL,
421                 };
422
423                 int status = rte_pipeline_port_out_create(p->p,
424                         &port_params,
425                         &p->port_out_id[i]);
426
427                 if (status) {
428                         rte_pipeline_free(p->p);
429                         rte_free(p);
430                         return NULL;
431                 }
432         }
433
434         /* Tables */
435         p->n_tables = 1;
436         {
437                 struct rte_table_hash_key8_ext_params
438                         table_hash_key8_params = {
439                         .n_entries = p_fc->n_flows,
440                         .n_entries_ext = p_fc->n_flows,
441                         .signature_offset = p_fc->hash_offset,
442                         .key_offset = p_fc->key_offset,
443                         .f_hash = hash_func[(p_fc->key_size / 8) - 1],
444                         .key_mask = p_fc->key_mask,
445                         .seed = 0,
446                 };
447
448                 struct rte_table_hash_key16_ext_params
449                         table_hash_key16_params = {
450                         .n_entries = p_fc->n_flows,
451                         .n_entries_ext = p_fc->n_flows,
452                         .signature_offset = p_fc->hash_offset,
453                         .key_offset = p_fc->key_offset,
454                         .f_hash = hash_func[(p_fc->key_size / 8) - 1],
455                         .key_mask = p_fc->key_mask,
456                         .seed = 0,
457                 };
458
459                 struct rte_table_hash_ext_params
460                         table_hash_params = {
461                         .key_size = p_fc->key_size,
462                         .n_keys = p_fc->n_flows,
463                         .n_buckets = p_fc->n_flows / 4,
464                         .n_buckets_ext = p_fc->n_flows / 4,
465                         .f_hash = hash_func[(p_fc->key_size / 8) - 1],
466                         .seed = 0,
467                         .signature_offset = p_fc->hash_offset,
468                         .key_offset = p_fc->key_offset,
469                 };
470
471                 struct rte_pipeline_table_params table_params = {
472                         .ops = NULL, /* set below */
473                         .arg_create = NULL, /* set below */
474                         .f_action_hit = get_fc_table_ah_hit(p_fc),
475                         .f_action_miss = NULL,
476                         .arg_ah = p_fc,
477                         .action_data_size = sizeof(struct flow_table_entry) -
478                                 sizeof(struct rte_pipeline_table_entry),
479                 };
480
481                 int status;
482
483                 switch (p_fc->key_size) {
484                 case 8:
485                         if (p_fc->hash_offset != 0) {
486                                 table_params.ops =
487                                         &rte_table_hash_key8_ext_ops;
488                         } else {
489                                 table_params.ops =
490                                         &rte_table_hash_key8_ext_dosig_ops;
491                         }
492                         table_params.arg_create = &table_hash_key8_params;
493                         break;
494
495                 case 16:
496                         if (p_fc->hash_offset != 0) {
497                                 table_params.ops =
498                                         &rte_table_hash_key16_ext_ops;
499                         } else {
500                                 table_params.ops =
501                                         &rte_table_hash_key16_ext_dosig_ops;
502                         }
503                         table_params.arg_create = &table_hash_key16_params;
504                         break;
505
506                 default:
507                         table_params.ops = &rte_table_hash_ext_ops;
508                         table_params.arg_create = &table_hash_params;
509                 }
510
511                 status = rte_pipeline_table_create(p->p,
512                         &table_params,
513                         &p->table_id[0]);
514
515                 if (status) {
516                         rte_pipeline_free(p->p);
517                         rte_free(p);
518                         return NULL;
519                 }
520         }
521
522         /* Connecting input ports to tables */
523         for (i = 0; i < p->n_ports_in; i++) {
524                 int status = rte_pipeline_port_in_connect_to_table(p->p,
525                         p->port_in_id[i],
526                         p->table_id[0]);
527
528                 if (status) {
529                         rte_pipeline_free(p->p);
530                         rte_free(p);
531                         return NULL;
532                 }
533         }
534
535         /* Enable input ports */
536         for (i = 0; i < p->n_ports_in; i++) {
537                 int status = rte_pipeline_port_in_enable(p->p,
538                         p->port_in_id[i]);
539
540                 if (status) {
541                         rte_pipeline_free(p->p);
542                         rte_free(p);
543                         return NULL;
544                 }
545         }
546
547         /* Check pipeline consistency */
548         if (rte_pipeline_check(p->p) < 0) {
549                 rte_pipeline_free(p->p);
550                 rte_free(p);
551                 return NULL;
552         }
553
554         /* Message queues */
555         p->n_msgq = params->n_msgq;
556         for (i = 0; i < p->n_msgq; i++)
557                 p->msgq_in[i] = params->msgq_in[i];
558         for (i = 0; i < p->n_msgq; i++)
559                 p->msgq_out[i] = params->msgq_out[i];
560
561         /* Message handlers */
562         memcpy(p->handlers, handlers, sizeof(p->handlers));
563         memcpy(p_fc->custom_handlers,
564                 custom_handlers,
565                 sizeof(p_fc->custom_handlers));
566
567         return p;
568 }
569
570 static int
571 pipeline_fc_free(void *pipeline)
572 {
573         struct pipeline *p = (struct pipeline *) pipeline;
574
575         /* Check input arguments */
576         if (p == NULL)
577                 return -1;
578
579         /* Free resources */
580         rte_pipeline_free(p->p);
581         rte_free(p);
582         return 0;
583 }
584
585 static int
586 pipeline_fc_track(void *pipeline,
587         __rte_unused uint32_t port_in,
588         uint32_t *port_out)
589 {
590         struct pipeline *p = (struct pipeline *) pipeline;
591
592         /* Check input arguments */
593         if ((p == NULL) ||
594                 (port_in >= p->n_ports_in) ||
595                 (port_out == NULL))
596                 return -1;
597
598         if (p->n_ports_in == 1) {
599                 *port_out = 0;
600                 return 0;
601         }
602
603         return -1;
604 }
605
606 static int
607 pipeline_fc_timer(void *pipeline)
608 {
609         struct pipeline *p = (struct pipeline *) pipeline;
610
611         pipeline_msg_req_handle(p);
612         rte_pipeline_flush(p->p);
613
614         return 0;
615 }
616
617 static void *
618 pipeline_fc_msg_req_custom_handler(struct pipeline *p, void *msg)
619 {
620         struct pipeline_flow_classification *p_fc =
621                         (struct pipeline_flow_classification *) p;
622         struct pipeline_custom_msg_req *req = msg;
623         pipeline_msg_req_handler f_handle;
624
625         f_handle = (req->subtype < PIPELINE_FC_MSG_REQS) ?
626                 p_fc->custom_handlers[req->subtype] :
627                 pipeline_msg_req_invalid_handler;
628
629         if (f_handle == NULL)
630                 f_handle = pipeline_msg_req_invalid_handler;
631
632         return f_handle(p, req);
633 }
634
635 static void *
636 pipeline_fc_msg_req_add_handler(struct pipeline *p, void *msg)
637 {
638         struct pipeline_fc_add_msg_req *req = msg;
639         struct pipeline_fc_add_msg_rsp *rsp = msg;
640
641         struct flow_table_entry entry = {
642                 .head = {
643                         .action = RTE_PIPELINE_ACTION_PORT,
644                         {.port_id = p->port_out_id[req->port_id]},
645                 },
646                 .flow_id = req->flow_id,
647         };
648
649         rsp->status = rte_pipeline_table_entry_add(p->p,
650                 p->table_id[0],
651                 &req->key,
652                 (struct rte_pipeline_table_entry *) &entry,
653                 &rsp->key_found,
654                 (struct rte_pipeline_table_entry **) &rsp->entry_ptr);
655
656         return rsp;
657 }
658
659 static void *
660 pipeline_fc_msg_req_add_bulk_handler(struct pipeline *p, void *msg)
661 {
662         struct pipeline_fc_add_bulk_msg_req *req = msg;
663         struct pipeline_fc_add_bulk_msg_rsp *rsp = msg;
664         uint32_t i;
665
666         for (i = 0; i < req->n_keys; i++) {
667                 struct pipeline_fc_add_bulk_flow_req *flow_req = &req->req[i];
668                 struct pipeline_fc_add_bulk_flow_rsp *flow_rsp = &req->rsp[i];
669
670                 struct flow_table_entry entry = {
671                         .head = {
672                                 .action = RTE_PIPELINE_ACTION_PORT,
673                                 {.port_id = p->port_out_id[flow_req->port_id]},
674                         },
675                         .flow_id = flow_req->flow_id,
676                 };
677
678                 int status = rte_pipeline_table_entry_add(p->p,
679                         p->table_id[0],
680                         &flow_req->key,
681                         (struct rte_pipeline_table_entry *) &entry,
682                         &flow_rsp->key_found,
683                         (struct rte_pipeline_table_entry **)
684                                 &flow_rsp->entry_ptr);
685
686                 if (status)
687                         break;
688         }
689
690         rsp->n_keys = i;
691
692         return rsp;
693 }
694
695 static void *
696 pipeline_fc_msg_req_del_handler(struct pipeline *p, void *msg)
697 {
698         struct pipeline_fc_del_msg_req *req = msg;
699         struct pipeline_fc_del_msg_rsp *rsp = msg;
700
701         rsp->status = rte_pipeline_table_entry_delete(p->p,
702                 p->table_id[0],
703                 &req->key,
704                 &rsp->key_found,
705                 NULL);
706
707         return rsp;
708 }
709
710 static void *
711 pipeline_fc_msg_req_add_default_handler(struct pipeline *p, void *msg)
712 {
713         struct pipeline_fc_add_default_msg_req *req = msg;
714         struct pipeline_fc_add_default_msg_rsp *rsp = msg;
715
716         struct flow_table_entry default_entry = {
717                 .head = {
718                         .action = RTE_PIPELINE_ACTION_PORT,
719                         {.port_id = p->port_out_id[req->port_id]},
720                 },
721
722                 .flow_id = 0,
723         };
724
725         rsp->status = rte_pipeline_table_default_entry_add(p->p,
726                 p->table_id[0],
727                 (struct rte_pipeline_table_entry *) &default_entry,
728                 (struct rte_pipeline_table_entry **) &rsp->entry_ptr);
729
730         return rsp;
731 }
732
733 static void *
734 pipeline_fc_msg_req_del_default_handler(struct pipeline *p, void *msg)
735 {
736         struct pipeline_fc_del_default_msg_rsp *rsp = msg;
737
738         rsp->status = rte_pipeline_table_default_entry_delete(p->p,
739                 p->table_id[0],
740                 NULL);
741
742         return rsp;
743 }
744
745 struct pipeline_be_ops pipeline_flow_classification_be_ops = {
746         .f_init = pipeline_fc_init,
747         .f_free = pipeline_fc_free,
748         .f_run = NULL,
749         .f_timer = pipeline_fc_timer,
750         .f_track = pipeline_fc_track,
751 };