mirror of https://github.com/hak5/openwrt-owl.git
99 lines
3.4 KiB
Diff
99 lines
3.4 KiB
Diff
Index: linux-4.9.17/drivers/net/dsa/mt7530.c
|
|
===================================================================
|
|
--- linux-4.9.17.orig/drivers/net/dsa/mt7530.c
|
|
+++ linux-4.9.17/drivers/net/dsa/mt7530.c
|
|
@@ -834,6 +834,7 @@ mt7530_port_bridge_join(struct dsa_switc
|
|
int i;
|
|
|
|
mutex_lock(&priv->reg_mutex);
|
|
+ priv->bridge_dev[port] = bridge;
|
|
|
|
for (i = 0; i < MT7530_NUM_PORTS; i++) {
|
|
/* Add this port to the port matrix of the other ports in the
|
|
@@ -841,7 +842,7 @@ mt7530_port_bridge_join(struct dsa_switc
|
|
* and not being setup until the port becomes enabled.
|
|
*/
|
|
if (ds->enabled_port_mask & BIT(i) && i != port) {
|
|
- if (ds->ports[i].bridge_dev != bridge)
|
|
+ if (priv->bridge_dev[i] != bridge)
|
|
continue;
|
|
if (priv->ports[i].enable)
|
|
mt7530_set(priv, MT7530_PCR_P(i),
|
|
@@ -864,8 +865,7 @@ mt7530_port_bridge_join(struct dsa_switc
|
|
}
|
|
|
|
static void
|
|
-mt7530_port_bridge_leave(struct dsa_switch *ds, int port,
|
|
- struct net_device *bridge)
|
|
+mt7530_port_bridge_leave(struct dsa_switch *ds, int port)
|
|
{
|
|
struct mt7530_priv *priv = ds->priv;
|
|
int i;
|
|
@@ -878,7 +878,7 @@ mt7530_port_bridge_leave(struct dsa_swit
|
|
* is kept and not being setup until the port becomes enabled.
|
|
*/
|
|
if (ds->enabled_port_mask & BIT(i) && i != port) {
|
|
- if (ds->ports[i].bridge_dev != bridge)
|
|
+ if (priv->bridge_dev[i] != priv->bridge_dev[port])
|
|
continue;
|
|
if (priv->ports[i].enable)
|
|
mt7530_clear(priv, MT7530_PCR_P(i),
|
|
@@ -890,6 +890,7 @@ mt7530_port_bridge_leave(struct dsa_swit
|
|
/* Set the cpu port to be the only one in the port matrix of
|
|
* this port.
|
|
*/
|
|
+ priv->bridge_dev[port] = NULL;
|
|
if (priv->ports[port].enable)
|
|
mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK,
|
|
PCR_MATRIX(BIT(MT7530_CPU_PORT)));
|
|
@@ -1033,7 +1034,7 @@ mt7530_probe(struct mdio_device *mdiodev
|
|
if (!priv)
|
|
return -ENOMEM;
|
|
|
|
- priv->ds = dsa_switch_alloc(&mdiodev->dev, DSA_MAX_PORTS);
|
|
+ priv->ds = devm_kzalloc(&mdiodev->dev, sizeof(*priv->ds), GFP_KERNEL);
|
|
if (!priv->ds)
|
|
return -ENOMEM;
|
|
|
|
@@ -1076,12 +1077,13 @@ mt7530_probe(struct mdio_device *mdiodev
|
|
priv->bus = mdiodev->bus;
|
|
priv->dev = &mdiodev->dev;
|
|
priv->ds->priv = priv;
|
|
+ priv->ds->dev = &mdiodev->dev;
|
|
priv->ds->ops = &mt7530_switch_ops;
|
|
mutex_init(&priv->reg_mutex);
|
|
lpriv = priv;
|
|
dev_set_drvdata(&mdiodev->dev, priv);
|
|
|
|
- return dsa_register_switch(priv->ds, &mdiodev->dev);
|
|
+ return dsa_register_switch(priv->ds, priv->ds->dev->of_node);
|
|
}
|
|
|
|
static void
|
|
Index: linux-4.9.17/drivers/net/dsa/mt7530.h
|
|
===================================================================
|
|
--- linux-4.9.17.orig/drivers/net/dsa/mt7530.h
|
|
+++ linux-4.9.17/drivers/net/dsa/mt7530.h
|
|
@@ -379,6 +379,8 @@ struct mt7530_priv {
|
|
struct mt7530_port ports[MT7530_NUM_PORTS];
|
|
/* protect among processes for registers access*/
|
|
struct mutex reg_mutex;
|
|
+
|
|
+ struct net_device *bridge_dev[MT7530_NUM_PORTS];
|
|
};
|
|
|
|
struct mt7530_hw_stats {
|
|
Index: linux-4.9.17/net/dsa/tag_mtk.c
|
|
===================================================================
|
|
--- linux-4.9.17.orig/net/dsa/tag_mtk.c
|
|
+++ linux-4.9.17/net/dsa/tag_mtk.c
|
|
@@ -35,7 +35,7 @@ static struct sk_buff *mtk_tag_xmit(stru
|
|
/* Build the tag after the MAC Source Address */
|
|
mtk_tag = skb->data + 2 * ETH_ALEN;
|
|
mtk_tag[0] = 0;
|
|
- mtk_tag[1] = (1 << p->dp->index) & MTK_HDR_XMIT_DP_BIT_MASK;
|
|
+ mtk_tag[1] = (1 << p->port) & MTK_HDR_XMIT_DP_BIT_MASK;
|
|
mtk_tag[2] = 0;
|
|
mtk_tag[3] = 0;
|
|
|