From patchwork Thu Dec 19 06:16:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Andrew.Yuan" X-Patchwork-Id: 13914516 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 C6DEDE77184 for ; Thu, 19 Dec 2024 06:18:25 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tO9qi-0007Ni-GQ; Thu, 19 Dec 2024 01:17:28 -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 1tO9qg-0007NR-N9; Thu, 19 Dec 2024 01:17:27 -0500 Received: from mail-tyzapc01on20727.outbound.protection.outlook.com ([2a01:111:f403:2011::727] helo=APC01-TYZ-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 1tO9qe-0004e4-Ac; Thu, 19 Dec 2024 01:17:26 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fDwB142H/4kMMPhRLrJbRRVCbsILTM+QAtGpHERH02bqxxBOzcdCeVnGqW19wdwtD9xIUwUhoFJgVYgsBtERc84Jta4Wqmgyq1zSbhaBROpLd1zY5DF0drVA0wTp7MMc2l0IsGiHSS62RcbIaYEgxSMPeehVX6upMZYgRDvoZN1Lgr8+FD3occcFRyrqMMVSha7XaZYitx9qiX4t9ngGn6FKR4f2ZbBuMOfNikJUTuXdodEX6ecsX/uoZ4yLfXuvRWGj2HUHyPBR4SIO22JKmA8F0S0YQp9MtKezNbKSEgEgIEOydnlOoc0mjJudmvMDJG0sl2qxsg+ROrkCMDN3kg== 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=eKBXAcv7Y/JDvKnZe9LtSBDuGqQSzB8OKvrJg7SJO4g=; b=KxOXfA+aq7RXa+Cxw5l0EmhTof8iObZOSf0lZehu8yxWoftzRBwRT/+AnN9VtWa4+yPFcbi7z/Md9rxIeQKnh823+M1je621en2KplKzAV05Urnn5xp+MXxE6Memcftw1mTvBZ+NI74jrA2O3C3qrfxAxI19xSDJQ8smrSjX2SObqrTYoGyWCe+0y8eoeQjodbnEaXYixsVzRvPeLoHiEH8R/U845WVDlXGk9uXLIvT+VlIXrXBa3L1XQw9aubZxfGLgUeFrLSYqrinDGmyUfQuAWy59yPCiJMzrpTjxubniVeHpKWiUOYQfJ335IEuNhFHKvBMtMBdtMu8f8Zl92A== 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=eKBXAcv7Y/JDvKnZe9LtSBDuGqQSzB8OKvrJg7SJO4g=; b=i9kQjeUqcmUsPNdNoc1NQKQIJysNJmL/OGjmZn4BKET7IFhgRAHu7IKzmrEwiHhOSbnlH+Hh6FHeo/8mP6C6sP0RXGCNAUDbpzKojlB5GatxXXJZH8VoHtGTnNxJdgPJHOGHjVqq/lWWQgMGenJZ5SuAICEVgot8fVacTSgY306TReW0IRlKwPYf3w3XhkCOIEsPjPmP+SsKEIS3n0A0o+WHl+7TsZI0VdBqI4ifZLbUm1FMbKwhW1HQoph3r6QUf31wG4HV1HE8XW+Za0AtrUGT4KG/lGOheI/XKjagK8AQCPyt3UGamaCNnX8tplQxDbJ6yfgMJJ2qzKevcJuvng== 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 SEZPR06MB5391.apcprd06.prod.outlook.com (2603:1096:101:66::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.14; Thu, 19 Dec 2024 06:17:13 +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 06:17:13 +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 v3] hw/net: cadence_gem: feat: add logic for the DISABLE_MASK bit in type2_compare_x_word_1 Date: Thu, 19 Dec 2024 14:16:58 +0800 Message-Id: <20241219061658.805-1-andrew.yuan@jaguarmicro.com> X-Mailer: git-send-email 2.37.0.windows.1 X-ClientProxiedBy: TYCP286CA0020.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:263::12) To KL1PR0601MB4891.apcprd06.prod.outlook.com (2603:1096:820:ae::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: KL1PR0601MB4891:EE_|SEZPR06MB5391:EE_ X-MS-Office365-Filtering-Correlation-Id: c27e885c-831a-4f77-e0da-08dd1ff4c707 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|366016|1800799024|38350700014|7053199007; X-Microsoft-Antispam-Message-Info: =?utf-8?q?/E+U3/1H9vDIKcCOgZP0/SkPvgfJDIT?= =?utf-8?q?5xqkTcJb3rHHZ63gATfuyfxZr6pJKqJ3bJPCvolS+PJwwn+lUJW5rGHMd5X22Qeey?= =?utf-8?q?aO0W3XQ7KF++vCEYhvyVxbhr3XcjCmfxPA7S8SXH7aaJLl5kzZmZpCL743sEO7MmY?= =?utf-8?q?BEvnwle/YEVB6SY9g9PWvpJAhnNVaffdGa36owfNpQxPPg5RAkT08Mzyo0hpOzgOl?= =?utf-8?q?IORHziFnezRRGfCoc/iXTFgFeybfYNjFbzG6JOMZMb/u7tb6Sj0bwzcyhaItHIoe2?= =?utf-8?q?LYgtjRNIucJ3075YXAYMnA6WnTRMBbqpjCoBtkd0rXDeDsdkO/Wrg/mCCf9ftpceQ?= =?utf-8?q?8S/EsmZKiAHIjFR5o5mnZxl4GUHB9TSuE8sTPGDniojuabOl4LOaD5lTijQUrEaU9?= =?utf-8?q?Dl4/JoQ4MPgxpO4Ckhl2NWm0EEf33l2k5qoqww5+uqk0NBxYDs8PfTc38RQhe8p1c?= =?utf-8?q?+dVkORXrMt04K6jZG6qqtkRUrleIQYZP8DXzp6YqUKS69d7I8fwTnRT3Cc/gTjb3w?= =?utf-8?q?1twkXgWLO8Q4wzoyxAzJlk8GQnfIj/gZEHQdqZvUH+I9l3LhXNLUvUqBoFY8JpNvv?= =?utf-8?q?IhhhBHerr63XOaOaAveGFcslMkCQWrbkQyGSRYlxU9D0GgqqB05+i92wf4oCpwIiK?= =?utf-8?q?gz8LFpaLjjV9XZ7QU1h2ZKfvbSXNNTErufUgrlXkoExv934fHnROZBRCSpPEFdgBW?= =?utf-8?q?V3jz37hsfCy/WBwDfkb35im/jyv/KuvknBtPy4PEDR3mXDtUvCHwehRznEmNVqB1S?= =?utf-8?q?FKRB+eu2zmUX/pnTkG9SyvXhKAeGfmvEsAbw48g8NJh6L76uhnVc0ZjrklH1qNkBe?= =?utf-8?q?gYey25fTinx0OUjUetC3aHFVSzrv6fzvih/Y00zlHfneojX055XtBjubTmXbe64A0?= =?utf-8?q?X83T1ScJap6mwI8XaTysdFZma9spkI2vDsYEjfvpP8FAZdzB6sagDu/wbzr1C055q?= =?utf-8?q?eblHWREKiM9yLkxdmqQi/fR5+6r/wyLyrdHkG3tAxOE7JhPih8NEApUOSh8rpVDZL?= =?utf-8?q?LK137ip5VoUZRTOV9gHWx8QPzstj7yrbT3jfOZC/TOUdDon6Nw2i/4ZLjnF00sZnN?= =?utf-8?q?DypzKy4TIugInpHHmovfxy3XyuGV20CXilOjv5FK382aQMIJjklxfNk91tk45ucKg?= =?utf-8?q?+oJaKIXlPfGQSiyShzFEVvMbnQ5pABKPST0qG1ubaxxH8SuPJN4t7JICTGCFKU/y0?= =?utf-8?q?fGQmoBhQP8Md2PW5rmheeb+RJeZ6sukx3hQaGsTkGqN3QC7Q3jyOgR+eQg3pGagp8?= =?utf-8?q?LHdStrLwL93xqoRSuKGFis4nAqbhgme7cGmBq0XQzRffu+MKQ1SAgeBrviETn03JE?= =?utf-8?q?k+H83cjn4WsxNLefNxapqHFC+ZrKHJhhyGWpoTyT17005xNgqFEQkzJdnz+x+iq9z?= =?utf-8?q?wqcAS260YQT?= 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)(52116014)(376014)(366016)(1800799024)(38350700014)(7053199007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Re+A1ttQWoHCJv1uYVzm+W1cu39F?= =?utf-8?q?zFwK2SmcYxCCoFEQ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31DXFKPcTsz6Xt9t4cSEMea1fRQkT9kO3Qe5RAL/ZuqczOqWUg?= =?utf-8?q?sexv/nsm/rK1aT/8xUPuXC4UT3dYsaar8jHII2NJA0Uqqdyrzyv/czXhrmyRj6dw2?= =?utf-8?q?8LWoLEwOISu5nm9SSGf05eBHnr6d73jWEN13koTLAFCyyClZfSf+2D90Ut44Qi+tf?= =?utf-8?q?UFw5VJXdD6HQ51zOPrc4TFInf6ocD7ekY88G5FWqYg+ORhYxG5rcww19KNPkshKvG?= =?utf-8?q?D1pknLo+U5zJwLrx2wZpv3vUlDmrlgSuuyt3LRi+0TIkE8ws3/Mwi1TuhN48krwW1?= =?utf-8?q?IF/1i8qHDyK8srQqi1ZjC7uov+yDSRxoH2NYqTQzYZdlG2IActW+11ciuHk8HVtb9?= =?utf-8?q?stYlG2PfqRxjlMCZ9WlXLNU4bD2vtAtVom5C/QIDok1HozZ+xap/Cdx07egJbS+CY?= =?utf-8?q?xc/sBkSHSjnfG9dT0Iy6kpUDN1+AhKkO75RXN+73QOKlcf+lVzhZSH7mmHhYgwltj?= =?utf-8?q?+TbnjVTQJ08O47E4GGQHU2vvnUnLBdlpctnUINgR6Vd7RLGWFQOuupLqv5Zztu8Dx?= =?utf-8?q?NnMfkGTSJjxXROEU2ztWJRIGnA3abvt4h/nc1m710pZUOl23W22qdXQlLvnUBNTpc?= =?utf-8?q?9U+ad+jyijfLqeek3Y46US1uGfH+9tAR9Q=3D=3D?= X-OriginatorOrg: jaguarmicro.com X-MS-Exchange-CrossTenant-Network-Message-Id: c27e885c-831a-4f77-e0da-08dd1ff4c707 X-MS-Exchange-CrossTenant-AuthSource: KL1PR0601MB4891.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 06:17:13.4819 (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: S0U7Q5wZ+3YeCLvkTOP0PigltFZp55SCH/anjU9qyEo7f/XmwiyWGTtbaxvo/cxN5yRU/QtCIy9rQU9ZJzjaonPPA/gmrufgnUXOzSdHL2I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB5391 Received-SPF: pass client-ip=2a01:111:f403:2011::727; envelope-from=andrew.yuan@jaguarmicro.com; helo=APC01-TYZ-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..7bd176951e 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;