Add check for configuration error (not enough mbuf) 87/66887/1
authorXavier Simonart <xavier.simonart@intel.com>
Wed, 23 Jan 2019 13:26:01 +0000 (14:26 +0100)
committerXavier Simonart <xavier.simonart@intel.com>
Thu, 7 Feb 2019 12:49:26 +0000 (13:49 +0100)
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>
VNFs/DPPD-PROX/main.c

index 5ab85d6..ed578c8 100644 (file)
@@ -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();