#include <stdio.h>
+#include <rte_ip.h>
+
#include "app.h"
static void
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];
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)
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) ||
n_rxq = app_link_get_n_rxq(app, link);
+ APP_CHECK((n_rxq), "%s does not have any RXQ\n", link->name);
+
APP_CHECK((n_rxq == rxq_max + 1),
"%s RXQs are not contiguous (B)\n", link->name);
/* Check that link RXQs are contiguous */
n_txq = app_link_get_n_txq(app, link);
+ APP_CHECK((n_txq), "%s does not have any TXQ\n", link->name);
+
for (i = 0; i < n_txq; i++) {
char name[APP_PARAM_NAME_SIZE];
int pos;
struct app_pktq_swq_params *p = &app->swq_params[i];
uint32_t n_readers = app_swq_get_readers(app, p);
uint32_t n_writers = app_swq_get_writers(app, p);
+ uint32_t n_flags;
APP_CHECK((p->size > 0),
"%s size is 0\n", p->name);
APP_CHECK((n_readers != 0),
"%s has no reader\n", p->name);
- APP_CHECK((n_readers == 1),
- "%s has more than one reader\n", p->name);
+ if (n_readers > 1)
+ APP_LOG(app, LOW, "%s has more than one reader", p->name);
APP_CHECK((n_writers != 0),
"%s has no writer\n", p->name);
- APP_CHECK((n_writers == 1),
- "%s has more than one writer\n", p->name);
+ if (n_writers > 1)
+ APP_LOG(app, LOW, "%s has more than one writer", p->name);
+
+ n_flags = p->ipv4_frag + p->ipv6_frag + p->ipv4_ras + p->ipv6_ras;
+
+ APP_CHECK((n_flags < 2),
+ "%s has more than one fragmentation or reassembly mode enabled\n",
+ p->name);
+
+ APP_CHECK((!((n_readers > 1) && (n_flags == 1))),
+ "%s has more than one reader when fragmentation or reassembly"
+ " mode enabled\n",
+ p->name);
+
+ APP_CHECK((!((n_writers > 1) && (n_flags == 1))),
+ "%s has more than one writer when fragmentation or reassembly"
+ " mode enabled\n",
+ p->name);
+
+ n_flags = p->ipv4_ras + p->ipv6_ras;
+
+ APP_CHECK((!((p->dropless == 1) && (n_flags == 1))),
+ "%s has dropless when reassembly mode enabled\n", p->name);
+
+ n_flags = p->ipv4_frag + p->ipv6_frag;
+
+ if (n_flags == 1) {
+ uint16_t ip_hdr_size = (p->ipv4_frag) ? sizeof(struct ipv4_hdr) :
+ sizeof(struct ipv6_hdr);
+
+ APP_CHECK((p->mtu > ip_hdr_size),
+ "%s mtu size is smaller than ip header\n", p->name);
+
+ APP_CHECK((!((p->mtu - ip_hdr_size) % 8)),
+ "%s mtu size is incorrect\n", p->name);
+ }
}
}