examples/ip_pipeline: support RSS
[dpdk.git] / examples / ip_pipeline / config_check.c
index 1ff5763..18f57be 100644 (file)
@@ -56,15 +56,39 @@ 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)
 {
-       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 +100,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)
@@ -86,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_local_q == i) ||
-                               (link->ip_local_q == i) ||
-                               (link->tcp_local_q == i) ||
-                               (link->udp_local_q == i) ||
-                               (link->sctp_local_q == i)),
+                       APP_CHECK((link_rxq_used(link, i)),
                                "%s RXQs are not contiguous (A)\n", link->name);
 
                n_rxq = app_link_get_n_rxq(app, link);
@@ -114,7 +136,7 @@ check_links(struct app_params *app)
                                "%s RXQs are not contiguous (C)\n", link->name);
                }
 
-               /* Check that link RXQs are contiguous */
+               /* Check that link TXQs are contiguous */
                n_txq = app_link_get_n_txq(app, link);
 
                APP_CHECK((n_txq),  "%s does not have any TXQ\n", link->name);