ip_pipeline: add load balancing function to pass-through pipeline
PATCH 1/1 ip_pipeline: add load balancing function to pass-through pipeline
The passthrough pipeline implementation is extended with load balancing function. This function allows uniform distribution of the packets among its output ports. For packets distribution, any application level logic can be applied. For instance, in this implementation, hash value computed over specific header fields of the incoming packets has been used to spread traffic uniformly among the output ports. The following passthrough configuration can be used for implementing load balancing function over ipv4 traffic;
[PIPELINE0]
type = PASS-THROUGH
core = 0pktq_in = RXQ0.0 RXQ1.0 RXQ2.0 RXQ3.0pktq_out = TXQ0.0 TXQ1.0 TXQ2.0 TXQ3.0dma_src_offset = 278; mbuf (128) + headroom (128) + 1st ethertype offset (14) + ttl offset within ip header = 278 (ipv4) dma_dst_offset = 128; mbuf (128)dma_size = 16dma_src_mask = 00FF0000FFFFFFFFFFFFFFFFFFFFFFFFdma_hash_offset = 144; (dma_dst_offset+dma_size)
lb = hash
--- .../ip_pipeline/pipeline/pipeline_actions_common.h | 22 ++ .../ip_pipeline/pipeline/pipeline_passthrough_be.c | 281 ++++++++++++++++----- .../ip_pipeline/pipeline/pipeline_passthrough_be.h | 2 + 3 files changed, 245 insertions(+), 60 deletions(-)
examples/ip_pipeline/pipeline/pipeline_actions_common.h +22 -0
@@ -59,6 +59,28 @@ f_ah( \return 0 ; \ } +#define PIPELINE_PORT_IN_AH_LB (f_ah, f_pkt_work, f_pkt4_work) \ +static int \ +f_ah( \ + struct rte_pipeline *p, \ + struct rte_mbuf **pkts, \ + uint32_t n_pkts, \ + void *arg) \ +{ \ + uint32_t i; \ + \ + uint64_t pkt_mask = RTE_LEN2MASK(n_pkts, uint64_t); \ + \ + rte_pipeline_ah_packet_hijack(p, pkt_mask); \ + for (i = 0; i < (n_pkts & (~0x3LLU)); i += 4) \ + f_pkt4_work(&pkts[i], arg); \ + \ + for ( ; i < n_pkts; i++) \ + f_pkt_work(pkts[i], arg); \ + \ + return 0; \ +} +#define PIPELINE_TABLE_AH_HIT (f_ah, f_pkt_work, f_pkt4_work) \ static int \ f_ah( \
examples/ip_pipeline/pipeline/pipeline_passthrough_be.c +221 -60
362 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_passthrough_be.h +2 -0
@@ -47,6 +47,8 @@ struct pipeline_passthrough_params {uint32_t dma_hash_enabled;uint32_t dma_hash_offset; +uint32_t lb_hash_enabled; +uint32_t n_ports_out_pow_of_2; };int
Signature · 1 line
2.5.0
PATCH v2 1/1 ip_pipeline: add load balancing function to pass-through pipeline
The pass-through pipeline implementation is extended with load balancing function. This function allows uniform distribution of the packets among its output ports. For packets distribution, any application level logic can be applied. For instance, in this implementation, hash value computed over specific header fields of the incoming packets has been used to spread traffic uniformly among the output ports. The following pass-through configuration can be used for implementing load balancing function over ipv4 traffic;
[PIPELINE0]
type = PASS-THROUGH
core = 0pktq_in = RXQ0.0 RXQ1.0 RXQ2.0 RXQ3.0pktq_out = TXQ0.0 TXQ1.0 TXQ2.0 TXQ3.0dma_src_offset = 278; mbuf (128) + headroom (128) + 1st ethertype offset (14) + ttl offset within ip header = 278 (ipv4) dma_dst_offset = 128; mbuf (128)dma_size = 16dma_src_mask = 00FF0000FFFFFFFFFFFFFFFFFFFFFFFFdma_hash_offset = 144; (dma_dst_offset+dma_size)
lb = hash
---
v2
* modify the action handler implementation
.../ip_pipeline/pipeline/pipeline_actions_common.h | 22 ++ .../ip_pipeline/pipeline/pipeline_passthrough_be.c | 279 ++++++++++++++++----- .../ip_pipeline/pipeline/pipeline_passthrough_be.h | 1 + 3 files changed, 236 insertions(+), 66 deletions(-)
examples/ip_pipeline/pipeline/pipeline_actions_common.h +22 -0
@@ -59,6 +59,28 @@ f_ah( \return 0 ; \ } +#define PIPELINE_PORT_IN_AH_HIJACK_ALL (f_ah, f_pkt_work, f_pkt4_work) \ +static int \ +f_ah( \ + struct rte_pipeline *p, \ + struct rte_mbuf **pkts, \ + uint32_t n_pkts, \ + void *arg) \ +{ \ + uint64_t pkt_mask = RTE_LEN2MASK(n_pkts, uint64_t); \ + uint32_t i; \ + \ + rte_pipeline_ah_packet_hijack(p, pkt_mask); \ + \ + for (i = 0; i < (n_pkts & (~0x3LLU)); i += 4) \ + f_pkt4_work(&pkts[i], arg); \ + \ + for ( ; i < n_pkts; i++) \ + f_pkt_work(pkts[i], arg); \ + \ + return 0; \ +} +#define PIPELINE_TABLE_AH_HIT (f_ah, f_pkt_work, f_pkt4_work) \ static int \ f_ah( \
examples/ip_pipeline/pipeline/pipeline_passthrough_be.c +213 -66
370 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_passthrough_be.h +1 -0
@@ -47,6 +47,7 @@ struct pipeline_passthrough_params {uint32_t dma_hash_enabled;uint32_t dma_hash_offset; +uint32_t lb_hash_enabled; };int
Signature · 1 line
2.5.0
2016-02-04 17:16, Jasvinder Singh:
Quoted 8 lines
The pass-through pipeline implementation is extended with load balancing function. This function allows uniform distribution of the packets among its output ports. For packets distribution, any application level logic can be applied. For instance, in this implementation, hash value computed over specific header fields of the incoming packets has been used to spread traffic uniformly among the output ports. The following pass-through configuration can be used for implementing load balancing function over ipv4 traffic;
Please rebase, thanks
PATCH v3 1/1 ip_pipeline: add load balancing function to pass-through pipeline
In reply to Jasvinder SinghThe pass-through pipeline implementation is extended with load balancing function. This function allows uniform distribution of the packets among its output ports. For packets distribution, any application level logic can be applied. For instance, in this implementation, hash value computed over specific header fields of the incoming packets has been used to spread traffic uniformly among the output ports.
The following pass-through configuration can be used for implementing load balancing function over ipv4 traffic;
[PIPELINE0]
type = PASS-THROUGH
core = 0pktq_in = RXQ0.0 RXQ1.0 RXQ2.0 RXQ3.0pktq_out = TXQ0.0 TXQ1.0 TXQ2.0 TXQ3.0dma_src_offset = 278; mbuf (128) + headroom (128) + 1st ethertype offset (14) + ttl offset within ip header = 278 (ipv4) dma_dst_offset = 128; mbuf (128)dma_size = 16dma_src_mask = 00FF0000FFFFFFFFFFFFFFFFFFFFFFFFdma_hash_offset = 144; (dma_dst_offset+dma_size)
lb = hash
---
v3
* rebased on master
v2
* modify the action handler implementation
.../ip_pipeline/pipeline/pipeline_actions_common.h | 22 ++ .../ip_pipeline/pipeline/pipeline_passthrough_be.c | 275 ++++++++++++++++----- .../ip_pipeline/pipeline/pipeline_passthrough_be.h | 1 + 3 files changed, 236 insertions(+), 62 deletions(-)
examples/ip_pipeline/pipeline/pipeline_actions_common.h +22 -0
@@ -59,6 +59,28 @@ f_ah( \return 0 ; \ } +#define PIPELINE_PORT_IN_AH_HIJACK_ALL (f_ah, f_pkt_work, f_pkt4_work) \ +static int \ +f_ah( \ + struct rte_pipeline *p, \ + struct rte_mbuf **pkts, \ + uint32_t n_pkts, \ + void *arg) \ +{ \ + uint64_t pkt_mask = RTE_LEN2MASK(n_pkts, uint64_t); \ + uint32_t i; \ + \ + rte_pipeline_ah_packet_hijack(p, pkt_mask); \ + \ + for (i = 0; i < (n_pkts & (~0x3LLU)); i += 4) \ + f_pkt4_work(&pkts[i], arg); \ + \ + for ( ; i < n_pkts; i++) \ + f_pkt_work(pkts[i], arg); \ + \ + return 0; \ +} +#define PIPELINE_TABLE_AH_HIT (f_ah, f_pkt_work, f_pkt4_work) \ static int \ f_ah( \
examples/ip_pipeline/pipeline/pipeline_passthrough_be.c +213 -62
366 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_passthrough_be.h +1 -0
@@ -47,6 +47,7 @@ struct pipeline_passthrough_params {uint32_t dma_hash_enabled;uint32_t dma_hash_offset; +uint32_t lb_hash_enabled; };int
Signature · 1 line
2.5.0
Thomas Monjalon
Applied2016-03-10 15:29, Jasvinder Singh:
Quoted 6 lines
The pass-through pipeline implementation is extended with load balancing function. This function allows uniform distribution of the packets among its output ports. For packets distribution, any application level logic can be applied. For instance, in this implementation, hash value computed over specific header fields of the incoming packets has been used to spread traffic uniformly among the output ports.
Applied, thanks