Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6668538rdb; Fri, 15 Dec 2023 05:23:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IHkHP2KVxNa//PEXLunqZbS76IkTFc6zMFZ9t2hjiIEOlzMgP4LWEAsv4V43jjIX+MLYHEM X-Received: by 2002:a50:c305:0:b0:552:d277:3c12 with SMTP id a5-20020a50c305000000b00552d2773c12mr413511edb.54.1702646596867; Fri, 15 Dec 2023 05:23:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702646596; cv=none; d=google.com; s=arc-20160816; b=sx1MsbQ1xNO2DWofjaG9uc8Z69hyCYpKbhR5a5IxVnMmObvAnt5LpwG3mD/X+5o9U3 p0uZu8F0qrhJzp7YwtvbihSGC/t1KrY2LyWktlFasB/aCkW34X2losGrA4P4Eaq+uQw1 kxtgGgzooWarkZhHs67F0TM/Gwhvpd1JOKLYD/CFIKE92An7IMPTN5/r+j3FMfgicRS7 GywrDaoKlL2T43VGVAzQzHnL1YNaSCLTDUTEHt6Z/+cBhP1orv+7sL74cHccGMUz9vI2 +N16/QenSJajO7zQ2mz9iz7yBTLlh/zI0rp78BYjo/d37HYc5jC6HNA+OIvieC864h4I VMaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=5mdLKwZ6JnGDgupRYRwzd2mmohgsXs7uhOLcNW+PAEc=; fh=atN1XXIEfyrYF91vXjukw10btm2OohYym78OPztZ9zU=; b=oelU1RRfsYW/f3Lqy5ddqazgLz59Wj0dH0Cp0wuFcyqg1VB7wt2kjTrB405vlRhWgs inWkq3X8IBVwp73IO6Jiaaq8PyaUE1vY6N2Feb4YgkHDWOMQSr27jAab0Ak/tkjxwXu6 guPTYpY2DxvfkbBtGskIM3z3Qc1CSWhAqYXnMnSWSTUeJjvtZs6zi9YQYSg0k8vEWPMk 1n6O21K36wPwxJVXWL0m9PhGwYtn3E8bQqURseI/N9UzRIpQ+Dv4JwYO2azmjDs4nZ4j l+g2efN0/nmNKA4KYgKYnNG/jkrLn+XtXPlXD0b8khJMOKAXpiHX3FVli7yOxOikwLxl EM/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CWtmemDO; spf=pass (google.com: domain of linux-kernel+bounces-1000-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1000-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id v11-20020a50d58b000000b0054ce168897esi7185134edi.410.2023.12.15.05.23.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 05:23:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1000-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CWtmemDO; spf=pass (google.com: domain of linux-kernel+bounces-1000-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1000-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6E5601F23764 for ; Fri, 15 Dec 2023 13:23:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 758F4315BB; Fri, 15 Dec 2023 13:21:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CWtmemDO" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9447C2DB8A; Fri, 15 Dec 2023 13:21:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74638C433C9; Fri, 15 Dec 2023 13:21:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702646479; bh=GTBpirpClrKgkhTJ1/mbtYxMkpaX4RCM1RUQDBtrBDM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CWtmemDO1TNO4PyKCoXa1jIAUmLBi4tHUUsyx1DIKYD7+MWhWA7k5R0jjCveQHd7n keyDfv2iqmLEDFwMsCawGRKvpJUAkfLtL54cDKtmNGDcLxecqvxywSdrif/4bxuxcu 1hLT5KQCl21M1MzYvHnRDORflReOiSlmDQRigTgq3s8iwtaDWDVAQ7U0n7IA6qsgfK WeLchmdBq0sGnseUaZPYG8FghmwOVxvLKBbvUQS4ihdlXByt0jij4tpp8qXJPaUCr+ THyK9v1/LqkpEttC1p2NgZjQ5B0L+ClhVj5aEXtipVYO/HOlUXHHb6fdvOeprxMpyM 7oDJG+gn1EPaw== From: Roger Quadros To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, shuah@kernel.org, vladimir.oltean@nxp.com Cc: s-vadapalli@ti.com, r-gunasekaran@ti.com, vigneshr@ti.com, srk@ti.com, horms@kernel.org, p-varis@ti.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, rogerq@kernel.org Subject: [PATCH net-next v9 06/10] net: ethernet: ti: am65-cpsw: Move code to avoid forward declaration Date: Fri, 15 Dec 2023 15:20:44 +0200 Message-Id: <20231215132048.43727-7-rogerq@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231215132048.43727-1-rogerq@kernel.org> References: <20231215132048.43727-1-rogerq@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Move this code around to avoid forward declaration. No functional change. Signed-off-by: Roger Quadros Reviewed-by: Vladimir Oltean --- drivers/net/ethernet/ti/am65-cpsw-qos.c | 86 ++++++++++++------------- 1 file changed, 43 insertions(+), 43 deletions(-) Changelog: v9: no code change. Added Reviewed-by tag. v8: no change v7: move am65_cpsw_qos_tx_rate_calc() v6: no change v5: no change v4: initial commit diff --git a/drivers/net/ethernet/ti/am65-cpsw-qos.c b/drivers/net/ethernet/ti/am65-cpsw-qos.c index 2c97fa05a852..862a98211caa 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-qos.c +++ b/drivers/net/ethernet/ti/am65-cpsw-qos.c @@ -56,6 +56,16 @@ enum timer_act { TACT_SKIP_PROG, /* just buffer can be updated */ }; +static u32 +am65_cpsw_qos_tx_rate_calc(u32 rate_mbps, unsigned long bus_freq) +{ + u32 ir; + + bus_freq /= 1000000; + ir = DIV_ROUND_UP(((u64)rate_mbps * 32768), bus_freq); + return ir; +} + static int am65_cpsw_port_est_enabled(struct am65_cpsw_port *port) { return port->qos.est_oper || port->qos.est_admin; @@ -772,49 +782,6 @@ static int am65_cpsw_qos_setup_tc_block(struct net_device *ndev, struct flow_blo port, port, true); } -int am65_cpsw_qos_ndo_setup_tc(struct net_device *ndev, enum tc_setup_type type, - void *type_data) -{ - switch (type) { - case TC_QUERY_CAPS: - return am65_cpsw_tc_query_caps(ndev, type_data); - case TC_SETUP_QDISC_TAPRIO: - return am65_cpsw_setup_taprio(ndev, type_data); - case TC_SETUP_BLOCK: - return am65_cpsw_qos_setup_tc_block(ndev, type_data); - default: - return -EOPNOTSUPP; - } -} - -void am65_cpsw_qos_link_up(struct net_device *ndev, int link_speed) -{ - struct am65_cpsw_port *port = am65_ndev_to_port(ndev); - - am65_cpsw_est_link_up(ndev, link_speed); - port->qos.link_down_time = 0; -} - -void am65_cpsw_qos_link_down(struct net_device *ndev) -{ - struct am65_cpsw_port *port = am65_ndev_to_port(ndev); - - if (!port->qos.link_down_time) - port->qos.link_down_time = ktime_get(); - - port->qos.link_speed = SPEED_UNKNOWN; -} - -static u32 -am65_cpsw_qos_tx_rate_calc(u32 rate_mbps, unsigned long bus_freq) -{ - u32 ir; - - bus_freq /= 1000000; - ir = DIV_ROUND_UP(((u64)rate_mbps * 32768), bus_freq); - return ir; -} - static void am65_cpsw_qos_tx_p0_rate_apply(struct am65_cpsw_common *common, int tx_ch, u32 rate_mbps) @@ -916,3 +883,36 @@ void am65_cpsw_qos_tx_p0_rate_init(struct am65_cpsw_common *common) host->port_base + AM65_CPSW_PN_REG_PRI_CIR(tx_ch)); } } + +int am65_cpsw_qos_ndo_setup_tc(struct net_device *ndev, enum tc_setup_type type, + void *type_data) +{ + switch (type) { + case TC_QUERY_CAPS: + return am65_cpsw_tc_query_caps(ndev, type_data); + case TC_SETUP_QDISC_TAPRIO: + return am65_cpsw_setup_taprio(ndev, type_data); + case TC_SETUP_BLOCK: + return am65_cpsw_qos_setup_tc_block(ndev, type_data); + default: + return -EOPNOTSUPP; + } +} + +void am65_cpsw_qos_link_up(struct net_device *ndev, int link_speed) +{ + struct am65_cpsw_port *port = am65_ndev_to_port(ndev); + + am65_cpsw_est_link_up(ndev, link_speed); + port->qos.link_down_time = 0; +} + +void am65_cpsw_qos_link_down(struct net_device *ndev) +{ + struct am65_cpsw_port *port = am65_ndev_to_port(ndev); + + if (!port->qos.link_down_time) + port->qos.link_down_time = ktime_get(); + + port->qos.link_speed = SPEED_UNKNOWN; +} -- 2.34.1