From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) (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 D93453DB337; Wed, 10 Jun 2026 11:55:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.148.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781092520; cv=none; b=mwVsk/pnFCvnH6fprVVe4UjFUjRe5lI1AZf3L1iwpcwcEisVEnPSIAX/77qpemKrgHmgtRmQJ0vgApfdHoIiOTteqe4klM70L70FI9F5jMfHZc6aZETSdtHJYsc0Hx8BUOMd4tOxFrtBmdGwz2oBOTrYjng0BDHealS72PxAycQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781092520; c=relaxed/simple; bh=2Fr9Gu0QhvY6MDVRVAgKv/0duU0nkIHHf6ZVRHEl0uo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uZB/QueUIp7L4xLgXV0r9KcmxJHYe9uh3ZBdIi+ohkJI4yuOCz5QCRMH3cNMfQBuaKfqaBlceQxlds9OBbZgxlAFgAovRTHx9YcR9rQwduVG89GwfAmtxghxW0eLd+H1XGsJr7AO3CfBmK6OiECaF2JnGD7VB86oNFSbc0tKgOA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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=ask1kJiw; arc=none smtp.client-ip=67.231.148.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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="ask1kJiw" Received: from pps.filterd (m0431384.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65A7kLwn3125563; Wed, 10 Jun 2026 04:55:09 -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=b SiNo6cLEgdJcx41UZzvbJ/IRtyosImtXdb7vMBXhtk=; b=ask1kJiwkcQus/Rlk +InH18eKsFjmvvawlYgriRB3SyFo9P63uMBa2PQJ4iUshswhOFUXIO3DzJa1Wn9m bDn/0/A4QtT9YYmcjgyL/5WESNyuEb/jRkgpn1fpEge07iKYN2jey8xEsT0xVkP7 sD7gWogaCFCU11KjvOU7c8E+xj5YIylKdTqKmAjSX+99gpMtxba96rVZ77B/RBxd 4Jgs0XjB2J4u5KVwQ/bXA/SigotAprhJBG5XoGuhIkgsNjgWW6wFYeWQz43O5Vv4 8W+PTAWEe0cMbSjDmUCOuQIOcRsYjuioG6xeOkF35rpQ09SF1Vhu9Mtr69YXBsah kYHtw== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 4epex1n7rv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Jun 2026 04:55:09 -0700 (PDT) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.25; Wed, 10 Jun 2026 04:55:08 -0700 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.25 via Frontend Transport; Wed, 10 Jun 2026 04:55:07 -0700 Received: from BG-LT92649.marvell.com (unknown [10.193.66.228]) by maili.marvell.com (Postfix) with ESMTP id 9C2093F708D; Wed, 10 Jun 2026 04:55:03 -0700 (PDT) From: To: CC: , , , , , , , , Sukhdeep Singh Subject: [PATCH net-next v5 2/12] net: atlantic: move active_ipv4/ipv6 bitmap updates after HW write Date: Wed, 10 Jun 2026 17:24:38 +0530 Message-ID: <20260610115448.272-3-sukhdeeps@marvell.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260610115448.272-1-sukhdeeps@marvell.com> References: <20260610115448.272-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-Spam-Details-Enc: AW1haW4tMjYwNjEwMDExMiBTYWx0ZWRfX93AC3IE6XcS0 2owSVBQc+6iGH3y1bLZ/cl/7jvvyJfiJBdkbsPXKCi/e4yKoVVcC8uN6Y6QloWagfvVRCHQwbl6 l3RRvRJD9fMCzKGy0vynmtC1PH9cPpkzYGg5j+FezHF6aqNiFAxDqEsHNOixh8AxBh5t+xnl1Bj y6F5qdiFb5RkmOt8vUPf2et631MXTi/rOCp6xwMQbb3jBbJ9P52xizTLNlHmvmQ4JoPj+IGoNmm KYK47Cs+M03qF1mNV5wLqRcCuuFWa02L7PYqyYzFkbOjdm9wZS2KVmkX3NN3EIGapVe/gEEXB28 0YE6N3rTGoMbMFzAqpPzyb9HWQN2DTRwv3Ns5s3jT9skdZBgdgUCcKpbkZ0MHwQoumZmHoDFV2K SjHY8Y62a4WamM3iKtkkiEwzGMYW5AKFgfqVMhSTwTarArAAAq7lsbjOePRJQo9urpdZRQSX804 e9H3vk6JVY4h/DN3++A== X-Proofpoint-ORIG-GUID: X2g8YiOlPGVtHmWBlHXGANiXKUpq1yW9 X-Authority-Analysis: v=2.4 cv=Aa2B2XXG c=1 sm=1 tr=0 ts=6a29509d cx=c_pps a=gIfcoYsirJbf48DBMSPrZA==:117 a=gIfcoYsirJbf48DBMSPrZA==:17 a=FelO9ux0wxsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=l0iWHRpgs5sLHlkKQ1IR:22 a=TtqV-g6YmW1Jfm2GSLaY:22 a=M5GUcnROAAAA:8 a=KHjEQNYavMDKLc9vdDMA:9 a=OBjm3rFKGHvpk9ecZwUJ:22 X-Proofpoint-GUID: X2g8YiOlPGVtHmWBlHXGANiXKUpq1yW9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-10_02,2026-06-09_02,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. The bitmap updates in aq_nic_reserve_filter() and aq_nic_release_filter() are intentionally retained: they guard the aq_check_approve_fl3l4() IPv4/IPv6 mixing validation for callers such as the AQC113 PTP path that program filters directly via hw_atl2_new_fl3l4_configure() without going through aq_add_del_fl3l4(). Signed-off-by: Sukhdeep Singh --- .../ethernet/aquantia/atlantic/aq_filters.c | 36 ++++++++++++------- 1 file changed, 23 insertions(+), 13 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, -- 2.43.0