From patchwork Tue Oct 18 14:18:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 13010628 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01AA4C43219 for ; Tue, 18 Oct 2022 14:20:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231479AbiJROUj (ORCPT ); Tue, 18 Oct 2022 10:20:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231325AbiJROUE (ORCPT ); Tue, 18 Oct 2022 10:20:04 -0400 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00079.outbound.protection.outlook.com [40.107.0.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C8804D17D; Tue, 18 Oct 2022 07:19:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K4xziIUBuBaGktzomrzJda0hucjb86b5mP5kqlSeVPklEZcoJPcEh1QS6pMwqBIKlVwPxG/wpQpEVYma9m40Aw9/n3f3OIaLLwdBmo0CUz8mJgvR37hxDOGDbfNJtKgShrTu9B2NJI2OjiL1RqECd4Oo5k4IfnfIKogIUau8t1wPMQ0pH/g2kkC6lUIh3++0dM9D5MyD/tPF0lNiHRXds9tUnpasJ7Bm7lqcagbZ1UsO6lJn+W3c86VS8WMYMkwAooI1DQG7VGmq1NHThwZjRYb2K4TkdJSMCTtND0QbTRIH7w++ozsBM14furT7gW994mhk1jdhOeALG4zDLqhvHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=xC0C739Qi88v+Z19lx7Ru9rwWXQ3k8zsB0B3ffB/ZnM=; b=ed5x07MVGYB4oUcbKfoFrhh4IecSFBoDfRb5oDVJeeWH9T2zBnLTa7QHxc+gvXPnaI6MoemLSZyXrI66x71Qd5K9mTmWUDRlJVL35s95abMe+VARV7bduiS2/j7ZVd/iAOctYXQNgCvglkKI8KTZwQgp1ezfJ9nNd6grUaa5s3goPaUazatDDTfucqLooyI2uYtKgXD9Xanoo4RY0ikJ27bsLzjzcwmQ3GEL6uATE0J7xFRh/AwJE8ZdbHCz0cqaCHwNE+MZAdW09NEMLsAURz3Gk9yrAMammJgLydKO32s9mq8/HIlJDFsYcu6jS+G6cKwOKHGqZNa64WyG1cX+8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xC0C739Qi88v+Z19lx7Ru9rwWXQ3k8zsB0B3ffB/ZnM=; b=UC/VsJOoCEQ6BLBeGCZU6o4QQhXEsPxSkXM2ZHPp5f7ZL38OUrB6Z7GaJRHGIqyJ8LoR5sCYejiNzkXEKWP0qs8C4oie2s6HIzQN//9hk8Dt0nefzuI9JS16q+3tf/MCdwAfzSg3/kQI/yK9FTC54u+a11gM/bFU4oyZUJhzezM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GV1PR04MB9055.eurprd04.prod.outlook.com (2603:10a6:150:1e::22) by DU2PR04MB9145.eurprd04.prod.outlook.com (2603:10a6:10:2f4::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26; Tue, 18 Oct 2022 14:19:37 +0000 Received: from GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::84a:2f01:9d76:3ff7]) by GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::84a:2f01:9d76:3ff7%7]) with mapi id 15.20.5723.033; Tue, 18 Oct 2022 14:19:37 +0000 From: Ioana Ciornei To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , bpf@vger.kernel.org Subject: [PATCH net-next v3 06/12] net: dpaa2-eth: update the dpni_set_pools() API to support per QDBIN pools Date: Tue, 18 Oct 2022 17:18:55 +0300 Message-Id: <20221018141901.147965-7-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221018141901.147965-1-ioana.ciornei@nxp.com> References: <20221018141901.147965-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AS4PR10CA0002.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:5dc::19) To GV1PR04MB9055.eurprd04.prod.outlook.com (2603:10a6:150:1e::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9055:EE_|DU2PR04MB9145:EE_ X-MS-Office365-Filtering-Correlation-Id: 9f3dc672-e785-4ce5-802c-08dab113c94c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WWYCf35kG8Bm1V2qsqgU3kjm8Biya1wADyXnyY9GE0D6SgR/g51oCGK3SMQ6abcGTZUrvZnwMciNZ+o/3g+7HIKZCykZDFLYp73AvRZDx+oErnNp5gfVCFGeaExEGPd3op6xQWvJ6Hf85Wcir/CqN0mSsKttOyDLMuiPyePOjGEOryO0IehCY719S/P4LSse9HND7CS01IkzSWGSJwQLBWelwCvQH6A3A6N2R+rK1d7m8HXPBQaJXOHLcoyHwtvWITcszzPJxddoUk+R2XJmrG7k+pdDEJSi9bpCzThxlUZ3gsIsUhGz7pYGVQQXOjkZXM51PmhgIhSIvYp4qEWSuHl/8wLGc9Y0u8WWutjtpqzfzWaINbBPSQXTB9W2vCnstf5cD9dZsXel2jcFSXIsoTkuHCowV8HGfG45aOwhQMFt1UBQjOWTWl1VPNJs5W6HxOhucCXiAv5DhSWQ90Diyq/U9XZAAC3bcNVQaOHdhS49X8Ha+YvdAzznlapuDjnQUezTaihBV9Ns34LSHsJZOb6e7rwwZS3V+OPNero7M4zl2UVBqOmudUThJaLCXYJ88cvQzmx7jOfNSKHxiGwS6N1t86wtN7BAQYiDjnCsKYwyExioSm8OzrAKz2bBiq/EP5Myd5QNyXUGcSCSFsPGF2cvnR/mKHrRZxoa3WkhvUYTDqCzXRf7Aa8ycpB3eOarF00AJFNlvGTK22jiHkCcwUQ8wcHl3tV2HaWJKfWhs80fzbE4PX+XTgJu+e5sgey8r3GIXqqp57/lA3tLg8hh+A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GV1PR04MB9055.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(396003)(136003)(376002)(346002)(39860400002)(451199015)(83380400001)(110136005)(6486002)(54906003)(6506007)(478600001)(26005)(36756003)(2906002)(44832011)(6512007)(38350700002)(38100700002)(316002)(4326008)(6666004)(8676002)(186003)(66556008)(15650500001)(52116002)(7416002)(41300700001)(8936002)(5660300002)(2616005)(66476007)(86362001)(66946007)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Lvgnn5wUcAm4/HVBQz6KOwePv6lpJ/6XaS5CCwU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XauXV59H9aSIzHhzyiOSHXP8AhT6OIU6ane6D1nD4mmnP3u5mQevgGQRKXVPTYm8c/GbVncZWVq2gnGz+YIl3p72Qtx5oVJNScLxqCfbrhuz8Qsy1MpqgCZzwTYz7ZPA3YawUIBCBPRsW7FlEcpPhx1CTKlBiXSEBgEbp4FN9bsQGDVxD515eFzl81z9Kvny7oEJvwRWd83zGREG1EKz/kAf/CalBoBn2K8STgUFXZm3mieMkOAUlgY+eN4/XwC8iQmLVobtDdcCcXB75WfBN4qN3jny7ff6xl9GFBNi8mh/Ji7SVmhBS/0CpPr3n9jRzpbHGN/hLw3zMWHNropdj5+0wSg0JDKryhhh4KqFkJcBuuRygOBa6Jt3vJ/MLg8l85lOiacNQW1pmArwFaDcT3eykHZad1OzkjSIrVIw0pGc0JucPweruqYz74v50BGKwh45wkonXWn4CIHFD4D7ZK6 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f3dc672-e785-4ce5-802c-08dab113c94c X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9055.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 14:19:36.7637 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: MZIbBl6/wGmOKr6ktl8xPJYWgtAM7LA6AoaKZMjnH1uGPdnoIiO07CUk5jWiVXSUa0niQPR54uv4yVWD5rdsmw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9145 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Robert-Ionut Alexa Update the dpni_set_pool() firmware API so that in the next patches we can configure per Rx queue (per QDBIN) buffer pools. This is a hard requirement of the AF_XDP, thus we need the newer API version. Signed-off-by: Robert-Ionut Alexa Signed-off-by: Ioana Ciornei --- Changes in v2: - use __le16 instead of u16 for the dpbp_id field Changes in v3: - none .../net/ethernet/freescale/dpaa2/dpni-cmd.h | 19 +++++++++++++------ drivers/net/ethernet/freescale/dpaa2/dpni.c | 6 +++++- drivers/net/ethernet/freescale/dpaa2/dpni.h | 9 +++++++++ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpni-cmd.h b/drivers/net/ethernet/freescale/dpaa2/dpni-cmd.h index 828f538097af..be9492b8d5dc 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpni-cmd.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpni-cmd.h @@ -13,10 +13,12 @@ #define DPNI_VER_MINOR 0 #define DPNI_CMD_BASE_VERSION 1 #define DPNI_CMD_2ND_VERSION 2 +#define DPNI_CMD_3RD_VERSION 3 #define DPNI_CMD_ID_OFFSET 4 #define DPNI_CMD(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_BASE_VERSION) #define DPNI_CMD_V2(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_2ND_VERSION) +#define DPNI_CMD_V3(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_3RD_VERSION) #define DPNI_CMDID_OPEN DPNI_CMD(0x801) #define DPNI_CMDID_CLOSE DPNI_CMD(0x800) @@ -39,7 +41,7 @@ #define DPNI_CMDID_GET_IRQ_STATUS DPNI_CMD(0x016) #define DPNI_CMDID_CLEAR_IRQ_STATUS DPNI_CMD(0x017) -#define DPNI_CMDID_SET_POOLS DPNI_CMD(0x200) +#define DPNI_CMDID_SET_POOLS DPNI_CMD_V3(0x200) #define DPNI_CMDID_SET_ERRORS_BEHAVIOR DPNI_CMD(0x20B) #define DPNI_CMDID_GET_QDID DPNI_CMD(0x210) @@ -115,14 +117,19 @@ struct dpni_cmd_open { }; #define DPNI_BACKUP_POOL(val, order) (((val) & 0x1) << (order)) + +struct dpni_cmd_pool { + __le16 dpbp_id; + u8 priority_mask; + u8 pad; +}; + struct dpni_cmd_set_pools { - /* cmd word 0 */ u8 num_dpbp; u8 backup_pool_mask; - __le16 pad; - /* cmd word 0..4 */ - __le32 dpbp_id[DPNI_MAX_DPBP]; - /* cmd word 4..6 */ + u8 pad; + u8 pool_options; + struct dpni_cmd_pool pool[DPNI_MAX_DPBP]; __le16 buffer_size[DPNI_MAX_DPBP]; }; diff --git a/drivers/net/ethernet/freescale/dpaa2/dpni.c b/drivers/net/ethernet/freescale/dpaa2/dpni.c index 6c3b36f20fb8..02601a283b59 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpni.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpni.c @@ -173,8 +173,12 @@ int dpni_set_pools(struct fsl_mc_io *mc_io, token); cmd_params = (struct dpni_cmd_set_pools *)cmd.params; cmd_params->num_dpbp = cfg->num_dpbp; + cmd_params->pool_options = cfg->pool_options; for (i = 0; i < DPNI_MAX_DPBP; i++) { - cmd_params->dpbp_id[i] = cpu_to_le32(cfg->pools[i].dpbp_id); + cmd_params->pool[i].dpbp_id = + cpu_to_le16(cfg->pools[i].dpbp_id); + cmd_params->pool[i].priority_mask = + cfg->pools[i].priority_mask; cmd_params->buffer_size[i] = cpu_to_le16(cfg->pools[i].buffer_size); cmd_params->backup_pool_mask |= diff --git a/drivers/net/ethernet/freescale/dpaa2/dpni.h b/drivers/net/ethernet/freescale/dpaa2/dpni.h index 6fffd519aa00..5c0a1d5ac934 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpni.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpni.h @@ -92,19 +92,28 @@ int dpni_close(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token); +#define DPNI_POOL_ASSOC_QPRI 0 +#define DPNI_POOL_ASSOC_QDBIN 1 + /** * struct dpni_pools_cfg - Structure representing buffer pools configuration * @num_dpbp: Number of DPBPs + * @pool_options: Buffer assignment options. + * This field is a combination of DPNI_POOL_ASSOC_flags * @pools: Array of buffer pools parameters; The number of valid entries * must match 'num_dpbp' value * @pools.dpbp_id: DPBP object ID + * @pools.priority: Priority mask that indicates TC's used with this buffer. + * If set to 0x00 MC will assume value 0xff. * @pools.buffer_size: Buffer size * @pools.backup_pool: Backup pool */ struct dpni_pools_cfg { u8 num_dpbp; + u8 pool_options; struct { int dpbp_id; + u8 priority_mask; u16 buffer_size; int backup_pool; } pools[DPNI_MAX_DPBP];