From patchwork Mon Nov 4 22:36:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13862193 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 A1BEC1FCC7C for ; Mon, 4 Nov 2024 22:36:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730759807; cv=none; b=fdEsw4k3zF7RXN9+osoPYoFY86nyydKHGfn70bweW9Q81Tv640JHNb/2VVCLhRvZqIo9aKgn0s4ARYGV8AMWpN1wpUMKuOBqfi+yaLhazsGGdmI8pplUX83OBlOIBvO77pqMUUSeWqSU+iFUXJoEIfHZ28B9UcY8aTv+mxowq3M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730759807; c=relaxed/simple; bh=+ubHQu77J9I3GlXsjmZmJQOw0UAuDkumxoVZJ6X/ImE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X1KYJqIdFHNU3GmkzhQHlDNH7s9Z0x7CrqyiLhnP7gPbwMyBoarqgnoEHfhEQnW7iG+wHrdWV1qeYpRPZaNdTDFGuq06eZ6Ltx+nMXZbQYjahauebcbxTWOl3KYd8BOEJ7uNyqTXWJ//MVQ+WUSEnAr1ZgwxUYi6aWIsB5PFLLE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=iMXdAwmY; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="iMXdAwmY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1730759805; x=1762295805; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+ubHQu77J9I3GlXsjmZmJQOw0UAuDkumxoVZJ6X/ImE=; b=iMXdAwmYhmMOVmFUNh36Ywrtg9a/pMlHFEwhQDmT7a/mEdZnLGdHag6Q T2fWc9HzzGLs+vUeBnBw1expQslj+XfabsY/NLiGyBATw9mEwr4VW4Eq/ SF21xDn685jKl9wxofvMpnR8DykmCy6AfFlJYAXaEmcqeOfkgzcgWAdJC 7iHbisfCqwukB9PRjfeufT//vULTKY9+V8hvrQN4HOTD9Xg2NWmMjp9x5 WKxEN7JXCtxy8ANTwgTUF9Bh0Q3gj35iCAP5vsXe91yJSJWLlkoR0IXpY bPiO+K6QUwX2HruK6DGVEHpZzc/9g2u2wPaqKySQq0dFnQ88wRF+7jOLF A==; X-CSE-ConnectionGUID: /2zkRH8USlmPA3KT8a3BHQ== X-CSE-MsgGUID: EFrfjNnPRoKJqb9UZuHMCg== X-IronPort-AV: E=McAfee;i="6700,10204,11246"; a="29901645" X-IronPort-AV: E=Sophos;i="6.11,258,1725346800"; d="scan'208";a="29901645" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2024 14:36:43 -0800 X-CSE-ConnectionGUID: ZyEv4hC4S7Sr0zgUHYkTcg== X-CSE-MsgGUID: Kt6D4LmEScWsyZ4b2R4JDA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,258,1725346800"; d="scan'208";a="83316976" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by fmviesa006.fm.intel.com with ESMTP; 04 Nov 2024 14:36:43 -0800 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, andrew+netdev@lunn.ch, netdev@vger.kernel.org Cc: Mateusz Polchlopek , anthony.l.nguyen@intel.com, Przemek Kitszel , Simon Horman , Pucha Himasekhar Reddy Subject: [PATCH net 2/6] ice: change q_index variable type to s16 to store -1 value Date: Mon, 4 Nov 2024 14:36:30 -0800 Message-ID: <20241104223639.2801097-3-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.46.0.522.gc50d79eeffbf In-Reply-To: <20241104223639.2801097-1-anthony.l.nguyen@intel.com> References: <20241104223639.2801097-1-anthony.l.nguyen@intel.com> 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 From: Mateusz Polchlopek Fix Flow Director not allowing to re-map traffic to 0th queue when action is configured to drop (and vice versa). The current implementation of ethtool callback in the ice driver forbids change Flow Director action from 0 to -1 and from -1 to 0 with an error, e.g: # ethtool -U eth2 flow-type tcp4 src-ip 1.1.1.1 loc 1 action 0 # ethtool -U eth2 flow-type tcp4 src-ip 1.1.1.1 loc 1 action -1 rmgr: Cannot insert RX class rule: Invalid argument We set the value of `u16 q_index = 0` at the beginning of the function ice_set_fdir_input_set(). In case of "drop traffic" action (which is equal to -1 in ethtool) we store the 0 value. Later, when want to change traffic rule to redirect to queue with index 0 it returns an error caused by duplicate found. Fix this behaviour by change of the type of field `q_index` from u16 to s16 in `struct ice_fdir_fltr`. This allows to store -1 in the field in case of "drop traffic" action. What is more, change the variable type in the function ice_set_fdir_input_set() and assign at the beginning the new `#define ICE_FDIR_NO_QUEUE_IDX` which is -1. Later, if the action is set to another value (point specific queue index) the variable value is overwritten in the function. Fixes: cac2a27cd9ab ("ice: Support IPv4 Flow Director filters") Reviewed-by: Przemek Kitszel Signed-off-by: Mateusz Polchlopek Reviewed-by: Simon Horman Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) Signed-off-by: Tony Nguyen Reviewed-by: Hariprasad Kelam --- drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c | 3 ++- drivers/net/ethernet/intel/ice/ice_fdir.h | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c b/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c index 5412eff8ef23..ee9862ddfe15 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c @@ -1830,11 +1830,12 @@ static int ice_set_fdir_input_set(struct ice_vsi *vsi, struct ethtool_rx_flow_spec *fsp, struct ice_fdir_fltr *input) { - u16 dest_vsi, q_index = 0; + s16 q_index = ICE_FDIR_NO_QUEUE_IDX; u16 orig_q_index = 0; struct ice_pf *pf; struct ice_hw *hw; int flow_type; + u16 dest_vsi; u8 dest_ctl; if (!vsi || !fsp || !input) diff --git a/drivers/net/ethernet/intel/ice/ice_fdir.h b/drivers/net/ethernet/intel/ice/ice_fdir.h index ab5b118daa2d..820023c0271f 100644 --- a/drivers/net/ethernet/intel/ice/ice_fdir.h +++ b/drivers/net/ethernet/intel/ice/ice_fdir.h @@ -53,6 +53,8 @@ */ #define ICE_FDIR_IPV4_PKT_FLAG_MF 0x20 +#define ICE_FDIR_NO_QUEUE_IDX -1 + enum ice_fltr_prgm_desc_dest { ICE_FLTR_PRGM_DESC_DEST_DROP_PKT, ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QINDEX, @@ -186,7 +188,7 @@ struct ice_fdir_fltr { u16 flex_fltr; /* filter control */ - u16 q_index; + s16 q_index; u16 orig_q_index; u16 dest_vsi; u8 dest_ctl;