From patchwork Fri Sep 2 21:57:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12964729 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 3FB1AECAAA1 for ; Fri, 2 Sep 2022 21:58:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230426AbiIBV6v (ORCPT ); Fri, 2 Sep 2022 17:58:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231203AbiIBV6T (ORCPT ); Fri, 2 Sep 2022 17:58:19 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150079.outbound.protection.outlook.com [40.107.15.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DCD3F5CE5; Fri, 2 Sep 2022 14:58:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FG1YEhbqDjjEotQXGPFXYyhW1WbXO2L4sDcag4nUW/qjwVjtAocEF8y0XHKW1pngBMQ/aAwJWE6R0WM1YSGHhd+y+n+fbnOycZH6sAO4uKmz8dFUAOTWsft36V8+xAqHAsVgig1M3OEd0hAs32+l//9N/C3WI43Lh21NlVv0GJIvMHAsni3BtW31CO50cDz43D7LSjmCZHlTrNszY6leu0uPxeRzHBjJQdxegCPhbJVdn4YfyKfbxO2mo1jndd6S2FvQmY3ON2QxeyT3ZruXWwdltYAzPjz/luHSecxQ+Z6hcROIL2fpfXV57OdxE32AxXGLTDvFm7GznEXkBvMwlg== 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=p9E0GJt9fU5phIpRkKfisX6q0VW/4r7DNqN8cQ7wYNw=; b=faWDpi+5mrGJ/2pZIB40xkHIV3bV/UAENx1upYznJDpetLq4CoHGIchD+DbBx04vVO7ud4WO/juXSe9ILn34MJJhUC8H0ZqCRuw8KsipVqvv47TsqBESGEhv9Lkx4Q86NIxwMvhHGX/3RL0ttTG12Gr75CdhK1j/oFVAilNOmH+QW4/2uw/MYyjWWjXPOQzqLE25CgmTyTQl5wlBDmwFVSHmQzAKbDVxTMmF27qWD39RIACQFhm9T95iK6HY24O8AC8Gu1wJJPulZSKZDwUrtXLGI1zTNCvAmT8cF3DW9De5YHa+iCz4ENwxntZTPRyCUVEqQs30U9HylAJk201sQA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p9E0GJt9fU5phIpRkKfisX6q0VW/4r7DNqN8cQ7wYNw=; b=DdlAt5haWh9LSb6MFNlT8JLXuLhxlG8FPQvzZiJ6tGeuYunnhM9a0yQwyyXB3hEcHMTG7TScyJ+exESeYZI/MXlWku4IzUmW0vukChTb6VahKDL0/S9od8F2MnGCdUnjD0rLWvXhXXBvF1VaQWB6UWbOvt7HEGYEiaQrhpuquAHAnM4JN8JWGtj02YLlZ3PUqcJh5kOQRfLALgQKDOGfZwzV5F2lcfutRc8XTGN2JdkSQRM78juoOvzH54uk3vO7nT8Jny7P2aAfmqMWZCYI6O9OAtHzR1o7QuLwAdn4DKs5+r2YVdPFR8Ffi92HbXsSP1QLx774KG7SmTBNClfqIw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AM6PR03MB4085.eurprd03.prod.outlook.com (2603:10a6:20b:1b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Fri, 2 Sep 2022 21:57:50 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5566.019; Fri, 2 Sep 2022 21:57:49 +0000 From: Sean Anderson To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: Camelia Groza , Madalin Bucur , linux-kernel@vger.kernel.org (open list), linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Sean Anderson Subject: [PATCH net-next v5 01/14] net: fman: Move initialization to mac-specific files Date: Fri, 2 Sep 2022 17:57:23 -0400 Message-Id: <20220902215737.981341-2-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220902215737.981341-1-sean.anderson@seco.com> References: <20220902215737.981341-1-sean.anderson@seco.com> X-ClientProxiedBy: CH0PR03CA0315.namprd03.prod.outlook.com (2603:10b6:610:118::15) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 596ccf31-2bf7-4f82-04a2-08da8d2e2d65 X-MS-TrafficTypeDiagnostic: AM6PR03MB4085:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hyWfpymuZGSJAzNl/lpWJmNeKt8f7rX2ZvB7ORJ/WhHwMGuymCslDM5D+5KeVtAtyIRtmnqJu21W+tBXJa9vErUwMOXoe59lsz+0xn3uV+JHthezXnd7C8nfIbjfuKMc5CeC2KyypL8bs1HifXm4g+WQOLOZ6WsBbgvq0SqUZgvU5tmb8wFoJUduBkWyBtCZAo4+AzIsAKgMzDzQntUPQ86d8Q6BmfuDcmRCBTCkRSZMneqwFwYZzts475OzxCnx22wVQF2FLJk0YDEIUo/vmhS8C8jVsxIODPGno/nnz5TvyG13Bqb9EZq7zsUmd08pOfZFEZLOTJPFfwZFWKIk7TfJ9Sb9PqTHBKSbkCroNv/fkux24WZbY6H/mN0oZJrImOIsYp7UxyibZhmdcbawMe42TnVbUoewDSqwz54NM9rNIBe4a89ekB2QwVLTLbL968HCRTRqxw04hu6ktSxdYb6vyZs4IZC3iaTXu7wwY7eIawgYp2yDzLZrLFBVUf8gqnEAGF0/t/EKSdhQ0e8gppKtjGb5ZGUrR1vKyB5Uaohm8ZIul2WJHZVPw8NIEyyxIqky+lIrL++caab0sAn9URjTzGVg+rfjik74Af8dBFSDWrQMPLHmcGoPZt8xuGnMHJsF6BU++DZ4EdNMoBt0B8TxGTV8dpJW8HFU4vnsDOwPobfaipMlA9F83GURiQKPse52PjsvMmKgV1FvC89XuFOC45jGTL/4qRXnmYi0LEvDGce/nNA31eYkJnWnJpBULfiG7VFj26TV7a3V3qpCaA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(136003)(346002)(376002)(396003)(366004)(30864003)(6506007)(6512007)(26005)(2616005)(186003)(1076003)(7416002)(44832011)(52116002)(8936002)(5660300002)(86362001)(6486002)(41300700001)(6666004)(107886003)(478600001)(83380400001)(36756003)(2906002)(4326008)(8676002)(110136005)(316002)(38350700002)(38100700002)(66476007)(54906003)(66946007)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kKdayp1ZM7yymxvglW1R7Is1/nvXkd4+t++lKa8cfdtcxigoP0xzQZajTdPvUCW0n2iC3XRQszDTqSCoVVnjSVDXOO1x95weMNKfqJanENbMSsKO59vOoCDVxXzyFKo4bYHfjhxYvP0241lMeJBON1Lk8oO3ccovPeFRvadn3NBZspIdYq7Pjxz2wN1WwJiU/uEbIN91o5NIQLFss9I3YWAbZ+IzaIa5vQ5LF11usYjpYPCzPMoooAoRURf67NNuCqaxQZKmYd9/5GuhRH68r1IFJYtYmR6VxQ6ad6y9qJZFJxN/sNAhFpy67RfCBI3gK5roSryHiv9ZIm2rPqsMxZdVTWKJogi2kqAvnE/lqXyZAP1ODIRXEFm7RWY4x2CfFWWFIAiETWyfOQ4AeaBujk4tBvC6S/vEmnQmYOglnyryFzdR1QmO8EFQ5tA4tL0PYaZMJkVI7bOiYfbwMmaSwOIYXDLz2YpGYLq0nSJdBvRhf8xrqjfkIDTBPbBxy/mrrucV1LJfF3OTyCHuh3huRjw7YdbG/G8fIcyXtU+LgfllrRRx2drLTcP+qSUf1hYV426haVW6Yzh3nDs7o3jyWP6c/PMwhd/p5f79G5lBoBbKRt6sjuhsNcPfz7fjs0clFQdrQJrwV/XWJ2yISI68ohLW+EL7Zd4qzxbVHlYt38YnKAaGRAO3Ri5omoFlk4jWi6toYmRKrQ/wm+TGJ22ZqiOv9HbsDgLDKP9qYi0+iXHrOIo+At5TI/8GfInZwSB2gN3lsQOw788gGZSWUJBLjVEi6vEA6yiS9IUzRFvoyVZ5EtaXAK9nqh70WU4iy1/H1flLqH/4u9FqixrgXh6C7Wl2FNUfOxwZrlRS50vjbnp5MusgiJYA1IJbIGfj9zTC4nhk288YjofIm9SFsLjeTSaaKyEn1+qq4UDAnbPcbJsEIYv59tPQArBbvSTsU6o1uzcDwpxFoGAbCn/6XGUwlDOdrVnXEyoqpmFgsCMfcdrq5o9ZFVBo+jbsFJwf/jJ7IXrPEHEf5xB694OiycdSUaYRtlrzCVTFjkvGoFKhodGerzAQhdL+Ndzy92wl5bcNGZfihntdIfoZf5LF6VjhlN5GTE7ptjoY6CUA3OPw8w0j2yO8GdJcODbKQWmbeu/DeoBq9UU+7YE9+7+4ZJ4AFMeXrWyTl7J9n/HvEW3kd280K4QFrxfQNej4VXoGz2OFCNfFQmVB1+QGjXhmrukq+HFffWwB82o5k9A57NKjSPxqSzGu0bUHWwN8avLkYwXXXmcdj3qt1EnqHihQVG2F1jcQ6mQMtHBSp/+lapzgqvRH8bl+qXqM9Rr5ArT3v0QTFrE47Pn/lOPrWFI8Glv+XwOSNa64pOqE7KM+OCVHaGnjIgdS0Gk/2JePyC52LLLdoljIyT5WExUxYDL7n60roBVQTG9CI0y1Cj3zv70F1HE6ku41hRXWAlVFqB1s/4IJW23Au20DhzxWVvFhYWylLblufioz0wr7AU94qPEcJEhwifML3bve+n10N0qRZ5XWM9tcGF1wI9/4GZtmDOtzE9aAhOL7UvT5KiHaUhV0jyJ6rAVnyNx1w1ra6xOq5PWn9hYkjob85dUmIf1ZKhaMng== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 596ccf31-2bf7-4f82-04a2-08da8d2e2d65 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2022 21:57:49.8765 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: z0owOVscGIkE9E3ezskAxtNfj2jOAMuiRmyBlEPUCg4tABrN4VlfKkbXBkgvMOXbN15SeUYWloOSLcZ5LU/O+g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB4085 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This moves mac-specific initialization to mac-specific files. This will make it easier to work with individual macs. It will also make it easier to refactor the initialization to simplify the control flow. No functional change intended. Signed-off-by: Sean Anderson Acked-by: Camelia Groza --- (no changes since v2) Changes in v2: - Fix prototype for dtsec_initialization .../net/ethernet/freescale/fman/fman_dtsec.c | 88 ++++++ .../net/ethernet/freescale/fman/fman_dtsec.h | 26 +- .../net/ethernet/freescale/fman/fman_memac.c | 113 +++++++- .../net/ethernet/freescale/fman/fman_memac.h | 25 +- .../net/ethernet/freescale/fman/fman_tgec.c | 65 +++++ .../net/ethernet/freescale/fman/fman_tgec.h | 22 +- drivers/net/ethernet/freescale/fman/mac.c | 261 ------------------ 7 files changed, 277 insertions(+), 323 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index 7f4f3d797a8d..92c2e35d3b4f 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -7,6 +7,7 @@ #include "fman_dtsec.h" #include "fman.h" +#include "mac.h" #include #include @@ -1247,6 +1248,28 @@ int dtsec_restart_autoneg(struct fman_mac *dtsec) return 0; } +static void adjust_link_dtsec(struct mac_device *mac_dev) +{ + struct phy_device *phy_dev = mac_dev->phy_dev; + struct fman_mac *fman_mac; + bool rx_pause, tx_pause; + int err; + + fman_mac = mac_dev->fman_mac; + if (!phy_dev->link) { + dtsec_restart_autoneg(fman_mac); + + return; + } + + dtsec_adjust_link(fman_mac, phy_dev->speed); + fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause); + err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause); + if (err < 0) + dev_err(mac_dev->dev, "fman_set_mac_active_pause() = %d\n", + err); +} + int dtsec_get_version(struct fman_mac *dtsec, u32 *mac_version) { struct dtsec_regs __iomem *regs = dtsec->regs; @@ -1492,3 +1515,68 @@ struct fman_mac *dtsec_config(struct fman_mac_params *params) kfree(dtsec); return NULL; } + +int dtsec_initialization(struct mac_device *mac_dev, + struct device_node *mac_node) +{ + int err; + struct fman_mac_params params; + u32 version; + + mac_dev->set_promisc = dtsec_set_promiscuous; + mac_dev->change_addr = dtsec_modify_mac_address; + mac_dev->add_hash_mac_addr = dtsec_add_hash_mac_address; + mac_dev->remove_hash_mac_addr = dtsec_del_hash_mac_address; + mac_dev->set_tx_pause = dtsec_set_tx_pause_frames; + mac_dev->set_rx_pause = dtsec_accept_rx_pause_frames; + mac_dev->set_exception = dtsec_set_exception; + mac_dev->set_allmulti = dtsec_set_allmulti; + mac_dev->set_tstamp = dtsec_set_tstamp; + mac_dev->set_multi = fman_set_multi; + mac_dev->adjust_link = adjust_link_dtsec; + mac_dev->enable = dtsec_enable; + mac_dev->disable = dtsec_disable; + + err = set_fman_mac_params(mac_dev, ¶ms); + if (err) + goto _return; + params.internal_phy_node = of_parse_phandle(mac_node, "tbi-handle", 0); + + mac_dev->fman_mac = dtsec_config(¶ms); + if (!mac_dev->fman_mac) { + err = -EINVAL; + goto _return; + } + + err = dtsec_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); + if (err < 0) + goto _return_fm_mac_free; + + err = dtsec_cfg_pad_and_crc(mac_dev->fman_mac, true); + if (err < 0) + goto _return_fm_mac_free; + + err = dtsec_init(mac_dev->fman_mac); + if (err < 0) + goto _return_fm_mac_free; + + /* For 1G MAC, disable by default the MIB counters overflow interrupt */ + err = mac_dev->set_exception(mac_dev->fman_mac, + FM_MAC_EX_1G_RX_MIB_CNT_OVFL, false); + if (err < 0) + goto _return_fm_mac_free; + + err = dtsec_get_version(mac_dev->fman_mac, &version); + if (err < 0) + goto _return_fm_mac_free; + + dev_info(mac_dev->dev, "FMan dTSEC version: 0x%08x\n", version); + + goto _return; + +_return_fm_mac_free: + dtsec_free(mac_dev->fman_mac); + +_return: + return err; +} diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.h b/drivers/net/ethernet/freescale/fman/fman_dtsec.h index f072cdc560ba..cf3e683c089c 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.h +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.h @@ -8,27 +8,9 @@ #include "fman_mac.h" -struct fman_mac *dtsec_config(struct fman_mac_params *params); -int dtsec_set_promiscuous(struct fman_mac *dtsec, bool new_val); -int dtsec_modify_mac_address(struct fman_mac *dtsec, const enet_addr_t *enet_addr); -int dtsec_adjust_link(struct fman_mac *dtsec, - u16 speed); -int dtsec_restart_autoneg(struct fman_mac *dtsec); -int dtsec_cfg_max_frame_len(struct fman_mac *dtsec, u16 new_val); -int dtsec_cfg_pad_and_crc(struct fman_mac *dtsec, bool new_val); -int dtsec_enable(struct fman_mac *dtsec); -int dtsec_disable(struct fman_mac *dtsec); -int dtsec_init(struct fman_mac *dtsec); -int dtsec_free(struct fman_mac *dtsec); -int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en); -int dtsec_set_tx_pause_frames(struct fman_mac *dtsec, u8 priority, - u16 pause_time, u16 thresh_time); -int dtsec_set_exception(struct fman_mac *dtsec, - enum fman_mac_exceptions exception, bool enable); -int dtsec_add_hash_mac_address(struct fman_mac *dtsec, enet_addr_t *eth_addr); -int dtsec_del_hash_mac_address(struct fman_mac *dtsec, enet_addr_t *eth_addr); -int dtsec_get_version(struct fman_mac *dtsec, u32 *mac_version); -int dtsec_set_allmulti(struct fman_mac *dtsec, bool enable); -int dtsec_set_tstamp(struct fman_mac *dtsec, bool enable); +struct mac_device; + +int dtsec_initialization(struct mac_device *mac_dev, + struct device_node *mac_node); #endif /* __DTSEC_H */ diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index c34da49aed31..fc5abd65f620 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -7,6 +7,7 @@ #include "fman_memac.h" #include "fman.h" +#include "mac.h" #include #include @@ -774,6 +775,23 @@ int memac_adjust_link(struct fman_mac *memac, u16 speed) return 0; } +static void adjust_link_memac(struct mac_device *mac_dev) +{ + struct phy_device *phy_dev = mac_dev->phy_dev; + struct fman_mac *fman_mac; + bool rx_pause, tx_pause; + int err; + + fman_mac = mac_dev->fman_mac; + memac_adjust_link(fman_mac, phy_dev->speed); + + fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause); + err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause); + if (err < 0) + dev_err(mac_dev->dev, "fman_set_mac_active_pause() = %d\n", + err); +} + int memac_cfg_max_frame_len(struct fman_mac *memac, u16 new_val) { if (is_init_done(memac->memac_drv_param)) @@ -995,7 +1013,7 @@ int memac_init(struct fman_mac *memac) u8 i; enet_addr_t eth_addr; bool slow_10g_if = false; - struct fixed_phy_status *fixed_link; + struct fixed_phy_status *fixed_link = NULL; int err; u32 reg32 = 0; @@ -1178,3 +1196,96 @@ struct fman_mac *memac_config(struct fman_mac_params *params) return memac; } + +int memac_initialization(struct mac_device *mac_dev, + struct device_node *mac_node) +{ + int err; + struct fman_mac_params params; + struct fixed_phy_status *fixed_link; + + mac_dev->set_promisc = memac_set_promiscuous; + mac_dev->change_addr = memac_modify_mac_address; + mac_dev->add_hash_mac_addr = memac_add_hash_mac_address; + mac_dev->remove_hash_mac_addr = memac_del_hash_mac_address; + mac_dev->set_tx_pause = memac_set_tx_pause_frames; + mac_dev->set_rx_pause = memac_accept_rx_pause_frames; + mac_dev->set_exception = memac_set_exception; + mac_dev->set_allmulti = memac_set_allmulti; + mac_dev->set_tstamp = memac_set_tstamp; + mac_dev->set_multi = fman_set_multi; + mac_dev->adjust_link = adjust_link_memac; + mac_dev->enable = memac_enable; + mac_dev->disable = memac_disable; + + err = set_fman_mac_params(mac_dev, ¶ms); + if (err) + goto _return; + params.internal_phy_node = of_parse_phandle(mac_node, "pcsphy-handle", 0); + + if (params.max_speed == SPEED_10000) + params.phy_if = PHY_INTERFACE_MODE_XGMII; + + mac_dev->fman_mac = memac_config(¶ms); + if (!mac_dev->fman_mac) { + err = -EINVAL; + goto _return; + } + + err = memac_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); + if (err < 0) + goto _return_fm_mac_free; + + err = memac_cfg_reset_on_init(mac_dev->fman_mac, true); + if (err < 0) + goto _return_fm_mac_free; + + if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) { + struct phy_device *phy; + + err = of_phy_register_fixed_link(mac_node); + if (err) + goto _return_fm_mac_free; + + fixed_link = kzalloc(sizeof(*fixed_link), GFP_KERNEL); + if (!fixed_link) { + err = -ENOMEM; + goto _return_fm_mac_free; + } + + mac_dev->phy_node = of_node_get(mac_node); + phy = of_phy_find_device(mac_dev->phy_node); + if (!phy) { + err = -EINVAL; + of_node_put(mac_dev->phy_node); + goto _return_fixed_link_free; + } + + fixed_link->link = phy->link; + fixed_link->speed = phy->speed; + fixed_link->duplex = phy->duplex; + fixed_link->pause = phy->pause; + fixed_link->asym_pause = phy->asym_pause; + + put_device(&phy->mdio.dev); + + err = memac_cfg_fixed_link(mac_dev->fman_mac, fixed_link); + if (err < 0) + goto _return_fixed_link_free; + } + + err = memac_init(mac_dev->fman_mac); + if (err < 0) + goto _return_fixed_link_free; + + dev_info(mac_dev->dev, "FMan MEMAC\n"); + + goto _return; + +_return_fixed_link_free: + kfree(fixed_link); +_return_fm_mac_free: + memac_free(mac_dev->fman_mac); +_return: + return err; +} diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.h b/drivers/net/ethernet/freescale/fman/fman_memac.h index 535ecd2b2ab4..a58215a3b1d9 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.h +++ b/drivers/net/ethernet/freescale/fman/fman_memac.h @@ -11,26 +11,9 @@ #include #include -struct fman_mac *memac_config(struct fman_mac_params *params); -int memac_set_promiscuous(struct fman_mac *memac, bool new_val); -int memac_modify_mac_address(struct fman_mac *memac, const enet_addr_t *enet_addr); -int memac_adjust_link(struct fman_mac *memac, u16 speed); -int memac_cfg_max_frame_len(struct fman_mac *memac, u16 new_val); -int memac_cfg_reset_on_init(struct fman_mac *memac, bool enable); -int memac_cfg_fixed_link(struct fman_mac *memac, - struct fixed_phy_status *fixed_link); -int memac_enable(struct fman_mac *memac); -int memac_disable(struct fman_mac *memac); -int memac_init(struct fman_mac *memac); -int memac_free(struct fman_mac *memac); -int memac_accept_rx_pause_frames(struct fman_mac *memac, bool en); -int memac_set_tx_pause_frames(struct fman_mac *memac, u8 priority, - u16 pause_time, u16 thresh_time); -int memac_set_exception(struct fman_mac *memac, - enum fman_mac_exceptions exception, bool enable); -int memac_add_hash_mac_address(struct fman_mac *memac, enet_addr_t *eth_addr); -int memac_del_hash_mac_address(struct fman_mac *memac, enet_addr_t *eth_addr); -int memac_set_allmulti(struct fman_mac *memac, bool enable); -int memac_set_tstamp(struct fman_mac *memac, bool enable); +struct mac_device; + +int memac_initialization(struct mac_device *mac_dev, + struct device_node *mac_node); #endif /* __MEMAC_H */ diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c index 2b38d22c863d..2f2c4ef45f6f 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c @@ -7,6 +7,7 @@ #include "fman_tgec.h" #include "fman.h" +#include "mac.h" #include #include @@ -609,6 +610,10 @@ int tgec_del_hash_mac_address(struct fman_mac *tgec, enet_addr_t *eth_addr) return 0; } +static void adjust_link_void(struct mac_device *mac_dev) +{ +} + int tgec_get_version(struct fman_mac *tgec, u32 *mac_version) { struct tgec_regs __iomem *regs = tgec->regs; @@ -794,3 +799,63 @@ struct fman_mac *tgec_config(struct fman_mac_params *params) return tgec; } + +int tgec_initialization(struct mac_device *mac_dev, + struct device_node *mac_node) +{ + int err; + struct fman_mac_params params; + u32 version; + + mac_dev->set_promisc = tgec_set_promiscuous; + mac_dev->change_addr = tgec_modify_mac_address; + mac_dev->add_hash_mac_addr = tgec_add_hash_mac_address; + mac_dev->remove_hash_mac_addr = tgec_del_hash_mac_address; + mac_dev->set_tx_pause = tgec_set_tx_pause_frames; + mac_dev->set_rx_pause = tgec_accept_rx_pause_frames; + mac_dev->set_exception = tgec_set_exception; + mac_dev->set_allmulti = tgec_set_allmulti; + mac_dev->set_tstamp = tgec_set_tstamp; + mac_dev->set_multi = fman_set_multi; + mac_dev->adjust_link = adjust_link_void; + mac_dev->enable = tgec_enable; + mac_dev->disable = tgec_disable; + + err = set_fman_mac_params(mac_dev, ¶ms); + if (err) + goto _return; + + mac_dev->fman_mac = tgec_config(¶ms); + if (!mac_dev->fman_mac) { + err = -EINVAL; + goto _return; + } + + err = tgec_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); + if (err < 0) + goto _return_fm_mac_free; + + err = tgec_init(mac_dev->fman_mac); + if (err < 0) + goto _return_fm_mac_free; + + /* For 10G MAC, disable Tx ECC exception */ + err = mac_dev->set_exception(mac_dev->fman_mac, + FM_MAC_EX_10G_TX_ECC_ER, false); + if (err < 0) + goto _return_fm_mac_free; + + err = tgec_get_version(mac_dev->fman_mac, &version); + if (err < 0) + goto _return_fm_mac_free; + + pr_info("FMan XGEC version: 0x%08x\n", version); + + goto _return; + +_return_fm_mac_free: + tgec_free(mac_dev->fman_mac); + +_return: + return err; +} diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.h b/drivers/net/ethernet/freescale/fman/fman_tgec.h index 5b256758cbec..2e45b9fea352 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.h +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.h @@ -8,23 +8,9 @@ #include "fman_mac.h" -struct fman_mac *tgec_config(struct fman_mac_params *params); -int tgec_set_promiscuous(struct fman_mac *tgec, bool new_val); -int tgec_modify_mac_address(struct fman_mac *tgec, const enet_addr_t *enet_addr); -int tgec_cfg_max_frame_len(struct fman_mac *tgec, u16 new_val); -int tgec_enable(struct fman_mac *tgec); -int tgec_disable(struct fman_mac *tgec); -int tgec_init(struct fman_mac *tgec); -int tgec_free(struct fman_mac *tgec); -int tgec_accept_rx_pause_frames(struct fman_mac *tgec, bool en); -int tgec_set_tx_pause_frames(struct fman_mac *tgec, u8 priority, - u16 pause_time, u16 thresh_time); -int tgec_set_exception(struct fman_mac *tgec, - enum fman_mac_exceptions exception, bool enable); -int tgec_add_hash_mac_address(struct fman_mac *tgec, enet_addr_t *eth_addr); -int tgec_del_hash_mac_address(struct fman_mac *tgec, enet_addr_t *eth_addr); -int tgec_get_version(struct fman_mac *tgec, u32 *mac_version); -int tgec_set_allmulti(struct fman_mac *tgec, bool enable); -int tgec_set_tstamp(struct fman_mac *tgec, bool enable); +struct mac_device; + +int tgec_initialization(struct mac_device *mac_dev, + struct device_node *mac_node); #endif /* __TGEC_H */ diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index f9a3f85760fb..7afedd4995c9 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -216,267 +216,6 @@ void fman_get_pause_cfg(struct mac_device *mac_dev, bool *rx_pause, } EXPORT_SYMBOL(fman_get_pause_cfg); -static void adjust_link_void(struct mac_device *mac_dev) -{ -} - -static void adjust_link_dtsec(struct mac_device *mac_dev) -{ - struct phy_device *phy_dev = mac_dev->phy_dev; - struct fman_mac *fman_mac; - bool rx_pause, tx_pause; - int err; - - fman_mac = mac_dev->fman_mac; - if (!phy_dev->link) { - dtsec_restart_autoneg(fman_mac); - - return; - } - - dtsec_adjust_link(fman_mac, phy_dev->speed); - fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause); - err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause); - if (err < 0) - dev_err(mac_dev->dev, "fman_set_mac_active_pause() = %d\n", - err); -} - -static void adjust_link_memac(struct mac_device *mac_dev) -{ - struct phy_device *phy_dev = mac_dev->phy_dev; - struct fman_mac *fman_mac; - bool rx_pause, tx_pause; - int err; - - fman_mac = mac_dev->fman_mac; - memac_adjust_link(fman_mac, phy_dev->speed); - - fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause); - err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause); - if (err < 0) - dev_err(mac_dev->dev, "fman_set_mac_active_pause() = %d\n", - err); -} - -static int tgec_initialization(struct mac_device *mac_dev, - struct device_node *mac_node) -{ - int err; - struct fman_mac_params params; - u32 version; - - mac_dev->set_promisc = tgec_set_promiscuous; - mac_dev->change_addr = tgec_modify_mac_address; - mac_dev->add_hash_mac_addr = tgec_add_hash_mac_address; - mac_dev->remove_hash_mac_addr = tgec_del_hash_mac_address; - mac_dev->set_tx_pause = tgec_set_tx_pause_frames; - mac_dev->set_rx_pause = tgec_accept_rx_pause_frames; - mac_dev->set_exception = tgec_set_exception; - mac_dev->set_allmulti = tgec_set_allmulti; - mac_dev->set_tstamp = tgec_set_tstamp; - mac_dev->set_multi = fman_set_multi; - mac_dev->adjust_link = adjust_link_void; - mac_dev->enable = tgec_enable; - mac_dev->disable = tgec_disable; - - err = set_fman_mac_params(mac_dev, ¶ms); - if (err) - goto _return; - - mac_dev->fman_mac = tgec_config(¶ms); - if (!mac_dev->fman_mac) { - err = -EINVAL; - goto _return; - } - - err = tgec_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); - if (err < 0) - goto _return_fm_mac_free; - - err = tgec_init(mac_dev->fman_mac); - if (err < 0) - goto _return_fm_mac_free; - - /* For 10G MAC, disable Tx ECC exception */ - err = mac_dev->set_exception(mac_dev->fman_mac, - FM_MAC_EX_10G_TX_ECC_ER, false); - if (err < 0) - goto _return_fm_mac_free; - - err = tgec_get_version(mac_dev->fman_mac, &version); - if (err < 0) - goto _return_fm_mac_free; - - dev_info(mac_dev->dev, "FMan XGEC version: 0x%08x\n", version); - - goto _return; - -_return_fm_mac_free: - tgec_free(mac_dev->fman_mac); - -_return: - return err; -} - -static int dtsec_initialization(struct mac_device *mac_dev, - struct device_node *mac_node) -{ - int err; - struct fman_mac_params params; - u32 version; - - mac_dev->set_promisc = dtsec_set_promiscuous; - mac_dev->change_addr = dtsec_modify_mac_address; - mac_dev->add_hash_mac_addr = dtsec_add_hash_mac_address; - mac_dev->remove_hash_mac_addr = dtsec_del_hash_mac_address; - mac_dev->set_tx_pause = dtsec_set_tx_pause_frames; - mac_dev->set_rx_pause = dtsec_accept_rx_pause_frames; - mac_dev->set_exception = dtsec_set_exception; - mac_dev->set_allmulti = dtsec_set_allmulti; - mac_dev->set_tstamp = dtsec_set_tstamp; - mac_dev->set_multi = fman_set_multi; - mac_dev->adjust_link = adjust_link_dtsec; - mac_dev->enable = dtsec_enable; - mac_dev->disable = dtsec_disable; - - err = set_fman_mac_params(mac_dev, ¶ms); - if (err) - goto _return; - params.internal_phy_node = of_parse_phandle(mac_node, "tbi-handle", 0); - - mac_dev->fman_mac = dtsec_config(¶ms); - if (!mac_dev->fman_mac) { - err = -EINVAL; - goto _return; - } - - err = dtsec_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); - if (err < 0) - goto _return_fm_mac_free; - - err = dtsec_cfg_pad_and_crc(mac_dev->fman_mac, true); - if (err < 0) - goto _return_fm_mac_free; - - err = dtsec_init(mac_dev->fman_mac); - if (err < 0) - goto _return_fm_mac_free; - - /* For 1G MAC, disable by default the MIB counters overflow interrupt */ - err = mac_dev->set_exception(mac_dev->fman_mac, - FM_MAC_EX_1G_RX_MIB_CNT_OVFL, false); - if (err < 0) - goto _return_fm_mac_free; - - err = dtsec_get_version(mac_dev->fman_mac, &version); - if (err < 0) - goto _return_fm_mac_free; - - dev_info(mac_dev->dev, "FMan dTSEC version: 0x%08x\n", version); - - goto _return; - -_return_fm_mac_free: - dtsec_free(mac_dev->fman_mac); - -_return: - return err; -} - -static int memac_initialization(struct mac_device *mac_dev, - struct device_node *mac_node) -{ - int err; - struct fman_mac_params params; - struct fixed_phy_status *fixed_link = NULL; - - mac_dev->set_promisc = memac_set_promiscuous; - mac_dev->change_addr = memac_modify_mac_address; - mac_dev->add_hash_mac_addr = memac_add_hash_mac_address; - mac_dev->remove_hash_mac_addr = memac_del_hash_mac_address; - mac_dev->set_tx_pause = memac_set_tx_pause_frames; - mac_dev->set_rx_pause = memac_accept_rx_pause_frames; - mac_dev->set_exception = memac_set_exception; - mac_dev->set_allmulti = memac_set_allmulti; - mac_dev->set_tstamp = memac_set_tstamp; - mac_dev->set_multi = fman_set_multi; - mac_dev->adjust_link = adjust_link_memac; - mac_dev->enable = memac_enable; - mac_dev->disable = memac_disable; - - err = set_fman_mac_params(mac_dev, ¶ms); - if (err) - goto _return; - params.internal_phy_node = of_parse_phandle(mac_node, "pcsphy-handle", 0); - - if (params.max_speed == SPEED_10000) - params.phy_if = PHY_INTERFACE_MODE_XGMII; - - mac_dev->fman_mac = memac_config(¶ms); - if (!mac_dev->fman_mac) { - err = -EINVAL; - goto _return; - } - - err = memac_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); - if (err < 0) - goto _return_fm_mac_free; - - err = memac_cfg_reset_on_init(mac_dev->fman_mac, true); - if (err < 0) - goto _return_fm_mac_free; - - if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) { - struct phy_device *phy; - - err = of_phy_register_fixed_link(mac_node); - if (err) - goto _return_fm_mac_free; - - fixed_link = kzalloc(sizeof(*fixed_link), GFP_KERNEL); - if (!fixed_link) { - err = -ENOMEM; - goto _return_fm_mac_free; - } - - mac_dev->phy_node = of_node_get(mac_node); - phy = of_phy_find_device(mac_dev->phy_node); - if (!phy) { - err = -EINVAL; - of_node_put(mac_dev->phy_node); - goto _return_fixed_link_free; - } - - fixed_link->link = phy->link; - fixed_link->speed = phy->speed; - fixed_link->duplex = phy->duplex; - fixed_link->pause = phy->pause; - fixed_link->asym_pause = phy->asym_pause; - - put_device(&phy->mdio.dev); - - err = memac_cfg_fixed_link(mac_dev->fman_mac, fixed_link); - if (err < 0) - goto _return_fixed_link_free; - } - - err = memac_init(mac_dev->fman_mac); - if (err < 0) - goto _return_fixed_link_free; - - dev_info(mac_dev->dev, "FMan MEMAC\n"); - - goto _return; - -_return_fixed_link_free: - kfree(fixed_link); -_return_fm_mac_free: - memac_free(mac_dev->fman_mac); -_return: - return err; -} - #define DTSEC_SUPPORTED \ (SUPPORTED_10baseT_Half \ | SUPPORTED_10baseT_Full \ From patchwork Fri Sep 2 21:57:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12964728 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 B51ABC6FA83 for ; Fri, 2 Sep 2022 21:58:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231297AbiIBV6t (ORCPT ); Fri, 2 Sep 2022 17:58:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231186AbiIBV6T (ORCPT ); Fri, 2 Sep 2022 17:58:19 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150043.outbound.protection.outlook.com [40.107.15.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 477EBFB0E8; Fri, 2 Sep 2022 14:58:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y5eMySqUnZoitF17GEFJPrZ0oMnuUdFPBGTa/ROdYr5xuaQ4BEqJn3U1DP+QCre97JUcWDHctn8UAl2FpzQBYauuQHrgMzZ7iw9VwImevM6Pb0l0SeGHfyW+ISCaIraXTMNQrt3Fb78gLdLrwMzl/gYysRv4YHzskmnN+ECj0oPtKGrKWa/NfMAzZtl/QHWUq9oMWDYJYwFYhALSdxBhQM/CBCqhXFZlTWLpVY3SU6DctqFuy9f99Wf5x6uJnDkQAwHfniIMzFM0N4CuamhD0KyDuEyRi2nzjHNT54LMp/zsvOx1z4FIJzED9WSYN/mo5EOqMWoUzf5onBKWAI7gsQ== 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=EOR3if54A6X5VAfYoNFEwrmCWpwdssdCPzhpYtyRIs8=; b=MvGjXY8M02WW2O/YZHwNJsUawQXpStRdHv1mloRpMhBJJALqH9PJ4V6VltmHRhS/XdTDgrzIIRU+dzZB1f3CXP4Q+r+PGLub5KLz22gaF6YEXcnRdA49ffBYdb/BnB++iTIDJSHdBnb6upkAYvwbsxaU97lLZMUuB1nUgoblWZmUT7cD6j6p55Lf/c7gb2bJzh28PNn4kO/g8p8uM4Vivo9nKeFaCiH9QUSj94JUj7eZMSPIzrcgdCxIht5NpRMhm0hQdV4duTQeonBFmGfF21PfgfU1lhuzKgNDm1K2W44nqp6E/AB6mk/vUNl1A7/mO2CHZXOiWRC4D3tTl/GgyQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EOR3if54A6X5VAfYoNFEwrmCWpwdssdCPzhpYtyRIs8=; b=Xqt00V7CCyP9QrJ6X9x7r2gIUBxQdIebGeHv6pndcqCLovABNXDoNnkDFTaSFVal503XeLF/burA48TQ1fkPjQZS4GFDiC8HGWOeKjxk5qC9COGOtVN4nH06npwlHmO+TUKzGVXvUHmnrRlOCn/lWE2SEFZV9TB0WOr6RkoD1RDoSWPLfYJB8geiKQL9oCpUTc20nG/YkX6ohjByrf5Id6UEhg3SPxrVQ+OQyaamKw/w0r+EiHv3m3FvcFKJ3woRMOMACTEjmgfFM0ZN5SKuhBLU4ixEkLH2jPl/hFtIxJsz2pO2Tg/VooW4Vs6uvJ4AW4Fs9JIykr22/r+fxB60Hw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AM6PR03MB4085.eurprd03.prod.outlook.com (2603:10a6:20b:1b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Fri, 2 Sep 2022 21:57:52 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5566.019; Fri, 2 Sep 2022 21:57:52 +0000 From: Sean Anderson To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: Camelia Groza , Madalin Bucur , linux-kernel@vger.kernel.org (open list), linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Sean Anderson Subject: [PATCH net-next v5 02/14] net: fman: Mark mac methods static Date: Fri, 2 Sep 2022 17:57:24 -0400 Message-Id: <20220902215737.981341-3-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220902215737.981341-1-sean.anderson@seco.com> References: <20220902215737.981341-1-sean.anderson@seco.com> X-ClientProxiedBy: CH0PR03CA0315.namprd03.prod.outlook.com (2603:10b6:610:118::15) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9b777966-2b17-4549-f122-08da8d2e2e9a X-MS-TrafficTypeDiagnostic: AM6PR03MB4085:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AYv8kLGMUKy/L7hGJoBPJO7PH+C4NJIgHKBWe253H9233yi0zpq18o9VsbzS+r/KjfWsYkSfNN/wGn7jGwavNkdw95bEahQFejnJ9G4m6HQzw+EcK+3hPS/M8WaockPZO0TYTBIZweF19o9Ym65vtOUSksKzF2aO2SYp1OQNw6sgTu0srOEdcvtKVmkd3bynpfe1WIK7mxlULoBtl9hAglvUelUR9C94GspLUmp5s6YWiYWPevzNkSlsz5AbINaPLXXuFNHUDjzfIXM/Gk2kpqRr1f1i6uWJ6QQq11TByZhx6qx7e/hWYngtKbDrtv+ohDPY4VjRXIcO2OwJeIeQ0zlR44LOCmTo1Po2mCkOIerYG3RmIE5AEg72Vjp8cTev0QsDapsN0drh/B9Nqcle82YsgIIYHL98X8Hspq0U2a9xGugJMVZ2Wdc05yyd7CeoDQZuzDwyrKevw+57iz/l2GxuTH+rLDDp6HlFOWP5gbVR/RgmH4FoPagDNgzVVv/kVCgwJ6KypgCvYgntoRZrG3ni32SXJzi3i/2bCDvjdD2tveio2kZMkWIowy+nZnQ/PJ9xF0ltub87+bSlyWXh6+JjuCfpz2Cww6on+VGxNkg5iDgdxV7tM7RvNPx5VqyUUncK01f5L/wUqiO6xUlC4arLeST8VIGU8JLNtxtBdAtO+bVgaP7fVakuVe0F4Nc76znZuq3zpD1/q+j8tGfu60sN7W1xdNm32sEzhBln14r/oIF1bEQQ+SpEHjBxo7aGbxnCb3oagBo1W14NeXzxxw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(136003)(346002)(376002)(396003)(366004)(30864003)(6506007)(6512007)(26005)(2616005)(186003)(1076003)(7416002)(44832011)(52116002)(8936002)(5660300002)(86362001)(6486002)(41300700001)(6666004)(107886003)(478600001)(83380400001)(36756003)(2906002)(4326008)(8676002)(110136005)(316002)(38350700002)(38100700002)(66476007)(54906003)(66946007)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hH1uP7PGVXVf52uqxrpaBwFf7Z6ZuRFTWzxhGvzv77d14IA1MxdwtUInXoRFyDD1/J1oyI6UVoHyAWlPK4aYwkGKjIuyfHgTeedXXXSPa27RCxnIh6Pyv/EGiSVjK2EIvOu2D3DF8B0blAHn4HcYjZRbUzVWRGDHLMLZk/CIhzAu1vUPr1He8Ko+qX2kcc6xG3xqXoM6mbmZvuD9z0hNVPFiT3L8co/co5gjtOs7xA3JSMk3whAxIYlkNDBd889aqXgOIhsvi/AoE1up0E6K0y/x+G77b5yL2StQ2zWNd9H1peX8jq8KZcuBnq9V9RlfJ/tFYb1NYEl/AKTCC+2B9hHBGklzWlbWeSPOHyYzRMvC+HhHHIM93/rUlJ0pi2CLyPIt0pfR/ZDhj+PmcRXdUZqbTMiWeClLJ3BBdNAduRlWDJymDV5UN7bvDtlnA2EfpFpgBUeE6GxL9prdqR4Qm7YNLAwbsXt93PZeBjuUU+IIzPW5IXJ1rEHHtrAccMtY2tegCnaeBZdnORCoyqnVg7Ot2GccygCFY2qICBSEWa4L0/UB2eNunGSWkf5eSPKrUrpNxqOxSF6mceSKXJcUscEYpZjzMdleA+8KyTBabmoI20kLtYPTqSsVobUKQa5Wj+XjZI0ham+HGRQooF0q+Jq6xc01QFDeS4bxDNXDmeS2nbuNrzNGO57Q17kISUnWXBI28QosImSwiQ0/EUXK9gLyBbFQlyMx54rS2blPYLQXz9kW/Ab5C23RGHZIRiIDMgetpb+LiqLZ9WvxYTpuJWImbBzxILG/5YqICj+ItaeiH9w7NlhPXXf2euPEF+2ih0fw6mID2hDOfx7dqqbrKsOVciYkjK9JybuOM2KTfnr6UizS0EIaCoPvS40B0wAqyB/FPyIihZmiQ5WruDm8P+Q0R2L/7B//VbpAL010DLZMoSczsFeprWUdIQFvhwhlUNK9Vy4QS7Ie2HAu06M7yQYd6w7zRXTN3Lybbudbdtx10895mEe3rhuJ3nci5JQjGhe3paGZaKEmWJ+XVL+Tuud9wgmXU3FR06vSFzfUoIKkIaEKZKVig7HkloED47GnwBp9pt3UP7kER1wc9Ng3tyKY7QvjwLHOFXOYN5AiN5UdvEnprUnr9mhs+PMbgif08VT6SIqeXl908ikXWWjHJlS9jgjA8/HnNQDxTREQMXgB6F7+zd1Bt1SRlJTSP0jooNKM0+hUXVQByUd8vIS0wi5pQjKBp+jRa5ra4gKmCHjTv4F7uEAl92ebPoM5OlY7n5YpAPKqByah+XMxqx2mFfF2ezyFulZwxbymLfl7b/sCXLS3M1f2nPDu4NFmphVDHwanGrdv1sIEQe13YMCvBlN/XwfUM3bTZ3InIlUOmSO87PqwcujIJjzYAy10moJ3Kh3jE2rVb4l/My5Lz2s7x6HHYWowsIvWhF012Bk2nLY6xt3wx5acupxaJVCFlWD/bKfoynaKDdwzAzGPucSk3foM0MntoreJw4Ed+A5hZUU0LfZJgL9M7N85/MB7E5w5yaeuibARSZ6jLHqWzybJDDIUmtg2HPspccXceQVyS+ohZ6QF8xAPkwagk5eVenFeFpMaeyvgwfvbgQPmbgH+4Q== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b777966-2b17-4549-f122-08da8d2e2e9a X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2022 21:57:51.9077 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: opQEWUXNv6B6HBGmpVGwXxoHwGqRvrCPHg7J9sYvrFkc7iq1iqS4kLuW0gYxv39DIOZGRVzro9syzSLFd4q+bA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB4085 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org These methods are no longer accessed outside of the driver file, so mark them as static. Signed-off-by: Sean Anderson Acked-by: Camelia Groza --- (no changes since v1) .../net/ethernet/freescale/fman/fman_dtsec.c | 48 ++++++++++--------- .../net/ethernet/freescale/fman/fman_memac.c | 45 +++++++++-------- .../net/ethernet/freescale/fman/fman_tgec.c | 40 +++++++++------- 3 files changed, 72 insertions(+), 61 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index 92c2e35d3b4f..6991586165d7 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -814,7 +814,7 @@ static void free_init_resources(struct fman_mac *dtsec) dtsec->unicast_addr_hash = NULL; } -int dtsec_cfg_max_frame_len(struct fman_mac *dtsec, u16 new_val) +static int dtsec_cfg_max_frame_len(struct fman_mac *dtsec, u16 new_val) { if (is_init_done(dtsec->dtsec_drv_param)) return -EINVAL; @@ -824,7 +824,7 @@ int dtsec_cfg_max_frame_len(struct fman_mac *dtsec, u16 new_val) return 0; } -int dtsec_cfg_pad_and_crc(struct fman_mac *dtsec, bool new_val) +static int dtsec_cfg_pad_and_crc(struct fman_mac *dtsec, bool new_val) { if (is_init_done(dtsec->dtsec_drv_param)) return -EINVAL; @@ -872,7 +872,7 @@ static void graceful_stop(struct fman_mac *dtsec) } } -int dtsec_enable(struct fman_mac *dtsec) +static int dtsec_enable(struct fman_mac *dtsec) { struct dtsec_regs __iomem *regs = dtsec->regs; u32 tmp; @@ -891,7 +891,7 @@ int dtsec_enable(struct fman_mac *dtsec) return 0; } -int dtsec_disable(struct fman_mac *dtsec) +static int dtsec_disable(struct fman_mac *dtsec) { struct dtsec_regs __iomem *regs = dtsec->regs; u32 tmp; @@ -909,9 +909,10 @@ int dtsec_disable(struct fman_mac *dtsec) return 0; } -int dtsec_set_tx_pause_frames(struct fman_mac *dtsec, - u8 __maybe_unused priority, - u16 pause_time, u16 __maybe_unused thresh_time) +static int dtsec_set_tx_pause_frames(struct fman_mac *dtsec, + u8 __maybe_unused priority, + u16 pause_time, + u16 __maybe_unused thresh_time) { struct dtsec_regs __iomem *regs = dtsec->regs; u32 ptv = 0; @@ -946,7 +947,7 @@ int dtsec_set_tx_pause_frames(struct fman_mac *dtsec, return 0; } -int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en) +static int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en) { struct dtsec_regs __iomem *regs = dtsec->regs; u32 tmp; @@ -968,7 +969,8 @@ int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en) return 0; } -int dtsec_modify_mac_address(struct fman_mac *dtsec, const enet_addr_t *enet_addr) +static int dtsec_modify_mac_address(struct fman_mac *dtsec, + const enet_addr_t *enet_addr) { if (!is_init_done(dtsec->dtsec_drv_param)) return -EINVAL; @@ -986,7 +988,8 @@ int dtsec_modify_mac_address(struct fman_mac *dtsec, const enet_addr_t *enet_add return 0; } -int dtsec_add_hash_mac_address(struct fman_mac *dtsec, enet_addr_t *eth_addr) +static int dtsec_add_hash_mac_address(struct fman_mac *dtsec, + enet_addr_t *eth_addr) { struct dtsec_regs __iomem *regs = dtsec->regs; struct eth_hash_entry *hash_entry; @@ -1052,7 +1055,7 @@ int dtsec_add_hash_mac_address(struct fman_mac *dtsec, enet_addr_t *eth_addr) return 0; } -int dtsec_set_allmulti(struct fman_mac *dtsec, bool enable) +static int dtsec_set_allmulti(struct fman_mac *dtsec, bool enable) { u32 tmp; struct dtsec_regs __iomem *regs = dtsec->regs; @@ -1071,7 +1074,7 @@ int dtsec_set_allmulti(struct fman_mac *dtsec, bool enable) return 0; } -int dtsec_set_tstamp(struct fman_mac *dtsec, bool enable) +static int dtsec_set_tstamp(struct fman_mac *dtsec, bool enable) { struct dtsec_regs __iomem *regs = dtsec->regs; u32 rctrl, tctrl; @@ -1096,7 +1099,8 @@ int dtsec_set_tstamp(struct fman_mac *dtsec, bool enable) return 0; } -int dtsec_del_hash_mac_address(struct fman_mac *dtsec, enet_addr_t *eth_addr) +static int dtsec_del_hash_mac_address(struct fman_mac *dtsec, + enet_addr_t *eth_addr) { struct dtsec_regs __iomem *regs = dtsec->regs; struct list_head *pos; @@ -1167,7 +1171,7 @@ int dtsec_del_hash_mac_address(struct fman_mac *dtsec, enet_addr_t *eth_addr) return 0; } -int dtsec_set_promiscuous(struct fman_mac *dtsec, bool new_val) +static int dtsec_set_promiscuous(struct fman_mac *dtsec, bool new_val) { struct dtsec_regs __iomem *regs = dtsec->regs; u32 tmp; @@ -1196,7 +1200,7 @@ int dtsec_set_promiscuous(struct fman_mac *dtsec, bool new_val) return 0; } -int dtsec_adjust_link(struct fman_mac *dtsec, u16 speed) +static int dtsec_adjust_link(struct fman_mac *dtsec, u16 speed) { struct dtsec_regs __iomem *regs = dtsec->regs; u32 tmp; @@ -1230,7 +1234,7 @@ int dtsec_adjust_link(struct fman_mac *dtsec, u16 speed) return 0; } -int dtsec_restart_autoneg(struct fman_mac *dtsec) +static int dtsec_restart_autoneg(struct fman_mac *dtsec) { u16 tmp_reg16; @@ -1270,7 +1274,7 @@ static void adjust_link_dtsec(struct mac_device *mac_dev) err); } -int dtsec_get_version(struct fman_mac *dtsec, u32 *mac_version) +static int dtsec_get_version(struct fman_mac *dtsec, u32 *mac_version) { struct dtsec_regs __iomem *regs = dtsec->regs; @@ -1282,8 +1286,8 @@ int dtsec_get_version(struct fman_mac *dtsec, u32 *mac_version) return 0; } -int dtsec_set_exception(struct fman_mac *dtsec, - enum fman_mac_exceptions exception, bool enable) +static int dtsec_set_exception(struct fman_mac *dtsec, + enum fman_mac_exceptions exception, bool enable) { struct dtsec_regs __iomem *regs = dtsec->regs; u32 bit_mask = 0; @@ -1336,7 +1340,7 @@ int dtsec_set_exception(struct fman_mac *dtsec, return 0; } -int dtsec_init(struct fman_mac *dtsec) +static int dtsec_init(struct fman_mac *dtsec) { struct dtsec_regs __iomem *regs = dtsec->regs; struct dtsec_cfg *dtsec_drv_param; @@ -1430,7 +1434,7 @@ int dtsec_init(struct fman_mac *dtsec) return 0; } -int dtsec_free(struct fman_mac *dtsec) +static int dtsec_free(struct fman_mac *dtsec) { free_init_resources(dtsec); @@ -1441,7 +1445,7 @@ int dtsec_free(struct fman_mac *dtsec) return 0; } -struct fman_mac *dtsec_config(struct fman_mac_params *params) +static struct fman_mac *dtsec_config(struct fman_mac_params *params) { struct fman_mac *dtsec; struct dtsec_cfg *dtsec_drv_param; diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index fc5abd65f620..d8e1ec16caf9 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -686,7 +686,7 @@ static bool is_init_done(struct memac_cfg *memac_drv_params) return false; } -int memac_enable(struct fman_mac *memac) +static int memac_enable(struct fman_mac *memac) { struct memac_regs __iomem *regs = memac->regs; u32 tmp; @@ -701,7 +701,7 @@ int memac_enable(struct fman_mac *memac) return 0; } -int memac_disable(struct fman_mac *memac) +static int memac_disable(struct fman_mac *memac) { struct memac_regs __iomem *regs = memac->regs; u32 tmp; @@ -716,7 +716,7 @@ int memac_disable(struct fman_mac *memac) return 0; } -int memac_set_promiscuous(struct fman_mac *memac, bool new_val) +static int memac_set_promiscuous(struct fman_mac *memac, bool new_val) { struct memac_regs __iomem *regs = memac->regs; u32 tmp; @@ -735,7 +735,7 @@ int memac_set_promiscuous(struct fman_mac *memac, bool new_val) return 0; } -int memac_adjust_link(struct fman_mac *memac, u16 speed) +static int memac_adjust_link(struct fman_mac *memac, u16 speed) { struct memac_regs __iomem *regs = memac->regs; u32 tmp; @@ -792,7 +792,7 @@ static void adjust_link_memac(struct mac_device *mac_dev) err); } -int memac_cfg_max_frame_len(struct fman_mac *memac, u16 new_val) +static int memac_cfg_max_frame_len(struct fman_mac *memac, u16 new_val) { if (is_init_done(memac->memac_drv_param)) return -EINVAL; @@ -802,7 +802,7 @@ int memac_cfg_max_frame_len(struct fman_mac *memac, u16 new_val) return 0; } -int memac_cfg_reset_on_init(struct fman_mac *memac, bool enable) +static int memac_cfg_reset_on_init(struct fman_mac *memac, bool enable) { if (is_init_done(memac->memac_drv_param)) return -EINVAL; @@ -812,8 +812,8 @@ int memac_cfg_reset_on_init(struct fman_mac *memac, bool enable) return 0; } -int memac_cfg_fixed_link(struct fman_mac *memac, - struct fixed_phy_status *fixed_link) +static int memac_cfg_fixed_link(struct fman_mac *memac, + struct fixed_phy_status *fixed_link) { if (is_init_done(memac->memac_drv_param)) return -EINVAL; @@ -823,8 +823,8 @@ int memac_cfg_fixed_link(struct fman_mac *memac, return 0; } -int memac_set_tx_pause_frames(struct fman_mac *memac, u8 priority, - u16 pause_time, u16 thresh_time) +static int memac_set_tx_pause_frames(struct fman_mac *memac, u8 priority, + u16 pause_time, u16 thresh_time) { struct memac_regs __iomem *regs = memac->regs; u32 tmp; @@ -861,7 +861,7 @@ int memac_set_tx_pause_frames(struct fman_mac *memac, u8 priority, return 0; } -int memac_accept_rx_pause_frames(struct fman_mac *memac, bool en) +static int memac_accept_rx_pause_frames(struct fman_mac *memac, bool en) { struct memac_regs __iomem *regs = memac->regs; u32 tmp; @@ -880,7 +880,8 @@ int memac_accept_rx_pause_frames(struct fman_mac *memac, bool en) return 0; } -int memac_modify_mac_address(struct fman_mac *memac, const enet_addr_t *enet_addr) +static int memac_modify_mac_address(struct fman_mac *memac, + const enet_addr_t *enet_addr) { if (!is_init_done(memac->memac_drv_param)) return -EINVAL; @@ -890,7 +891,8 @@ int memac_modify_mac_address(struct fman_mac *memac, const enet_addr_t *enet_add return 0; } -int memac_add_hash_mac_address(struct fman_mac *memac, enet_addr_t *eth_addr) +static int memac_add_hash_mac_address(struct fman_mac *memac, + enet_addr_t *eth_addr) { struct memac_regs __iomem *regs = memac->regs; struct eth_hash_entry *hash_entry; @@ -923,7 +925,7 @@ int memac_add_hash_mac_address(struct fman_mac *memac, enet_addr_t *eth_addr) return 0; } -int memac_set_allmulti(struct fman_mac *memac, bool enable) +static int memac_set_allmulti(struct fman_mac *memac, bool enable) { u32 entry; struct memac_regs __iomem *regs = memac->regs; @@ -946,12 +948,13 @@ int memac_set_allmulti(struct fman_mac *memac, bool enable) return 0; } -int memac_set_tstamp(struct fman_mac *memac, bool enable) +static int memac_set_tstamp(struct fman_mac *memac, bool enable) { return 0; /* Always enabled. */ } -int memac_del_hash_mac_address(struct fman_mac *memac, enet_addr_t *eth_addr) +static int memac_del_hash_mac_address(struct fman_mac *memac, + enet_addr_t *eth_addr) { struct memac_regs __iomem *regs = memac->regs; struct eth_hash_entry *hash_entry = NULL; @@ -984,8 +987,8 @@ int memac_del_hash_mac_address(struct fman_mac *memac, enet_addr_t *eth_addr) return 0; } -int memac_set_exception(struct fman_mac *memac, - enum fman_mac_exceptions exception, bool enable) +static int memac_set_exception(struct fman_mac *memac, + enum fman_mac_exceptions exception, bool enable) { u32 bit_mask = 0; @@ -1007,7 +1010,7 @@ int memac_set_exception(struct fman_mac *memac, return 0; } -int memac_init(struct fman_mac *memac) +static int memac_init(struct fman_mac *memac) { struct memac_cfg *memac_drv_param; u8 i; @@ -1124,7 +1127,7 @@ int memac_init(struct fman_mac *memac) return 0; } -int memac_free(struct fman_mac *memac) +static int memac_free(struct fman_mac *memac) { free_init_resources(memac); @@ -1137,7 +1140,7 @@ int memac_free(struct fman_mac *memac) return 0; } -struct fman_mac *memac_config(struct fman_mac_params *params) +static struct fman_mac *memac_config(struct fman_mac_params *params) { struct fman_mac *memac; struct memac_cfg *memac_drv_param; diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c index 2f2c4ef45f6f..ca0e00386c66 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c @@ -393,7 +393,7 @@ static bool is_init_done(struct tgec_cfg *cfg) return false; } -int tgec_enable(struct fman_mac *tgec) +static int tgec_enable(struct fman_mac *tgec) { struct tgec_regs __iomem *regs = tgec->regs; u32 tmp; @@ -408,7 +408,7 @@ int tgec_enable(struct fman_mac *tgec) return 0; } -int tgec_disable(struct fman_mac *tgec) +static int tgec_disable(struct fman_mac *tgec) { struct tgec_regs __iomem *regs = tgec->regs; u32 tmp; @@ -423,7 +423,7 @@ int tgec_disable(struct fman_mac *tgec) return 0; } -int tgec_set_promiscuous(struct fman_mac *tgec, bool new_val) +static int tgec_set_promiscuous(struct fman_mac *tgec, bool new_val) { struct tgec_regs __iomem *regs = tgec->regs; u32 tmp; @@ -441,7 +441,7 @@ int tgec_set_promiscuous(struct fman_mac *tgec, bool new_val) return 0; } -int tgec_cfg_max_frame_len(struct fman_mac *tgec, u16 new_val) +static int tgec_cfg_max_frame_len(struct fman_mac *tgec, u16 new_val) { if (is_init_done(tgec->cfg)) return -EINVAL; @@ -451,8 +451,9 @@ int tgec_cfg_max_frame_len(struct fman_mac *tgec, u16 new_val) return 0; } -int tgec_set_tx_pause_frames(struct fman_mac *tgec, u8 __maybe_unused priority, - u16 pause_time, u16 __maybe_unused thresh_time) +static int tgec_set_tx_pause_frames(struct fman_mac *tgec, + u8 __maybe_unused priority, u16 pause_time, + u16 __maybe_unused thresh_time) { struct tgec_regs __iomem *regs = tgec->regs; @@ -464,7 +465,7 @@ int tgec_set_tx_pause_frames(struct fman_mac *tgec, u8 __maybe_unused priority, return 0; } -int tgec_accept_rx_pause_frames(struct fman_mac *tgec, bool en) +static int tgec_accept_rx_pause_frames(struct fman_mac *tgec, bool en) { struct tgec_regs __iomem *regs = tgec->regs; u32 tmp; @@ -482,7 +483,8 @@ int tgec_accept_rx_pause_frames(struct fman_mac *tgec, bool en) return 0; } -int tgec_modify_mac_address(struct fman_mac *tgec, const enet_addr_t *p_enet_addr) +static int tgec_modify_mac_address(struct fman_mac *tgec, + const enet_addr_t *p_enet_addr) { if (!is_init_done(tgec->cfg)) return -EINVAL; @@ -493,7 +495,8 @@ int tgec_modify_mac_address(struct fman_mac *tgec, const enet_addr_t *p_enet_add return 0; } -int tgec_add_hash_mac_address(struct fman_mac *tgec, enet_addr_t *eth_addr) +static int tgec_add_hash_mac_address(struct fman_mac *tgec, + enet_addr_t *eth_addr) { struct tgec_regs __iomem *regs = tgec->regs; struct eth_hash_entry *hash_entry; @@ -530,7 +533,7 @@ int tgec_add_hash_mac_address(struct fman_mac *tgec, enet_addr_t *eth_addr) return 0; } -int tgec_set_allmulti(struct fman_mac *tgec, bool enable) +static int tgec_set_allmulti(struct fman_mac *tgec, bool enable) { u32 entry; struct tgec_regs __iomem *regs = tgec->regs; @@ -553,7 +556,7 @@ int tgec_set_allmulti(struct fman_mac *tgec, bool enable) return 0; } -int tgec_set_tstamp(struct fman_mac *tgec, bool enable) +static int tgec_set_tstamp(struct fman_mac *tgec, bool enable) { struct tgec_regs __iomem *regs = tgec->regs; u32 tmp; @@ -573,7 +576,8 @@ int tgec_set_tstamp(struct fman_mac *tgec, bool enable) return 0; } -int tgec_del_hash_mac_address(struct fman_mac *tgec, enet_addr_t *eth_addr) +static int tgec_del_hash_mac_address(struct fman_mac *tgec, + enet_addr_t *eth_addr) { struct tgec_regs __iomem *regs = tgec->regs; struct eth_hash_entry *hash_entry = NULL; @@ -614,7 +618,7 @@ static void adjust_link_void(struct mac_device *mac_dev) { } -int tgec_get_version(struct fman_mac *tgec, u32 *mac_version) +static int tgec_get_version(struct fman_mac *tgec, u32 *mac_version) { struct tgec_regs __iomem *regs = tgec->regs; @@ -626,8 +630,8 @@ int tgec_get_version(struct fman_mac *tgec, u32 *mac_version) return 0; } -int tgec_set_exception(struct fman_mac *tgec, - enum fman_mac_exceptions exception, bool enable) +static int tgec_set_exception(struct fman_mac *tgec, + enum fman_mac_exceptions exception, bool enable) { struct tgec_regs __iomem *regs = tgec->regs; u32 bit_mask = 0; @@ -653,7 +657,7 @@ int tgec_set_exception(struct fman_mac *tgec, return 0; } -int tgec_init(struct fman_mac *tgec) +static int tgec_init(struct fman_mac *tgec) { struct tgec_cfg *cfg; enet_addr_t eth_addr; @@ -736,7 +740,7 @@ int tgec_init(struct fman_mac *tgec) return 0; } -int tgec_free(struct fman_mac *tgec) +static int tgec_free(struct fman_mac *tgec) { free_init_resources(tgec); @@ -746,7 +750,7 @@ int tgec_free(struct fman_mac *tgec) return 0; } -struct fman_mac *tgec_config(struct fman_mac_params *params) +static struct fman_mac *tgec_config(struct fman_mac_params *params) { struct fman_mac *tgec; struct tgec_cfg *cfg; From patchwork Fri Sep 2 21:57:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12964730 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 8AE78C6FA86 for ; Fri, 2 Sep 2022 21:58:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231186AbiIBV6z (ORCPT ); Fri, 2 Sep 2022 17:58:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231222AbiIBV6U (ORCPT ); Fri, 2 Sep 2022 17:58:20 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150043.outbound.protection.outlook.com [40.107.15.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FA8DFB29F; Fri, 2 Sep 2022 14:58:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DsccoqxlufET7g7YApV9bEm+KQlOdFu3PBZfZq8M3lQ1LrNTzhnl1a6FxvhI+rBZDbil3i7KSwqbNjypjFrcAEQJfQaMn7+yiQZDpctDAVHcg7yZ1xdFBIN5wBiSz8qIhpWhKilgpAeR7pu5C4Diac4W+//TPErtWJUXyJ1RuUmy39b7NdaRpuegiltJnGMgZCwte6Dr4cFKI8QIjuSsFw65+Tk93qwF/+tnr4+vDLwgOwIomvlGIPKDIfJKk6RqtlQ1VA6toDpOK8LkN4dF6YB8kvSLoJlEzK083IUpOd4B4T1XTGlVpJ3EccRDZ2SMZ6OoKlabtvZ7aBZYaDu44g== 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=yA8N1Y23rKJ/MbRGzbvie3E8a4NB1oLpc/VHH++2zQI=; b=d9D7jE544I2zPWjbT0Ik+BYzfvf13wEdduIr4TGvi3jfUE/28+kV+vB9OxI5AvTTLU7NUSMMfkzHbvZOdmtJ3jWWMzkl6a/Ta2ReCeKH2yuJwAAZQ15SdOkUORcQOeu5QsSbLB54yBE1RHio64uJRZgfuHsm12U0fjX8FnSw2hiL0BjrJTvpt0GvBVpGBKEZkwSywFewgWKhwNniPxUer3aJcA72rdWXTp7aNBjGYi4ITGRx8W/4eaiJ+Ru+6+2OXcAT6MMLFWl/Ye76I/qgrO9eJvbGKBNm1FKAhHlMB41vd2wcEoXsfF0WsC0NDLLrg07+/JrF4KjZeeOGnh1fWw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yA8N1Y23rKJ/MbRGzbvie3E8a4NB1oLpc/VHH++2zQI=; b=oVfnjHuk4vLU+n8eoOYTyBq/VsSj+XjDRyJWLXiwBBtPRB6o7/vnOHhlfMFd1GZ1ikHnjHNAZ4IqF4AoGtljIfooK/cj054lP1uGG8Ej4B2fzXx1IrQ3ZqbeA4V+WrzjEfB/JPRj0CeiPyNnZrzK0BwcrMD1SCtvXq3sQiRmIiyiiq1p+UntTUPDwisoPyM+McCqo+tbeLmXhHQCqk7ly81SwOxfI06kIUFMHXP8YDdwL3aMarGOFcqx/P6t3lZsDZFhoCM+dX0Xdq2PoFBZA3L4lGMw1tS1Pq+STYCF6syKYwqOsjzL8kqxXejZBEs3Oxh1mF+OdCuBK0oIlnCg7g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AM6PR03MB4085.eurprd03.prod.outlook.com (2603:10a6:20b:1b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Fri, 2 Sep 2022 21:57:54 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5566.019; Fri, 2 Sep 2022 21:57:54 +0000 From: Sean Anderson To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: Camelia Groza , Madalin Bucur , linux-kernel@vger.kernel.org (open list), linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Sean Anderson Subject: [PATCH net-next v5 03/14] net: fman: Inline several functions into initialization Date: Fri, 2 Sep 2022 17:57:25 -0400 Message-Id: <20220902215737.981341-4-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220902215737.981341-1-sean.anderson@seco.com> References: <20220902215737.981341-1-sean.anderson@seco.com> X-ClientProxiedBy: CH0PR03CA0315.namprd03.prod.outlook.com (2603:10b6:610:118::15) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: abe469de-d58d-471f-d3d9-08da8d2e306b X-MS-TrafficTypeDiagnostic: AM6PR03MB4085:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WcAO03vllsvSFAJhaY+xsZav4AJGGwHkiAmPPdOgpOopWSvsCUzCdIw4Bqz+c9P+/i9ZKSwMdflVQIDNqlKHhcU+ET7cRV8ZxpYQ1mN/K2iVmcGM6Tj5DPEAZItezSg/c51CYDJvyuPuFz1KEO/GF3nvGgKXRMTbZwLw1V3xlfyncvSTidMWpH3x6YoSWrtyLOVeLJ2OJO6vcy/4r8ezZqE7y0FRpa1VKyoCuw/NFU+ZNISVw1bnlMpuzZ4rc6QNzR1pMuD1K23TjZt70PTKG61+aMHy5dalkjokFbq7xSagdzD7uRa3g22imV1ZQRN//tkS0p2wigNnIkvbdYXoYNppOKkenKZynq7eIhndGXQz1sdaz9gY88z5gC6ZQqpVEDWUfGvuW6ejVp37ZrakY0NFaJZZ2skhFmAkKfRM+RBiRp78CTYIZismNwWoiy2yhdI2pP4iGb7sl6/38sE1k7SdlLE3C/gKMe9R9ZJuCte0KP1eN5WlTHG+21vDexPWLslI/GdKtuosLXbHBdu2gmP3Rg/w1j6Y3c7IjQTWP2Gv/q/eiZXmhtLYjxoyrOJdmkdOLYGNaXrDQJua+Hlo0DRtaMu3N2j9lT7LyUvxqZgrCGyv71jUNcxBnz0CTkDUH53saQkjY+9E327b0171XWMxRbhiCyrbUr4/n+0tE+WH+UyvjkFPs2qTG1wQByjGmP9PMTBAN+Oh57ZxXyDd0OXSfpJURdbTRo9kJNiBcvI2PSepcZ/aZ2slolupl3sbLiuviRJi0ZY5jqhfenUcrw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(136003)(346002)(376002)(396003)(366004)(6506007)(6512007)(26005)(2616005)(186003)(1076003)(7416002)(44832011)(52116002)(8936002)(5660300002)(86362001)(6486002)(41300700001)(6666004)(107886003)(478600001)(83380400001)(36756003)(2906002)(4326008)(8676002)(110136005)(316002)(38350700002)(38100700002)(66476007)(54906003)(66946007)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +YkKL9udhWuw4J0yY7b0+ygltXrUjB1BpvIPNx+GMvaRsstY8ZFdGG4BR1i5byMcutjb/vKhNuY35u4Ip9tlhZ0dkJE2wwctTZfbrN/jrMX40rdsPkuGbh55FTyqcUmwDnKOhKuudmH708u42ICX9Tw7oyBhw6cKOxu64St5bcLTnc2UA4YHyJzA+DL1HmWr4E2UhYCgP1RnPYfH0ZHa5QI18ekZ34x9OaocJFjU2KvYHoVq78YUi90cGoTrbDO9sfJai0gI4hDvfF0M6/7uqF4v+dM5Jg+wLk0O0QVHVXcBSfIbByQzNqq+cx1s/f/Tj3hjUdyxcTh21rlfGcZnS6W4NjxmEGsfKQEFE9R7xcn0e8HBTr7kAjw9Mdi4f//z4qXLVlBasKfrrLgCm4bUlIJa0CAVV7UiegLDjJIJ1IIgChcT4ULZr18Hz0n+nPyBznmUAB/YGdrWmgmmYjSh2oGYWMPg3s2IvlbHbu+Q1nykjJkVfHBlHIj0NzjesXdFtgsa9qpPKGdS6HtYVuiAX6tx+DR+b2ypcMQUK/i/NPCSXC/zCYQDLJxjQEgYdT7rO6kNF4/o37k8F1gUYW6sV7jAhijTBljntvRCWPwYLlNNNaJGRB1X0j9Ci49YgoDSttmNuIrEWaeWt9vmh352SQ08LhG4O9KxNDSVos+6aDh3EpgPCBLynT3F+2n0GNjI8fmazY6SO2Qecw14puN6QXuxKmX87KhW/P7NkPQeUbbL3Utx2JoRiW+OG9+Cz34BS8uwlYUE7nNWptck3IoOWu01O8uBpqPll+7uQAv5zuUIJXx0/66TzqW4YCpYPcvz0izaYI17R/u472dT7Ngw/a/w4tTQbV4KbAOSro4SeUFWuDBrPCbFYWepthiwAqrK30WH/Qi4pZ8+XS/q1ZQgFBL7jO5iph03LOjpVyEswH8LvvgamKRC5VeZ1e/XMIsrrt05BeyNWBseQO23htz4ge1VZ79OYcfCYTTQB/vOyldzZx2dVpZP2GCIHt8ymxzkI5rbDedz+Egx/R5AB68ivyxbz8Tk9M6l50ARzBtrW3Ba+V49VwiiHbwT5b2A4WXwEyc3vHtVGBSppSNEJVVAAYDwviBMR+RepMtD4q0sSJ4Cz6fufNK/7dPdHLHe49kR7HSoDSD1h29hCFsScDEvS3xP/tvXCfUMtkSJI6K4sH5HNMs2PbuVcsfLcfiqq2Ty54eLImHrOV998Ej/UlxMqF4K/H0bSTXPtm7NlWlq2mfvQKtRk1kcLdUxe2ubYfOpLKxcwf9J5etkt4iBgu+s5UzOZA+G1wtaP514x31SBtBKUYOTqGhRk1HRkda/qrU4XgzN5UsqgRefHCYnS8crNP9L2JGWmKB9Mffi9+6HSYU2wOiTnZZxbia2HHlzsBG4xpvCiXKUWwjtV52zvlg+HG6dwl3YwjnsIjiDlAnGYOW0Kce6q7E9LCJ/CEJpgQp62WI7xBfUawEEp5Y5U2ZAs/KQd56bLVpWOdUeq70XtIuudMnjIEfAZo6a/8fUq0/tybUTlK0n15RhYvF5ib8IGOnrHZrLcskCaG9nCpnIg20STdOiycXHWHuH4xXFVqumhTT4MuZo7aDPmU/7xalfDg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: abe469de-d58d-471f-d3d9-08da8d2e306b X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2022 21:57:54.8450 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: f+5f6haflVznecoAV2CsVXHprnv/wtdcmXexxpN7T+YKUak7WBvY6ufUqayYfpl46KOKjfEU6L8FO6iz4ZljqA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB4085 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org There are several small functions which were only necessary because the initialization functions didn't have access to the mac private data. Now that they do, just do things directly. Signed-off-by: Sean Anderson Acked-by: Camelia Groza --- (no changes since v4) Changes in v4: - weer -> were .../net/ethernet/freescale/fman/fman_dtsec.c | 59 +++---------------- .../net/ethernet/freescale/fman/fman_memac.c | 47 ++------------- .../net/ethernet/freescale/fman/fman_tgec.c | 43 +++----------- 3 files changed, 21 insertions(+), 128 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index 6991586165d7..84205be3a817 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -814,26 +814,6 @@ static void free_init_resources(struct fman_mac *dtsec) dtsec->unicast_addr_hash = NULL; } -static int dtsec_cfg_max_frame_len(struct fman_mac *dtsec, u16 new_val) -{ - if (is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - - dtsec->dtsec_drv_param->maximum_frame = new_val; - - return 0; -} - -static int dtsec_cfg_pad_and_crc(struct fman_mac *dtsec, bool new_val) -{ - if (is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - - dtsec->dtsec_drv_param->tx_pad_crc = new_val; - - return 0; -} - static void graceful_start(struct fman_mac *dtsec) { struct dtsec_regs __iomem *regs = dtsec->regs; @@ -1274,18 +1254,6 @@ static void adjust_link_dtsec(struct mac_device *mac_dev) err); } -static int dtsec_get_version(struct fman_mac *dtsec, u32 *mac_version) -{ - struct dtsec_regs __iomem *regs = dtsec->regs; - - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - - *mac_version = ioread32be(®s->tsec_id); - - return 0; -} - static int dtsec_set_exception(struct fman_mac *dtsec, enum fman_mac_exceptions exception, bool enable) { @@ -1525,7 +1493,7 @@ int dtsec_initialization(struct mac_device *mac_dev, { int err; struct fman_mac_params params; - u32 version; + struct fman_mac *dtsec; mac_dev->set_promisc = dtsec_set_promiscuous; mac_dev->change_addr = dtsec_modify_mac_address; @@ -1552,34 +1520,25 @@ int dtsec_initialization(struct mac_device *mac_dev, goto _return; } - err = dtsec_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); - if (err < 0) - goto _return_fm_mac_free; - - err = dtsec_cfg_pad_and_crc(mac_dev->fman_mac, true); - if (err < 0) - goto _return_fm_mac_free; - - err = dtsec_init(mac_dev->fman_mac); + dtsec = mac_dev->fman_mac; + dtsec->dtsec_drv_param->maximum_frame = fman_get_max_frm(); + dtsec->dtsec_drv_param->tx_pad_crc = true; + err = dtsec_init(dtsec); if (err < 0) goto _return_fm_mac_free; /* For 1G MAC, disable by default the MIB counters overflow interrupt */ - err = mac_dev->set_exception(mac_dev->fman_mac, - FM_MAC_EX_1G_RX_MIB_CNT_OVFL, false); + err = dtsec_set_exception(dtsec, FM_MAC_EX_1G_RX_MIB_CNT_OVFL, false); if (err < 0) goto _return_fm_mac_free; - err = dtsec_get_version(mac_dev->fman_mac, &version); - if (err < 0) - goto _return_fm_mac_free; - - dev_info(mac_dev->dev, "FMan dTSEC version: 0x%08x\n", version); + dev_info(mac_dev->dev, "FMan dTSEC version: 0x%08x\n", + ioread32be(&dtsec->regs->tsec_id)); goto _return; _return_fm_mac_free: - dtsec_free(mac_dev->fman_mac); + dtsec_free(dtsec); _return: return err; diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index d8e1ec16caf9..e5d75597463a 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -792,37 +792,6 @@ static void adjust_link_memac(struct mac_device *mac_dev) err); } -static int memac_cfg_max_frame_len(struct fman_mac *memac, u16 new_val) -{ - if (is_init_done(memac->memac_drv_param)) - return -EINVAL; - - memac->memac_drv_param->max_frame_length = new_val; - - return 0; -} - -static int memac_cfg_reset_on_init(struct fman_mac *memac, bool enable) -{ - if (is_init_done(memac->memac_drv_param)) - return -EINVAL; - - memac->memac_drv_param->reset_on_init = enable; - - return 0; -} - -static int memac_cfg_fixed_link(struct fman_mac *memac, - struct fixed_phy_status *fixed_link) -{ - if (is_init_done(memac->memac_drv_param)) - return -EINVAL; - - memac->memac_drv_param->fixed_link = fixed_link; - - return 0; -} - static int memac_set_tx_pause_frames(struct fman_mac *memac, u8 priority, u16 pause_time, u16 thresh_time) { @@ -1206,6 +1175,7 @@ int memac_initialization(struct mac_device *mac_dev, int err; struct fman_mac_params params; struct fixed_phy_status *fixed_link; + struct fman_mac *memac; mac_dev->set_promisc = memac_set_promiscuous; mac_dev->change_addr = memac_modify_mac_address; @@ -1235,13 +1205,9 @@ int memac_initialization(struct mac_device *mac_dev, goto _return; } - err = memac_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); - if (err < 0) - goto _return_fm_mac_free; - - err = memac_cfg_reset_on_init(mac_dev->fman_mac, true); - if (err < 0) - goto _return_fm_mac_free; + memac = mac_dev->fman_mac; + memac->memac_drv_param->max_frame_length = fman_get_max_frm(); + memac->memac_drv_param->reset_on_init = true; if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) { struct phy_device *phy; @@ -1271,10 +1237,7 @@ int memac_initialization(struct mac_device *mac_dev, fixed_link->asym_pause = phy->asym_pause; put_device(&phy->mdio.dev); - - err = memac_cfg_fixed_link(mac_dev->fman_mac, fixed_link); - if (err < 0) - goto _return_fixed_link_free; + memac->memac_drv_param->fixed_link = fixed_link; } err = memac_init(mac_dev->fman_mac); diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c index ca0e00386c66..32ee1674ff2f 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c @@ -441,16 +441,6 @@ static int tgec_set_promiscuous(struct fman_mac *tgec, bool new_val) return 0; } -static int tgec_cfg_max_frame_len(struct fman_mac *tgec, u16 new_val) -{ - if (is_init_done(tgec->cfg)) - return -EINVAL; - - tgec->cfg->max_frame_length = new_val; - - return 0; -} - static int tgec_set_tx_pause_frames(struct fman_mac *tgec, u8 __maybe_unused priority, u16 pause_time, u16 __maybe_unused thresh_time) @@ -618,18 +608,6 @@ static void adjust_link_void(struct mac_device *mac_dev) { } -static int tgec_get_version(struct fman_mac *tgec, u32 *mac_version) -{ - struct tgec_regs __iomem *regs = tgec->regs; - - if (!is_init_done(tgec->cfg)) - return -EINVAL; - - *mac_version = ioread32be(®s->tgec_id); - - return 0; -} - static int tgec_set_exception(struct fman_mac *tgec, enum fman_mac_exceptions exception, bool enable) { @@ -809,7 +787,7 @@ int tgec_initialization(struct mac_device *mac_dev, { int err; struct fman_mac_params params; - u32 version; + struct fman_mac *tgec; mac_dev->set_promisc = tgec_set_promiscuous; mac_dev->change_addr = tgec_modify_mac_address; @@ -835,26 +813,19 @@ int tgec_initialization(struct mac_device *mac_dev, goto _return; } - err = tgec_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); - if (err < 0) - goto _return_fm_mac_free; - - err = tgec_init(mac_dev->fman_mac); + tgec = mac_dev->fman_mac; + tgec->cfg->max_frame_length = fman_get_max_frm(); + err = tgec_init(tgec); if (err < 0) goto _return_fm_mac_free; /* For 10G MAC, disable Tx ECC exception */ - err = mac_dev->set_exception(mac_dev->fman_mac, - FM_MAC_EX_10G_TX_ECC_ER, false); + err = tgec_set_exception(tgec, FM_MAC_EX_10G_TX_ECC_ER, false); if (err < 0) goto _return_fm_mac_free; - err = tgec_get_version(mac_dev->fman_mac, &version); - if (err < 0) - goto _return_fm_mac_free; - - pr_info("FMan XGEC version: 0x%08x\n", version); - + pr_info("FMan XGEC version: 0x%08x\n", + ioread32be(&tgec->regs->tgec_id)); goto _return; _return_fm_mac_free: From patchwork Fri Sep 2 21:57:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12964731 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 26CF4C6FA83 for ; Fri, 2 Sep 2022 21:58:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231336AbiIBV65 (ORCPT ); Fri, 2 Sep 2022 17:58:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230435AbiIBV6U (ORCPT ); Fri, 2 Sep 2022 17:58:20 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150079.outbound.protection.outlook.com [40.107.15.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E559BF63E1; Fri, 2 Sep 2022 14:58:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nH5e+Yh4irqGDToZWjNmfflzMwzxBxVeGVAEs5KhPMv9K0D2J/fq4MztsqwDVV7W1LcLfWzLLnT+KsNBpGLN2u1tLqIraBOqQUzaPewbdPhlbWY/BYJ74E3Z4Qku63M436tqyfTIAkubP35Ce6CbEl2j2DjR95tukbV2oUr8646Aqt+VjWS8wHhstFKgV/0yKZQbayJB8nj+jT3lHIaqrxh5CP0vUJgTfqAJmJdag7sgWl4fOGYAF0dEO/HjxqtacRACaMQW0c9y9y7QjCk/cCC+ieZ0ttIvfC0daPv5cFSLlt6vBlSH8h6GfOnOSzGeohnP8genAxH9UmrG6gwOfg== 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=acLe4Wk915HW3eBewjGOe74OkfM4KNtKFmTP75fpf+E=; b=Xzz/HbVuo0aLXm2dM42OSqaIaGDHejHKyjtDHHViEbiGWzA1nztWO4nSXlufpZukAvI8xRp1GHNUCc20WzqZnsnhGf6U+ZRwJAGPA9p1ySnAJ9rvG2b82aZt090Iv1jFq9W5W35MKbu9WYiYt6pDccJGD89MnV3yFyZbqd9JgDawC5Bkusww4KzvMPJP+bEaSPNeB21/1vbsDwgzRzipUDd4aLVroYsXrunPGHChngRzvbo57TTbselgiHNZcgLeHZ/ufys+6RQw59oDJMcLmgHTa/xQlvBCg/pF7DwbghSQplk2UNWFBygcpgC2GUQfN+UOdSL+8ghrur/G/puS5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=acLe4Wk915HW3eBewjGOe74OkfM4KNtKFmTP75fpf+E=; b=fwMn0aL+JRtCgWZsz2bFHYt4UjvwTrJ+l3rm0J71s3uL/oY+f8MG69qCYmKOXHb1RlsK4vmGPEPEN/IKu2fFRRKZk5ZW+H4PcV1kll4BTRkJES77dS6uHh3t56E8D5x69bVxk38YnuCKzBj/l8A4q9io9NU7NUFzeQiW4XyBTfh7li5tFKtwqzG5w7GLkjicO5rYGQfj9FWh41jK6w1tcJz9u2kSL53BvfVy7P6887uIe1f/fuolWMYpFyjI9FqIwAe/Bi5RZOyyoUaCnbxEw+qK3TZqQ7ImqLt6Z+5oiIh/Mn5Cfyky+eUWmplD70PSa8yZ+fvHbatw+MG+H/BqCw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AM6PR03MB4085.eurprd03.prod.outlook.com (2603:10a6:20b:1b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Fri, 2 Sep 2022 21:57:57 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5566.019; Fri, 2 Sep 2022 21:57:57 +0000 From: Sean Anderson To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: Camelia Groza , Madalin Bucur , linux-kernel@vger.kernel.org (open list), linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Sean Anderson Subject: [PATCH net-next v5 04/14] net: fman: Remove internal_phy_node from params Date: Fri, 2 Sep 2022 17:57:26 -0400 Message-Id: <20220902215737.981341-5-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220902215737.981341-1-sean.anderson@seco.com> References: <20220902215737.981341-1-sean.anderson@seco.com> X-ClientProxiedBy: CH0PR03CA0315.namprd03.prod.outlook.com (2603:10b6:610:118::15) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 24bfdac5-5d73-4a3a-1019-08da8d2e3191 X-MS-TrafficTypeDiagnostic: AM6PR03MB4085:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MuxUO7Nmif/eaf6psa9ow51pOyrciw8yls9C+shsrrtSMkIV12r5zTo9cuNaDuS6mnT0RH7pVRj29zW190J6XSDWDgxuryG2pkIvPblhzIkTDA1JPeyp2QECXnNIk03E4WZ1LH5llSoQpVmsPHElsPiCtOXnlJFA8uhSoxrNT8VuJw0QjeYWsCDKDCeH0dDdzA5016rpK5DIE7e8oHOm8/dv+PpJeP/3RgaG+L1GRNUdOsIYfW9dTUszNJwpQQ5Dh5jyyushTZF/KFob1RtdB/l0Cn1eNtPKvNtbA4ohL9OJWUpjyOOa1IM0tIYz40UpBvNwCYGlyOcfB2yLlYXjwKgFdTRVPu6Z0zq84gpRM84sboNhSxyl/jqGKSDVXx91yehPvx2gYXrZTA4CFOovsHP+pObwlA7To7zPV++OT6ltVq3GtH79oKeFe0qSs1EGLKbEA7Ce/b5y/4YlWlIDw9kxE0jbssayW7R/Cp2VTsOAaBRDcQYN8OZ6PkyHIuNMkCbDIYd01mR9IrL3/P2L/r+Vrv+lWIkndELNR90NIsZjfFP2xYxAwdSJZ15bZ3A3CXLING2NSfvBsAFsbhpsoepIDRtwW3+2UspngMkdz7EeANWy97oQdiFpV/OnQkdl1Mfu3v73lWln5ZQhop6sejeTKaK9oXEYfaJ8F6+ZUniIO6Suaotl21+4kXX6pMgD/KKUBjy7WohJ3JjMrNAKmEtpUAu/Sti4TqH71sRuNEnPZgApb3PKP3gP/a6ysDTPGBcFKACiT3UCaREpKuG21Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(136003)(346002)(376002)(396003)(366004)(6506007)(6512007)(26005)(2616005)(186003)(1076003)(7416002)(44832011)(52116002)(8936002)(5660300002)(86362001)(6486002)(41300700001)(6666004)(107886003)(478600001)(83380400001)(36756003)(2906002)(4326008)(8676002)(110136005)(316002)(38350700002)(38100700002)(66476007)(54906003)(66946007)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WXXPgaV3+1yl+mqdTi1LhK/bZX96iNjK8RvJpXCdRIJJuRbJoi2pXKuzLPu0QjzgxQ5dESXU/qr1e108CLssDT2fg9/OXoHmKMZ6FuL30rBoOR0nHVexNbrBF2hB20mIe2jzF59oeQhCnrS+c/3SHcjlTgxu0fONzgKnWR67iEKtfAUk7f7/a/ABTuAR4kVK+nXRnADadUz7x/DPVEMWRA2+r7JL5eTGnqQuzGCmHCwZdyiHuyAqZIpVxL/5N5RyBdmSYz+xgRxLi3Urv/v/45sgnhE0h/18QTgWI1FwRbkRMoUjEtKdGL5iJgwDlcpzRHXozjbNaLttVMCeOOD0lgvXp6Fv/YMCP+uS9/JaxUvtvsJaFj1eNVbsVldyRFXlK1cCbTznxCgvbw1suDJPyykagunhdN3fngg8GxYkWetF3M5yMrRGsamuJD2FD+o1rB3Yh8ezcLLncbsc7GUqSkd4unS09TothPAenAyxWyYINK21s0PJV36LOT4u+mUoIERN5SFd2lAHN7g9UGU9jF0y8mRzIu6c5u3flK07a3w10fuv0Us9a7y7atTuAwtQalMSAaEk2zgUXdzaSdbTO5zhSKtxxRrcx/HEgKGThCgjBRVyUxWwmzIPvNWas3aze9V/C0FgAn9PnTbOJmuB/xdlO2AyEn3sCgIW3QN3xtMhsp0rfty41Jcvch6N/sDZCACT2IDZyDxdCGF2fUkTLpiHtjgFG8cijhkgsTPYvfkfKs+r3cj9w2pRo6ou+NB/vv3K5Bs29bqz+cFMF0/K7xuOSOwh8nQqinNS5oHxv23QIX5TkhrL3sqG3TVFvVCmbntCpeLmACvOno7+bfqxUHUuv3iEn+hV1L4NT3oSRaIyWsqL8Yo3KxO5phA48qPBe8+LyJuv5O/A2YFydOm6TisMI8edPJKNZ2K0qB+ATjvb/Ra4CbZN9jeVA5JNUQXJpgRYPmES2CIHWRKTDrXzMvq8jBfAT6dhwhGkh88Wy3cGgqsXTkyjWhhfJLto3DL6+u8zvCs2+SKeFy42CSLC99TZg6vJnlPmX01q+90QBCeofdbLYCdxtp6wMYmkD2tAFPFycTywwCdCGtDYkGjo1Xt5BeP0G3wMbY1MFbLh20UHz3VKEQvtibu6vv5y0XhDq6RR1QkfSsYSQWPCs0MUOZlzuMRYpijf27K44ubsE2D1R/TD0RruGvAwk735ONODv5ZY9pOObCwB7ILMrUzADMcCVsz4NBkEIN2tPdAPdTShOKTiUoGDQ3KV8Q8ZHDO6NiofidaRgSXUg5LSRnKY/v4JdrKZWx4YJtCi3xVmty+d6LKcO67U+rrCslXPtD/2C0xGHOx3BlM2KqfXcG6CgosZRY23oX5LyO/Z/GMtoAWiDSmJkl2V743/0wiZJg4ZFk0SSuJGEdkCl5W7/zJq9+obYUSe4DGQwCImzgHLJ7bUJ2SE5BuCPN0LHhnYGGxNMDwkN/rkid9xRwqyQC/BjI6aVxwc5MtVKXyBzc66Smf7xGy3wan8S1R6r5GiUUdnnI4rSGvekTOmIr0YdCcLF8f+fcJzONlMIuBdJX5YPsXsK2TdAMcAK11ylZIsNoY+P7EAaqm2lhOdSL8sQOoCtg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 24bfdac5-5d73-4a3a-1019-08da8d2e3191 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2022 21:57:57.2979 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cpUD5YhDTHo6Wafbu8844vC3/OdJ27rE6ar56KjBJ/54dXQnmrEwPa7uJVnqTAeYnc1EiJ23L/cBnVujRXs6Jg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB4085 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This member was used to pass the phy node between mac_probe and the mac-specific initialization function. But now that the phy node is gotten in the initialization function, this parameter does not serve a purpose. Remove it, and do the grabbing of the node/grabbing of the phy in the same place. Signed-off-by: Sean Anderson Acked-by: Camelia Groza --- (no changes since v1) .../net/ethernet/freescale/fman/fman_dtsec.c | 33 +++++++++--------- .../net/ethernet/freescale/fman/fman_mac.h | 2 -- .../net/ethernet/freescale/fman/fman_memac.c | 34 +++++++++---------- 3 files changed, 34 insertions(+), 35 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index 84205be3a817..c2c4677451a9 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -1463,26 +1463,11 @@ static struct fman_mac *dtsec_config(struct fman_mac_params *params) dtsec->fm = params->fm; dtsec->basex_if = params->basex_if; - if (!params->internal_phy_node) { - pr_err("TBI PHY node is not available\n"); - goto err_dtsec_drv_param; - } - - dtsec->tbiphy = of_phy_find_device(params->internal_phy_node); - if (!dtsec->tbiphy) { - pr_err("of_phy_find_device (TBI PHY) failed\n"); - goto err_dtsec_drv_param; - } - - put_device(&dtsec->tbiphy->mdio.dev); - /* Save FMan revision */ fman_get_revision(dtsec->fm, &dtsec->fm_rev_info); return dtsec; -err_dtsec_drv_param: - kfree(dtsec_drv_param); err_dtsec: kfree(dtsec); return NULL; @@ -1494,6 +1479,7 @@ int dtsec_initialization(struct mac_device *mac_dev, int err; struct fman_mac_params params; struct fman_mac *dtsec; + struct device_node *phy_node; mac_dev->set_promisc = dtsec_set_promiscuous; mac_dev->change_addr = dtsec_modify_mac_address; @@ -1512,7 +1498,6 @@ int dtsec_initialization(struct mac_device *mac_dev, err = set_fman_mac_params(mac_dev, ¶ms); if (err) goto _return; - params.internal_phy_node = of_parse_phandle(mac_node, "tbi-handle", 0); mac_dev->fman_mac = dtsec_config(¶ms); if (!mac_dev->fman_mac) { @@ -1523,6 +1508,22 @@ int dtsec_initialization(struct mac_device *mac_dev, dtsec = mac_dev->fman_mac; dtsec->dtsec_drv_param->maximum_frame = fman_get_max_frm(); dtsec->dtsec_drv_param->tx_pad_crc = true; + + phy_node = of_parse_phandle(mac_node, "tbi-handle", 0); + if (!phy_node) { + pr_err("TBI PHY node is not available\n"); + err = -EINVAL; + goto _return_fm_mac_free; + } + + dtsec->tbiphy = of_phy_find_device(phy_node); + if (!dtsec->tbiphy) { + pr_err("of_phy_find_device (TBI PHY) failed\n"); + err = -EINVAL; + goto _return_fm_mac_free; + } + put_device(&dtsec->tbiphy->mdio.dev); + err = dtsec_init(dtsec); if (err < 0) goto _return_fm_mac_free; diff --git a/drivers/net/ethernet/freescale/fman/fman_mac.h b/drivers/net/ethernet/freescale/fman/fman_mac.h index 418d1de85702..7774af6463e5 100644 --- a/drivers/net/ethernet/freescale/fman/fman_mac.h +++ b/drivers/net/ethernet/freescale/fman/fman_mac.h @@ -190,8 +190,6 @@ struct fman_mac_params { * synchronize with far-end phy at 10Mbps, 100Mbps or 1000Mbps */ bool basex_if; - /* Pointer to TBI/PCS PHY node, used for TBI/PCS PHY access */ - struct device_node *internal_phy_node; }; struct eth_hash_t { diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index e5d75597463a..19c2d657c41a 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -1150,22 +1150,6 @@ static struct fman_mac *memac_config(struct fman_mac_params *params) /* Save FMan revision */ fman_get_revision(memac->fm, &memac->fm_rev_info); - if (memac->phy_if == PHY_INTERFACE_MODE_SGMII || - memac->phy_if == PHY_INTERFACE_MODE_QSGMII) { - if (!params->internal_phy_node) { - pr_err("PCS PHY node is not available\n"); - memac_free(memac); - return NULL; - } - - memac->pcsphy = of_phy_find_device(params->internal_phy_node); - if (!memac->pcsphy) { - pr_err("of_phy_find_device (PCS PHY) failed\n"); - memac_free(memac); - return NULL; - } - } - return memac; } @@ -1173,6 +1157,7 @@ int memac_initialization(struct mac_device *mac_dev, struct device_node *mac_node) { int err; + struct device_node *phy_node; struct fman_mac_params params; struct fixed_phy_status *fixed_link; struct fman_mac *memac; @@ -1194,7 +1179,6 @@ int memac_initialization(struct mac_device *mac_dev, err = set_fman_mac_params(mac_dev, ¶ms); if (err) goto _return; - params.internal_phy_node = of_parse_phandle(mac_node, "pcsphy-handle", 0); if (params.max_speed == SPEED_10000) params.phy_if = PHY_INTERFACE_MODE_XGMII; @@ -1208,6 +1192,22 @@ int memac_initialization(struct mac_device *mac_dev, memac = mac_dev->fman_mac; memac->memac_drv_param->max_frame_length = fman_get_max_frm(); memac->memac_drv_param->reset_on_init = true; + if (memac->phy_if == PHY_INTERFACE_MODE_SGMII || + memac->phy_if == PHY_INTERFACE_MODE_QSGMII) { + phy_node = of_parse_phandle(mac_node, "pcsphy-handle", 0); + if (!phy_node) { + pr_err("PCS PHY node is not available\n"); + err = -EINVAL; + goto _return_fm_mac_free; + } + + memac->pcsphy = of_phy_find_device(phy_node); + if (!memac->pcsphy) { + pr_err("of_phy_find_device (PCS PHY) failed\n"); + err = -EINVAL; + goto _return_fm_mac_free; + } + } if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) { struct phy_device *phy; From patchwork Fri Sep 2 21:57:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12964733 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 35D3CC6FA83 for ; Fri, 2 Sep 2022 21:59:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231355AbiIBV7B (ORCPT ); Fri, 2 Sep 2022 17:59:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231235AbiIBV6W (ORCPT ); Fri, 2 Sep 2022 17:58:22 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150043.outbound.protection.outlook.com [40.107.15.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91456FB2A3; Fri, 2 Sep 2022 14:58:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CYOGSMmyT47NGtxDgA18OORPEuXZLOrz7XBFS5dSyn1Sz/hdDCUXeeIU6WMppbnCN0dy3CTzLb9s5EIcZbVq2Dw5V8eiUPWvKG8UfWtubDqtYzWUCBcy9N+8DRrKO+vcWAXqIOgXR0Vml4wRcg5de+IC1lrptT5upXm6KdEWqUmQtIWZPXJ6lBxuTqkClKL9w8BFtHB+lWxLn7UHtSjy8S+14NL65uXq2VF9pCLCkgM5L74ABHZZ0hT0+l8Y0EIfSkmDmtSfFBHfCfLck+tqtAbnUDO2+MeP5h+to6lMqBoWnvVPNXGUCYiMXzjexu6O0XdL3CmgocCMY8bmLgf7mg== 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=FsN773m6ciD5I+wjfDxSmqyTx5B8yJ3+gC7Ig+LJ/no=; b=E1EtcIWKcAuHYWrK9+ZKjkgjCUrpLyUYDKJRCmqhcWKNxxTPVge4cvbfm9kYVJfq1kDdkBl2Oa4DV7vXn9Ao1lEA8OwYpm8GuKdPBH7sj9rjcFtMY6bAec5GgfNRfXr8A2jtiUzjwSDlq9sb9MNWsacMBpYK6FzK1ZxLfTKHvt9loWc1w6GNDTK7er9+UedRtxWnZWDkFa/80EAUsGzbO5SWdfmnIvY3nlbZrSd9DooX1IMsXImkmhRVXbuYiQquZYztxoV9BA6vZUGFExP0kVcbfD0EHIT0cOJMYWdjaq/VLxaBgZaepJ9eZtc1EKCq3m85+xJxP0aNFG77QmlrTQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FsN773m6ciD5I+wjfDxSmqyTx5B8yJ3+gC7Ig+LJ/no=; b=NQvCm38KMfBU6o5OElrLMtmA0xTReTHFcd0SrKie+w93l9MGKaQWT3eW6AorsyEt8h0AxM6PhKsfDTOYiXY0zp+050fkaMHvHr5VGjtpsLRPR5JouGKh6iMAsnvaEZRUBYTQkci95poMTBhbbf47gPAnr6oO/El7z77v36LLE9DEaOJ5l3zDkG2B5kD3xi0CrPCGkncDZe++89HMwkcotf2Ojw/Fe1o1V31XLoj1QwtuMbn+tCQ8idjI6o1snnV+p1CPwKbx8NstXaYcSU8SFeH9uqG8OHIo3IdYNvOqzY0Ru7j3gUVTZH6bDTS3+2OBlzCwCm8EKFMreooM5izsOA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AM6PR03MB4085.eurprd03.prod.outlook.com (2603:10a6:20b:1b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Fri, 2 Sep 2022 21:57:59 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5566.019; Fri, 2 Sep 2022 21:57:59 +0000 From: Sean Anderson To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: Camelia Groza , Madalin Bucur , linux-kernel@vger.kernel.org (open list), linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Sean Anderson Subject: [PATCH net-next v5 05/14] net: fman: Map the base address once Date: Fri, 2 Sep 2022 17:57:27 -0400 Message-Id: <20220902215737.981341-6-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220902215737.981341-1-sean.anderson@seco.com> References: <20220902215737.981341-1-sean.anderson@seco.com> X-ClientProxiedBy: CH0PR03CA0315.namprd03.prod.outlook.com (2603:10b6:610:118::15) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 061b0159-b19a-4d64-6f64-08da8d2e32fb X-MS-TrafficTypeDiagnostic: AM6PR03MB4085:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jbWkCyK6jgv4MwSubyu73TUxOD83MX4PumDbcPVrEDIUgHn7zgS1nmZHzIbhsPOvoor5kfXazYlEvDUzOp6JaUvA2+8PxqI0mATqghB2YGAR3dQyRTEqXjk69J/ywxdRNcvOa8AGotmOkKTP8oYv/u+nC2+5qeutDrUMT58jGExmg3jhF4bJ0N+f6uT+cSCDI9ZdJ4gYUwq8kOL9AlggmDBwjA+yoHWhM92XorecIbu3gNrWa5IHhtaVQa+gamk8qOQRb7U81F29gFMfTuRm+7a8gQuFiHWLo3SW4EO9GTxdAaC/M0zkSojqpCfntGh+HYgd0xFXejLYieHmzBRpev7Obz4Har9KgjOVxOWjvvhIp9Zuio0OwRevO0PIg6B1Ds0vzJsPXS0HRETIcW0S1VyiFolT4qNmHqcZTT/46YAY720hivPWQLrPcFTQDk7vwnULZzKCtOdEpxnn5M1V0PiW8sPCzJXZg0qgbxVZVvNacTuCQEEAmZWAO2VFG8JPBHJ3k13s4WYMXbvTYeMKsbZg58A0s5JCayjVKlzcB10xezNEBkY++jCRKXlYhxSDhd93ktsKlgOE8Jr7mXGBGNUWkeEui3qcoEIcn1z3dfeMeWT+7VPVhi9lefzdM968DG5SQD7+Kw1w0cKEBRzLUp+qr9tubq82mqAxwln21Ioy65a3ySGKvss2G6QnQEnzonWtkknP1i47SX2e4V7RQFoLsQuzYh7ArtC8C48E9L8GDnv5UqNkxj/Lwm9uV6EJxGbylkLuau8+B+99jAfL7A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(136003)(346002)(376002)(396003)(366004)(6506007)(6512007)(26005)(2616005)(186003)(1076003)(7416002)(44832011)(52116002)(8936002)(5660300002)(86362001)(6486002)(41300700001)(6666004)(107886003)(478600001)(83380400001)(36756003)(2906002)(4326008)(8676002)(110136005)(316002)(38350700002)(38100700002)(66476007)(54906003)(66946007)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XzGWQqpUzToBT/kHbiP9vYyb7CRFoX4GFmegrOeM5YVBLon9xqtceIJ1bXnqzIUwrJEXMzsnVUyY/M8QDBnK6TsbZXmIoLnyiYjvq315FsM/ATvbErBTcJsHWWVp0NL1O3NXQ93V78EwGTbbp0VGHzEpOZgxdjJdpIJemHynpbvYrXILz1oUA1vvU+N6+0i/xHhOhzBtHjwAL7h9/WDuFkPHF8+y3MNA4P3rtFA58XTfGO8WDnkDzU7/syZVRqtayk1yPv20lkO9CLEw4D66k+enqKCugH8EdWGA5EIN7YL5vgBxRSNev1/Ze+ig5gJmlCCKkWmeltRs6QNeOWWEcwML9qszrW8ZTpRU6C/RozczK2CRQIuyIqfTC2JlkF/NSI98uFr/CumAzaNnFYdhLgM2ysUBYnIZW1FAUsBevDDguS7Tt1qWcRqrqSS9T0wRzBUhAx1YvVFX18Tvwrr8uZ61y5JoCOyTwJbQ7KgjcgNEd8B703qovVzRskJxHLDeKpQUoePQuhgu3aE32zvXePMICWldBCSQbLWcVC3ASdga3RdcYRHo6FYpnbp1oaWEZcJl4nQMi2hbr2fjgTZDeGZE9HkxPwjX/EpX4ujFo1/apGOs7ifCUugXHE55YiyoA6+R4NUfh7owQ5e+OsmJgpXs+SdwEqqyWR8REvOaEKIJNPXwPS6NGC/S0JP+iHdSWVrdGZJqAhjye55oGKkxqDvIKYQg3bkKh5vO2zCnC/B1/JfdcZ7M7Y7vfLWjY/qfqU7sz86K0u+ySHDm3F+jENnBM9auANXtgdJvDPtskvUM/AuciSlQq/RMDrGEw49eLevAeq2ws2JRu1FkWzIOhc+muqGW5j9BWCatSx+igD1bf5CNm/HBSmWVuyjAELB4ue14YQEm8dxXYiykI6meWjJbb25T+KRxmIcM2Jnbbj/Q98CeKmxG8W/0unESCO5Q134xjkRLM8VJknz5HMpU88InIwz/CA3fVwuu9x2JOYZ446wPl/okYqkZ223EQD4o+lZiBMlp9oHRd5nhzDOIby07dZi0BQ/ls21a7AbLBvVCXLJh+hUC0zYK/4UR159PSS/iVAM9sPEkMjm7AnR6c9sIpIAAGY42fyGA9Gr6qCZJWdj1q0WEkC/3jbVdwzlqdYvlcL+EDoC28kzz7emZ5lL88ERc2zG+f7Clk4yvabMOwTX71Wr+dIrkKbGvb5MBP4+4/0rTVl2grLI5Kdkeng/3d0Su4CPqD04pwhs6HnzQa6YQoP2HA6DSQpGQqBczpsqLn0aNwI8bFUf7v1tVcFvUENACewIyKypBD7dV7g9q2bsL3qmdUT3Vw9F4L7k4YtUFS7Pvwz2mQkf5LEsgmyhnNqTxXsKwCvC32T/hewmSqASk4NE/pA7XEMr1k+qynrQ3QSDO1HOlQOamhECHzHBQRL3uIJF0tHyZxmZ3hz7qejK9Be9V9BhzuWo5PKVlm9J8hj00QCt6L0oibAq5R7D1T9vwvUa0uIHgJpQ/y/hEAa+d+G5lOV+nJ7fGIdNd4Qa8GBVC+obQ2pr5gfhzZkTjia2sHiFRM+VTTmEW+M6z81TIkf//5GJiJ+KfJ4B9CHAz8Jnrqh1WWcbBRTd2vg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 061b0159-b19a-4d64-6f64-08da8d2e32fb X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2022 21:57:59.0791 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3oowpywGQa+7oePHX6oNnQr0IiKLBnsviVMbHRJWmLy8lXe0WCXeBfY4wqMtNfqdvCHkWyRtLvIcHNlbON6+Xw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB4085 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org We don't need to remap the base address from the resource twice (once in mac_probe() and again in set_fman_mac_params()). We still need the resource to get the end address, but we can use a single function call to get both at once. While we're at it, use platform_get_mem_or_io and devm_request_resource to map the resource. I think this is the more "correct" way to do things here, since we use the pdev resource, instead of creating a new one. It's still a bit tricky, since we need to ensure that the resource is a child of the fman region when it gets requested. Signed-off-by: Sean Anderson Acked-by: Camelia Groza --- (no changes since v4) Changes in v4: - tricy -> tricky Changes in v2: - Fix warning if sizeof(void *) != sizeof(resource_size_t) .../net/ethernet/freescale/dpaa/dpaa_eth.c | 4 +-- .../ethernet/freescale/dpaa/dpaa_eth_sysfs.c | 2 +- drivers/net/ethernet/freescale/fman/mac.c | 35 +++++++------------ drivers/net/ethernet/freescale/fman/mac.h | 3 +- 4 files changed, 17 insertions(+), 27 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index e974d90f15e3..02b588c46fcf 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -218,8 +218,8 @@ static int dpaa_netdev_init(struct net_device *net_dev, net_dev->netdev_ops = dpaa_ops; mac_addr = priv->mac_dev->addr; - net_dev->mem_start = priv->mac_dev->res->start; - net_dev->mem_end = priv->mac_dev->res->end; + net_dev->mem_start = (unsigned long)priv->mac_dev->vaddr; + net_dev->mem_end = (unsigned long)priv->mac_dev->vaddr_end; net_dev->min_mtu = ETH_MIN_MTU; net_dev->max_mtu = dpaa_get_max_mtu(); diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c index 4fee74c024bd..258eb6c8f4c0 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c @@ -18,7 +18,7 @@ static ssize_t dpaa_eth_show_addr(struct device *dev, if (mac_dev) return sprintf(buf, "%llx", - (unsigned long long)mac_dev->res->start); + (unsigned long long)mac_dev->vaddr); else return sprintf(buf, "none"); } diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index 7afedd4995c9..62af81c0c942 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -28,7 +28,6 @@ MODULE_LICENSE("Dual BSD/GPL"); MODULE_DESCRIPTION("FSL FMan MAC API based driver"); struct mac_priv_s { - void __iomem *vaddr; u8 cell_index; struct fman *fman; /* List of multicast addresses */ @@ -63,12 +62,7 @@ int set_fman_mac_params(struct mac_device *mac_dev, { struct mac_priv_s *priv = mac_dev->priv; - params->base_addr = (typeof(params->base_addr)) - devm_ioremap(mac_dev->dev, mac_dev->res->start, - resource_size(mac_dev->res)); - if (!params->base_addr) - return -ENOMEM; - + params->base_addr = mac_dev->vaddr; memcpy(¶ms->addr, mac_dev->addr, sizeof(mac_dev->addr)); params->max_speed = priv->max_speed; params->phy_if = mac_dev->phy_if; @@ -305,7 +299,7 @@ static int mac_probe(struct platform_device *_of_dev) struct device_node *mac_node, *dev_node; struct mac_device *mac_dev; struct platform_device *of_dev; - struct resource res; + struct resource *res; struct mac_priv_s *priv; u32 val; u8 fman_id; @@ -368,30 +362,25 @@ static int mac_probe(struct platform_device *_of_dev) of_node_put(dev_node); /* Get the address of the memory mapped registers */ - err = of_address_to_resource(mac_node, 0, &res); - if (err < 0) { - dev_err(dev, "of_address_to_resource(%pOF) = %d\n", - mac_node, err); - goto _return_of_node_put; + res = platform_get_mem_or_io(_of_dev, 0); + if (!res) { + dev_err(dev, "could not get registers\n"); + return -EINVAL; } - mac_dev->res = __devm_request_region(dev, - fman_get_mem_region(priv->fman), - res.start, resource_size(&res), - "mac"); - if (!mac_dev->res) { - dev_err(dev, "__devm_request_mem_region(mac) failed\n"); - err = -EBUSY; + err = devm_request_resource(dev, fman_get_mem_region(priv->fman), res); + if (err) { + dev_err_probe(dev, err, "could not request resource\n"); goto _return_of_node_put; } - priv->vaddr = devm_ioremap(dev, mac_dev->res->start, - resource_size(mac_dev->res)); - if (!priv->vaddr) { + mac_dev->vaddr = devm_ioremap(dev, res->start, resource_size(res)); + if (!mac_dev->vaddr) { dev_err(dev, "devm_ioremap() failed\n"); err = -EIO; goto _return_of_node_put; } + mac_dev->vaddr_end = mac_dev->vaddr + resource_size(res); if (!of_device_is_available(mac_node)) { err = -ENODEV; diff --git a/drivers/net/ethernet/freescale/fman/mac.h b/drivers/net/ethernet/freescale/fman/mac.h index da410a7d00c9..7aa71b05bd3e 100644 --- a/drivers/net/ethernet/freescale/fman/mac.h +++ b/drivers/net/ethernet/freescale/fman/mac.h @@ -19,8 +19,9 @@ struct fman_mac; struct mac_priv_s; struct mac_device { + void __iomem *vaddr; + void __iomem *vaddr_end; struct device *dev; - struct resource *res; u8 addr[ETH_ALEN]; struct fman_port *port[2]; u32 if_support; From patchwork Fri Sep 2 21:57:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12964732 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 68B2CECAAA1 for ; Fri, 2 Sep 2022 21:59:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231243AbiIBV66 (ORCPT ); Fri, 2 Sep 2022 17:58:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231237AbiIBV6W (ORCPT ); Fri, 2 Sep 2022 17:58:22 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150079.outbound.protection.outlook.com [40.107.15.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D96B6FC11B; Fri, 2 Sep 2022 14:58:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ny7IejYpH9A/FlJa8KWMFWwFF+a1wko+/zzZ3omGpxvKETvoXTwJ6mN9nA2qDwXATUQ+pqUCQa0a7U7Ik3SU67lQ8ID/sFahWQewRTdc2/J42vorzwHprQFnZgV2POeTdgIjQWDkxRbBwo3sMb3xON9SmpQ+Yns2ahtHvKn6IeyIRi901/NSO/SqRLVNOo13yyP4I/5ArV/BnJ6WdaqtTO5Xvhf5wHlF4kV7a8fO2SZgGaOJylhbLcD9tIqc/gNHBB8PE7Bn/oTkqQct6KacvDAN2/MdEO4vBi1x/meEBegj2YRBQq3p8yVUQu02vmqeH+NigjnvHjvfV1/OhefXxw== 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=/KuhusnLjiLJbej+rFDCuxZxkk1q2MwlbFKv7ZvUD2s=; b=kc/j/ysprd4ewzAvSdoP37l+e8o+DUwKEOho8f3fctODIsNJNCnjRbqIPlkA/X2l7yPTcmyIIOmMcAg4X1FFNZDE7LLeLMEwwo9zo9J9qMPsoEQ65n9V70ZBVOUXRiW/Q04XBkjjk7KathPcSY8znr0rJNDl58dBrUGbywhSUqI7Qsma2pjgXZzCVXyDjHWjCBaBRknMhfTUkHzfoxOZ5shAgi4fbuj84xEkpUlVsQxKrohn+77UV141tC6xDhfNi2OMcKppYM883LjUYEK9heQSLF6sCVP48n4QXMvy/74NS0k+4Ufc4j3fm9Xzg430HRiwW0LuOsY2Er25peR1cw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/KuhusnLjiLJbej+rFDCuxZxkk1q2MwlbFKv7ZvUD2s=; b=gLrXOfGJcBuLy6S1uSFsZuP3neYjVwf4IxDwa+1wf3uO0wDn38DxcdvhNCOQr+ovxTFp4lm2Ty/0x9Own52NdxJgRLORjjVdNXHYIpNub/XhrfUbVjpZlrjdaWjclcYiXdVlUAchQbJ9bAYvSwAvf6puI7MrNvwE4nlRvNoAashi3xn+VYsmrf76P1swRAe07VDaBLqokk/UiB34XPg1LihCnUME40kOTgp9JsWmCzrhOi+3eaC6IKtPXIZGVb7m+jwoYwSEkC86tpk3NOTQDJjcIfNml4pP9jcgFT2/ePibmXruA97Flt+LYI3zQp2L0hyd+AvTmMTaWZM8r7CnQA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AM6PR03MB4085.eurprd03.prod.outlook.com (2603:10a6:20b:1b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Fri, 2 Sep 2022 21:58:01 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5566.019; Fri, 2 Sep 2022 21:58:01 +0000 From: Sean Anderson To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: Camelia Groza , Madalin Bucur , linux-kernel@vger.kernel.org (open list), linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Sean Anderson Subject: [PATCH net-next v5 06/14] net: fman: Pass params directly to mac init Date: Fri, 2 Sep 2022 17:57:28 -0400 Message-Id: <20220902215737.981341-7-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220902215737.981341-1-sean.anderson@seco.com> References: <20220902215737.981341-1-sean.anderson@seco.com> X-ClientProxiedBy: CH0PR03CA0315.namprd03.prod.outlook.com (2603:10b6:610:118::15) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4c6f6146-c44a-4d52-9948-08da8d2e340d X-MS-TrafficTypeDiagnostic: AM6PR03MB4085:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RtxAULMkJ7CFbifOZQXGACljz9AmK2XORqWj9u7MeI2KIID7OYl2RrW47k7DR/IhlWQZYbNUKJgaP84z/mEBXXOpwzyFYYPMUSsb3/KtjECHRpC8X5GpAKb2DJ5SHzh41oSDAFlV0xiiVXoljGtG6LlcFnyERVdCoi1kOE5iF3qp8CiT97oAtAaR9w3QTfAnKqAQWIZJtR1HjMqinsaPP73Cl0WjrpdnRSfL7nQpxwR06yqZ/cfvUFPdSmPvvv0HjDzwFDxErdpAWjvo8XDkacWiUR6iu/Lic+kyH3e3N5/g/kSGp7dDXwL+l8UQ7t8ZFuwXRPyjYbyczYsvpU6JpC3aEpPESD5t66g/hMgYlSgikFa8DKB9H9YN3ipP56RlWhfAYeeaoeRsZ7qp9UDXZak6BrBGX8nmBV9R8D2gVlVLJ4O0MmbY4DnH+ICh2lCfLihJ/vwJhuHNBwXGe+d8RlEVdVDB41W1YrDArLjjZbDawsrsjw3J6CN0gBq1i3Ta9sviXW6Wz3KaD8MXZCq811V+81XO0fRz8dTRsaROT5lW/cPhcL9PtD0YsIWBFeJFWT2wqDDVnDnnGzRX4FaLfy6S4HzOfNevXKEyZkzoi/Wjyoa8l5ZVbS6m9HO7Y9Q1HaOQCrW4Lv7w0hCgsMAUStYWoLdMqm26wRzbpL7olDB93DKwA8mRrD89QtcuZwUbUa7lhJnhmyg2cL0+liRcP3ulD9t63aO1ZE8YQkuRfjkfxHTxz8voE8KIbTqaUyqRjkGwkktbgQXrCov48PEhfg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(136003)(346002)(376002)(396003)(366004)(6506007)(6512007)(26005)(2616005)(186003)(1076003)(7416002)(44832011)(52116002)(8936002)(5660300002)(86362001)(6486002)(41300700001)(6666004)(107886003)(478600001)(83380400001)(36756003)(2906002)(4326008)(8676002)(110136005)(316002)(38350700002)(38100700002)(66476007)(54906003)(66946007)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KMtX7lA8lcL4+RvNJkGipLfVwy4rSODfPwXXTNuCjRjZFo/Qsv01wyjcTAcw17uvrL8wWgs076cWU3ytBkdV9Z0omiJeM+U3DM1OVeDeeNEwMFLVII2aM/MnB8QNDc4NFt4XHeUMOmTtV3PZDayD+ZQCpnKJgC9S9RFFZSQy3Zpo6ATOA17JN5rrpKThv34roRxAT3Mu/bQjuH2qXUzbHOiD9LB4m8jn8B83gxQW3j3YQewl0gi9iGHXiBEUmgT4bJazVRs2qJWx3FyyZlQbgUNCSBWspZpceJr6H6fJZQWdVy5JYoCKyE1jx2X6XYl5tDGeFwj1dq/y4+wQySKJyvsWoGQEuoIB86uhsiwdHZFddaV8ZoB05OSbkzTbJlZKmaN3fp0Ktkar864FhdN70XN9oAtU2BQtOqQbFpo7NGA/YPtR0aIC5GyLvVXSpYtHqnncOH49eu0Tkjz89L4SlTe7JQdgHlPfS0lrowZAleaNp29SruqylRJQOoYl2aLWrL8pbLcQA3bzCPn+VTYSIqQvDCaHCz50jq2bnlSY82AKZCJcBMJYmAaL9dhV2Sp4X6Xk0ns8VMTBVxlHJ8W+Bgj9CeUnwAv/AM1/GG7gWPH4BZSjD+4Sr0rOWxIh6bUxlnxWM7vqHKi/9YDf7Q7AcLPWEpQKnJikRY8vkxemysI0POWv4togi/NwJCr6N7TdvSUxwn5fNaWxWCIxE0TNqdSAshJ3B9yJOhd+MUwG6EZNCSJjGtDuRMVzFVEbWUHkD46BF48Ddq7h09L9/HLkxw5evDOwvnO+a/aYi4K+Vjjoz5EORP2YgnQxvyH9ZOvxUW50iVVXp2tuA0EhuUx2R0og/swNeS/avRV4MkWiiJRiaVx4mjwK+3tTmyB7Lh7Hq5FvEGUnGsg05xViaYMwSF86E8evdGUhtM+APhnzKER1MVjUp5LsYGR0a8fwytSS2AMbX4uyCGx0uQXXfBJP1SK7M9amhbctAguu3pS53aEr7JZotA8fHnpR7OARFpX9j7+7uWb9Iz3u4BAjQpvkCmQ5oSUhdgCbh5UnqvJAB9SpUuJHzpDft1K+kqdJ+i++t5UE/CvABXLiFjR7aQhjae2DhyWUgxn9z9NdxFBifJcx4hbwdFlGn20/YV7RwI2aXrvVtaFiwug0nNigU41jSqXvQLQodsc7w/nh8uQRvj5CNWEd4GEbjkZX+wdx6kJblySQbGHmi0mQ65gZLsh4mrVmNQ6/BO+NAWRwEBmR8b6Tth0vYGkIyc5ZveeLZufQmRH3cUDapc9muv7NTdWPigEr40dyNlauynr0t+cIXELD6f+BYWkCpvip2Ia0+KkFNF/eRg9ZNOpS8Dys5oMn81C/kuh5NdS8XV+IfuSYRp5JQtYZi6J103tCNX3MO6ugO+RwJZUeOIR/GO0MZLR3p/bnVyl1FZEJqm9lW6fogUH2JeSNCWvN7PFyE/0H1fp0wkAVFP/SbIOwrVf5hP19grstIVQAj/Gc1caKezkviOrMK0rR+lP8NkTJRU6gVclheOoyFYLXmBykpJvx1+ZTeG+LT8bNTvl2sdpBEeSjotu/Dee/xDxntiquFrlGA6fHoxTs1M5p57K2uik/K8o73Q== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c6f6146-c44a-4d52-9948-08da8d2e340d X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2022 21:58:00.9696 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Csg2msrxrYLD4PBMBOxFHaLZUWY2Ra8TLp3kUmOCCsn2Ml03zZaN0zw6nE4dRs3b3VH9D1EFwCMzEhi77rBcSA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB4085 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Instead of having the mac init functions call back into the fman core to get their params, just pass them directly to the init functions. Signed-off-by: Sean Anderson Acked-by: Camelia Groza --- (no changes since v1) .../net/ethernet/freescale/fman/fman_dtsec.c | 10 ++---- .../net/ethernet/freescale/fman/fman_dtsec.h | 3 +- .../net/ethernet/freescale/fman/fman_memac.c | 14 +++----- .../net/ethernet/freescale/fman/fman_memac.h | 3 +- .../net/ethernet/freescale/fman/fman_tgec.c | 10 ++---- .../net/ethernet/freescale/fman/fman_tgec.h | 3 +- drivers/net/ethernet/freescale/fman/mac.c | 36 ++++++++----------- drivers/net/ethernet/freescale/fman/mac.h | 2 -- 8 files changed, 32 insertions(+), 49 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index c2c4677451a9..9fabb2dfc972 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -1474,10 +1474,10 @@ static struct fman_mac *dtsec_config(struct fman_mac_params *params) } int dtsec_initialization(struct mac_device *mac_dev, - struct device_node *mac_node) + struct device_node *mac_node, + struct fman_mac_params *params) { int err; - struct fman_mac_params params; struct fman_mac *dtsec; struct device_node *phy_node; @@ -1495,11 +1495,7 @@ int dtsec_initialization(struct mac_device *mac_dev, mac_dev->enable = dtsec_enable; mac_dev->disable = dtsec_disable; - err = set_fman_mac_params(mac_dev, ¶ms); - if (err) - goto _return; - - mac_dev->fman_mac = dtsec_config(¶ms); + mac_dev->fman_mac = dtsec_config(params); if (!mac_dev->fman_mac) { err = -EINVAL; goto _return; diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.h b/drivers/net/ethernet/freescale/fman/fman_dtsec.h index cf3e683c089c..8c72d280c51a 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.h +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.h @@ -11,6 +11,7 @@ struct mac_device; int dtsec_initialization(struct mac_device *mac_dev, - struct device_node *mac_node); + struct device_node *mac_node, + struct fman_mac_params *params); #endif /* __DTSEC_H */ diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index 19c2d657c41a..5daa8c7626f4 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -1154,11 +1154,11 @@ static struct fman_mac *memac_config(struct fman_mac_params *params) } int memac_initialization(struct mac_device *mac_dev, - struct device_node *mac_node) + struct device_node *mac_node, + struct fman_mac_params *params) { int err; struct device_node *phy_node; - struct fman_mac_params params; struct fixed_phy_status *fixed_link; struct fman_mac *memac; @@ -1176,14 +1176,10 @@ int memac_initialization(struct mac_device *mac_dev, mac_dev->enable = memac_enable; mac_dev->disable = memac_disable; - err = set_fman_mac_params(mac_dev, ¶ms); - if (err) - goto _return; + if (params->max_speed == SPEED_10000) + params->phy_if = PHY_INTERFACE_MODE_XGMII; - if (params.max_speed == SPEED_10000) - params.phy_if = PHY_INTERFACE_MODE_XGMII; - - mac_dev->fman_mac = memac_config(¶ms); + mac_dev->fman_mac = memac_config(params); if (!mac_dev->fman_mac) { err = -EINVAL; goto _return; diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.h b/drivers/net/ethernet/freescale/fman/fman_memac.h index a58215a3b1d9..5a3a14f9684f 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.h +++ b/drivers/net/ethernet/freescale/fman/fman_memac.h @@ -14,6 +14,7 @@ struct mac_device; int memac_initialization(struct mac_device *mac_dev, - struct device_node *mac_node); + struct device_node *mac_node, + struct fman_mac_params *params); #endif /* __MEMAC_H */ diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c index 32ee1674ff2f..f34f89e46a6f 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c @@ -783,10 +783,10 @@ static struct fman_mac *tgec_config(struct fman_mac_params *params) } int tgec_initialization(struct mac_device *mac_dev, - struct device_node *mac_node) + struct device_node *mac_node, + struct fman_mac_params *params) { int err; - struct fman_mac_params params; struct fman_mac *tgec; mac_dev->set_promisc = tgec_set_promiscuous; @@ -803,11 +803,7 @@ int tgec_initialization(struct mac_device *mac_dev, mac_dev->enable = tgec_enable; mac_dev->disable = tgec_disable; - err = set_fman_mac_params(mac_dev, ¶ms); - if (err) - goto _return; - - mac_dev->fman_mac = tgec_config(¶ms); + mac_dev->fman_mac = tgec_config(params); if (!mac_dev->fman_mac) { err = -EINVAL; goto _return; diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.h b/drivers/net/ethernet/freescale/fman/fman_tgec.h index 2e45b9fea352..768b8d165e05 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.h +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.h @@ -11,6 +11,7 @@ struct mac_device; int tgec_initialization(struct mac_device *mac_dev, - struct device_node *mac_node); + struct device_node *mac_node, + struct fman_mac_params *params); #endif /* __TGEC_H */ diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index 62af81c0c942..fb04c1f9cd3e 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -57,25 +57,6 @@ static void mac_exception(void *handle, enum fman_mac_exceptions ex) __func__, ex); } -int set_fman_mac_params(struct mac_device *mac_dev, - struct fman_mac_params *params) -{ - struct mac_priv_s *priv = mac_dev->priv; - - params->base_addr = mac_dev->vaddr; - memcpy(¶ms->addr, mac_dev->addr, sizeof(mac_dev->addr)); - params->max_speed = priv->max_speed; - params->phy_if = mac_dev->phy_if; - params->basex_if = false; - params->mac_id = priv->cell_index; - params->fm = (void *)priv->fman; - params->exception_cb = mac_exception; - params->event_cb = mac_exception; - params->dev_id = mac_dev; - - return 0; -} - int fman_set_multi(struct net_device *net_dev, struct mac_device *mac_dev) { struct mac_priv_s *priv; @@ -294,13 +275,15 @@ MODULE_DEVICE_TABLE(of, mac_match); static int mac_probe(struct platform_device *_of_dev) { int err, i, nph; - int (*init)(struct mac_device *mac_dev, struct device_node *mac_node); + int (*init)(struct mac_device *mac_dev, struct device_node *mac_node, + struct fman_mac_params *params); struct device *dev; struct device_node *mac_node, *dev_node; struct mac_device *mac_dev; struct platform_device *of_dev; struct resource *res; struct mac_priv_s *priv; + struct fman_mac_params params; u32 val; u8 fman_id; phy_interface_t phy_if; @@ -474,7 +457,18 @@ static int mac_probe(struct platform_device *_of_dev) /* Get the rest of the PHY information */ mac_dev->phy_node = of_parse_phandle(mac_node, "phy-handle", 0); - err = init(mac_dev, mac_node); + params.base_addr = mac_dev->vaddr; + memcpy(¶ms.addr, mac_dev->addr, sizeof(mac_dev->addr)); + params.max_speed = priv->max_speed; + params.phy_if = mac_dev->phy_if; + params.basex_if = false; + params.mac_id = priv->cell_index; + params.fm = (void *)priv->fman; + params.exception_cb = mac_exception; + params.event_cb = mac_exception; + params.dev_id = mac_dev; + + err = init(mac_dev, mac_node, ¶ms); if (err < 0) { dev_err(dev, "mac_dev->init() = %d\n", err); of_node_put(mac_dev->phy_node); diff --git a/drivers/net/ethernet/freescale/fman/mac.h b/drivers/net/ethernet/freescale/fman/mac.h index 7aa71b05bd3e..c5fb4d46210f 100644 --- a/drivers/net/ethernet/freescale/fman/mac.h +++ b/drivers/net/ethernet/freescale/fman/mac.h @@ -72,8 +72,6 @@ int fman_set_mac_active_pause(struct mac_device *mac_dev, bool rx, bool tx); void fman_get_pause_cfg(struct mac_device *mac_dev, bool *rx_pause, bool *tx_pause); -int set_fman_mac_params(struct mac_device *mac_dev, - struct fman_mac_params *params); int fman_set_multi(struct net_device *net_dev, struct mac_device *mac_dev); #endif /* __MAC_H */ From patchwork Fri Sep 2 21:57:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12964735 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 5737FC6FA83 for ; Fri, 2 Sep 2022 21:59:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230236AbiIBV7q (ORCPT ); Fri, 2 Sep 2022 17:59:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230513AbiIBV6Z (ORCPT ); Fri, 2 Sep 2022 17:58:25 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150043.outbound.protection.outlook.com [40.107.15.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44D6EF63EA; Fri, 2 Sep 2022 14:58:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ec1be/RkaiLx/2IlrpxsiOMekqiJnOtp+nbSkbxVKXn0k/IsXfZGYnJw/hqm1YEmfT/ua/x8BiLZiknY9b4yts81uyyKJlBg3I85ezb/QCBhWOA6yQaRniqpMyaxFjKY6hCIHS/nNXQbmDRtm364H3ytbyOZmfbLTGRy4ARO5H9CJouu1+Iozj4AA6scaYI9OApB/U3N4cAyuqMcylZhSjEglQQZyehCbFzRbx8uh7/kd0tnJPS8cp4rOQGLCdmkD1xTefmdjtdY/ORIIQ3eoqnc01ZGCUa98CBIzsQkzY3CUSwMNEGuOhr7YF3tSAJ5v9a+zwdsJApDG5CJ2YNphQ== 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=SpPL6u4EhYR2Y+5IJnStcnatWnT+xiJhHgRNjD9gT6k=; b=TPj1wjHtgP1t56ipv2HbTnJKf6GUybbbqXno8qK1CRQUcKlBmu58KM6xHjcps1NJ1yrfwlmy4z+tQ8LCG5jXtozMk/MXhSHIMvjxgPb6NSnU3+dBpTvj0b9Tm49ubEuppaKHZJJ+4vCTBRCKZK3goxqgPlYcPWozwBcXcBlc6R34i2z3gCMDXBT68lSnHtnv+/etRjZ+gSKHADVFvJWnh4GN47WRV/RIAGLaPCXte37im3POuU0TxaPmVK1O6yDBw0GRjVvVXxTaRD57EFrrZVLH8VopBP9lm+sgq3kecmy6bnX8oJTFh3GQdpOUbFbTrjbXA/Fe4VYLpnPhF1/RZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SpPL6u4EhYR2Y+5IJnStcnatWnT+xiJhHgRNjD9gT6k=; b=cBexR3R4ArUIzgJDUULedXl/y6xtXTCdCh6IheIDTcL2XCXP6kArXC+iJK111EdTp/3GZGkxJ+t4i0pf0J/O/BklMkRw4jltbfOWnfT1HFTVjhhCKwVWRe/cxZ3eorV5qozAWKzL63DLI2opCjmLJxZnoliuFzgR+14kzvd8EiCQf6h8+nTsE9sQeYDMYNF7DeEXHE8upgaJZrwrnLFKfaPnETktdJSMWhqhcVhoFWYEDOtQq76HiJDU5Gg0DlN8hBlMCgwra9UiCuPykbuTd6sDniJWESX5Hv0iHSMGy3Rsei8025LVZH9aoVdhEc3V98E4yL0RSlxLdUfdCcDdag== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AM6PR03MB4085.eurprd03.prod.outlook.com (2603:10a6:20b:1b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Fri, 2 Sep 2022 21:58:03 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5566.019; Fri, 2 Sep 2022 21:58:03 +0000 From: Sean Anderson To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: Camelia Groza , Madalin Bucur , linux-kernel@vger.kernel.org (open list), linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Sean Anderson Subject: [PATCH net-next v5 07/14] net: fman: Use mac_dev for some params Date: Fri, 2 Sep 2022 17:57:29 -0400 Message-Id: <20220902215737.981341-8-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220902215737.981341-1-sean.anderson@seco.com> References: <20220902215737.981341-1-sean.anderson@seco.com> X-ClientProxiedBy: CH0PR03CA0315.namprd03.prod.outlook.com (2603:10b6:610:118::15) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2e0f944c-9aab-4e0a-5eda-08da8d2e353c X-MS-TrafficTypeDiagnostic: AM6PR03MB4085:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hozqHNQfyTZXQy5fziepuyJ4hRDM539/FqYnk9++cVnvTHVihZkChC+zGCNtW6NLh21s7gGhEDl7iKHPgbpNmhkmxs1QFQEKGKOaoNxt+vd2riF9n1SHJFcgzh3O/565Xmu7y9gmRnxxyds250pbtFZDzHDr/eT0yVnrOPuivnIqrHFGCStzvyKdACBl8LDrZhVaMCHLEnmWMFbnDWY/jWlwnYjPTjw4zOFCkp6UVgmqf/bK9E/oWD4wSiG5B8/7GQUsOTmd4ETVMunDb8W80lZZHZoSdTVEYM1z06l82DfNa0rA3KjoeMEL7C0LI56zidxSY26gcPXerARxgNsYizn1RCxeQ8nDPiZJbjCVQwMwrBgdwB9I7QVu5q/YLx+2yG9bDaxO5eeoxKgJ1HVoKObAZ9g5TYRFKn59ngx0FFiVOij641fJtVcaqPvA3Jo13ynwxMniMVtav6oC69Hklx4KYuHNs4wSvpf0axPwj7geQkNRHHiM2vSXltMdBbFylyIRaNKRQHVCnF1FyVnwzI96eLdYfkw/FrnLcunSIddLde+YKyXkTNss6y8GvT8nxkFGLKPh4DW9c2TkpdZZNx/D7gRGzy7D/UiW16RVW65+u7QLyac1rxJ4H7BFqQhJVD2hZ98/2TZopNHpNYG/8dJNY5aX1lPtTNcQs/Um8txnhaSxzEIs01uUotty1C6tabx9uVLfc8ps8f/7zHvl8l8RvFhiAUIgfdztFK1+xF64Rovj5AXd2Adu6k3d6W34Gq3cLFeVmHCZBwaYqKOZ6A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(136003)(346002)(376002)(396003)(366004)(6506007)(6512007)(26005)(2616005)(186003)(1076003)(7416002)(44832011)(52116002)(8936002)(5660300002)(86362001)(6486002)(41300700001)(6666004)(107886003)(478600001)(83380400001)(36756003)(2906002)(4326008)(8676002)(110136005)(316002)(38350700002)(38100700002)(66476007)(54906003)(66946007)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: A/t3f0T4LOnDgCN5pixYOj69TGmqbS8uUn4hbzLub0NDwZanTO9gwPm/3gf/uttxPl/5ta30Uqn8yzCjdsLPIAlhMaFwWkyOy7RrDiKGCXBmnEJDMFm13S2GCWmZQZOpWFUHHEo53A/B8UOJtnBiexTJkChPszQqrW+Ja2UG2bHB3Dd77K2Bb9XuHoSGlMCd1do1j6XnymiG4e8vgOSYX2L3cNt2w4Sn0UVVpiKzSWMqPqrSnpXgFkDAoIhcuDyR6eIZQxM3D5Ba+CTOXyPyFi7gBkPIa56tYKlwDBQHjuJfdfPi78SBv7dPDJAO5isEacC8yekm2GBCu66j3O7giKhAgYHchQeXfBORW6KLwla914you1/iZpyIb4oTszifavrAehEkqehL29vXa9SfZeZHrvDb30HX7KWyS1j6TBAeGpfg4RbpsWmC2RHI3EgtaQBtPM3BZTJfTWpaOQXPnr37mfx9Ok4LlH0FXamsDgeOrMTiod3FGxX/EdlesswXbo+6sFMTl22sLigMZqnsi/hSH5iUg/31FWbM2n236fZgj6z2WfiERsbAUxCKBiPJXFgSy0GU9Z/vT5dUWkY2sJzP/wDBze4d2J/SYtQdoBVvNRufJ+vYicXab09OSbmOTnYagDNYGl6ZT5uuYijqgdOdXa7WOS4vNXOV9uEgQ8A5SMpJYkfE1v/NtAuDjCfR2azF/0JhItSC2fEBU1nOZdidE/eiEcXjOZv34yQN8YLTltQeP0GrIHn4vtjmLM8A7xCboCFQhuES14X+JnR67t/gQFgsMGoe1NI9KqlNAu1wyemR5aZhXk4dHl2IIZtGzBfo7MFB1l3wtrNYL+XDBm/X7r57FeaXbY2/tnXWOuGUN/jApnRFbB6wMBxF7n83VW/iGtrj48cEPZB+yTS8lu1qiu0K2/+mun/QenMdEsPfHCa8tgLw2DDtERJhclJ1g5eDS6aYdcF7zkJDHyZILliFF6rjwvyh78VpiiZYkIWfn0LqA8IEkV4kRfwyzyePJnxO5au+IZwdoVY6i/SXQK11vLbyjqL3/7rhQm00tYcDKqieJz9t0wOHqhGw0uaoS1DtPQLRc074Dg6dF60I5c2EpI16lUAUCdCaSIszFGZIpkefAAcFryYDOGbbuYdhgXsHeNnn1JWDhm6F0eUAqJ896NWdqrOxFawJ4vwsg5Il5YdJgkUXL5PesQaFjf/xzTwMpXpI4HyHZ6PrsI0ET49mcTxRtRmoq7dM0fweYG0zuM5QdE1yqqIxW/nJxzVihRgU0dALi2eEQZ0YwHhmrprnj6/cmXpYD5Gv63PGVawxVWiprFPVtC9dxczz/2zc9HzApvaww9m3fMD3uBMwJHshfMgiX61w+nMWo+PSmyUS1mFwPikx3HU4YwMgJ7xjzZ7Vi2+k9oN61eaWT4/D5BMjpV0mRlxZFnsLagMiSpe4eYzq76cZ5huHS3NZe3um8/QkwBOjKHfi3iX9VdvEdByfJ9lidmjJXgSrOZXlKugW7InpovlhltxEd4kMjCMd2CvJqxzkKOOILci/NFG+4TWnShZvr2NK/5cjFiEyqy7D2j5oP2ld/k+scB0giPVwwC9+a0898FXqViwh8992pw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2e0f944c-9aab-4e0a-5eda-08da8d2e353c X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2022 21:58:02.9538 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lo5o6ghG8srpXX/XJoRUOXEIhXtD8lIeTUYx2vEksEJs/7WDVjDbDZFflhg8qea0PjQ4wkY/eT40DC0rx5QMvQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB4085 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Some params are already present in mac_dev. Use them directly instead of passing them through params. Signed-off-by: Sean Anderson Acked-by: Camelia Groza --- (no changes since v1) .../net/ethernet/freescale/fman/fman_dtsec.c | 16 +++++++--------- drivers/net/ethernet/freescale/fman/fman_mac.h | 7 ------- .../net/ethernet/freescale/fman/fman_memac.c | 17 ++++++++--------- drivers/net/ethernet/freescale/fman/fman_tgec.c | 12 +++++------- drivers/net/ethernet/freescale/fman/mac.c | 10 ++-------- 5 files changed, 22 insertions(+), 40 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index 9fabb2dfc972..09ad1117005a 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -1413,13 +1413,11 @@ static int dtsec_free(struct fman_mac *dtsec) return 0; } -static struct fman_mac *dtsec_config(struct fman_mac_params *params) +static struct fman_mac *dtsec_config(struct mac_device *mac_dev, + struct fman_mac_params *params) { struct fman_mac *dtsec; struct dtsec_cfg *dtsec_drv_param; - void __iomem *base_addr; - - base_addr = params->base_addr; /* allocate memory for the UCC GETH data structure. */ dtsec = kzalloc(sizeof(*dtsec), GFP_KERNEL); @@ -1436,10 +1434,10 @@ static struct fman_mac *dtsec_config(struct fman_mac_params *params) set_dflts(dtsec_drv_param); - dtsec->regs = base_addr; - dtsec->addr = ENET_ADDR_TO_UINT64(params->addr); + dtsec->regs = mac_dev->vaddr; + dtsec->addr = ENET_ADDR_TO_UINT64(mac_dev->addr); dtsec->max_speed = params->max_speed; - dtsec->phy_if = params->phy_if; + dtsec->phy_if = mac_dev->phy_if; dtsec->mac_id = params->mac_id; dtsec->exceptions = (DTSEC_IMASK_BREN | DTSEC_IMASK_RXCEN | @@ -1456,7 +1454,7 @@ static struct fman_mac *dtsec_config(struct fman_mac_params *params) DTSEC_IMASK_RDPEEN); dtsec->exception_cb = params->exception_cb; dtsec->event_cb = params->event_cb; - dtsec->dev_id = params->dev_id; + dtsec->dev_id = mac_dev; dtsec->ptp_tsu_enabled = dtsec->dtsec_drv_param->ptp_tsu_en; dtsec->en_tsu_err_exception = dtsec->dtsec_drv_param->ptp_exception_en; @@ -1495,7 +1493,7 @@ int dtsec_initialization(struct mac_device *mac_dev, mac_dev->enable = dtsec_enable; mac_dev->disable = dtsec_disable; - mac_dev->fman_mac = dtsec_config(params); + mac_dev->fman_mac = dtsec_config(mac_dev, params); if (!mac_dev->fman_mac) { err = -EINVAL; goto _return; diff --git a/drivers/net/ethernet/freescale/fman/fman_mac.h b/drivers/net/ethernet/freescale/fman/fman_mac.h index 7774af6463e5..730aae7fed13 100644 --- a/drivers/net/ethernet/freescale/fman/fman_mac.h +++ b/drivers/net/ethernet/freescale/fman/fman_mac.h @@ -163,25 +163,18 @@ typedef void (fman_mac_exception_cb)(void *dev_id, /* FMan MAC config input */ struct fman_mac_params { - /* Base of memory mapped FM MAC registers */ - void __iomem *base_addr; - /* MAC address of device; First octet is sent first */ - enet_addr_t addr; /* MAC ID; numbering of dTSEC and 1G-mEMAC: * 0 - FM_MAX_NUM_OF_1G_MACS; * numbering of 10G-MAC (TGEC) and 10G-mEMAC: * 0 - FM_MAX_NUM_OF_10G_MACS */ u8 mac_id; - /* PHY interface */ - phy_interface_t phy_if; /* Note that the speed should indicate the maximum rate that * this MAC should support rather than the actual speed; */ u16 max_speed; /* A handle to the FM object this port related to */ void *fm; - void *dev_id; /* device cookie used by the exception cbs */ fman_mac_exception_cb *event_cb; /* MDIO Events Callback Routine */ fman_mac_exception_cb *exception_cb;/* Exception Callback Routine */ /* SGMII/QSGII interface with 1000BaseX auto-negotiation between MAC diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index 5daa8c7626f4..af2e67a250de 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -1109,13 +1109,12 @@ static int memac_free(struct fman_mac *memac) return 0; } -static struct fman_mac *memac_config(struct fman_mac_params *params) +static struct fman_mac *memac_config(struct mac_device *mac_dev, + struct fman_mac_params *params) { struct fman_mac *memac; struct memac_cfg *memac_drv_param; - void __iomem *base_addr; - base_addr = params->base_addr; /* allocate memory for the m_emac data structure */ memac = kzalloc(sizeof(*memac), GFP_KERNEL); if (!memac) @@ -1133,17 +1132,17 @@ static struct fman_mac *memac_config(struct fman_mac_params *params) set_dflts(memac_drv_param); - memac->addr = ENET_ADDR_TO_UINT64(params->addr); + memac->addr = ENET_ADDR_TO_UINT64(mac_dev->addr); - memac->regs = base_addr; + memac->regs = mac_dev->vaddr; memac->max_speed = params->max_speed; - memac->phy_if = params->phy_if; + memac->phy_if = mac_dev->phy_if; memac->mac_id = params->mac_id; memac->exceptions = (MEMAC_IMASK_TSECC_ER | MEMAC_IMASK_TECC_ER | MEMAC_IMASK_RECC_ER | MEMAC_IMASK_MGI); memac->exception_cb = params->exception_cb; memac->event_cb = params->event_cb; - memac->dev_id = params->dev_id; + memac->dev_id = mac_dev; memac->fm = params->fm; memac->basex_if = params->basex_if; @@ -1177,9 +1176,9 @@ int memac_initialization(struct mac_device *mac_dev, mac_dev->disable = memac_disable; if (params->max_speed == SPEED_10000) - params->phy_if = PHY_INTERFACE_MODE_XGMII; + mac_dev->phy_if = PHY_INTERFACE_MODE_XGMII; - mac_dev->fman_mac = memac_config(params); + mac_dev->fman_mac = memac_config(mac_dev, params); if (!mac_dev->fman_mac) { err = -EINVAL; goto _return; diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c index f34f89e46a6f..2642a4c27292 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c @@ -728,13 +728,11 @@ static int tgec_free(struct fman_mac *tgec) return 0; } -static struct fman_mac *tgec_config(struct fman_mac_params *params) +static struct fman_mac *tgec_config(struct mac_device *mac_dev, struct fman_mac_params *params) { struct fman_mac *tgec; struct tgec_cfg *cfg; - void __iomem *base_addr; - base_addr = params->base_addr; /* allocate memory for the UCC GETH data structure. */ tgec = kzalloc(sizeof(*tgec), GFP_KERNEL); if (!tgec) @@ -752,8 +750,8 @@ static struct fman_mac *tgec_config(struct fman_mac_params *params) set_dflts(cfg); - tgec->regs = base_addr; - tgec->addr = ENET_ADDR_TO_UINT64(params->addr); + tgec->regs = mac_dev->vaddr; + tgec->addr = ENET_ADDR_TO_UINT64(mac_dev->addr); tgec->max_speed = params->max_speed; tgec->mac_id = params->mac_id; tgec->exceptions = (TGEC_IMASK_MDIO_SCAN_EVENT | @@ -773,7 +771,7 @@ static struct fman_mac *tgec_config(struct fman_mac_params *params) TGEC_IMASK_RX_ALIGN_ER); tgec->exception_cb = params->exception_cb; tgec->event_cb = params->event_cb; - tgec->dev_id = params->dev_id; + tgec->dev_id = mac_dev; tgec->fm = params->fm; /* Save FMan revision */ @@ -803,7 +801,7 @@ int tgec_initialization(struct mac_device *mac_dev, mac_dev->enable = tgec_enable; mac_dev->disable = tgec_disable; - mac_dev->fman_mac = tgec_config(params); + mac_dev->fman_mac = tgec_config(mac_dev, params); if (!mac_dev->fman_mac) { err = -EINVAL; goto _return; diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index fb04c1f9cd3e..0f9e3e9e60c6 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -34,7 +34,6 @@ struct mac_priv_s { struct list_head mc_addr_list; struct platform_device *eth_dev; u16 speed; - u16 max_speed; }; struct mac_address { @@ -439,7 +438,7 @@ static int mac_probe(struct platform_device *_of_dev) mac_dev->phy_if = phy_if; priv->speed = phy2speed[mac_dev->phy_if]; - priv->max_speed = priv->speed; + params.max_speed = priv->speed; mac_dev->if_support = DTSEC_SUPPORTED; /* We don't support half-duplex in SGMII mode */ if (mac_dev->phy_if == PHY_INTERFACE_MODE_SGMII) @@ -447,7 +446,7 @@ static int mac_probe(struct platform_device *_of_dev) SUPPORTED_100baseT_Half); /* Gigabit support (no half-duplex) */ - if (priv->max_speed == 1000) + if (params.max_speed == 1000) mac_dev->if_support |= SUPPORTED_1000baseT_Full; /* The 10G interface only supports one mode */ @@ -457,16 +456,11 @@ static int mac_probe(struct platform_device *_of_dev) /* Get the rest of the PHY information */ mac_dev->phy_node = of_parse_phandle(mac_node, "phy-handle", 0); - params.base_addr = mac_dev->vaddr; - memcpy(¶ms.addr, mac_dev->addr, sizeof(mac_dev->addr)); - params.max_speed = priv->max_speed; - params.phy_if = mac_dev->phy_if; params.basex_if = false; params.mac_id = priv->cell_index; params.fm = (void *)priv->fman; params.exception_cb = mac_exception; params.event_cb = mac_exception; - params.dev_id = mac_dev; err = init(mac_dev, mac_node, ¶ms); if (err < 0) { From patchwork Fri Sep 2 21:57:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12964734 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 92C08C6FA82 for ; Fri, 2 Sep 2022 21:59:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230502AbiIBV7n (ORCPT ); Fri, 2 Sep 2022 17:59:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231263AbiIBV6Y (ORCPT ); Fri, 2 Sep 2022 17:58:24 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150079.outbound.protection.outlook.com [40.107.15.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1D98F72EA; Fri, 2 Sep 2022 14:58:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bKxuxuu5r08o7rAKfgQsyGFz/acL2kwPV1iJ8Kwf6TICiLaxBDwmjzvVfAOKcKkfuNhH5rBSOoO9UuakTntCmFMDbXGbSoczIJYRatbQnq0BMfhXwuI3a3QAB8HUaFyjcHd2PhoeF0t94nEQxms/OkPBz4BY0EkO6UmK9yXmoDeBVMsQLM/vjwkJdCNAu9CAkvFSw94P2gjH+LpLYIWolOHgn6PWs9ruH5S3nUszCKCm6sKQ1pqhTDTHzlruPx7TjTSB2fvlhFKGdqe9KtvRHV1NyhuZ+3wxjfqFkgtv3vjJDg25ZrCeaiaOlMnGQPFf0XGW88iaYh3J3t39RiYgfw== 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=GPLsINVCZek7AgubG4D2wNh7zNp0V2wFxp/SOz3Jd7I=; b=L5Ue8+BJHhlS0zfLQ1g5ZfH3UE1T6z4u4iM0iqA5ltol6qwAqCZFBpERdZYgUEYkt4VNBu+MR238e3BLyeuWu5oEWH/ITCHug8iRiICnk8slRUQcJ1FXg/8RJGHo6w2h2Le8dMKS3OGhKw0tytA1XFQXhQqm24aNpJXfNWLTU7Nd9wvkjNwGfx3dyBKW7HsBcWfXLLFsLhRZkNOESYWvBcl9E6xLp7H3PQzOLVwOeh0V8ws7ol+hvUJ3EOcs3OBbjRmzJXekpNkLOYm5yjsji2Y0RfnkNmWe+KIK982KSoTemy4T1wUUjrfTTAFhXgFxtPXjY4bDS0Z3Csp6fTJoaw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GPLsINVCZek7AgubG4D2wNh7zNp0V2wFxp/SOz3Jd7I=; b=NDbW/Dh77+33GNxDv7p1EaJ+l+ddpgUBdPPbMsvRituh9AVz6zKFgTqqRBKOOXQOL7XpUYCmql8nH6TJv8fJ07+1w1HUyS/0dmtYhtVRnVPZ3lhKTczPWeIuL0Tk7FU6OQ/0qvqzBsl+08pefd/6WY1gZJJneIkNureYwBcMKXmWjEqjMgRHZ1vrNP9N97EVVXE57LIcgeFmqtIuKYPc1cNBfI1u7lbswefAXKcU6RiqpMsrHVa4BmOLBv1+Bc+f50vO0K6haaZHdNUX2g/uJbbpmuIDVIX/2qipW5s4VNFzX9M2h8dKzwXDGOPARi1Sll7hY9Sl6GitYd1hVLNFbg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AM6PR03MB4085.eurprd03.prod.outlook.com (2603:10a6:20b:1b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Fri, 2 Sep 2022 21:58:04 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5566.019; Fri, 2 Sep 2022 21:58:04 +0000 From: Sean Anderson To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: Camelia Groza , Madalin Bucur , linux-kernel@vger.kernel.org (open list), linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Sean Anderson Subject: [PATCH net-next v5 08/14] net: fman: Specify type of mac_dev for exception_cb Date: Fri, 2 Sep 2022 17:57:30 -0400 Message-Id: <20220902215737.981341-9-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220902215737.981341-1-sean.anderson@seco.com> References: <20220902215737.981341-1-sean.anderson@seco.com> X-ClientProxiedBy: CH0PR03CA0315.namprd03.prod.outlook.com (2603:10b6:610:118::15) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f7ae83f7-8632-4327-38bb-08da8d2e365f X-MS-TrafficTypeDiagnostic: AM6PR03MB4085:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +BewBlAbuws50cy1qpc/BsCAeQv0A7Tuqxc3yUyZW/m67RG8GvFlgstX69urO1Btv+sJO5sWdYW0vDt0CRmlJ+EqYRs3mxCqlODYRf/eOtdPS8O/uxNOE7h48RpMweUadsiEq3ranJAmMw4mjtX54pT+Q2dPoQuQsi1pcGHuLKsbh4YcaOokTD9bg56X2vpvM7eMfQ6DOBTAEhUNZl6I3s4p9TsyU5xKJ5/g0F8lvHI01xhgVPpBTcrwNfSzs4t3wpPMYF0sD6DHamOqhVM8Pe4GCU62tZigx63+ub/RU4wEBWwj+oqlMjEVzd7UYEwD4X0Q6rNtPGsWzu/BQTvfd+pctEWIIEG2pFk6gyBy1kv0KO9Yv9eNxA2kh1MpJgCnBJd6+znaoeLR8o+/EeFgaZXA1+gvp8BfEbcfktN9VawwCkAiXHhVj8hbXKD1hNxGXlrrCXMmRozZGI86nsSQ7P/GOm9fmOsdCQGdmtXDciAuRbM119DtdX0yzFH5zf+1a5EJAF1CJHz1Zpq/Ljt0/xHp9eUc+j/gzmc6tDAmt5R7amIvhthNoSlGOwTls8tljN7h3vGSCl2Eui4UboOZQJKoi8AP3oJL+TiSk9hlrD0LfKa/sARCPDepKBLjIbR1U5e251UApijzq9hmLG+Zcf7PXln5yW8utf6Du1gc8BtXiWPXWg7pDFRucs4R2aXhzOs0ihM9+sfXVzzg4DpwVpUt0takW7YLCoWtbReK7V/AZXhFVK9/2KvJK43KLMtOYzmvo6Uf8gz2jGdD9hVzig== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(136003)(346002)(376002)(396003)(366004)(6506007)(6512007)(26005)(2616005)(186003)(1076003)(7416002)(44832011)(52116002)(8936002)(5660300002)(86362001)(6486002)(41300700001)(6666004)(107886003)(478600001)(83380400001)(36756003)(2906002)(4326008)(8676002)(110136005)(316002)(38350700002)(38100700002)(66476007)(54906003)(66946007)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /8i+X10rqpI/QTTx31dH+ZdoG9/qk2010Td7E2Hmn19NhroMBYCmQG0ol7QPAq4gPVl5sbo6yeJFeRO0gtB3G0U4ISCipEqaM9SVT48TuE8j11GUqYDjsinPBhW7U4f5B5X0z8UgN7E0MmsATFOHKwKMURZ+2Z50FULXLB8qp6Kbz435WtZNMjcKbNbvpBrFYL9DkOLtfx986Y9/UUuxPjVUMidCiBzYAPlBWI21V/YSZpsUEH4VDQe16jPVpyckn1tGo/5LVSql8wz/g6e3QOsvC0P1/myxxeGS++wyGD7fj4jtaxXgW05ogSSDTOa7nM4XSyv29gCuHVO4XSwvdyASdXEJrLw0i/vMXi5bNK58kyg0kDfPSyOuch979C3KWv6f1RgpR2GSt5lA3ooXNO4zxGKheSdvSUMn0LUimV59QqpgJF9IoIh2RbfdtSElbCdmAALixG5VxhoycySDe1va0b7dG8E4pqu0HgcvknZPhJywISWSWxjb4KeA1EW9DGisTn1TGQoW6MINt/exOXVY3fsht6zq6hUCdyJJqpNRtn+Kt01ZI26xGiEE8kt4nsFx6R3vD6PQxJfDZGBs/gwTdTa4Rdu9lUpHHvNVXJgikPyb/ORDsfyor+ps9sLG/0qtrONLoR6Q+En6mrM6sOgywHyP8OMbtazpXqUZ1atISpQPLeAEmxs6BTwcZEspaRPGYSuc3aesaRMROROgHxL0xMSLB20CMFbyp/vxreWM+GD6DuFWAWkQPvPZiFtc3Ol8+dH20q/D0g9XxdRSqQyEuXpMjmLde+aXGpkW7V338z61lj42/53btD9WYccxPUzVfArPob3o7xYHlZXINEyx9h1KQ6FQqD22w8iM015+xwWv8y8IVQKSTOTjM2ECLMQ6YTbQhUl4TS0NxA8nGvmsXQcIMYEYQaeqlkmIq4XzBjvulTR0TvV3i9aWVx+ARjcoXtnhbrx7TDpWRtNxM2RtD/S+3U8JBvhxfIGWRXkmfUSuJhIwwGbxeQ+f+/fRQegfRqZia8NgbO57J4d6ulmQ3RVFnfbsC2vZJctFfB8fjhzjYXfiCUwPrgEMOYjtoMa1u4kFcSs305j8uYxTtTPYpGmPwGQ/F/LyK/Jdo0XW4r7AZgoJO0Dn88pLlpUQ0XPit8ufTRpSs8qnBK7HPeyReFOnGF9wOOs8+KK8YkscW4GuzOnlJhZ5ETUGTf61XJcuzw2fhJQwpuNM5sm6TQRCuo7ptrifgjGUpUGECziAGIKdeU4Erzzpmc7OyyBL/aKtR2r+VPkQNJD6cqdEcCaB8KirTS+G0dO+5Hqn+kYulVgChC4//PVqjL4p+VNgUkakO4v+J0t1izdh8ELqVu0hNh0FYs5DRyC6WR1W+cmrxjH44MOn0kEQL51/cbExgmSxX2vayUG24I/Vt9QMAwL6xRtAEXqpzQk7kjb5fyUxNE4wl4kNOQhfCCAg6aeO1PNq+dhJ64/PAJ3QJibrfSIpvQe7f5kyBYIE2esOaVzUkQNCTqWBFSMBc4/1iyxzVM0k3HuR0qxGUV5E5xW12Ry2FzFU5PbC1qMUoWZ2HIy/RNduo3itHQJGuBiOX2jHaAqQuEEvF6OokXE7A2CSig== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: f7ae83f7-8632-4327-38bb-08da8d2e365f X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2022 21:58:04.8599 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bn99MfgQvwdBU9gkaJLjnpCUcK22DN70Dyc+TbHJCgQDnc7bTE/fm6I+4m3NC2IpnDiRlReG0ZscHcNM+PJzXw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB4085 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Instead of using a void pointer for mac_dev, specify its type explicitly. Signed-off-by: Sean Anderson Acked-by: Camelia Groza --- Changes in v5: - Reduce line length of tgec_config Changes in v2: - New drivers/net/ethernet/freescale/fman/fman_dtsec.c | 2 +- drivers/net/ethernet/freescale/fman/fman_mac.h | 5 +++-- drivers/net/ethernet/freescale/fman/fman_memac.c | 2 +- drivers/net/ethernet/freescale/fman/fman_tgec.c | 5 +++-- drivers/net/ethernet/freescale/fman/mac.c | 5 ++--- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index 09ad1117005a..7acd57424034 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -301,7 +301,7 @@ struct fman_mac { /* Ethernet physical interface */ phy_interface_t phy_if; u16 max_speed; - void *dev_id; /* device cookie used by the exception cbs */ + struct mac_device *dev_id; /* device cookie used by the exception cbs */ fman_mac_exception_cb *exception_cb; fman_mac_exception_cb *event_cb; /* Number of individual addresses in registers for this station */ diff --git a/drivers/net/ethernet/freescale/fman/fman_mac.h b/drivers/net/ethernet/freescale/fman/fman_mac.h index 730aae7fed13..65887a3160d7 100644 --- a/drivers/net/ethernet/freescale/fman/fman_mac.h +++ b/drivers/net/ethernet/freescale/fman/fman_mac.h @@ -41,6 +41,7 @@ #include struct fman_mac; +struct mac_device; /* Ethernet Address */ typedef u8 enet_addr_t[ETH_ALEN]; @@ -158,8 +159,8 @@ struct eth_hash_entry { struct list_head node; }; -typedef void (fman_mac_exception_cb)(void *dev_id, - enum fman_mac_exceptions exceptions); +typedef void (fman_mac_exception_cb)(struct mac_device *dev_id, + enum fman_mac_exceptions exceptions); /* FMan MAC config input */ struct fman_mac_params { diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index af2e67a250de..0e0d9415b93e 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -311,7 +311,7 @@ struct fman_mac { /* Ethernet physical interface */ phy_interface_t phy_if; u16 max_speed; - void *dev_id; /* device cookie used by the exception cbs */ + struct mac_device *dev_id; /* device cookie used by the exception cbs */ fman_mac_exception_cb *exception_cb; fman_mac_exception_cb *event_cb; /* Pointer to driver's global address hash table */ diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c index 2642a4c27292..0a66ae58c026 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c @@ -180,7 +180,7 @@ struct fman_mac { /* MAC address of device; */ u64 addr; u16 max_speed; - void *dev_id; /* device cookie used by the exception cbs */ + struct mac_device *dev_id; /* device cookie used by the exception cbs */ fman_mac_exception_cb *exception_cb; fman_mac_exception_cb *event_cb; /* pointer to driver's global address hash table */ @@ -728,7 +728,8 @@ static int tgec_free(struct fman_mac *tgec) return 0; } -static struct fman_mac *tgec_config(struct mac_device *mac_dev, struct fman_mac_params *params) +static struct fman_mac *tgec_config(struct mac_device *mac_dev, + struct fman_mac_params *params) { struct fman_mac *tgec; struct tgec_cfg *cfg; diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index 0f9e3e9e60c6..66a3742a862b 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -41,10 +41,9 @@ struct mac_address { struct list_head list; }; -static void mac_exception(void *handle, enum fman_mac_exceptions ex) +static void mac_exception(struct mac_device *mac_dev, + enum fman_mac_exceptions ex) { - struct mac_device *mac_dev = handle; - if (ex == FM_MAC_EX_10G_RX_FIFO_OVFL) { /* don't flag RX FIFO after the first */ mac_dev->set_exception(mac_dev->fman_mac, From patchwork Fri Sep 2 21:57:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12964736 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 4C63DECAAA1 for ; Fri, 2 Sep 2022 22:00:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231437AbiIBWAG (ORCPT ); Fri, 2 Sep 2022 18:00:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230526AbiIBV6a (ORCPT ); Fri, 2 Sep 2022 17:58:30 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150079.outbound.protection.outlook.com [40.107.15.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00BE0F8EE6; Fri, 2 Sep 2022 14:58:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k2+q45ED9FE73+iCNUqLi9OC4o3vB8MMWJrs9CYF5spDE1RcFS/Enr7aFC2e+r+tnhPF1F88+5nVMgOn1qnu8PgnqCYXnGwkE1gvRMiNfIX7A5eA4EovcgYSkWRNXzRYMblj+w3KPlSuSBPE2xIRTkAjZ/8r0c4Z3dvTfNaFfYO24WHDKuR4Ei6xgGEkb6l65hdDU/1ZKPDu/MagSMzczlveqje0bcO2/2OWZInyjiHjGtfvUNSYtRdNvTF1VVWoYsgo4msk5v9LF87NT2Y0I6bSCTZdhJl8vCObSeiO+vsOFFn9grc9LF9G7xpNQpYVHWNXGW7wy0BUMn+sIi1Zpw== 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=F39VOWHdbomM6yNOWWJ7eMkODFt7MS7bR17qY8C8kTQ=; b=S5RqtxAPCSUiMOtfDiKOMhijLKnV8Stbql83sKYB2K8lq1PN391anw7RIUSVzzdLZZbkA3FmKvCn3Rn+PlLjlPsZtKFZZ/1+3V6YXC74zKg5vYn7r4s2h7NE3xjKTU/6wIMEX97kWMgMEPYycdVgs96QD5EJ+lFTVRmwLJqIA9Y45UcDZxCexPbwRBC7pTUm1ESZNMYEkfmbIxxiA68vPEK1TjfzQxuIcAP9t9mbiYprD3bkmWQCtUAzRX52qLrgv2vjstcHNIQgSJXY5WqujkvwfkZ9MLTAzedKtwho/xx7Kw5mfo+JvFy5f78q6WmGXCPyspRB35A2KvXwDbZtWA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F39VOWHdbomM6yNOWWJ7eMkODFt7MS7bR17qY8C8kTQ=; b=pS1V3JL70y8vxeXNNszEyRGCZADgtSXi5Cgka4sdxQKM7vU4ZbYsyZ4H7PW3kzbs8Kh227IANtGiLwSeNbTz4n5Pp6pYVpB3MXx0+83IQ3iBcFFR/Sd8mdVPLownOJ41fE6YZ6G3sUGWoztX9Y2DuSUNsR8c7d5ep2EQlKrXnHos66Ax9LZ5JUiMXi7tBrBhFyH2O5fjviyS7vyze2SPCqn1vRnKuPyIB8s6jRa7kIl3ephza3Bom7GhIAAO/2YjSk1gVWLGGztjzaQRJpjIce7kNudfYMqtc2U+3XuSn/QVgQyQfbRDhuAtYURdSDfyZ04v5O/+cwTfGEYWEibbAQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AM6PR03MB4085.eurprd03.prod.outlook.com (2603:10a6:20b:1b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Fri, 2 Sep 2022 21:58:07 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5566.019; Fri, 2 Sep 2022 21:58:07 +0000 From: Sean Anderson To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: Camelia Groza , Madalin Bucur , linux-kernel@vger.kernel.org (open list), linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Sean Anderson Subject: [PATCH net-next v5 09/14] net: fman: Clean up error handling Date: Fri, 2 Sep 2022 17:57:31 -0400 Message-Id: <20220902215737.981341-10-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220902215737.981341-1-sean.anderson@seco.com> References: <20220902215737.981341-1-sean.anderson@seco.com> X-ClientProxiedBy: CH0PR03CA0315.namprd03.prod.outlook.com (2603:10b6:610:118::15) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 50911eee-2a36-43c4-12b8-08da8d2e3782 X-MS-TrafficTypeDiagnostic: AM6PR03MB4085:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TVJ5TGBy4HOikSQf6CS57HfAF5mz9vTxl2Ifpg+xSZNrlMut8DsKoRyqBe3Z+Qs+CmPa0Rk9WCWuXV1N+38bB0mRIxDR6mGmqxgjb+xt09IZLLWprZrAP+y/OhW+RJ+kt6haiCSuXJ5HU+6YZLZhMporVIk/bzyI7EIrq+rpPszdzecjJwE9yz8ZHDG9LuYV8AMwwh4mCawmEtcncj/BYlqc98HK4ohoZUfLI4DXJ2VBF6pKs8HmqWowvT/cq3r1nhS+fX6oGPg+pWxXtq2fliBP1h+4rDZKb7Ok/NAjQZJUyNtxakZs2/U9j1TreM4vEyzReusORLeoBPFcfJQTSfI5Xa6PUt4oBBZhJonAN6Bc4OatvTU3JQjPT0S8Yh7qdxTVcHPkMQB0jRQw+W3RPIs6pC7cHcSnFnAYHsDTAfPYI5rRXYijLn/JIW2c0191TceOOuoZAIKe0ADZM6h5PhsOa8o/N1qQRF+BbDk5UNFkUFgySyysqcBrxkZ4JAmqgLAHh0PAfZuOVxjTR9vGsfskU5vQKRGT/WTTQtlq73nsobDKWOuIlkqoDok50zoDWfbdW8VUYDUcXXQkxk1D0W8mVsEGmuiNNt55MkA3nJmRY6ZvMtGx1lLBxZHYVdimITbFAnGZ9YQV+dmXfeIASn6DurTuDnzFvDsBfec+5r/07ot1w5kx6HYtRwcMYMUVU7fNzxqBb2HRgx5HEMUZcqS9DO9/lFB2avwBFf5lDkgSdSz12jyhKxfxnLOmvCKpp2Pm/RA7M8FxEg2cMvKcZw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(136003)(346002)(376002)(396003)(366004)(6506007)(6512007)(26005)(2616005)(186003)(1076003)(7416002)(44832011)(52116002)(8936002)(5660300002)(86362001)(6486002)(41300700001)(6666004)(107886003)(478600001)(83380400001)(36756003)(2906002)(4326008)(8676002)(110136005)(316002)(38350700002)(38100700002)(66476007)(54906003)(66946007)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SM3y6GswtlxeHcuVj4E4S8docDs9j6+ybl3/8lV/DSoR0ggsxn/LFJL1CUVa93FvJj3L9tLqxQszJlLPXP3/BlSUcL9H8NgjnklsPVA/veq8VCW/QMAuGjFQF38cvd7GGC9rhafRmaetFQ4YwQ6jTtfQM2tm/ueUPeSSKXetGAnBxubDCoy6GPtGVC7uklcbwpB9MLDN20MIVzCGTSBVNBnhgegnKx/55p5XKiElVZDPzzxz8hT1HC009UUWkcNaRxwpDO8wlaxDtrxtFax5CS91gThS7Lbf+sRQ4tB0mHLKJ6HMBKm5nwLomiTE2hA+NTK/UF/l/oecEWUxOSi/7sQI8C3JJXKGDZid4Ce/mSmHhuVgnmY7nzURVG2mcz0DHummlX1UZcMo2ESQlPsuh+i1Gndr9cWvZ3gcwGHizGXo0nXKezlacvLFq59RdZ9yS9CM5HK74DfSZm1bl7rsZT2S8NzDs9DFgX0JAKqU10sQ4XQ22hNtIDuEE5orbf1L9BwMUPXTjEhWtS+KBp5IizCr/hx6CV5ZALkR/G4aUdfeuv2uPBH69Nc2aCL+0Wke6b6p32jLvwfpCl6qK5nIMQMlDYvPTU/XhFRWNRcxddVTe3ENjrIDJKn19w/BeBBDeW5kLPuxG0r8QgxYvJYQcVMNRqk0+8OpZBPSrwP5AON8dloAs3NmqXh0HkcL4RCGsUiLktFnT+TC2xKV6Gu8VQad22JZbb3lBNfudQH/NWpST1tj0/vygXKEGQYDo4FWrMnOfwDK1YXrbn/kY5f1tjF1NkelJL5Pnw9jtwPzd7JIAwaI2SfO81Qyd/AvG2Uc27bnr+/hZNF88T9i/0+qjHA7tyjVEIUQuagGTATGe5iTY0PgrUEHHYSmdawf+8G3UUWgTjn+N98hhufcIMp6EOVaebV789J6fNIMmw4WmJabOoRStLmr35y2+BegEL5UyljZmHT4FkCb7LZ03JP51fAYf8KR18dww14EimieoO4PqDiIWd35sRwFr1y/HuWcxg12WeFeDVtJQQbavp/88JxgbpCIhzp+la+5aCPcqSnCR4Al2kmcQ646+dXqOYfieNy4usUXEfL6ZWHiAwFaqmy3r5OdS7C1DY3Q7cm8RufbfW1PRs7EgRtzynmVIh3/yRFUvY8kWDZNBLcAZ5CUdrvjdl4atL+VaVQaivHyygGPtX//yGh+JyVOwL5IKFZtZEIvch5VWdRNSK+QP+VIshzQfdOekJNxgWWDXjHeeNxYQYL6S1786kGkeIooggSg8qUvtNkMyE4RRm138QvtEIPX4JcxiHOlubq1uU+Mf5AgAQGqhIUI2+FQLe4y4fTbNH7DaQ4KbPkSRwPh2ohN3QCrpR7G1HT3mGnl/cUWd5GzrM3xG5rMvjhtgjP7qOqORekfcw/NU3u4zqOkWuLPk9jFjsX8+R16cdHu/NQuH7QCHHDVsZ5+T5/rfywp0fBTZ+yoCST4XOYyrENOpqFeUYSqIWKsYLv+E/Q3RzJWSnHWGK6uoRI+YdP8RRVSG7HqTj3hjaQ6sICtREBEQuCNSzR+yrQ2iMh5ue+nS+WdhgvBt6No36SeSbC4h1aFBvOmlLWuOJwEMuqoU73kc8DQ6A== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50911eee-2a36-43c4-12b8-08da8d2e3782 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2022 21:58:07.1098 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uyBgAIyxTKw26l+lacoJXHUmPKXhhXlwxqgNUqqS/1Xo0VRGLM6E6L35SeUWLEaKuhW4dxLVnhTXNLPxhlV6Qw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB4085 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This removes the _return label, since something like err = -EFOO; goto _return; can be replaced by the briefer return -EFOO; Additionally, this skips going to _return_of_node_put when dev_node has already been put (preventing a double put). Signed-off-by: Sean Anderson Acked-by: Camelia Groza --- (no changes since v1) drivers/net/ethernet/freescale/fman/mac.c | 43 ++++++++--------------- 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index 66a3742a862b..7b7526fd7da3 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -291,15 +291,11 @@ static int mac_probe(struct platform_device *_of_dev) init = of_device_get_match_data(dev); mac_dev = devm_kzalloc(dev, sizeof(*mac_dev), GFP_KERNEL); - if (!mac_dev) { - err = -ENOMEM; - goto _return; - } + if (!mac_dev) + return -ENOMEM; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); - if (!priv) { - err = -ENOMEM; - goto _return; - } + if (!priv) + return -ENOMEM; /* Save private information */ mac_dev->priv = priv; @@ -312,8 +308,7 @@ static int mac_probe(struct platform_device *_of_dev) if (!dev_node) { dev_err(dev, "of_get_parent(%pOF) failed\n", mac_node); - err = -EINVAL; - goto _return_of_node_put; + return -EINVAL; } of_dev = of_find_device_by_node(dev_node); @@ -352,28 +347,24 @@ static int mac_probe(struct platform_device *_of_dev) err = devm_request_resource(dev, fman_get_mem_region(priv->fman), res); if (err) { dev_err_probe(dev, err, "could not request resource\n"); - goto _return_of_node_put; + return err; } mac_dev->vaddr = devm_ioremap(dev, res->start, resource_size(res)); if (!mac_dev->vaddr) { dev_err(dev, "devm_ioremap() failed\n"); - err = -EIO; - goto _return_of_node_put; + return -EIO; } mac_dev->vaddr_end = mac_dev->vaddr + resource_size(res); - if (!of_device_is_available(mac_node)) { - err = -ENODEV; - goto _return_of_node_put; - } + if (!of_device_is_available(mac_node)) + return -ENODEV; /* Get the cell-index */ err = of_property_read_u32(mac_node, "cell-index", &val); if (err) { dev_err(dev, "failed to read cell-index for %pOF\n", mac_node); - err = -EINVAL; - goto _return_of_node_put; + return -EINVAL; } priv->cell_index = (u8)val; @@ -387,15 +378,13 @@ static int mac_probe(struct platform_device *_of_dev) if (unlikely(nph < 0)) { dev_err(dev, "of_count_phandle_with_args(%pOF, fsl,fman-ports) failed\n", mac_node); - err = nph; - goto _return_of_node_put; + return nph; } if (nph != ARRAY_SIZE(mac_dev->port)) { dev_err(dev, "Not supported number of fman-ports handles of mac node %pOF from device tree\n", mac_node); - err = -EINVAL; - goto _return_of_node_put; + return -EINVAL; } for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) { @@ -404,8 +393,7 @@ static int mac_probe(struct platform_device *_of_dev) if (!dev_node) { dev_err(dev, "of_parse_phandle(%pOF, fsl,fman-ports) failed\n", mac_node); - err = -EINVAL; - goto _return_of_node_put; + return -EINVAL; } of_dev = of_find_device_by_node(dev_node); @@ -465,7 +453,7 @@ static int mac_probe(struct platform_device *_of_dev) if (err < 0) { dev_err(dev, "mac_dev->init() = %d\n", err); of_node_put(mac_dev->phy_node); - goto _return_of_node_put; + return err; } /* pause frame autonegotiation enabled */ @@ -492,11 +480,10 @@ static int mac_probe(struct platform_device *_of_dev) priv->eth_dev = NULL; } - goto _return; + return err; _return_of_node_put: of_node_put(dev_node); -_return: return err; } From patchwork Fri Sep 2 21:57:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12964737 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 6CE3BC6FA82 for ; Fri, 2 Sep 2022 22:00:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231182AbiIBWAN (ORCPT ); Fri, 2 Sep 2022 18:00:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230343AbiIBV6c (ORCPT ); Fri, 2 Sep 2022 17:58:32 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150043.outbound.protection.outlook.com [40.107.15.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F854F8FC6; Fri, 2 Sep 2022 14:58:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hVAx4+wSDQZbuBvXgYqLeIRHSVbqUcGcrmi8HFO6SpSY8EVhUt5uqbEIsXL96uV29wVJUwep5LblxC5ztSlYxON39WqCjzP6anQs7K4/AuEKbu2e6QL2s9Q2mix1PkfVAueQPTTS65i0nCD/QuLcWvn1PaPabtuUea2oZsO8AAZyyJ567QBmFtUDnme865ZNrONIszEHUfv4ixaQp7u5G+1+iqDhPizfXVGXWQcukWHCAMDOTFBRtQ0QXIP0YqPyTlTSGEBmqUmljWk4xer/M22T7mUaxViyrac8tPx4A5KJFIeZYlLUPrSsBI5SOU/N43S7FpRgAwaI9No2HbvW4A== 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=DPJ9aEZ0tCyCtwuMuwv2HSxodcvXZItyWRtXwYebUDY=; b=iqJPvLUEShMwZogzAUtbv0i3v7+rCKLfeMYcCbU0Sh+8opTpFr0Xv4sB/MK7e45N1Q/4k7r3jqbMEkTEno3nRC02UE+wrfN8hmyIjolg0NwFf3oPCILBAq7OfU/jAvxULKHqXzeecaHRMLkkPtvlTpgtNxP/OPlEPefnU8/+6aCjtGisGkk1Uusz1cOnA81fNRHFVAZ6CRmeHvBeEtEwUaBpzLsdOUFKSl56OlrjPMu6LOCPrVqC0Cr78U2CUmQk1gZFJbbtgZDvcxMSFK4sAmxy1/BTcX4wcSELdqxMVZrpE13TRBOnMhxGnafIcmOHrFFiwHW22+2OylOy9uhgbQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DPJ9aEZ0tCyCtwuMuwv2HSxodcvXZItyWRtXwYebUDY=; b=zu2vU3euAbW6SSmOT//0dX96aZX5AusK0AKHgyEP04LrzdHLwLZnTGwR0iVdjEn6DSBQT9/QpEMzb6Ye6ttogDKMnHHrT9A2YhwHHPzdApKEH0A23XJFO+gNxRS8WiC8sQEmOkU+mf0brWbyQrcPsxjNYaE/ObeSQ5+7dY27yXF2JcdVCu3l9wW+Q8J+Gs3mYEBrcnk7uPUPITwaYwN1aVn7QxEIeSTBE6kj19TvpVt7kjZ9UsqlYr8x3Ve4KgSACsUgW9Rl/gddgIM4GfMRXREfk60TXhc7Pin8v39aaOsR5VwRVIRMSKJdnmbKq3FyBK6eku/i+T3/Y3oX9LDaSQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AM6PR03MB4085.eurprd03.prod.outlook.com (2603:10a6:20b:1b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Fri, 2 Sep 2022 21:58:09 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5566.019; Fri, 2 Sep 2022 21:58:09 +0000 From: Sean Anderson To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: Camelia Groza , Madalin Bucur , linux-kernel@vger.kernel.org (open list), linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Sean Anderson Subject: [PATCH net-next v5 10/14] net: fman: Change return type of disable to void Date: Fri, 2 Sep 2022 17:57:32 -0400 Message-Id: <20220902215737.981341-11-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220902215737.981341-1-sean.anderson@seco.com> References: <20220902215737.981341-1-sean.anderson@seco.com> X-ClientProxiedBy: CH0PR03CA0315.namprd03.prod.outlook.com (2603:10b6:610:118::15) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a159ce17-7811-4988-4b1f-08da8d2e38e5 X-MS-TrafficTypeDiagnostic: AM6PR03MB4085:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2mveDSjxZP+mYTBWNqj4XARFkNbVGqAmmEChCN7X4zlqS9Ck8/j96oD5X6zHBcyMPX4AJu7o48RaL2fSgfpU5ARYnJQtbAM+VZrEACJQcTHHl64pgP1uGTYW6s2HPNux09c7QAfQT6BPwJGz/x0Sr1BkiIm1NLJqiARgU3ZdiccEaN/H0fXK4tjOSEr/mshc7ZET2IskfZ1y33XKZiaN17EajJmzBC92nqP9JLr/mmjDciWlT66VSK5JSYDGOm/6x3EG2qx8YHi2mFAF1YEv3v2UOjLIbM1wklK9eXHniRStskU89WXai4NhwQuMVb91fuT0MKq6SXx8c8TAvWg2jdKs176UBvZNrgrqVmG0RAuUas5cFr0I1AoJ1VmxwThBUPYckjzx22Birfx33lEGrpbVaEnWtV2c5HsKngSgDrg82+0uqGmgQAbWADsSeiiNP9Kj7iCcRMHxe4Kxcr52SgxPBNhPXGGlamrcUoDCIRZtx5ubo9eCa8JWPXoJKA3qDkYPWovdwVN5VAHxvN2giII3SMfTy7GQYDBGyfhPNFdbRFv5e6weEMQ9dXSBJLlrQp50DbA9fcHGI0AzOnMF6j7b0HHiWACNX1dAqqez0InxDNDqWvU265W7ZpWvOzOxK5n6h6JZu7CjgBvwFWpEccTQlIEfFh95iyR1K7MaQYUJ1AWNbjjEc3A2AwvWaknI0rIef7C+S+jbEVSPq1QGdk/bZ3E9nRScw6/7FEDMS5OF1fLBH6RrVcb+osQxNgYf X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(136003)(346002)(376002)(396003)(366004)(6506007)(6512007)(26005)(2616005)(186003)(1076003)(7416002)(44832011)(52116002)(8936002)(5660300002)(86362001)(6486002)(41300700001)(6666004)(107886003)(478600001)(83380400001)(36756003)(2906002)(4326008)(8676002)(110136005)(316002)(38350700002)(38100700002)(66476007)(54906003)(66946007)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zfCmFpCxulvDi/XP05hOxoGiaHsBhMK+cv57gmeboEnPvif8AY3psS4mw/G3WnvokJxGnjGyUxrnWmNGvS5b+fEG3n9DA7Os2PlhGGV2qeIhmSJ6IgWS1UrnpM0s3WcpqMiRfGtnpgEOB35fb+/2RdvwAEya9K+35MvYvEJ+TmQWilEQnmtq4p8zXqrmtMZBmrTgC7TUOTHj+ECKyMtlgDg1FvXnfoym2O4pXALNYGnWsJblgzoMpFKZVAkmqe0z+gP4DzdoxYBh9f/LNq/QdARBJgwwJRBMqP5OJ9aFWVWXOi5b7inv/rSDjmVEz4abRTBMCVod0UqRfNgi2t337psYbN9NToyMsHV/iufbyuBvuMLHy9muDo22y8MvGj6wTLbV2PpWoiqrfv9rg3DzMjmvqh4L2zfClsuONaV3F7AwXSTVEReDsZh85K/P6wHHoY47EnPJrfryhFGstT9U8bKSpqV50B2X6k46KRLZFW3Ru6JvY9fAYlY6Fuh5cMtT4UMmt0hdMANR38OSlM7R34DIPxrVmMfFI5yZNUIXhmFJFXgjOurYRkZdsqh6Wp2N8ullBr6JlTd3i3vwJHu/imSR7msOCdptDkQc9LB6ma02omifjyDkrIkKoNeU+ZhpVmmGHWSSCU+bW4mQwBqogtvtSq6IVnmWtMXYB7trMOMl3dUA0SEe5p9hyxc/1ZvJxSZbXwZLOMy7/i+w3mstpLLtwZF8o8Tur9WY35y3foqpsbCaODfX49QnbLcnwNi8N/XLgs0IJHz6jJnaFyleT4F6dhESrGiPCBGd3qE8AWn+cxcTEYMes6ZfLTSJq5a67QViyaGB+Z23sTkUMzqhTwSFE2jTZOI+Wl1nms8hj5mSwryGfBHS1/zu6CTUCH1C0I6Y0FalHtVQKsYldgiyh//G8gTKgqjx5PqLy9g6d/DbZURDYFsy9emh7OooVSIhRJjk+B1NqrTCBiyIDnMbExl6LcrTDThbSTSlMwtIRsGAyPjiHxalGZS/JrQe9so54sVPeMwuD7ZFDLkCYPDdU+uJgp/TU84BE9+N3iF80SWdAgj6X2ynbRPxbrjICHcH1lQpBmMNc0dxz8HlixSyU6oh+zY3PedL/V913yEBjrmbKDvTjToYRQJ6zhGh+zJiCMJ6s1inNs4tsyQsNYXEesbvgnnrYx2TJ0A/qfqcJizp01aQLmqMYrxjCTnnrKWCxbJrR+Z8XAhVsY22hMoZlOskBsiObX+2nNMWotZ+L0DqxUQLcoOcJ1ceisQQ0923taEjq70JgkHI7X5x4HhPxQQmbYyEfv7IyiqwljZLE2Vt5AhXhSyMgQZ7QNm0VdGhl4huXZVuORUWyBv1lHOiWEpIfpci6M+bMwsOpQpre8cEasZng0RZQ1utYnCMcXSPcsNf/M1+W8EZzwfuN1d73DturUZnPMHVQ1ClUoOMPD/JRWXSHM0iKbjTLAlfvu7bLhxzfca2KroA4q/6Bfb+3hn55HDKv+WE7gBu/mvRCK0IOnvPCjK+5GozMuxRRpRAn0ykUJ8/T/zzIUcmRxrugFUHCtg+CGfAURtjhjZtijWGwW42JOQDMFFIx8vJS2ex/FPAsQ02vc0OTipJ+/7BjQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: a159ce17-7811-4988-4b1f-08da8d2e38e5 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2022 21:58:09.0628 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: DEdJNS67+QwAJdMD2FnoLGKpzXC8F9bRGPnDJU35kyn4LFc4/f1MY2YiTyL9XMzjQ7kAoQcEl4HDpSN6lcFDCg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB4085 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org When disabling, there is nothing we can do about errors. In fact, the only error which can occur is misuse of the API. Just warn in the mac driver instead. Signed-off-by: Sean Anderson Acked-by: Camelia Groza --- (no changes since v1) drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 5 +---- drivers/net/ethernet/freescale/fman/fman_dtsec.c | 7 ++----- drivers/net/ethernet/freescale/fman/fman_memac.c | 8 +++----- drivers/net/ethernet/freescale/fman/fman_tgec.c | 7 ++----- drivers/net/ethernet/freescale/fman/mac.h | 2 +- 5 files changed, 9 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 02b588c46fcf..d378247a6d0c 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -290,10 +290,7 @@ static int dpaa_stop(struct net_device *net_dev) if (mac_dev->phy_dev) phy_stop(mac_dev->phy_dev); - err = mac_dev->disable(mac_dev->fman_mac); - if (err < 0) - netif_err(priv, ifdown, net_dev, "mac_dev->disable() = %d\n", - err); + mac_dev->disable(mac_dev->fman_mac); for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) { error = fman_port_disable(mac_dev->port[i]); diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index 7acd57424034..f2dd07b714ea 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -871,13 +871,12 @@ static int dtsec_enable(struct fman_mac *dtsec) return 0; } -static int dtsec_disable(struct fman_mac *dtsec) +static void dtsec_disable(struct fman_mac *dtsec) { struct dtsec_regs __iomem *regs = dtsec->regs; u32 tmp; - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; + WARN_ON_ONCE(!is_init_done(dtsec->dtsec_drv_param)); /* Graceful stop - Assert the graceful Rx/Tx stop bit */ graceful_stop(dtsec); @@ -885,8 +884,6 @@ static int dtsec_disable(struct fman_mac *dtsec) tmp = ioread32be(®s->maccfg1); tmp &= ~(MACCFG1_RX_EN | MACCFG1_TX_EN); iowrite32be(tmp, ®s->maccfg1); - - return 0; } static int dtsec_set_tx_pause_frames(struct fman_mac *dtsec, diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index 0e0d9415b93e..fc79abd1f204 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -701,19 +701,17 @@ static int memac_enable(struct fman_mac *memac) return 0; } -static int memac_disable(struct fman_mac *memac) +static void memac_disable(struct fman_mac *memac) + { struct memac_regs __iomem *regs = memac->regs; u32 tmp; - if (!is_init_done(memac->memac_drv_param)) - return -EINVAL; + WARN_ON_ONCE(!is_init_done(memac->memac_drv_param)); tmp = ioread32be(®s->command_config); tmp &= ~(CMD_CFG_RX_EN | CMD_CFG_TX_EN); iowrite32be(tmp, ®s->command_config); - - return 0; } static int memac_set_promiscuous(struct fman_mac *memac, bool new_val) diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c index 0a66ae58c026..1b60239d5fc7 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c @@ -408,19 +408,16 @@ static int tgec_enable(struct fman_mac *tgec) return 0; } -static int tgec_disable(struct fman_mac *tgec) +static void tgec_disable(struct fman_mac *tgec) { struct tgec_regs __iomem *regs = tgec->regs; u32 tmp; - if (!is_init_done(tgec->cfg)) - return -EINVAL; + WARN_ON_ONCE(!is_init_done(tgec->cfg)); tmp = ioread32be(®s->command_config); tmp &= ~(CMD_CFG_RX_EN | CMD_CFG_TX_EN); iowrite32be(tmp, ®s->command_config); - - return 0; } static int tgec_set_promiscuous(struct fman_mac *tgec, bool new_val) diff --git a/drivers/net/ethernet/freescale/fman/mac.h b/drivers/net/ethernet/freescale/fman/mac.h index c5fb4d46210f..a55efcb7998c 100644 --- a/drivers/net/ethernet/freescale/fman/mac.h +++ b/drivers/net/ethernet/freescale/fman/mac.h @@ -38,7 +38,7 @@ struct mac_device { bool allmulti; int (*enable)(struct fman_mac *mac_dev); - int (*disable)(struct fman_mac *mac_dev); + void (*disable)(struct fman_mac *mac_dev); void (*adjust_link)(struct mac_device *mac_dev); int (*set_promisc)(struct fman_mac *mac_dev, bool enable); int (*change_addr)(struct fman_mac *mac_dev, const enet_addr_t *enet_addr); From patchwork Fri Sep 2 21:57:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12964738 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 3E3F1ECAAA1 for ; Fri, 2 Sep 2022 22:00:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231473AbiIBWAl (ORCPT ); Fri, 2 Sep 2022 18:00:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230360AbiIBV6s (ORCPT ); Fri, 2 Sep 2022 17:58:48 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150079.outbound.protection.outlook.com [40.107.15.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D86E3F8ECD; Fri, 2 Sep 2022 14:58:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ExVy7nEZp6FWtE4i8VI/2O01ZlEfEuN6oOx1lE2/mkJXjKDtlClug5lfQY3c95WoiWlzLdgbkXas2tsWzj58OM2t1+Do/HjCMLL3NQ/OVo6PnHA4aXlQ0UBeUYgl9z6n7dN91yXUULwIPXVoVZyYGvn05PwBr/+5ZLTFchItVJqkv8rF2Emye+NsME9A6et3XBqGlJJf5I1iI4RLf230R8rtJJc7quvHlKuymQ0r+uaY3rlmlMPh/byH7vSOkDJScNzzGtxjG69cyKA19TULweax3drQgB8tz9VwHAN12RHSLLdyi5nwBmhXBjQP3Z6NK01Wkn/JnsKXxsg2q12C0w== 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=TqJP1HjUKNiOj19I0PtTLzwe2FIfFYUs1TMZxj3zRTY=; b=jVv/sa4NCzHQ0zupqGdfc1xzdZjNM6SiJWE8gmf0N8GXyKGpiG2DaK8Z2axPrepfyQmv/0cKI8dDCVYCVA+FUiTaoJUVcLp1fP19/sNH7pzutxC2qdgasgFHYDLRwH80y5h1hUu04iBcp7+l68Iw0AoiDlijItZeGi+QfrA43yOvKIhbz58YeE3dlElak+ZERyH9RlYURW+NMiVpbp77yLW+vZHNH9Uz5RMQOlDp0Ir4ML/e02UcT+uDyD4/Lesw8w6WiL5GE59SPXH7K6lotyGJprX27G+zl3VLUUHDRR6iFuoShX7vzPjjUsYl0X3HWgy3xG/BhnR7fU7p86jIsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TqJP1HjUKNiOj19I0PtTLzwe2FIfFYUs1TMZxj3zRTY=; b=m/ToFdIwYu63JzdKmTQdFG2Xdh2nlA2b2FmWgzpSuKLuRAB80USmbQxHeM9WgoU+Cbj74RzVihk9sRs95bY5W+oyjBUL/a3CSQTOaPkTrHB3YdsBmPLHZ48cEGnn6o1FQfs/jvD6oes+szJVF23NnfdxkcBF/UBt4qkx9lwp7G1BJmfQqkg7WHQkpcw2nW80lrzEF0A9WUPSWGhjYRKreGACkuJ65pSfxN1zB2P4cCU437PbwGQKZTyFzRp0obrHw32swEGgAw12uHRMlhUa9wUn/PSGyQMFvOP01FGA9lEvQlexDq667ml+k4wW/0jVh1s8iE8rORsQvPSya9uExw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AM6PR03MB4085.eurprd03.prod.outlook.com (2603:10a6:20b:1b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Fri, 2 Sep 2022 21:58:11 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5566.019; Fri, 2 Sep 2022 21:58:11 +0000 From: Sean Anderson To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: Camelia Groza , Madalin Bucur , linux-kernel@vger.kernel.org (open list), linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Sean Anderson Subject: [PATCH net-next v5 11/14] net: dpaa: Use mac_dev variable in dpaa_netdev_init Date: Fri, 2 Sep 2022 17:57:33 -0400 Message-Id: <20220902215737.981341-12-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220902215737.981341-1-sean.anderson@seco.com> References: <20220902215737.981341-1-sean.anderson@seco.com> X-ClientProxiedBy: CH0PR03CA0315.namprd03.prod.outlook.com (2603:10b6:610:118::15) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7637fdd6-8897-4dbe-c2d5-08da8d2e3a05 X-MS-TrafficTypeDiagnostic: AM6PR03MB4085:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7W8frS5KKDfntFb6kXWBaMjpzDFGQZvsQzwR+XwpW4j1kEGTnbw2kZdhgnt5JxOycY+xVcsr2V841SQnnSonCFVLclGOeBM5bPDafxCy4brmYvxoNSomk3/PnTnBhEm80PIE8xLu5FQeJ1+7HPDCVaSwuN7MokALzt+xlXy1uot5YZcj1NzpO6y2e4Ye4y7LeTJCySk1FLH9OVjcbq/+Mj29Y74yLjrIpY05nIoXRNuJIusCtdGERHAvrANMkDSpVMj1JiMJN8ubcgk8AeQOlojCxLWRtHjAsXUkZ5EdH9s+zYqMrne6Tk0ijpIwI3P8NhOmAqPP/eOJyAqyfvdFJ9tmBqdY/w83ad8pvY/UUcGZOsU7XnCfNMlK2bhugnYbHk5A6qFSTxhQ3Y2DY1idPvVJKqGvZrSbwgteiiq67iQVDkQhmWKMFS5qC+M3ir6TBa4Zel5jv70iZnDCGCy/DQVngmZasP0pEB9QNm7VD1JEtSP6hMOBnJJvEmMotMlV9Gy6LXBTGk0mxfB7l3VHpSkBBEI4QyY19WzUPMvOEAQIR06Iyuz6MLLdx3hMgNMuhc2+FzBdIumU1e7DYf8cXfreOWqG5BzaEiFl0Pg1TE6JKev4JAn8kdwvMt6pqWtZoW5lSvN9s4bn7pglQ4FFlHdpJy49bIvilWYHa701h2eXeTiosYmj0BI/n2odR0TVB2+L96Nd21IRvRG5gOJzJpNevh/gBbZf2iF5YeiXxbQv52c7A+8uAlkw4UTVdS5OeMzujK3QSTUJwMvpcBv6qg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(136003)(346002)(376002)(396003)(366004)(6506007)(6512007)(26005)(2616005)(186003)(1076003)(7416002)(44832011)(52116002)(8936002)(5660300002)(86362001)(6486002)(41300700001)(6666004)(107886003)(478600001)(83380400001)(36756003)(2906002)(4326008)(8676002)(110136005)(316002)(38350700002)(38100700002)(66476007)(54906003)(66946007)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: B30O6cme8wh9glCT3CZgZMgv7BuZu7gO+Y57x9qZJD8chVFJeYrWICXeQVnKEMQMVZBjzhWig0rqCam/HKuy6VLvJbLLSBCvpQhujLr2JKs7Qns25FNEIDwqhThHUCajz+iBBB5l+yRizTxJ23q0oo0uNYx8tuiYEYG3e0CVChNshD+zIFbk25qShUZ7c0T7cbkLt+VcVTE7t2QwECNslxjpSTmiHezYY9TKLDd19Uhw2RYMLxJW4lSkvUwSLm1vTRMDC39boECxeVJhuP7/rZN83L+BPB7qSWPLXeQLvoIZ3KE9wRUn9Ieschn7hN1v2RZgNvnY4MqZSSDlO5PxXOOY7VhLLi7NSn9x/nYTaB/hLz7X+3GYg1qWeRGa0n9qeSFMRddmDcOanNMdhv31pGmImjQGVNNJn5tg7gb94lOim8RiRaEWbsmq379eBLmaYheMxubz412J83F7JPA4ryII1wCvTbKgKI+MlLb2ac7wi435hjyWdjLfjpkhz3DslVCgAk1RqTHoaor/xvSV5V7EZMCQAtM0VYrLuMxuTb5VEiaX8MzCB7Yp5f3u1NU17ViIphjuQAWge8WGsvg66sG34mMMHChhnqNbcFmVhH+ic03TGIMCuhZ0Hf0EXK+UJt/diuXzrr4He2Si7NDyWgDyHdptBXeboPunAZQtsSa1zpL1WCfw8I/pm9jUzV+Zj/U1AwInBeFZLxlsHcCYde0miskP84dmVewa3045kNb0XyDvFbR9x0TL33jTAR+VgI7TO391+BClgZMsO0v9/7B1tmiF0AnmFmj0kRhiNhftP5fmV7MnkE++7RQfUwXmGp/AcB0pPna+Q/gnWUIeRdwq/YjI0lo7Nf6QaLdHPF99wPEx+znYtGOgFEpLMugzVWQAzrX9ZjQzGMY7kGnG4BlZiB1dCft+gfj/duL3zTHKZsJlr/obIjF1b59dRAuFBxshFoCENSAgeIDpBcyvu54QNFGfpK7rp84/eQL7jdC9DJhVDhRhFhfOqzXI++fTL05Io2HObeMBm6wKtx2gwHhZqYpuLByvZoBSqwWHq03O3U8qkkJfeMW5T+8JEyz1XbwvGclvONUxr79Ugponamc+tTJ9Z/SHAP3YI9VPxplyVC6LyZhQSwsgbKtDgO2CNo9h4CZiNui/IMYN2qypMHQZN+CmDGmKFFV/iKxOk7gf/l5YgUWvz9MmOuKTJH3yHuQpTX0NjKTlamPeyu8qOcaxTuxT6Is39ERTXCRxfDvwnBFU3k67KyDNspszPWSZ9GGBkJHen47hQOjgn5Kf0F+0oBPsukymLF/FRR7bHp5snc40ELgFgpbp3YflmKJOAfhJ9gdDvLGPbCA38jnTIZ73lMHVUsmgIRgHLcs3m/PYh5NaStVMyz3g2Zvfei/B0E4bpOcGaVqk5t3z/RZxI+12lBvY5C8U4RK0cWVjok4q13/pWA4AtQ77b723FbX68g+wlfSilhgL5Kty6HpVNVjuzaK5TwLqOKdUgIl2ZTInbb0KymtyEmrFXla8HRyuePFQCSu9mew723Zk8j/QPEeJXkcIk6jNc2zmX60ovONRKbxMGI1hhPYmE1JdQ6W6havjMglrOOyAfh5UaGejbQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7637fdd6-8897-4dbe-c2d5-08da8d2e3a05 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2022 21:58:10.9689 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: KMRb7fQiRw1u1LY4sLsJ42bHslO5HttgY/OpZHzvCA2OQhz7LBwKYBLb6QFeGnprq9VkAcjXfCjxI8HLYg4U2w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB4085 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org There are several references to mac_dev in dpaa_netdev_init. Make things a bit more concise by adding a local variable for it. Signed-off-by: Sean Anderson Acked-by: Camelia Groza --- (no changes since v4) Changes in v4: - Use mac_dev for calling change_addr drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index d378247a6d0c..7df3bf5a9c03 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -203,6 +203,7 @@ static int dpaa_netdev_init(struct net_device *net_dev, { struct dpaa_priv *priv = netdev_priv(net_dev); struct device *dev = net_dev->dev.parent; + struct mac_device *mac_dev = priv->mac_dev; struct dpaa_percpu_priv *percpu_priv; const u8 *mac_addr; int i, err; @@ -216,10 +217,10 @@ static int dpaa_netdev_init(struct net_device *net_dev, } net_dev->netdev_ops = dpaa_ops; - mac_addr = priv->mac_dev->addr; + mac_addr = mac_dev->addr; - net_dev->mem_start = (unsigned long)priv->mac_dev->vaddr; - net_dev->mem_end = (unsigned long)priv->mac_dev->vaddr_end; + net_dev->mem_start = (unsigned long)mac_dev->vaddr; + net_dev->mem_end = (unsigned long)mac_dev->vaddr_end; net_dev->min_mtu = ETH_MIN_MTU; net_dev->max_mtu = dpaa_get_max_mtu(); @@ -246,7 +247,7 @@ static int dpaa_netdev_init(struct net_device *net_dev, eth_hw_addr_set(net_dev, mac_addr); } else { eth_hw_addr_random(net_dev); - err = priv->mac_dev->change_addr(priv->mac_dev->fman_mac, + err = mac_dev->change_addr(mac_dev->fman_mac, (const enet_addr_t *)net_dev->dev_addr); if (err) { dev_err(dev, "Failed to set random MAC address\n"); From patchwork Fri Sep 2 21:57:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12964739 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 90B27C6FA82 for ; Fri, 2 Sep 2022 22:00:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230398AbiIBWAn (ORCPT ); Fri, 2 Sep 2022 18:00:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231156AbiIBV6s (ORCPT ); Fri, 2 Sep 2022 17:58:48 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150043.outbound.protection.outlook.com [40.107.15.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 671EBF7B07; Fri, 2 Sep 2022 14:58:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MYZqSlucoq9Jm5SGhHaL9ZFeOFmgRXGLZBfUhJTOoHuYf1EB4py9wp1VFGYMkBIrrcEnrQeajNrE846J6gTSo3F4RDkxYIGQYNPquLTN6dpVQuUubCrCrDGRwHQ/+8X8wfqnMVlNfDZFcV/aqmB31+eNCOhq/W4IfltgJQHM9h7DpxZPrhkpR+6GgwTASSOwvxBUIXXmbWENPika0s8H3tyiV3XZWyNuj30xxTpJL8h0mfjvpzc3jjqjWmEDRoC/SupiMdVTUPfYb86yDAejK/vJsE7LcYDGaiteC5XjPgNyBOWsGQqbFmECL75MwOfYhsLNdttaYvyQOaGMbcpIcg== 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=N0iVIpavMKo9hh8B6pZsnQSMzDiNhLM+JGQPoO6Zp1c=; b=gup+O3CBr+q8PEOrtKj0huFm7XlCpig+IMa0gsn+7ND5yZ4Wza7Uw4JNinQ8k+5f8KABEpdkNuIQtCf3gbk4zxCO3D0e9GDTldEWXS5JTC9EFkYLomooI5FM4C+oU/fLKOA7IzUtSL1LTOnuvTRlIGEPX+FZ4nunzyVWlmX+ffu9B4O6kixpjIkyZ66LMZikTMxr5ErfpszFNpJmX20DnnoGFv4gIm+L5gmn/sXt1/rAIe/EnzKPEZpB4liSJtsIC4ji8jtH4xaE1pjWuCQtVvhWJrASMgVmu+DMBXegSlKpUjsqBz+YR1bCFPK6XEN7Ihf/Kagtegl8zfyfF1LYkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N0iVIpavMKo9hh8B6pZsnQSMzDiNhLM+JGQPoO6Zp1c=; b=tgk4qz4EFSm5+1CWfPudS1Ih/c1GdPH5ga33fLgS4Fhx4bRmHVunZIRNeIBRJUUxvV4swLmAr5OfVZzDH28wd8PMW5NsT0S6qY7XKlhNISat+oekvida2GnNIalbXYFfMlUv3xlHb/2oU0qCB0hZ2AvCrwiMSFZCQf40WZ2MVk0Md8LOhBhBXO1qJmT/hW7Kx4DCQdfzK0x2uaiHpH8YJDaNkZp9ZTvJk9OyFqPK4042Yu6MUU8ksS1q+/ERo4hi6LwZLHjhLIypfz2sPiyznwscXclAcbuOWudVZSUXJVsbafn12cieZEdIBE3/42X+peKCh5RlmaJDxQnawc2H2A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AM6PR03MB4085.eurprd03.prod.outlook.com (2603:10a6:20b:1b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Fri, 2 Sep 2022 21:58:13 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5566.019; Fri, 2 Sep 2022 21:58:12 +0000 From: Sean Anderson To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: Camelia Groza , Madalin Bucur , linux-kernel@vger.kernel.org (open list), linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Sean Anderson , Li Yang Subject: [PATCH net-next v5 12/14] soc: fsl: qbman: Add helper for sanity checking cgr ops Date: Fri, 2 Sep 2022 17:57:34 -0400 Message-Id: <20220902215737.981341-13-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220902215737.981341-1-sean.anderson@seco.com> References: <20220902215737.981341-1-sean.anderson@seco.com> X-ClientProxiedBy: CH0PR03CA0315.namprd03.prod.outlook.com (2603:10b6:610:118::15) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fc088082-cdfd-41ed-8854-08da8d2e3b34 X-MS-TrafficTypeDiagnostic: AM6PR03MB4085:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0yAMrzV+6IeZzeIn7a0jg+LEf4GDglNIK6+AyvvUBcmGgo5RHRuI2+tPiol/542M19cjZIkKm9fRHPeJVy38begBG8rQIj642bwh9kVeY872ssGp+wox9L9k2EBzrOKARXNTBVdXPNaUWGf+wVBoIQYB6nlwM0qlT4xTkK9lsrxfc8T/Atw3dwhlhfq5YUo+N4tlO2zndRFPs3WWUalpM24pdM/LaXagg+Dm5GoPR2JlQsu/7gpFP/zUbNNscKNsfUQJxlwH4O/1yNxKdRPFrcuR95k5U5HLqpmoUUxBAtZM/gldbVCqCk34XylA/yedwz/Td48TwWgd5Su0sKRqjDWJim8frv13dZZ3xpkk/SXOMwV6NswGH93/bOWW35k5w9GaXYZSAS4e/vFlIt3qcaBcWO9CGUz2JKzcRd8ACrtksAYFs4LsmkP0K3yvfnpr4+IMkKOe3FjqzCD0aPcSvNQOE2/7x2r2z8CbwGN9IzsyIfJX6LqS/R2XNJWTvONwAndcYIzEaVjS4WU+VJqH3xandAKY214RBz45+hA+QHbvkNHhedv7b6F7k6SYhy8RZZ8YiB3IM4BbjnZeKSRsnLgJkYLislriyTyHYreTqeRImgFk4RYifXH3DdVmFka21DnJWV5/gX0G0qdDcVrvoj7iLkxWtOYWUhN2NxpGBSRXnZkRFFLPMaKV/mx1DGgBqeXwa+1deq1dibdt0er73/tay1PzYp0PwznvAmVzjcHDS3rNru/nBOylU9Wk10C84SflWOxmVq6f7/w7IZYj6A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(136003)(346002)(376002)(396003)(366004)(6506007)(6512007)(26005)(2616005)(186003)(1076003)(7416002)(44832011)(52116002)(8936002)(5660300002)(86362001)(6486002)(41300700001)(6666004)(478600001)(83380400001)(36756003)(2906002)(4326008)(8676002)(110136005)(316002)(38350700002)(38100700002)(66476007)(54906003)(66946007)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qx3dM7Iq/CMosLRqUMiZ+0zJx/qKki4my0zPF1ZwVJ491vhubF+M5Thg3QiyRmXKi8Su8LP4CV69jmG9Zm7vnZCV42AOEbgkhhTfq8bjiwoaPkZPqhnEQa6BZajKcqm/K7rPiuvgFwPKy5+I8nSz26Un7UhDVskXEeG/2v4uHsuxNm2+FucVBclCDZaqgJEngEfUGO+hnubXyWx0hLw98zr7onfWsDHttLGv09lDNrkBhuO/HoSx+wuHsdM94riK+BoaKtK8FyBIPtQ9EzRk7lNbPrdo1OyQXJJ74u8+HRtJrDgKq7FrP8wIP/LQkQa/xeQ3N1c9+hUAXN/8kEDU3ekN0ddgnKCiGsHZVw1i/cCsIIBLJnSCFXG/bRz7i1Z3yJ245DNoPCCEDFINBKLtUIYpzXjCuYw0iIjxHeaQRDxaBFOtyT4bjNF5G6wlrkLkFd+AN3dsJX7TYTyVW6O8eMj7nmhwasilIQU82PY5Oj4RsDWiQa+6KdCT5R41vmPt0Uz2O7Srk93M+VLclGpWtKjvZ5QGBkJli91x1PcKE6kokE7rQn7WZaD/PhT8CNJ+NZeutujSLhB4YoNp+Wv6H5MJ0rQCTjhJ6rWF4GkD0m+k0LG9DMsqdGWjNIhMHU5rD8Z+sRIQqkB2M2nObg+CZY+TKX3e1nzMOtJfRH9mqucJZhskgD+/2UQ55Mf2eCJerDzeCGpPfmTYvnWjr8UgF7VRgbF6E/v2MWh9fklCfEiIl8Umxwrz4DKDEEKzzYWgOFyZgVTe330a2en+/+uatwoOfYj37sB98Em8EwiWU3J4OMtwz72KZcdb5YkwFOzC4xIIR0mHhxV5qjOnCbPq4L6ZOUtaYAvhkSkZx9RJE53XeZHfyqEf6aA6Li21lnHA8nXRw22V5t7s1okPIvHMSrQnImqxwV9SCtnub+KAFpNVJdhk2eDYXBx6Fwr+TLp76aAIrzBfl2AFBfUcyYN8WhD3t6sgHfxHxJ95mTW0CjELQ9p14EPauxaIxpvlFrT21P6EMUv9+nh2EGtogLFqRa+HLELmlDz4snV7fHU/FAU+yzv8vANZTZgOfv1n92OJuIQUnj7s2OU1MVmCcGNzU9GHv9r1Ga1NGAiUGjMpu9wzvKdhwrnziCbJE/vca6xpdgagYdjUbLcoZQTRYFYGNTB0Mvf85zlgSCZubLqla9tCtHiGpgEWAot4yCpTha/PWPTzNrsM+YFabgGO38jSBwIM5G91CgXzC1IZiQLBOFPA8TWsKHug6DsEYVTRDZ3kdDZNUZSp4dqkriEfk0RqP10sASJS3Lye2bKdF4F0ZWxOucPXTilb+mdmul7P8VG4aV7jxMDo/pK9R+uc4wlCLgHESse6n6hRawYdVjEs7fs8NY4rSFUhRVdK97y9Ex86OSTZbvqWTQX4PgPGvsn2exDJSaBtHA2mSb7IajEXqV6g2K6QqQBWA2s+DFm07YlCB4aIBScejJD1C7y6m8a6n+KjK93GQ/SIeGAGuGKZFp50vJlAgvfD6uECrMsi5IfN4LsnXVhEi4K64fLGdWX1R427TX3wXcGGC2DF8yy3ssReD3OfHNxJyVCAv5RrRPbMmwUNQ/zmSGhz+R7DWYt3MQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc088082-cdfd-41ed-8854-08da8d2e3b34 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2022 21:58:12.8750 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: L+dXAU2qJbYXseDxrsviVP3U+SvGyeWC/whveBvReNK9/UzREwlGa3y3WeumdnI7BccRWVrVS7glLQbdfdt4SQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB4085 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This breaks out/combines get_affine_portal and the cgr sanity check in preparation for the next commit. No functional change intended. Signed-off-by: Sean Anderson Acked-by: Camelia Groza --- (no changes since v2) Changes in v2: - New drivers/soc/fsl/qbman/qman.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c index fde4edd83c14..eb6600aab09b 100644 --- a/drivers/soc/fsl/qbman/qman.c +++ b/drivers/soc/fsl/qbman/qman.c @@ -2483,13 +2483,8 @@ int qman_create_cgr(struct qman_cgr *cgr, u32 flags, } EXPORT_SYMBOL(qman_create_cgr); -int qman_delete_cgr(struct qman_cgr *cgr) +static struct qman_portal *qman_cgr_get_affine_portal(struct qman_cgr *cgr) { - unsigned long irqflags; - struct qm_mcr_querycgr cgr_state; - struct qm_mcc_initcgr local_opts; - int ret = 0; - struct qman_cgr *i; struct qman_portal *p = get_affine_portal(); if (cgr->chan != p->config->channel) { @@ -2497,10 +2492,25 @@ int qman_delete_cgr(struct qman_cgr *cgr) dev_err(p->config->dev, "CGR not owned by current portal"); dev_dbg(p->config->dev, " create 0x%x, delete 0x%x\n", cgr->chan, p->config->channel); - - ret = -EINVAL; - goto put_portal; + put_affine_portal(); + return NULL; } + + return p; +} + +int qman_delete_cgr(struct qman_cgr *cgr) +{ + unsigned long irqflags; + struct qm_mcr_querycgr cgr_state; + struct qm_mcc_initcgr local_opts; + int ret = 0; + struct qman_cgr *i; + struct qman_portal *p = qman_cgr_get_affine_portal(cgr); + + if (!p) + return -EINVAL; + memset(&local_opts, 0, sizeof(struct qm_mcc_initcgr)); spin_lock_irqsave(&p->cgr_lock, irqflags); list_del(&cgr->node); @@ -2528,7 +2538,6 @@ int qman_delete_cgr(struct qman_cgr *cgr) list_add(&cgr->node, &p->cgr_cbs); release_lock: spin_unlock_irqrestore(&p->cgr_lock, irqflags); -put_portal: put_affine_portal(); return ret; } From patchwork Fri Sep 2 21:57:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12964740 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 B68F0ECAAA1 for ; Fri, 2 Sep 2022 22:00:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231509AbiIBWAp (ORCPT ); Fri, 2 Sep 2022 18:00:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231204AbiIBV6s (ORCPT ); Fri, 2 Sep 2022 17:58:48 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150079.outbound.protection.outlook.com [40.107.15.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2625CF824B; Fri, 2 Sep 2022 14:58:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HacGdyYWBxZQ1OAEFThn5jlRqd6PiUJ1g3riSTBIZ+OJgsMQQe5ACN7pI+GokmLuuYpbF3VySiVH/TEal+cOqMQMR6hooWnGj4d4egZzKU/DkyJq1Q1vMEJYj/EhPoVd+kbFFpqtWjj07HZwrUFYq10xA6icTV/YWpb6fJVihrZgHMXxctAdZY043lPoCK16AG44ssIHQVRNJ7mPTYuV/pPs8FyD4YwnpUHKg3ccBHebaM9a5kHcVjw6uy5GukmxBhDF2TP6eL4pJqB1YDM8bfPr9VZx4jUe2X8NIuXWXLNutZobSLXeA40LJ/tkSN0nQxKwaWRZxDKOLnWrOtHMCQ== 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=9Vl+X+CzEIoTOyrwUa6t9RkbFIR1sPkScboy4MAV6lQ=; b=dYCgeCS4EVgDhESjtDfjZkNK5b3E1RH8wrB+czoYr3/XhtOuKJUwq6MuvhT/zL9Spw9WhNuELzmfQujznnVvUxsTg5O9J0Co6mOMA11l23OIG+iDpGiuOxtgRwvgwAn6f0PMHRDAt5+ULKMomZVyxXsGy+w9RJ6IlZojgqiDITy3JrKteUlOad1ZA4ghY9fqjYuLcGTKpRXW1HDTFfG5EmOspAFUWsDIEtK96imvwWp9iVnwVDobPFTu/RfL19AA4c0p/wUwBve5bd30IOI5/RMIUlxiCVElmsHrUcHudhw+EUIuVp+7ZnmzBAbJ+6ydi357fBmfqfzYONzYIqkgVA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9Vl+X+CzEIoTOyrwUa6t9RkbFIR1sPkScboy4MAV6lQ=; b=vIoWbbikm7EHO6OpEfnhjjZ/PCc7UoqIY+gxK4T66ELBoC2LCFvKrqr6DPN2mfYxTvb2vYmkp7EZavizue83YqczvfKwn9Z6LB0AoIUtTHZ+/TrEy/jD2PQXjhNx/OluzUUazEcV8To5UqFd5nMGBxc+nlpPfdv/n8VjZH6jBGvB7h2c0+9PZBuqOcCmDWG8wVubbaREYzU49U4LrSOayTARPVr9Whq1GU8iN2AW+nHprS+iQtR9XuFrrn+BtdbtXE+S9AyHCoTptGW3vB9Llb/hCMb4pZr/abcqIkwW/EEfjPjXESP3An1Y8YvpzYaulBoepkFaW7pKIk9WE6xDHQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AM6PR03MB4085.eurprd03.prod.outlook.com (2603:10a6:20b:1b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Fri, 2 Sep 2022 21:58:15 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5566.019; Fri, 2 Sep 2022 21:58:14 +0000 From: Sean Anderson To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: Camelia Groza , Madalin Bucur , linux-kernel@vger.kernel.org (open list), linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Sean Anderson , Li Yang Subject: [PATCH net-next v5 13/14] soc: fsl: qbman: Add CGR update function Date: Fri, 2 Sep 2022 17:57:35 -0400 Message-Id: <20220902215737.981341-14-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220902215737.981341-1-sean.anderson@seco.com> References: <20220902215737.981341-1-sean.anderson@seco.com> X-ClientProxiedBy: CH0PR03CA0315.namprd03.prod.outlook.com (2603:10b6:610:118::15) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 12644857-848b-4794-eb96-08da8d2e3c60 X-MS-TrafficTypeDiagnostic: AM6PR03MB4085:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dOsuvnyi3F6l02JXJFoAaOsqqxLw6WTPYnZ2RiZs6KK9/PWt56wlu4pSiImP6jockSYdokpjjWMusOxb3rwo9fbTQwh5nwEvEWNStKYlEdkPju5HeBeLi5/vPZMbiiuFFvmCaUtoVxTygDDl7PVWhZ2emLxGI4G8FXZi7YMqW3A2M2/zvRJzzIXpGKZa63lGC/9zzCHHR/nmfL9RisR7mKPG8fCchThvkiHxvWafL0/FECeswIJ5sExp0ND+L7LZY8KWvwyuTIiZ1nlQBKMo1KJc55hbgNASRqWEHlA8gaD4a48DPSEljBDGaN4Qq3nRtEXvHU+exSoKE+f70lA7NjHN0YXrXbWqknCtDIM4TzakVLZR4j8QAl4XGZVuLjAfYvEmF7ShXLgzfYmddUIO60C6yyMd5zmW37Y336qJlZVu3rAFGeJivHtFessk9R3WgLldWbqCgSWxNlpTJmpnGfLfbaQR3eLJP3JnB4oso3nKtjlEqKObyz5/NBR9jxu9/pjQzMcHHUq+ZoTOKZARoCd+xR9mO/plzTfO3Sq2sfF84vI4JxaZQql0zlw1ZqHkC2wUp529hrAYWv6HATO5PA7903PWBuqSkoTAmSiJmMlAAySTbP+tfATm/ln5gO7E0dAu36RVQ+BTH/l7QkJvaegn4EQW8W/qH+y7DB2TloIDBvL3QQidlne92lRcVRO34B1MwJq1IFB9GEsKgoerlBw1WtDIjjjiRqKpYFmP/rzU+X95GEh/UAiBB1GMhvhRRM6omSW+lJgetHqWFIgFnA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(136003)(346002)(376002)(396003)(366004)(6506007)(6512007)(26005)(2616005)(186003)(1076003)(7416002)(44832011)(52116002)(8936002)(5660300002)(86362001)(6486002)(41300700001)(6666004)(478600001)(83380400001)(36756003)(2906002)(4326008)(8676002)(110136005)(316002)(15650500001)(38350700002)(38100700002)(66476007)(54906003)(66946007)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WiAwCs3/CdXhQhLDwRb3yqIBDU2QHAb3x9/cdljyPCzqnHbOY+xDv7gcVpjLFAvomKeTPsNndBON+I+v8ML8hw4XdHqrykBvvIB7G/nV99Ri26gGBjJ7fL/YYLCoozpKBqgJwdSBTQ+3rbhqWcQC8ZNLx/QcHPYfJL12K0CTp0bqMSekeXsaCJt/Evk/aySUew6iVzDJ8F8T9T6r4HNsGF1yfx9O5f+HRpCvuv78dukiJCq5PFTEiIRzoPzgYULSxoO1lcVY/jYwO0gZVyHLPjF9eMwhHxdrQuRatPISF/o8QeGhIp0GRsDG4t1hdthqLgAoIKp+VZdHLGPmJnRfoaUcxZMiHLm5nZOEBe34ufJ9YhHG3zjEPfpA3oJE95KPDujlGeWKGstOW+ut0nbBFoaxdro9VY2wcpzIh2dgC4+D3Slhfw5PxYyAkqm1U+CQq4ZWDyDWGXWWw0t/s9L36azy/kXOFYdpHVQPzYs4JgrKYrxuY88b3anBtNpHgWLBrqEBOFFbmYrsqz82uRoOkxEAO/SCAWVfqXsA8Kda7G2xEDE3xzZxpO/vgpwRZu6YY/xGMKCMjXBfpszYY0w4o3dh77xBsQPYpYL6WqPB/n7xXfCOL6ZXRVyq/jg1XqWw6fsIvhJT58ut8ljsW28mzeqWxel/8700TwXzuTqpa/BO1GysIz7WryPr2R+wPsvRhPqUFuyFO9Say/Y/oB9RfYPcb1x/Jagt/29fn3nWTzBuOcjQ1R6Sm8LGp0w0cBUONUSRvVSi0VWJqofulStSeDkrHueYRi9WTtgwOh+JRAJyMGbrH9FkRX+VEsvT8RoKEeWG0js1/MzOtNRpkNws5TWLeBVBEQwn/K3cWdxQmJNZjANmnEvS8OWxtdIfIfjXwXYmmoUfjduMMSr2GceZd9fLYCp0ygUTzDUtV1lnw/WtrtDxY01m0+aS+Z6Js+I8yujd7yen9bumEvz72oA2T3S8wzyVefW/0A2fE/3bHTvldHrcEGRRnAS+aLNDenEUtu0HNGiTRRpD/sTKkZKUKViR41orvw2k3/00rduZ9CjGwHfZq+xj/B2GN+i3pdudM82zG/rhndMfJcBmbEcWN67mUM2qe5DN9dJp/c2vdUVi2XzLS+pSMAn3DD3mazLZAljjBggyzDRLGUvYRw7aZPjLSumRZNOh9JOw/4qniDL/H0urVgNSRQT9BUVbPOeZUaRa6c6FWuFTYpP2JRxqDteQNVmoff8D/0ZEj285669cjTHHgQdXUCzduhsTouitg6ScMJTYbbAdW4+mUqiqBH5OcPLzRW4/GcJF4BT91NGMr9t7B66UtR+wwZLhmwCombNv+MVL/yK96M25CRhs8Fb6GLFE8RLLjVnbaiPGHQzT/84Br/r/OGTL3iEsoUTYhNICp5urI2Qx+Gvx5qUNW4bN0JTop34eaZpU9boud0UtuamC9fJo7GiYSmfNRcJxg+RyAjErE0irygieB08hcprPAu6Ur37YXNv0+geXHoKKi814jrsFCW8dt/9ZicPUfyNOOxSaWkTLXwPTtW/ywQKZrUgUiJ5VpE8h3p7jCHxxejNOAirAdCBQS5TrWidxuUs/a39fomgVzUef0RMoeQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 12644857-848b-4794-eb96-08da8d2e3c60 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2022 21:58:14.9061 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7ZsIj4A/v5oSIcqaRhQU0BFcHbF+YFSqs9RKpPrekUWGT3vK2cgpz2Uyd6GnhbLUdplwHgbyb1K5PEWCxtdFjA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB4085 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This adds a function to update a CGR with new parameters. qman_create_cgr can almost be used for this (with flags=0), but it's not suitable because it also registers the callback function. The _safe variant was modeled off of qman_cgr_delete_safe. However, we handle multiple arguments and a return value. Signed-off-by: Sean Anderson Acked-by: Camelia Groza --- Changes in v5: - Reduce line length of qman_update_cgr_safe Changes in v4: - qman_cgr_create -> qman_create_cgr Changes in v2: - New drivers/soc/fsl/qbman/qman.c | 48 ++++++++++++++++++++++++++++++++++++ include/soc/fsl/qman.h | 9 +++++++ 2 files changed, 57 insertions(+) diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c index eb6600aab09b..739e4eee6b75 100644 --- a/drivers/soc/fsl/qbman/qman.c +++ b/drivers/soc/fsl/qbman/qman.c @@ -2568,6 +2568,54 @@ void qman_delete_cgr_safe(struct qman_cgr *cgr) } EXPORT_SYMBOL(qman_delete_cgr_safe); +static int qman_update_cgr(struct qman_cgr *cgr, struct qm_mcc_initcgr *opts) +{ + int ret; + unsigned long irqflags; + struct qman_portal *p = qman_cgr_get_affine_portal(cgr); + + if (!p) + return -EINVAL; + + spin_lock_irqsave(&p->cgr_lock, irqflags); + ret = qm_modify_cgr(cgr, 0, opts); + spin_unlock_irqrestore(&p->cgr_lock, irqflags); + put_affine_portal(); + return ret; +} + +struct update_cgr_params { + struct qman_cgr *cgr; + struct qm_mcc_initcgr *opts; + int ret; +}; + +static void qman_update_cgr_smp_call(void *p) +{ + struct update_cgr_params *params = p; + + params->ret = qman_update_cgr(params->cgr, params->opts); +} + +int qman_update_cgr_safe(struct qman_cgr *cgr, struct qm_mcc_initcgr *opts) +{ + struct update_cgr_params params = { + .cgr = cgr, + .opts = opts, + }; + + preempt_disable(); + if (qman_cgr_cpus[cgr->cgrid] != smp_processor_id()) + smp_call_function_single(qman_cgr_cpus[cgr->cgrid], + qman_update_cgr_smp_call, ¶ms, + true); + else + params.ret = qman_update_cgr(cgr, opts); + preempt_enable(); + return params.ret; +} +EXPORT_SYMBOL(qman_update_cgr_safe); + /* Cleanup FQs */ static int _qm_mr_consume_and_match_verb(struct qm_portal *p, int v) diff --git a/include/soc/fsl/qman.h b/include/soc/fsl/qman.h index 59eeba31c192..0d3d6beb7fdb 100644 --- a/include/soc/fsl/qman.h +++ b/include/soc/fsl/qman.h @@ -1171,6 +1171,15 @@ int qman_delete_cgr(struct qman_cgr *cgr); */ void qman_delete_cgr_safe(struct qman_cgr *cgr); +/** + * qman_update_cgr_safe - Modifies a congestion group object from any CPU + * @cgr: the 'cgr' object to modify + * @opts: state of the CGR settings + * + * This will select the proper CPU and modify the CGR settings. + */ +int qman_update_cgr_safe(struct qman_cgr *cgr, struct qm_mcc_initcgr *opts); + /** * qman_query_cgr_congested - Queries CGR's congestion status * @cgr: the 'cgr' object to query From patchwork Fri Sep 2 21:57:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12964741 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 0E1E9C6FA82 for ; Fri, 2 Sep 2022 22:00:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231322AbiIBWAr (ORCPT ); Fri, 2 Sep 2022 18:00:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230362AbiIBV6t (ORCPT ); Fri, 2 Sep 2022 17:58:49 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150043.outbound.protection.outlook.com [40.107.15.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EC8AF8FC9; Fri, 2 Sep 2022 14:58:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F/eLsUySn4DKb81kjj6oYn0LBzqBM45yhCNiBbvCuBouYeSA4QYE6CUs2Yax3/6lW9kBm+Jx2VL5S2X/jf8EOht37f8P41DciTJnivDiY/aYpvmgunJWHG41YoF7qPQ0Tkrwz9jG5UPdmhmvpdcuTeoWMrGp6radaT6hGGKZgerVeunRNn8jQgfg4je1ca3EwWvxmMtCDv/FMvWy60G44t1pt7gh7KzFL5GMfJ8l69bnxN6iOMLqAqqctd19O5iv6gpHn8LLoJH43ucgqD5lalpbKlyDMvjM7ebubWIbMhoHrtUEjcm100c14uXopXTroYP52ZALGPyRirBoGlG/Vg== 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=Js0EvR9gWskrzROD7oa36jjDuLkIHJQDWDYqsS4YuN4=; b=NMYL17KLvXEJ3OYcAfkelAXsXlQ9aCmDWiH81/Mkp103TL49Zx8chj01cvB10MUEhQJ8ou+PzVIF4QPLuBtAsgmIAKO0OZbWryh5buvh4wECRhP1d0flhPIYc/lxQVa3XtgON1gy0KW2Flf8JWz2da6qFMdToKgHyAQvvH9bJvtxXcMgkfBk2E8PT35kFQBK2daBLPewQyN4cOUdc1oz6A07JVzyHASGDo5KYH0bXCogKHQerQ3hdJ8GqFnSRe7ziyi3sRV0WNB3GmXTsK0kmZCyBofPR0cBvGQqVS3WE6VPhNi0lfjVUE4qW+TlJ8zFS+MRFIWeinhYAn5onGsMeA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Js0EvR9gWskrzROD7oa36jjDuLkIHJQDWDYqsS4YuN4=; b=mqgTLPQbrA3rRiKuHhtKb//PF/doQIUmEDKMIsq8WEzEFVfhsJP43yg/dTWW1PrF5qXjqbwpxBa6gTiAeiHLOUtYOGDKXYV7B/CMzcpkiT/Lggzqa/zDPgMDw+QLuIwUzaM4HPN3SYm8A1SuXFz0T/g5R1qNM16AubEgsekiX0F2zyEcvMxttRuT9z5VW/3lExX97QHsRiCX2biNABeA3gAvpmq7xGDDvm+OJN0J1FkzwhWEq3fzmXobZzx3kEBDNu8TYD/s2jm3ZCgG0llNVt2pb+X5wdO+3g+IyU9VeWtPwLehYzhESakzuV0SdL91sduxA1OmKNPJWpN21gUE9g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AM6PR03MB4085.eurprd03.prod.outlook.com (2603:10a6:20b:1b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Fri, 2 Sep 2022 21:58:17 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5566.019; Fri, 2 Sep 2022 21:58:17 +0000 From: Sean Anderson To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: Camelia Groza , Madalin Bucur , linux-kernel@vger.kernel.org (open list), linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Sean Anderson , Li Yang Subject: [PATCH net-next v5 14/14] net: dpaa: Adjust queue depth on rate change Date: Fri, 2 Sep 2022 17:57:36 -0400 Message-Id: <20220902215737.981341-15-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220902215737.981341-1-sean.anderson@seco.com> References: <20220902215737.981341-1-sean.anderson@seco.com> X-ClientProxiedBy: CH0PR03CA0315.namprd03.prod.outlook.com (2603:10b6:610:118::15) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e7b8a825-7fb9-4b53-23f6-08da8d2e3dc4 X-MS-TrafficTypeDiagnostic: AM6PR03MB4085:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CEM6ooRWAFkBQPWG9IJbI7J7MEt5RljuKb5wTi7xRskSsX+8llgvIfuMWxojA4H5SNhrH8hXobgvY1t+bkBA67J2xWQTSAaXhUDp530CASAdwpaFi/zLAz5c30ZmIgMeWD5NaQ6E9mpLTBAyrWZRFSYs86xy2jFVnKhFwYYcYLllXBXwpz7Ipd2v44OMrfNfCXv/eUFAfxRC94YGie6jp4EZ9KASWYuoySipDe2yxVC5IDvB87lbeuq0Jo8JCNtixZLTi1Y1eA0Lc6cB52D8gBAu6sr+GEy19RdZV+LDEw9WYxNYe2qhzXBJhjVsZKi5MDdHyiLbBXXVv+Ov851Mk5FG9l3JQQnVi7r7bQHwOX4IdE/4PcpQ7RQKBAea0BP6zoceomIXv3GUwYJFxzEry03ABpYIyEpRTAkr2wsZl+DJr0eT+gbUfaH+WAQTXg0k4uLhG6QZasTYeC1esafPBtakLiZOHsmus1aIB0VkK7JCPq8C+HpAbt9CHWx3ZeXk+HG7LRaoVCNGVqBGaXc3ol5+02i25hhSLnbe4TRECUb2VOcsOZs+mevgwf1LzzHMjnvRsraESKnTXydlYszfpow1TVi8JLVQO/HDbvGIa8RDER7V0zuF0qj5STP/FGCqk9F6jLixcG7BEOzOSSxw9+gaKcigGtXB2XzhmuUO0ltdYcdB3j1E8hA56o7m8zR3iBq/kHbgLUxA9hUXrbofXI+vEuCW3uvTxpb2uW3kY8csu1uvI1nWQF6fvqNCAq4WizlmPKbcnGYKt6mHhUo1wg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(136003)(346002)(376002)(396003)(366004)(6506007)(6512007)(26005)(2616005)(186003)(1076003)(7416002)(44832011)(52116002)(8936002)(5660300002)(86362001)(6486002)(41300700001)(6666004)(478600001)(83380400001)(36756003)(2906002)(4326008)(8676002)(110136005)(316002)(38350700002)(38100700002)(66476007)(54906003)(66946007)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Bc35ShQ7F+7Id6Q3+58JnXI+TDMVssL0emFSojNmZ6yJuc5cTj0tho/tp6B8W+C5XjhQORKg/1N8cHRuImhA+wmHyLrlz974Ns94VnpSYWVmwnD5oW3zDWGi51kMZS1snPB+Vn3TpwGHEzYN0Ovef7gZyeQuBZDSg+ZlascrNLfvq4Jzzfq79uTWNPj9odQxyByvMTwnhSIifj4P4mJwpugVI6HT+skHtVCNf91zZPgv4Z/H7rX5gZ7yWFAEK6hjPvZuycMRLt/PEwpMyw5HfHqV/M7sDmim7YRR02ldM46qoGuG3WlTcigndCer/8sn28Jd8rViwEUO5i2TzdojKxw4Ah3zlmbd9SbK2+CNU5Ie4qEOPzINx0g6knoLZegh+cz6GIN/yGRG/Prn1XN/4UmbIQRLkAmkC6bbGvHV1WBdpYPmFEcmTAoBE+J0o24rThyOVEtFs2rLRiq/qF7f2JemCZGNGr/JchYRoaupvvS49/YVoAY5zIq3ZdIg+LTFSuLeP/F/GosCW7ai8DyJ+0fS9NDHwPCT8Rmp+g1IThDE8Gikqy+Q8dTXwgj791AaIk9NO+BpYHhx6H2B6LDRSDIr5noznyNYmHbNVEXobd7o7d6O3SIG9DyCd+280zC/2Fdhi6VRaaRIcyfirhDwrHI7ujCdrfFkiiwvsMgZ+URJR0GJmtz0lwWuzPOICOEH47aA0qSog0bQ6VQeOCW+jutZXfHmvNBECIMFhz7qsibOqIjptx8EjEPHS9nCkKpwRWbEw0lNhA3OO/cjnpErnekJcHa84YFTFWNBe1EK+lGAI/AOXzrviiJ2oBp+gNOSodMKMydI9s7nDFL/z7cOvGMsy2nIN4Lzgk3+xa30uzH/Tnw1SGt+2sOB7pnQHLsbQwsTpXus/vJ5FgE1Iu6gLa43og8Hjj28fIF49+IEnqjFfzHvj76Zy0JLoKRm3C8bQSyNuzaq54SxXmlZIaylt1e5p5Tn7EmB0viUph8iC5OT/mcKBufiUc0/K8jEagEoLjOzR97sEN6IyrpPG3wdebvxh937VhYgYVrLTmOCTRhY+4Pr+/qhhT8eOJisvW52PeDaBfT6+iF2+cdMF/9XGDqg86n6vGV9efF7JNLUcUk+wNdScRrDwvrSrSu/ngQJYtes5k29sVeXgpooJ75m7hHU+SIwmUZWXiF8pu8UcVGdk7MMiAI0muRw5q1WVWOJGxWYwV+/CcdTdMb80c3uLkUFud4EWXVDM9Om7dk2Wr5UMqyoc0DB8pbOnFbzL70084R4Lx5X9P9OcghAmyhgsVvLtsSmS6iTqOZ9mYiuiKo0vaBVEes1vPE1ncdMJoD6OgHHs7f79mM1t85cE2X5mDfRbs/ovapt2oAcPEExRrqEM6b8FHPK8HBFeTiTMHt7vCOZda5seO++Vxox1zSttLKYjbXj/52ImeQkkvhG34H1BhnwU2xyPdo8PxAKKA9uoe61P/nSsjHozHSoKbH2uy0BaQJrainnzL3Xqh4mUoPG0C1XPI6FtYhT5I6zGHyvclhidoFf9jnswK36HdK6T5SZOsC3gbCtW5KPQXmNSLwcoixweIh9KYfYl/SIyTtL06USk4GUDsKxXQfHBFhgNQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7b8a825-7fb9-4b53-23f6-08da8d2e3dc4 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2022 21:58:17.6247 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iHit+r+3Ez0kQZkt1Yxbcu9NOqChesgm1KcLofuvddS8UAQKbTDeoMXYbG4FovkkENnLuOi0qkKGyAi9GtGsJA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB4085 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Instead of setting the queue depth once during probe, adjust it on the fly whenever we configure the link. This is a bit unusal, since usually the DPAA driver calls into the FMAN driver, but here we do the opposite. We need to add a netdev to struct mac_device for this, but it will soon live in the phylink config. I haven't tested this extensively, but it doesn't seem to break anything. We could possibly optimize this a bit by keeping track of the last rate, but for now we just update every time. 10GEC probably doesn't need to call into this at all, but I've added it for consistency. Signed-off-by: Sean Anderson Acked-by: Camelia Groza --- (no changes since v2) Changes in v2: - New .../net/ethernet/freescale/dpaa/dpaa_eth.c | 38 +++++++++++++++++-- .../net/ethernet/freescale/fman/fman_dtsec.c | 1 + .../net/ethernet/freescale/fman/fman_memac.c | 1 + .../net/ethernet/freescale/fman/fman_tgec.c | 7 +++- drivers/net/ethernet/freescale/fman/mac.h | 3 ++ 5 files changed, 44 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 7df3bf5a9c03..0a180d17121c 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -197,6 +197,8 @@ static int dpaa_rx_extra_headroom; #define dpaa_get_max_mtu() \ (dpaa_max_frm - (VLAN_ETH_HLEN + ETH_FCS_LEN)) +static void dpaa_eth_cgr_set_speed(struct mac_device *mac_dev, int speed); + static int dpaa_netdev_init(struct net_device *net_dev, const struct net_device_ops *dpaa_ops, u16 tx_timeout) @@ -262,6 +264,9 @@ static int dpaa_netdev_init(struct net_device *net_dev, net_dev->needed_headroom = priv->tx_headroom; net_dev->watchdog_timeo = msecs_to_jiffies(tx_timeout); + mac_dev->net_dev = net_dev; + mac_dev->update_speed = dpaa_eth_cgr_set_speed; + /* start without the RUNNING flag, phylib controls it later */ netif_carrier_off(net_dev); @@ -826,10 +831,10 @@ static int dpaa_eth_cgr_init(struct dpaa_priv *priv) initcgr.we_mask = cpu_to_be16(QM_CGR_WE_CSCN_EN | QM_CGR_WE_CS_THRES); initcgr.cgr.cscn_en = QM_CGR_EN; - /* Set different thresholds based on the MAC speed. - * This may turn suboptimal if the MAC is reconfigured at a speed - * lower than its max, e.g. if a dTSEC later negotiates a 100Mbps link. - * In such cases, we ought to reconfigure the threshold, too. + /* Set different thresholds based on the configured MAC speed. + * This may turn suboptimal if the MAC is reconfigured at another + * speed, so MACs must call dpaa_eth_cgr_set_speed in their adjust_link + * callback. */ if (priv->mac_dev->if_support & SUPPORTED_10000baseT_Full) cs_th = DPAA_CS_THRESHOLD_10G; @@ -858,6 +863,31 @@ static int dpaa_eth_cgr_init(struct dpaa_priv *priv) return err; } +static void dpaa_eth_cgr_set_speed(struct mac_device *mac_dev, int speed) +{ + struct net_device *net_dev = mac_dev->net_dev; + struct dpaa_priv *priv = netdev_priv(net_dev); + struct qm_mcc_initcgr opts = { }; + u32 cs_th; + int err; + + opts.we_mask = cpu_to_be16(QM_CGR_WE_CS_THRES); + switch (speed) { + case SPEED_10000: + cs_th = DPAA_CS_THRESHOLD_10G; + break; + case SPEED_1000: + default: + cs_th = DPAA_CS_THRESHOLD_1G; + break; + } + qm_cgr_cs_thres_set64(&opts.cgr.cs_thres, cs_th, 1); + + err = qman_update_cgr_safe(&priv->cgr_data.cgr, &opts); + if (err) + netdev_err(net_dev, "could not update speed: %d\n", err); +} + static inline void dpaa_setup_ingress(const struct dpaa_priv *priv, struct dpaa_fq *fq, const struct qman_fq *template) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index f2dd07b714ea..6617932fd3fd 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -1244,6 +1244,7 @@ static void adjust_link_dtsec(struct mac_device *mac_dev) } dtsec_adjust_link(fman_mac, phy_dev->speed); + mac_dev->update_speed(mac_dev, phy_dev->speed); fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause); err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause); if (err < 0) diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index fc79abd1f204..32d26cf17843 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -782,6 +782,7 @@ static void adjust_link_memac(struct mac_device *mac_dev) fman_mac = mac_dev->fman_mac; memac_adjust_link(fman_mac, phy_dev->speed); + mac_dev->update_speed(mac_dev, phy_dev->speed); fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause); err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause); diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c index 1b60239d5fc7..5a4be54ad459 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c @@ -601,8 +601,11 @@ static int tgec_del_hash_mac_address(struct fman_mac *tgec, return 0; } -static void adjust_link_void(struct mac_device *mac_dev) +static void tgec_adjust_link(struct mac_device *mac_dev) { + struct phy_device *phy_dev = mac_dev->phy_dev; + + mac_dev->update_speed(mac_dev, phy_dev->speed); } static int tgec_set_exception(struct fman_mac *tgec, @@ -795,7 +798,7 @@ int tgec_initialization(struct mac_device *mac_dev, mac_dev->set_allmulti = tgec_set_allmulti; mac_dev->set_tstamp = tgec_set_tstamp; mac_dev->set_multi = fman_set_multi; - mac_dev->adjust_link = adjust_link_void; + mac_dev->adjust_link = tgec_adjust_link; mac_dev->enable = tgec_enable; mac_dev->disable = tgec_disable; diff --git a/drivers/net/ethernet/freescale/fman/mac.h b/drivers/net/ethernet/freescale/fman/mac.h index a55efcb7998c..b95d384271bd 100644 --- a/drivers/net/ethernet/freescale/fman/mac.h +++ b/drivers/net/ethernet/freescale/fman/mac.h @@ -28,6 +28,7 @@ struct mac_device { struct phy_device *phy_dev; phy_interface_t phy_if; struct device_node *phy_node; + struct net_device *net_dev; bool autoneg_pause; bool rx_pause_req; @@ -56,6 +57,8 @@ struct mac_device { int (*remove_hash_mac_addr)(struct fman_mac *mac_dev, enet_addr_t *eth_addr); + void (*update_speed)(struct mac_device *mac_dev, int speed); + struct fman_mac *fman_mac; struct mac_priv_s *priv; };