Commit 055e13f3 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller
Browse files

eth: cpsw: remove a copy of the NAPI_POLL_WEIGHT define



Defining local versions of NAPI_POLL_WEIGHT with the same
values in the drivers just makes refactoring harder.

Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e2a30329
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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);
+2 −2
Original line number Diff line number Diff line
@@ -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;
+6 −6
Original line number Diff line number Diff line
@@ -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;
+0 −1
Original line number Diff line number Diff line
@@ -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)