From patchwork Thu Dec 19 03:43:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Andrew.Yuan" X-Patchwork-Id: 13914439 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A8827E77184 for ; Thu, 19 Dec 2024 03:44:33 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tO7SS-0002Jj-4W; Wed, 18 Dec 2024 22:44:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tO7SM-0002If-Fy; Wed, 18 Dec 2024 22:44:10 -0500 Received: from mail-psaapc01on20709.outbound.protection.outlook.com ([2a01:111:f403:200e::709] helo=APC01-PSA-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tO7SI-0004d6-MS; Wed, 18 Dec 2024 22:44:09 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lD2F5Zm4Darl79lfMN04Su8ybZx6bAZM9SDbMOWOv0+EhckJJsU7NU1PC9y/Fn+beF+1gM3CbvslhdHhyEyRli9seQluB1NJmqtH58YGQ4Kc5VjhgDnP4nRfs3zpxiEDGiWXsxN8+DLRNtrpz81nVmehGuD5Q6UWD12Ibce6QEO0g5SqNgvhEe6fF0SnL1+doApiVqAvPlyy/2AHi6rvFbf8GcREIUtmFFx6yJQ1F+9l/U1bK/u9Mdp1MY83LbXKE8yNB5hbrVSfiwqK0FRIFrjWl7oQkYfmBuZQBRzhdNLikgulnkDewGwqX0iVhmdGvxHKM1u2/4MFE1peO0Xh4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zZjyjQN0TffYB9GY+3kasOF64l+SxEvW3lWGSIyGP3o=; b=WOTzJDkzTZLzaVG8HHA3UWo7+4EN4eopeWKJmmLJwesCZOne1kjlp6RpFpVVpGqBaZLcQ/dLvx0DVeofuRy+aIkmReIQZJMs8hY7KrnH8CSRT3E8XjrUaSp1OsQixysFOO8tgp0N2GrxcEKnj3eIc/qxqwXbWzHGt2sO+0sbrT7UQkkoNj8VYWXl8NlwaB4hZ7BbkI6Y43weIO7mwjRF0SbUIDE9pA02wooeRGZt63/KjWbe2wqy6ioLgCaDW1V+7bTVDhn/bSJjz5WlnZzzbBRtXzBpAi8Tybom8fJ8lvHzx2zuhwhV+RYqwKH+w6tZloXATBNVEeAt7ABp2num5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=jaguarmicro.com; dmarc=pass action=none header.from=jaguarmicro.com; dkim=pass header.d=jaguarmicro.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jaguarmicro.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zZjyjQN0TffYB9GY+3kasOF64l+SxEvW3lWGSIyGP3o=; b=h+T2xSM06uM+SJaBa9KnbXg+i/jzQ4CKiLqUDirhQfZBjcu9//AELv3tOsXZz5yltgdDruByXjm80SkvdVmHm3G6AmZBIbndEB8E5q611b2QdU2cNJcabHp5rbrlGne17VMRZhWKkavAPnhGBVeEO3TWHhcINDq/3Y55ahLrld/iIwYjTsLxgcv/UJBhDZVtchJfB5UdiG+joTj/Z/Ll8CLQIiVEu2dbo4vSUau9o2s2Gs+EFkec6y0QDlzACfA5V836qn6+sagnD3MveonhtFq6tCz1G9cPNy4XJ5IKPM3fKsVFn/PI/STv9WVhcrMN0dsJtpLJ0GlMn5MDF1NaOQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=jaguarmicro.com; Received: from KL1PR0601MB4891.apcprd06.prod.outlook.com (2603:1096:820:ae::7) by KL1PR06MB6963.apcprd06.prod.outlook.com (2603:1096:820:125::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.11; Thu, 19 Dec 2024 03:43:50 +0000 Received: from KL1PR0601MB4891.apcprd06.prod.outlook.com ([fe80::8950:42de:2354:91b2]) by KL1PR0601MB4891.apcprd06.prod.outlook.com ([fe80::8950:42de:2354:91b2%6]) with mapi id 15.20.8272.005; Thu, 19 Dec 2024 03:43:50 +0000 From: "Andrew.Yuan" To: philmd@linaro.org, edgar.iglesias@gmail.com, alistair@alistair23.me, jasowang@redhat.com, peter.maydell@linaro.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Andrew Yuan Subject: [PATCH v2] hw/net: cadence_gem: feat: add logic for the DISABLE_MASK bit in type2_compare_x_word_1 Date: Thu, 19 Dec 2024 11:43:03 +0800 Message-Id: <20241219034304.747-1-andrew.yuan@jaguarmicro.com> X-Mailer: git-send-email 2.37.0.windows.1 X-ClientProxiedBy: SI1PR02CA0051.apcprd02.prod.outlook.com (2603:1096:4:1f5::6) To KL1PR0601MB4891.apcprd06.prod.outlook.com (2603:1096:820:ae::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: KL1PR0601MB4891:EE_|KL1PR06MB6963:EE_ X-MS-Office365-Filtering-Correlation-Id: ac25409e-d666-4721-3e05-08dd1fdf59e9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|52116014|376014|1800799024|38350700014|7053199007; X-Microsoft-Antispam-Message-Info: =?utf-8?q?vAVmGM+gBjVqsTYowpYMeR2ZtMOIlIa?= =?utf-8?q?DzEcYGHd0ygVxZdSWBDPjf8oL3aR8EppPdtQJJxedIv5XRrp9QVmUt5AmX+Qy6Hpw?= =?utf-8?q?pvt7zbjz2WouJhQTSmK8fyVwOz5N9+BPCoSR1swyhMp4HaoDFkcf/G97pHvHkkZ/9?= =?utf-8?q?6zxcNDNEsUugiawdpSPyPOkgx8yyRCzTiCYwUfDCkYo+zvUHjRnad2GJY2YwhU3vk?= =?utf-8?q?YHZ8on05c8M3a1skoFqQU85b7PZlpzWKqn2YOPKNnCEN0ryUlTKKcWnuGnt04rogW?= =?utf-8?q?pM2BjHzYZnGZD6pemB+BExLQEhwAFBHpaelBsee8+B9ULzS7EqzSObaRJcm/naFgR?= =?utf-8?q?wamBDVCUtINFrIqoCInNyAMDb9WhrOzc67gLj5bVQqj93yo/ITLY4BK5jTKhRZJoc?= =?utf-8?q?c3MfYtON25JklE1gKNbeTU/TTAnskL1I8QxMeiVLNJFw3VhZXGFi+/c4bMpIpFQOb?= =?utf-8?q?qLqH3JAuXsIUGhuxGlIvBFVq8DCvcU+jmtY5A0Tk/7u872VbhGYG79mg6EYkAgXt9?= =?utf-8?q?NTzOGnVMkGW8SEcWKsnlkDHwXr5ADWRtlMhCqjKI2+i3PcERaga08QjxgOmRH6d8k?= =?utf-8?q?xrHWO6p+TRPs/G1EE7jugK/6wqJSgrDoTMJiQTx9frRvnBlfi+dyoMLF2FlEhcNtA?= =?utf-8?q?XL6T2dUQSwRo3IiPz1ztiujaA2qDYI2Yih1h9+McRLHCqzJHszjnymfWQEOlgSwNd?= =?utf-8?q?VTW2dNEqpTiOvd1AiQimB6Lgp2juzy9EzaQ9+wD8XDU+kKeZzogIoDHSuGcz/2cJb?= =?utf-8?q?ewFP5oG/ix+5q0DsagdDux8+R8tkNIQim/fVcqLNJ/unbZtnpDvzJ0NsFNjJBFc5a?= =?utf-8?q?+LJKyBjNk/CzaRMT7z4MoeOh575UDjYtpBdN5JJkMVa+Lq2aA7D5S19imsUXqXNAh?= =?utf-8?q?/nwT6vlwwhlEhtt43/CWyIENh45WouYjofvcezHJoRP3kZO40TcjPd7zSliZxEtD6?= =?utf-8?q?YbcJSgRwYfo6AY2YM8cidnAztMefhyKgaJ5cuO8HZct5fTNZgnnK0faweFcShMw+0?= =?utf-8?q?l3mQi0UTnAmBEaRjx3FIfAvX6gM9dCSeLW9xUQIsPUdLMkbgfJ0E8YlmFm/HfoiiD?= =?utf-8?q?Q32yfsiSz1MNsNQ6dDP9mbDjHTQQPA6aHqsoipGQyDTJzdh4/C4+gG57xQo43dGXE?= =?utf-8?q?9HR79Ikrm/f3fDiyuN10MpBabKGNeguErS2OmFJrQF6MxvIrtvnrTVxlBC6lxRB8a?= =?utf-8?q?rkn9L5hmINN7IUSWcO7lu4AV+Vr9C52rEOwfIiVWTveHNsr6FL3FrEKuIksSE59HF?= =?utf-8?q?Yg67WL6bu62ylrYme2uDjQiFRHn6molNuJA7AXYT5r/DPWnNnzOIcWv0MAh7u+tjb?= =?utf-8?q?tHLoNJj/NxQwl3tKyobllfE/qa+vrE3k4YLS0Kvhw6JbRNGpaO92PS5ozWHX07AlM?= =?utf-8?q?Zumo6Y05ev4?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:KL1PR0601MB4891.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(52116014)(376014)(1800799024)(38350700014)(7053199007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?WjFLEy24iQaeJQgq2gWLD7DrS4qx?= =?utf-8?q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Q6PGB+Cwarn0aamouLQ+2j6TyG97VLoZ6IG8c/sUvFr/1ivnas/9N4hm?= =?utf-8?q?eKp9cKWmiUDv8/6SGnKEQt2wxB/on860pME2g3HRHIKUp6MyPYPBcw2FT28pQvzpi?= =?utf-8?q?/J0Daw3By7XpnArpHg0UmW3f4Zqgdde72eNpWqLHhFDyKGauSsmr/5bWZMyPdzyTi?= =?utf-8?q?cXSb5HqzuOWQyuCWQHx/bZa6pGSTXDM0N63nIgp2gT/RLZJ3KKbx37akUODami9t5?= =?utf-8?q?iu4Os4VVsSWxUfXpDAl46zfE18nsPIxp4B4rG0rPh8k3rC38P5PwQeF8IW2DZD2Bv?= =?utf-8?q?LC/bQTgy5D2AN1wueaZrSjyDVrw9gy/ruZNDzw+D9jPtLgglyNtQt7gtLDvi5rzEU?= =?utf-8?q?tzvS8lsXavvf9NTIIywh2+B6ekqKiS/OplS0rj5e2TxxWHfKWVoau7P3Tp0xHozoU?= =?utf-8?q?qGRFowdk8PD/f29/juzt3/XMtXAtGhwTqweYv1TYNqqqEyF/pMZ11+ylchu/UDJE2?= =?utf-8?q?qY68V6LaPkTDYEVmu2yvVAAqNeYI4dXe/Ryjx8cxD1M8cVoDI70hh++opmt63S2iX?= =?utf-8?q?JSXV55ppnhjvqJxOf1h+PmOzP/snvIhcddR7pwANrQOkhc8mCUawesQGsir1sMHw7?= =?utf-8?q?4+OTJDEZcD7kCwOYFL29qUA10qMzlkHlhg=3D=3D?= X-OriginatorOrg: jaguarmicro.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac25409e-d666-4721-3e05-08dd1fdf59e9 X-MS-Exchange-CrossTenant-AuthSource: KL1PR0601MB4891.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 03:43:50.5225 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 1e45a5c2-d3e1-46b3-a0e6-c5ebf6d8ba7b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hKSf9BuENNvQN9G3fpQ+iaazb4am1jm2dAjduh2dCpNBlqyTYKJKHY2umk0if/QDfgRucHJeoIZk1UJYDhB7FJjP6+JHq1CDiAokRexxT0I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6963 Received-SPF: pass client-ip=2a01:111:f403:200e::709; envelope-from=andrew.yuan@jaguarmicro.com; helo=APC01-PSA-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Andrew Yuan As in the Cadence IP for Gigabit Ethernet MAC Part Number: IP7014 IP Rev: R1p12 - Doc Rev: 1.3 User Guide, if the DISABLE_MASK bit in type2_compare_x_word_1 is set, mask_value in type2_compare_x_word_0 is used as an additional 2 byte Compare Value Signed-off-by: Andrew Yuan Suggested-by: Philippe Mathieu-Daudé --- hw/net/cadence_gem.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c index 3fce01315f..897331c5ef 100644 --- a/hw/net/cadence_gem.c +++ b/hw/net/cadence_gem.c @@ -909,8 +909,8 @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, /* Compare A, B, C */ for (j = 0; j < 3; j++) { - uint32_t cr0, cr1, mask, compare; - uint16_t rx_cmp; + uint32_t cr0, cr1, mask, compare, disable_mask; + uint32_t rx_cmp; int offset; int cr_idx = extract32(reg, R_SCREENING_TYPE2_REG0_COMPARE_A_SHIFT + j * 6, R_SCREENING_TYPE2_REG0_COMPARE_A_LENGTH); @@ -946,9 +946,23 @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, break; } - rx_cmp = rxbuf_ptr[offset] << 8 | rxbuf_ptr[offset]; - mask = FIELD_EX32(cr0, TYPE2_COMPARE_0_WORD_0, MASK_VALUE); - compare = FIELD_EX32(cr0, TYPE2_COMPARE_0_WORD_0, COMPARE_VALUE); + disable_mask = + FIELD_EX32(cr1, TYPE2_COMPARE_0_WORD_1, DISABLE_MASK); + if (disable_mask) { + /* + * If disable_mask is set, + * mask_value is used as an additional 2 byte Compare Value. + * To simple, set mask = 0xFFFFFFFF, if disable_mask is set. + */ + rx_cmp = ldl_le_p(rxbuf_ptr[offset]); + mask = 0xFFFFFFFF; + compare = cr0; + } else { + rx_cmp = lduw_le_p(rxbuf_ptr[offset]); + mask = FIELD_EX32(cr0, TYPE2_COMPARE_0_WORD_0, MASK_VALUE); + compare = + FIELD_EX32(cr0, TYPE2_COMPARE_0_WORD_0, COMPARE_VALUE); + } if ((rx_cmp & mask) == (compare & mask)) { matched = true;