From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) (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 8DD093DB652; Fri, 8 May 2026 12:03:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.156.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778241826; cv=none; b=bs3Ru9LNR11pdHLwotj1XJX68WcYqZ1Rmlniy5LyKFg/FfHp4RUBSq+jpy/8IcpPP8K+CIZeMtPeKv9SEwT3wYcBVSundU33Ezvl4kzNjEABmPt5AK0CZNGB4Fdb6Ujq6i1aheIIFDHwV9wx2rWkAUE3TFMYIGRVKnt+OL65H0A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778241826; c=relaxed/simple; bh=PhY45nTJrZsT2sZclP3aMDoTnqVhyD7cWv/vottTDkE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=afdw6vu5CraL/SCZs3SwtRpS9S3ZyQlN4+MUgwGqgPg2ma043VKO3SzZw+f95jhb7qrQrqgKXuoF6WPEOLFYKNKVV1m4GDp8oZtfmADdxUVjryWRb+tMLuBFSsDSiZFkS6GJ8FCwFjRSLaV1eaO3MYsWnyFTnZpZpVqmwVXLH10= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=AgaC3Jzy; arc=none smtp.client-ip=67.231.156.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="AgaC3Jzy" Received: from pps.filterd (m0431383.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 648BPU5q2841684; Fri, 8 May 2026 05:03:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=0 UsXOIb7sjUhVm9XZcULBy90X19VInSaFQauJs8V39c=; b=AgaC3Jzy4DxrEBBDE 9xl+WFTKDGCxfZfljRouP5QzmdFyUkOvFe8ydKDkj6vRDeLP7gJ8Gw0klTpnpYfI YQ7iIdaehTtK8fowHzrHl3Ub/SMY2mmLwlMpXik08ZjuAn18d5etRQnlC8QqriK4 Ps5mT00llcf3qSk7rmxTAMH+fuwi7870gdMoV8eAS9Q/oepaEM01L2IxnIBKRv32 WqturtIulKR2Q0V/yqEJmniNG6Zqz8cltXfl5Acp4qXjd75cchzYvRKRjfzmjcA7 hJi19hjTFR+U0kPKOaRBAODW2YsEL6d4yoVEKkJlVdO1eZ6EZtjI4bzsSz2Ff6TC 5BayQ== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 4e14g0hqur-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 08 May 2026 05:03:21 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.25; Fri, 8 May 2026 05:03:19 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.25 via Frontend Transport; Fri, 8 May 2026 05:03:19 -0700 Received: from BG-LT92649.marvell.com (BG-LT92649.marvell.com [10.28.166.218]) by maili.marvell.com (Postfix) with ESMTP id EC4573F7087; Fri, 8 May 2026 05:03:14 -0700 (PDT) From: To: CC: , , , , , , , , , , Sukhdeep Singh Subject: [PATCH net-next v2 2/9] net: atlantic: move active_ipv4/ipv6 bitmap updates after HW write updates after HW write Date: Fri, 8 May 2026 17:31:49 +0530 Message-ID: <20260508120156.3060-3-sukhdeeps@marvell.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260508120156.3060-1-sukhdeeps@marvell.com> References: <20260506135706.2834-1-sukhdeeps@marvell.com> <20260508120156.3060-1-sukhdeeps@marvell.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: XyNTtVopkcfsw2HA8OvBUdpitcZCyVRu X-Authority-Analysis: v=2.4 cv=bMUm5v+Z c=1 sm=1 tr=0 ts=69fdd109 cx=c_pps a=rEv8fa4AjpPjGxpoe8rlIQ==:117 a=rEv8fa4AjpPjGxpoe8rlIQ==:17 a=NGcC8JguVDcA:10 a=VkNPw1HP01LnGYTKEx00:22 a=l0iWHRpgs5sLHlkKQ1IR:22 a=qit2iCtTFQkLgVSMPQTB:22 a=M5GUcnROAAAA:8 a=gSoh3b3hW_7NMvOQyb8A:9 a=OBjm3rFKGHvpk9ecZwUJ:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTA4MDEyNSBTYWx0ZWRfX/Ne1hVGwsQV/ Ptd6Sm98wkVor23lLMOCjLcAKIyX/SVk5Pdxb1EmybkpMp7p4sFuVZxlZzuClTceqA9q/1GG+5F 4NG34FxbS6To1f3RuNWSv6tBMBJyUIjWisKNwKt8Dmd2E9Wdm5ncVoir73wd+zMNngBnvJ60giS bQJBkvDuFHzB1qgIInnVXiCCrfcPKr5iOVyVHrhoyezCtA8WDKlx8KW/Dmcwz9mU/XrYHVcDIHv a/zjWkGPpwDBVrYZP5rIsqiWK4GqbbGOdx8M6GsgZ4AFwk27osG4RMmHrRntXhbabJWVcIOEpcg SrzH+0Hqb0ngaghxnGh6Kr5+bbCvCWS/BGcLdurmKRUnK5jWOU3HTyXENV7JmC/+dCkRp50sxvZ M5tp6Cqxmvjv+c9pK+fDJqsIKRc4TNOjLpys6Fjcvvu2j25//nRV5U8lJdLNPGMKYTLxB9OOkp6 v5JwOSphMaWdOHzcRkA== X-Proofpoint-GUID: XyNTtVopkcfsw2HA8OvBUdpitcZCyVRu X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-05-07_02,2026-05-06_01,2025-10-01_01 From: Sukhdeep Singh Move active_ipv4/active_ipv6 bitmap updates from aq_set_data_fl3l4() into aq_add_del_fl3l4() after the hardware write succeeds. The bitmaps track which filter slots are actively programmed in hardware and must only be updated once the HW write is confirmed. Also remove bitmap manipulation from aq_nic_reserve_filter() and aq_nic_release_filter(). These functions manage filter slot reservation counts, not HW filter state. Setting active_ipv4 bits at reservation time (before any filter is programmed) and clearing them at release time (regardless of HW state) results in incorrect state visible to aq_check_approve_fl3l4() for IPv4/IPv6 mixing validation. This corrected state management is required for the AQC113 L3L4 filter path introduced later in this series. Signed-off-by: Sukhdeep Singh --- .../ethernet/aquantia/atlantic/aq_filters.c | 36 ++++++++++++------- .../net/ethernet/aquantia/atlantic/aq_nic.c | 3 -- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_filters.c b/drivers/net/ethernet/aquantia/atlantic/aq_filters.c index eef52f23166d..150a0b1af26a 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_filters.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_filters.c @@ -479,15 +479,8 @@ static int aq_set_data_fl3l4(struct aq_nic_s *aq_nic, data->is_ipv6 = rx_fltrs->fl3l4.is_ipv6; data->location = HW_ATL_GET_REG_LOCATION_FL3L4(fsp->location); - if (!add) { - if (!data->is_ipv6) - rx_fltrs->fl3l4.active_ipv4 &= ~BIT(data->location); - else - rx_fltrs->fl3l4.active_ipv6 &= - ~BIT((data->location) / 4); - + if (!add) return 0; - } data->cmd |= HW_ATL_RX_ENABLE_FLTR_L3L4; @@ -515,11 +508,9 @@ static int aq_set_data_fl3l4(struct aq_nic_s *aq_nic, ntohl(fsp->h_u.tcp_ip4_spec.ip4src); data->ip_dst[0] = ntohl(fsp->h_u.tcp_ip4_spec.ip4dst); - rx_fltrs->fl3l4.active_ipv4 |= BIT(data->location); } else { int i; - rx_fltrs->fl3l4.active_ipv6 |= BIT((data->location) / 4); for (i = 0; i < HW_ATL_RX_CNT_REG_ADDR_IPV6; ++i) { data->ip_dst[i] = ntohl(fsp->h_u.tcp_ip6_spec.ip6dst[i]); @@ -574,16 +565,35 @@ static int aq_set_fl3l4(struct aq_hw_s *aq_hw, static int aq_add_del_fl3l4(struct aq_nic_s *aq_nic, struct aq_rx_filter *aq_rx_fltr, bool add) { + struct aq_hw_rx_fltrs_s *rx_fltrs = aq_get_hw_rx_fltrs(aq_nic); const struct aq_hw_ops *aq_hw_ops = aq_nic->aq_hw_ops; struct aq_hw_s *aq_hw = aq_nic->aq_hw; struct aq_rx_filter_l3l4 data; + int err; if (unlikely(aq_rx_fltr->aq_fsp.location < AQ_RX_FIRST_LOC_FL3L4 || - aq_rx_fltr->aq_fsp.location > AQ_RX_LAST_LOC_FL3L4 || - aq_set_data_fl3l4(aq_nic, aq_rx_fltr, &data, add))) + aq_rx_fltr->aq_fsp.location > AQ_RX_LAST_LOC_FL3L4)) return -EINVAL; - return aq_set_fl3l4(aq_hw, aq_hw_ops, &data); + aq_set_data_fl3l4(aq_nic, aq_rx_fltr, &data, add); + + err = aq_set_fl3l4(aq_hw, aq_hw_ops, &data); + if (err) + return err; + + if (add) { + if (!data.is_ipv6) + rx_fltrs->fl3l4.active_ipv4 |= BIT(data.location); + else + rx_fltrs->fl3l4.active_ipv6 |= BIT(data.location / 4); + } else { + if (!data.is_ipv6) + rx_fltrs->fl3l4.active_ipv4 &= ~BIT(data.location); + else + rx_fltrs->fl3l4.active_ipv6 &= ~BIT(data.location / 4); + } + + return 0; } static int aq_add_del_rule(struct aq_nic_s *aq_nic, diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c index ef9447810071..3cec853e9fad 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c @@ -1522,8 +1522,6 @@ u8 aq_nic_reserve_filter(struct aq_nic_s *self, enum aq_rx_filter_type type) case aq_rx_filter_l3l4: fltr_cnt = AQ_RX_LAST_LOC_FL3L4 - AQ_RX_FIRST_LOC_FL3L4; n_bit = fltr_cnt - self->aq_hw_rx_fltrs.fl3l4.reserved_count; - - self->aq_hw_rx_fltrs.fl3l4.active_ipv4 |= BIT(n_bit); self->aq_hw_rx_fltrs.fl3l4.reserved_count++; location = n_bit; break; @@ -1543,7 +1541,6 @@ void aq_nic_release_filter(struct aq_nic_s *self, enum aq_rx_filter_type type, break; case aq_rx_filter_l3l4: self->aq_hw_rx_fltrs.fl3l4.reserved_count--; - self->aq_hw_rx_fltrs.fl3l4.active_ipv4 &= ~BIT(location); break; default: break; -- 2.43.0