projects
/
openwrt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ar71xx: make the rtl8306 switch attach to eth0 instead of eth1 on the wrt160nl, fixes...
[openwrt.git]
/
target
/
linux
/
generic-2.6
/
files
/
drivers
/
net
/
phy
/
mvswitch.c
diff --git
a/target/linux/generic-2.6/files/drivers/net/phy/mvswitch.c
b/target/linux/generic-2.6/files/drivers/net/phy/mvswitch.c
index
427bad4
..
c2f3245
100644
(file)
--- a/
target/linux/generic-2.6/files/drivers/net/phy/mvswitch.c
+++ b/
target/linux/generic-2.6/files/drivers/net/phy/mvswitch.c
@@
-41,8
+41,8
@@
MODULE_LICENSE("GPL");
#define MVSWITCH_MAGIC 0x88E6060
struct mvswitch_priv {
#define MVSWITCH_MAGIC 0x88E6060
struct mvswitch_priv {
- /* the driver's tx function */
-
int (*hardstart)(struct sk_buff *skb, struct net_device *dev)
;
+ const struct net_device_ops *ndo_old;
+
struct net_device_ops ndo
;
struct vlan_group *grp;
u8 vlans[16];
};
struct vlan_group *grp;
u8 vlans[16];
};
@@
-133,7
+133,7
@@
mvswitch_mangle_tx(struct sk_buff *skb, struct net_device *dev)
));
#endif
));
#endif
- return priv->
hardstar
t(skb, dev);
+ return priv->
ndo_old->ndo_start_xmi
t(skb, dev);
error_expand:
if (net_ratelimit())
error_expand:
if (net_ratelimit())
@@
-248,10
+248,13
@@
mvswitch_config_init(struct phy_device *pdev)
pdev->advertising = ADVERTISED_100baseT_Full;
dev->phy_ptr = priv;
dev->irq = PHY_POLL;
pdev->advertising = ADVERTISED_100baseT_Full;
dev->phy_ptr = priv;
dev->irq = PHY_POLL;
+#ifdef HEADER_MODE
+ dev->flags |= IFF_PROMISC;
+#endif
/* initialize default vlans */
for (i = 0; i < MV_PORTS; i++)
/* initialize default vlans */
for (i = 0; i < MV_PORTS; i++)
- priv->vlans[(i == MV_WANPORT ?
1 : 0
)] |= (1 << i);
+ priv->vlans[(i == MV_WANPORT ?
2 : 1
)] |= (1 << i);
/* before entering reset, disable all ports */
for (i = 0; i < MV_PORTS; i++)
/* before entering reset, disable all ports */
for (i = 0; i < MV_PORTS; i++)
@@
-340,12
+343,15
@@
mvswitch_config_init(struct phy_device *pdev)
);
/* hook into the tx function */
);
/* hook into the tx function */
+ priv->ndo_old = dev->netdev_ops;
+ memcpy(&priv->ndo, priv->ndo_old, sizeof(struct net_device_ops));
+ priv->ndo.ndo_start_xmit = mvswitch_mangle_tx;
+ priv->ndo.ndo_vlan_rx_register = mvswitch_vlan_rx_register;
+ dev->netdev_ops = &priv->ndo;
+
pdev->pkt_align = 2;
pdev->pkt_align = 2;
- priv->hardstart = dev->hard_start_xmit;
pdev->netif_receive_skb = mvswitch_netif_receive_skb;
pdev->netif_rx = mvswitch_netif_rx;
pdev->netif_receive_skb = mvswitch_netif_receive_skb;
pdev->netif_rx = mvswitch_netif_rx;
- dev->hard_start_xmit = mvswitch_mangle_tx;
- dev->vlan_rx_register = mvswitch_vlan_rx_register;
#ifdef HEADER_MODE
dev->features |= NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX;
#else
#ifdef HEADER_MODE
dev->features |= NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX;
#else
@@
-360,7
+366,7
@@
mvswitch_read_status(struct phy_device *pdev)
{
pdev->speed = SPEED_100;
pdev->duplex = DUPLEX_FULL;
{
pdev->speed = SPEED_100;
pdev->duplex = DUPLEX_FULL;
- pdev->
state = PHY_UP
;
+ pdev->
link = 1
;
/* XXX ugly workaround: we can't force the switch
* to gracefully handle hosts moving from one port to another,
/* XXX ugly workaround: we can't force the switch
* to gracefully handle hosts moving from one port to another,
@@
-393,11
+399,9
@@
mvswitch_remove(struct phy_device *pdev)
struct mvswitch_priv *priv = to_mvsw(pdev);
struct net_device *dev = pdev->attached_dev;
struct mvswitch_priv *priv = to_mvsw(pdev);
struct net_device *dev = pdev->attached_dev;
- /* restore old xmit handler */
- if (priv->hardstart && dev)
- dev->hard_start_xmit = priv->hardstart;
- dev->vlan_rx_register = NULL;
- dev->vlan_rx_kill_vid = NULL;
+ /* restore old netdev ops */
+ if (priv->ndo_old && dev)
+ dev->netdev_ops = priv->ndo_old;
dev->phy_ptr = NULL;
dev->features &= ~NETIF_F_HW_VLAN_RX;
kfree(priv);
dev->phy_ptr = NULL;
dev->features &= ~NETIF_F_HW_VLAN_RX;
kfree(priv);
@@
-422,7
+426,9
@@
mvswitch_fixup(struct phy_device *dev)
{
u16 reg;
{
u16 reg;
- /* look for the switch on the bus */
+ if (dev->addr != 0x10)
+ return 0;
+
reg = dev->bus->read(dev->bus, MV_PORTREG(IDENT, 0)) & MV_IDENT_MASK;
if (reg != MV_IDENT_VALUE)
return 0;
reg = dev->bus->read(dev->bus, MV_PORTREG(IDENT, 0)) & MV_IDENT_MASK;
if (reg != MV_IDENT_VALUE)
return 0;
This page took
0.024041 seconds
and
4
git commands to generate.