Skip to contentSkip to conversation

ip_pipeline: add load balancing function to pass-through pipeline

PATCH Superseded Jasvinder Singh 2 participants 5 messages Jan 27, 2016 – Mar 13, 2016

lore
Share & tools
lore
#0 lore raw

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 = 0
pktq_in = RXQ0.0 RXQ1.0 RXQ2.0 RXQ3.0
pktq_out = TXQ0.0 TXQ1.0 TXQ2.0 TXQ3.0
dma_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 = 16
dma_src_mask = 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF
dma_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
index 9958758..2c08db2 100644
@@ -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
index 03756a1..5c8fa8d 100644
@@ -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
#1 lore raw

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 = 0
pktq_in = RXQ0.0 RXQ1.0 RXQ2.0 RXQ3.0
pktq_out = TXQ0.0 TXQ1.0 TXQ2.0 TXQ3.0
dma_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 = 16
dma_src_mask = 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF
dma_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
index 9958758..ab08612 100644
@@ -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
index 03756a1..9368cec 100644
@@ -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
#2 lore raw

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

#3 lore raw

PATCH v3 1/1 ip_pipeline: add load balancing function to pass-through pipeline

In reply to Jasvinder Singh

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 = 0
pktq_in = RXQ0.0 RXQ1.0 RXQ2.0 RXQ3.0
pktq_out = TXQ0.0 TXQ1.0 TXQ2.0 TXQ3.0
dma_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 = 16
dma_src_mask = 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF
dma_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
index 9958758..ab08612 100644
@@ -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
index 03756a1..9368cec 100644
@@ -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
#4 lore raw

2016-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