{"id":2221738,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2221738/?format=json","web_url":"http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260410074921.1254213-10-aleksandr.loktionov@intel.com/","project":{"id":46,"url":"http://patchwork.ozlabs.org/api/1.1/projects/46/?format=json","name":"Intel Wired Ethernet development","link_name":"intel-wired-lan","list_id":"intel-wired-lan.osuosl.org","list_email":"intel-wired-lan@osuosl.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260410074921.1254213-10-aleksandr.loktionov@intel.com>","date":"2026-04-10T07:49:20","name":"[iwl-next,9/10] ice: use inline helpers instead of memcmp() for IPv6 mask checks in ice_ethtool_fdir","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"a6e049594b680fb0983340ad3d3ba6720495a9d2","submitter":{"id":75597,"url":"http://patchwork.ozlabs.org/api/1.1/people/75597/?format=json","name":"Loktionov, Aleksandr","email":"aleksandr.loktionov@intel.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260410074921.1254213-10-aleksandr.loktionov@intel.com/mbox/","series":[{"id":499419,"url":"http://patchwork.ozlabs.org/api/1.1/series/499419/?format=json","web_url":"http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=499419","date":"2026-04-10T07:49:11","name":"ice: misc cleanups and improvements","version":1,"mbox":"http://patchwork.ozlabs.org/series/499419/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2221738/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2221738/checks/","tags":{},"headers":{"Return-Path":"<intel-wired-lan-bounces@osuosl.org>","X-Original-To":["incoming@patchwork.ozlabs.org","intel-wired-lan@lists.osuosl.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","intel-wired-lan@lists.osuosl.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256\n header.s=default header.b=JvdxamIR;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=140.211.166.136; helo=smtp3.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fsTV90tMrz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 17:49:53 +1000 (AEST)","from localhost (localhost [127.0.0.1])\n\tby smtp3.osuosl.org (Postfix) with ESMTP id 75F6260BB3;\n\tFri, 10 Apr 2026 07:49:41 +0000 (UTC)","from smtp3.osuosl.org ([127.0.0.1])\n by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id RkIitNhAwChs; Fri, 10 Apr 2026 07:49:40 +0000 (UTC)","from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142])\n\tby smtp3.osuosl.org (Postfix) with ESMTP id AB8CB60880;\n\tFri, 10 Apr 2026 07:49:40 +0000 (UTC)","from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n by lists1.osuosl.org (Postfix) with ESMTP id 735CE1F6\n for <intel-wired-lan@lists.osuosl.org>; Fri, 10 Apr 2026 07:49:39 +0000 (UTC)","from localhost (localhost [127.0.0.1])\n by smtp1.osuosl.org (Postfix) with ESMTP id 598A981A81\n for <intel-wired-lan@lists.osuosl.org>; Fri, 10 Apr 2026 07:49:39 +0000 (UTC)","from smtp1.osuosl.org ([127.0.0.1])\n by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id hd_umFQIDaV5 for <intel-wired-lan@lists.osuosl.org>;\n Fri, 10 Apr 2026 07:49:38 +0000 (UTC)","from mgamail.intel.com (mgamail.intel.com [198.175.65.16])\n by smtp1.osuosl.org (Postfix) with ESMTPS id 5B26C816EE\n for <intel-wired-lan@lists.osuosl.org>; Fri, 10 Apr 2026 07:49:38 +0000 (UTC)","from orviesa008.jf.intel.com ([10.64.159.148])\n by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 10 Apr 2026 00:49:38 -0700","from amlin-019-225.igk.intel.com ([10.102.19.225])\n by orviesa008.jf.intel.com with ESMTP; 10 Apr 2026 00:49:37 -0700"],"X-Virus-Scanned":["amavis at osuosl.org","amavis at osuosl.org"],"X-Comment":"SPF check N/A for local connections - client-ip=140.211.166.142;\n helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=<UNKNOWN> ","DKIM-Filter":["OpenDKIM Filter v2.11.0 smtp3.osuosl.org AB8CB60880","OpenDKIM Filter v2.11.0 smtp1.osuosl.org 5B26C816EE"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org;\n\ts=default; t=1775807380;\n\tbh=Jwcl3Qdav8RvydIKl0s+Wt5lhJ2UrYGx01R1Tp4cJr0=;\n\th=From:To:Cc:Date:In-Reply-To:References:Subject:List-Id:\n\t List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:\n\t From;\n\tb=JvdxamIRM2dRcGpMr/mL9X5IdoVQQfMtJK/lYKRLwIizjLYKU4oVUlxhsMdajtceB\n\t lAhFImxy+xPluV3tyGwOCBokoH80afXm3ZwGT6G4Od50mPvaiUe8lRd++M/ihejn7l\n\t av6TZmPGD7CCrWw1mGWTWwvqeqPxLYriDrhj34DisqitrMLbAt+s/H0Lz2oBy2F6La\n\t evYRpv++U/v87S34XSUkSM7m7TCDm/r2+rqoZ3O3tR0IYVV9YFXlogYdCT/GbIxc9o\n\t ruvub4VuExGjXDvcTK/HsGuoLAW99nA88RmLtO8KzOtQ+UoPUzfz6mTGeMmOnTsIkK\n\t acM10wOCf2FFg==","Received-SPF":"Pass (mailfrom) identity=mailfrom; client-ip=198.175.65.16;\n helo=mgamail.intel.com; envelope-from=aleksandr.loktionov@intel.com;\n receiver=<UNKNOWN>","DMARC-Filter":"OpenDMARC Filter v1.4.2 smtp1.osuosl.org 5B26C816EE","X-CSE-ConnectionGUID":["maUm4tOgQOqq8wc4aVh2QA==","zT8ceFmrThObprmwK0C0cg=="],"X-CSE-MsgGUID":["8hR+Nq77SAq05rYLIuGeFQ==","b+wSATUkTWCA7gjGbjtZlw=="],"X-IronPort-AV":["E=McAfee;i=\"6800,10657,11754\"; a=\"77007945\"","E=Sophos;i=\"6.23,171,1770624000\"; d=\"scan'208\";a=\"77007945\"","E=Sophos;i=\"6.23,171,1770624000\"; d=\"scan'208\";a=\"228941906\""],"X-ExtLoop1":"1","From":"Aleksandr Loktionov <aleksandr.loktionov@intel.com>","To":"intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com,\n aleksandr.loktionov@intel.com","Cc":"netdev@vger.kernel.org,\n\tLarysa Zaremba <larysa.zaremba@intel.com>","Date":"Fri, 10 Apr 2026 09:49:20 +0200","Message-ID":"<20260410074921.1254213-10-aleksandr.loktionov@intel.com>","X-Mailer":"git-send-email 2.52.0","In-Reply-To":"<20260410074921.1254213-1-aleksandr.loktionov@intel.com>","References":"<20260410074921.1254213-1-aleksandr.loktionov@intel.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Mailman-Original-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1775807378; x=1807343378;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=/GsckPs+NdN9rChj/2Ywk80a8qYQmlKLwO31lOo/oAA=;\n b=GTbEJEHzMxvfC9iI0ml3AGy7t/6T6ycaZNp+yI/r1TVHch4mbMV8K1yP\n d1TQt3eAWhINmbV/MH29Ek3xadMWBpT5nDS4/WzBjS0QOJ9VPP1k8Ubm4\n Kf+V75ZzM0ymS6jf3u7PUb+S7OodvG86HqA+agBmxscZSnOLS3wo4Mtde\n nvFPHE3qSk7cLt5NaN1NCX2VHwMTjLLkQHLs+Z3KURAfUxiiOOZr9F5UT\n 16VQOKY73MiuJ6Y7mYGHYAbaoqRV/gCqDwbtGt3Z83XExPNN0aaKCE+54\n ZFo1sEBeO0Cbuav0sv125ezCjAIIKD20A/GgB06n2isk2n7y8dViUIsBp\n Q==;","X-Mailman-Original-Authentication-Results":["smtp1.osuosl.org;\n dmarc=pass (p=none dis=none)\n header.from=intel.com","smtp1.osuosl.org;\n dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com\n header.a=rsa-sha256 header.s=Intel header.b=GTbEJEHz"],"Subject":"[Intel-wired-lan] [PATCH iwl-next 9/10] ice: use inline helpers\n instead of memcmp() for IPv6 mask checks in ice_ethtool_fdir","X-BeenThere":"intel-wired-lan@osuosl.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Intel Wired Ethernet Linux Kernel Driver Development\n <intel-wired-lan.osuosl.org>","List-Unsubscribe":"<https://lists.osuosl.org/mailman/options/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>","List-Archive":"<http://lists.osuosl.org/pipermail/intel-wired-lan/>","List-Post":"<mailto:intel-wired-lan@osuosl.org>","List-Help":"<mailto:intel-wired-lan-request@osuosl.org?subject=help>","List-Subscribe":"<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>","Errors-To":"intel-wired-lan-bounces@osuosl.org","Sender":"\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"},"content":"Replace static full_ipv6_addr_mask / zero_ipv6_addr_mask structs\nand the associated memcmp() calls in ice_ethtool_fdir.c with the\nkernel-provided ipv6_addr_any() helper and a new ice_ipv6_mask_full()\ninline, reducing boilerplate and making intent clearer.\n\nSuggested-by: Larysa Zaremba <larysa.zaremba@intel.com>\nSigned-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>\n---\n .../net/ethernet/intel/ice/ice_ethtool_fdir.c | 57 ++++++-------------\n 1 file changed, 16 insertions(+), 41 deletions(-)","diff":"diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c b/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c\nindex aceec18..1d7c595 100644\n--- a/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c\n+++ b/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c\n@@ -8,23 +8,10 @@\n #include \"ice_fdir.h\"\n #include \"ice_flow.h\"\n \n-static struct in6_addr full_ipv6_addr_mask = {\n-\t.in6_u = {\n-\t\t.u6_addr8 = {\n-\t\t\t0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,\n-\t\t\t0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,\n-\t\t}\n-\t}\n-};\n-\n-static struct in6_addr zero_ipv6_addr_mask = {\n-\t.in6_u = {\n-\t\t.u6_addr8 = {\n-\t\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n-\t\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n-\t\t}\n-\t}\n-};\n+static bool ice_ipv6_mask_full(const __be32 *a)\n+{\n+\treturn (a[0] & a[1] & a[2] & a[3]) == cpu_to_be32(0xffffffff);\n+}\n \n /* calls to ice_flow_add_prof require the number of segments in the array\n  * for segs_cnt. In this code that is one more than the index.\n@@ -1070,10 +1057,8 @@ ice_set_fdir_ip6_seg(struct ice_flow_seg_info *seg,\n \tenum ice_flow_field src_port, dst_port;\n \n \t/* make sure we don't have any empty rule */\n-\tif (!memcmp(tcp_ip6_spec->ip6src, &zero_ipv6_addr_mask,\n-\t\t    sizeof(struct in6_addr)) &&\n-\t    !memcmp(tcp_ip6_spec->ip6dst, &zero_ipv6_addr_mask,\n-\t\t    sizeof(struct in6_addr)) &&\n+\tif (ipv6_addr_any((struct in6_addr *)tcp_ip6_spec->ip6src) &&\n+\t    ipv6_addr_any((struct in6_addr *)tcp_ip6_spec->ip6dst) &&\n \t    !tcp_ip6_spec->psrc && !tcp_ip6_spec->pdst)\n \t\treturn -EINVAL;\n \n@@ -1097,24 +1082,20 @@ ice_set_fdir_ip6_seg(struct ice_flow_seg_info *seg,\n \t*perfect_fltr = true;\n \tICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_IPV6 | l4_proto);\n \n-\tif (!memcmp(tcp_ip6_spec->ip6src, &full_ipv6_addr_mask,\n-\t\t    sizeof(struct in6_addr)))\n+\tif (ice_ipv6_mask_full(tcp_ip6_spec->ip6src))\n \t\tice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_IPV6_SA,\n \t\t\t\t ICE_FLOW_FLD_OFF_INVAL, ICE_FLOW_FLD_OFF_INVAL,\n \t\t\t\t ICE_FLOW_FLD_OFF_INVAL, false);\n-\telse if (!memcmp(tcp_ip6_spec->ip6src, &zero_ipv6_addr_mask,\n-\t\t\t sizeof(struct in6_addr)))\n+\telse if (ipv6_addr_any((struct in6_addr *)tcp_ip6_spec->ip6src))\n \t\t*perfect_fltr = false;\n \telse\n \t\treturn -EOPNOTSUPP;\n \n-\tif (!memcmp(tcp_ip6_spec->ip6dst, &full_ipv6_addr_mask,\n-\t\t    sizeof(struct in6_addr)))\n+\tif (ice_ipv6_mask_full(tcp_ip6_spec->ip6dst))\n \t\tice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_IPV6_DA,\n \t\t\t\t ICE_FLOW_FLD_OFF_INVAL, ICE_FLOW_FLD_OFF_INVAL,\n \t\t\t\t ICE_FLOW_FLD_OFF_INVAL, false);\n-\telse if (!memcmp(tcp_ip6_spec->ip6dst, &zero_ipv6_addr_mask,\n-\t\t\t sizeof(struct in6_addr)))\n+\telse if (ipv6_addr_any((struct in6_addr *)tcp_ip6_spec->ip6dst))\n \t\t*perfect_fltr = false;\n \telse\n \t\treturn -EOPNOTSUPP;\n@@ -1167,33 +1148,27 @@ ice_set_fdir_ip6_usr_seg(struct ice_flow_seg_info *seg,\n \tif (usr_ip6_spec->l4_proto)\n \t\treturn -EOPNOTSUPP;\n \t/* empty rules are not valid */\n-\tif (!memcmp(usr_ip6_spec->ip6src, &zero_ipv6_addr_mask,\n-\t\t    sizeof(struct in6_addr)) &&\n-\t    !memcmp(usr_ip6_spec->ip6dst, &zero_ipv6_addr_mask,\n-\t\t    sizeof(struct in6_addr)))\n+\tif (ipv6_addr_any((struct in6_addr *)usr_ip6_spec->ip6src) &&\n+\t    ipv6_addr_any((struct in6_addr *)usr_ip6_spec->ip6dst))\n \t\treturn -EINVAL;\n \n \t*perfect_fltr = true;\n \tICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_IPV6);\n \n-\tif (!memcmp(usr_ip6_spec->ip6src, &full_ipv6_addr_mask,\n-\t\t    sizeof(struct in6_addr)))\n+\tif (ice_ipv6_mask_full(usr_ip6_spec->ip6src))\n \t\tice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_IPV6_SA,\n \t\t\t\t ICE_FLOW_FLD_OFF_INVAL, ICE_FLOW_FLD_OFF_INVAL,\n \t\t\t\t ICE_FLOW_FLD_OFF_INVAL, false);\n-\telse if (!memcmp(usr_ip6_spec->ip6src, &zero_ipv6_addr_mask,\n-\t\t\t sizeof(struct in6_addr)))\n+\telse if (ipv6_addr_any((struct in6_addr *)usr_ip6_spec->ip6src))\n \t\t*perfect_fltr = false;\n \telse\n \t\treturn -EOPNOTSUPP;\n \n-\tif (!memcmp(usr_ip6_spec->ip6dst, &full_ipv6_addr_mask,\n-\t\t    sizeof(struct in6_addr)))\n+\tif (ice_ipv6_mask_full(usr_ip6_spec->ip6dst))\n \t\tice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_IPV6_DA,\n \t\t\t\t ICE_FLOW_FLD_OFF_INVAL, ICE_FLOW_FLD_OFF_INVAL,\n \t\t\t\t ICE_FLOW_FLD_OFF_INVAL, false);\n-\telse if (!memcmp(usr_ip6_spec->ip6dst, &zero_ipv6_addr_mask,\n-\t\t\t sizeof(struct in6_addr)))\n+\telse if (ipv6_addr_any((struct in6_addr *)usr_ip6_spec->ip6dst))\n \t\t*perfect_fltr = false;\n \telse\n \t\treturn -EOPNOTSUPP;\n","prefixes":["iwl-next","9/10"]}