net/mvpp2: check meter packet mode
authorLi Zhang <lizh@nvidia.com>
Tue, 13 Apr 2021 15:59:57 +0000 (18:59 +0300)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 13 Apr 2021 16:40:58 +0000 (18:40 +0200)
Currently meter algorithms only supports bytes per second(BPS).
Check packet_mode set to TRUE are rejected.

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Liron Himi <lironh@marvell.com>
drivers/net/mvpp2/mrvl_mtr.c

index 2fa5cb4..c07ac95 100644 (file)
@@ -88,6 +88,12 @@ mrvl_meter_profile_add(struct rte_eth_dev *dev, uint32_t meter_profile_id,
                                          NULL,
                                          "Only srTCM RFC 2697 is supported\n");
 
+       if (profile->packet_mode)
+               return -rte_mtr_error_set(error, EINVAL,
+                               RTE_MTR_ERROR_TYPE_METER_PROFILE_PACKET_MODE,
+                               NULL,
+                               "Packet mode is not supported\n");
+
        prof = mrvl_mtr_profile_from_id(priv, meter_profile_id);
        if (prof)
                return -rte_mtr_error_set(error, EEXIST,