openwrtv3/target/linux/brcm63xx/patches-3.8/419-bcm63xx_enet-store-is_sw-in-a-variable-instead-of-ch.patch
Jonas Gorski 8506964e6d bcm63xx: add support for linux 3.8
Based on 3.8-rc6

Signed-off-by: Jonas Gorski <jogo@openwrt.org>

SVN-Revision: 35482
2013-02-04 10:19:55 +00:00

73 lines
2.1 KiB
Diff

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 bcm_enet_probe(struct platfor
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 bcm_enetsw_probe(struct platf
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
@@ -325,6 +325,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];
@@ -335,12 +337,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_ */