version: 21.11-rc0
[dpdk.git] / drivers / net / mvpp2 / mrvl_qos.c
index 38556b2..dbfc3b5 100644 (file)
@@ -79,6 +79,9 @@
 /* parser forward bad frames tokens */
 #define MRVL_TOK_FWD_BAD_FRAMES "forward_bad_frames"
 
+/* parse fill bpool buffers tokens */
+#define MRVL_TOK_FILL_BPOOL_BUFFS "fill_bpool_buffs"
+
 /** Number of tokens in range a-b = 2. */
 #define MAX_RNG_TOKENS 2
 
@@ -321,7 +324,7 @@ parse_tc_cfg(struct rte_cfgfile *file, int port, int tc,
        if (rte_cfgfile_num_sections(file, sec_name, strlen(sec_name)) <= 0)
                return 0;
 
-       cfg->port[port].use_global_defaults = 0;
+       cfg->port[port].use_qos_global_defaults = 0;
        entry = rte_cfgfile_get_entry(file, sec_name, MRVL_TOK_RXQ);
        if (entry) {
                n = get_entry_values(entry,
@@ -718,7 +721,12 @@ mrvl_get_cfg(const char *key __rte_unused, const char *path, void *extra_args)
                        MRVL_TOK_PORT, n, MRVL_TOK_DEFAULT);
 
                /* Use global defaults, unless an override occurs */
-               (*cfg)->port[n].use_global_defaults = 1;
+               (*cfg)->port[n].use_qos_global_defaults = 1;
+
+               /* Set non-zero defaults before the decision to continue to next
+                * port or to parse the port section in config file
+                */
+               (*cfg)->port[n].fill_bpool_buffs = MRVL_BURST_SIZE;
 
                /* Skip ports non-existing in configuration. */
                if (rte_cfgfile_num_sections(file, sec_name,
@@ -796,7 +804,7 @@ mrvl_get_cfg(const char *key __rte_unused, const char *path, void *extra_args)
                entry = rte_cfgfile_get_entry(file, sec_name,
                                MRVL_TOK_MAPPING_PRIORITY);
                if (entry) {
-                       (*cfg)->port[n].use_global_defaults = 0;
+                       (*cfg)->port[n].use_qos_global_defaults = 0;
                        if (!strncmp(entry, MRVL_TOK_VLAN_IP,
                                sizeof(MRVL_TOK_VLAN_IP)))
                                (*cfg)->port[n].mapping_priority =
@@ -828,7 +836,7 @@ mrvl_get_cfg(const char *key __rte_unused, const char *path, void *extra_args)
                entry = rte_cfgfile_get_entry(file, sec_name,
                                MRVL_TOK_PLCR_DEFAULT);
                if (entry) {
-                       (*cfg)->port[n].use_global_defaults = 0;
+                       (*cfg)->port[n].use_qos_global_defaults = 0;
                        if (get_val_securely(entry, &val) < 0)
                                return -1;
 
@@ -867,7 +875,7 @@ mrvl_get_cfg(const char *key __rte_unused, const char *path, void *extra_args)
                                return -1;
                        (*cfg)->port[n].default_tc = (uint8_t)val;
                } else {
-                       if ((*cfg)->port[n].use_global_defaults == 0) {
+                       if ((*cfg)->port[n].use_qos_global_defaults == 0) {
                                MRVL_LOG(ERR,
                                         "Default Traffic Class required in "
                                         "custom configuration!");
@@ -889,6 +897,19 @@ mrvl_get_cfg(const char *key __rte_unused, const char *path, void *extra_args)
                } else {
                        (*cfg)->port[n].forward_bad_frames = 0;
                }
+
+               /* Parse fill bpool buffs option */
+               entry = rte_cfgfile_get_entry(file, sec_name,
+                               MRVL_TOK_FILL_BPOOL_BUFFS);
+               if (entry) {
+                       if (get_val_securely(entry, &val) < 0) {
+                               MRVL_LOG(ERR,
+                                       "Error in parsing %s value (%s)!\n",
+                                       MRVL_TOK_FILL_BPOOL_BUFFS, entry);
+                               return -1;
+                       }
+                       (*cfg)->port[n].fill_bpool_buffs = val;
+               }
        }
 
        return 0;
@@ -984,7 +1005,7 @@ mrvl_configure_rxqs(struct mrvl_priv *priv, uint16_t portid,
        size_t i, tc;
 
        if (mrvl_cfg == NULL ||
-               mrvl_cfg->port[portid].use_global_defaults) {
+               mrvl_cfg->port[portid].use_qos_global_defaults) {
                /*
                 * No port configuration, use default: 1 TC, no QoS,
                 * TC color set to green.