diff options
Diffstat (limited to 'drivers/net/dsa/dsa_loop.c')
| -rw-r--r-- | drivers/net/dsa/dsa_loop.c | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/drivers/net/dsa/dsa_loop.c b/drivers/net/dsa/dsa_loop.c index f77be9f85cb3..816f34d64736 100644 --- a/drivers/net/dsa/dsa_loop.c +++ b/drivers/net/dsa/dsa_loop.c | |||
| @@ -67,7 +67,7 @@ static struct phy_device *phydevs[PHY_MAX_ADDR]; | |||
| 67 | static enum dsa_tag_protocol dsa_loop_get_protocol(struct dsa_switch *ds, | 67 | static enum dsa_tag_protocol dsa_loop_get_protocol(struct dsa_switch *ds, |
| 68 | int port) | 68 | int port) |
| 69 | { | 69 | { |
| 70 | dev_dbg(ds->dev, "%s\n", __func__); | 70 | dev_dbg(ds->dev, "%s: port: %d\n", __func__, port); |
| 71 | 71 | ||
| 72 | return DSA_TAG_PROTO_NONE; | 72 | return DSA_TAG_PROTO_NONE; |
| 73 | } | 73 | } |
| @@ -86,16 +86,23 @@ static int dsa_loop_setup(struct dsa_switch *ds) | |||
| 86 | return 0; | 86 | return 0; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | static int dsa_loop_get_sset_count(struct dsa_switch *ds, int port) | 89 | static int dsa_loop_get_sset_count(struct dsa_switch *ds, int port, int sset) |
| 90 | { | 90 | { |
| 91 | if (sset != ETH_SS_STATS && sset != ETH_SS_PHY_STATS) | ||
| 92 | return 0; | ||
| 93 | |||
| 91 | return __DSA_LOOP_CNT_MAX; | 94 | return __DSA_LOOP_CNT_MAX; |
| 92 | } | 95 | } |
| 93 | 96 | ||
| 94 | static void dsa_loop_get_strings(struct dsa_switch *ds, int port, uint8_t *data) | 97 | static void dsa_loop_get_strings(struct dsa_switch *ds, int port, |
| 98 | u32 stringset, uint8_t *data) | ||
| 95 | { | 99 | { |
| 96 | struct dsa_loop_priv *ps = ds->priv; | 100 | struct dsa_loop_priv *ps = ds->priv; |
| 97 | unsigned int i; | 101 | unsigned int i; |
| 98 | 102 | ||
| 103 | if (stringset != ETH_SS_STATS && stringset != ETH_SS_PHY_STATS) | ||
| 104 | return; | ||
| 105 | |||
| 99 | for (i = 0; i < __DSA_LOOP_CNT_MAX; i++) | 106 | for (i = 0; i < __DSA_LOOP_CNT_MAX; i++) |
| 100 | memcpy(data + i * ETH_GSTRING_LEN, | 107 | memcpy(data + i * ETH_GSTRING_LEN, |
| 101 | ps->ports[port].mib[i].name, ETH_GSTRING_LEN); | 108 | ps->ports[port].mib[i].name, ETH_GSTRING_LEN); |
| @@ -117,8 +124,6 @@ static int dsa_loop_phy_read(struct dsa_switch *ds, int port, int regnum) | |||
| 117 | struct mii_bus *bus = ps->bus; | 124 | struct mii_bus *bus = ps->bus; |
| 118 | int ret; | 125 | int ret; |
| 119 | 126 | ||
| 120 | dev_dbg(ds->dev, "%s\n", __func__); | ||
| 121 | |||
| 122 | ret = mdiobus_read_nested(bus, ps->port_base + port, regnum); | 127 | ret = mdiobus_read_nested(bus, ps->port_base + port, regnum); |
| 123 | if (ret < 0) | 128 | if (ret < 0) |
| 124 | ps->ports[port].mib[DSA_LOOP_PHY_READ_ERR].val++; | 129 | ps->ports[port].mib[DSA_LOOP_PHY_READ_ERR].val++; |
| @@ -135,8 +140,6 @@ static int dsa_loop_phy_write(struct dsa_switch *ds, int port, | |||
| 135 | struct mii_bus *bus = ps->bus; | 140 | struct mii_bus *bus = ps->bus; |
| 136 | int ret; | 141 | int ret; |
| 137 | 142 | ||
| 138 | dev_dbg(ds->dev, "%s\n", __func__); | ||
| 139 | |||
| 140 | ret = mdiobus_write_nested(bus, ps->port_base + port, regnum, value); | 143 | ret = mdiobus_write_nested(bus, ps->port_base + port, regnum, value); |
| 141 | if (ret < 0) | 144 | if (ret < 0) |
| 142 | ps->ports[port].mib[DSA_LOOP_PHY_WRITE_ERR].val++; | 145 | ps->ports[port].mib[DSA_LOOP_PHY_WRITE_ERR].val++; |
| @@ -149,7 +152,8 @@ static int dsa_loop_phy_write(struct dsa_switch *ds, int port, | |||
| 149 | static int dsa_loop_port_bridge_join(struct dsa_switch *ds, int port, | 152 | static int dsa_loop_port_bridge_join(struct dsa_switch *ds, int port, |
| 150 | struct net_device *bridge) | 153 | struct net_device *bridge) |
| 151 | { | 154 | { |
| 152 | dev_dbg(ds->dev, "%s\n", __func__); | 155 | dev_dbg(ds->dev, "%s: port: %d, bridge: %s\n", |
| 156 | __func__, port, bridge->name); | ||
| 153 | 157 | ||
| 154 | return 0; | 158 | return 0; |
| 155 | } | 159 | } |
| @@ -157,19 +161,22 @@ static int dsa_loop_port_bridge_join(struct dsa_switch *ds, int port, | |||
| 157 | static void dsa_loop_port_bridge_leave(struct dsa_switch *ds, int port, | 161 | static void dsa_loop_port_bridge_leave(struct dsa_switch *ds, int port, |
| 158 | struct net_device *bridge) | 162 | struct net_device *bridge) |
| 159 | { | 163 | { |
| 160 | dev_dbg(ds->dev, "%s\n", __func__); | 164 | dev_dbg(ds->dev, "%s: port: %d, bridge: %s\n", |
| 165 | __func__, port, bridge->name); | ||
| 161 | } | 166 | } |
| 162 | 167 | ||
| 163 | static void dsa_loop_port_stp_state_set(struct dsa_switch *ds, int port, | 168 | static void dsa_loop_port_stp_state_set(struct dsa_switch *ds, int port, |
| 164 | u8 state) | 169 | u8 state) |
| 165 | { | 170 | { |
| 166 | dev_dbg(ds->dev, "%s\n", __func__); | 171 | dev_dbg(ds->dev, "%s: port: %d, state: %d\n", |
| 172 | __func__, port, state); | ||
| 167 | } | 173 | } |
| 168 | 174 | ||
| 169 | static int dsa_loop_port_vlan_filtering(struct dsa_switch *ds, int port, | 175 | static int dsa_loop_port_vlan_filtering(struct dsa_switch *ds, int port, |
| 170 | bool vlan_filtering) | 176 | bool vlan_filtering) |
| 171 | { | 177 | { |
| 172 | dev_dbg(ds->dev, "%s\n", __func__); | 178 | dev_dbg(ds->dev, "%s: port: %d, vlan_filtering: %d\n", |
| 179 | __func__, port, vlan_filtering); | ||
| 173 | 180 | ||
| 174 | return 0; | 181 | return 0; |
| 175 | } | 182 | } |
| @@ -181,7 +188,8 @@ dsa_loop_port_vlan_prepare(struct dsa_switch *ds, int port, | |||
| 181 | struct dsa_loop_priv *ps = ds->priv; | 188 | struct dsa_loop_priv *ps = ds->priv; |
| 182 | struct mii_bus *bus = ps->bus; | 189 | struct mii_bus *bus = ps->bus; |
| 183 | 190 | ||
| 184 | dev_dbg(ds->dev, "%s\n", __func__); | 191 | dev_dbg(ds->dev, "%s: port: %d, vlan: %d-%d", |
| 192 | __func__, port, vlan->vid_begin, vlan->vid_end); | ||
| 185 | 193 | ||
| 186 | /* Just do a sleeping operation to make lockdep checks effective */ | 194 | /* Just do a sleeping operation to make lockdep checks effective */ |
| 187 | mdiobus_read(bus, ps->port_base + port, MII_BMSR); | 195 | mdiobus_read(bus, ps->port_base + port, MII_BMSR); |
| @@ -202,8 +210,6 @@ static void dsa_loop_port_vlan_add(struct dsa_switch *ds, int port, | |||
| 202 | struct dsa_loop_vlan *vl; | 210 | struct dsa_loop_vlan *vl; |
| 203 | u16 vid; | 211 | u16 vid; |
| 204 | 212 | ||
| 205 | dev_dbg(ds->dev, "%s\n", __func__); | ||
| 206 | |||
| 207 | /* Just do a sleeping operation to make lockdep checks effective */ | 213 | /* Just do a sleeping operation to make lockdep checks effective */ |
| 208 | mdiobus_read(bus, ps->port_base + port, MII_BMSR); | 214 | mdiobus_read(bus, ps->port_base + port, MII_BMSR); |
| 209 | 215 | ||
| @@ -215,6 +221,9 @@ static void dsa_loop_port_vlan_add(struct dsa_switch *ds, int port, | |||
| 215 | vl->untagged |= BIT(port); | 221 | vl->untagged |= BIT(port); |
| 216 | else | 222 | else |
| 217 | vl->untagged &= ~BIT(port); | 223 | vl->untagged &= ~BIT(port); |
| 224 | |||
| 225 | dev_dbg(ds->dev, "%s: port: %d vlan: %d, %stagged, pvid: %d\n", | ||
| 226 | __func__, port, vid, untagged ? "un" : "", pvid); | ||
| 218 | } | 227 | } |
| 219 | 228 | ||
| 220 | if (pvid) | 229 | if (pvid) |
| @@ -230,8 +239,6 @@ static int dsa_loop_port_vlan_del(struct dsa_switch *ds, int port, | |||
| 230 | struct dsa_loop_vlan *vl; | 239 | struct dsa_loop_vlan *vl; |
| 231 | u16 vid, pvid = ps->pvid; | 240 | u16 vid, pvid = ps->pvid; |
| 232 | 241 | ||
| 233 | dev_dbg(ds->dev, "%s\n", __func__); | ||
| 234 | |||
| 235 | /* Just do a sleeping operation to make lockdep checks effective */ | 242 | /* Just do a sleeping operation to make lockdep checks effective */ |
| 236 | mdiobus_read(bus, ps->port_base + port, MII_BMSR); | 243 | mdiobus_read(bus, ps->port_base + port, MII_BMSR); |
| 237 | 244 | ||
| @@ -244,6 +251,9 @@ static int dsa_loop_port_vlan_del(struct dsa_switch *ds, int port, | |||
| 244 | 251 | ||
| 245 | if (pvid == vid) | 252 | if (pvid == vid) |
| 246 | pvid = 1; | 253 | pvid = 1; |
| 254 | |||
| 255 | dev_dbg(ds->dev, "%s: port: %d vlan: %d, %stagged, pvid: %d\n", | ||
| 256 | __func__, port, vid, untagged ? "un" : "", pvid); | ||
| 247 | } | 257 | } |
| 248 | ps->pvid = pvid; | 258 | ps->pvid = pvid; |
| 249 | 259 | ||
| @@ -256,6 +266,7 @@ static const struct dsa_switch_ops dsa_loop_driver = { | |||
| 256 | .get_strings = dsa_loop_get_strings, | 266 | .get_strings = dsa_loop_get_strings, |
| 257 | .get_ethtool_stats = dsa_loop_get_ethtool_stats, | 267 | .get_ethtool_stats = dsa_loop_get_ethtool_stats, |
| 258 | .get_sset_count = dsa_loop_get_sset_count, | 268 | .get_sset_count = dsa_loop_get_sset_count, |
| 269 | .get_ethtool_phy_stats = dsa_loop_get_ethtool_stats, | ||
| 259 | .phy_read = dsa_loop_phy_read, | 270 | .phy_read = dsa_loop_phy_read, |
| 260 | .phy_write = dsa_loop_phy_write, | 271 | .phy_write = dsa_loop_phy_write, |
| 261 | .port_bridge_join = dsa_loop_port_bridge_join, | 272 | .port_bridge_join = dsa_loop_port_bridge_join, |
