net/softnic: check meter packet mode
authorLi Zhang <lizh@nvidia.com>
Tue, 13 Apr 2021 15:59:56 +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: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
drivers/net/softnic/rte_eth_softnic_meter.c

index 31a2a0e..b27b128 100644 (file)
@@ -128,6 +128,14 @@ meter_profile_check(struct rte_eth_dev *dev,
                        NULL,
                        "Metering alg not supported");
 
+       /* Not support packet mode, just support byte mode. */
+       if (profile->packet_mode)
+               return -rte_mtr_error_set(error,
+                       EINVAL,
+                       RTE_MTR_ERROR_TYPE_METER_PROFILE_PACKET_MODE,
+                       NULL,
+                       "Meter packet mode not supported");
+
        return 0;
 }