From: Marek Kasiewicz <[email protected]>

Allow per-queue bandwidth rate limiting to be configured without
stopping the port when only a single TC node and single QoS element
are involved. This enables dynamic session management where individual
queue pacing rates can be changed while other queues continue
transmitting.

Also fix the queue ID assignment in the bandwidth configuration to
use the actual TM node ID rather than a sequential counter index, and
only mark the TM hierarchy as committed when the port is stopped to
permit subsequent reconfiguration.

Signed-off-by: Marek Kasiewicz <[email protected]>
Signed-off-by: Dawid Wesierski <[email protected]>
---
 drivers/net/intel/iavf/iavf_tm.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/drivers/net/intel/iavf/iavf_tm.c b/drivers/net/intel/iavf/iavf_tm.c
index 1cf7bfb106..e3492ec491 100644
--- a/drivers/net/intel/iavf/iavf_tm.c
+++ b/drivers/net/intel/iavf/iavf_tm.c
@@ -804,19 +804,25 @@ static int iavf_hierarchy_commit(struct rte_eth_dev *dev,
        int index = 0, node_committed = 0;
        int i, ret_val = IAVF_SUCCESS;
 
-       /* check if port is stopped */
-       if (adapter->stopped != 1) {
-               PMD_DRV_LOG(ERR, "Please stop port first");
-               ret_val = IAVF_ERR_NOT_READY;
-               goto err;
-       }
-
        if (!(vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_QOS)) {
                PMD_DRV_LOG(ERR, "VF queue tc mapping is not supported");
                ret_val = IAVF_NOT_SUPPORTED;
                goto fail_clear;
        }
 
+       /*
+        * Allow reconfiguration on a running port only when a single queue is
+        * involved (single TC node and single QoS element); otherwise the port
+        * must be stopped first. qos_cap is valid here because the
+        * VIRTCHNL_VF_OFFLOAD_QOS capability was checked above.
+        */
+       if ((vf->tm_conf.nb_tc_node != 1 || vf->qos_cap->num_elem != 1) &&
+           adapter->stopped != 1) {
+               PMD_DRV_LOG(ERR, "Please stop port first");
+               ret_val = IAVF_ERR_NOT_READY;
+               goto err;
+       }
+
        /* check if all TC nodes are set with VF vsi */
        if (vf->tm_conf.nb_tc_node != vf->qos_cap->num_elem) {
                PMD_DRV_LOG(ERR, "Does not set VF vsi nodes to all TCs");
@@ -856,7 +862,7 @@ static int iavf_hierarchy_commit(struct rte_eth_dev *dev,
                q_tc_mapping->tc[tm_node->tc].req.queue_count++;
 
                if (tm_node->shaper_profile) {
-                       q_bw->cfg[node_committed].queue_id = node_committed;
+                       q_bw->cfg[node_committed].queue_id = tm_node->id;
                        q_bw->cfg[node_committed].shaper.peak =
                        tm_node->shaper_profile->profile.peak.rate /
                        1000 * IAVF_BITS_PER_BYTE;
@@ -900,7 +906,8 @@ static int iavf_hierarchy_commit(struct rte_eth_dev *dev,
                goto fail_clear;
 
        vf->qtc_map = qtc_map;
-       vf->tm_conf.committed = true;
+       if (adapter->stopped == 1)
+               vf->tm_conf.committed = true;
        return ret_val;
 
 fail_clear:
-- 
2.47.3

---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial 
Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | 
Kapital zakladowy 200.000 PLN.
Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z 
dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach 
handlowych.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i 
moze zawierac informacje poufne. W razie przypadkowego otrzymania tej 
wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; 
jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole 
use of the intended recipient(s). If you are not the intended recipient, please 
contact the sender and delete all copies; any review or distribution by others 
is strictly prohibited.

Reply via email to