ice: Fix check for weight and priority of a scheduling node
authorMichal Wilczynski <michal.wilczynski@intel.com>
Wed, 25 Jan 2023 11:37:40 +0000 (12:37 +0100)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Mon, 13 Feb 2023 17:47:51 +0000 (09:47 -0800)
Currently checks for weight and priority ranges don't check incoming value
from the devlink. Instead it checks node current weight or priority. This
makes those checks useless.

Change range checks in ice_set_object_tx_priority() and
ice_set_object_tx_weight() to check against incoming priority an weight.

Fixes: 42c2eb6b1f43 ("ice: Implement devlink-rate API")
Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com>
Acked-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_devlink.c

index 8286e47b4baec06deb8c96ec306fca07127563a3..0fae0186bd8507ef5c4f1cf219890725dc2b67e7 100644 (file)
@@ -899,7 +899,7 @@ static int ice_set_object_tx_priority(struct ice_port_info *pi, struct ice_sched
 {
        int status;
 
-       if (node->tx_priority >= 8) {
+       if (priority >= 8) {
                NL_SET_ERR_MSG_MOD(extack, "Priority should be less than 8");
                return -EINVAL;
        }
@@ -929,7 +929,7 @@ static int ice_set_object_tx_weight(struct ice_port_info *pi, struct ice_sched_n
 {
        int status;
 
-       if (node->tx_weight > 200 || node->tx_weight < 1) {
+       if (weight > 200 || weight < 1) {
                NL_SET_ERR_MSG_MOD(extack, "Weight must be between 1 and 200");
                return -EINVAL;
        }