From patchwork Wed Jun 5 14:17:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Szycik X-Patchwork-Id: 13687009 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07A9323D7 for ; Wed, 5 Jun 2024 14:15:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717596954; cv=none; b=LSSOAl8/YvKFS7gXntC6Ek6UYdV2qh7aoHLKv/w7K8amFMiacYxcw0ZhHMWOvtg4yZphbvsaJnl1o/BBBJomIJyRu7aNHVfAp6y4wyOrAMaLXAb1ZKM8BZ7sR7gWkmtOmlqFgQsO33u3N6m0ClhNZX/HEIsUQc/vJQxo02znnzk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717596954; c=relaxed/simple; bh=qNGcKSHzMUHaoXNNVdVj1QrqBWKJMJw+NEabirszjXc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=NzFA2v5CIwe+Ya3QieY+LGSq4fpjRBtLrqASRCxdhARVr3HLKuz6JAgJuj1sri0PxhZ0IxHy5c2ozhbzlEnQF/j6J0OmpvX4UjEQr/1yk5P6Jk6L56r+4PYqYh7T+/snA9Ulb+Frd3fpkwcycFnt8K1KN4N03sGh8azo0Mi3GaA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=OIDfC0nu; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="OIDfC0nu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717596954; x=1749132954; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=qNGcKSHzMUHaoXNNVdVj1QrqBWKJMJw+NEabirszjXc=; b=OIDfC0nuvwL9/M2gx5xHuJFf8HKeiIH2rWztYgbFo56KQagg4H4gmY2E G2dt3pWFSgBAOi8QBolMCVJj0m/pw1hvASiTQ8437ktUuypARfDt2nLUK Eg9NNlm4Kzv8AARLRXUiJk9fJ6XLCBWHNABBVpRxXsIQHUEO8sKA3P6jE Zf969xDfRayYH2TieQW6egCtDhyx8wmTCe2Ube4eB44e7iTTCN5wB9CKh a9SxWorP0CFafAG8QPVkTVTgy9510WkUMNPYBvn6B4pqRtQQXIH1qln9d +PLN2JifdLNEUkpxRZC/8ToKkmnnN4hhVaPQNaaH6KVVTf/qihXxHw6a2 w==; X-CSE-ConnectionGUID: nMaIRAEMThyFMuBs2Tm/VQ== X-CSE-MsgGUID: ngul3ArPTAS2WAr0mOSxxw== X-IronPort-AV: E=McAfee;i="6600,9927,11093"; a="14052655" X-IronPort-AV: E=Sophos;i="6.08,216,1712646000"; d="scan'208";a="14052655" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2024 07:15:53 -0700 X-CSE-ConnectionGUID: NdV6qpahS1yE7X3L5n8ZlQ== X-CSE-MsgGUID: w6mSOVe0RnWzAhH1SkiS1A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,216,1712646000"; d="scan'208";a="38177138" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by orviesa008.jf.intel.com with ESMTP; 05 Jun 2024 07:15:51 -0700 Received: from mystra-4.igk.intel.com (mystra-4.igk.intel.com [10.123.220.40]) by irvmail002.ir.intel.com (Postfix) with ESMTP id CDB0F33BC3; Wed, 5 Jun 2024 15:15:49 +0100 (IST) From: Marcin Szycik To: intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org, Marcin Szycik , Michal Swiatkowski , Przemek Kitszel Subject: [PATCH iwl-net] ice: Fix VSI list rule with ICE_SW_LKUP_LAST type Date: Wed, 5 Jun 2024 16:17:45 +0200 Message-ID: <20240605141744.601582-2-marcin.szycik@linux.intel.com> X-Mailer: git-send-email 2.45.0 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Adding/updating VSI list rule, as well as allocating/freeing VSI list resource are called several times with type ICE_SW_LKUP_LAST, which fails because ice_update_vsi_list_rule() and ice_aq_alloc_free_vsi_list() consider it invalid. Allow calling these functions with ICE_SW_LKUP_LAST. This fixes at least one issue in switchdev mode, where the same rule with different action cannot be added, e.g.: tc filter add dev $PF1 ingress protocol arp prio 0 flower skip_sw \ dst_mac ff:ff:ff:ff:ff:ff action mirred egress redirect dev $VF1_PR tc filter add dev $PF1 ingress protocol arp prio 0 flower skip_sw \ dst_mac ff:ff:ff:ff:ff:ff action mirred egress redirect dev $VF2_PR Fixes: 0f94570d0cae ("ice: allow adding advanced rules") Suggested-by: Michal Swiatkowski Reviewed-by: Michal Swiatkowski Reviewed-by: Przemek Kitszel Signed-off-by: Marcin Szycik Reviewed-by: Jacob Keller Reviewed-by: Simon Horman Tested-by: Sujai Buvaneswaran --- drivers/net/ethernet/intel/ice/ice_switch.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c index 94d6670d0901..1191031b2a43 100644 --- a/drivers/net/ethernet/intel/ice/ice_switch.c +++ b/drivers/net/ethernet/intel/ice/ice_switch.c @@ -1899,7 +1899,8 @@ ice_aq_alloc_free_vsi_list(struct ice_hw *hw, u16 *vsi_list_id, lkup_type == ICE_SW_LKUP_ETHERTYPE_MAC || lkup_type == ICE_SW_LKUP_PROMISC || lkup_type == ICE_SW_LKUP_PROMISC_VLAN || - lkup_type == ICE_SW_LKUP_DFLT) { + lkup_type == ICE_SW_LKUP_DFLT || + lkup_type == ICE_SW_LKUP_LAST) { sw_buf->res_type = cpu_to_le16(ICE_AQC_RES_TYPE_VSI_LIST_REP); } else if (lkup_type == ICE_SW_LKUP_VLAN) { if (opc == ice_aqc_opc_alloc_res) @@ -2922,7 +2923,8 @@ ice_update_vsi_list_rule(struct ice_hw *hw, u16 *vsi_handle_arr, u16 num_vsi, lkup_type == ICE_SW_LKUP_ETHERTYPE_MAC || lkup_type == ICE_SW_LKUP_PROMISC || lkup_type == ICE_SW_LKUP_PROMISC_VLAN || - lkup_type == ICE_SW_LKUP_DFLT) + lkup_type == ICE_SW_LKUP_DFLT || + lkup_type == ICE_SW_LKUP_LAST) rule_type = remove ? ICE_AQC_SW_RULES_T_VSI_LIST_CLEAR : ICE_AQC_SW_RULES_T_VSI_LIST_SET; else if (lkup_type == ICE_SW_LKUP_VLAN)