Skip to contentSkip to conversation

examples/ip_pipeline: add link identification feature

PATCH Applied Fan Zhang 2 participants 2 messages Mar 1, 2016 – Mar 7, 2016

lore
Share & tools
lore

Fan Zhang

author
#0 lore raw

PATCH v2 1/1 examples/ip_pipeline: add link identification feature

This patch adds link identification feature to packet framework. To identify a link, user can use both existing port-mask option, or specify PCI device in every LINK section in the configuration file.

---
*v2
To be applied on top of:
[dpdk-dev,v2] examples/ip_pipeline: config parser clean-up
(http://dpdk.org/dev/patchwork/patch/10569/)

 examples/ip_pipeline/app.h                         |  19 +--
 examples/ip_pipeline/config_check.c                |  16 ++-
 examples/ip_pipeline/config_parse.c                | 155 +++++++++++++++++----
 examples/ip_pipeline/init.c                        |  95 ++++++++++---
 examples/ip_pipeline/pipeline/pipeline_common_fe.c |  12 +-
 5 files changed, 231 insertions(+), 66 deletions(-)
examples/ip_pipeline/app.h +10 -9
index 6510d6d..f749a5f 100644
@@ -49,7 +49,7 @@
 #include "pipeline.h"
 
 #define APP_PARAM_NAME_SIZE                      PIPELINE_NAME_SIZE
-
+#define APP_LINK_PCI_BDF_SIZE                    16
 struct app_mempool_params {
 	char *name;
 	uint32_t parsed;
@@ -64,7 +64,7 @@ struct app_link_params {
 	uint32_t parsed;
 	uint32_t pmd_id; /* Generated based on port mask */
 	uint32_t arp_q; /* 0 = Disabled (packets go to default queue 0) */
-	uint32_t tcp_syn_local_q; /* 0 = Disabled (pkts go to default queue) */
+	uint32_t tcp_syn_q; /* 0 = Disabled (pkts go to default queue) */
 	uint32_t ip_local_q; /* 0 = Disabled (pkts go to default queue 0) */
 	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) */
@@ -73,6 +73,7 @@ struct app_link_params {
 	uint32_t ip; /* 0 = Invalid */
 	uint32_t depth; /* Valid only when IP is valid */
 	uint64_t mac_addr; /* Read from HW */
+	char pci_bdf[APP_LINK_PCI_BDF_SIZE];
 
 	struct rte_eth_conf conf;
 	uint8_t promisc;
@@ -265,6 +266,10 @@ struct app_thread_data {
 	struct rte_ring *msgq_out;
 };
 
+#ifndef APP_MAX_LINKS
+#define APP_MAX_LINKS                            16
+#endif
+
 struct app_eal_params {
 	/* Map lcore set to physical cpu set */
 	char *coremap;
@@ -286,13 +291,13 @@ struct app_eal_params {
 	uint32_t ranks;
 
 	/* Add a PCI device in black list. */
-	char *pci_blacklist;
+	char *pci_blacklist[APP_MAX_LINKS];
 
 	/* Add a PCI device in white list. */
-	char *pci_whitelist;
+	char *pci_whitelist[APP_MAX_LINKS];
 
 	/* Add a virtual device. */
-	char *vdev;
+	char *vdev[APP_MAX_LINKS];
 
 	 /* Use VMware TSC map instead of native RDTSC */
 	uint32_t vmware_tsc_map_present;
@@ -367,10 +372,6 @@ struct app_eal_params {
 #define APP_MAX_MEMPOOLS                         8
 #endif
 
-#ifndef APP_MAX_LINKS
-#define APP_MAX_LINKS                            16
-#endif
-
 #ifndef APP_LINK_MAX_HWQ_IN
 #define APP_LINK_MAX_HWQ_IN                      64
 #endif
examples/ip_pipeline/config_check.c +10 -6
index 1ff5763..fd9ff49 100644
@@ -59,12 +59,16 @@ check_mempools(struct app_params *app)
 static void
 check_links(struct app_params *app)
 {
-	uint32_t n_links_port_mask = __builtin_popcountll(app->port_mask);
 	uint32_t i;
 
 	/* Check that number of links matches the port mask */
-	APP_CHECK((app->n_links == n_links_port_mask),
-		"Not enough links provided in the PORT_MASK\n");
+	if (app->port_mask) {
+		uint32_t n_links_port_mask =
+			__builtin_popcountll(app->port_mask);
+
+		APP_CHECK((app->n_links == n_links_port_mask),
+			"Not enough links provided in the PORT_MASK\n");
+	}
 
 	for (i = 0; i < app->n_links; i++) {
 		struct app_link_params *link = &app->link_params[i];
@@ -76,8 +80,8 @@ check_links(struct app_params *app)
 		rxq_max = 0;
 		if (link->arp_q > rxq_max)
 			rxq_max = link->arp_q;
-		if (link->tcp_syn_local_q > rxq_max)
-			rxq_max = link->tcp_syn_local_q;
+		if (link->tcp_syn_q > rxq_max)
+			rxq_max = link->tcp_syn_q;
 		if (link->ip_local_q > rxq_max)
 			rxq_max = link->ip_local_q;
 		if (link->tcp_local_q > rxq_max)
@@ -89,7 +93,7 @@ check_links(struct app_params *app)
 
 		for (i = 1; i <= rxq_max; i++)
 			APP_CHECK(((link->arp_q == i) ||
-				(link->tcp_syn_local_q == i) ||
+				(link->tcp_syn_q == i) ||
 				(link->ip_local_q == i) ||
 				(link->tcp_local_q == i) ||
 				(link->udp_local_q == i) ||
examples/ip_pipeline/config_parse.c +125 -30

284 lines not on this page · raw message

examples/ip_pipeline/init.c +77 -18

168 lines not on this page · raw message

examples/ip_pipeline/pipeline/pipeline_common_fe.c +9 -3
index 1e16ad6..bffc9a4 100644
@@ -898,9 +898,15 @@ print_link_info(struct app_link_params *p)
 
 	mac_addr = (struct ether_addr *) &p->mac_addr;
 
-	printf("%s: flags=<%s>\n",
-		p->name,
-		(p->state) ? "UP" : "DOWN");
+	if (strlen(p->pci_bdf))
+		printf("%s(%s): flags=<%s>\n",
+			p->name,
+			p->pci_bdf,
+			(p->state) ? "UP" : "DOWN");
+	else
+		printf("%s: flags=<%s>\n",
+			p->name,
+			(p->state) ? "UP" : "DOWN");
 
 	if (p->ip)
 		printf("\tinet %" PRIu32 ".%" PRIu32
Signature · 1 line
2.5.0