]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ice: fix check for existing switch rule
authorMateusz Pacuszka <mateuszx.pacuszka@intel.com>
Fri, 14 Feb 2025 08:50:35 +0000 (09:50 +0100)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Fri, 11 Apr 2025 16:32:31 +0000 (09:32 -0700)
In case the rule already exists and another VSI wants to subscribe to it
new VSI list is being created and both VSIs are moved to it.
Currently, the check for already existing VSI with the same rule is done
based on fdw_id.hw_vsi_id, which applies only to LOOKUP_RX flag.
Change it to vsi_handle. This is software VSI ID, but it can be applied
here, because vsi_map itself is also based on it.

Additionally change return status in case the VSI already exists in the
VSI map to "Already exists". Such case should be handled by the caller.

Signed-off-by: Mateusz Pacuszka <mateuszx.pacuszka@intel.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_switch.c

index 4a91e0aaf0a5e51f981909cf7d39c72f38e9cd19..9d9a7edd3618af04e0b8674f9b85c36a0c649a46 100644 (file)
@@ -3146,7 +3146,7 @@ ice_add_update_vsi_list(struct ice_hw *hw,
                u16 vsi_handle_arr[2];
 
                /* A rule already exists with the new VSI being added */
-               if (cur_fltr->fwd_id.hw_vsi_id == new_fltr->fwd_id.hw_vsi_id)
+               if (cur_fltr->vsi_handle == new_fltr->vsi_handle)
                        return -EEXIST;
 
                vsi_handle_arr[0] = cur_fltr->vsi_handle;
@@ -5978,7 +5978,7 @@ ice_adv_add_update_vsi_list(struct ice_hw *hw,
 
                /* A rule already exists with the new VSI being added */
                if (test_bit(vsi_handle, m_entry->vsi_list_info->vsi_map))
-                       return 0;
+                       return -EEXIST;
 
                /* Update the previously created VSI list set with
                 * the new VSI ID passed in