aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm63xx/patches-3.3/419-bcm63xx_enet-store-is_sw-in-a-variable-instead-of-ch.patch
blob: 6f73477ab3c58ab5d75556c7c23d315044e0e285 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
From ef581388c45dbc48f7bbe050e87deb1e3c63a698 Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jonas.gorski@gmail.com>
Date: Tue, 10 Jul 2012 10:52:02 +0200
Subject: [PATCH 35/84] bcm63xx_enet: store is_sw in a variable instead of checking the cpuid

Reduces the number of changes needed for making enetsw work on new
chips.
---
 drivers/net/ethernet/broadcom/bcm63xx_enet.c |    7 +++++--
 drivers/net/ethernet/broadcom/bcm63xx_enet.h |   10 ++--------
 2 files changed, 7 insertions(+), 10 deletions(-)

--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -364,7 +364,7 @@ static int bcm_enet_receive_queue(struct
 		}
 
 		/* recycle packet if it's marked as bad */
-		if (!bcm_enet_is_sw(priv) &&
+		if (!priv->enet_is_sw &&
 		    unlikely(len_stat & DMADESC_ERR_MASK)) {
 			dev->stats.rx_errors++;
 
@@ -597,7 +597,7 @@ static int bcm_enet_start_xmit(struct sk
 	}
 
 	/* pad small packets sent on a switch device */
-	if (bcm_enet_is_sw(priv) && skb->len < 64) {
+	if (priv->enet_is_sw && skb->len < 64) {
 		int needed = 64 - skb->len;
 		char *data;
 
@@ -1700,6 +1700,8 @@ static int __devinit bcm_enet_probe(stru
 		return -ENOMEM;
 	priv = netdev_priv(dev);
 
+	priv->enet_is_sw = false;
+
 	ret = compute_hw_mtu(priv, dev->mtu);
 	if (ret)
 		goto out;
@@ -2725,6 +2727,7 @@ static int __devinit bcm_enetsw_probe(st
 	memset(priv, 0, sizeof(*priv));
 
 	/* initialize default and fetch platform data */
+	priv->enet_is_sw = true;
 	priv->irq_rx = irq_rx;
 	priv->irq_tx = irq_tx;
 	priv->rx_ring_size = BCMENET_DEF_RX_DESC;
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.h
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.h
@@ -353,6 +353,8 @@ struct bcm_enet_priv {
 	/* maximum hardware transmit/receive size */
 	unsigned int hw_mtu;
 
+	bool enet_is_sw;
+
 	/* port mapping for switch devices */
 	int num_ports;
 	struct bcm63xx_enetsw_port used_ports[ENETSW_MAX_PORT];
@@ -363,12 +365,4 @@ struct bcm_enet_priv {
 	spinlock_t enetsw_mdio_lock;
 };
 
-static inline int bcm_enet_is_sw(struct bcm_enet_priv *priv)
-{
-	if (BCMCPU_IS_6368())
-		return 1;
-	else
-		return 0;
-}
-
 #endif /* ! BCM63XX_ENET_H_ */