ip_pipeline: modify action handler in passthrough pipeline
PATCH 1/1 ip_pipeline: modify action handler in passthrough pipeline
This patch implements a generic approach to extract fields from the packet's header and copying them to packet metadata. The fields are selected at the desired offset on the basis of the mask specified in application configuration file. The extracted fields, for instance, can be used to compute hash for the lookup table. This feature exposes more flexibility to the users as they will be able to employ new protocol headers and specify the required fields to be extracted.
The above feature has been implemented as port_in action handler of the passthrough pipeline. The example of the configuration file for passthrough pipeline is as below;
[PIPELINE1]
type = PASS-THROUGH
core = 1pktq_in = RXQ0.0 RXQ1.0 RXQ2.0 RXQ3.0 pktq_out = TXQ0.0 TXQ1.0 TXQ2.0 TXQ3.0 dma_size = 16dma_dst_offset = 64dma_src_offset = 150dma_src_mask = 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF dma_hash_offset = 80
--- examples/ip_pipeline/config_parse.c | 52 ++ .../ip_pipeline/pipeline/pipeline_passthrough_be.c | 660 ++++++++------------- .../ip_pipeline/pipeline/pipeline_passthrough_be.h | 17 + examples/ip_pipeline/pipeline_be.h | 3 + 4 files changed, 319 insertions(+), 413 deletions(-)
examples/ip_pipeline/config_parse.c +52 -0
@@ -362,6 +362,58 @@ parser_read_uint32(uint32_t *value, const char *p)return 0 ; } +static uint32_t +get_hex_val (char c) +{ +switch (c) { +case '0' :case '1' :case '2' :case '3' :case '4' :case '5' : +case '6' :case '7' :case '8' :case '9' : +return c -'0' ; +case 'A' :case 'B' :case 'C' :case 'D' :case 'E' :case 'F' : +return c -'A' +10 ; +case 'a' :case 'b' :case 'c' :case 'd' :case 'e' :case 'f' : +return c -'a' +10 ; +default : +return 0 ; + } +} + +int +parse_hex_string (char *src,uint8_t *dst,uint32_t *size) +{ +char *c; +uint32_t len, i; + +/* Check input parameters */ +if ((src ==NULL ) || + (dst ==NULL ) || + (size ==NULL ) || + (*size ==0 )) +return -1 ; + + len =strlen (src); +if (((len &3 ) !=0 ) || + (len > (*size) *2 )) +return -1 ; + *size = len /2 ; + +for (c = src; *c !=0 ; c++) { +if ((((*c) >='0' ) && ((*c) <='9' )) || + (((*c) >='A' ) && ((*c) <='F' )) || + (((*c) >='a' ) && ((*c) <='f' ))) +continue ; + +return -1 ; + } + +/* Convert chars to bytes */ +for (i =0 ; i < *size; i++) + dst[i] =get_hex_val (src[2 * i]) *16 + +get_hex_val (src[2 * i +1 ]); + +return 0 ; +} + static int parse_pipeline_core(uint32_t *socket, uint32_t *core,
examples/ip_pipeline/pipeline/pipeline_passthrough_be.c +247 -413
746 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_passthrough_be.h +17 -0
@@ -36,6 +36,23 @@#include "pipeline_common_be.h" +#define PIPELINE_PASSTHROUGH_DMA_SIZE_MAX 64 + +struct pipeline_passthrough_params { +uint32_t dma_enabled; +uint32_t dma_dst_offset; +uint32_t dma_src_offset; +uint8_t dma_src_mask[PIPELINE_PASSTHROUGH_DMA_SIZE_MAX ]; +uint32_t dma_size; + +uint32_t dma_hash_enabled; +uint32_t dma_hash_offset; +}; + +int +pipeline_passthrough_parse_args (struct pipeline_passthrough_params *p, +struct pipeline_params *params); +extern struct pipeline_be_ops pipeline_passthrough_be_ops;#endif
examples/ip_pipeline/pipeline_be.h +3 -0
@@ -253,4 +253,7 @@ struct pipeline_be_ops { pipeline_be_op_track f_track; }; +int +parse_hex_string (char *src,uint8_t *dst,uint32_t *size); +#endif
Signature · 1 line
2.1.0
Quoted 10 lines
-----Original Message-----
From: Singh, Jasvinder
Sent: Saturday, October 3, 2015 12:20 PM
To: [email protected]
Cc: Dumitrescu, Cristian
Subject: [PATCH]ip_pipeline: modify action handler in passthrough pipeline
Quoted 2 lines
Signed-off-by Jasvinder Singh <[email protected]>---
Thomas Monjalon
AppliedQuoted 3 lines
Quoted 1 line
Signed-off-by Jasvinder Singh <[email protected]>
Applied, thanks