summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Simonart <xavier.simonart@intel.com>2019-01-23 14:26:01 +0100
committerXavier Simonart <xavier.simonart@intel.com>2019-02-07 13:49:26 +0100
commit0eca932897b14ebe0cfa63a5678b81a3146a5121 (patch)
treee78aa4990c92ea30c27bece10a9e48031d37f044
parent06d71cb8ceab4d531a29b09c589eeda7bd4e6311 (diff)
Add check for configuration error (not enough mbuf)
Number of mbufs must at least cover for number of rx descriptors, number of tx descriptors, number of mbuf cached and number of mbufs handled by the application. If this is not the case, a warning is returned. This ony check for the more basic cases. This will not check for instance for cases with multiples rings where more mbufs might be cached. Change-Id: If2c0c9fc76ed4500849d92cf7586bb0b25d8ab22 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
-rw-r--r--VNFs/DPPD-PROX/main.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/VNFs/DPPD-PROX/main.c b/VNFs/DPPD-PROX/main.c
index 5ab85d60..ed578c85 100644
--- a/VNFs/DPPD-PROX/main.c
+++ b/VNFs/DPPD-PROX/main.c
@@ -127,11 +127,33 @@ static void check_zero_rx(void)
}
}
+static void check_nb_mbuf(void)
+{
+ struct lcore_cfg *lconf = NULL;
+ struct task_args *targ = NULL;
+ uint8_t port_id;
+ int n_txd = 0, n_rxd = 0;
+
+ while (core_targ_next(&lconf, &targ, 0) == 0) {
+ for (uint8_t i = 0; i < targ->nb_txports; ++i) {
+ port_id = targ->tx_port_queue[i].port;
+ n_txd = prox_port_cfg[port_id].n_txd;
+ }
+ for (uint8_t i = 0; i < targ->nb_rxports; ++i) {
+ port_id = targ->rx_port_queue[i].port;
+ n_rxd = prox_port_cfg[port_id].n_rxd;
+ }
+ if (targ->nb_mbuf <= n_rxd + n_txd + targ->nb_cache_mbuf + MAX_PKT_BURST) {
+ plog_warn("Core %d, task %d might not have enough mbufs (%d) to support %d txd, %d rxd and %d cache_mbuf\n",
+ lconf->id, targ->id, targ->nb_mbuf, n_txd, n_rxd, targ->nb_cache_mbuf);
+ }
+ }
+}
+
static void check_missing_rx(void)
{
struct lcore_cfg *lconf = NULL, *rx_lconf = NULL, *tx_lconf = NULL;
struct task_args *targ, *rx_targ = NULL, *tx_targ = NULL;
- struct prox_port_cfg *port;
uint8_t port_id, rx_port_id, ok;
while (core_targ_next(&lconf, &targ, 0) == 0) {
@@ -192,6 +214,7 @@ static void check_missing_rx(void)
static void check_cfg_consistent(void)
{
+ check_nb_mbuf();
check_missing_rx();
check_zero_rx();
check_mixed_normal_pipeline();