From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net, pabeni@redhat.com
Cc: netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
grygorii.strashko@ti.com, chi.minghao@zte.com.cn,
vladimir.oltean@nxp.com, toke@redhat.com,
chenhao288@hisilicon.com, moyufeng@huawei.com,
linux-omap@vger.kernel.org
Subject: [PATCH net-next 03/14] eth: cpsw: remove a copy of the NAPI_POLL_WEIGHT define
Date: Wed, 27 Apr 2022 08:41:00 -0700 [thread overview]
Message-ID: <20220427154111.529975-4-kuba@kernel.org> (raw)
In-Reply-To: <20220427154111.529975-1-kuba@kernel.org>
Defining local versions of NAPI_POLL_WEIGHT with the same
values in the drivers just makes refactoring harder.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: grygorii.strashko@ti.com
CC: chi.minghao@zte.com.cn
CC: vladimir.oltean@nxp.com
CC: toke@redhat.com
CC: chenhao288@hisilicon.com
CC: moyufeng@huawei.com
CC: linux-omap@vger.kernel.org
---
drivers/net/ethernet/ti/cpsw.c | 4 ++--
drivers/net/ethernet/ti/cpsw_new.c | 4 ++--
drivers/net/ethernet/ti/cpsw_priv.c | 12 ++++++------
drivers/net/ethernet/ti/cpsw_priv.h | 1 -
4 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index e6ad2e53f1cd..662435e36805 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1639,10 +1639,10 @@ static int cpsw_probe(struct platform_device *pdev)
ndev->ethtool_ops = &cpsw_ethtool_ops;
netif_napi_add(ndev, &cpsw->napi_rx,
cpsw->quirk_irq ? cpsw_rx_poll : cpsw_rx_mq_poll,
- CPSW_POLL_WEIGHT);
+ NAPI_POLL_WEIGHT);
netif_tx_napi_add(ndev, &cpsw->napi_tx,
cpsw->quirk_irq ? cpsw_tx_poll : cpsw_tx_mq_poll,
- CPSW_POLL_WEIGHT);
+ NAPI_POLL_WEIGHT);
/* register the network device */
SET_NETDEV_DEV(ndev, dev);
diff --git a/drivers/net/ethernet/ti/cpsw_new.c b/drivers/net/ethernet/ti/cpsw_new.c
index 0f31cb4168bb..b33781ed760e 100644
--- a/drivers/net/ethernet/ti/cpsw_new.c
+++ b/drivers/net/ethernet/ti/cpsw_new.c
@@ -1416,11 +1416,11 @@ static int cpsw_create_ports(struct cpsw_common *cpsw)
netif_napi_add(ndev, &cpsw->napi_rx,
cpsw->quirk_irq ?
cpsw_rx_poll : cpsw_rx_mq_poll,
- CPSW_POLL_WEIGHT);
+ NAPI_POLL_WEIGHT);
netif_tx_napi_add(ndev, &cpsw->napi_tx,
cpsw->quirk_irq ?
cpsw_tx_poll : cpsw_tx_mq_poll,
- CPSW_POLL_WEIGHT);
+ NAPI_POLL_WEIGHT);
}
napi_ndev = ndev;
diff --git a/drivers/net/ethernet/ti/cpsw_priv.c b/drivers/net/ethernet/ti/cpsw_priv.c
index 887285c57db8..758295c898ac 100644
--- a/drivers/net/ethernet/ti/cpsw_priv.c
+++ b/drivers/net/ethernet/ti/cpsw_priv.c
@@ -364,7 +364,7 @@ void cpsw_split_res(struct cpsw_common *cpsw)
if (cpsw->tx_ch_num == rlim_ch_num) {
max_rate = consumed_rate;
} else if (!rlim_ch_num) {
- ch_budget = CPSW_POLL_WEIGHT / cpsw->tx_ch_num;
+ ch_budget = NAPI_POLL_WEIGHT / cpsw->tx_ch_num;
bigest_rate = 0;
max_rate = consumed_rate;
} else {
@@ -379,19 +379,19 @@ void cpsw_split_res(struct cpsw_common *cpsw)
if (max_rate < consumed_rate)
max_rate *= 10;
- ch_budget = (consumed_rate * CPSW_POLL_WEIGHT) / max_rate;
- ch_budget = (CPSW_POLL_WEIGHT - ch_budget) /
+ ch_budget = (consumed_rate * NAPI_POLL_WEIGHT) / max_rate;
+ ch_budget = (NAPI_POLL_WEIGHT - ch_budget) /
(cpsw->tx_ch_num - rlim_ch_num);
bigest_rate = (max_rate - consumed_rate) /
(cpsw->tx_ch_num - rlim_ch_num);
}
/* split tx weight/budget */
- budget = CPSW_POLL_WEIGHT;
+ budget = NAPI_POLL_WEIGHT;
for (i = 0; i < cpsw->tx_ch_num; i++) {
ch_rate = cpdma_chan_get_rate(txv[i].ch);
if (ch_rate) {
- txv[i].budget = (ch_rate * CPSW_POLL_WEIGHT) / max_rate;
+ txv[i].budget = (ch_rate * NAPI_POLL_WEIGHT) / max_rate;
if (!txv[i].budget)
txv[i].budget++;
if (ch_rate > bigest_rate) {
@@ -417,7 +417,7 @@ void cpsw_split_res(struct cpsw_common *cpsw)
txv[bigest_rate_ch].budget += budget;
/* split rx budget */
- budget = CPSW_POLL_WEIGHT;
+ budget = NAPI_POLL_WEIGHT;
ch_budget = budget / cpsw->rx_ch_num;
for (i = 0; i < cpsw->rx_ch_num; i++) {
cpsw->rxv[i].budget = ch_budget;
diff --git a/drivers/net/ethernet/ti/cpsw_priv.h b/drivers/net/ethernet/ti/cpsw_priv.h
index fc591f5ebe18..34230145ca0b 100644
--- a/drivers/net/ethernet/ti/cpsw_priv.h
+++ b/drivers/net/ethernet/ti/cpsw_priv.h
@@ -89,7 +89,6 @@ do { \
#define CPDMA_TXCP 0x40
#define CPDMA_RXCP 0x60
-#define CPSW_POLL_WEIGHT 64
#define CPSW_RX_VLAN_ENCAP_HDR_SIZE 4
#define CPSW_MIN_PACKET_SIZE_VLAN (VLAN_ETH_ZLEN)
#define CPSW_MIN_PACKET_SIZE (ETH_ZLEN)
--
2.34.1
next prev parent reply other threads:[~2022-04-27 15:41 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-27 15:40 [PATCH net-next 00/14] remove copies of the NAPI_POLL_WEIGHT define Jakub Kicinski
2022-04-27 15:40 ` [PATCH net-next 01/14] eth: " Jakub Kicinski
2022-05-01 22:10 ` Linus Walleij
2022-04-27 15:40 ` [PATCH net-next 02/14] eth: remove NAPI_WEIGHT defines Jakub Kicinski
2022-04-27 17:41 ` Greg KH
2022-04-27 15:41 ` Jakub Kicinski [this message]
2022-04-27 15:47 ` [PATCH net-next 03/14] eth: cpsw: remove a copy of the NAPI_POLL_WEIGHT define Vladimir Oltean
2022-04-27 15:53 ` Jakub Kicinski
2022-04-27 21:06 ` Francois Romieu
2022-04-27 15:41 ` [PATCH net-next 04/14] eth: pch_gbe: " Jakub Kicinski
2022-04-28 9:57 ` Andy Shevchenko
2022-04-27 15:41 ` [PATCH net-next 05/14] eth: mtk_eth_soc: " Jakub Kicinski
2022-04-27 15:41 ` [PATCH net-next 06/14] usb: lan78xx: " Jakub Kicinski
2022-04-27 15:41 ` [PATCH net-next 07/14] slic: " Jakub Kicinski
2022-04-27 15:41 ` [PATCH net-next 08/14] eth: bgnet: " Jakub Kicinski
2022-04-27 16:09 ` Florian Fainelli
2022-04-27 16:53 ` Jakub Kicinski
2022-04-27 17:32 ` Florian Fainelli
2022-04-27 15:41 ` [PATCH net-next 09/14] eth: atlantic: " Jakub Kicinski
2022-04-27 15:41 ` [PATCH net-next 10/14] eth: benet: " Jakub Kicinski
2022-04-27 15:41 ` [PATCH net-next 11/14] eth: gfar: " Jakub Kicinski
2022-04-27 15:41 ` [PATCH net-next 12/14] eth: vxge: " Jakub Kicinski
2022-04-27 15:41 ` [PATCH net-next 13/14] eth: spider: " Jakub Kicinski
2022-04-27 21:56 ` Geoff Levand
2022-04-27 15:41 ` [PATCH net-next 14/14] eth: velocity: " Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220427154111.529975-4-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=chenhao288@hisilicon.com \
--cc=chi.minghao@zte.com.cn \
--cc=davem@davemloft.net \
--cc=grygorii.strashko@ti.com \
--cc=linux-omap@vger.kernel.org \
--cc=moyufeng@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=toke@redhat.com \
--cc=vladimir.oltean@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).