From nobody Thu Oct 9 04:19:42 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (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 7647E285051; Fri, 20 Jun 2025 10:03:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750413809; cv=none; b=dKps+UN9CuaLGgTbNFZ3NUpp8eYIkfNx5fuLOiCfbLALnrxrN9xKP3qTn2gQtZGhLvMlY5GO1pS6a3Ha0LB4TrH1WrVLCKdzK7Yh7GRNvc8U34DR0rQrHr7u1YmMX8wcDfidAiwfeQ8kWA1YujLkRq2mw17d7DOENdN5qub6gHg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750413809; c=relaxed/simple; bh=CQGVmG5DzyINqq9HjZaFAhV7/N9sszZHtO3uOlf8a+k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=j/mPgSM5Ra7P/o2zo0BUBKfCELex01qjLB3sPsHTZC89iQy3kXNVSOTUvYt2pxBHQ5NFxiBDjW062CfiBa+RA60M7Bwc8tQBztKG2SzMYgTWb1vgNhEQ+kYtqOToMyoLpDgVIwgNTf8+Kcw9zMrJZX3f0s18XHAQr3xkIK55f6w= 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=Y11UvJ8s; arc=none smtp.client-ip=198.175.65.18 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="Y11UvJ8s" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1750413807; x=1781949807; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CQGVmG5DzyINqq9HjZaFAhV7/N9sszZHtO3uOlf8a+k=; b=Y11UvJ8sYIJLu5zHCjUU3tJz3beIUDDbc89F1DlCkCPp1/kBl9eXDkxV T9AdqJy5X5bsBoIxC6lJaQ5q8ZfG4oWo+yKkMkdjEXjGm2TgM+OA9wSOx I4aDvhdsrsus9eismWmjrW/qJinIH1K6cMp0avhjPnf6G2zzEe9pSsUxz 81STFZH0dapvrylRgtiQDD2iIcUKhrtEQTEb9/Ni1V9Vr15BlDDFb/I0z WoI5bvJ573g7KIkNbuTS2cwQz6YwHey+RmBifU5Q+CVVlkEKy8r0zbxdi YOYk+wGq52ynxLxAZRNUAHhTE+HGbDF6lfJvu6eKfE/9PkkLA9stRRytz Q==; X-CSE-ConnectionGUID: Ypwolvp5QJe5vBVaz3FKeg== X-CSE-MsgGUID: zjCs9c/kRXiLe1fMp+w12g== X-IronPort-AV: E=McAfee;i="6800,10657,11469"; a="52817095" X-IronPort-AV: E=Sophos;i="6.16,251,1744095600"; d="scan'208";a="52817095" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2025 03:03:27 -0700 X-CSE-ConnectionGUID: MhaWDlu1QxqkL0qi3Zw4pw== X-CSE-MsgGUID: Ce0XWxVtSoSksHuUAySBQg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,251,1744095600"; d="scan'208";a="181744791" Received: from p12ill20yoongsia.png.intel.com ([10.88.227.38]) by fmviesa001.fm.intel.com with ESMTP; 20 Jun 2025 03:03:21 -0700 From: Song Yoong Siang To: Tony Nguyen , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Vinicius Costa Gomes , Jonathan Corbet , Przemek Kitszel , Shinas Rasheed , Kevin Tian , Brett Creeley , Blanco Alcaine Hector , Joshua Hay , Andrew Lunn , Jacob Keller , Kurt Kanzenbach , Marcin Szycik , Brett Creeley Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH iwl-next,v3 1/2] igc: Relocate RSS field definitions to igc_defines.h Date: Fri, 20 Jun 2025 18:02:50 +0800 Message-Id: <20250620100251.2791202-2-yoong.siang.song@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250620100251.2791202-1-yoong.siang.song@intel.com> References: <20250620100251.2791202-1-yoong.siang.song@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Move the RSS field definitions related to IPv4 and IPv6 UDP from igc.h to igc_defines.h to consolidate the RSS field definitions in a single header file, improving code organization and maintainability. This refactoring does not alter the functionality of the driver but enhances the logical grouping of related constants Reviewed-by: Kurt Kanzenbach Signed-off-by: Song Yoong Siang Reviewed-by: Aleksandr Loktionov Reviewed-by: Brett Creeley Tested-by: Mor Bar-Gabay --- drivers/net/ethernet/intel/igc/igc.h | 4 ---- drivers/net/ethernet/intel/igc/igc_defines.h | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/igc/igc.h b/drivers/net/ethernet/in= tel/igc/igc.h index 1525ae25fd3e..0b35e593d5ee 100644 --- a/drivers/net/ethernet/intel/igc/igc.h +++ b/drivers/net/ethernet/intel/igc/igc.h @@ -406,10 +406,6 @@ extern char igc_driver_name[]; #define IGC_FLAG_RSS_FIELD_IPV4_UDP BIT(6) #define IGC_FLAG_RSS_FIELD_IPV6_UDP BIT(7) =20 -#define IGC_MRQC_ENABLE_RSS_MQ 0x00000002 -#define IGC_MRQC_RSS_FIELD_IPV4_UDP 0x00400000 -#define IGC_MRQC_RSS_FIELD_IPV6_UDP 0x00800000 - /* RX-desc Write-Back format RSS Type's */ enum igc_rss_type_num { IGC_RSS_TYPE_NO_HASH =3D 0, diff --git a/drivers/net/ethernet/intel/igc/igc_defines.h b/drivers/net/eth= ernet/intel/igc/igc_defines.h index 86b346687196..d80254f2a278 100644 --- a/drivers/net/ethernet/intel/igc/igc_defines.h +++ b/drivers/net/ethernet/intel/igc/igc_defines.h @@ -383,11 +383,14 @@ #define IGC_RXDEXT_STATERR_IPE 0x40000000 #define IGC_RXDEXT_STATERR_RXE 0x80000000 =20 +#define IGC_MRQC_ENABLE_RSS_MQ 0x00000002 #define IGC_MRQC_RSS_FIELD_IPV4_TCP 0x00010000 #define IGC_MRQC_RSS_FIELD_IPV4 0x00020000 #define IGC_MRQC_RSS_FIELD_IPV6_TCP_EX 0x00040000 #define IGC_MRQC_RSS_FIELD_IPV6 0x00100000 #define IGC_MRQC_RSS_FIELD_IPV6_TCP 0x00200000 +#define IGC_MRQC_RSS_FIELD_IPV4_UDP 0x00400000 +#define IGC_MRQC_RSS_FIELD_IPV6_UDP 0x00800000 =20 /* Header split receive */ #define IGC_RFCTL_IPV6_EX_DIS 0x00010000 --=20 2.34.1 From nobody Thu Oct 9 04:19:42 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (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 33234285412; Fri, 20 Jun 2025 10:03:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750413815; cv=none; b=BSTf+kr7Vzccg+Wmy8rumh1F1R7UwX2fGSvdVwbcXZmSD983YAsBMQpNy4TC8QDFip1ZY54X01bspm2kqv8ZLv8b8dicNm0QvZVlN/gKztt5LgVHaiohmr+wwInBVC/UbPmuJ8hr2JwnVm4FCCRJfBL8dcv3TeRzVVueLMTktuk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750413815; c=relaxed/simple; bh=dYyBprBnixwR53Tfm/dKtWJm68UzW+gDxVTIxJUHFZQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SDm899w2b+PVMj/llohRrri6S55bfPWp4e8mzkYEFdZnbumGL2Xu8CqIO1UD1Dh83mLPhkES75b6fQqe5Ax7PhMKkxsaOD+1SVecpfFxTbBWheoHQqkDmZit8PplVpXgyT8Nz5Lpf5tZop1PMS/o/aT16vM1isu4oSM/PHnJljU= 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=VhuKr3vl; arc=none smtp.client-ip=198.175.65.18 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="VhuKr3vl" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1750413813; x=1781949813; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dYyBprBnixwR53Tfm/dKtWJm68UzW+gDxVTIxJUHFZQ=; b=VhuKr3vlo4Y3gWngIg4OuD7KddlZDssiFGu5S9h/jOiq+YVYVUg7b3tl llv+myC9emrM2t0l9EWIr8iPUT/WhKpA51cht0NII1YgC08v4Bmey+n63 IO0kytr09HXlqt6YxEa7VlcKCr0bx18e3WHtUtKCktMf2P6tMIhkd6zb+ BfJWb+7ck/y3s7E41b98V9N0IhYmXKTNtVSs23EVLD/xi0lIovBbtYn7Z 9EdXM/Svygi1zDLd2vOWJTlX6TlephTSbwnUGamDB2L6Yv16uytBtKss5 2lbdA6/Xre8uFnRKt7Wq9tH7a4SddKSo+SGyo7JQ59pUn6itG5AvnbhNc g==; X-CSE-ConnectionGUID: i5xz8RcNRSS7NIaCXVPDYw== X-CSE-MsgGUID: oOPLMc1PRlaU8ea5TtxysA== X-IronPort-AV: E=McAfee;i="6800,10657,11469"; a="52817128" X-IronPort-AV: E=Sophos;i="6.16,251,1744095600"; d="scan'208";a="52817128" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2025 03:03:33 -0700 X-CSE-ConnectionGUID: yTN32KeyTZGyDUAArqSApA== X-CSE-MsgGUID: IpfS2IKxSlSThBWGDenFgQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,251,1744095600"; d="scan'208";a="181744802" Received: from p12ill20yoongsia.png.intel.com ([10.88.227.38]) by fmviesa001.fm.intel.com with ESMTP; 20 Jun 2025 03:03:27 -0700 From: Song Yoong Siang To: Tony Nguyen , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Vinicius Costa Gomes , Jonathan Corbet , Przemek Kitszel , Shinas Rasheed , Kevin Tian , Brett Creeley , Blanco Alcaine Hector , Joshua Hay , Andrew Lunn , Jacob Keller , Kurt Kanzenbach , Marcin Szycik , Brett Creeley Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH iwl-next,v3 2/2] igc: Add wildcard rule support to ethtool NFC using Default Queue Date: Fri, 20 Jun 2025 18:02:51 +0800 Message-Id: <20250620100251.2791202-3-yoong.siang.song@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250620100251.2791202-1-yoong.siang.song@intel.com> References: <20250620100251.2791202-1-yoong.siang.song@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Introduce support for a lowest priority wildcard (catch-all) rule in ethtool's Network Flow Classification (NFC) for the igc driver. The wildcard rule directs all unmatched network traffic, including traffic not captured by Receive Side Scaling (RSS), to a specified queue. This functionality utilizes the Default Queue feature available in I225/I226 hardware. The implementation has been validated on Intel ADL-S systems with two back-to-back connected I226 network interfaces. Testing Procedure: 1. On the Device Under Test (DUT), verify the initial statistic: $ ethtool -S enp1s0 | grep rx_q.*packets rx_queue_0_packets: 0 rx_queue_1_packets: 0 rx_queue_2_packets: 0 rx_queue_3_packets: 0 2. From the Link Partner, send 10 ARP packets: $ arping -c 10 -I enp170s0 169.254.1.2 3. On the DUT, verify the packet reception on Queue 0: $ ethtool -S enp1s0 | grep rx_q.*packets rx_queue_0_packets: 10 rx_queue_1_packets: 0 rx_queue_2_packets: 0 rx_queue_3_packets: 0 4. On the DUT, add a wildcard rule to route all packets to Queue 3: $ sudo ethtool -N enp1s0 flow-type ether queue 3 5. From the Link Partner, send another 10 ARP packets: $ arping -c 10 -I enp170s0 169.254.1.2 6. Now, packets are routed to Queue 3 by the wildcard (Default Queue) rule: $ ethtool -S enp1s0 | grep rx_q.*packets rx_queue_0_packets: 10 rx_queue_1_packets: 0 rx_queue_2_packets: 0 rx_queue_3_packets: 10 7. On the DUT, add a EtherType rule to route ARP packet to Queue 1: $ sudo ethtool -N enp1s0 flow-type ether proto 0x0806 queue 1 8. From the Link Partner, send another 10 ARP packets: $ arping -c 10 -I enp170s0 169.254.1.2 9. Now, packets are routed to Queue 1 by the EtherType rule because it is higher priority than the wildcard (Default Queue) rule: $ ethtool -S enp1s0 | grep rx_q.*packets rx_queue_0_packets: 10 rx_queue_1_packets: 10 rx_queue_2_packets: 0 rx_queue_3_packets: 10 10. On the DUT, delete all the NFC rules: $ sudo ethtool -N enp1s0 delete 63 $ sudo ethtool -N enp1s0 delete 64 11. From the Link Partner, send another 10 ARP packets: $ arping -c 10 -I enp170s0 169.254.1.2 12. Now, packets are routed to Queue 0 because the value of Default Queue is reset back to 0: $ ethtool -S enp1s0 | grep rx_q.*packets rx_queue_0_packets: 20 rx_queue_1_packets: 10 rx_queue_2_packets: 0 rx_queue_3_packets: 10 Reviewed-by: Kurt Kanzenbach Co-developed-by: Blanco Alcaine Hector Signed-off-by: Blanco Alcaine Hector Signed-off-by: Song Yoong Siang Tested-by: Mor Bar-Gabay --- drivers/net/ethernet/intel/igc/igc.h | 11 +++++++--- drivers/net/ethernet/intel/igc/igc_defines.h | 1 + drivers/net/ethernet/intel/igc/igc_ethtool.c | 18 ++++++++++++++++ drivers/net/ethernet/intel/igc/igc_main.c | 22 ++++++++++++++++++++ 4 files changed, 49 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/igc/igc.h b/drivers/net/ethernet/in= tel/igc/igc.h index 0b35e593d5ee..c580ecc954be 100644 --- a/drivers/net/ethernet/intel/igc/igc.h +++ b/drivers/net/ethernet/intel/igc/igc.h @@ -631,6 +631,7 @@ enum igc_filter_match_flags { IGC_FILTER_FLAG_DST_MAC_ADDR =3D BIT(3), IGC_FILTER_FLAG_USER_DATA =3D BIT(4), IGC_FILTER_FLAG_VLAN_ETYPE =3D BIT(5), + IGC_FILTER_FLAG_DEFAULT_QUEUE =3D BIT(6), }; =20 struct igc_nfc_filter { @@ -658,10 +659,14 @@ struct igc_nfc_rule { bool flex; }; =20 -/* IGC supports a total of 32 NFC rules: 16 MAC address based, 8 VLAN prio= rity - * based, 8 ethertype based and 32 Flex filter based rules. +/* IGC supports a total of 65 NFC rules, listed below in order of priority: + * - 16 MAC address based filtering rules (highest priority) + * - 8 ethertype based filtering rules + * - 32 Flex filter based filtering rules + * - 8 VLAN priority based filtering rules + * - 1 default queue rule (lowest priority) */ -#define IGC_MAX_RXNFC_RULES 64 +#define IGC_MAX_RXNFC_RULES 65 =20 struct igc_flex_filter { u8 index; diff --git a/drivers/net/ethernet/intel/igc/igc_defines.h b/drivers/net/eth= ernet/intel/igc/igc_defines.h index d80254f2a278..498ba1522ca4 100644 --- a/drivers/net/ethernet/intel/igc/igc_defines.h +++ b/drivers/net/ethernet/intel/igc/igc_defines.h @@ -391,6 +391,7 @@ #define IGC_MRQC_RSS_FIELD_IPV6_TCP 0x00200000 #define IGC_MRQC_RSS_FIELD_IPV4_UDP 0x00400000 #define IGC_MRQC_RSS_FIELD_IPV6_UDP 0x00800000 +#define IGC_MRQC_DEFAULT_QUEUE_MASK GENMASK(5, 3) =20 /* Header split receive */ #define IGC_RFCTL_IPV6_EX_DIS 0x00010000 diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/eth= ernet/intel/igc/igc_ethtool.c index a7f397b58cd6..ecb35b693ce5 100644 --- a/drivers/net/ethernet/intel/igc/igc_ethtool.c +++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c @@ -1283,6 +1283,24 @@ static void igc_ethtool_init_nfc_rule(struct igc_nfc= _rule *rule, rule->flex =3D true; else rule->flex =3D false; + + /* The wildcard rule is only applied if: + * a) None of the other filtering rules match (match_flags is zero) + * b) The flow type is ETHER_FLOW only (no additional fields set) + * c) Mask for Source MAC address is not specified (all zeros) + * d) Mask for Destination MAC address is not specified (all zeros) + * e) Mask for L2 EtherType is not specified (zero) + * + * If all these conditions are met, the rule is treated as a wildcard + * rule. Default queue feature will be used, so that all packets that do + * not match any other rule will be routed to the default queue. + */ + if (!rule->filter.match_flags && + fsp->flow_type =3D=3D ETHER_FLOW && + is_zero_ether_addr(fsp->m_u.ether_spec.h_source) && + is_zero_ether_addr(fsp->m_u.ether_spec.h_dest) && + !fsp->m_u.ether_spec.h_proto) + rule->filter.match_flags =3D IGC_FILTER_FLAG_DEFAULT_QUEUE; } =20 /** diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethern= et/intel/igc/igc_main.c index 2e12915b42a9..87311ea47018 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -3874,6 +3874,22 @@ static void igc_del_flex_filter(struct igc_adapter *= adapter, wr32(IGC_WUFC, wufc); } =20 +static void igc_set_default_queue_filter(struct igc_adapter *adapter, u32 = queue) +{ + struct igc_hw *hw =3D &adapter->hw; + u32 mrqc =3D rd32(IGC_MRQC); + + mrqc &=3D ~IGC_MRQC_DEFAULT_QUEUE_MASK; + mrqc |=3D FIELD_PREP(IGC_MRQC_DEFAULT_QUEUE_MASK, queue); + wr32(IGC_MRQC, mrqc); +} + +static void igc_reset_default_queue_filter(struct igc_adapter *adapter) +{ + /* Reset the default queue to its default value which is Queue 0 */ + igc_set_default_queue_filter(adapter, 0); +} + static int igc_enable_nfc_rule(struct igc_adapter *adapter, struct igc_nfc_rule *rule) { @@ -3912,6 +3928,9 @@ static int igc_enable_nfc_rule(struct igc_adapter *ad= apter, return err; } =20 + if (rule->filter.match_flags & IGC_FILTER_FLAG_DEFAULT_QUEUE) + igc_set_default_queue_filter(adapter, rule->action); + return 0; } =20 @@ -3939,6 +3958,9 @@ static void igc_disable_nfc_rule(struct igc_adapter *= adapter, if (rule->filter.match_flags & IGC_FILTER_FLAG_DST_MAC_ADDR) igc_del_mac_filter(adapter, IGC_MAC_FILTER_TYPE_DST, rule->filter.dst_addr); + + if (rule->filter.match_flags & IGC_FILTER_FLAG_DEFAULT_QUEUE) + igc_reset_default_queue_filter(adapter); } =20 /** --=20 2.34.1