{"id":2234729,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2234729/?format=json","web_url":"http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260508031226.3601800-4-aleksandr.loktionov@intel.com/","project":{"id":46,"url":"http://patchwork.ozlabs.org/api/1.2/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":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260508031226.3601800-4-aleksandr.loktionov@intel.com>","list_archive_url":null,"date":"2026-05-08T03:12:21","name":"[iwl-next,3/8] ixgbe: prevent adding duplicate FDIR perfect filter rules","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"6e607851155474860e1378783e79871551bd9f27","submitter":{"id":75597,"url":"http://patchwork.ozlabs.org/api/1.2/people/75597/?format=json","name":"Loktionov, Aleksandr","email":"aleksandr.loktionov@intel.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260508031226.3601800-4-aleksandr.loktionov@intel.com/mbox/","series":[{"id":503311,"url":"http://patchwork.ozlabs.org/api/1.2/series/503311/?format=json","web_url":"http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=503311","date":"2026-05-08T03:12:18","name":"ixgbe: small cleanups and improvements","version":1,"mbox":"http://patchwork.ozlabs.org/series/503311/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2234729/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2234729/checks/","tags":{},"related":[],"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=m8sv6WCh;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137])\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 4gBZ1Q2Y8Lz1yJq\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 13:12:42 +1000 (AEST)","from localhost (localhost [127.0.0.1])\n\tby smtp4.osuosl.org (Postfix) with ESMTP id E27BE4145A;\n\tFri,  8 May 2026 03:12:37 +0000 (UTC)","from smtp4.osuosl.org ([127.0.0.1])\n by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id MpLtBE51b_or; Fri,  8 May 2026 03:12:37 +0000 (UTC)","from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142])\n\tby smtp4.osuosl.org (Postfix) with ESMTP id 18CDF41455;\n\tFri,  8 May 2026 03:12:37 +0000 (UTC)","from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n by lists1.osuosl.org (Postfix) with ESMTP id 1AA38317\n for <intel-wired-lan@lists.osuosl.org>; Fri,  8 May 2026 03:12:35 +0000 (UTC)","from localhost (localhost [127.0.0.1])\n by smtp2.osuosl.org (Postfix) with ESMTP id 00B3E409B3\n for <intel-wired-lan@lists.osuosl.org>; Fri,  8 May 2026 03:12:35 +0000 (UTC)","from smtp2.osuosl.org ([127.0.0.1])\n by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id aHDDLJN0cN1A for <intel-wired-lan@lists.osuosl.org>;\n Fri,  8 May 2026 03:12:34 +0000 (UTC)","from mgamail.intel.com (mgamail.intel.com [192.198.163.17])\n by smtp2.osuosl.org (Postfix) with ESMTPS id F0E634030E\n for <intel-wired-lan@lists.osuosl.org>; Fri,  8 May 2026 03:12:33 +0000 (UTC)","from fmviesa005.fm.intel.com ([10.60.135.145])\n by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 07 May 2026 20:12:34 -0700","from amlin-019-225.igk.intel.com ([10.102.19.225])\n by fmviesa005.fm.intel.com with ESMTP; 07 May 2026 20:12:32 -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 smtp4.osuosl.org 18CDF41455","OpenDKIM Filter v2.11.0 smtp2.osuosl.org F0E634030E"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org;\n\ts=default; t=1778209957;\n\tbh=bh/oORBLNQ2x5kaaL0oP0C72RNUJz4SGrmtRKwH9lvs=;\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=m8sv6WChwveKUxmurqQdmUFcvuvg/Rly50v4LO8EpJpXOjf+uLe0ojR6b6tqccGE6\n\t lTAPoKfNCxe7R3ZbjWnjkBOSzfkD9ZB5mOyixVDg1Y6QYRaRmvwU5e628EHzSQ+eYl\n\t rCuplk1o+zzlalNdTzWeWKAX5eEipndjux/5Rofia4/fJIu7dDJdubyREZqVsyPjzY\n\t T6Gra0bprBWy96ruKjDx1Vav9fTExKJ3YjYoPNjwqaXm+9GJ7g2iEMn8sgnyLZHHYm\n\t sS9Y4/omgpwhV0Lz8lfmBfYrAbtidYpZ9IQr405sfCtIOKg9RZcUt7ctK85pCYh5Nr\n\t ZStzsd/hC8uiQ==","Received-SPF":"Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.17;\n helo=mgamail.intel.com; envelope-from=aleksandr.loktionov@intel.com;\n receiver=<UNKNOWN>","DMARC-Filter":"OpenDMARC Filter v1.4.2 smtp2.osuosl.org F0E634030E","X-CSE-ConnectionGUID":["FNIWQ54zRo2cNoUvCp0RUw==","64ZNGCcPTIG3odcucKXIjw=="],"X-CSE-MsgGUID":["gFkayHSPTRu5x90ZQilYLA==","LUJ9MZl+RIWFn0YYHfHPhw=="],"X-IronPort-AV":["E=McAfee;i=\"6800,10657,11779\"; a=\"79027501\"","E=Sophos;i=\"6.23,222,1770624000\"; d=\"scan'208\";a=\"79027501\"","E=Sophos;i=\"6.23,222,1770624000\"; d=\"scan'208\";a=\"241623191\""],"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\tPiotr Skajewski <piotrx.skajewski@intel.com>","Date":"Fri,  8 May 2026 05:12:21 +0200","Message-ID":"<20260508031226.3601800-4-aleksandr.loktionov@intel.com>","X-Mailer":"git-send-email 2.52.0","In-Reply-To":"<20260508031226.3601800-1-aleksandr.loktionov@intel.com>","References":"<20260508031226.3601800-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=1778209954; x=1809745954;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=eNkuLWRPSYTLbgVnN8ZTLbezDayq2V1B+TaYvmbS3UQ=;\n b=NGZS+pM6gDcFbB2LOj1Z15MV3dnjMoPNqHjcksds+Wp+tZoMf4UgPKX5\n Oczpxf89dN3Rus6Ks9U0o8zXnqieMkRKIFnpxiSkjZzbf/rmcmajQvr2w\n JJt0KDegKrySY8faDLTjC+iI5CWElrF0Dh+Ymz+ROvnMdB8yVCs7QngTy\n wdyW0PEZ7GP3GM08LxkTbTljY65OV7ibVtgmU1dCHODWoPxHuJTzkesxT\n +FZHXx5BvjPxYy7VO4vU+H40Pqiu2YTZuGEruSJCk0OG95gGcXLvvKynD\n tLCPpPbX7Y8kJu6nP39DV/VwxNOgvBEyahQs0U2o0od/wn9kZ7E4R+l8l\n w==;","X-Mailman-Original-Authentication-Results":["smtp2.osuosl.org;\n dmarc=pass (p=none dis=none)\n header.from=intel.com","smtp2.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=NGZS+pM6"],"Subject":"[Intel-wired-lan] [PATCH iwl-next 3/8] ixgbe: prevent adding\n duplicate FDIR perfect filter rules","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":"From: Piotr Skajewski <piotrx.skajewski@intel.com>\n\nWhen the same flow specification is added twice (same 5-tuple with\ndifferent sw_idx values), ixgbe_add_ethtool_fdir_entry() silently\nprograms the duplicate into hardware using a second FDIR table slot.\nThis wastes a scarce FDIR entry and can cause confusing behaviour\nwhen deleting rules.\n\nAdd a helper ixgbe_match_ethtool_fdir_entry() that walks the in-kernel\nfilter list before programming hardware.  If an entry with an\nidentical filter (excluding the sw_idx) already exists, the new add\nrequest is rejected with -EEXIST.\n\nSigned-off-by: Piotr Skajewski <piotrx.skajewski@intel.com>\nSigned-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>\n---\n .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c  | 27 +++++++++++++++++--\n 1 file changed, 25 insertions(+), 2 deletions(-)","diff":"diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c\nindex ba049b3..a2009df 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c\n@@ -2938,6 +2938,23 @@ static int ixgbe_flowspec_to_flow_type(struct ethtool_rx_flow_spec *fsp,\n \treturn 1;\n }\n \n+static bool ixgbe_match_ethtool_fdir_entry(struct ixgbe_adapter *adapter,\n+\t\t\t\t\t   struct ixgbe_fdir_filter *input)\n+{\n+\tstruct ixgbe_fdir_filter *rule = NULL;\n+\n+\thlist_for_each_entry(rule, &adapter->fdir_filter_list, fdir_node) {\n+\t\tif (rule->sw_idx == input->sw_idx)\n+\t\t\tcontinue;\n+\t\tif (!memcmp(&rule->filter, &input->filter,\n+\t\t\t    sizeof(rule->filter))) {\n+\t\t\te_warn(drv, \"FDIR filter already exists\\n\");\n+\t\t\treturn true;\n+\t\t}\n+\t}\n+\treturn false;\n+}\n+\n static int ixgbe_add_ethtool_fdir_entry(struct ixgbe_adapter *adapter,\n \t\t\t\t\tstruct ethtool_rxnfc *cmd)\n {\n@@ -2947,7 +2964,7 @@ static int ixgbe_add_ethtool_fdir_entry(struct ixgbe_adapter *adapter,\n \tstruct ixgbe_fdir_filter *input;\n \tunion ixgbe_atr_input mask;\n \tu8 queue;\n-\tint err;\n+\tint err = -EINVAL;\n \n \tif (!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE))\n \t\treturn -EOPNOTSUPP;\n@@ -3050,6 +3067,12 @@ static int ixgbe_add_ethtool_fdir_entry(struct ixgbe_adapter *adapter,\n \t/* apply mask and compute/store hash */\n \tixgbe_atr_compute_perfect_hash_82599(&input->filter, &mask);\n \n+\t/* check for a duplicate filter */\n+\tif (ixgbe_match_ethtool_fdir_entry(adapter, input)) {\n+\t\terr = -EEXIST;\n+\t\tgoto err_out_w_lock;\n+\t}\n+\n \t/* program filters to filter memory */\n \terr = ixgbe_fdir_write_perfect_filter_82599(hw,\n \t\t\t\t&input->filter, input->sw_idx, queue);\n@@ -3065,7 +3088,7 @@ static int ixgbe_add_ethtool_fdir_entry(struct ixgbe_adapter *adapter,\n \tspin_unlock(&adapter->fdir_perfect_lock);\n err_out:\n \tkfree(input);\n-\treturn -EINVAL;\n+\treturn err;\n }\n \n static int ixgbe_del_ethtool_fdir_entry(struct ixgbe_adapter *adapter,\n","prefixes":["iwl-next","3/8"]}