[dpdk-dev] [PATCH v3] ip_pipeline: add rss support

2016-06-08 Thread Thomas Monjalon
2016-05-30 18:14, Jasvinder Singh:
> This patch enables rss (receive side scaling) per network interface
> through the configuration file. The user can specify following
> parameters in LINK section for enabling the rss feature - rss_qs,
> rss_proto_ipv4, rss_proto_ipv6 and ip_proto_l2.
> 
> The "rss_qs" is mandatory parameter which indicates the queues to be
> used for rss, while rest of the parameters are optional. When optional
> parameters are not provided in the configuration file, default setting
> (ETH_RSS_IPV4 | ETH_RSS_IPV6) is assumed for "rss_hf" field of the
> rss_conf structure.
> 
> For example, following configuration can be applied for using the rss
> on port 0 of the network interface;
> 
> [PIPELINE0]
> type = MASTER
> core = 0
> 
> [LINK0]
> rss_qs = 0 1
> 
> [PIPELINE1]
> type = PASS-THROUGH
> core = 1
> pktq_in = RXQ0.0 RXQ0.1 RXQ1.0
> pktq_out = TXQ0.0 TXQ1.0 TXQ0.1
> 
> Signed-off-by: Jasvinder Singh 
> Acked-by: Cristian Dumitrescu 

Applied, thanks


[dpdk-dev] [PATCH v3] ip_pipeline: add rss support

2016-05-30 Thread Jasvinder Singh
This patch enables rss (receive side scaling) per network interface
through the configuration file. The user can specify following
parameters in LINK section for enabling the rss feature - rss_qs,
rss_proto_ipv4, rss_proto_ipv6 and ip_proto_l2.

The "rss_qs" is mandatory parameter which indicates the queues to be
used for rss, while rest of the parameters are optional. When optional
parameters are not provided in the configuration file, default setting
(ETH_RSS_IPV4 | ETH_RSS_IPV6) is assumed for "rss_hf" field of the
rss_conf structure.

For example, following configuration can be applied for using the rss
on port 0 of the network interface;

[PIPELINE0]
type = MASTER
core = 0

[LINK0]
rss_qs = 0 1

[PIPELINE1]
type = PASS-THROUGH
core = 1
pktq_in = RXQ0.0 RXQ0.1 RXQ1.0
pktq_out = TXQ0.0 TXQ1.0 TXQ0.1

Signed-off-by: Jasvinder Singh 
Acked-by: Cristian Dumitrescu 
---
v3
- rebase on top of ip_pipeline configuration file clean up patch
  (http://dpdk.org/dev/patchwork/patch/13106/)
v2
- add check on the number of rss queues entries

 examples/ip_pipeline/app.h  |  27 ++--
 examples/ip_pipeline/config_check.c |  32 +++-
 examples/ip_pipeline/config_parse.c | 299 +++-
 examples/ip_pipeline/init.c |  70 -
 4 files changed, 408 insertions(+), 20 deletions(-)

diff --git a/examples/ip_pipeline/app.h b/examples/ip_pipeline/app.h
index 05d608b..976fbd0 100644
--- a/examples/ip_pipeline/app.h
+++ b/examples/ip_pipeline/app.h
@@ -51,6 +51,14 @@
 #define APP_PARAM_NAME_SIZE  PIPELINE_NAME_SIZE
 #define APP_LINK_PCI_BDF_SIZE16

+#ifndef APP_LINK_MAX_HWQ_IN
+#define APP_LINK_MAX_HWQ_IN  64
+#endif
+
+#ifndef APP_LINK_MAX_HWQ_OUT
+#define APP_LINK_MAX_HWQ_OUT 64
+#endif
+
 struct app_mempool_params {
char *name;
uint32_t parsed;
@@ -70,6 +78,12 @@ struct app_link_params {
uint32_t tcp_local_q; /* 0 = Disabled (pkts go to default queue 0) */
uint32_t udp_local_q; /* 0 = Disabled (pkts go to default queue 0) */
uint32_t sctp_local_q; /* 0 = Disabled (pkts go to default queue 0) */
+   uint32_t rss_qs[APP_LINK_MAX_HWQ_IN];
+   uint32_t n_rss_qs;
+   uint64_t rss_proto_ipv4;
+   uint64_t rss_proto_ipv6;
+   uint64_t rss_proto_l2;
+   uint32_t promisc;
uint32_t state; /* DOWN = 0, UP = 1 */
uint32_t ip; /* 0 = Invalid */
uint32_t depth; /* Valid only when IP is valid */
@@ -77,7 +91,6 @@ struct app_link_params {
char pci_bdf[APP_LINK_PCI_BDF_SIZE];

struct rte_eth_conf conf;
-   uint8_t promisc;
 };

 struct app_pktq_hwq_in_params {
@@ -383,17 +396,9 @@ struct app_eal_params {
 #define APP_MAX_MEMPOOLS 8
 #endif

-#ifndef APP_LINK_MAX_HWQ_IN
-#define APP_LINK_MAX_HWQ_IN  64
-#endif
-
-#ifndef APP_LINK_MAX_HWQ_OUT
-#define APP_LINK_MAX_HWQ_OUT 64
-#endif
-
-#define APP_MAX_HWQ_IN (APP_MAX_LINKS * 
APP_LINK_MAX_HWQ_IN)
+#define APP_MAX_HWQ_IN  (APP_MAX_LINKS * APP_LINK_MAX_HWQ_IN)

-#define APP_MAX_HWQ_OUT   (APP_MAX_LINKS * 
APP_LINK_MAX_HWQ_OUT)
+#define APP_MAX_HWQ_OUT (APP_MAX_LINKS * APP_LINK_MAX_HWQ_OUT)

 #ifndef APP_MAX_PKTQ_SWQ
 #define APP_MAX_PKTQ_SWQ 256
diff --git a/examples/ip_pipeline/config_check.c 
b/examples/ip_pipeline/config_check.c
index fd9ff49..18f57be 100644
--- a/examples/ip_pipeline/config_check.c
+++ b/examples/ip_pipeline/config_check.c
@@ -56,6 +56,26 @@ check_mempools(struct app_params *app)
}
 }

+static inline uint32_t
+link_rxq_used(struct app_link_params *link, uint32_t q_id)
+{
+   uint32_t i;
+
+   if ((link->arp_q == q_id) ||
+   (link->tcp_syn_q == q_id) ||
+   (link->ip_local_q == q_id) ||
+   (link->tcp_local_q == q_id) ||
+   (link->udp_local_q == q_id) ||
+   (link->sctp_local_q == q_id))
+   return 1;
+
+   for (i = 0; i < link->n_rss_qs; i++)
+   if (link->rss_qs[i] == q_id)
+   return 1;
+
+   return 0;
+}
+
 static void
 check_links(struct app_params *app)
 {
@@ -90,14 +110,12 @@ check_links(struct app_params *app)
rxq_max = link->udp_local_q;
if (link->sctp_local_q > rxq_max)
rxq_max = link->sctp_local_q;
+   for (i = 0; i < link->n_rss_qs; i++)
+   if (link->rss_qs[i] > rxq_max)
+   rxq_max = link->rss_qs[i];

for (i = 1; i <= rxq_max; i++)
-   APP_CHECK(((link->arp_q == i) ||
-   (link->tcp_syn_q == i) ||
-   (link->ip_local_q == i) ||
-   (link->tcp_local_q == i) ||
-   (link->udp_local_q ==