Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5238016rdb; Wed, 13 Dec 2023 03:08:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IGVc2kTZvOYg0S3i/Wt0U1OIRdLyNgoo1AV8w3Ow4KRmiPRRjvMjFkR7RBQJrVFGKp14pX7 X-Received: by 2002:a05:6a20:8e15:b0:18c:3ea9:b85d with SMTP id y21-20020a056a208e1500b0018c3ea9b85dmr11745956pzj.11.1702465709604; Wed, 13 Dec 2023 03:08:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702465709; cv=none; d=google.com; s=arc-20160816; b=iDvuk9R0VMeVykqhlDAQMCz7f+YkX/TnS1zjUfvyhMhSlXktEHQtj2vnx+8wfI2R81 QkZxQc3nau7OhE2GfgG19Vys6TPLNTbB8bv95jsKluy3SM5y9MCv7f7UQY8t0jGGktUf UYjTKXX9/3pvI+NmYoSbn7guwWpZny1Tb4E8jfBRLF/0BzELgLBw6TwuCn58t6kdYdXv FhUo+yG0uts23Mh5TF5YByang/vqSJyHGnXp5/MzdZqIgB59JebOi1R0W1XmnNvijsSQ 9BGx7yIOi31QCdFAl9/Chb58sOex17CziFaXDPv6Vummfh+hU5giuTu0Yi+tioAmwkyC ZSXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CRPL0ixQIGZ8ucBCBigqnAvROYUDILUtAX97rq+zBek=; fh=asmpGj2YxYe8/ji4bMUZUZytUYtbGpU9WbAkliy8rO0=; b=M4BAzBEb1iDUkiRG+TXe89T+2NSCHo6D39nr4OX6RTsjlFO+vFd0pVlRWOD7aqWbbt fW5B3RPJbkjUoMylvh6O/2DiU7++L2TLgOlhktkur7IT7ofbVsn8s12j3svbKFhOmhcJ JtT9BtV7UmjCFY7ld1LlZdBmCR72JRdpsgei1IvmFP/CN19Q0RkicRjOHeL/KqURVWLM /AC0ketA5GyTP9+rMHKtrP2ZPM5BWNx26XwRMI9bzeD0NBOhJhljsUShVXMaAVxiDdIp MEoAUzUlpTVKAriFEnsB9JgLD5hyX8sJAXTdxnp9hdblDTXBK2u/i+tDcnjDrKQ4Fv0q 3p3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aUCcJyZg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id 27-20020a630f5b000000b005c609c4fb47si9316219pgp.283.2023.12.13.03.08.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 03:08:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aUCcJyZg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 16D65804AD9C; Wed, 13 Dec 2023 03:08:26 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378811AbjLMLH6 (ORCPT + 99 others); Wed, 13 Dec 2023 06:07:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378817AbjLMLHv (ORCPT ); Wed, 13 Dec 2023 06:07:51 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB190189 for ; Wed, 13 Dec 2023 03:07:52 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF688C433C8; Wed, 13 Dec 2023 11:07:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702465672; bh=uKhd3JS1pFTqDv4Q8l75rLOBPsAgjlEdfaWWYPn6jXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aUCcJyZgrU8hhbXX06TZyC9YJe/SITdnhAAiRBrbNF3MKXaxqu/+PF2g6/mhCNANP B7C+bcpiwzYw28pAcCHmSY7oxiBPZcY7BsxrAfjXUWzXr8wInwhDAmY2uDyPEDb/t8 B2OJyyQyAaAOMUfFft6+Z6YUeQmYcyjiCET4RMjANoiOvZ/ylLjDKkJD5bQZ7ZQb9c EKPgBZsH4ELSqjjarQd1AhshBLnHGwAPq0xP8Blid3kmfq/BuGlVkdF/6njPDAFFuR GjmHVx25SWAxcIdKxeAUWcTHEJjgJJ8EhLvOewvKj26jphy3LvR0mZ7Y/UZAjyKSQE 1sdVQOmQH0Img== 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, rogerq@kernel.org Subject: [PATCH v8 net-next 06/11] net: ethernet: ti: am65-cpsw: Move code to avoid forward declaration Date: Wed, 13 Dec 2023 13:07:16 +0200 Message-Id: <20231213110721.69154-7-rogerq@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231213110721.69154-1-rogerq@kernel.org> References: <20231213110721.69154-1-rogerq@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 13 Dec 2023 03:08:26 -0800 (PST) Move this code to the end to avoid forward declaration. No functional change. Signed-off-by: Roger Quadros --- drivers/net/ethernet/ti/am65-cpsw-qos.c | 86 ++++++++++++------------- 1 file changed, 43 insertions(+), 43 deletions(-) Changelog 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