diff options
39 files changed, 768 insertions, 1057 deletions
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index 4ffc224faa7f..8e21d457b899 100644 --- a/drivers/infiniband/core/addr.c +++ b/drivers/infiniband/core/addr.c | |||
@@ -185,15 +185,20 @@ static int addr4_resolve(struct sockaddr_in *src_in, | |||
185 | __be32 dst_ip = dst_in->sin_addr.s_addr; | 185 | __be32 dst_ip = dst_in->sin_addr.s_addr; |
186 | struct rtable *rt; | 186 | struct rtable *rt; |
187 | struct neighbour *neigh; | 187 | struct neighbour *neigh; |
188 | struct flowi4 fl4; | ||
188 | int ret; | 189 | int ret; |
189 | 190 | ||
190 | rt = ip_route_output(&init_net, dst_ip, src_ip, 0, addr->bound_dev_if); | 191 | memset(&fl4, 0, sizeof(fl4)); |
192 | fl4.daddr = dst_ip; | ||
193 | fl4.saddr = src_ip; | ||
194 | fl4.flowi4_oif = addr->bound_dev_if; | ||
195 | rt = ip_route_output_key(&init_net, &fl4); | ||
191 | if (IS_ERR(rt)) { | 196 | if (IS_ERR(rt)) { |
192 | ret = PTR_ERR(rt); | 197 | ret = PTR_ERR(rt); |
193 | goto out; | 198 | goto out; |
194 | } | 199 | } |
195 | src_in->sin_family = AF_INET; | 200 | src_in->sin_family = AF_INET; |
196 | src_in->sin_addr.s_addr = rt->rt_src; | 201 | src_in->sin_addr.s_addr = fl4.saddr; |
197 | 202 | ||
198 | if (rt->dst.dev->flags & IFF_LOOPBACK) { | 203 | if (rt->dst.dev->flags & IFF_LOOPBACK) { |
199 | ret = rdma_translate_ip((struct sockaddr *) dst_in, addr); | 204 | ret = rdma_translate_ip((struct sockaddr *) dst_in, addr); |
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index d4160f87e910..c7537abca4f2 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -2403,14 +2403,6 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) | |||
2403 | struct ad_info ad_info; | 2403 | struct ad_info ad_info; |
2404 | int res = 1; | 2404 | int res = 1; |
2405 | 2405 | ||
2406 | /* make sure that the slaves list will | ||
2407 | * not change during tx | ||
2408 | */ | ||
2409 | read_lock(&bond->lock); | ||
2410 | |||
2411 | if (!BOND_IS_OK(bond)) | ||
2412 | goto out; | ||
2413 | |||
2414 | if (bond_3ad_get_active_agg_info(bond, &ad_info)) { | 2406 | if (bond_3ad_get_active_agg_info(bond, &ad_info)) { |
2415 | pr_debug("%s: Error: bond_3ad_get_active_agg_info failed\n", | 2407 | pr_debug("%s: Error: bond_3ad_get_active_agg_info failed\n", |
2416 | dev->name); | 2408 | dev->name); |
@@ -2464,7 +2456,7 @@ out: | |||
2464 | /* no suitable interface, frame not sent */ | 2456 | /* no suitable interface, frame not sent */ |
2465 | dev_kfree_skb(skb); | 2457 | dev_kfree_skb(skb); |
2466 | } | 2458 | } |
2467 | read_unlock(&bond->lock); | 2459 | |
2468 | return NETDEV_TX_OK; | 2460 | return NETDEV_TX_OK; |
2469 | } | 2461 | } |
2470 | 2462 | ||
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 3b7b0409406f..8f2d2e7c70e5 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -1225,16 +1225,10 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev) | |||
1225 | skb_reset_mac_header(skb); | 1225 | skb_reset_mac_header(skb); |
1226 | eth_data = eth_hdr(skb); | 1226 | eth_data = eth_hdr(skb); |
1227 | 1227 | ||
1228 | /* make sure that the curr_active_slave and the slaves list do | 1228 | /* make sure that the curr_active_slave do not change during tx |
1229 | * not change during tx | ||
1230 | */ | 1229 | */ |
1231 | read_lock(&bond->lock); | ||
1232 | read_lock(&bond->curr_slave_lock); | 1230 | read_lock(&bond->curr_slave_lock); |
1233 | 1231 | ||
1234 | if (!BOND_IS_OK(bond)) { | ||
1235 | goto out; | ||
1236 | } | ||
1237 | |||
1238 | switch (ntohs(skb->protocol)) { | 1232 | switch (ntohs(skb->protocol)) { |
1239 | case ETH_P_IP: { | 1233 | case ETH_P_IP: { |
1240 | const struct iphdr *iph = ip_hdr(skb); | 1234 | const struct iphdr *iph = ip_hdr(skb); |
@@ -1334,13 +1328,12 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev) | |||
1334 | } | 1328 | } |
1335 | } | 1329 | } |
1336 | 1330 | ||
1337 | out: | ||
1338 | if (res) { | 1331 | if (res) { |
1339 | /* no suitable interface, frame not sent */ | 1332 | /* no suitable interface, frame not sent */ |
1340 | dev_kfree_skb(skb); | 1333 | dev_kfree_skb(skb); |
1341 | } | 1334 | } |
1342 | read_unlock(&bond->curr_slave_lock); | 1335 | read_unlock(&bond->curr_slave_lock); |
1343 | read_unlock(&bond->lock); | 1336 | |
1344 | return NETDEV_TX_OK; | 1337 | return NETDEV_TX_OK; |
1345 | } | 1338 | } |
1346 | 1339 | ||
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 9a5feaf4bab9..6312db1f7838 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -4004,10 +4004,6 @@ static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev | |||
4004 | int i, slave_no, res = 1; | 4004 | int i, slave_no, res = 1; |
4005 | struct iphdr *iph = ip_hdr(skb); | 4005 | struct iphdr *iph = ip_hdr(skb); |
4006 | 4006 | ||
4007 | read_lock(&bond->lock); | ||
4008 | |||
4009 | if (!BOND_IS_OK(bond)) | ||
4010 | goto out; | ||
4011 | /* | 4007 | /* |
4012 | * Start with the curr_active_slave that joined the bond as the | 4008 | * Start with the curr_active_slave that joined the bond as the |
4013 | * default for sending IGMP traffic. For failover purposes one | 4009 | * default for sending IGMP traffic. For failover purposes one |
@@ -4054,7 +4050,7 @@ out: | |||
4054 | /* no suitable interface, frame not sent */ | 4050 | /* no suitable interface, frame not sent */ |
4055 | dev_kfree_skb(skb); | 4051 | dev_kfree_skb(skb); |
4056 | } | 4052 | } |
4057 | read_unlock(&bond->lock); | 4053 | |
4058 | return NETDEV_TX_OK; | 4054 | return NETDEV_TX_OK; |
4059 | } | 4055 | } |
4060 | 4056 | ||
@@ -4068,24 +4064,18 @@ static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_d | |||
4068 | struct bonding *bond = netdev_priv(bond_dev); | 4064 | struct bonding *bond = netdev_priv(bond_dev); |
4069 | int res = 1; | 4065 | int res = 1; |
4070 | 4066 | ||
4071 | read_lock(&bond->lock); | ||
4072 | read_lock(&bond->curr_slave_lock); | 4067 | read_lock(&bond->curr_slave_lock); |
4073 | 4068 | ||
4074 | if (!BOND_IS_OK(bond)) | 4069 | if (bond->curr_active_slave) |
4075 | goto out; | 4070 | res = bond_dev_queue_xmit(bond, skb, |
4071 | bond->curr_active_slave->dev); | ||
4076 | 4072 | ||
4077 | if (!bond->curr_active_slave) | ||
4078 | goto out; | ||
4079 | |||
4080 | res = bond_dev_queue_xmit(bond, skb, bond->curr_active_slave->dev); | ||
4081 | |||
4082 | out: | ||
4083 | if (res) | 4073 | if (res) |
4084 | /* no suitable interface, frame not sent */ | 4074 | /* no suitable interface, frame not sent */ |
4085 | dev_kfree_skb(skb); | 4075 | dev_kfree_skb(skb); |
4086 | 4076 | ||
4087 | read_unlock(&bond->curr_slave_lock); | 4077 | read_unlock(&bond->curr_slave_lock); |
4088 | read_unlock(&bond->lock); | 4078 | |
4089 | return NETDEV_TX_OK; | 4079 | return NETDEV_TX_OK; |
4090 | } | 4080 | } |
4091 | 4081 | ||
@@ -4102,11 +4092,6 @@ static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev) | |||
4102 | int i; | 4092 | int i; |
4103 | int res = 1; | 4093 | int res = 1; |
4104 | 4094 | ||
4105 | read_lock(&bond->lock); | ||
4106 | |||
4107 | if (!BOND_IS_OK(bond)) | ||
4108 | goto out; | ||
4109 | |||
4110 | slave_no = bond->xmit_hash_policy(skb, bond->slave_cnt); | 4095 | slave_no = bond->xmit_hash_policy(skb, bond->slave_cnt); |
4111 | 4096 | ||
4112 | bond_for_each_slave(bond, slave, i) { | 4097 | bond_for_each_slave(bond, slave, i) { |
@@ -4126,12 +4111,11 @@ static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev) | |||
4126 | } | 4111 | } |
4127 | } | 4112 | } |
4128 | 4113 | ||
4129 | out: | ||
4130 | if (res) { | 4114 | if (res) { |
4131 | /* no suitable interface, frame not sent */ | 4115 | /* no suitable interface, frame not sent */ |
4132 | dev_kfree_skb(skb); | 4116 | dev_kfree_skb(skb); |
4133 | } | 4117 | } |
4134 | read_unlock(&bond->lock); | 4118 | |
4135 | return NETDEV_TX_OK; | 4119 | return NETDEV_TX_OK; |
4136 | } | 4120 | } |
4137 | 4121 | ||
@@ -4146,11 +4130,6 @@ static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device *bond_dev) | |||
4146 | int i; | 4130 | int i; |
4147 | int res = 1; | 4131 | int res = 1; |
4148 | 4132 | ||
4149 | read_lock(&bond->lock); | ||
4150 | |||
4151 | if (!BOND_IS_OK(bond)) | ||
4152 | goto out; | ||
4153 | |||
4154 | read_lock(&bond->curr_slave_lock); | 4133 | read_lock(&bond->curr_slave_lock); |
4155 | start_at = bond->curr_active_slave; | 4134 | start_at = bond->curr_active_slave; |
4156 | read_unlock(&bond->curr_slave_lock); | 4135 | read_unlock(&bond->curr_slave_lock); |
@@ -4189,7 +4168,6 @@ out: | |||
4189 | dev_kfree_skb(skb); | 4168 | dev_kfree_skb(skb); |
4190 | 4169 | ||
4191 | /* frame sent to all suitable interfaces */ | 4170 | /* frame sent to all suitable interfaces */ |
4192 | read_unlock(&bond->lock); | ||
4193 | return NETDEV_TX_OK; | 4171 | return NETDEV_TX_OK; |
4194 | } | 4172 | } |
4195 | 4173 | ||
@@ -4221,10 +4199,8 @@ static inline int bond_slave_override(struct bonding *bond, | |||
4221 | struct slave *slave = NULL; | 4199 | struct slave *slave = NULL; |
4222 | struct slave *check_slave; | 4200 | struct slave *check_slave; |
4223 | 4201 | ||
4224 | read_lock(&bond->lock); | 4202 | if (!skb->queue_mapping) |
4225 | 4203 | return 1; | |
4226 | if (!BOND_IS_OK(bond) || !skb->queue_mapping) | ||
4227 | goto out; | ||
4228 | 4204 | ||
4229 | /* Find out if any slaves have the same mapping as this skb. */ | 4205 | /* Find out if any slaves have the same mapping as this skb. */ |
4230 | bond_for_each_slave(bond, check_slave, i) { | 4206 | bond_for_each_slave(bond, check_slave, i) { |
@@ -4240,8 +4216,6 @@ static inline int bond_slave_override(struct bonding *bond, | |||
4240 | res = bond_dev_queue_xmit(bond, skb, slave->dev); | 4216 | res = bond_dev_queue_xmit(bond, skb, slave->dev); |
4241 | } | 4217 | } |
4242 | 4218 | ||
4243 | out: | ||
4244 | read_unlock(&bond->lock); | ||
4245 | return res; | 4219 | return res; |
4246 | } | 4220 | } |
4247 | 4221 | ||
@@ -4263,17 +4237,10 @@ static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb) | |||
4263 | return txq; | 4237 | return txq; |
4264 | } | 4238 | } |
4265 | 4239 | ||
4266 | static netdev_tx_t bond_start_xmit(struct sk_buff *skb, struct net_device *dev) | 4240 | static netdev_tx_t __bond_start_xmit(struct sk_buff *skb, struct net_device *dev) |
4267 | { | 4241 | { |
4268 | struct bonding *bond = netdev_priv(dev); | 4242 | struct bonding *bond = netdev_priv(dev); |
4269 | 4243 | ||
4270 | /* | ||
4271 | * If we risk deadlock from transmitting this in the | ||
4272 | * netpoll path, tell netpoll to queue the frame for later tx | ||
4273 | */ | ||
4274 | if (is_netpoll_tx_blocked(dev)) | ||
4275 | return NETDEV_TX_BUSY; | ||
4276 | |||
4277 | if (TX_QUEUE_OVERRIDE(bond->params.mode)) { | 4244 | if (TX_QUEUE_OVERRIDE(bond->params.mode)) { |
4278 | if (!bond_slave_override(bond, skb)) | 4245 | if (!bond_slave_override(bond, skb)) |
4279 | return NETDEV_TX_OK; | 4246 | return NETDEV_TX_OK; |
@@ -4303,6 +4270,29 @@ static netdev_tx_t bond_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
4303 | } | 4270 | } |
4304 | } | 4271 | } |
4305 | 4272 | ||
4273 | static netdev_tx_t bond_start_xmit(struct sk_buff *skb, struct net_device *dev) | ||
4274 | { | ||
4275 | struct bonding *bond = netdev_priv(dev); | ||
4276 | netdev_tx_t ret = NETDEV_TX_OK; | ||
4277 | |||
4278 | /* | ||
4279 | * If we risk deadlock from transmitting this in the | ||
4280 | * netpoll path, tell netpoll to queue the frame for later tx | ||
4281 | */ | ||
4282 | if (is_netpoll_tx_blocked(dev)) | ||
4283 | return NETDEV_TX_BUSY; | ||
4284 | |||
4285 | read_lock(&bond->lock); | ||
4286 | |||
4287 | if (bond->slave_cnt) | ||
4288 | ret = __bond_start_xmit(skb, dev); | ||
4289 | else | ||
4290 | dev_kfree_skb(skb); | ||
4291 | |||
4292 | read_unlock(&bond->lock); | ||
4293 | |||
4294 | return ret; | ||
4295 | } | ||
4306 | 4296 | ||
4307 | /* | 4297 | /* |
4308 | * set bond mode specific net device operations | 4298 | * set bond mode specific net device operations |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 3ad5425b82dd..d7c0bc62da7f 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -785,6 +785,7 @@ static int macvlan_device_event(struct notifier_block *unused, | |||
785 | struct net_device *dev = ptr; | 785 | struct net_device *dev = ptr; |
786 | struct macvlan_dev *vlan, *next; | 786 | struct macvlan_dev *vlan, *next; |
787 | struct macvlan_port *port; | 787 | struct macvlan_port *port; |
788 | LIST_HEAD(list_kill); | ||
788 | 789 | ||
789 | if (!macvlan_port_exists(dev)) | 790 | if (!macvlan_port_exists(dev)) |
790 | return NOTIFY_DONE; | 791 | return NOTIFY_DONE; |
@@ -810,7 +811,9 @@ static int macvlan_device_event(struct notifier_block *unused, | |||
810 | break; | 811 | break; |
811 | 812 | ||
812 | list_for_each_entry_safe(vlan, next, &port->vlans, list) | 813 | list_for_each_entry_safe(vlan, next, &port->vlans, list) |
813 | vlan->dev->rtnl_link_ops->dellink(vlan->dev, NULL); | 814 | vlan->dev->rtnl_link_ops->dellink(vlan->dev, &list_kill); |
815 | unregister_netdevice_many(&list_kill); | ||
816 | list_del(&list_kill); | ||
814 | break; | 817 | break; |
815 | case NETDEV_PRE_TYPE_CHANGE: | 818 | case NETDEV_PRE_TYPE_CHANGE: |
816 | /* Forbid underlaying device to change its type. */ | 819 | /* Forbid underlaying device to change its type. */ |
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index eb41e44921e6..a83e101440fd 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c | |||
@@ -242,34 +242,6 @@ static struct netconsole_target *to_target(struct config_item *item) | |||
242 | } | 242 | } |
243 | 243 | ||
244 | /* | 244 | /* |
245 | * Wrapper over simple_strtol (base 10) with sanity and range checking. | ||
246 | * We return (signed) long only because we may want to return errors. | ||
247 | * Do not use this to convert numbers that are allowed to be negative. | ||
248 | */ | ||
249 | static long strtol10_check_range(const char *cp, long min, long max) | ||
250 | { | ||
251 | long ret; | ||
252 | char *p = (char *) cp; | ||
253 | |||
254 | WARN_ON(min < 0); | ||
255 | WARN_ON(max < min); | ||
256 | |||
257 | ret = simple_strtol(p, &p, 10); | ||
258 | |||
259 | if (*p && (*p != '\n')) { | ||
260 | printk(KERN_ERR "netconsole: invalid input\n"); | ||
261 | return -EINVAL; | ||
262 | } | ||
263 | if ((ret < min) || (ret > max)) { | ||
264 | printk(KERN_ERR "netconsole: input %ld must be between " | ||
265 | "%ld and %ld\n", ret, min, max); | ||
266 | return -EINVAL; | ||
267 | } | ||
268 | |||
269 | return ret; | ||
270 | } | ||
271 | |||
272 | /* | ||
273 | * Attribute operations for netconsole_target. | 245 | * Attribute operations for netconsole_target. |
274 | */ | 246 | */ |
275 | 247 | ||
@@ -327,12 +299,14 @@ static ssize_t store_enabled(struct netconsole_target *nt, | |||
327 | const char *buf, | 299 | const char *buf, |
328 | size_t count) | 300 | size_t count) |
329 | { | 301 | { |
302 | int enabled; | ||
330 | int err; | 303 | int err; |
331 | long enabled; | ||
332 | 304 | ||
333 | enabled = strtol10_check_range(buf, 0, 1); | 305 | err = kstrtoint(buf, 10, &enabled); |
334 | if (enabled < 0) | 306 | if (err < 0) |
335 | return enabled; | 307 | return err; |
308 | if (enabled < 0 || enabled > 1) | ||
309 | return -EINVAL; | ||
336 | 310 | ||
337 | if (enabled) { /* 1 */ | 311 | if (enabled) { /* 1 */ |
338 | 312 | ||
@@ -384,8 +358,7 @@ static ssize_t store_local_port(struct netconsole_target *nt, | |||
384 | const char *buf, | 358 | const char *buf, |
385 | size_t count) | 359 | size_t count) |
386 | { | 360 | { |
387 | long local_port; | 361 | int rv; |
388 | #define __U16_MAX ((__u16) ~0U) | ||
389 | 362 | ||
390 | if (nt->enabled) { | 363 | if (nt->enabled) { |
391 | printk(KERN_ERR "netconsole: target (%s) is enabled, " | 364 | printk(KERN_ERR "netconsole: target (%s) is enabled, " |
@@ -394,12 +367,9 @@ static ssize_t store_local_port(struct netconsole_target *nt, | |||
394 | return -EINVAL; | 367 | return -EINVAL; |
395 | } | 368 | } |
396 | 369 | ||
397 | local_port = strtol10_check_range(buf, 0, __U16_MAX); | 370 | rv = kstrtou16(buf, 10, &nt->np.local_port); |
398 | if (local_port < 0) | 371 | if (rv < 0) |
399 | return local_port; | 372 | return rv; |
400 | |||
401 | nt->np.local_port = local_port; | ||
402 | |||
403 | return strnlen(buf, count); | 373 | return strnlen(buf, count); |
404 | } | 374 | } |
405 | 375 | ||
@@ -407,8 +377,7 @@ static ssize_t store_remote_port(struct netconsole_target *nt, | |||
407 | const char *buf, | 377 | const char *buf, |
408 | size_t count) | 378 | size_t count) |
409 | { | 379 | { |
410 | long remote_port; | 380 | int rv; |
411 | #define __U16_MAX ((__u16) ~0U) | ||
412 | 381 | ||
413 | if (nt->enabled) { | 382 | if (nt->enabled) { |
414 | printk(KERN_ERR "netconsole: target (%s) is enabled, " | 383 | printk(KERN_ERR "netconsole: target (%s) is enabled, " |
@@ -417,12 +386,9 @@ static ssize_t store_remote_port(struct netconsole_target *nt, | |||
417 | return -EINVAL; | 386 | return -EINVAL; |
418 | } | 387 | } |
419 | 388 | ||
420 | remote_port = strtol10_check_range(buf, 0, __U16_MAX); | 389 | rv = kstrtou16(buf, 10, &nt->np.remote_port); |
421 | if (remote_port < 0) | 390 | if (rv < 0) |
422 | return remote_port; | 391 | return rv; |
423 | |||
424 | nt->np.remote_port = remote_port; | ||
425 | |||
426 | return strnlen(buf, count); | 392 | return strnlen(buf, count); |
427 | } | 393 | } |
428 | 394 | ||
@@ -463,8 +429,6 @@ static ssize_t store_remote_mac(struct netconsole_target *nt, | |||
463 | size_t count) | 429 | size_t count) |
464 | { | 430 | { |
465 | u8 remote_mac[ETH_ALEN]; | 431 | u8 remote_mac[ETH_ALEN]; |
466 | char *p = (char *) buf; | ||
467 | int i; | ||
468 | 432 | ||
469 | if (nt->enabled) { | 433 | if (nt->enabled) { |
470 | printk(KERN_ERR "netconsole: target (%s) is enabled, " | 434 | printk(KERN_ERR "netconsole: target (%s) is enabled, " |
@@ -473,23 +437,13 @@ static ssize_t store_remote_mac(struct netconsole_target *nt, | |||
473 | return -EINVAL; | 437 | return -EINVAL; |
474 | } | 438 | } |
475 | 439 | ||
476 | for (i = 0; i < ETH_ALEN - 1; i++) { | 440 | if (!mac_pton(buf, remote_mac)) |
477 | remote_mac[i] = simple_strtoul(p, &p, 16); | 441 | return -EINVAL; |
478 | if (*p != ':') | 442 | if (buf[3 * ETH_ALEN - 1] && buf[3 * ETH_ALEN - 1] != '\n') |
479 | goto invalid; | 443 | return -EINVAL; |
480 | p++; | ||
481 | } | ||
482 | remote_mac[ETH_ALEN - 1] = simple_strtoul(p, &p, 16); | ||
483 | if (*p && (*p != '\n')) | ||
484 | goto invalid; | ||
485 | |||
486 | memcpy(nt->np.remote_mac, remote_mac, ETH_ALEN); | 444 | memcpy(nt->np.remote_mac, remote_mac, ETH_ALEN); |
487 | 445 | ||
488 | return strnlen(buf, count); | 446 | return strnlen(buf, count); |
489 | |||
490 | invalid: | ||
491 | printk(KERN_ERR "netconsole: invalid input\n"); | ||
492 | return -EINVAL; | ||
493 | } | 447 | } |
494 | 448 | ||
495 | /* | 449 | /* |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index a8976a753814..04f4e6086cd0 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -98,40 +98,40 @@ static const int multicast_filter_limit = 32; | |||
98 | #define RTL_R32(reg) readl (ioaddr + (reg)) | 98 | #define RTL_R32(reg) readl (ioaddr + (reg)) |
99 | 99 | ||
100 | enum mac_version { | 100 | enum mac_version { |
101 | RTL_GIGA_MAC_NONE = 0x00, | 101 | RTL_GIGA_MAC_VER_01 = 0, |
102 | RTL_GIGA_MAC_VER_01 = 0x01, // 8169 | 102 | RTL_GIGA_MAC_VER_02, |
103 | RTL_GIGA_MAC_VER_02 = 0x02, // 8169S | 103 | RTL_GIGA_MAC_VER_03, |
104 | RTL_GIGA_MAC_VER_03 = 0x03, // 8110S | 104 | RTL_GIGA_MAC_VER_04, |
105 | RTL_GIGA_MAC_VER_04 = 0x04, // 8169SB | 105 | RTL_GIGA_MAC_VER_05, |
106 | RTL_GIGA_MAC_VER_05 = 0x05, // 8110SCd | 106 | RTL_GIGA_MAC_VER_06, |
107 | RTL_GIGA_MAC_VER_06 = 0x06, // 8110SCe | 107 | RTL_GIGA_MAC_VER_07, |
108 | RTL_GIGA_MAC_VER_07 = 0x07, // 8102e | 108 | RTL_GIGA_MAC_VER_08, |
109 | RTL_GIGA_MAC_VER_08 = 0x08, // 8102e | 109 | RTL_GIGA_MAC_VER_09, |
110 | RTL_GIGA_MAC_VER_09 = 0x09, // 8102e | 110 | RTL_GIGA_MAC_VER_10, |
111 | RTL_GIGA_MAC_VER_10 = 0x0a, // 8101e | 111 | RTL_GIGA_MAC_VER_11, |
112 | RTL_GIGA_MAC_VER_11 = 0x0b, // 8168Bb | 112 | RTL_GIGA_MAC_VER_12, |
113 | RTL_GIGA_MAC_VER_12 = 0x0c, // 8168Be | 113 | RTL_GIGA_MAC_VER_13, |
114 | RTL_GIGA_MAC_VER_13 = 0x0d, // 8101Eb | 114 | RTL_GIGA_MAC_VER_14, |
115 | RTL_GIGA_MAC_VER_14 = 0x0e, // 8101 ? | 115 | RTL_GIGA_MAC_VER_15, |
116 | RTL_GIGA_MAC_VER_15 = 0x0f, // 8101 ? | 116 | RTL_GIGA_MAC_VER_16, |
117 | RTL_GIGA_MAC_VER_16 = 0x11, // 8101Ec | 117 | RTL_GIGA_MAC_VER_17, |
118 | RTL_GIGA_MAC_VER_17 = 0x10, // 8168Bf | 118 | RTL_GIGA_MAC_VER_18, |
119 | RTL_GIGA_MAC_VER_18 = 0x12, // 8168CP | 119 | RTL_GIGA_MAC_VER_19, |
120 | RTL_GIGA_MAC_VER_19 = 0x13, // 8168C | 120 | RTL_GIGA_MAC_VER_20, |
121 | RTL_GIGA_MAC_VER_20 = 0x14, // 8168C | 121 | RTL_GIGA_MAC_VER_21, |
122 | RTL_GIGA_MAC_VER_21 = 0x15, // 8168C | 122 | RTL_GIGA_MAC_VER_22, |
123 | RTL_GIGA_MAC_VER_22 = 0x16, // 8168C | 123 | RTL_GIGA_MAC_VER_23, |
124 | RTL_GIGA_MAC_VER_23 = 0x17, // 8168CP | 124 | RTL_GIGA_MAC_VER_24, |
125 | RTL_GIGA_MAC_VER_24 = 0x18, // 8168CP | 125 | RTL_GIGA_MAC_VER_25, |
126 | RTL_GIGA_MAC_VER_25 = 0x19, // 8168D | 126 | RTL_GIGA_MAC_VER_26, |
127 | RTL_GIGA_MAC_VER_26 = 0x1a, // 8168D | 127 | RTL_GIGA_MAC_VER_27, |
128 | RTL_GIGA_MAC_VER_27 = 0x1b, // 8168DP | 128 | RTL_GIGA_MAC_VER_28, |
129 | RTL_GIGA_MAC_VER_28 = 0x1c, // 8168DP | 129 | RTL_GIGA_MAC_VER_29, |
130 | RTL_GIGA_MAC_VER_29 = 0x1d, // 8105E | 130 | RTL_GIGA_MAC_VER_30, |
131 | RTL_GIGA_MAC_VER_30 = 0x1e, // 8105E | 131 | RTL_GIGA_MAC_VER_31, |
132 | RTL_GIGA_MAC_VER_31 = 0x1f, // 8168DP | 132 | RTL_GIGA_MAC_VER_32, |
133 | RTL_GIGA_MAC_VER_32 = 0x20, // 8168E | 133 | RTL_GIGA_MAC_VER_33, |
134 | RTL_GIGA_MAC_VER_33 = 0x21, // 8168E | 134 | RTL_GIGA_MAC_NONE = 0xff, |
135 | }; | 135 | }; |
136 | 136 | ||
137 | enum rtl_tx_desc_version { | 137 | enum rtl_tx_desc_version { |
@@ -139,61 +139,84 @@ enum rtl_tx_desc_version { | |||
139 | RTL_TD_1 = 1, | 139 | RTL_TD_1 = 1, |
140 | }; | 140 | }; |
141 | 141 | ||
142 | #define _R(NAME,MAC,TD) \ | 142 | #define _R(NAME,TD,FW) \ |
143 | { .name = NAME, .mac_version = MAC, .txd_version = TD } | 143 | { .name = NAME, .txd_version = TD, .fw_name = FW } |
144 | 144 | ||
145 | static const struct { | 145 | static const struct { |
146 | const char *name; | 146 | const char *name; |
147 | u8 mac_version; | ||
148 | enum rtl_tx_desc_version txd_version; | 147 | enum rtl_tx_desc_version txd_version; |
149 | } rtl_chip_info[] = { | ||
150 | _R("RTL8169", RTL_GIGA_MAC_VER_01, RTL_TD_0), // 8169 | ||
151 | _R("RTL8169s", RTL_GIGA_MAC_VER_02, RTL_TD_0), // 8169S | ||
152 | _R("RTL8110s", RTL_GIGA_MAC_VER_03, RTL_TD_0), // 8110S | ||
153 | _R("RTL8169sb/8110sb", RTL_GIGA_MAC_VER_04, RTL_TD_0), // 8169SB | ||
154 | _R("RTL8169sc/8110sc", RTL_GIGA_MAC_VER_05, RTL_TD_0), // 8110SCd | ||
155 | _R("RTL8169sc/8110sc", RTL_GIGA_MAC_VER_06, RTL_TD_0), // 8110SCe | ||
156 | _R("RTL8102e", RTL_GIGA_MAC_VER_07, RTL_TD_1), // PCI-E | ||
157 | _R("RTL8102e", RTL_GIGA_MAC_VER_08, RTL_TD_1), // PCI-E | ||
158 | _R("RTL8102e", RTL_GIGA_MAC_VER_09, RTL_TD_1), // PCI-E | ||
159 | _R("RTL8101e", RTL_GIGA_MAC_VER_10, RTL_TD_0), // PCI-E | ||
160 | _R("RTL8168b/8111b", RTL_GIGA_MAC_VER_11, RTL_TD_0), // PCI-E | ||
161 | _R("RTL8168b/8111b", RTL_GIGA_MAC_VER_12, RTL_TD_0), // PCI-E | ||
162 | _R("RTL8101e", RTL_GIGA_MAC_VER_13, RTL_TD_0), // PCI-E 8139 | ||
163 | _R("RTL8100e", RTL_GIGA_MAC_VER_14, RTL_TD_0), // PCI-E 8139 | ||
164 | _R("RTL8100e", RTL_GIGA_MAC_VER_15, RTL_TD_0), // PCI-E 8139 | ||
165 | _R("RTL8168b/8111b", RTL_GIGA_MAC_VER_17, RTL_TD_0), // PCI-E | ||
166 | _R("RTL8101e", RTL_GIGA_MAC_VER_16, RTL_TD_0), // PCI-E | ||
167 | _R("RTL8168cp/8111cp", RTL_GIGA_MAC_VER_18, RTL_TD_1), // PCI-E | ||
168 | _R("RTL8168c/8111c", RTL_GIGA_MAC_VER_19, RTL_TD_1), // PCI-E | ||
169 | _R("RTL8168c/8111c", RTL_GIGA_MAC_VER_20, RTL_TD_1), // PCI-E | ||
170 | _R("RTL8168c/8111c", RTL_GIGA_MAC_VER_21, RTL_TD_1), // PCI-E | ||
171 | _R("RTL8168c/8111c", RTL_GIGA_MAC_VER_22, RTL_TD_1), // PCI-E | ||
172 | _R("RTL8168cp/8111cp", RTL_GIGA_MAC_VER_23, RTL_TD_1), // PCI-E | ||
173 | _R("RTL8168cp/8111cp", RTL_GIGA_MAC_VER_24, RTL_TD_1), // PCI-E | ||
174 | _R("RTL8168d/8111d", RTL_GIGA_MAC_VER_25, RTL_TD_1), // PCI-E | ||
175 | _R("RTL8168d/8111d", RTL_GIGA_MAC_VER_26, RTL_TD_1), // PCI-E | ||
176 | _R("RTL8168dp/8111dp", RTL_GIGA_MAC_VER_27, RTL_TD_1), // PCI-E | ||
177 | _R("RTL8168dp/8111dp", RTL_GIGA_MAC_VER_28, RTL_TD_1), // PCI-E | ||
178 | _R("RTL8105e", RTL_GIGA_MAC_VER_29, RTL_TD_1), // PCI-E | ||
179 | _R("RTL8105e", RTL_GIGA_MAC_VER_30, RTL_TD_1), // PCI-E | ||
180 | _R("RTL8168dp/8111dp", RTL_GIGA_MAC_VER_31, RTL_TD_1), // PCI-E | ||
181 | _R("RTL8168e/8111e", RTL_GIGA_MAC_VER_32, RTL_TD_1), // PCI-E | ||
182 | _R("RTL8168e/8111e", RTL_GIGA_MAC_VER_33, RTL_TD_1) // PCI-E | ||
183 | }; | ||
184 | #undef _R | ||
185 | |||
186 | static const struct rtl_firmware_info { | ||
187 | int mac_version; | ||
188 | const char *fw_name; | 148 | const char *fw_name; |
189 | } rtl_firmware_infos[] = { | 149 | } rtl_chip_infos[] = { |
190 | { .mac_version = RTL_GIGA_MAC_VER_25, .fw_name = FIRMWARE_8168D_1 }, | 150 | /* PCI devices. */ |
191 | { .mac_version = RTL_GIGA_MAC_VER_26, .fw_name = FIRMWARE_8168D_2 }, | 151 | [RTL_GIGA_MAC_VER_01] = |
192 | { .mac_version = RTL_GIGA_MAC_VER_29, .fw_name = FIRMWARE_8105E_1 }, | 152 | _R("RTL8169", RTL_TD_0, NULL), |
193 | { .mac_version = RTL_GIGA_MAC_VER_30, .fw_name = FIRMWARE_8105E_1 }, | 153 | [RTL_GIGA_MAC_VER_02] = |
194 | { .mac_version = RTL_GIGA_MAC_VER_32, .fw_name = FIRMWARE_8168E_1 }, | 154 | _R("RTL8169s", RTL_TD_0, NULL), |
195 | { .mac_version = RTL_GIGA_MAC_VER_33, .fw_name = FIRMWARE_8168E_2 } | 155 | [RTL_GIGA_MAC_VER_03] = |
156 | _R("RTL8110s", RTL_TD_0, NULL), | ||
157 | [RTL_GIGA_MAC_VER_04] = | ||
158 | _R("RTL8169sb/8110sb", RTL_TD_0, NULL), | ||
159 | [RTL_GIGA_MAC_VER_05] = | ||
160 | _R("RTL8169sc/8110sc", RTL_TD_0, NULL), | ||
161 | [RTL_GIGA_MAC_VER_06] = | ||
162 | _R("RTL8169sc/8110sc", RTL_TD_0, NULL), | ||
163 | /* PCI-E devices. */ | ||
164 | [RTL_GIGA_MAC_VER_07] = | ||
165 | _R("RTL8102e", RTL_TD_1, NULL), | ||
166 | [RTL_GIGA_MAC_VER_08] = | ||
167 | _R("RTL8102e", RTL_TD_1, NULL), | ||
168 | [RTL_GIGA_MAC_VER_09] = | ||
169 | _R("RTL8102e", RTL_TD_1, NULL), | ||
170 | [RTL_GIGA_MAC_VER_10] = | ||
171 | _R("RTL8101e", RTL_TD_0, NULL), | ||
172 | [RTL_GIGA_MAC_VER_11] = | ||
173 | _R("RTL8168b/8111b", RTL_TD_0, NULL), | ||
174 | [RTL_GIGA_MAC_VER_12] = | ||
175 | _R("RTL8168b/8111b", RTL_TD_0, NULL), | ||
176 | [RTL_GIGA_MAC_VER_13] = | ||
177 | _R("RTL8101e", RTL_TD_0, NULL), | ||
178 | [RTL_GIGA_MAC_VER_14] = | ||
179 | _R("RTL8100e", RTL_TD_0, NULL), | ||
180 | [RTL_GIGA_MAC_VER_15] = | ||
181 | _R("RTL8100e", RTL_TD_0, NULL), | ||
182 | [RTL_GIGA_MAC_VER_16] = | ||
183 | _R("RTL8101e", RTL_TD_0, NULL), | ||
184 | [RTL_GIGA_MAC_VER_17] = | ||
185 | _R("RTL8168b/8111b", RTL_TD_0, NULL), | ||
186 | [RTL_GIGA_MAC_VER_18] = | ||
187 | _R("RTL8168cp/8111cp", RTL_TD_1, NULL), | ||
188 | [RTL_GIGA_MAC_VER_19] = | ||
189 | _R("RTL8168c/8111c", RTL_TD_1, NULL), | ||
190 | [RTL_GIGA_MAC_VER_20] = | ||
191 | _R("RTL8168c/8111c", RTL_TD_1, NULL), | ||
192 | [RTL_GIGA_MAC_VER_21] = | ||
193 | _R("RTL8168c/8111c", RTL_TD_1, NULL), | ||
194 | [RTL_GIGA_MAC_VER_22] = | ||
195 | _R("RTL8168c/8111c", RTL_TD_1, NULL), | ||
196 | [RTL_GIGA_MAC_VER_23] = | ||
197 | _R("RTL8168cp/8111cp", RTL_TD_1, NULL), | ||
198 | [RTL_GIGA_MAC_VER_24] = | ||
199 | _R("RTL8168cp/8111cp", RTL_TD_1, NULL), | ||
200 | [RTL_GIGA_MAC_VER_25] = | ||
201 | _R("RTL8168d/8111d", RTL_TD_1, FIRMWARE_8168D_1), | ||
202 | [RTL_GIGA_MAC_VER_26] = | ||
203 | _R("RTL8168d/8111d", RTL_TD_1, FIRMWARE_8168D_2), | ||
204 | [RTL_GIGA_MAC_VER_27] = | ||
205 | _R("RTL8168dp/8111dp", RTL_TD_1, NULL), | ||
206 | [RTL_GIGA_MAC_VER_28] = | ||
207 | _R("RTL8168dp/8111dp", RTL_TD_1, NULL), | ||
208 | [RTL_GIGA_MAC_VER_29] = | ||
209 | _R("RTL8105e", RTL_TD_1, FIRMWARE_8105E_1), | ||
210 | [RTL_GIGA_MAC_VER_30] = | ||
211 | _R("RTL8105e", RTL_TD_1, FIRMWARE_8105E_1), | ||
212 | [RTL_GIGA_MAC_VER_31] = | ||
213 | _R("RTL8168dp/8111dp", RTL_TD_1, NULL), | ||
214 | [RTL_GIGA_MAC_VER_32] = | ||
215 | _R("RTL8168e/8111e", RTL_TD_1, FIRMWARE_8168E_1), | ||
216 | [RTL_GIGA_MAC_VER_33] = | ||
217 | _R("RTL8168e/8111e", RTL_TD_1, FIRMWARE_8168E_2) | ||
196 | }; | 218 | }; |
219 | #undef _R | ||
197 | 220 | ||
198 | enum cfg_version { | 221 | enum cfg_version { |
199 | RTL_CFG_0 = 0x00, | 222 | RTL_CFG_0 = 0x00, |
@@ -345,7 +368,7 @@ enum rtl8168_registers { | |||
345 | #define OCPAR_GPHY_READ_CMD 0x0000f060 | 368 | #define OCPAR_GPHY_READ_CMD 0x0000f060 |
346 | RDSAR1 = 0xd0, /* 8168c only. Undocumented on 8168dp */ | 369 | RDSAR1 = 0xd0, /* 8168c only. Undocumented on 8168dp */ |
347 | MISC = 0xf0, /* 8168e only. */ | 370 | MISC = 0xf0, /* 8168e only. */ |
348 | txpla_rst = (1 << 29) | 371 | #define TXPLA_RST (1 << 29) |
349 | }; | 372 | }; |
350 | 373 | ||
351 | enum rtl_register_content { | 374 | enum rtl_register_content { |
@@ -423,7 +446,7 @@ enum rtl_register_content { | |||
423 | BWF = (1 << 6), /* Accept Broadcast wakeup frame */ | 446 | BWF = (1 << 6), /* Accept Broadcast wakeup frame */ |
424 | MWF = (1 << 5), /* Accept Multicast wakeup frame */ | 447 | MWF = (1 << 5), /* Accept Multicast wakeup frame */ |
425 | UWF = (1 << 4), /* Accept Unicast wakeup frame */ | 448 | UWF = (1 << 4), /* Accept Unicast wakeup frame */ |
426 | spi_en = (1 << 3), | 449 | Spi_en = (1 << 3), |
427 | LanWake = (1 << 1), /* LanWake enable/disable */ | 450 | LanWake = (1 << 1), /* LanWake enable/disable */ |
428 | PMEStatus = (1 << 0), /* PME status can be reset by PCI RST# */ | 451 | PMEStatus = (1 << 0), /* PME status can be reset by PCI RST# */ |
429 | 452 | ||
@@ -594,10 +617,10 @@ struct rtl8169_counters { | |||
594 | 617 | ||
595 | struct rtl8169_private { | 618 | struct rtl8169_private { |
596 | void __iomem *mmio_addr; /* memory map physical address */ | 619 | void __iomem *mmio_addr; /* memory map physical address */ |
597 | struct pci_dev *pci_dev; /* Index of PCI device */ | 620 | struct pci_dev *pci_dev; |
598 | struct net_device *dev; | 621 | struct net_device *dev; |
599 | struct napi_struct napi; | 622 | struct napi_struct napi; |
600 | spinlock_t lock; /* spin lock flag */ | 623 | spinlock_t lock; |
601 | u32 msg_enable; | 624 | u32 msg_enable; |
602 | u16 txd_version; | 625 | u16 txd_version; |
603 | u16 mac_version; | 626 | u16 mac_version; |
@@ -616,7 +639,6 @@ struct rtl8169_private { | |||
616 | u16 intr_event; | 639 | u16 intr_event; |
617 | u16 napi_event; | 640 | u16 napi_event; |
618 | u16 intr_mask; | 641 | u16 intr_mask; |
619 | int phy_1000_ctrl_reg; | ||
620 | 642 | ||
621 | struct mdio_ops { | 643 | struct mdio_ops { |
622 | void (*write)(void __iomem *, int, int); | 644 | void (*write)(void __iomem *, int, int); |
@@ -730,17 +752,19 @@ static void rtl8168_oob_notify(struct rtl8169_private *tp, u8 cmd) | |||
730 | #define OOB_CMD_DRIVER_START 0x05 | 752 | #define OOB_CMD_DRIVER_START 0x05 |
731 | #define OOB_CMD_DRIVER_STOP 0x06 | 753 | #define OOB_CMD_DRIVER_STOP 0x06 |
732 | 754 | ||
755 | static u16 rtl8168_get_ocp_reg(struct rtl8169_private *tp) | ||
756 | { | ||
757 | return (tp->mac_version == RTL_GIGA_MAC_VER_31) ? 0xb8 : 0x10; | ||
758 | } | ||
759 | |||
733 | static void rtl8168_driver_start(struct rtl8169_private *tp) | 760 | static void rtl8168_driver_start(struct rtl8169_private *tp) |
734 | { | 761 | { |
762 | u16 reg; | ||
735 | int i; | 763 | int i; |
736 | u32 reg; | ||
737 | 764 | ||
738 | rtl8168_oob_notify(tp, OOB_CMD_DRIVER_START); | 765 | rtl8168_oob_notify(tp, OOB_CMD_DRIVER_START); |
739 | 766 | ||
740 | if (tp->mac_version == RTL_GIGA_MAC_VER_31) | 767 | reg = rtl8168_get_ocp_reg(tp); |
741 | reg = 0xb8; | ||
742 | else | ||
743 | reg = 0x10; | ||
744 | 768 | ||
745 | for (i = 0; i < 10; i++) { | 769 | for (i = 0; i < 10; i++) { |
746 | msleep(10); | 770 | msleep(10); |
@@ -751,15 +775,12 @@ static void rtl8168_driver_start(struct rtl8169_private *tp) | |||
751 | 775 | ||
752 | static void rtl8168_driver_stop(struct rtl8169_private *tp) | 776 | static void rtl8168_driver_stop(struct rtl8169_private *tp) |
753 | { | 777 | { |
778 | u16 reg; | ||
754 | int i; | 779 | int i; |
755 | u32 reg; | ||
756 | 780 | ||
757 | rtl8168_oob_notify(tp, OOB_CMD_DRIVER_STOP); | 781 | rtl8168_oob_notify(tp, OOB_CMD_DRIVER_STOP); |
758 | 782 | ||
759 | if (tp->mac_version == RTL_GIGA_MAC_VER_31) | 783 | reg = rtl8168_get_ocp_reg(tp); |
760 | reg = 0xb8; | ||
761 | else | ||
762 | reg = 0x10; | ||
763 | 784 | ||
764 | for (i = 0; i < 10; i++) { | 785 | for (i = 0; i < 10; i++) { |
765 | msleep(10); | 786 | msleep(10); |
@@ -770,17 +791,9 @@ static void rtl8168_driver_stop(struct rtl8169_private *tp) | |||
770 | 791 | ||
771 | static int r8168dp_check_dash(struct rtl8169_private *tp) | 792 | static int r8168dp_check_dash(struct rtl8169_private *tp) |
772 | { | 793 | { |
773 | u32 reg; | 794 | u16 reg = rtl8168_get_ocp_reg(tp); |
774 | |||
775 | if (tp->mac_version == RTL_GIGA_MAC_VER_31) | ||
776 | reg = 0xb8; | ||
777 | else | ||
778 | reg = 0x10; | ||
779 | 795 | ||
780 | if (ocp_read(tp, 0xF, reg) & 0x00008000) | 796 | return (ocp_read(tp, 0x0f, reg) & 0x00008000) ? 1 : 0; |
781 | return 1; | ||
782 | else | ||
783 | return 0; | ||
784 | } | 797 | } |
785 | 798 | ||
786 | static void r8169_mdio_write(void __iomem *ioaddr, int reg_addr, int value) | 799 | static void r8169_mdio_write(void __iomem *ioaddr, int reg_addr, int value) |
@@ -1080,9 +1093,8 @@ static void rtl8169_xmii_reset_enable(struct rtl8169_private *tp) | |||
1080 | } | 1093 | } |
1081 | 1094 | ||
1082 | static void __rtl8169_check_link_status(struct net_device *dev, | 1095 | static void __rtl8169_check_link_status(struct net_device *dev, |
1083 | struct rtl8169_private *tp, | 1096 | struct rtl8169_private *tp, |
1084 | void __iomem *ioaddr, | 1097 | void __iomem *ioaddr, bool pm) |
1085 | bool pm) | ||
1086 | { | 1098 | { |
1087 | unsigned long flags; | 1099 | unsigned long flags; |
1088 | 1100 | ||
@@ -1199,6 +1211,11 @@ static int rtl8169_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
1199 | return 0; | 1211 | return 0; |
1200 | } | 1212 | } |
1201 | 1213 | ||
1214 | static const char *rtl_lookup_firmware_name(struct rtl8169_private *tp) | ||
1215 | { | ||
1216 | return rtl_chip_infos[tp->mac_version].fw_name; | ||
1217 | } | ||
1218 | |||
1202 | static void rtl8169_get_drvinfo(struct net_device *dev, | 1219 | static void rtl8169_get_drvinfo(struct net_device *dev, |
1203 | struct ethtool_drvinfo *info) | 1220 | struct ethtool_drvinfo *info) |
1204 | { | 1221 | { |
@@ -1207,6 +1224,8 @@ static void rtl8169_get_drvinfo(struct net_device *dev, | |||
1207 | strcpy(info->driver, MODULENAME); | 1224 | strcpy(info->driver, MODULENAME); |
1208 | strcpy(info->version, RTL8169_VERSION); | 1225 | strcpy(info->version, RTL8169_VERSION); |
1209 | strcpy(info->bus_info, pci_name(tp->pci_dev)); | 1226 | strcpy(info->bus_info, pci_name(tp->pci_dev)); |
1227 | strncpy(info->fw_version, IS_ERR_OR_NULL(tp->fw) ? "N/A" : | ||
1228 | rtl_lookup_firmware_name(tp), sizeof(info->fw_version) - 1); | ||
1210 | } | 1229 | } |
1211 | 1230 | ||
1212 | static int rtl8169_get_regs_len(struct net_device *dev) | 1231 | static int rtl8169_get_regs_len(struct net_device *dev) |
@@ -1268,16 +1287,7 @@ static int rtl8169_set_speed_xmii(struct net_device *dev, | |||
1268 | giga_ctrl &= ~(ADVERTISE_1000FULL | ADVERTISE_1000HALF); | 1287 | giga_ctrl &= ~(ADVERTISE_1000FULL | ADVERTISE_1000HALF); |
1269 | 1288 | ||
1270 | /* The 8100e/8101e/8102e do Fast Ethernet only. */ | 1289 | /* The 8100e/8101e/8102e do Fast Ethernet only. */ |
1271 | if ((tp->mac_version != RTL_GIGA_MAC_VER_07) && | 1290 | if (tp->mii.supports_gmii) { |
1272 | (tp->mac_version != RTL_GIGA_MAC_VER_08) && | ||
1273 | (tp->mac_version != RTL_GIGA_MAC_VER_09) && | ||
1274 | (tp->mac_version != RTL_GIGA_MAC_VER_10) && | ||
1275 | (tp->mac_version != RTL_GIGA_MAC_VER_13) && | ||
1276 | (tp->mac_version != RTL_GIGA_MAC_VER_14) && | ||
1277 | (tp->mac_version != RTL_GIGA_MAC_VER_15) && | ||
1278 | (tp->mac_version != RTL_GIGA_MAC_VER_16) && | ||
1279 | (tp->mac_version != RTL_GIGA_MAC_VER_29) && | ||
1280 | (tp->mac_version != RTL_GIGA_MAC_VER_30)) { | ||
1281 | if (adv & ADVERTISED_1000baseT_Half) | 1291 | if (adv & ADVERTISED_1000baseT_Half) |
1282 | giga_ctrl |= ADVERTISE_1000HALF; | 1292 | giga_ctrl |= ADVERTISE_1000HALF; |
1283 | if (adv & ADVERTISED_1000baseT_Full) | 1293 | if (adv & ADVERTISED_1000baseT_Full) |
@@ -1307,12 +1317,10 @@ static int rtl8169_set_speed_xmii(struct net_device *dev, | |||
1307 | bmcr |= BMCR_FULLDPLX; | 1317 | bmcr |= BMCR_FULLDPLX; |
1308 | } | 1318 | } |
1309 | 1319 | ||
1310 | tp->phy_1000_ctrl_reg = giga_ctrl; | ||
1311 | |||
1312 | rtl_writephy(tp, MII_BMCR, bmcr); | 1320 | rtl_writephy(tp, MII_BMCR, bmcr); |
1313 | 1321 | ||
1314 | if ((tp->mac_version == RTL_GIGA_MAC_VER_02) || | 1322 | if (tp->mac_version == RTL_GIGA_MAC_VER_02 || |
1315 | (tp->mac_version == RTL_GIGA_MAC_VER_03)) { | 1323 | tp->mac_version == RTL_GIGA_MAC_VER_03) { |
1316 | if ((speed == SPEED_100) && (autoneg != AUTONEG_ENABLE)) { | 1324 | if ((speed == SPEED_100) && (autoneg != AUTONEG_ENABLE)) { |
1317 | rtl_writephy(tp, 0x17, 0x2138); | 1325 | rtl_writephy(tp, 0x17, 0x2138); |
1318 | rtl_writephy(tp, 0x0e, 0x0260); | 1326 | rtl_writephy(tp, 0x0e, 0x0260); |
@@ -1334,10 +1342,14 @@ static int rtl8169_set_speed(struct net_device *dev, | |||
1334 | int ret; | 1342 | int ret; |
1335 | 1343 | ||
1336 | ret = tp->set_speed(dev, autoneg, speed, duplex, advertising); | 1344 | ret = tp->set_speed(dev, autoneg, speed, duplex, advertising); |
1345 | if (ret < 0) | ||
1346 | goto out; | ||
1337 | 1347 | ||
1338 | if (netif_running(dev) && (tp->phy_1000_ctrl_reg & ADVERTISE_1000FULL)) | 1348 | if (netif_running(dev) && (autoneg == AUTONEG_ENABLE) && |
1349 | (advertising & ADVERTISED_1000baseT_Full)) { | ||
1339 | mod_timer(&tp->timer, jiffies + RTL8169_PHY_TIMEOUT); | 1350 | mod_timer(&tp->timer, jiffies + RTL8169_PHY_TIMEOUT); |
1340 | 1351 | } | |
1352 | out: | ||
1341 | return ret; | 1353 | return ret; |
1342 | } | 1354 | } |
1343 | 1355 | ||
@@ -1347,9 +1359,10 @@ static int rtl8169_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1347 | unsigned long flags; | 1359 | unsigned long flags; |
1348 | int ret; | 1360 | int ret; |
1349 | 1361 | ||
1362 | del_timer_sync(&tp->timer); | ||
1363 | |||
1350 | spin_lock_irqsave(&tp->lock, flags); | 1364 | spin_lock_irqsave(&tp->lock, flags); |
1351 | ret = rtl8169_set_speed(dev, | 1365 | ret = rtl8169_set_speed(dev, cmd->autoneg, ethtool_cmd_speed(cmd), |
1352 | cmd->autoneg, ethtool_cmd_speed(cmd), | ||
1353 | cmd->duplex, cmd->advertising); | 1366 | cmd->duplex, cmd->advertising); |
1354 | spin_unlock_irqrestore(&tp->lock, flags); | 1367 | spin_unlock_irqrestore(&tp->lock, flags); |
1355 | 1368 | ||
@@ -1507,11 +1520,11 @@ static void rtl8169_update_counters(struct net_device *dev) | |||
1507 | { | 1520 | { |
1508 | struct rtl8169_private *tp = netdev_priv(dev); | 1521 | struct rtl8169_private *tp = netdev_priv(dev); |
1509 | void __iomem *ioaddr = tp->mmio_addr; | 1522 | void __iomem *ioaddr = tp->mmio_addr; |
1523 | struct device *d = &tp->pci_dev->dev; | ||
1510 | struct rtl8169_counters *counters; | 1524 | struct rtl8169_counters *counters; |
1511 | dma_addr_t paddr; | 1525 | dma_addr_t paddr; |
1512 | u32 cmd; | 1526 | u32 cmd; |
1513 | int wait = 1000; | 1527 | int wait = 1000; |
1514 | struct device *d = &tp->pci_dev->dev; | ||
1515 | 1528 | ||
1516 | /* | 1529 | /* |
1517 | * Some chips are unable to dump tally counters when the receiver | 1530 | * Some chips are unable to dump tally counters when the receiver |
@@ -1531,7 +1544,6 @@ static void rtl8169_update_counters(struct net_device *dev) | |||
1531 | 1544 | ||
1532 | while (wait--) { | 1545 | while (wait--) { |
1533 | if ((RTL_R32(CounterAddrLow) & CounterDump) == 0) { | 1546 | if ((RTL_R32(CounterAddrLow) & CounterDump) == 0) { |
1534 | /* copy updated counters */ | ||
1535 | memcpy(&tp->counters, counters, sizeof(*counters)); | 1547 | memcpy(&tp->counters, counters, sizeof(*counters)); |
1536 | break; | 1548 | break; |
1537 | } | 1549 | } |
@@ -1594,8 +1606,9 @@ static const struct ethtool_ops rtl8169_ethtool_ops = { | |||
1594 | }; | 1606 | }; |
1595 | 1607 | ||
1596 | static void rtl8169_get_mac_version(struct rtl8169_private *tp, | 1608 | static void rtl8169_get_mac_version(struct rtl8169_private *tp, |
1597 | void __iomem *ioaddr) | 1609 | struct net_device *dev, u8 default_version) |
1598 | { | 1610 | { |
1611 | void __iomem *ioaddr = tp->mmio_addr; | ||
1599 | /* | 1612 | /* |
1600 | * The driver currently handles the 8168Bf and the 8168Be identically | 1613 | * The driver currently handles the 8168Bf and the 8168Be identically |
1601 | * but they can be identified more specifically through the test below | 1614 | * but they can be identified more specifically through the test below |
@@ -1682,6 +1695,12 @@ static void rtl8169_get_mac_version(struct rtl8169_private *tp, | |||
1682 | while ((reg & p->mask) != p->val) | 1695 | while ((reg & p->mask) != p->val) |
1683 | p++; | 1696 | p++; |
1684 | tp->mac_version = p->mac_version; | 1697 | tp->mac_version = p->mac_version; |
1698 | |||
1699 | if (tp->mac_version == RTL_GIGA_MAC_NONE) { | ||
1700 | netif_notice(tp, probe, dev, | ||
1701 | "unknown MAC, using family default\n"); | ||
1702 | tp->mac_version = default_version; | ||
1703 | } | ||
1685 | } | 1704 | } |
1686 | 1705 | ||
1687 | static void rtl8169_print_mac_version(struct rtl8169_private *tp) | 1706 | static void rtl8169_print_mac_version(struct rtl8169_private *tp) |
@@ -1751,14 +1770,14 @@ rtl_phy_write_fw(struct rtl8169_private *tp, const struct firmware *fw) | |||
1751 | case PHY_BJMPN: | 1770 | case PHY_BJMPN: |
1752 | if (regno > index) { | 1771 | if (regno > index) { |
1753 | netif_err(tp, probe, tp->dev, | 1772 | netif_err(tp, probe, tp->dev, |
1754 | "Out of range of firmware\n"); | 1773 | "Out of range of firmware\n"); |
1755 | return; | 1774 | return; |
1756 | } | 1775 | } |
1757 | break; | 1776 | break; |
1758 | case PHY_READCOUNT_EQ_SKIP: | 1777 | case PHY_READCOUNT_EQ_SKIP: |
1759 | if (index + 2 >= fw_size) { | 1778 | if (index + 2 >= fw_size) { |
1760 | netif_err(tp, probe, tp->dev, | 1779 | netif_err(tp, probe, tp->dev, |
1761 | "Out of range of firmware\n"); | 1780 | "Out of range of firmware\n"); |
1762 | return; | 1781 | return; |
1763 | } | 1782 | } |
1764 | break; | 1783 | break; |
@@ -1767,7 +1786,7 @@ rtl_phy_write_fw(struct rtl8169_private *tp, const struct firmware *fw) | |||
1767 | case PHY_SKIPN: | 1786 | case PHY_SKIPN: |
1768 | if (index + 1 + regno >= fw_size) { | 1787 | if (index + 1 + regno >= fw_size) { |
1769 | netif_err(tp, probe, tp->dev, | 1788 | netif_err(tp, probe, tp->dev, |
1770 | "Out of range of firmware\n"); | 1789 | "Out of range of firmware\n"); |
1771 | return; | 1790 | return; |
1772 | } | 1791 | } |
1773 | break; | 1792 | break; |
@@ -1823,10 +1842,7 @@ rtl_phy_write_fw(struct rtl8169_private *tp, const struct firmware *fw) | |||
1823 | index++; | 1842 | index++; |
1824 | break; | 1843 | break; |
1825 | case PHY_READCOUNT_EQ_SKIP: | 1844 | case PHY_READCOUNT_EQ_SKIP: |
1826 | if (count == data) | 1845 | index += (count == data) ? 2 : 1; |
1827 | index += 2; | ||
1828 | else | ||
1829 | index += 1; | ||
1830 | break; | 1846 | break; |
1831 | case PHY_COMP_EQ_SKIPN: | 1847 | case PHY_COMP_EQ_SKIPN: |
1832 | if (predata == data) | 1848 | if (predata == data) |
@@ -2237,7 +2253,7 @@ static void rtl8168d_1_hw_phy_config(struct rtl8169_private *tp) | |||
2237 | 2253 | ||
2238 | /* | 2254 | /* |
2239 | * Tx Error Issue | 2255 | * Tx Error Issue |
2240 | * enhance line driver power | 2256 | * Enhance line driver power |
2241 | */ | 2257 | */ |
2242 | { 0x1f, 0x0002 }, | 2258 | { 0x1f, 0x0002 }, |
2243 | { 0x06, 0x5561 }, | 2259 | { 0x06, 0x5561 }, |
@@ -2349,7 +2365,7 @@ static void rtl8168d_2_hw_phy_config(struct rtl8169_private *tp) | |||
2349 | 2365 | ||
2350 | /* | 2366 | /* |
2351 | * Tx Error Issue | 2367 | * Tx Error Issue |
2352 | * enhance line driver power | 2368 | * Enhance line driver power |
2353 | */ | 2369 | */ |
2354 | { 0x1f, 0x0002 }, | 2370 | { 0x1f, 0x0002 }, |
2355 | { 0x06, 0x5561 }, | 2371 | { 0x06, 0x5561 }, |
@@ -2548,7 +2564,7 @@ static void rtl8168e_hw_phy_config(struct rtl8169_private *tp) | |||
2548 | /* For impedance matching */ | 2564 | /* For impedance matching */ |
2549 | rtl_writephy(tp, 0x1f, 0x0002); | 2565 | rtl_writephy(tp, 0x1f, 0x0002); |
2550 | rtl_w1w0_phy(tp, 0x08, 0x8000, 0x7f00); | 2566 | rtl_w1w0_phy(tp, 0x08, 0x8000, 0x7f00); |
2551 | rtl_writephy(tp, 0x1F, 0x0000); | 2567 | rtl_writephy(tp, 0x1f, 0x0000); |
2552 | 2568 | ||
2553 | /* PHY auto speed down */ | 2569 | /* PHY auto speed down */ |
2554 | rtl_writephy(tp, 0x1f, 0x0007); | 2570 | rtl_writephy(tp, 0x1f, 0x0007); |
@@ -2692,6 +2708,9 @@ static void rtl_hw_phy_config(struct net_device *dev) | |||
2692 | case RTL_GIGA_MAC_VER_30: | 2708 | case RTL_GIGA_MAC_VER_30: |
2693 | rtl8105e_hw_phy_config(tp); | 2709 | rtl8105e_hw_phy_config(tp); |
2694 | break; | 2710 | break; |
2711 | case RTL_GIGA_MAC_VER_31: | ||
2712 | /* None. */ | ||
2713 | break; | ||
2695 | case RTL_GIGA_MAC_VER_32: | 2714 | case RTL_GIGA_MAC_VER_32: |
2696 | case RTL_GIGA_MAC_VER_33: | 2715 | case RTL_GIGA_MAC_VER_33: |
2697 | rtl8168e_hw_phy_config(tp); | 2716 | rtl8168e_hw_phy_config(tp); |
@@ -2712,9 +2731,6 @@ static void rtl8169_phy_timer(unsigned long __opaque) | |||
2712 | 2731 | ||
2713 | assert(tp->mac_version > RTL_GIGA_MAC_VER_01); | 2732 | assert(tp->mac_version > RTL_GIGA_MAC_VER_01); |
2714 | 2733 | ||
2715 | if (!(tp->phy_1000_ctrl_reg & ADVERTISE_1000FULL)) | ||
2716 | return; | ||
2717 | |||
2718 | spin_lock_irq(&tp->lock); | 2734 | spin_lock_irq(&tp->lock); |
2719 | 2735 | ||
2720 | if (tp->phy_reset_pending(tp)) { | 2736 | if (tp->phy_reset_pending(tp)) { |
@@ -2739,28 +2755,6 @@ out_unlock: | |||
2739 | spin_unlock_irq(&tp->lock); | 2755 | spin_unlock_irq(&tp->lock); |
2740 | } | 2756 | } |
2741 | 2757 | ||
2742 | static inline void rtl8169_delete_timer(struct net_device *dev) | ||
2743 | { | ||
2744 | struct rtl8169_private *tp = netdev_priv(dev); | ||
2745 | struct timer_list *timer = &tp->timer; | ||
2746 | |||
2747 | if (tp->mac_version <= RTL_GIGA_MAC_VER_01) | ||
2748 | return; | ||
2749 | |||
2750 | del_timer_sync(timer); | ||
2751 | } | ||
2752 | |||
2753 | static inline void rtl8169_request_timer(struct net_device *dev) | ||
2754 | { | ||
2755 | struct rtl8169_private *tp = netdev_priv(dev); | ||
2756 | struct timer_list *timer = &tp->timer; | ||
2757 | |||
2758 | if (tp->mac_version <= RTL_GIGA_MAC_VER_01) | ||
2759 | return; | ||
2760 | |||
2761 | mod_timer(timer, jiffies + RTL8169_PHY_TIMEOUT); | ||
2762 | } | ||
2763 | |||
2764 | #ifdef CONFIG_NET_POLL_CONTROLLER | 2758 | #ifdef CONFIG_NET_POLL_CONTROLLER |
2765 | /* | 2759 | /* |
2766 | * Polling 'interrupt' - used by things like netconsole to send skbs | 2760 | * Polling 'interrupt' - used by things like netconsole to send skbs |
@@ -2828,11 +2822,11 @@ static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp) | |||
2828 | rtl8169_phy_reset(dev, tp); | 2822 | rtl8169_phy_reset(dev, tp); |
2829 | 2823 | ||
2830 | rtl8169_set_speed(dev, AUTONEG_ENABLE, SPEED_1000, DUPLEX_FULL, | 2824 | rtl8169_set_speed(dev, AUTONEG_ENABLE, SPEED_1000, DUPLEX_FULL, |
2831 | ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | | 2825 | ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | |
2832 | ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full | | 2826 | ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full | |
2833 | (tp->mii.supports_gmii ? | 2827 | (tp->mii.supports_gmii ? |
2834 | ADVERTISED_1000baseT_Half | | 2828 | ADVERTISED_1000baseT_Half | |
2835 | ADVERTISED_1000baseT_Full : 0)); | 2829 | ADVERTISED_1000baseT_Full : 0)); |
2836 | 2830 | ||
2837 | if (RTL_R8(PHYstatus) & TBI_Enable) | 2831 | if (RTL_R8(PHYstatus) & TBI_Enable) |
2838 | netif_info(tp, link, dev, "TBI auto-negotiating\n"); | 2832 | netif_info(tp, link, dev, "TBI auto-negotiating\n"); |
@@ -2885,7 +2879,8 @@ static int rtl8169_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
2885 | return netif_running(dev) ? tp->do_ioctl(tp, data, cmd) : -ENODEV; | 2879 | return netif_running(dev) ? tp->do_ioctl(tp, data, cmd) : -ENODEV; |
2886 | } | 2880 | } |
2887 | 2881 | ||
2888 | static int rtl_xmii_ioctl(struct rtl8169_private *tp, struct mii_ioctl_data *data, int cmd) | 2882 | static int rtl_xmii_ioctl(struct rtl8169_private *tp, |
2883 | struct mii_ioctl_data *data, int cmd) | ||
2889 | { | 2884 | { |
2890 | switch (cmd) { | 2885 | switch (cmd) { |
2891 | case SIOCGMIIPHY: | 2886 | case SIOCGMIIPHY: |
@@ -3107,15 +3102,15 @@ static void r8168_pll_power_down(struct rtl8169_private *tp) | |||
3107 | { | 3102 | { |
3108 | void __iomem *ioaddr = tp->mmio_addr; | 3103 | void __iomem *ioaddr = tp->mmio_addr; |
3109 | 3104 | ||
3110 | if (((tp->mac_version == RTL_GIGA_MAC_VER_27) || | 3105 | if ((tp->mac_version == RTL_GIGA_MAC_VER_27 || |
3111 | (tp->mac_version == RTL_GIGA_MAC_VER_28) || | 3106 | tp->mac_version == RTL_GIGA_MAC_VER_28 || |
3112 | (tp->mac_version == RTL_GIGA_MAC_VER_31)) && | 3107 | tp->mac_version == RTL_GIGA_MAC_VER_31) && |
3113 | r8168dp_check_dash(tp)) { | 3108 | r8168dp_check_dash(tp)) { |
3114 | return; | 3109 | return; |
3115 | } | 3110 | } |
3116 | 3111 | ||
3117 | if (((tp->mac_version == RTL_GIGA_MAC_VER_23) || | 3112 | if ((tp->mac_version == RTL_GIGA_MAC_VER_23 || |
3118 | (tp->mac_version == RTL_GIGA_MAC_VER_24)) && | 3113 | tp->mac_version == RTL_GIGA_MAC_VER_24) && |
3119 | (RTL_R16(CPlusCmd) & ASF)) { | 3114 | (RTL_R16(CPlusCmd) & ASF)) { |
3120 | return; | 3115 | return; |
3121 | } | 3116 | } |
@@ -3152,9 +3147,9 @@ static void r8168_pll_power_up(struct rtl8169_private *tp) | |||
3152 | { | 3147 | { |
3153 | void __iomem *ioaddr = tp->mmio_addr; | 3148 | void __iomem *ioaddr = tp->mmio_addr; |
3154 | 3149 | ||
3155 | if (((tp->mac_version == RTL_GIGA_MAC_VER_27) || | 3150 | if ((tp->mac_version == RTL_GIGA_MAC_VER_27 || |
3156 | (tp->mac_version == RTL_GIGA_MAC_VER_28) || | 3151 | tp->mac_version == RTL_GIGA_MAC_VER_28 || |
3157 | (tp->mac_version == RTL_GIGA_MAC_VER_31)) && | 3152 | tp->mac_version == RTL_GIGA_MAC_VER_31) && |
3158 | r8168dp_check_dash(tp)) { | 3153 | r8168dp_check_dash(tp)) { |
3159 | return; | 3154 | return; |
3160 | } | 3155 | } |
@@ -3235,6 +3230,22 @@ static void __devinit rtl_init_pll_power_ops(struct rtl8169_private *tp) | |||
3235 | } | 3230 | } |
3236 | } | 3231 | } |
3237 | 3232 | ||
3233 | static void rtl_hw_reset(struct rtl8169_private *tp) | ||
3234 | { | ||
3235 | void __iomem *ioaddr = tp->mmio_addr; | ||
3236 | int i; | ||
3237 | |||
3238 | /* Soft reset the chip. */ | ||
3239 | RTL_W8(ChipCmd, CmdReset); | ||
3240 | |||
3241 | /* Check that the chip has finished the reset. */ | ||
3242 | for (i = 0; i < 100; i++) { | ||
3243 | if ((RTL_R8(ChipCmd) & CmdReset) == 0) | ||
3244 | break; | ||
3245 | msleep_interruptible(1); | ||
3246 | } | ||
3247 | } | ||
3248 | |||
3238 | static int __devinit | 3249 | static int __devinit |
3239 | rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | 3250 | rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
3240 | { | 3251 | { |
@@ -3334,6 +3345,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3334 | rc = -EIO; | 3345 | rc = -EIO; |
3335 | goto err_out_free_res_3; | 3346 | goto err_out_free_res_3; |
3336 | } | 3347 | } |
3348 | tp->mmio_addr = ioaddr; | ||
3337 | 3349 | ||
3338 | tp->pcie_cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); | 3350 | tp->pcie_cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); |
3339 | if (!tp->pcie_cap) | 3351 | if (!tp->pcie_cap) |
@@ -3341,22 +3353,14 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3341 | 3353 | ||
3342 | RTL_W16(IntrMask, 0x0000); | 3354 | RTL_W16(IntrMask, 0x0000); |
3343 | 3355 | ||
3344 | /* Soft reset the chip. */ | 3356 | rtl_hw_reset(tp); |
3345 | RTL_W8(ChipCmd, CmdReset); | ||
3346 | |||
3347 | /* Check that the chip has finished the reset. */ | ||
3348 | for (i = 0; i < 100; i++) { | ||
3349 | if ((RTL_R8(ChipCmd) & CmdReset) == 0) | ||
3350 | break; | ||
3351 | msleep_interruptible(1); | ||
3352 | } | ||
3353 | 3357 | ||
3354 | RTL_W16(IntrStatus, 0xffff); | 3358 | RTL_W16(IntrStatus, 0xffff); |
3355 | 3359 | ||
3356 | pci_set_master(pdev); | 3360 | pci_set_master(pdev); |
3357 | 3361 | ||
3358 | /* Identify chip attached to board */ | 3362 | /* Identify chip attached to board */ |
3359 | rtl8169_get_mac_version(tp, ioaddr); | 3363 | rtl8169_get_mac_version(tp, dev, cfg->default_ver); |
3360 | 3364 | ||
3361 | /* | 3365 | /* |
3362 | * Pretend we are using VLANs; This bypasses a nasty bug where | 3366 | * Pretend we are using VLANs; This bypasses a nasty bug where |
@@ -3368,26 +3372,10 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3368 | rtl_init_mdio_ops(tp); | 3372 | rtl_init_mdio_ops(tp); |
3369 | rtl_init_pll_power_ops(tp); | 3373 | rtl_init_pll_power_ops(tp); |
3370 | 3374 | ||
3371 | /* Use appropriate default if unknown */ | ||
3372 | if (tp->mac_version == RTL_GIGA_MAC_NONE) { | ||
3373 | netif_notice(tp, probe, dev, | ||
3374 | "unknown MAC, using family default\n"); | ||
3375 | tp->mac_version = cfg->default_ver; | ||
3376 | } | ||
3377 | |||
3378 | rtl8169_print_mac_version(tp); | 3375 | rtl8169_print_mac_version(tp); |
3379 | 3376 | ||
3380 | for (i = 0; i < ARRAY_SIZE(rtl_chip_info); i++) { | 3377 | chipset = tp->mac_version; |
3381 | if (tp->mac_version == rtl_chip_info[i].mac_version) | 3378 | tp->txd_version = rtl_chip_infos[chipset].txd_version; |
3382 | break; | ||
3383 | } | ||
3384 | if (i == ARRAY_SIZE(rtl_chip_info)) { | ||
3385 | dev_err(&pdev->dev, | ||
3386 | "driver bug, MAC version not found in rtl_chip_info\n"); | ||
3387 | goto err_out_msi_4; | ||
3388 | } | ||
3389 | chipset = i; | ||
3390 | tp->txd_version = rtl_chip_info[chipset].txd_version; | ||
3391 | 3379 | ||
3392 | RTL_W8(Cfg9346, Cfg9346_Unlock); | 3380 | RTL_W8(Cfg9346, Cfg9346_Unlock); |
3393 | RTL_W8(Config1, RTL_R8(Config1) | PMEnable); | 3381 | RTL_W8(Config1, RTL_R8(Config1) | PMEnable); |
@@ -3407,8 +3395,6 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3407 | tp->phy_reset_pending = rtl8169_tbi_reset_pending; | 3395 | tp->phy_reset_pending = rtl8169_tbi_reset_pending; |
3408 | tp->link_ok = rtl8169_tbi_link_ok; | 3396 | tp->link_ok = rtl8169_tbi_link_ok; |
3409 | tp->do_ioctl = rtl_tbi_ioctl; | 3397 | tp->do_ioctl = rtl_tbi_ioctl; |
3410 | |||
3411 | tp->phy_1000_ctrl_reg = ADVERTISE_1000FULL; /* Implied by TBI */ | ||
3412 | } else { | 3398 | } else { |
3413 | tp->set_speed = rtl8169_set_speed_xmii; | 3399 | tp->set_speed = rtl8169_set_speed_xmii; |
3414 | tp->get_settings = rtl8169_gset_xmii; | 3400 | tp->get_settings = rtl8169_gset_xmii; |
@@ -3420,8 +3406,6 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3420 | 3406 | ||
3421 | spin_lock_init(&tp->lock); | 3407 | spin_lock_init(&tp->lock); |
3422 | 3408 | ||
3423 | tp->mmio_addr = ioaddr; | ||
3424 | |||
3425 | /* Get MAC address */ | 3409 | /* Get MAC address */ |
3426 | for (i = 0; i < MAC_ADDR_LEN; i++) | 3410 | for (i = 0; i < MAC_ADDR_LEN; i++) |
3427 | dev->dev_addr[i] = RTL_R8(MAC0 + i); | 3411 | dev->dev_addr[i] = RTL_R8(MAC0 + i); |
@@ -3466,12 +3450,12 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3466 | pci_set_drvdata(pdev, dev); | 3450 | pci_set_drvdata(pdev, dev); |
3467 | 3451 | ||
3468 | netif_info(tp, probe, dev, "%s at 0x%lx, %pM, XID %08x IRQ %d\n", | 3452 | netif_info(tp, probe, dev, "%s at 0x%lx, %pM, XID %08x IRQ %d\n", |
3469 | rtl_chip_info[chipset].name, dev->base_addr, dev->dev_addr, | 3453 | rtl_chip_infos[chipset].name, dev->base_addr, dev->dev_addr, |
3470 | (u32)(RTL_R32(TxConfig) & 0x9cf0f8ff), dev->irq); | 3454 | (u32)(RTL_R32(TxConfig) & 0x9cf0f8ff), dev->irq); |
3471 | 3455 | ||
3472 | if ((tp->mac_version == RTL_GIGA_MAC_VER_27) || | 3456 | if (tp->mac_version == RTL_GIGA_MAC_VER_27 || |
3473 | (tp->mac_version == RTL_GIGA_MAC_VER_28) || | 3457 | tp->mac_version == RTL_GIGA_MAC_VER_28 || |
3474 | (tp->mac_version == RTL_GIGA_MAC_VER_31)) { | 3458 | tp->mac_version == RTL_GIGA_MAC_VER_31) { |
3475 | rtl8168_driver_start(tp); | 3459 | rtl8168_driver_start(tp); |
3476 | } | 3460 | } |
3477 | 3461 | ||
@@ -3503,9 +3487,9 @@ static void __devexit rtl8169_remove_one(struct pci_dev *pdev) | |||
3503 | struct net_device *dev = pci_get_drvdata(pdev); | 3487 | struct net_device *dev = pci_get_drvdata(pdev); |
3504 | struct rtl8169_private *tp = netdev_priv(dev); | 3488 | struct rtl8169_private *tp = netdev_priv(dev); |
3505 | 3489 | ||
3506 | if ((tp->mac_version == RTL_GIGA_MAC_VER_27) || | 3490 | if (tp->mac_version == RTL_GIGA_MAC_VER_27 || |
3507 | (tp->mac_version == RTL_GIGA_MAC_VER_28) || | 3491 | tp->mac_version == RTL_GIGA_MAC_VER_28 || |
3508 | (tp->mac_version == RTL_GIGA_MAC_VER_31)) { | 3492 | tp->mac_version == RTL_GIGA_MAC_VER_31) { |
3509 | rtl8168_driver_stop(tp); | 3493 | rtl8168_driver_stop(tp); |
3510 | } | 3494 | } |
3511 | 3495 | ||
@@ -3528,33 +3512,23 @@ static void __devexit rtl8169_remove_one(struct pci_dev *pdev) | |||
3528 | 3512 | ||
3529 | static void rtl_request_firmware(struct rtl8169_private *tp) | 3513 | static void rtl_request_firmware(struct rtl8169_private *tp) |
3530 | { | 3514 | { |
3531 | int i; | ||
3532 | |||
3533 | /* Return early if the firmware is already loaded / cached. */ | 3515 | /* Return early if the firmware is already loaded / cached. */ |
3534 | if (!IS_ERR(tp->fw)) | 3516 | if (IS_ERR(tp->fw)) { |
3535 | goto out; | 3517 | const char *name; |
3536 | |||
3537 | for (i = 0; i < ARRAY_SIZE(rtl_firmware_infos); i++) { | ||
3538 | const struct rtl_firmware_info *info = rtl_firmware_infos + i; | ||
3539 | 3518 | ||
3540 | if (info->mac_version == tp->mac_version) { | 3519 | name = rtl_lookup_firmware_name(tp); |
3541 | const char *name = info->fw_name; | 3520 | if (name) { |
3542 | int rc; | 3521 | int rc; |
3543 | 3522 | ||
3544 | rc = request_firmware(&tp->fw, name, &tp->pci_dev->dev); | 3523 | rc = request_firmware(&tp->fw, name, &tp->pci_dev->dev); |
3545 | if (rc < 0) { | 3524 | if (rc >= 0) |
3546 | netif_warn(tp, ifup, tp->dev, "unable to load " | 3525 | return; |
3547 | "firmware patch %s (%d)\n", name, rc); | 3526 | |
3548 | goto out_disable_request_firmware; | 3527 | netif_warn(tp, ifup, tp->dev, "unable to load " |
3549 | } | 3528 | "firmware patch %s (%d)\n", name, rc); |
3550 | goto out; | ||
3551 | } | 3529 | } |
3530 | tp->fw = NULL; | ||
3552 | } | 3531 | } |
3553 | |||
3554 | out_disable_request_firmware: | ||
3555 | tp->fw = NULL; | ||
3556 | out: | ||
3557 | return; | ||
3558 | } | 3532 | } |
3559 | 3533 | ||
3560 | static int rtl8169_open(struct net_device *dev) | 3534 | static int rtl8169_open(struct net_device *dev) |
@@ -3606,8 +3580,6 @@ static int rtl8169_open(struct net_device *dev) | |||
3606 | 3580 | ||
3607 | rtl_hw_start(dev); | 3581 | rtl_hw_start(dev); |
3608 | 3582 | ||
3609 | rtl8169_request_timer(dev); | ||
3610 | |||
3611 | tp->saved_wolopts = 0; | 3583 | tp->saved_wolopts = 0; |
3612 | pm_runtime_put_noidle(&pdev->dev); | 3584 | pm_runtime_put_noidle(&pdev->dev); |
3613 | 3585 | ||
@@ -3669,25 +3641,14 @@ static void rtl_set_rx_tx_config_registers(struct rtl8169_private *tp) | |||
3669 | static void rtl_hw_start(struct net_device *dev) | 3641 | static void rtl_hw_start(struct net_device *dev) |
3670 | { | 3642 | { |
3671 | struct rtl8169_private *tp = netdev_priv(dev); | 3643 | struct rtl8169_private *tp = netdev_priv(dev); |
3672 | void __iomem *ioaddr = tp->mmio_addr; | ||
3673 | unsigned int i; | ||
3674 | |||
3675 | /* Soft reset the chip. */ | ||
3676 | RTL_W8(ChipCmd, CmdReset); | ||
3677 | 3644 | ||
3678 | /* Check that the chip has finished the reset. */ | 3645 | rtl_hw_reset(tp); |
3679 | for (i = 0; i < 100; i++) { | ||
3680 | if ((RTL_R8(ChipCmd) & CmdReset) == 0) | ||
3681 | break; | ||
3682 | msleep_interruptible(1); | ||
3683 | } | ||
3684 | 3646 | ||
3685 | tp->hw_start(dev); | 3647 | tp->hw_start(dev); |
3686 | 3648 | ||
3687 | netif_start_queue(dev); | 3649 | netif_start_queue(dev); |
3688 | } | 3650 | } |
3689 | 3651 | ||
3690 | |||
3691 | static void rtl_set_rx_tx_desc_registers(struct rtl8169_private *tp, | 3652 | static void rtl_set_rx_tx_desc_registers(struct rtl8169_private *tp, |
3692 | void __iomem *ioaddr) | 3653 | void __iomem *ioaddr) |
3693 | { | 3654 | { |
@@ -3753,26 +3714,26 @@ static void rtl_hw_start_8169(struct net_device *dev) | |||
3753 | } | 3714 | } |
3754 | 3715 | ||
3755 | RTL_W8(Cfg9346, Cfg9346_Unlock); | 3716 | RTL_W8(Cfg9346, Cfg9346_Unlock); |
3756 | if ((tp->mac_version == RTL_GIGA_MAC_VER_01) || | 3717 | if (tp->mac_version == RTL_GIGA_MAC_VER_01 || |
3757 | (tp->mac_version == RTL_GIGA_MAC_VER_02) || | 3718 | tp->mac_version == RTL_GIGA_MAC_VER_02 || |
3758 | (tp->mac_version == RTL_GIGA_MAC_VER_03) || | 3719 | tp->mac_version == RTL_GIGA_MAC_VER_03 || |
3759 | (tp->mac_version == RTL_GIGA_MAC_VER_04)) | 3720 | tp->mac_version == RTL_GIGA_MAC_VER_04) |
3760 | RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); | 3721 | RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); |
3761 | 3722 | ||
3762 | RTL_W8(EarlyTxThres, NoEarlyTx); | 3723 | RTL_W8(EarlyTxThres, NoEarlyTx); |
3763 | 3724 | ||
3764 | rtl_set_rx_max_size(ioaddr, rx_buf_sz); | 3725 | rtl_set_rx_max_size(ioaddr, rx_buf_sz); |
3765 | 3726 | ||
3766 | if ((tp->mac_version == RTL_GIGA_MAC_VER_01) || | 3727 | if (tp->mac_version == RTL_GIGA_MAC_VER_01 || |
3767 | (tp->mac_version == RTL_GIGA_MAC_VER_02) || | 3728 | tp->mac_version == RTL_GIGA_MAC_VER_02 || |
3768 | (tp->mac_version == RTL_GIGA_MAC_VER_03) || | 3729 | tp->mac_version == RTL_GIGA_MAC_VER_03 || |
3769 | (tp->mac_version == RTL_GIGA_MAC_VER_04)) | 3730 | tp->mac_version == RTL_GIGA_MAC_VER_04) |
3770 | rtl_set_rx_tx_config_registers(tp); | 3731 | rtl_set_rx_tx_config_registers(tp); |
3771 | 3732 | ||
3772 | tp->cp_cmd |= rtl_rw_cpluscmd(ioaddr) | PCIMulRW; | 3733 | tp->cp_cmd |= rtl_rw_cpluscmd(ioaddr) | PCIMulRW; |
3773 | 3734 | ||
3774 | if ((tp->mac_version == RTL_GIGA_MAC_VER_02) || | 3735 | if (tp->mac_version == RTL_GIGA_MAC_VER_02 || |
3775 | (tp->mac_version == RTL_GIGA_MAC_VER_03)) { | 3736 | tp->mac_version == RTL_GIGA_MAC_VER_03) { |
3776 | dprintk("Set MAC Reg C+CR Offset 0xE0. " | 3737 | dprintk("Set MAC Reg C+CR Offset 0xE0. " |
3777 | "Bit-3 and bit-14 MUST be 1\n"); | 3738 | "Bit-3 and bit-14 MUST be 1\n"); |
3778 | tp->cp_cmd |= (1 << 14); | 3739 | tp->cp_cmd |= (1 << 14); |
@@ -3790,10 +3751,10 @@ static void rtl_hw_start_8169(struct net_device *dev) | |||
3790 | 3751 | ||
3791 | rtl_set_rx_tx_desc_registers(tp, ioaddr); | 3752 | rtl_set_rx_tx_desc_registers(tp, ioaddr); |
3792 | 3753 | ||
3793 | if ((tp->mac_version != RTL_GIGA_MAC_VER_01) && | 3754 | if (tp->mac_version != RTL_GIGA_MAC_VER_01 && |
3794 | (tp->mac_version != RTL_GIGA_MAC_VER_02) && | 3755 | tp->mac_version != RTL_GIGA_MAC_VER_02 && |
3795 | (tp->mac_version != RTL_GIGA_MAC_VER_03) && | 3756 | tp->mac_version != RTL_GIGA_MAC_VER_03 && |
3796 | (tp->mac_version != RTL_GIGA_MAC_VER_04)) { | 3757 | tp->mac_version != RTL_GIGA_MAC_VER_04) { |
3797 | RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); | 3758 | RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); |
3798 | rtl_set_rx_tx_config_registers(tp); | 3759 | rtl_set_rx_tx_config_registers(tp); |
3799 | } | 3760 | } |
@@ -4103,10 +4064,10 @@ static void rtl_hw_start_8168e(void __iomem *ioaddr, struct pci_dev *pdev) | |||
4103 | rtl_disable_clock_request(pdev); | 4064 | rtl_disable_clock_request(pdev); |
4104 | 4065 | ||
4105 | /* Reset tx FIFO pointer */ | 4066 | /* Reset tx FIFO pointer */ |
4106 | RTL_W32(MISC, RTL_R32(MISC) | txpla_rst); | 4067 | RTL_W32(MISC, RTL_R32(MISC) | TXPLA_RST); |
4107 | RTL_W32(MISC, RTL_R32(MISC) & ~txpla_rst); | 4068 | RTL_W32(MISC, RTL_R32(MISC) & ~TXPLA_RST); |
4108 | 4069 | ||
4109 | RTL_W8(Config5, RTL_R8(Config5) & ~spi_en); | 4070 | RTL_W8(Config5, RTL_R8(Config5) & ~Spi_en); |
4110 | } | 4071 | } |
4111 | 4072 | ||
4112 | static void rtl_hw_start_8168(struct net_device *dev) | 4073 | static void rtl_hw_start_8168(struct net_device *dev) |
@@ -4190,6 +4151,7 @@ static void rtl_hw_start_8168(struct net_device *dev) | |||
4190 | case RTL_GIGA_MAC_VER_28: | 4151 | case RTL_GIGA_MAC_VER_28: |
4191 | rtl_hw_start_8168d_4(ioaddr, pdev); | 4152 | rtl_hw_start_8168d_4(ioaddr, pdev); |
4192 | break; | 4153 | break; |
4154 | |||
4193 | case RTL_GIGA_MAC_VER_31: | 4155 | case RTL_GIGA_MAC_VER_31: |
4194 | rtl_hw_start_8168dp(ioaddr, pdev); | 4156 | rtl_hw_start_8168dp(ioaddr, pdev); |
4195 | break; | 4157 | break; |
@@ -4286,10 +4248,10 @@ static void rtl_hw_start_8105e_1(void __iomem *ioaddr, struct pci_dev *pdev) | |||
4286 | { 0x0a, 0, 0x0020 } | 4248 | { 0x0a, 0, 0x0020 } |
4287 | }; | 4249 | }; |
4288 | 4250 | ||
4289 | /* Force LAN exit from ASPM if Rx/Tx are not idel */ | 4251 | /* Force LAN exit from ASPM if Rx/Tx are not idle */ |
4290 | RTL_W32(FuncEvent, RTL_R32(FuncEvent) | 0x002800); | 4252 | RTL_W32(FuncEvent, RTL_R32(FuncEvent) | 0x002800); |
4291 | 4253 | ||
4292 | /* disable Early Tally Counter */ | 4254 | /* Disable Early Tally Counter */ |
4293 | RTL_W32(FuncEvent, RTL_R32(FuncEvent) & ~0x010000); | 4255 | RTL_W32(FuncEvent, RTL_R32(FuncEvent) & ~0x010000); |
4294 | 4256 | ||
4295 | RTL_W8(MCU, RTL_R8(MCU) | EN_NDP | EN_OOB_RESET); | 4257 | RTL_W8(MCU, RTL_R8(MCU) | EN_NDP | EN_OOB_RESET); |
@@ -4310,8 +4272,8 @@ static void rtl_hw_start_8101(struct net_device *dev) | |||
4310 | void __iomem *ioaddr = tp->mmio_addr; | 4272 | void __iomem *ioaddr = tp->mmio_addr; |
4311 | struct pci_dev *pdev = tp->pci_dev; | 4273 | struct pci_dev *pdev = tp->pci_dev; |
4312 | 4274 | ||
4313 | if ((tp->mac_version == RTL_GIGA_MAC_VER_13) || | 4275 | if (tp->mac_version == RTL_GIGA_MAC_VER_13 || |
4314 | (tp->mac_version == RTL_GIGA_MAC_VER_16)) { | 4276 | tp->mac_version == RTL_GIGA_MAC_VER_16) { |
4315 | int cap = tp->pcie_cap; | 4277 | int cap = tp->pcie_cap; |
4316 | 4278 | ||
4317 | if (cap) { | 4279 | if (cap) { |
@@ -4613,6 +4575,7 @@ static void rtl8169_reset_task(struct work_struct *work) | |||
4613 | struct rtl8169_private *tp = | 4575 | struct rtl8169_private *tp = |
4614 | container_of(work, struct rtl8169_private, task.work); | 4576 | container_of(work, struct rtl8169_private, task.work); |
4615 | struct net_device *dev = tp->dev; | 4577 | struct net_device *dev = tp->dev; |
4578 | int i; | ||
4616 | 4579 | ||
4617 | rtnl_lock(); | 4580 | rtnl_lock(); |
4618 | 4581 | ||
@@ -4621,19 +4584,15 @@ static void rtl8169_reset_task(struct work_struct *work) | |||
4621 | 4584 | ||
4622 | rtl8169_wait_for_quiescence(dev); | 4585 | rtl8169_wait_for_quiescence(dev); |
4623 | 4586 | ||
4624 | rtl8169_rx_interrupt(dev, tp, tp->mmio_addr, ~(u32)0); | 4587 | for (i = 0; i < NUM_RX_DESC; i++) |
4588 | rtl8169_mark_to_asic(tp->RxDescArray + i, rx_buf_sz); | ||
4589 | |||
4625 | rtl8169_tx_clear(tp); | 4590 | rtl8169_tx_clear(tp); |
4626 | 4591 | ||
4627 | if (tp->dirty_rx == tp->cur_rx) { | 4592 | rtl8169_init_ring_indexes(tp); |
4628 | rtl8169_init_ring_indexes(tp); | 4593 | rtl_hw_start(dev); |
4629 | rtl_hw_start(dev); | 4594 | netif_wake_queue(dev); |
4630 | netif_wake_queue(dev); | 4595 | rtl8169_check_link_status(dev, tp, tp->mmio_addr); |
4631 | rtl8169_check_link_status(dev, tp, tp->mmio_addr); | ||
4632 | } else { | ||
4633 | if (net_ratelimit()) | ||
4634 | netif_emerg(tp, intr, dev, "Rx buffers shortage\n"); | ||
4635 | rtl8169_schedule_work(dev, rtl8169_reset_task); | ||
4636 | } | ||
4637 | 4596 | ||
4638 | out_unlock: | 4597 | out_unlock: |
4639 | rtnl_unlock(); | 4598 | rtnl_unlock(); |
@@ -4677,7 +4636,7 @@ static int rtl8169_xmit_frags(struct rtl8169_private *tp, struct sk_buff *skb, | |||
4677 | goto err_out; | 4636 | goto err_out; |
4678 | } | 4637 | } |
4679 | 4638 | ||
4680 | /* anti gcc 2.95.3 bugware (sic) */ | 4639 | /* Anti gcc 2.95.3 bugware (sic) */ |
4681 | status = opts[0] | len | | 4640 | status = opts[0] | len | |
4682 | (RingEnd * !((entry + 1) % NUM_TX_DESC)); | 4641 | (RingEnd * !((entry + 1) % NUM_TX_DESC)); |
4683 | 4642 | ||
@@ -4773,7 +4732,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | |||
4773 | 4732 | ||
4774 | wmb(); | 4733 | wmb(); |
4775 | 4734 | ||
4776 | /* anti gcc 2.95.3 bugware (sic) */ | 4735 | /* Anti gcc 2.95.3 bugware (sic) */ |
4777 | status = opts[0] | len | (RingEnd * !((entry + 1) % NUM_TX_DESC)); | 4736 | status = opts[0] | len | (RingEnd * !((entry + 1) % NUM_TX_DESC)); |
4778 | txd->opts1 = cpu_to_le32(status); | 4737 | txd->opts1 = cpu_to_le32(status); |
4779 | 4738 | ||
@@ -4781,7 +4740,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | |||
4781 | 4740 | ||
4782 | wmb(); | 4741 | wmb(); |
4783 | 4742 | ||
4784 | RTL_W8(TxPoll, NPQ); /* set polling bit */ | 4743 | RTL_W8(TxPoll, NPQ); |
4785 | 4744 | ||
4786 | if (TX_BUFFS_AVAIL(tp) < MAX_SKB_FRAGS) { | 4745 | if (TX_BUFFS_AVAIL(tp) < MAX_SKB_FRAGS) { |
4787 | netif_stop_queue(dev); | 4746 | netif_stop_queue(dev); |
@@ -4938,20 +4897,12 @@ static struct sk_buff *rtl8169_try_rx_copy(void *data, | |||
4938 | return skb; | 4897 | return skb; |
4939 | } | 4898 | } |
4940 | 4899 | ||
4941 | /* | ||
4942 | * Warning : rtl8169_rx_interrupt() might be called : | ||
4943 | * 1) from NAPI (softirq) context | ||
4944 | * (polling = 1 : we should call netif_receive_skb()) | ||
4945 | * 2) from process context (rtl8169_reset_task()) | ||
4946 | * (polling = 0 : we must call netif_rx() instead) | ||
4947 | */ | ||
4948 | static int rtl8169_rx_interrupt(struct net_device *dev, | 4900 | static int rtl8169_rx_interrupt(struct net_device *dev, |
4949 | struct rtl8169_private *tp, | 4901 | struct rtl8169_private *tp, |
4950 | void __iomem *ioaddr, u32 budget) | 4902 | void __iomem *ioaddr, u32 budget) |
4951 | { | 4903 | { |
4952 | unsigned int cur_rx, rx_left; | 4904 | unsigned int cur_rx, rx_left; |
4953 | unsigned int count; | 4905 | unsigned int count; |
4954 | int polling = (budget != ~(u32)0) ? 1 : 0; | ||
4955 | 4906 | ||
4956 | cur_rx = tp->cur_rx; | 4907 | cur_rx = tp->cur_rx; |
4957 | rx_left = NUM_RX_DESC + tp->dirty_rx - cur_rx; | 4908 | rx_left = NUM_RX_DESC + tp->dirty_rx - cur_rx; |
@@ -5011,10 +4962,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev, | |||
5011 | 4962 | ||
5012 | rtl8169_rx_vlan_tag(desc, skb); | 4963 | rtl8169_rx_vlan_tag(desc, skb); |
5013 | 4964 | ||
5014 | if (likely(polling)) | 4965 | napi_gro_receive(&tp->napi, skb); |
5015 | napi_gro_receive(&tp->napi, skb); | ||
5016 | else | ||
5017 | netif_rx(skb); | ||
5018 | 4966 | ||
5019 | dev->stats.rx_bytes += pkt_size; | 4967 | dev->stats.rx_bytes += pkt_size; |
5020 | dev->stats.rx_packets++; | 4968 | dev->stats.rx_packets++; |
@@ -5170,7 +5118,7 @@ static void rtl8169_down(struct net_device *dev) | |||
5170 | struct rtl8169_private *tp = netdev_priv(dev); | 5118 | struct rtl8169_private *tp = netdev_priv(dev); |
5171 | void __iomem *ioaddr = tp->mmio_addr; | 5119 | void __iomem *ioaddr = tp->mmio_addr; |
5172 | 5120 | ||
5173 | rtl8169_delete_timer(dev); | 5121 | del_timer_sync(&tp->timer); |
5174 | 5122 | ||
5175 | netif_stop_queue(dev); | 5123 | netif_stop_queue(dev); |
5176 | 5124 | ||
@@ -5207,7 +5155,7 @@ static int rtl8169_close(struct net_device *dev) | |||
5207 | 5155 | ||
5208 | pm_runtime_get_sync(&pdev->dev); | 5156 | pm_runtime_get_sync(&pdev->dev); |
5209 | 5157 | ||
5210 | /* update counters before going down */ | 5158 | /* Update counters before going down */ |
5211 | rtl8169_update_counters(dev); | 5159 | rtl8169_update_counters(dev); |
5212 | 5160 | ||
5213 | rtl8169_down(dev); | 5161 | rtl8169_down(dev); |
@@ -5400,15 +5348,15 @@ static int rtl8169_runtime_idle(struct device *device) | |||
5400 | } | 5348 | } |
5401 | 5349 | ||
5402 | static const struct dev_pm_ops rtl8169_pm_ops = { | 5350 | static const struct dev_pm_ops rtl8169_pm_ops = { |
5403 | .suspend = rtl8169_suspend, | 5351 | .suspend = rtl8169_suspend, |
5404 | .resume = rtl8169_resume, | 5352 | .resume = rtl8169_resume, |
5405 | .freeze = rtl8169_suspend, | 5353 | .freeze = rtl8169_suspend, |
5406 | .thaw = rtl8169_resume, | 5354 | .thaw = rtl8169_resume, |
5407 | .poweroff = rtl8169_suspend, | 5355 | .poweroff = rtl8169_suspend, |
5408 | .restore = rtl8169_resume, | 5356 | .restore = rtl8169_resume, |
5409 | .runtime_suspend = rtl8169_runtime_suspend, | 5357 | .runtime_suspend = rtl8169_runtime_suspend, |
5410 | .runtime_resume = rtl8169_runtime_resume, | 5358 | .runtime_resume = rtl8169_runtime_resume, |
5411 | .runtime_idle = rtl8169_runtime_idle, | 5359 | .runtime_idle = rtl8169_runtime_idle, |
5412 | }; | 5360 | }; |
5413 | 5361 | ||
5414 | #define RTL8169_PM_OPS (&rtl8169_pm_ops) | 5362 | #define RTL8169_PM_OPS (&rtl8169_pm_ops) |
@@ -5427,7 +5375,7 @@ static void rtl_shutdown(struct pci_dev *pdev) | |||
5427 | 5375 | ||
5428 | rtl8169_net_suspend(dev); | 5376 | rtl8169_net_suspend(dev); |
5429 | 5377 | ||
5430 | /* restore original MAC address */ | 5378 | /* Restore original MAC address */ |
5431 | rtl_rar_set(tp, dev->perm_addr); | 5379 | rtl_rar_set(tp, dev->perm_addr); |
5432 | 5380 | ||
5433 | spin_lock_irq(&tp->lock); | 5381 | spin_lock_irq(&tp->lock); |
diff --git a/drivers/net/tulip/21142.c b/drivers/net/tulip/21142.c index 007d8e75666d..092c3faa882a 100644 --- a/drivers/net/tulip/21142.c +++ b/drivers/net/tulip/21142.c | |||
@@ -122,8 +122,8 @@ void t21142_start_nway(struct net_device *dev) | |||
122 | tp->nway = tp->mediasense = 1; | 122 | tp->nway = tp->mediasense = 1; |
123 | tp->nwayset = tp->lpar = 0; | 123 | tp->nwayset = tp->lpar = 0; |
124 | if (tulip_debug > 1) | 124 | if (tulip_debug > 1) |
125 | printk(KERN_DEBUG "%s: Restarting 21143 autonegotiation, csr14=%08x\n", | 125 | netdev_dbg(dev, "Restarting 21143 autonegotiation, csr14=%08x\n", |
126 | dev->name, csr14); | 126 | csr14); |
127 | iowrite32(0x0001, ioaddr + CSR13); | 127 | iowrite32(0x0001, ioaddr + CSR13); |
128 | udelay(100); | 128 | udelay(100); |
129 | iowrite32(csr14, ioaddr + CSR14); | 129 | iowrite32(csr14, ioaddr + CSR14); |
@@ -206,14 +206,14 @@ void t21142_lnk_change(struct net_device *dev, int csr5) | |||
206 | #if 0 /* Restart shouldn't be needed. */ | 206 | #if 0 /* Restart shouldn't be needed. */ |
207 | iowrite32(tp->csr6 | RxOn, ioaddr + CSR6); | 207 | iowrite32(tp->csr6 | RxOn, ioaddr + CSR6); |
208 | if (tulip_debug > 2) | 208 | if (tulip_debug > 2) |
209 | printk(KERN_DEBUG "%s: Restarting Tx and Rx, CSR5 is %08x\n", | 209 | netdev_dbg(dev, " Restarting Tx and Rx, CSR5 is %08x\n", |
210 | dev->name, ioread32(ioaddr + CSR5)); | 210 | ioread32(ioaddr + CSR5)); |
211 | #endif | 211 | #endif |
212 | tulip_start_rxtx(tp); | 212 | tulip_start_rxtx(tp); |
213 | if (tulip_debug > 2) | 213 | if (tulip_debug > 2) |
214 | printk(KERN_DEBUG "%s: Setting CSR6 %08x/%x CSR12 %08x\n", | 214 | netdev_dbg(dev, " Setting CSR6 %08x/%x CSR12 %08x\n", |
215 | dev->name, tp->csr6, ioread32(ioaddr + CSR6), | 215 | tp->csr6, ioread32(ioaddr + CSR6), |
216 | ioread32(ioaddr + CSR12)); | 216 | ioread32(ioaddr + CSR12)); |
217 | } else if ((tp->nwayset && (csr5 & 0x08000000) && | 217 | } else if ((tp->nwayset && (csr5 & 0x08000000) && |
218 | (dev->if_port == 3 || dev->if_port == 5) && | 218 | (dev->if_port == 3 || dev->if_port == 5) && |
219 | (csr12 & 2) == 2) || | 219 | (csr12 & 2) == 2) || |
diff --git a/drivers/net/tulip/Makefile b/drivers/net/tulip/Makefile index 200cbf7c815c..5e8be38b45bb 100644 --- a/drivers/net/tulip/Makefile +++ b/drivers/net/tulip/Makefile | |||
@@ -2,6 +2,8 @@ | |||
2 | # Makefile for the Linux "Tulip" family network device drivers. | 2 | # Makefile for the Linux "Tulip" family network device drivers. |
3 | # | 3 | # |
4 | 4 | ||
5 | ccflags-$(CONFIG_NET_TULIP) := -DDEBUG | ||
6 | |||
5 | obj-$(CONFIG_PCMCIA_XIRCOM) += xircom_cb.o | 7 | obj-$(CONFIG_PCMCIA_XIRCOM) += xircom_cb.o |
6 | obj-$(CONFIG_DM9102) += dmfe.o | 8 | obj-$(CONFIG_DM9102) += dmfe.o |
7 | obj-$(CONFIG_WINBOND_840) += winbond-840.o | 9 | obj-$(CONFIG_WINBOND_840) += winbond-840.o |
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index 46d5a1b15036..e2f692351180 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c | |||
@@ -27,6 +27,8 @@ | |||
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
31 | |||
30 | #define DRV_NAME "de2104x" | 32 | #define DRV_NAME "de2104x" |
31 | #define DRV_VERSION "0.7" | 33 | #define DRV_VERSION "0.7" |
32 | #define DRV_RELDATE "Mar 17, 2004" | 34 | #define DRV_RELDATE "Mar 17, 2004" |
@@ -51,7 +53,7 @@ | |||
51 | 53 | ||
52 | /* These identify the driver base version and may not be removed. */ | 54 | /* These identify the driver base version and may not be removed. */ |
53 | static char version[] = | 55 | static char version[] = |
54 | KERN_INFO DRV_NAME " PCI Ethernet driver v" DRV_VERSION " (" DRV_RELDATE ")\n"; | 56 | "PCI Ethernet driver v" DRV_VERSION " (" DRV_RELDATE ")"; |
55 | 57 | ||
56 | MODULE_AUTHOR("Jeff Garzik <jgarzik@pobox.com>"); | 58 | MODULE_AUTHOR("Jeff Garzik <jgarzik@pobox.com>"); |
57 | MODULE_DESCRIPTION("Intel/Digital 21040/1 series PCI Ethernet driver"); | 59 | MODULE_DESCRIPTION("Intel/Digital 21040/1 series PCI Ethernet driver"); |
@@ -73,8 +75,6 @@ static int rx_copybreak = 100; | |||
73 | module_param (rx_copybreak, int, 0); | 75 | module_param (rx_copybreak, int, 0); |
74 | MODULE_PARM_DESC (rx_copybreak, "de2104x Breakpoint at which Rx packets are copied"); | 76 | MODULE_PARM_DESC (rx_copybreak, "de2104x Breakpoint at which Rx packets are copied"); |
75 | 77 | ||
76 | #define PFX DRV_NAME ": " | ||
77 | |||
78 | #define DE_DEF_MSG_ENABLE (NETIF_MSG_DRV | \ | 78 | #define DE_DEF_MSG_ENABLE (NETIF_MSG_DRV | \ |
79 | NETIF_MSG_PROBE | \ | 79 | NETIF_MSG_PROBE | \ |
80 | NETIF_MSG_LINK | \ | 80 | NETIF_MSG_LINK | \ |
@@ -377,18 +377,16 @@ static u16 t21041_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, }; | |||
377 | static void de_rx_err_acct (struct de_private *de, unsigned rx_tail, | 377 | static void de_rx_err_acct (struct de_private *de, unsigned rx_tail, |
378 | u32 status, u32 len) | 378 | u32 status, u32 len) |
379 | { | 379 | { |
380 | if (netif_msg_rx_err (de)) | 380 | netif_dbg(de, rx_err, de->dev, |
381 | printk (KERN_DEBUG | 381 | "rx err, slot %d status 0x%x len %d\n", |
382 | "%s: rx err, slot %d status 0x%x len %d\n", | 382 | rx_tail, status, len); |
383 | de->dev->name, rx_tail, status, len); | ||
384 | 383 | ||
385 | if ((status & 0x38000300) != 0x0300) { | 384 | if ((status & 0x38000300) != 0x0300) { |
386 | /* Ingore earlier buffers. */ | 385 | /* Ingore earlier buffers. */ |
387 | if ((status & 0xffff) != 0x7fff) { | 386 | if ((status & 0xffff) != 0x7fff) { |
388 | if (netif_msg_rx_err(de)) | 387 | netif_warn(de, rx_err, de->dev, |
389 | dev_warn(&de->dev->dev, | 388 | "Oversized Ethernet frame spanned multiple buffers, status %08x!\n", |
390 | "Oversized Ethernet frame spanned multiple buffers, status %08x!\n", | 389 | status); |
391 | status); | ||
392 | de->net_stats.rx_length_errors++; | 390 | de->net_stats.rx_length_errors++; |
393 | } | 391 | } |
394 | } else if (status & RxError) { | 392 | } else if (status & RxError) { |
@@ -435,10 +433,9 @@ static void de_rx (struct de_private *de) | |||
435 | 433 | ||
436 | copying_skb = (len <= rx_copybreak); | 434 | copying_skb = (len <= rx_copybreak); |
437 | 435 | ||
438 | if (unlikely(netif_msg_rx_status(de))) | 436 | netif_dbg(de, rx_status, de->dev, |
439 | printk(KERN_DEBUG "%s: rx slot %d status 0x%x len %d copying? %d\n", | 437 | "rx slot %d status 0x%x len %d copying? %d\n", |
440 | de->dev->name, rx_tail, status, len, | 438 | rx_tail, status, len, copying_skb); |
441 | copying_skb); | ||
442 | 439 | ||
443 | buflen = copying_skb ? (len + RX_OFFSET) : de->rx_buf_sz; | 440 | buflen = copying_skb ? (len + RX_OFFSET) : de->rx_buf_sz; |
444 | copy_skb = dev_alloc_skb (buflen); | 441 | copy_skb = dev_alloc_skb (buflen); |
@@ -491,7 +488,7 @@ rx_next: | |||
491 | } | 488 | } |
492 | 489 | ||
493 | if (!rx_work) | 490 | if (!rx_work) |
494 | dev_warn(&de->dev->dev, "rx work limit reached\n"); | 491 | netdev_warn(de->dev, "rx work limit reached\n"); |
495 | 492 | ||
496 | de->rx_tail = rx_tail; | 493 | de->rx_tail = rx_tail; |
497 | } | 494 | } |
@@ -506,10 +503,9 @@ static irqreturn_t de_interrupt (int irq, void *dev_instance) | |||
506 | if ((!(status & (IntrOK|IntrErr))) || (status == 0xFFFF)) | 503 | if ((!(status & (IntrOK|IntrErr))) || (status == 0xFFFF)) |
507 | return IRQ_NONE; | 504 | return IRQ_NONE; |
508 | 505 | ||
509 | if (netif_msg_intr(de)) | 506 | netif_dbg(de, intr, dev, "intr, status %08x mode %08x desc %u/%u/%u\n", |
510 | printk(KERN_DEBUG "%s: intr, status %08x mode %08x desc %u/%u/%u\n", | 507 | status, dr32(MacMode), |
511 | dev->name, status, dr32(MacMode), | 508 | de->rx_tail, de->tx_head, de->tx_tail); |
512 | de->rx_tail, de->tx_head, de->tx_tail); | ||
513 | 509 | ||
514 | dw32(MacStatus, status); | 510 | dw32(MacStatus, status); |
515 | 511 | ||
@@ -534,9 +530,9 @@ static irqreturn_t de_interrupt (int irq, void *dev_instance) | |||
534 | 530 | ||
535 | pci_read_config_word(de->pdev, PCI_STATUS, &pci_status); | 531 | pci_read_config_word(de->pdev, PCI_STATUS, &pci_status); |
536 | pci_write_config_word(de->pdev, PCI_STATUS, pci_status); | 532 | pci_write_config_word(de->pdev, PCI_STATUS, pci_status); |
537 | dev_err(&de->dev->dev, | 533 | netdev_err(de->dev, |
538 | "PCI bus error, status=%08x, PCI status=%04x\n", | 534 | "PCI bus error, status=%08x, PCI status=%04x\n", |
539 | status, pci_status); | 535 | status, pci_status); |
540 | } | 536 | } |
541 | 537 | ||
542 | return IRQ_HANDLED; | 538 | return IRQ_HANDLED; |
@@ -572,9 +568,9 @@ static void de_tx (struct de_private *de) | |||
572 | 568 | ||
573 | if (status & LastFrag) { | 569 | if (status & LastFrag) { |
574 | if (status & TxError) { | 570 | if (status & TxError) { |
575 | if (netif_msg_tx_err(de)) | 571 | netif_dbg(de, tx_err, de->dev, |
576 | printk(KERN_DEBUG "%s: tx err, status 0x%x\n", | 572 | "tx err, status 0x%x\n", |
577 | de->dev->name, status); | 573 | status); |
578 | de->net_stats.tx_errors++; | 574 | de->net_stats.tx_errors++; |
579 | if (status & TxOWC) | 575 | if (status & TxOWC) |
580 | de->net_stats.tx_window_errors++; | 576 | de->net_stats.tx_window_errors++; |
@@ -587,9 +583,8 @@ static void de_tx (struct de_private *de) | |||
587 | } else { | 583 | } else { |
588 | de->net_stats.tx_packets++; | 584 | de->net_stats.tx_packets++; |
589 | de->net_stats.tx_bytes += skb->len; | 585 | de->net_stats.tx_bytes += skb->len; |
590 | if (netif_msg_tx_done(de)) | 586 | netif_dbg(de, tx_done, de->dev, |
591 | printk(KERN_DEBUG "%s: tx done, slot %d\n", | 587 | "tx done, slot %d\n", tx_tail); |
592 | de->dev->name, tx_tail); | ||
593 | } | 588 | } |
594 | dev_kfree_skb_irq(skb); | 589 | dev_kfree_skb_irq(skb); |
595 | } | 590 | } |
@@ -646,9 +641,8 @@ static netdev_tx_t de_start_xmit (struct sk_buff *skb, | |||
646 | wmb(); | 641 | wmb(); |
647 | 642 | ||
648 | de->tx_head = NEXT_TX(entry); | 643 | de->tx_head = NEXT_TX(entry); |
649 | if (netif_msg_tx_queued(de)) | 644 | netif_dbg(de, tx_queued, dev, "tx queued, slot %d, skblen %d\n", |
650 | printk(KERN_DEBUG "%s: tx queued, slot %d, skblen %d\n", | 645 | entry, skb->len); |
651 | dev->name, entry, skb->len); | ||
652 | 646 | ||
653 | if (tx_free == 0) | 647 | if (tx_free == 0) |
654 | netif_stop_queue(dev); | 648 | netif_stop_queue(dev); |
@@ -873,7 +867,7 @@ static void de_stop_rxtx (struct de_private *de) | |||
873 | udelay(100); | 867 | udelay(100); |
874 | } | 868 | } |
875 | 869 | ||
876 | dev_warn(&de->dev->dev, "timeout expired stopping DMA\n"); | 870 | netdev_warn(de->dev, "timeout expired, stopping DMA\n"); |
877 | } | 871 | } |
878 | 872 | ||
879 | static inline void de_start_rxtx (struct de_private *de) | 873 | static inline void de_start_rxtx (struct de_private *de) |
@@ -907,9 +901,8 @@ static void de_link_up(struct de_private *de) | |||
907 | { | 901 | { |
908 | if (!netif_carrier_ok(de->dev)) { | 902 | if (!netif_carrier_ok(de->dev)) { |
909 | netif_carrier_on(de->dev); | 903 | netif_carrier_on(de->dev); |
910 | if (netif_msg_link(de)) | 904 | netif_info(de, link, de->dev, "link up, media %s\n", |
911 | dev_info(&de->dev->dev, "link up, media %s\n", | 905 | media_name[de->media_type]); |
912 | media_name[de->media_type]); | ||
913 | } | 906 | } |
914 | } | 907 | } |
915 | 908 | ||
@@ -917,8 +910,7 @@ static void de_link_down(struct de_private *de) | |||
917 | { | 910 | { |
918 | if (netif_carrier_ok(de->dev)) { | 911 | if (netif_carrier_ok(de->dev)) { |
919 | netif_carrier_off(de->dev); | 912 | netif_carrier_off(de->dev); |
920 | if (netif_msg_link(de)) | 913 | netif_info(de, link, de->dev, "link down\n"); |
921 | dev_info(&de->dev->dev, "link down\n"); | ||
922 | } | 914 | } |
923 | } | 915 | } |
924 | 916 | ||
@@ -928,8 +920,7 @@ static void de_set_media (struct de_private *de) | |||
928 | u32 macmode = dr32(MacMode); | 920 | u32 macmode = dr32(MacMode); |
929 | 921 | ||
930 | if (de_is_running(de)) | 922 | if (de_is_running(de)) |
931 | dev_warn(&de->dev->dev, | 923 | netdev_warn(de->dev, "chip is running while changing media!\n"); |
932 | "chip is running while changing media!\n"); | ||
933 | 924 | ||
934 | if (de->de21040) | 925 | if (de->de21040) |
935 | dw32(CSR11, FULL_DUPLEX_MAGIC); | 926 | dw32(CSR11, FULL_DUPLEX_MAGIC); |
@@ -948,18 +939,13 @@ static void de_set_media (struct de_private *de) | |||
948 | else | 939 | else |
949 | macmode &= ~FullDuplex; | 940 | macmode &= ~FullDuplex; |
950 | 941 | ||
951 | if (netif_msg_link(de)) | 942 | netif_info(de, link, de->dev, "set link %s\n", media_name[media]); |
952 | dev_info(&de->dev->dev, "set link %s\n", media_name[media]); | 943 | netif_info(de, hw, de->dev, "mode 0x%x, sia 0x%x,0x%x,0x%x,0x%x\n", |
953 | if (netif_msg_hw(de)) { | 944 | dr32(MacMode), dr32(SIAStatus), |
954 | dev_info(&de->dev->dev, "mode 0x%x, sia 0x%x,0x%x,0x%x,0x%x\n", | 945 | dr32(CSR13), dr32(CSR14), dr32(CSR15)); |
955 | dr32(MacMode), dr32(SIAStatus), | 946 | netif_info(de, hw, de->dev, "set mode 0x%x, set sia 0x%x,0x%x,0x%x\n", |
956 | dr32(CSR13), dr32(CSR14), dr32(CSR15)); | 947 | macmode, de->media[media].csr13, |
957 | 948 | de->media[media].csr14, de->media[media].csr15); | |
958 | dev_info(&de->dev->dev, | ||
959 | "set mode 0x%x, set sia 0x%x,0x%x,0x%x\n", | ||
960 | macmode, de->media[media].csr13, | ||
961 | de->media[media].csr14, de->media[media].csr15); | ||
962 | } | ||
963 | if (macmode != dr32(MacMode)) | 949 | if (macmode != dr32(MacMode)) |
964 | dw32(MacMode, macmode); | 950 | dw32(MacMode, macmode); |
965 | } | 951 | } |
@@ -996,9 +982,8 @@ static void de21040_media_timer (unsigned long data) | |||
996 | if (!netif_carrier_ok(dev)) | 982 | if (!netif_carrier_ok(dev)) |
997 | de_link_up(de); | 983 | de_link_up(de); |
998 | else | 984 | else |
999 | if (netif_msg_timer(de)) | 985 | netif_info(de, timer, dev, "%s link ok, status %x\n", |
1000 | dev_info(&dev->dev, "%s link ok, status %x\n", | 986 | media_name[de->media_type], status); |
1001 | media_name[de->media_type], status); | ||
1002 | return; | 987 | return; |
1003 | } | 988 | } |
1004 | 989 | ||
@@ -1025,9 +1010,8 @@ no_link_yet: | |||
1025 | de->media_timer.expires = jiffies + DE_TIMER_NO_LINK; | 1010 | de->media_timer.expires = jiffies + DE_TIMER_NO_LINK; |
1026 | add_timer(&de->media_timer); | 1011 | add_timer(&de->media_timer); |
1027 | 1012 | ||
1028 | if (netif_msg_timer(de)) | 1013 | netif_info(de, timer, dev, "no link, trying media %s, status %x\n", |
1029 | dev_info(&dev->dev, "no link, trying media %s, status %x\n", | 1014 | media_name[de->media_type], status); |
1030 | media_name[de->media_type], status); | ||
1031 | } | 1015 | } |
1032 | 1016 | ||
1033 | static unsigned int de_ok_to_advertise (struct de_private *de, u32 new_media) | 1017 | static unsigned int de_ok_to_advertise (struct de_private *de, u32 new_media) |
@@ -1085,11 +1069,10 @@ static void de21041_media_timer (unsigned long data) | |||
1085 | if (!netif_carrier_ok(dev)) | 1069 | if (!netif_carrier_ok(dev)) |
1086 | de_link_up(de); | 1070 | de_link_up(de); |
1087 | else | 1071 | else |
1088 | if (netif_msg_timer(de)) | 1072 | netif_info(de, timer, dev, |
1089 | dev_info(&dev->dev, | 1073 | "%s link ok, mode %x status %x\n", |
1090 | "%s link ok, mode %x status %x\n", | 1074 | media_name[de->media_type], |
1091 | media_name[de->media_type], | 1075 | dr32(MacMode), status); |
1092 | dr32(MacMode), status); | ||
1093 | return; | 1076 | return; |
1094 | } | 1077 | } |
1095 | 1078 | ||
@@ -1163,9 +1146,8 @@ no_link_yet: | |||
1163 | de->media_timer.expires = jiffies + DE_TIMER_NO_LINK; | 1146 | de->media_timer.expires = jiffies + DE_TIMER_NO_LINK; |
1164 | add_timer(&de->media_timer); | 1147 | add_timer(&de->media_timer); |
1165 | 1148 | ||
1166 | if (netif_msg_timer(de)) | 1149 | netif_info(de, timer, dev, "no link, trying media %s, status %x\n", |
1167 | dev_info(&dev->dev, "no link, trying media %s, status %x\n", | 1150 | media_name[de->media_type], status); |
1168 | media_name[de->media_type], status); | ||
1169 | } | 1151 | } |
1170 | 1152 | ||
1171 | static void de_media_interrupt (struct de_private *de, u32 status) | 1153 | static void de_media_interrupt (struct de_private *de, u32 status) |
@@ -1401,14 +1383,13 @@ static int de_open (struct net_device *dev) | |||
1401 | struct de_private *de = netdev_priv(dev); | 1383 | struct de_private *de = netdev_priv(dev); |
1402 | int rc; | 1384 | int rc; |
1403 | 1385 | ||
1404 | if (netif_msg_ifup(de)) | 1386 | netif_dbg(de, ifup, dev, "enabling interface\n"); |
1405 | printk(KERN_DEBUG "%s: enabling interface\n", dev->name); | ||
1406 | 1387 | ||
1407 | de->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32); | 1388 | de->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32); |
1408 | 1389 | ||
1409 | rc = de_alloc_rings(de); | 1390 | rc = de_alloc_rings(de); |
1410 | if (rc) { | 1391 | if (rc) { |
1411 | dev_err(&dev->dev, "ring allocation failure, err=%d\n", rc); | 1392 | netdev_err(dev, "ring allocation failure, err=%d\n", rc); |
1412 | return rc; | 1393 | return rc; |
1413 | } | 1394 | } |
1414 | 1395 | ||
@@ -1416,14 +1397,14 @@ static int de_open (struct net_device *dev) | |||
1416 | 1397 | ||
1417 | rc = request_irq(dev->irq, de_interrupt, IRQF_SHARED, dev->name, dev); | 1398 | rc = request_irq(dev->irq, de_interrupt, IRQF_SHARED, dev->name, dev); |
1418 | if (rc) { | 1399 | if (rc) { |
1419 | dev_err(&dev->dev, "IRQ %d request failure, err=%d\n", | 1400 | netdev_err(dev, "IRQ %d request failure, err=%d\n", |
1420 | dev->irq, rc); | 1401 | dev->irq, rc); |
1421 | goto err_out_free; | 1402 | goto err_out_free; |
1422 | } | 1403 | } |
1423 | 1404 | ||
1424 | rc = de_init_hw(de); | 1405 | rc = de_init_hw(de); |
1425 | if (rc) { | 1406 | if (rc) { |
1426 | dev_err(&dev->dev, "h/w init failure, err=%d\n", rc); | 1407 | netdev_err(dev, "h/w init failure, err=%d\n", rc); |
1427 | goto err_out_free_irq; | 1408 | goto err_out_free_irq; |
1428 | } | 1409 | } |
1429 | 1410 | ||
@@ -1444,8 +1425,7 @@ static int de_close (struct net_device *dev) | |||
1444 | struct de_private *de = netdev_priv(dev); | 1425 | struct de_private *de = netdev_priv(dev); |
1445 | unsigned long flags; | 1426 | unsigned long flags; |
1446 | 1427 | ||
1447 | if (netif_msg_ifdown(de)) | 1428 | netif_dbg(de, ifdown, dev, "disabling interface\n"); |
1448 | printk(KERN_DEBUG "%s: disabling interface\n", dev->name); | ||
1449 | 1429 | ||
1450 | del_timer_sync(&de->media_timer); | 1430 | del_timer_sync(&de->media_timer); |
1451 | 1431 | ||
@@ -1466,9 +1446,9 @@ static void de_tx_timeout (struct net_device *dev) | |||
1466 | { | 1446 | { |
1467 | struct de_private *de = netdev_priv(dev); | 1447 | struct de_private *de = netdev_priv(dev); |
1468 | 1448 | ||
1469 | printk(KERN_DEBUG "%s: NIC status %08x mode %08x sia %08x desc %u/%u/%u\n", | 1449 | netdev_dbg(dev, "NIC status %08x mode %08x sia %08x desc %u/%u/%u\n", |
1470 | dev->name, dr32(MacStatus), dr32(MacMode), dr32(SIAStatus), | 1450 | dr32(MacStatus), dr32(MacMode), dr32(SIAStatus), |
1471 | de->rx_tail, de->tx_head, de->tx_tail); | 1451 | de->rx_tail, de->tx_head, de->tx_tail); |
1472 | 1452 | ||
1473 | del_timer_sync(&de->media_timer); | 1453 | del_timer_sync(&de->media_timer); |
1474 | 1454 | ||
@@ -1693,9 +1673,8 @@ static int de_nway_reset(struct net_device *dev) | |||
1693 | 1673 | ||
1694 | status = dr32(SIAStatus); | 1674 | status = dr32(SIAStatus); |
1695 | dw32(SIAStatus, (status & ~NWayState) | NWayRestart); | 1675 | dw32(SIAStatus, (status & ~NWayState) | NWayRestart); |
1696 | if (netif_msg_link(de)) | 1676 | netif_info(de, link, dev, "link nway restart, status %x,%x\n", |
1697 | dev_info(&de->dev->dev, "link nway restart, status %x,%x\n", | 1677 | status, dr32(SIAStatus)); |
1698 | status, dr32(SIAStatus)); | ||
1699 | return 0; | 1678 | return 0; |
1700 | } | 1679 | } |
1701 | 1680 | ||
@@ -1740,7 +1719,8 @@ static void __devinit de21040_get_mac_address (struct de_private *de) | |||
1740 | de->dev->dev_addr[i] = value; | 1719 | de->dev->dev_addr[i] = value; |
1741 | udelay(1); | 1720 | udelay(1); |
1742 | if (boguscnt <= 0) | 1721 | if (boguscnt <= 0) |
1743 | pr_warning(PFX "timeout reading 21040 MAC address byte %u\n", i); | 1722 | pr_warn("timeout reading 21040 MAC address byte %u\n", |
1723 | i); | ||
1744 | } | 1724 | } |
1745 | } | 1725 | } |
1746 | 1726 | ||
@@ -1926,8 +1906,10 @@ static void __devinit de21041_get_srom_info (struct de_private *de) | |||
1926 | de->media[idx].csr14, | 1906 | de->media[idx].csr14, |
1927 | de->media[idx].csr15); | 1907 | de->media[idx].csr15); |
1928 | 1908 | ||
1929 | } else if (netif_msg_probe(de)) | 1909 | } else { |
1930 | pr_cont("\n"); | 1910 | if (netif_msg_probe(de)) |
1911 | pr_cont("\n"); | ||
1912 | } | ||
1931 | 1913 | ||
1932 | if (bufp > ((void *)&ee_data[DE_EEPROM_SIZE - 3])) | 1914 | if (bufp > ((void *)&ee_data[DE_EEPROM_SIZE - 3])) |
1933 | break; | 1915 | break; |
@@ -1996,7 +1978,7 @@ static int __devinit de_init_one (struct pci_dev *pdev, | |||
1996 | 1978 | ||
1997 | #ifndef MODULE | 1979 | #ifndef MODULE |
1998 | if (board_idx == 0) | 1980 | if (board_idx == 0) |
1999 | printk("%s", version); | 1981 | pr_info("%s\n", version); |
2000 | #endif | 1982 | #endif |
2001 | 1983 | ||
2002 | /* allocate a new ethernet device structure, and fill in defaults */ | 1984 | /* allocate a new ethernet device structure, and fill in defaults */ |
@@ -2038,7 +2020,7 @@ static int __devinit de_init_one (struct pci_dev *pdev, | |||
2038 | /* check for invalid IRQ value */ | 2020 | /* check for invalid IRQ value */ |
2039 | if (pdev->irq < 2) { | 2021 | if (pdev->irq < 2) { |
2040 | rc = -EIO; | 2022 | rc = -EIO; |
2041 | pr_err(PFX "invalid irq (%d) for pci dev %s\n", | 2023 | pr_err("invalid irq (%d) for pci dev %s\n", |
2042 | pdev->irq, pci_name(pdev)); | 2024 | pdev->irq, pci_name(pdev)); |
2043 | goto err_out_res; | 2025 | goto err_out_res; |
2044 | } | 2026 | } |
@@ -2049,12 +2031,12 @@ static int __devinit de_init_one (struct pci_dev *pdev, | |||
2049 | pciaddr = pci_resource_start(pdev, 1); | 2031 | pciaddr = pci_resource_start(pdev, 1); |
2050 | if (!pciaddr) { | 2032 | if (!pciaddr) { |
2051 | rc = -EIO; | 2033 | rc = -EIO; |
2052 | pr_err(PFX "no MMIO resource for pci dev %s\n", pci_name(pdev)); | 2034 | pr_err("no MMIO resource for pci dev %s\n", pci_name(pdev)); |
2053 | goto err_out_res; | 2035 | goto err_out_res; |
2054 | } | 2036 | } |
2055 | if (pci_resource_len(pdev, 1) < DE_REGS_SIZE) { | 2037 | if (pci_resource_len(pdev, 1) < DE_REGS_SIZE) { |
2056 | rc = -EIO; | 2038 | rc = -EIO; |
2057 | pr_err(PFX "MMIO resource (%llx) too small on pci dev %s\n", | 2039 | pr_err("MMIO resource (%llx) too small on pci dev %s\n", |
2058 | (unsigned long long)pci_resource_len(pdev, 1), | 2040 | (unsigned long long)pci_resource_len(pdev, 1), |
2059 | pci_name(pdev)); | 2041 | pci_name(pdev)); |
2060 | goto err_out_res; | 2042 | goto err_out_res; |
@@ -2064,7 +2046,7 @@ static int __devinit de_init_one (struct pci_dev *pdev, | |||
2064 | regs = ioremap_nocache(pciaddr, DE_REGS_SIZE); | 2046 | regs = ioremap_nocache(pciaddr, DE_REGS_SIZE); |
2065 | if (!regs) { | 2047 | if (!regs) { |
2066 | rc = -EIO; | 2048 | rc = -EIO; |
2067 | pr_err(PFX "Cannot map PCI MMIO (%llx@%lx) on pci dev %s\n", | 2049 | pr_err("Cannot map PCI MMIO (%llx@%lx) on pci dev %s\n", |
2068 | (unsigned long long)pci_resource_len(pdev, 1), | 2050 | (unsigned long long)pci_resource_len(pdev, 1), |
2069 | pciaddr, pci_name(pdev)); | 2051 | pciaddr, pci_name(pdev)); |
2070 | goto err_out_res; | 2052 | goto err_out_res; |
@@ -2077,7 +2059,7 @@ static int __devinit de_init_one (struct pci_dev *pdev, | |||
2077 | /* make sure hardware is not running */ | 2059 | /* make sure hardware is not running */ |
2078 | rc = de_reset_mac(de); | 2060 | rc = de_reset_mac(de); |
2079 | if (rc) { | 2061 | if (rc) { |
2080 | pr_err(PFX "Cannot reset MAC, pci dev %s\n", pci_name(pdev)); | 2062 | pr_err("Cannot reset MAC, pci dev %s\n", pci_name(pdev)); |
2081 | goto err_out_iomap; | 2063 | goto err_out_iomap; |
2082 | } | 2064 | } |
2083 | 2065 | ||
@@ -2097,11 +2079,11 @@ static int __devinit de_init_one (struct pci_dev *pdev, | |||
2097 | goto err_out_iomap; | 2079 | goto err_out_iomap; |
2098 | 2080 | ||
2099 | /* print info about board and interface just registered */ | 2081 | /* print info about board and interface just registered */ |
2100 | dev_info(&dev->dev, "%s at 0x%lx, %pM, IRQ %d\n", | 2082 | netdev_info(dev, "%s at 0x%lx, %pM, IRQ %d\n", |
2101 | de->de21040 ? "21040" : "21041", | 2083 | de->de21040 ? "21040" : "21041", |
2102 | dev->base_addr, | 2084 | dev->base_addr, |
2103 | dev->dev_addr, | 2085 | dev->dev_addr, |
2104 | dev->irq); | 2086 | dev->irq); |
2105 | 2087 | ||
2106 | pci_set_drvdata(pdev, dev); | 2088 | pci_set_drvdata(pdev, dev); |
2107 | 2089 | ||
@@ -2189,7 +2171,7 @@ static int de_resume (struct pci_dev *pdev) | |||
2189 | if (!netif_running(dev)) | 2171 | if (!netif_running(dev)) |
2190 | goto out_attach; | 2172 | goto out_attach; |
2191 | if ((retval = pci_enable_device(pdev))) { | 2173 | if ((retval = pci_enable_device(pdev))) { |
2192 | dev_err(&dev->dev, "pci_enable_device failed in resume\n"); | 2174 | netdev_err(dev, "pci_enable_device failed in resume\n"); |
2193 | goto out; | 2175 | goto out; |
2194 | } | 2176 | } |
2195 | pci_set_master(pdev); | 2177 | pci_set_master(pdev); |
@@ -2218,7 +2200,7 @@ static struct pci_driver de_driver = { | |||
2218 | static int __init de_init (void) | 2200 | static int __init de_init (void) |
2219 | { | 2201 | { |
2220 | #ifdef MODULE | 2202 | #ifdef MODULE |
2221 | printk("%s", version); | 2203 | pr_info("%s\n", version); |
2222 | #endif | 2204 | #endif |
2223 | return pci_register_driver(&de_driver); | 2205 | return pci_register_driver(&de_driver); |
2224 | } | 2206 | } |
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c index fb07f48910ae..468512731966 100644 --- a/drivers/net/tulip/dmfe.c +++ b/drivers/net/tulip/dmfe.c | |||
@@ -295,8 +295,7 @@ enum dmfe_CR6_bits { | |||
295 | /* Global variable declaration ----------------------------- */ | 295 | /* Global variable declaration ----------------------------- */ |
296 | static int __devinitdata printed_version; | 296 | static int __devinitdata printed_version; |
297 | static const char version[] __devinitconst = | 297 | static const char version[] __devinitconst = |
298 | KERN_INFO DRV_NAME ": Davicom DM9xxx net driver, version " | 298 | "Davicom DM9xxx net driver, version " DRV_VERSION " (" DRV_RELDATE ")"; |
299 | DRV_VERSION " (" DRV_RELDATE ")\n"; | ||
300 | 299 | ||
301 | static int dmfe_debug; | 300 | static int dmfe_debug; |
302 | static unsigned char dmfe_media_mode = DMFE_AUTO; | 301 | static unsigned char dmfe_media_mode = DMFE_AUTO; |
@@ -381,7 +380,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev, | |||
381 | DMFE_DBUG(0, "dmfe_init_one()", 0); | 380 | DMFE_DBUG(0, "dmfe_init_one()", 0); |
382 | 381 | ||
383 | if (!printed_version++) | 382 | if (!printed_version++) |
384 | printk(version); | 383 | pr_info("%s\n", version); |
385 | 384 | ||
386 | /* | 385 | /* |
387 | * SPARC on-board DM910x chips should be handled by the main | 386 | * SPARC on-board DM910x chips should be handled by the main |
@@ -406,7 +405,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev, | |||
406 | SET_NETDEV_DEV(dev, &pdev->dev); | 405 | SET_NETDEV_DEV(dev, &pdev->dev); |
407 | 406 | ||
408 | if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { | 407 | if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { |
409 | pr_warning("32-bit PCI DMA not available\n"); | 408 | pr_warn("32-bit PCI DMA not available\n"); |
410 | err = -ENODEV; | 409 | err = -ENODEV; |
411 | goto err_out_free; | 410 | goto err_out_free; |
412 | } | 411 | } |
@@ -2203,7 +2202,7 @@ static int __init dmfe_init_module(void) | |||
2203 | { | 2202 | { |
2204 | int rc; | 2203 | int rc; |
2205 | 2204 | ||
2206 | printk(version); | 2205 | pr_info("%s\n", version); |
2207 | printed_version = 1; | 2206 | printed_version = 1; |
2208 | 2207 | ||
2209 | DMFE_DBUG(0, "init_module() ", debug); | 2208 | DMFE_DBUG(0, "init_module() ", debug); |
diff --git a/drivers/net/tulip/eeprom.c b/drivers/net/tulip/eeprom.c index 296486bf0956..fa5eee925f25 100644 --- a/drivers/net/tulip/eeprom.c +++ b/drivers/net/tulip/eeprom.c | |||
@@ -222,8 +222,8 @@ subsequent_board: | |||
222 | /* there is no phy information, don't even try to build mtable */ | 222 | /* there is no phy information, don't even try to build mtable */ |
223 | if (count == 0) { | 223 | if (count == 0) { |
224 | if (tulip_debug > 0) | 224 | if (tulip_debug > 0) |
225 | pr_warning("%s: no phy info, aborting mtable build\n", | 225 | pr_warn("%s: no phy info, aborting mtable build\n", |
226 | dev->name); | 226 | dev->name); |
227 | return; | 227 | return; |
228 | } | 228 | } |
229 | 229 | ||
diff --git a/drivers/net/tulip/interrupt.c b/drivers/net/tulip/interrupt.c index 0013642903ee..5350d753e0ff 100644 --- a/drivers/net/tulip/interrupt.c +++ b/drivers/net/tulip/interrupt.c | |||
@@ -125,12 +125,12 @@ int tulip_poll(struct napi_struct *napi, int budget) | |||
125 | #endif | 125 | #endif |
126 | 126 | ||
127 | if (tulip_debug > 4) | 127 | if (tulip_debug > 4) |
128 | printk(KERN_DEBUG " In tulip_rx(), entry %d %08x\n", | 128 | netdev_dbg(dev, " In tulip_rx(), entry %d %08x\n", |
129 | entry, tp->rx_ring[entry].status); | 129 | entry, tp->rx_ring[entry].status); |
130 | 130 | ||
131 | do { | 131 | do { |
132 | if (ioread32(tp->base_addr + CSR5) == 0xffffffff) { | 132 | if (ioread32(tp->base_addr + CSR5) == 0xffffffff) { |
133 | printk(KERN_DEBUG " In tulip_poll(), hardware disappeared\n"); | 133 | netdev_dbg(dev, " In tulip_poll(), hardware disappeared\n"); |
134 | break; | 134 | break; |
135 | } | 135 | } |
136 | /* Acknowledge current RX interrupt sources. */ | 136 | /* Acknowledge current RX interrupt sources. */ |
@@ -145,9 +145,9 @@ int tulip_poll(struct napi_struct *napi, int budget) | |||
145 | if (tp->dirty_rx + RX_RING_SIZE == tp->cur_rx) | 145 | if (tp->dirty_rx + RX_RING_SIZE == tp->cur_rx) |
146 | break; | 146 | break; |
147 | 147 | ||
148 | if (tulip_debug > 5) | 148 | if (tulip_debug > 5) |
149 | printk(KERN_DEBUG "%s: In tulip_rx(), entry %d %08x\n", | 149 | netdev_dbg(dev, "In tulip_rx(), entry %d %08x\n", |
150 | dev->name, entry, status); | 150 | entry, status); |
151 | 151 | ||
152 | if (++work_done >= budget) | 152 | if (++work_done >= budget) |
153 | goto not_done; | 153 | goto not_done; |
@@ -184,9 +184,9 @@ int tulip_poll(struct napi_struct *napi, int budget) | |||
184 | } | 184 | } |
185 | } else { | 185 | } else { |
186 | /* There was a fatal error. */ | 186 | /* There was a fatal error. */ |
187 | if (tulip_debug > 2) | 187 | if (tulip_debug > 2) |
188 | printk(KERN_DEBUG "%s: Receive error, Rx status %08x\n", | 188 | netdev_dbg(dev, "Receive error, Rx status %08x\n", |
189 | dev->name, status); | 189 | status); |
190 | dev->stats.rx_errors++; /* end of a packet.*/ | 190 | dev->stats.rx_errors++; /* end of a packet.*/ |
191 | if (pkt_len > 1518 || | 191 | if (pkt_len > 1518 || |
192 | (status & RxDescRunt)) | 192 | (status & RxDescRunt)) |
@@ -367,16 +367,16 @@ static int tulip_rx(struct net_device *dev) | |||
367 | int received = 0; | 367 | int received = 0; |
368 | 368 | ||
369 | if (tulip_debug > 4) | 369 | if (tulip_debug > 4) |
370 | printk(KERN_DEBUG " In tulip_rx(), entry %d %08x\n", | 370 | netdev_dbg(dev, "In tulip_rx(), entry %d %08x\n", |
371 | entry, tp->rx_ring[entry].status); | 371 | entry, tp->rx_ring[entry].status); |
372 | /* If we own the next entry, it is a new packet. Send it up. */ | 372 | /* If we own the next entry, it is a new packet. Send it up. */ |
373 | while ( ! (tp->rx_ring[entry].status & cpu_to_le32(DescOwned))) { | 373 | while ( ! (tp->rx_ring[entry].status & cpu_to_le32(DescOwned))) { |
374 | s32 status = le32_to_cpu(tp->rx_ring[entry].status); | 374 | s32 status = le32_to_cpu(tp->rx_ring[entry].status); |
375 | short pkt_len; | 375 | short pkt_len; |
376 | 376 | ||
377 | if (tulip_debug > 5) | 377 | if (tulip_debug > 5) |
378 | printk(KERN_DEBUG "%s: In tulip_rx(), entry %d %08x\n", | 378 | netdev_dbg(dev, "In tulip_rx(), entry %d %08x\n", |
379 | dev->name, entry, status); | 379 | entry, status); |
380 | if (--rx_work_limit < 0) | 380 | if (--rx_work_limit < 0) |
381 | break; | 381 | break; |
382 | 382 | ||
@@ -404,16 +404,16 @@ static int tulip_rx(struct net_device *dev) | |||
404 | /* Ingore earlier buffers. */ | 404 | /* Ingore earlier buffers. */ |
405 | if ((status & 0xffff) != 0x7fff) { | 405 | if ((status & 0xffff) != 0x7fff) { |
406 | if (tulip_debug > 1) | 406 | if (tulip_debug > 1) |
407 | dev_warn(&dev->dev, | 407 | netdev_warn(dev, |
408 | "Oversized Ethernet frame spanned multiple buffers, status %08x!\n", | 408 | "Oversized Ethernet frame spanned multiple buffers, status %08x!\n", |
409 | status); | 409 | status); |
410 | dev->stats.rx_length_errors++; | 410 | dev->stats.rx_length_errors++; |
411 | } | 411 | } |
412 | } else { | 412 | } else { |
413 | /* There was a fatal error. */ | 413 | /* There was a fatal error. */ |
414 | if (tulip_debug > 2) | 414 | if (tulip_debug > 2) |
415 | printk(KERN_DEBUG "%s: Receive error, Rx status %08x\n", | 415 | netdev_dbg(dev, "Receive error, Rx status %08x\n", |
416 | dev->name, status); | 416 | status); |
417 | dev->stats.rx_errors++; /* end of a packet.*/ | 417 | dev->stats.rx_errors++; /* end of a packet.*/ |
418 | if (pkt_len > 1518 || | 418 | if (pkt_len > 1518 || |
419 | (status & RxDescRunt)) | 419 | (status & RxDescRunt)) |
@@ -573,8 +573,8 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance) | |||
573 | #endif /* CONFIG_TULIP_NAPI */ | 573 | #endif /* CONFIG_TULIP_NAPI */ |
574 | 574 | ||
575 | if (tulip_debug > 4) | 575 | if (tulip_debug > 4) |
576 | printk(KERN_DEBUG "%s: interrupt csr5=%#8.8x new csr5=%#8.8x\n", | 576 | netdev_dbg(dev, "interrupt csr5=%#8.8x new csr5=%#8.8x\n", |
577 | dev->name, csr5, ioread32(ioaddr + CSR5)); | 577 | csr5, ioread32(ioaddr + CSR5)); |
578 | 578 | ||
579 | 579 | ||
580 | if (csr5 & (TxNoBuf | TxDied | TxIntr | TimerInt)) { | 580 | if (csr5 & (TxNoBuf | TxDied | TxIntr | TimerInt)) { |
@@ -605,8 +605,8 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance) | |||
605 | /* There was an major error, log it. */ | 605 | /* There was an major error, log it. */ |
606 | #ifndef final_version | 606 | #ifndef final_version |
607 | if (tulip_debug > 1) | 607 | if (tulip_debug > 1) |
608 | printk(KERN_DEBUG "%s: Transmit error, Tx status %08x\n", | 608 | netdev_dbg(dev, "Transmit error, Tx status %08x\n", |
609 | dev->name, status); | 609 | status); |
610 | #endif | 610 | #endif |
611 | dev->stats.tx_errors++; | 611 | dev->stats.tx_errors++; |
612 | if (status & 0x4104) | 612 | if (status & 0x4104) |
@@ -804,8 +804,8 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance) | |||
804 | } | 804 | } |
805 | 805 | ||
806 | if (tulip_debug > 4) | 806 | if (tulip_debug > 4) |
807 | printk(KERN_DEBUG "%s: exiting interrupt, csr5=%#04x\n", | 807 | netdev_dbg(dev, "exiting interrupt, csr5=%#04x\n", |
808 | dev->name, ioread32(ioaddr + CSR5)); | 808 | ioread32(ioaddr + CSR5)); |
809 | 809 | ||
810 | return IRQ_HANDLED; | 810 | return IRQ_HANDLED; |
811 | } | 811 | } |
diff --git a/drivers/net/tulip/media.c b/drivers/net/tulip/media.c index a0c770ee4b64..4bd13922875d 100644 --- a/drivers/net/tulip/media.c +++ b/drivers/net/tulip/media.c | |||
@@ -182,8 +182,8 @@ void tulip_select_media(struct net_device *dev, int startup) | |||
182 | switch (mleaf->type) { | 182 | switch (mleaf->type) { |
183 | case 0: /* 21140 non-MII xcvr. */ | 183 | case 0: /* 21140 non-MII xcvr. */ |
184 | if (tulip_debug > 1) | 184 | if (tulip_debug > 1) |
185 | printk(KERN_DEBUG "%s: Using a 21140 non-MII transceiver with control setting %02x\n", | 185 | netdev_dbg(dev, "Using a 21140 non-MII transceiver with control setting %02x\n", |
186 | dev->name, p[1]); | 186 | p[1]); |
187 | dev->if_port = p[0]; | 187 | dev->if_port = p[0]; |
188 | if (startup) | 188 | if (startup) |
189 | iowrite32(mtable->csr12dir | 0x100, ioaddr + CSR12); | 189 | iowrite32(mtable->csr12dir | 0x100, ioaddr + CSR12); |
@@ -204,15 +204,14 @@ void tulip_select_media(struct net_device *dev, int startup) | |||
204 | struct medialeaf *rleaf = &mtable->mleaf[mtable->has_reset]; | 204 | struct medialeaf *rleaf = &mtable->mleaf[mtable->has_reset]; |
205 | unsigned char *rst = rleaf->leafdata; | 205 | unsigned char *rst = rleaf->leafdata; |
206 | if (tulip_debug > 1) | 206 | if (tulip_debug > 1) |
207 | printk(KERN_DEBUG "%s: Resetting the transceiver\n", | 207 | netdev_dbg(dev, "Resetting the transceiver\n"); |
208 | dev->name); | ||
209 | for (i = 0; i < rst[0]; i++) | 208 | for (i = 0; i < rst[0]; i++) |
210 | iowrite32(get_u16(rst + 1 + (i<<1)) << 16, ioaddr + CSR15); | 209 | iowrite32(get_u16(rst + 1 + (i<<1)) << 16, ioaddr + CSR15); |
211 | } | 210 | } |
212 | if (tulip_debug > 1) | 211 | if (tulip_debug > 1) |
213 | printk(KERN_DEBUG "%s: 21143 non-MII %s transceiver control %04x/%04x\n", | 212 | netdev_dbg(dev, "21143 non-MII %s transceiver control %04x/%04x\n", |
214 | dev->name, medianame[dev->if_port], | 213 | medianame[dev->if_port], |
215 | setup[0], setup[1]); | 214 | setup[0], setup[1]); |
216 | if (p[0] & 0x40) { /* SIA (CSR13-15) setup values are provided. */ | 215 | if (p[0] & 0x40) { /* SIA (CSR13-15) setup values are provided. */ |
217 | csr13val = setup[0]; | 216 | csr13val = setup[0]; |
218 | csr14val = setup[1]; | 217 | csr14val = setup[1]; |
@@ -239,8 +238,8 @@ void tulip_select_media(struct net_device *dev, int startup) | |||
239 | if (startup) iowrite32(csr13val, ioaddr + CSR13); | 238 | if (startup) iowrite32(csr13val, ioaddr + CSR13); |
240 | } | 239 | } |
241 | if (tulip_debug > 1) | 240 | if (tulip_debug > 1) |
242 | printk(KERN_DEBUG "%s: Setting CSR15 to %08x/%08x\n", | 241 | netdev_dbg(dev, "Setting CSR15 to %08x/%08x\n", |
243 | dev->name, csr15dir, csr15val); | 242 | csr15dir, csr15val); |
244 | if (mleaf->type == 4) | 243 | if (mleaf->type == 4) |
245 | new_csr6 = 0x82020000 | ((setup[2] & 0x71) << 18); | 244 | new_csr6 = 0x82020000 | ((setup[2] & 0x71) << 18); |
246 | else | 245 | else |
@@ -316,9 +315,9 @@ void tulip_select_media(struct net_device *dev, int startup) | |||
316 | if (tp->mii_advertise == 0) | 315 | if (tp->mii_advertise == 0) |
317 | tp->mii_advertise = tp->advertising[phy_num]; | 316 | tp->mii_advertise = tp->advertising[phy_num]; |
318 | if (tulip_debug > 1) | 317 | if (tulip_debug > 1) |
319 | printk(KERN_DEBUG "%s: Advertising %04x on MII %d\n", | 318 | netdev_dbg(dev, " Advertising %04x on MII %d\n", |
320 | dev->name, tp->mii_advertise, | 319 | tp->mii_advertise, |
321 | tp->phys[phy_num]); | 320 | tp->phys[phy_num]); |
322 | tulip_mdio_write(dev, tp->phys[phy_num], 4, tp->mii_advertise); | 321 | tulip_mdio_write(dev, tp->phys[phy_num], 4, tp->mii_advertise); |
323 | } | 322 | } |
324 | break; | 323 | break; |
@@ -335,8 +334,7 @@ void tulip_select_media(struct net_device *dev, int startup) | |||
335 | struct medialeaf *rleaf = &mtable->mleaf[mtable->has_reset]; | 334 | struct medialeaf *rleaf = &mtable->mleaf[mtable->has_reset]; |
336 | unsigned char *rst = rleaf->leafdata; | 335 | unsigned char *rst = rleaf->leafdata; |
337 | if (tulip_debug > 1) | 336 | if (tulip_debug > 1) |
338 | printk(KERN_DEBUG "%s: Resetting the transceiver\n", | 337 | netdev_dbg(dev, "Resetting the transceiver\n"); |
339 | dev->name); | ||
340 | for (i = 0; i < rst[0]; i++) | 338 | for (i = 0; i < rst[0]; i++) |
341 | iowrite32(get_u16(rst + 1 + (i<<1)) << 16, ioaddr + CSR15); | 339 | iowrite32(get_u16(rst + 1 + (i<<1)) << 16, ioaddr + CSR15); |
342 | } | 340 | } |
@@ -344,20 +342,21 @@ void tulip_select_media(struct net_device *dev, int startup) | |||
344 | break; | 342 | break; |
345 | } | 343 | } |
346 | default: | 344 | default: |
347 | printk(KERN_DEBUG "%s: Invalid media table selection %d\n", | 345 | netdev_dbg(dev, " Invalid media table selection %d\n", |
348 | dev->name, mleaf->type); | 346 | mleaf->type); |
349 | new_csr6 = 0x020E0000; | 347 | new_csr6 = 0x020E0000; |
350 | } | 348 | } |
351 | if (tulip_debug > 1) | 349 | if (tulip_debug > 1) |
352 | printk(KERN_DEBUG "%s: Using media type %s, CSR12 is %02x\n", | 350 | netdev_dbg(dev, "Using media type %s, CSR12 is %02x\n", |
353 | dev->name, medianame[dev->if_port], | 351 | medianame[dev->if_port], |
354 | ioread32(ioaddr + CSR12) & 0xff); | 352 | ioread32(ioaddr + CSR12) & 0xff); |
355 | } else if (tp->chip_id == LC82C168) { | 353 | } else if (tp->chip_id == LC82C168) { |
356 | if (startup && ! tp->medialock) | 354 | if (startup && ! tp->medialock) |
357 | dev->if_port = tp->mii_cnt ? 11 : 0; | 355 | dev->if_port = tp->mii_cnt ? 11 : 0; |
358 | if (tulip_debug > 1) | 356 | if (tulip_debug > 1) |
359 | printk(KERN_DEBUG "%s: PNIC PHY status is %3.3x, media %s\n", | 357 | netdev_dbg(dev, "PNIC PHY status is %3.3x, media %s\n", |
360 | dev->name, ioread32(ioaddr + 0xB8), medianame[dev->if_port]); | 358 | ioread32(ioaddr + 0xB8), |
359 | medianame[dev->if_port]); | ||
361 | if (tp->mii_cnt) { | 360 | if (tp->mii_cnt) { |
362 | new_csr6 = 0x810C0000; | 361 | new_csr6 = 0x810C0000; |
363 | iowrite32(0x0001, ioaddr + CSR15); | 362 | iowrite32(0x0001, ioaddr + CSR15); |
@@ -388,9 +387,9 @@ void tulip_select_media(struct net_device *dev, int startup) | |||
388 | } else | 387 | } else |
389 | new_csr6 = 0x03860000; | 388 | new_csr6 = 0x03860000; |
390 | if (tulip_debug > 1) | 389 | if (tulip_debug > 1) |
391 | printk(KERN_DEBUG "%s: No media description table, assuming %s transceiver, CSR12 %02x\n", | 390 | netdev_dbg(dev, "No media description table, assuming %s transceiver, CSR12 %02x\n", |
392 | dev->name, medianame[dev->if_port], | 391 | medianame[dev->if_port], |
393 | ioread32(ioaddr + CSR12)); | 392 | ioread32(ioaddr + CSR12)); |
394 | } | 393 | } |
395 | 394 | ||
396 | tp->csr6 = new_csr6 | (tp->csr6 & 0xfdff) | (tp->full_duplex ? 0x0200 : 0); | 395 | tp->csr6 = new_csr6 | (tp->csr6 & 0xfdff) | (tp->full_duplex ? 0x0200 : 0); |
@@ -504,8 +503,8 @@ void __devinit tulip_find_mii (struct net_device *dev, int board_idx) | |||
504 | 503 | ||
505 | /* Fixup for DLink with miswired PHY. */ | 504 | /* Fixup for DLink with miswired PHY. */ |
506 | if (mii_advert != to_advert) { | 505 | if (mii_advert != to_advert) { |
507 | printk(KERN_DEBUG "tulip%d: Advertising %04x on PHY %d, previously advertising %04x\n", | 506 | pr_debug("tulip%d: Advertising %04x on PHY %d, previously advertising %04x\n", |
508 | board_idx, to_advert, phy, mii_advert); | 507 | board_idx, to_advert, phy, mii_advert); |
509 | tulip_mdio_write (dev, phy, 4, to_advert); | 508 | tulip_mdio_write (dev, phy, 4, to_advert); |
510 | } | 509 | } |
511 | 510 | ||
diff --git a/drivers/net/tulip/pnic.c b/drivers/net/tulip/pnic.c index a63e64b6863d..aa4d9dad0395 100644 --- a/drivers/net/tulip/pnic.c +++ b/drivers/net/tulip/pnic.c | |||
@@ -40,8 +40,8 @@ void pnic_do_nway(struct net_device *dev) | |||
40 | new_csr6 |= 0x00000200; | 40 | new_csr6 |= 0x00000200; |
41 | } | 41 | } |
42 | if (tulip_debug > 1) | 42 | if (tulip_debug > 1) |
43 | printk(KERN_DEBUG "%s: PNIC autonegotiated status %08x, %s\n", | 43 | netdev_dbg(dev, "PNIC autonegotiated status %08x, %s\n", |
44 | dev->name, phy_reg, medianame[dev->if_port]); | 44 | phy_reg, medianame[dev->if_port]); |
45 | if (tp->csr6 != new_csr6) { | 45 | if (tp->csr6 != new_csr6) { |
46 | tp->csr6 = new_csr6; | 46 | tp->csr6 = new_csr6; |
47 | /* Restart Tx */ | 47 | /* Restart Tx */ |
@@ -58,8 +58,8 @@ void pnic_lnk_change(struct net_device *dev, int csr5) | |||
58 | int phy_reg = ioread32(ioaddr + 0xB8); | 58 | int phy_reg = ioread32(ioaddr + 0xB8); |
59 | 59 | ||
60 | if (tulip_debug > 1) | 60 | if (tulip_debug > 1) |
61 | printk(KERN_DEBUG "%s: PNIC link changed state %08x, CSR5 %08x\n", | 61 | netdev_dbg(dev, "PNIC link changed state %08x, CSR5 %08x\n", |
62 | dev->name, phy_reg, csr5); | 62 | phy_reg, csr5); |
63 | if (ioread32(ioaddr + CSR5) & TPLnkFail) { | 63 | if (ioread32(ioaddr + CSR5) & TPLnkFail) { |
64 | iowrite32((ioread32(ioaddr + CSR7) & ~TPLnkFail) | TPLnkPass, ioaddr + CSR7); | 64 | iowrite32((ioread32(ioaddr + CSR7) & ~TPLnkFail) | TPLnkPass, ioaddr + CSR7); |
65 | /* If we use an external MII, then we mustn't use the | 65 | /* If we use an external MII, then we mustn't use the |
@@ -114,8 +114,8 @@ void pnic_timer(unsigned long data) | |||
114 | int csr5 = ioread32(ioaddr + CSR5); | 114 | int csr5 = ioread32(ioaddr + CSR5); |
115 | 115 | ||
116 | if (tulip_debug > 1) | 116 | if (tulip_debug > 1) |
117 | printk(KERN_DEBUG "%s: PNIC timer PHY status %08x, %s CSR5 %08x\n", | 117 | netdev_dbg(dev, "PNIC timer PHY status %08x, %s CSR5 %08x\n", |
118 | dev->name, phy_reg, medianame[dev->if_port], csr5); | 118 | phy_reg, medianame[dev->if_port], csr5); |
119 | if (phy_reg & 0x04000000) { /* Remote link fault */ | 119 | if (phy_reg & 0x04000000) { /* Remote link fault */ |
120 | iowrite32(0x0201F078, ioaddr + 0xB8); | 120 | iowrite32(0x0201F078, ioaddr + 0xB8); |
121 | next_tick = 1*HZ; | 121 | next_tick = 1*HZ; |
@@ -125,11 +125,11 @@ void pnic_timer(unsigned long data) | |||
125 | next_tick = 60*HZ; | 125 | next_tick = 60*HZ; |
126 | } else if (csr5 & TPLnkFail) { /* 100baseTx link beat */ | 126 | } else if (csr5 & TPLnkFail) { /* 100baseTx link beat */ |
127 | if (tulip_debug > 1) | 127 | if (tulip_debug > 1) |
128 | printk(KERN_DEBUG "%s: %s link beat failed, CSR12 %04x, CSR5 %08x, PHY %03x\n", | 128 | netdev_dbg(dev, "%s link beat failed, CSR12 %04x, CSR5 %08x, PHY %03x\n", |
129 | dev->name, medianame[dev->if_port], | 129 | medianame[dev->if_port], |
130 | csr12, | 130 | csr12, |
131 | ioread32(ioaddr + CSR5), | 131 | ioread32(ioaddr + CSR5), |
132 | ioread32(ioaddr + 0xB8)); | 132 | ioread32(ioaddr + 0xB8)); |
133 | next_tick = 3*HZ; | 133 | next_tick = 3*HZ; |
134 | if (tp->medialock) { | 134 | if (tp->medialock) { |
135 | } else if (tp->nwayset && (dev->if_port & 1)) { | 135 | } else if (tp->nwayset && (dev->if_port & 1)) { |
diff --git a/drivers/net/tulip/pnic2.c b/drivers/net/tulip/pnic2.c index 4690c8e69207..93358ee4d830 100644 --- a/drivers/net/tulip/pnic2.c +++ b/drivers/net/tulip/pnic2.c | |||
@@ -125,8 +125,8 @@ void pnic2_start_nway(struct net_device *dev) | |||
125 | csr14 |= 0x00001184; | 125 | csr14 |= 0x00001184; |
126 | 126 | ||
127 | if (tulip_debug > 1) | 127 | if (tulip_debug > 1) |
128 | printk(KERN_DEBUG "%s: Restarting PNIC2 autonegotiation, csr14=%08x\n", | 128 | netdev_dbg(dev, "Restarting PNIC2 autonegotiation, csr14=%08x\n", |
129 | dev->name, csr14); | 129 | csr14); |
130 | 130 | ||
131 | /* tell pnic2_lnk_change we are doing an nway negotiation */ | 131 | /* tell pnic2_lnk_change we are doing an nway negotiation */ |
132 | dev->if_port = 0; | 132 | dev->if_port = 0; |
@@ -137,8 +137,7 @@ void pnic2_start_nway(struct net_device *dev) | |||
137 | 137 | ||
138 | tp->csr6 = ioread32(ioaddr + CSR6); | 138 | tp->csr6 = ioread32(ioaddr + CSR6); |
139 | if (tulip_debug > 1) | 139 | if (tulip_debug > 1) |
140 | printk(KERN_DEBUG "%s: On Entry to Nway, csr6=%08x\n", | 140 | netdev_dbg(dev, "On Entry to Nway, csr6=%08x\n", tp->csr6); |
141 | dev->name, tp->csr6); | ||
142 | 141 | ||
143 | /* mask off any bits not to touch | 142 | /* mask off any bits not to touch |
144 | * comment at top of file explains mask value | 143 | * comment at top of file explains mask value |
@@ -271,9 +270,10 @@ void pnic2_lnk_change(struct net_device *dev, int csr5) | |||
271 | iowrite32(1, ioaddr + CSR13); | 270 | iowrite32(1, ioaddr + CSR13); |
272 | 271 | ||
273 | if (tulip_debug > 2) | 272 | if (tulip_debug > 2) |
274 | printk(KERN_DEBUG "%s: Setting CSR6 %08x/%x CSR12 %08x\n", | 273 | netdev_dbg(dev, "Setting CSR6 %08x/%x CSR12 %08x\n", |
275 | dev->name, tp->csr6, | 274 | tp->csr6, |
276 | ioread32(ioaddr + CSR6), ioread32(ioaddr + CSR12)); | 275 | ioread32(ioaddr + CSR6), |
276 | ioread32(ioaddr + CSR12)); | ||
277 | 277 | ||
278 | /* now the following actually writes out the | 278 | /* now the following actually writes out the |
279 | * new csr6 values | 279 | * new csr6 values |
@@ -324,7 +324,7 @@ void pnic2_lnk_change(struct net_device *dev, int csr5) | |||
324 | /* Link blew? Maybe restart NWay. */ | 324 | /* Link blew? Maybe restart NWay. */ |
325 | 325 | ||
326 | if (tulip_debug > 2) | 326 | if (tulip_debug > 2) |
327 | printk(KERN_DEBUG "%s: Ugh! Link blew?\n", dev->name); | 327 | netdev_dbg(dev, "Ugh! Link blew?\n"); |
328 | 328 | ||
329 | del_timer_sync(&tp->timer); | 329 | del_timer_sync(&tp->timer); |
330 | pnic2_start_nway(dev); | 330 | pnic2_start_nway(dev); |
diff --git a/drivers/net/tulip/timer.c b/drivers/net/tulip/timer.c index 36c2725ec886..2017faf2d0e6 100644 --- a/drivers/net/tulip/timer.c +++ b/drivers/net/tulip/timer.c | |||
@@ -28,11 +28,11 @@ void tulip_media_task(struct work_struct *work) | |||
28 | unsigned long flags; | 28 | unsigned long flags; |
29 | 29 | ||
30 | if (tulip_debug > 2) { | 30 | if (tulip_debug > 2) { |
31 | printk(KERN_DEBUG "%s: Media selection tick, %s, status %08x mode %08x SIA %08x %08x %08x %08x\n", | 31 | netdev_dbg(dev, "Media selection tick, %s, status %08x mode %08x SIA %08x %08x %08x %08x\n", |
32 | dev->name, medianame[dev->if_port], | 32 | medianame[dev->if_port], |
33 | ioread32(ioaddr + CSR5), ioread32(ioaddr + CSR6), | 33 | ioread32(ioaddr + CSR5), ioread32(ioaddr + CSR6), |
34 | csr12, ioread32(ioaddr + CSR13), | 34 | csr12, ioread32(ioaddr + CSR13), |
35 | ioread32(ioaddr + CSR14), ioread32(ioaddr + CSR15)); | 35 | ioread32(ioaddr + CSR14), ioread32(ioaddr + CSR15)); |
36 | } | 36 | } |
37 | switch (tp->chip_id) { | 37 | switch (tp->chip_id) { |
38 | case DC21140: | 38 | case DC21140: |
@@ -48,9 +48,9 @@ void tulip_media_task(struct work_struct *work) | |||
48 | Assume this a generic MII or SYM transceiver. */ | 48 | Assume this a generic MII or SYM transceiver. */ |
49 | next_tick = 60*HZ; | 49 | next_tick = 60*HZ; |
50 | if (tulip_debug > 2) | 50 | if (tulip_debug > 2) |
51 | printk(KERN_DEBUG "%s: network media monitor CSR6 %08x CSR12 0x%02x\n", | 51 | netdev_dbg(dev, "network media monitor CSR6 %08x CSR12 0x%02x\n", |
52 | dev->name, | 52 | ioread32(ioaddr + CSR6), |
53 | ioread32(ioaddr + CSR6), csr12 & 0xff); | 53 | csr12 & 0xff); |
54 | break; | 54 | break; |
55 | } | 55 | } |
56 | mleaf = &tp->mtable->mleaf[tp->cur_index]; | 56 | mleaf = &tp->mtable->mleaf[tp->cur_index]; |
@@ -62,8 +62,8 @@ void tulip_media_task(struct work_struct *work) | |||
62 | s8 bitnum = p[offset]; | 62 | s8 bitnum = p[offset]; |
63 | if (p[offset+1] & 0x80) { | 63 | if (p[offset+1] & 0x80) { |
64 | if (tulip_debug > 1) | 64 | if (tulip_debug > 1) |
65 | printk(KERN_DEBUG "%s: Transceiver monitor tick CSR12=%#02x, no media sense\n", | 65 | netdev_dbg(dev, "Transceiver monitor tick CSR12=%#02x, no media sense\n", |
66 | dev->name, csr12); | 66 | csr12); |
67 | if (mleaf->type == 4) { | 67 | if (mleaf->type == 4) { |
68 | if (mleaf->media == 3 && (csr12 & 0x02)) | 68 | if (mleaf->media == 3 && (csr12 & 0x02)) |
69 | goto select_next_media; | 69 | goto select_next_media; |
@@ -71,17 +71,16 @@ void tulip_media_task(struct work_struct *work) | |||
71 | break; | 71 | break; |
72 | } | 72 | } |
73 | if (tulip_debug > 2) | 73 | if (tulip_debug > 2) |
74 | printk(KERN_DEBUG "%s: Transceiver monitor tick: CSR12=%#02x bit %d is %d, expecting %d\n", | 74 | netdev_dbg(dev, "Transceiver monitor tick: CSR12=%#02x bit %d is %d, expecting %d\n", |
75 | dev->name, csr12, (bitnum >> 1) & 7, | 75 | csr12, (bitnum >> 1) & 7, |
76 | (csr12 & (1 << ((bitnum >> 1) & 7))) != 0, | 76 | (csr12 & (1 << ((bitnum >> 1) & 7))) != 0, |
77 | (bitnum >= 0)); | 77 | (bitnum >= 0)); |
78 | /* Check that the specified bit has the proper value. */ | 78 | /* Check that the specified bit has the proper value. */ |
79 | if ((bitnum < 0) != | 79 | if ((bitnum < 0) != |
80 | ((csr12 & (1 << ((bitnum >> 1) & 7))) != 0)) { | 80 | ((csr12 & (1 << ((bitnum >> 1) & 7))) != 0)) { |
81 | if (tulip_debug > 2) | 81 | if (tulip_debug > 2) |
82 | printk(KERN_DEBUG "%s: Link beat detected for %s\n", | 82 | netdev_dbg(dev, "Link beat detected for %s\n", |
83 | dev->name, | 83 | medianame[mleaf->media & MEDIA_MASK]); |
84 | medianame[mleaf->media & MEDIA_MASK]); | ||
85 | if ((p[2] & 0x61) == 0x01) /* Bogus Znyx board. */ | 84 | if ((p[2] & 0x61) == 0x01) /* Bogus Znyx board. */ |
86 | goto actually_mii; | 85 | goto actually_mii; |
87 | netif_carrier_on(dev); | 86 | netif_carrier_on(dev); |
@@ -99,10 +98,9 @@ void tulip_media_task(struct work_struct *work) | |||
99 | if (tulip_media_cap[dev->if_port] & MediaIsFD) | 98 | if (tulip_media_cap[dev->if_port] & MediaIsFD) |
100 | goto select_next_media; /* Skip FD entries. */ | 99 | goto select_next_media; /* Skip FD entries. */ |
101 | if (tulip_debug > 1) | 100 | if (tulip_debug > 1) |
102 | printk(KERN_DEBUG "%s: No link beat on media %s, trying transceiver type %s\n", | 101 | netdev_dbg(dev, "No link beat on media %s, trying transceiver type %s\n", |
103 | dev->name, | 102 | medianame[mleaf->media & MEDIA_MASK], |
104 | medianame[mleaf->media & MEDIA_MASK], | 103 | medianame[tp->mtable->mleaf[tp->cur_index].media]); |
105 | medianame[tp->mtable->mleaf[tp->cur_index].media]); | ||
106 | tulip_select_media(dev, 0); | 104 | tulip_select_media(dev, 0); |
107 | /* Restart the transmit process. */ | 105 | /* Restart the transmit process. */ |
108 | tulip_restart_rxtx(tp); | 106 | tulip_restart_rxtx(tp); |
@@ -166,10 +164,9 @@ void comet_timer(unsigned long data) | |||
166 | int next_tick = 60*HZ; | 164 | int next_tick = 60*HZ; |
167 | 165 | ||
168 | if (tulip_debug > 1) | 166 | if (tulip_debug > 1) |
169 | printk(KERN_DEBUG "%s: Comet link status %04x partner capability %04x\n", | 167 | netdev_dbg(dev, "Comet link status %04x partner capability %04x\n", |
170 | dev->name, | 168 | tulip_mdio_read(dev, tp->phys[0], 1), |
171 | tulip_mdio_read(dev, tp->phys[0], 1), | 169 | tulip_mdio_read(dev, tp->phys[0], 5)); |
172 | tulip_mdio_read(dev, tp->phys[0], 5)); | ||
173 | /* mod_timer synchronizes us with potential add_timer calls | 170 | /* mod_timer synchronizes us with potential add_timer calls |
174 | * from interrupts. | 171 | * from interrupts. |
175 | */ | 172 | */ |
diff --git a/drivers/net/tulip/tulip.h b/drivers/net/tulip/tulip.h index ed66a16711dc..9db528967da9 100644 --- a/drivers/net/tulip/tulip.h +++ b/drivers/net/tulip/tulip.h | |||
@@ -547,11 +547,9 @@ static inline void tulip_stop_rxtx(struct tulip_private *tp) | |||
547 | udelay(10); | 547 | udelay(10); |
548 | 548 | ||
549 | if (!i) | 549 | if (!i) |
550 | printk(KERN_DEBUG "%s: tulip_stop_rxtx() failed" | 550 | netdev_dbg(tp->dev, "tulip_stop_rxtx() failed (CSR5 0x%x CSR6 0x%x)\n", |
551 | " (CSR5 0x%x CSR6 0x%x)\n", | 551 | ioread32(ioaddr + CSR5), |
552 | pci_name(tp->pdev), | 552 | ioread32(ioaddr + CSR6)); |
553 | ioread32(ioaddr + CSR5), | ||
554 | ioread32(ioaddr + CSR6)); | ||
555 | } | 553 | } |
556 | } | 554 | } |
557 | 555 | ||
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index 5c01e260f1ba..82f87647207e 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c | |||
@@ -12,6 +12,7 @@ | |||
12 | Please submit bugs to http://bugzilla.kernel.org/ . | 12 | Please submit bugs to http://bugzilla.kernel.org/ . |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #define pr_fmt(fmt) "tulip: " fmt | ||
15 | 16 | ||
16 | #define DRV_NAME "tulip" | 17 | #define DRV_NAME "tulip" |
17 | #ifdef CONFIG_TULIP_NAPI | 18 | #ifdef CONFIG_TULIP_NAPI |
@@ -119,8 +120,6 @@ module_param(csr0, int, 0); | |||
119 | module_param_array(options, int, NULL, 0); | 120 | module_param_array(options, int, NULL, 0); |
120 | module_param_array(full_duplex, int, NULL, 0); | 121 | module_param_array(full_duplex, int, NULL, 0); |
121 | 122 | ||
122 | #define PFX DRV_NAME ": " | ||
123 | |||
124 | #ifdef TULIP_DEBUG | 123 | #ifdef TULIP_DEBUG |
125 | int tulip_debug = TULIP_DEBUG; | 124 | int tulip_debug = TULIP_DEBUG; |
126 | #else | 125 | #else |
@@ -331,8 +330,7 @@ static void tulip_up(struct net_device *dev) | |||
331 | udelay(100); | 330 | udelay(100); |
332 | 331 | ||
333 | if (tulip_debug > 1) | 332 | if (tulip_debug > 1) |
334 | printk(KERN_DEBUG "%s: tulip_up(), irq==%d\n", | 333 | netdev_dbg(dev, "tulip_up(), irq==%d\n", dev->irq); |
335 | dev->name, dev->irq); | ||
336 | 334 | ||
337 | iowrite32(tp->rx_ring_dma, ioaddr + CSR3); | 335 | iowrite32(tp->rx_ring_dma, ioaddr + CSR3); |
338 | iowrite32(tp->tx_ring_dma, ioaddr + CSR4); | 336 | iowrite32(tp->tx_ring_dma, ioaddr + CSR4); |
@@ -499,10 +497,10 @@ media_picked: | |||
499 | iowrite32(0, ioaddr + CSR2); /* Rx poll demand */ | 497 | iowrite32(0, ioaddr + CSR2); /* Rx poll demand */ |
500 | 498 | ||
501 | if (tulip_debug > 2) { | 499 | if (tulip_debug > 2) { |
502 | printk(KERN_DEBUG "%s: Done tulip_up(), CSR0 %08x, CSR5 %08x CSR6 %08x\n", | 500 | netdev_dbg(dev, "Done tulip_up(), CSR0 %08x, CSR5 %08x CSR6 %08x\n", |
503 | dev->name, ioread32(ioaddr + CSR0), | 501 | ioread32(ioaddr + CSR0), |
504 | ioread32(ioaddr + CSR5), | 502 | ioread32(ioaddr + CSR5), |
505 | ioread32(ioaddr + CSR6)); | 503 | ioread32(ioaddr + CSR6)); |
506 | } | 504 | } |
507 | 505 | ||
508 | /* Set the timer to switch to check for link beat and perhaps switch | 506 | /* Set the timer to switch to check for link beat and perhaps switch |
@@ -843,8 +841,7 @@ static int tulip_close (struct net_device *dev) | |||
843 | tulip_down (dev); | 841 | tulip_down (dev); |
844 | 842 | ||
845 | if (tulip_debug > 1) | 843 | if (tulip_debug > 1) |
846 | dev_printk(KERN_DEBUG, &dev->dev, | 844 | netdev_dbg(dev, "Shutting down ethercard, status was %02x\n", |
847 | "Shutting down ethercard, status was %02x\n", | ||
848 | ioread32 (ioaddr + CSR5)); | 845 | ioread32 (ioaddr + CSR5)); |
849 | 846 | ||
850 | free_irq (dev->irq, dev); | 847 | free_irq (dev->irq, dev); |
@@ -1207,7 +1204,7 @@ static void __devinit tulip_mwi_config (struct pci_dev *pdev, | |||
1207 | u32 csr0; | 1204 | u32 csr0; |
1208 | 1205 | ||
1209 | if (tulip_debug > 3) | 1206 | if (tulip_debug > 3) |
1210 | printk(KERN_DEBUG "%s: tulip_mwi_config()\n", pci_name(pdev)); | 1207 | netdev_dbg(dev, "tulip_mwi_config()\n"); |
1211 | 1208 | ||
1212 | tp->csr0 = csr0 = 0; | 1209 | tp->csr0 = csr0 = 0; |
1213 | 1210 | ||
@@ -1269,8 +1266,8 @@ static void __devinit tulip_mwi_config (struct pci_dev *pdev, | |||
1269 | out: | 1266 | out: |
1270 | tp->csr0 = csr0; | 1267 | tp->csr0 = csr0; |
1271 | if (tulip_debug > 2) | 1268 | if (tulip_debug > 2) |
1272 | printk(KERN_DEBUG "%s: MWI config cacheline=%d, csr0=%08x\n", | 1269 | netdev_dbg(dev, "MWI config cacheline=%d, csr0=%08x\n", |
1273 | pci_name(pdev), cache, csr0); | 1270 | cache, csr0); |
1274 | } | 1271 | } |
1275 | #endif | 1272 | #endif |
1276 | 1273 | ||
@@ -1340,13 +1337,13 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, | |||
1340 | */ | 1337 | */ |
1341 | 1338 | ||
1342 | if (pdev->subsystem_vendor == PCI_VENDOR_ID_LMC) { | 1339 | if (pdev->subsystem_vendor == PCI_VENDOR_ID_LMC) { |
1343 | pr_err(PFX "skipping LMC card\n"); | 1340 | pr_err("skipping LMC card\n"); |
1344 | return -ENODEV; | 1341 | return -ENODEV; |
1345 | } else if (pdev->subsystem_vendor == PCI_VENDOR_ID_SBE && | 1342 | } else if (pdev->subsystem_vendor == PCI_VENDOR_ID_SBE && |
1346 | (pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_T3E3 || | 1343 | (pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_T3E3 || |
1347 | pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_2T3E3_P0 || | 1344 | pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_2T3E3_P0 || |
1348 | pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_2T3E3_P1)) { | 1345 | pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_2T3E3_P1)) { |
1349 | pr_err(PFX "skipping SBE T3E3 port\n"); | 1346 | pr_err("skipping SBE T3E3 port\n"); |
1350 | return -ENODEV; | 1347 | return -ENODEV; |
1351 | } | 1348 | } |
1352 | 1349 | ||
@@ -1362,13 +1359,13 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, | |||
1362 | 1359 | ||
1363 | if (pdev->vendor == 0x1282 && pdev->device == 0x9100 && | 1360 | if (pdev->vendor == 0x1282 && pdev->device == 0x9100 && |
1364 | pdev->revision < 0x30) { | 1361 | pdev->revision < 0x30) { |
1365 | pr_info(PFX "skipping early DM9100 with Crc bug (use dmfe)\n"); | 1362 | pr_info("skipping early DM9100 with Crc bug (use dmfe)\n"); |
1366 | return -ENODEV; | 1363 | return -ENODEV; |
1367 | } | 1364 | } |
1368 | 1365 | ||
1369 | dp = pci_device_to_OF_node(pdev); | 1366 | dp = pci_device_to_OF_node(pdev); |
1370 | if (!(dp && of_get_property(dp, "local-mac-address", NULL))) { | 1367 | if (!(dp && of_get_property(dp, "local-mac-address", NULL))) { |
1371 | pr_info(PFX "skipping DM910x expansion card (use dmfe)\n"); | 1368 | pr_info("skipping DM910x expansion card (use dmfe)\n"); |
1372 | return -ENODEV; | 1369 | return -ENODEV; |
1373 | } | 1370 | } |
1374 | } | 1371 | } |
@@ -1415,16 +1412,14 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, | |||
1415 | 1412 | ||
1416 | i = pci_enable_device(pdev); | 1413 | i = pci_enable_device(pdev); |
1417 | if (i) { | 1414 | if (i) { |
1418 | pr_err(PFX "Cannot enable tulip board #%d, aborting\n", | 1415 | pr_err("Cannot enable tulip board #%d, aborting\n", board_idx); |
1419 | board_idx); | ||
1420 | return i; | 1416 | return i; |
1421 | } | 1417 | } |
1422 | 1418 | ||
1423 | /* The chip will fail to enter a low-power state later unless | 1419 | /* The chip will fail to enter a low-power state later unless |
1424 | * first explicitly commanded into D0 */ | 1420 | * first explicitly commanded into D0 */ |
1425 | if (pci_set_power_state(pdev, PCI_D0)) { | 1421 | if (pci_set_power_state(pdev, PCI_D0)) { |
1426 | printk (KERN_NOTICE PFX | 1422 | pr_notice("Failed to set power state to D0\n"); |
1427 | "Failed to set power state to D0\n"); | ||
1428 | } | 1423 | } |
1429 | 1424 | ||
1430 | irq = pdev->irq; | 1425 | irq = pdev->irq; |
@@ -1432,13 +1427,13 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, | |||
1432 | /* alloc_etherdev ensures aligned and zeroed private structures */ | 1427 | /* alloc_etherdev ensures aligned and zeroed private structures */ |
1433 | dev = alloc_etherdev (sizeof (*tp)); | 1428 | dev = alloc_etherdev (sizeof (*tp)); |
1434 | if (!dev) { | 1429 | if (!dev) { |
1435 | pr_err(PFX "ether device alloc failed, aborting\n"); | 1430 | pr_err("ether device alloc failed, aborting\n"); |
1436 | return -ENOMEM; | 1431 | return -ENOMEM; |
1437 | } | 1432 | } |
1438 | 1433 | ||
1439 | SET_NETDEV_DEV(dev, &pdev->dev); | 1434 | SET_NETDEV_DEV(dev, &pdev->dev); |
1440 | if (pci_resource_len (pdev, 0) < tulip_tbl[chip_idx].io_size) { | 1435 | if (pci_resource_len (pdev, 0) < tulip_tbl[chip_idx].io_size) { |
1441 | pr_err(PFX "%s: I/O region (0x%llx@0x%llx) too small, aborting\n", | 1436 | pr_err("%s: I/O region (0x%llx@0x%llx) too small, aborting\n", |
1442 | pci_name(pdev), | 1437 | pci_name(pdev), |
1443 | (unsigned long long)pci_resource_len (pdev, 0), | 1438 | (unsigned long long)pci_resource_len (pdev, 0), |
1444 | (unsigned long long)pci_resource_start (pdev, 0)); | 1439 | (unsigned long long)pci_resource_start (pdev, 0)); |
@@ -1483,7 +1478,8 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, | |||
1483 | if (sig == 0x09811317) { | 1478 | if (sig == 0x09811317) { |
1484 | tp->flags |= COMET_PM; | 1479 | tp->flags |= COMET_PM; |
1485 | tp->wolinfo.supported = WAKE_PHY | WAKE_MAGIC; | 1480 | tp->wolinfo.supported = WAKE_PHY | WAKE_MAGIC; |
1486 | printk(KERN_INFO "tulip_init_one: Enabled WOL support for AN983B\n"); | 1481 | pr_info("%s: Enabled WOL support for AN983B\n", |
1482 | __func__); | ||
1487 | } | 1483 | } |
1488 | } | 1484 | } |
1489 | tp->pdev = pdev; | 1485 | tp->pdev = pdev; |
@@ -1879,7 +1875,7 @@ save_state: | |||
1879 | tulip_set_wolopts(pdev, tp->wolinfo.wolopts); | 1875 | tulip_set_wolopts(pdev, tp->wolinfo.wolopts); |
1880 | rc = pci_enable_wake(pdev, pstate, tp->wolinfo.wolopts); | 1876 | rc = pci_enable_wake(pdev, pstate, tp->wolinfo.wolopts); |
1881 | if (rc) | 1877 | if (rc) |
1882 | printk("tulip: pci_enable_wake failed (%d)\n", rc); | 1878 | pr_err("pci_enable_wake failed (%d)\n", rc); |
1883 | } | 1879 | } |
1884 | pci_set_power_state(pdev, pstate); | 1880 | pci_set_power_state(pdev, pstate); |
1885 | 1881 | ||
@@ -1905,12 +1901,12 @@ static int tulip_resume(struct pci_dev *pdev) | |||
1905 | return 0; | 1901 | return 0; |
1906 | 1902 | ||
1907 | if ((retval = pci_enable_device(pdev))) { | 1903 | if ((retval = pci_enable_device(pdev))) { |
1908 | pr_err(PFX "pci_enable_device failed in resume\n"); | 1904 | pr_err("pci_enable_device failed in resume\n"); |
1909 | return retval; | 1905 | return retval; |
1910 | } | 1906 | } |
1911 | 1907 | ||
1912 | if ((retval = request_irq(dev->irq, tulip_interrupt, IRQF_SHARED, dev->name, dev))) { | 1908 | if ((retval = request_irq(dev->irq, tulip_interrupt, IRQF_SHARED, dev->name, dev))) { |
1913 | pr_err(PFX "request_irq failed in resume\n"); | 1909 | pr_err("request_irq failed in resume\n"); |
1914 | return retval; | 1910 | return retval; |
1915 | } | 1911 | } |
1916 | 1912 | ||
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c index a4375c406b5f..9e63f406f72d 100644 --- a/drivers/net/tulip/uli526x.c +++ b/drivers/net/tulip/uli526x.c | |||
@@ -209,8 +209,7 @@ enum uli526x_CR6_bits { | |||
209 | /* Global variable declaration ----------------------------- */ | 209 | /* Global variable declaration ----------------------------- */ |
210 | static int __devinitdata printed_version; | 210 | static int __devinitdata printed_version; |
211 | static const char version[] __devinitconst = | 211 | static const char version[] __devinitconst = |
212 | KERN_INFO DRV_NAME ": ULi M5261/M5263 net driver, version " | 212 | "ULi M5261/M5263 net driver, version " DRV_VERSION " (" DRV_RELDATE ")"; |
213 | DRV_VERSION " (" DRV_RELDATE ")\n"; | ||
214 | 213 | ||
215 | static int uli526x_debug; | 214 | static int uli526x_debug; |
216 | static unsigned char uli526x_media_mode = ULI526X_AUTO; | 215 | static unsigned char uli526x_media_mode = ULI526X_AUTO; |
@@ -283,7 +282,7 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev, | |||
283 | ULI526X_DBUG(0, "uli526x_init_one()", 0); | 282 | ULI526X_DBUG(0, "uli526x_init_one()", 0); |
284 | 283 | ||
285 | if (!printed_version++) | 284 | if (!printed_version++) |
286 | printk(version); | 285 | pr_info("%s\n", version); |
287 | 286 | ||
288 | /* Init network device */ | 287 | /* Init network device */ |
289 | dev = alloc_etherdev(sizeof(*db)); | 288 | dev = alloc_etherdev(sizeof(*db)); |
@@ -292,7 +291,7 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev, | |||
292 | SET_NETDEV_DEV(dev, &pdev->dev); | 291 | SET_NETDEV_DEV(dev, &pdev->dev); |
293 | 292 | ||
294 | if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { | 293 | if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { |
295 | pr_warning("32-bit PCI DMA not available\n"); | 294 | pr_warn("32-bit PCI DMA not available\n"); |
296 | err = -ENODEV; | 295 | err = -ENODEV; |
297 | goto err_out_free; | 296 | goto err_out_free; |
298 | } | 297 | } |
@@ -390,9 +389,9 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev, | |||
390 | if (err) | 389 | if (err) |
391 | goto err_out_res; | 390 | goto err_out_res; |
392 | 391 | ||
393 | dev_info(&dev->dev, "ULi M%04lx at pci%s, %pM, irq %d\n", | 392 | netdev_info(dev, "ULi M%04lx at pci%s, %pM, irq %d\n", |
394 | ent->driver_data >> 16, pci_name(pdev), | 393 | ent->driver_data >> 16, pci_name(pdev), |
395 | dev->dev_addr, dev->irq); | 394 | dev->dev_addr, dev->irq); |
396 | 395 | ||
397 | pci_set_master(pdev); | 396 | pci_set_master(pdev); |
398 | 397 | ||
@@ -524,7 +523,7 @@ static void uli526x_init(struct net_device *dev) | |||
524 | } | 523 | } |
525 | } | 524 | } |
526 | if(phy_tmp == 32) | 525 | if(phy_tmp == 32) |
527 | pr_warning("Can not find the phy address!!!"); | 526 | pr_warn("Can not find the phy address!!!\n"); |
528 | /* Parser SROM and media mode */ | 527 | /* Parser SROM and media mode */ |
529 | db->media_mode = uli526x_media_mode; | 528 | db->media_mode = uli526x_media_mode; |
530 | 529 | ||
@@ -590,7 +589,7 @@ static netdev_tx_t uli526x_start_xmit(struct sk_buff *skb, | |||
590 | 589 | ||
591 | /* Too large packet check */ | 590 | /* Too large packet check */ |
592 | if (skb->len > MAX_PACKET_SIZE) { | 591 | if (skb->len > MAX_PACKET_SIZE) { |
593 | pr_err("big packet = %d\n", (u16)skb->len); | 592 | netdev_err(dev, "big packet = %d\n", (u16)skb->len); |
594 | dev_kfree_skb(skb); | 593 | dev_kfree_skb(skb); |
595 | return NETDEV_TX_OK; | 594 | return NETDEV_TX_OK; |
596 | } | 595 | } |
@@ -600,7 +599,7 @@ static netdev_tx_t uli526x_start_xmit(struct sk_buff *skb, | |||
600 | /* No Tx resource check, it never happen nromally */ | 599 | /* No Tx resource check, it never happen nromally */ |
601 | if (db->tx_packet_cnt >= TX_FREE_DESC_CNT) { | 600 | if (db->tx_packet_cnt >= TX_FREE_DESC_CNT) { |
602 | spin_unlock_irqrestore(&db->lock, flags); | 601 | spin_unlock_irqrestore(&db->lock, flags); |
603 | pr_err("No Tx resource %ld\n", db->tx_packet_cnt); | 602 | netdev_err(dev, "No Tx resource %ld\n", db->tx_packet_cnt); |
604 | return NETDEV_TX_BUSY; | 603 | return NETDEV_TX_BUSY; |
605 | } | 604 | } |
606 | 605 | ||
@@ -667,15 +666,6 @@ static int uli526x_stop(struct net_device *dev) | |||
667 | /* free allocated rx buffer */ | 666 | /* free allocated rx buffer */ |
668 | uli526x_free_rxbuffer(db); | 667 | uli526x_free_rxbuffer(db); |
669 | 668 | ||
670 | #if 0 | ||
671 | /* show statistic counter */ | ||
672 | printk(DRV_NAME ": FU:%lx EC:%lx LC:%lx NC:%lx LOC:%lx TXJT:%lx RESET:%lx RCR8:%lx FAL:%lx TT:%lx\n", | ||
673 | db->tx_fifo_underrun, db->tx_excessive_collision, | ||
674 | db->tx_late_collision, db->tx_no_carrier, db->tx_loss_carrier, | ||
675 | db->tx_jabber_timeout, db->reset_count, db->reset_cr8, | ||
676 | db->reset_fatal, db->reset_TXtimeout); | ||
677 | #endif | ||
678 | |||
679 | return 0; | 669 | return 0; |
680 | } | 670 | } |
681 | 671 | ||
@@ -755,7 +745,6 @@ static void uli526x_free_tx_pkt(struct net_device *dev, | |||
755 | txptr = db->tx_remove_ptr; | 745 | txptr = db->tx_remove_ptr; |
756 | while(db->tx_packet_cnt) { | 746 | while(db->tx_packet_cnt) { |
757 | tdes0 = le32_to_cpu(txptr->tdes0); | 747 | tdes0 = le32_to_cpu(txptr->tdes0); |
758 | /* printk(DRV_NAME ": tdes0=%x\n", tdes0); */ | ||
759 | if (tdes0 & 0x80000000) | 748 | if (tdes0 & 0x80000000) |
760 | break; | 749 | break; |
761 | 750 | ||
@@ -765,7 +754,6 @@ static void uli526x_free_tx_pkt(struct net_device *dev, | |||
765 | 754 | ||
766 | /* Transmit statistic counter */ | 755 | /* Transmit statistic counter */ |
767 | if ( tdes0 != 0x7fffffff ) { | 756 | if ( tdes0 != 0x7fffffff ) { |
768 | /* printk(DRV_NAME ": tdes0=%x\n", tdes0); */ | ||
769 | dev->stats.collisions += (tdes0 >> 3) & 0xf; | 757 | dev->stats.collisions += (tdes0 >> 3) & 0xf; |
770 | dev->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff; | 758 | dev->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff; |
771 | if (tdes0 & TDES0_ERR_MASK) { | 759 | if (tdes0 & TDES0_ERR_MASK) { |
@@ -838,7 +826,6 @@ static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info | |||
838 | /* error summary bit check */ | 826 | /* error summary bit check */ |
839 | if (rdes0 & 0x8000) { | 827 | if (rdes0 & 0x8000) { |
840 | /* This is a error packet */ | 828 | /* This is a error packet */ |
841 | //printk(DRV_NAME ": rdes0: %lx\n", rdes0); | ||
842 | dev->stats.rx_errors++; | 829 | dev->stats.rx_errors++; |
843 | if (rdes0 & 1) | 830 | if (rdes0 & 1) |
844 | dev->stats.rx_fifo_errors++; | 831 | dev->stats.rx_fifo_errors++; |
@@ -1024,7 +1011,6 @@ static void uli526x_timer(unsigned long data) | |||
1024 | struct net_device *dev = (struct net_device *) data; | 1011 | struct net_device *dev = (struct net_device *) data; |
1025 | struct uli526x_board_info *db = netdev_priv(dev); | 1012 | struct uli526x_board_info *db = netdev_priv(dev); |
1026 | unsigned long flags; | 1013 | unsigned long flags; |
1027 | u8 TmpSpeed=10; | ||
1028 | 1014 | ||
1029 | //ULI526X_DBUG(0, "uli526x_timer()", 0); | 1015 | //ULI526X_DBUG(0, "uli526x_timer()", 0); |
1030 | spin_lock_irqsave(&db->lock, flags); | 1016 | spin_lock_irqsave(&db->lock, flags); |
@@ -1047,8 +1033,7 @@ static void uli526x_timer(unsigned long data) | |||
1047 | if ( time_after(jiffies, dev_trans_start(dev) + ULI526X_TX_TIMEOUT) ) { | 1033 | if ( time_after(jiffies, dev_trans_start(dev) + ULI526X_TX_TIMEOUT) ) { |
1048 | db->reset_TXtimeout++; | 1034 | db->reset_TXtimeout++; |
1049 | db->wait_reset = 1; | 1035 | db->wait_reset = 1; |
1050 | printk( "%s: Tx timeout - resetting\n", | 1036 | netdev_err(dev, " Tx timeout - resetting\n"); |
1051 | dev->name); | ||
1052 | } | 1037 | } |
1053 | } | 1038 | } |
1054 | 1039 | ||
@@ -1070,7 +1055,7 @@ static void uli526x_timer(unsigned long data) | |||
1070 | /* Link Failed */ | 1055 | /* Link Failed */ |
1071 | ULI526X_DBUG(0, "Link Failed", tmp_cr12); | 1056 | ULI526X_DBUG(0, "Link Failed", tmp_cr12); |
1072 | netif_carrier_off(dev); | 1057 | netif_carrier_off(dev); |
1073 | pr_info("%s NIC Link is Down\n",dev->name); | 1058 | netdev_info(dev, "NIC Link is Down\n"); |
1074 | db->link_failed = 1; | 1059 | db->link_failed = 1; |
1075 | 1060 | ||
1076 | /* For Force 10/100M Half/Full mode: Enable Auto-Nego mode */ | 1061 | /* For Force 10/100M Half/Full mode: Enable Auto-Nego mode */ |
@@ -1096,18 +1081,13 @@ static void uli526x_timer(unsigned long data) | |||
1096 | 1081 | ||
1097 | if(db->link_failed==0) | 1082 | if(db->link_failed==0) |
1098 | { | 1083 | { |
1099 | if(db->op_mode==ULI526X_100MHF || db->op_mode==ULI526X_100MFD) | 1084 | netdev_info(dev, "NIC Link is Up %d Mbps %s duplex\n", |
1100 | { | 1085 | (db->op_mode == ULI526X_100MHF || |
1101 | TmpSpeed = 100; | 1086 | db->op_mode == ULI526X_100MFD) |
1102 | } | 1087 | ? 100 : 10, |
1103 | if(db->op_mode==ULI526X_10MFD || db->op_mode==ULI526X_100MFD) | 1088 | (db->op_mode == ULI526X_10MFD || |
1104 | { | 1089 | db->op_mode == ULI526X_100MFD) |
1105 | pr_info("%s NIC Link is Up %d Mbps Full duplex\n",dev->name,TmpSpeed); | 1090 | ? "Full" : "Half"); |
1106 | } | ||
1107 | else | ||
1108 | { | ||
1109 | pr_info("%s NIC Link is Up %d Mbps Half duplex\n",dev->name,TmpSpeed); | ||
1110 | } | ||
1111 | netif_carrier_on(dev); | 1091 | netif_carrier_on(dev); |
1112 | } | 1092 | } |
1113 | /* SHOW_MEDIA_TYPE(db->op_mode); */ | 1093 | /* SHOW_MEDIA_TYPE(db->op_mode); */ |
@@ -1116,7 +1096,7 @@ static void uli526x_timer(unsigned long data) | |||
1116 | { | 1096 | { |
1117 | if(db->init==1) | 1097 | if(db->init==1) |
1118 | { | 1098 | { |
1119 | pr_info("%s NIC Link is Down\n",dev->name); | 1099 | netdev_info(dev, "NIC Link is Down\n"); |
1120 | netif_carrier_off(dev); | 1100 | netif_carrier_off(dev); |
1121 | } | 1101 | } |
1122 | } | 1102 | } |
@@ -1242,7 +1222,7 @@ static int uli526x_resume(struct pci_dev *pdev) | |||
1242 | 1222 | ||
1243 | err = pci_set_power_state(pdev, PCI_D0); | 1223 | err = pci_set_power_state(pdev, PCI_D0); |
1244 | if (err) { | 1224 | if (err) { |
1245 | dev_warn(&dev->dev, "Could not put device into D0\n"); | 1225 | netdev_warn(dev, "Could not put device into D0\n"); |
1246 | return err; | 1226 | return err; |
1247 | } | 1227 | } |
1248 | 1228 | ||
@@ -1443,7 +1423,7 @@ static void send_filter_frame(struct net_device *dev, int mc_cnt) | |||
1443 | update_cr6(db->cr6_data, dev->base_addr); | 1423 | update_cr6(db->cr6_data, dev->base_addr); |
1444 | dev->trans_start = jiffies; | 1424 | dev->trans_start = jiffies; |
1445 | } else | 1425 | } else |
1446 | pr_err("No Tx resource - Send_filter_frame!\n"); | 1426 | netdev_err(dev, "No Tx resource - Send_filter_frame!\n"); |
1447 | } | 1427 | } |
1448 | 1428 | ||
1449 | 1429 | ||
@@ -1540,7 +1520,6 @@ static u8 uli526x_sense_speed(struct uli526x_board_info * db) | |||
1540 | else | 1520 | else |
1541 | phy_mode = 0x1000; | 1521 | phy_mode = 0x1000; |
1542 | 1522 | ||
1543 | /* printk(DRV_NAME ": Phy_mode %x ",phy_mode); */ | ||
1544 | switch (phy_mode) { | 1523 | switch (phy_mode) { |
1545 | case 0x1000: db->op_mode = ULI526X_10MHF; break; | 1524 | case 0x1000: db->op_mode = ULI526X_10MHF; break; |
1546 | case 0x2000: db->op_mode = ULI526X_10MFD; break; | 1525 | case 0x2000: db->op_mode = ULI526X_10MFD; break; |
@@ -1829,7 +1808,7 @@ MODULE_PARM_DESC(mode, "ULi M5261/M5263: Bit 0: 10/100Mbps, bit 2: duplex, bit 8 | |||
1829 | static int __init uli526x_init_module(void) | 1808 | static int __init uli526x_init_module(void) |
1830 | { | 1809 | { |
1831 | 1810 | ||
1832 | printk(version); | 1811 | pr_info("%s\n", version); |
1833 | printed_version = 1; | 1812 | printed_version = 1; |
1834 | 1813 | ||
1835 | ULI526X_DBUG(0, "init_module() ", debug); | 1814 | ULI526X_DBUG(0, "init_module() ", debug); |
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c index f0b231035dee..862eadf07191 100644 --- a/drivers/net/tulip/winbond-840.c +++ b/drivers/net/tulip/winbond-840.c | |||
@@ -44,6 +44,8 @@ | |||
44 | * Wake-On-LAN | 44 | * Wake-On-LAN |
45 | */ | 45 | */ |
46 | 46 | ||
47 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
48 | |||
47 | #define DRV_NAME "winbond-840" | 49 | #define DRV_NAME "winbond-840" |
48 | #define DRV_VERSION "1.01-e" | 50 | #define DRV_VERSION "1.01-e" |
49 | #define DRV_RELDATE "Sep-11-2006" | 51 | #define DRV_RELDATE "Sep-11-2006" |
@@ -139,7 +141,7 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1}; | |||
139 | 141 | ||
140 | /* These identify the driver base version and may not be removed. */ | 142 | /* These identify the driver base version and may not be removed. */ |
141 | static const char version[] __initconst = | 143 | static const char version[] __initconst = |
142 | KERN_INFO DRV_NAME ".c:v" DRV_VERSION " (2.4 port) " | 144 | "v" DRV_VERSION " (2.4 port) " |
143 | DRV_RELDATE " Donald Becker <becker@scyld.com>\n" | 145 | DRV_RELDATE " Donald Becker <becker@scyld.com>\n" |
144 | " http://www.scyld.com/network/drivers.html\n"; | 146 | " http://www.scyld.com/network/drivers.html\n"; |
145 | 147 | ||
@@ -375,8 +377,8 @@ static int __devinit w840_probe1 (struct pci_dev *pdev, | |||
375 | irq = pdev->irq; | 377 | irq = pdev->irq; |
376 | 378 | ||
377 | if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { | 379 | if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { |
378 | pr_warning("Winbond-840: Device %s disabled due to DMA limitations\n", | 380 | pr_warn("Device %s disabled due to DMA limitations\n", |
379 | pci_name(pdev)); | 381 | pci_name(pdev)); |
380 | return -EIO; | 382 | return -EIO; |
381 | } | 383 | } |
382 | dev = alloc_etherdev(sizeof(*np)); | 384 | dev = alloc_etherdev(sizeof(*np)); |
@@ -643,8 +645,7 @@ static int netdev_open(struct net_device *dev) | |||
643 | goto out_err; | 645 | goto out_err; |
644 | 646 | ||
645 | if (debug > 1) | 647 | if (debug > 1) |
646 | printk(KERN_DEBUG "%s: w89c840_open() irq %d\n", | 648 | netdev_dbg(dev, "w89c840_open() irq %d\n", dev->irq); |
647 | dev->name, dev->irq); | ||
648 | 649 | ||
649 | if((i=alloc_ringdesc(dev))) | 650 | if((i=alloc_ringdesc(dev))) |
650 | goto out_err; | 651 | goto out_err; |
@@ -656,7 +657,7 @@ static int netdev_open(struct net_device *dev) | |||
656 | 657 | ||
657 | netif_start_queue(dev); | 658 | netif_start_queue(dev); |
658 | if (debug > 2) | 659 | if (debug > 2) |
659 | printk(KERN_DEBUG "%s: Done netdev_open()\n", dev->name); | 660 | netdev_dbg(dev, "Done netdev_open()\n"); |
660 | 661 | ||
661 | /* Set the timer to check for link beat. */ | 662 | /* Set the timer to check for link beat. */ |
662 | init_timer(&np->timer); | 663 | init_timer(&np->timer); |
@@ -785,9 +786,9 @@ static void netdev_timer(unsigned long data) | |||
785 | void __iomem *ioaddr = np->base_addr; | 786 | void __iomem *ioaddr = np->base_addr; |
786 | 787 | ||
787 | if (debug > 2) | 788 | if (debug > 2) |
788 | printk(KERN_DEBUG "%s: Media selection timer tick, status %08x config %08x\n", | 789 | netdev_dbg(dev, "Media selection timer tick, status %08x config %08x\n", |
789 | dev->name, ioread32(ioaddr + IntrStatus), | 790 | ioread32(ioaddr + IntrStatus), |
790 | ioread32(ioaddr + NetworkConfig)); | 791 | ioread32(ioaddr + NetworkConfig)); |
791 | spin_lock_irq(&np->lock); | 792 | spin_lock_irq(&np->lock); |
792 | update_csr6(dev, update_link(dev)); | 793 | update_csr6(dev, update_link(dev)); |
793 | spin_unlock_irq(&np->lock); | 794 | spin_unlock_irq(&np->lock); |
@@ -1054,8 +1055,8 @@ static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev) | |||
1054 | spin_unlock_irq(&np->lock); | 1055 | spin_unlock_irq(&np->lock); |
1055 | 1056 | ||
1056 | if (debug > 4) { | 1057 | if (debug > 4) { |
1057 | printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d\n", | 1058 | netdev_dbg(dev, "Transmit frame #%d queued in slot %d\n", |
1058 | dev->name, np->cur_tx, entry); | 1059 | np->cur_tx, entry); |
1059 | } | 1060 | } |
1060 | return NETDEV_TX_OK; | 1061 | return NETDEV_TX_OK; |
1061 | } | 1062 | } |
@@ -1072,8 +1073,8 @@ static void netdev_tx_done(struct net_device *dev) | |||
1072 | if (tx_status & 0x8000) { /* There was an error, log it. */ | 1073 | if (tx_status & 0x8000) { /* There was an error, log it. */ |
1073 | #ifndef final_version | 1074 | #ifndef final_version |
1074 | if (debug > 1) | 1075 | if (debug > 1) |
1075 | printk(KERN_DEBUG "%s: Transmit error, Tx status %08x\n", | 1076 | netdev_dbg(dev, "Transmit error, Tx status %08x\n", |
1076 | dev->name, tx_status); | 1077 | tx_status); |
1077 | #endif | 1078 | #endif |
1078 | np->stats.tx_errors++; | 1079 | np->stats.tx_errors++; |
1079 | if (tx_status & 0x0104) np->stats.tx_aborted_errors++; | 1080 | if (tx_status & 0x0104) np->stats.tx_aborted_errors++; |
@@ -1085,8 +1086,8 @@ static void netdev_tx_done(struct net_device *dev) | |||
1085 | } else { | 1086 | } else { |
1086 | #ifndef final_version | 1087 | #ifndef final_version |
1087 | if (debug > 3) | 1088 | if (debug > 3) |
1088 | printk(KERN_DEBUG "%s: Transmit slot %d ok, Tx status %08x\n", | 1089 | netdev_dbg(dev, "Transmit slot %d ok, Tx status %08x\n", |
1089 | dev->name, entry, tx_status); | 1090 | entry, tx_status); |
1090 | #endif | 1091 | #endif |
1091 | np->stats.tx_bytes += np->tx_skbuff[entry]->len; | 1092 | np->stats.tx_bytes += np->tx_skbuff[entry]->len; |
1092 | np->stats.collisions += (tx_status >> 3) & 15; | 1093 | np->stats.collisions += (tx_status >> 3) & 15; |
@@ -1129,8 +1130,7 @@ static irqreturn_t intr_handler(int irq, void *dev_instance) | |||
1129 | iowrite32(intr_status & 0x001ffff, ioaddr + IntrStatus); | 1130 | iowrite32(intr_status & 0x001ffff, ioaddr + IntrStatus); |
1130 | 1131 | ||
1131 | if (debug > 4) | 1132 | if (debug > 4) |
1132 | printk(KERN_DEBUG "%s: Interrupt, status %04x\n", | 1133 | netdev_dbg(dev, "Interrupt, status %04x\n", intr_status); |
1133 | dev->name, intr_status); | ||
1134 | 1134 | ||
1135 | if ((intr_status & (NormalIntr|AbnormalIntr)) == 0) | 1135 | if ((intr_status & (NormalIntr|AbnormalIntr)) == 0) |
1136 | break; | 1136 | break; |
@@ -1171,8 +1171,8 @@ static irqreturn_t intr_handler(int irq, void *dev_instance) | |||
1171 | } while (1); | 1171 | } while (1); |
1172 | 1172 | ||
1173 | if (debug > 3) | 1173 | if (debug > 3) |
1174 | printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x\n", | 1174 | netdev_dbg(dev, "exiting interrupt, status=%#4.4x\n", |
1175 | dev->name, ioread32(ioaddr + IntrStatus)); | 1175 | ioread32(ioaddr + IntrStatus)); |
1176 | return IRQ_RETVAL(handled); | 1176 | return IRQ_RETVAL(handled); |
1177 | } | 1177 | } |
1178 | 1178 | ||
@@ -1185,8 +1185,8 @@ static int netdev_rx(struct net_device *dev) | |||
1185 | int work_limit = np->dirty_rx + RX_RING_SIZE - np->cur_rx; | 1185 | int work_limit = np->dirty_rx + RX_RING_SIZE - np->cur_rx; |
1186 | 1186 | ||
1187 | if (debug > 4) { | 1187 | if (debug > 4) { |
1188 | printk(KERN_DEBUG " In netdev_rx(), entry %d status %04x\n", | 1188 | netdev_dbg(dev, " In netdev_rx(), entry %d status %04x\n", |
1189 | entry, np->rx_ring[entry].status); | 1189 | entry, np->rx_ring[entry].status); |
1190 | } | 1190 | } |
1191 | 1191 | ||
1192 | /* If EOP is set on the next entry, it's a new packet. Send it up. */ | 1192 | /* If EOP is set on the next entry, it's a new packet. Send it up. */ |
@@ -1195,8 +1195,8 @@ static int netdev_rx(struct net_device *dev) | |||
1195 | s32 status = desc->status; | 1195 | s32 status = desc->status; |
1196 | 1196 | ||
1197 | if (debug > 4) | 1197 | if (debug > 4) |
1198 | printk(KERN_DEBUG " netdev_rx() status was %08x\n", | 1198 | netdev_dbg(dev, " netdev_rx() status was %08x\n", |
1199 | status); | 1199 | status); |
1200 | if (status < 0) | 1200 | if (status < 0) |
1201 | break; | 1201 | break; |
1202 | if ((status & 0x38008300) != 0x0300) { | 1202 | if ((status & 0x38008300) != 0x0300) { |
@@ -1211,8 +1211,8 @@ static int netdev_rx(struct net_device *dev) | |||
1211 | } else if (status & 0x8000) { | 1211 | } else if (status & 0x8000) { |
1212 | /* There was a fatal error. */ | 1212 | /* There was a fatal error. */ |
1213 | if (debug > 2) | 1213 | if (debug > 2) |
1214 | printk(KERN_DEBUG "%s: Receive error, Rx status %08x\n", | 1214 | netdev_dbg(dev, "Receive error, Rx status %08x\n", |
1215 | dev->name, status); | 1215 | status); |
1216 | np->stats.rx_errors++; /* end of a packet.*/ | 1216 | np->stats.rx_errors++; /* end of a packet.*/ |
1217 | if (status & 0x0890) np->stats.rx_length_errors++; | 1217 | if (status & 0x0890) np->stats.rx_length_errors++; |
1218 | if (status & 0x004C) np->stats.rx_frame_errors++; | 1218 | if (status & 0x004C) np->stats.rx_frame_errors++; |
@@ -1225,8 +1225,8 @@ static int netdev_rx(struct net_device *dev) | |||
1225 | 1225 | ||
1226 | #ifndef final_version | 1226 | #ifndef final_version |
1227 | if (debug > 4) | 1227 | if (debug > 4) |
1228 | printk(KERN_DEBUG " netdev_rx() normal Rx pkt length %d status %x\n", | 1228 | netdev_dbg(dev, " netdev_rx() normal Rx pkt length %d status %x\n", |
1229 | pkt_len, status); | 1229 | pkt_len, status); |
1230 | #endif | 1230 | #endif |
1231 | /* Check if the packet is long enough to accept without copying | 1231 | /* Check if the packet is long enough to accept without copying |
1232 | to a minimally-sized skbuff. */ | 1232 | to a minimally-sized skbuff. */ |
@@ -1251,10 +1251,10 @@ static int netdev_rx(struct net_device *dev) | |||
1251 | #ifndef final_version /* Remove after testing. */ | 1251 | #ifndef final_version /* Remove after testing. */ |
1252 | /* You will want this info for the initial debug. */ | 1252 | /* You will want this info for the initial debug. */ |
1253 | if (debug > 5) | 1253 | if (debug > 5) |
1254 | printk(KERN_DEBUG " Rx data %pM %pM %02x%02x %pI4\n", | 1254 | netdev_dbg(dev, " Rx data %pM %pM %02x%02x %pI4\n", |
1255 | &skb->data[0], &skb->data[6], | 1255 | &skb->data[0], &skb->data[6], |
1256 | skb->data[12], skb->data[13], | 1256 | skb->data[12], skb->data[13], |
1257 | &skb->data[14]); | 1257 | &skb->data[14]); |
1258 | #endif | 1258 | #endif |
1259 | skb->protocol = eth_type_trans(skb, dev); | 1259 | skb->protocol = eth_type_trans(skb, dev); |
1260 | netif_rx(skb); | 1260 | netif_rx(skb); |
@@ -1292,8 +1292,7 @@ static void netdev_error(struct net_device *dev, int intr_status) | |||
1292 | void __iomem *ioaddr = np->base_addr; | 1292 | void __iomem *ioaddr = np->base_addr; |
1293 | 1293 | ||
1294 | if (debug > 2) | 1294 | if (debug > 2) |
1295 | printk(KERN_DEBUG "%s: Abnormal event, %08x\n", | 1295 | netdev_dbg(dev, "Abnormal event, %08x\n", intr_status); |
1296 | dev->name, intr_status); | ||
1297 | if (intr_status == 0xffffffff) | 1296 | if (intr_status == 0xffffffff) |
1298 | return; | 1297 | return; |
1299 | spin_lock(&np->lock); | 1298 | spin_lock(&np->lock); |
@@ -1313,8 +1312,7 @@ static void netdev_error(struct net_device *dev, int intr_status) | |||
1313 | new = 127; /* load full packet before starting */ | 1312 | new = 127; /* load full packet before starting */ |
1314 | new = (np->csr6 & ~(0x7F << 14)) | (new<<14); | 1313 | new = (np->csr6 & ~(0x7F << 14)) | (new<<14); |
1315 | #endif | 1314 | #endif |
1316 | printk(KERN_DEBUG "%s: Tx underflow, new csr6 %08x\n", | 1315 | netdev_dbg(dev, "Tx underflow, new csr6 %08x\n", new); |
1317 | dev->name, new); | ||
1318 | update_csr6(dev, new); | 1316 | update_csr6(dev, new); |
1319 | } | 1317 | } |
1320 | if (intr_status & RxDied) { /* Missed a Rx frame. */ | 1318 | if (intr_status & RxDied) { /* Missed a Rx frame. */ |
@@ -1487,13 +1485,12 @@ static int netdev_close(struct net_device *dev) | |||
1487 | netif_stop_queue(dev); | 1485 | netif_stop_queue(dev); |
1488 | 1486 | ||
1489 | if (debug > 1) { | 1487 | if (debug > 1) { |
1490 | printk(KERN_DEBUG "%s: Shutting down ethercard, status was %08x Config %08x\n", | 1488 | netdev_dbg(dev, "Shutting down ethercard, status was %08x Config %08x\n", |
1491 | dev->name, ioread32(ioaddr + IntrStatus), | 1489 | ioread32(ioaddr + IntrStatus), |
1492 | ioread32(ioaddr + NetworkConfig)); | 1490 | ioread32(ioaddr + NetworkConfig)); |
1493 | printk(KERN_DEBUG "%s: Queue pointers were Tx %d / %d, Rx %d / %d\n", | 1491 | netdev_dbg(dev, "Queue pointers were Tx %d / %d, Rx %d / %d\n", |
1494 | dev->name, | 1492 | np->cur_tx, np->dirty_tx, |
1495 | np->cur_tx, np->dirty_tx, | 1493 | np->cur_rx, np->dirty_rx); |
1496 | np->cur_rx, np->dirty_rx); | ||
1497 | } | 1494 | } |
1498 | 1495 | ||
1499 | /* Stop the chip's Tx and Rx processes. */ | 1496 | /* Stop the chip's Tx and Rx processes. */ |
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c index 5a73752be2ca..988b8eb24d37 100644 --- a/drivers/net/tulip/xircom_cb.c +++ b/drivers/net/tulip/xircom_cb.c | |||
@@ -37,15 +37,6 @@ | |||
37 | #include <asm/irq.h> | 37 | #include <asm/irq.h> |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #ifdef DEBUG | ||
41 | #define enter(x) printk("Enter: %s, %s line %i\n",x,__FILE__,__LINE__) | ||
42 | #define leave(x) printk("Leave: %s, %s line %i\n",x,__FILE__,__LINE__) | ||
43 | #else | ||
44 | #define enter(x) do {} while (0) | ||
45 | #define leave(x) do {} while (0) | ||
46 | #endif | ||
47 | |||
48 | |||
49 | MODULE_DESCRIPTION("Xircom Cardbus ethernet driver"); | 40 | MODULE_DESCRIPTION("Xircom Cardbus ethernet driver"); |
50 | MODULE_AUTHOR("Arjan van de Ven <arjanv@redhat.com>"); | 41 | MODULE_AUTHOR("Arjan van de Ven <arjanv@redhat.com>"); |
51 | MODULE_LICENSE("GPL"); | 42 | MODULE_LICENSE("GPL"); |
@@ -161,7 +152,7 @@ static struct pci_driver xircom_ops = { | |||
161 | }; | 152 | }; |
162 | 153 | ||
163 | 154 | ||
164 | #ifdef DEBUG | 155 | #if defined DEBUG && DEBUG > 1 |
165 | static void print_binary(unsigned int number) | 156 | static void print_binary(unsigned int number) |
166 | { | 157 | { |
167 | int i,i2; | 158 | int i,i2; |
@@ -176,7 +167,7 @@ static void print_binary(unsigned int number) | |||
176 | if ((i&3)==0) | 167 | if ((i&3)==0) |
177 | buffer[i2++]=' '; | 168 | buffer[i2++]=' '; |
178 | } | 169 | } |
179 | printk("%s\n",buffer); | 170 | pr_debug("%s\n",buffer); |
180 | } | 171 | } |
181 | #endif | 172 | #endif |
182 | 173 | ||
@@ -205,7 +196,6 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_ | |||
205 | struct xircom_private *private; | 196 | struct xircom_private *private; |
206 | unsigned long flags; | 197 | unsigned long flags; |
207 | unsigned short tmp16; | 198 | unsigned short tmp16; |
208 | enter("xircom_probe"); | ||
209 | 199 | ||
210 | /* First do the PCI initialisation */ | 200 | /* First do the PCI initialisation */ |
211 | 201 | ||
@@ -272,8 +262,8 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_ | |||
272 | goto reg_fail; | 262 | goto reg_fail; |
273 | } | 263 | } |
274 | 264 | ||
275 | dev_info(&dev->dev, "Xircom cardbus revision %i at irq %i\n", | 265 | netdev_info(dev, "Xircom cardbus revision %i at irq %i\n", |
276 | pdev->revision, pdev->irq); | 266 | pdev->revision, pdev->irq); |
277 | /* start the transmitter to get a heartbeat */ | 267 | /* start the transmitter to get a heartbeat */ |
278 | /* TODO: send 2 dummy packets here */ | 268 | /* TODO: send 2 dummy packets here */ |
279 | transceiver_voodoo(private); | 269 | transceiver_voodoo(private); |
@@ -285,7 +275,6 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_ | |||
285 | 275 | ||
286 | trigger_receive(private); | 276 | trigger_receive(private); |
287 | 277 | ||
288 | leave("xircom_probe"); | ||
289 | return 0; | 278 | return 0; |
290 | 279 | ||
291 | reg_fail: | 280 | reg_fail: |
@@ -310,7 +299,6 @@ static void __devexit xircom_remove(struct pci_dev *pdev) | |||
310 | struct net_device *dev = pci_get_drvdata(pdev); | 299 | struct net_device *dev = pci_get_drvdata(pdev); |
311 | struct xircom_private *card = netdev_priv(dev); | 300 | struct xircom_private *card = netdev_priv(dev); |
312 | 301 | ||
313 | enter("xircom_remove"); | ||
314 | pci_free_consistent(pdev,8192,card->rx_buffer,card->rx_dma_handle); | 302 | pci_free_consistent(pdev,8192,card->rx_buffer,card->rx_dma_handle); |
315 | pci_free_consistent(pdev,8192,card->tx_buffer,card->tx_dma_handle); | 303 | pci_free_consistent(pdev,8192,card->tx_buffer,card->tx_dma_handle); |
316 | 304 | ||
@@ -318,7 +306,6 @@ static void __devexit xircom_remove(struct pci_dev *pdev) | |||
318 | unregister_netdev(dev); | 306 | unregister_netdev(dev); |
319 | free_netdev(dev); | 307 | free_netdev(dev); |
320 | pci_set_drvdata(pdev, NULL); | 308 | pci_set_drvdata(pdev, NULL); |
321 | leave("xircom_remove"); | ||
322 | } | 309 | } |
323 | 310 | ||
324 | static irqreturn_t xircom_interrupt(int irq, void *dev_instance) | 311 | static irqreturn_t xircom_interrupt(int irq, void *dev_instance) |
@@ -328,17 +315,15 @@ static irqreturn_t xircom_interrupt(int irq, void *dev_instance) | |||
328 | unsigned int status; | 315 | unsigned int status; |
329 | int i; | 316 | int i; |
330 | 317 | ||
331 | enter("xircom_interrupt\n"); | ||
332 | |||
333 | spin_lock(&card->lock); | 318 | spin_lock(&card->lock); |
334 | status = inl(card->io_port+CSR5); | 319 | status = inl(card->io_port+CSR5); |
335 | 320 | ||
336 | #ifdef DEBUG | 321 | #if defined DEBUG && DEBUG > 1 |
337 | print_binary(status); | 322 | print_binary(status); |
338 | printk("tx status 0x%08x 0x%08x\n", | 323 | pr_debug("tx status 0x%08x 0x%08x\n", |
339 | card->tx_buffer[0], card->tx_buffer[4]); | 324 | card->tx_buffer[0], card->tx_buffer[4]); |
340 | printk("rx status 0x%08x 0x%08x\n", | 325 | pr_debug("rx status 0x%08x 0x%08x\n", |
341 | card->rx_buffer[0], card->rx_buffer[4]); | 326 | card->rx_buffer[0], card->rx_buffer[4]); |
342 | #endif | 327 | #endif |
343 | /* Handle shared irq and hotplug */ | 328 | /* Handle shared irq and hotplug */ |
344 | if (status == 0 || status == 0xffffffff) { | 329 | if (status == 0 || status == 0xffffffff) { |
@@ -348,9 +333,9 @@ static irqreturn_t xircom_interrupt(int irq, void *dev_instance) | |||
348 | 333 | ||
349 | if (link_status_changed(card)) { | 334 | if (link_status_changed(card)) { |
350 | int newlink; | 335 | int newlink; |
351 | printk(KERN_DEBUG "xircom_cb: Link status has changed\n"); | 336 | netdev_dbg(dev, "Link status has changed\n"); |
352 | newlink = link_status(card); | 337 | newlink = link_status(card); |
353 | dev_info(&dev->dev, "Link is %i mbit\n", newlink); | 338 | netdev_info(dev, "Link is %d mbit\n", newlink); |
354 | if (newlink) | 339 | if (newlink) |
355 | netif_carrier_on(dev); | 340 | netif_carrier_on(dev); |
356 | else | 341 | else |
@@ -369,9 +354,7 @@ static irqreturn_t xircom_interrupt(int irq, void *dev_instance) | |||
369 | for (i=0;i<NUMDESCRIPTORS;i++) | 354 | for (i=0;i<NUMDESCRIPTORS;i++) |
370 | investigate_read_descriptor(dev,card,i,bufferoffsets[i]); | 355 | investigate_read_descriptor(dev,card,i,bufferoffsets[i]); |
371 | 356 | ||
372 | |||
373 | spin_unlock(&card->lock); | 357 | spin_unlock(&card->lock); |
374 | leave("xircom_interrupt"); | ||
375 | return IRQ_HANDLED; | 358 | return IRQ_HANDLED; |
376 | } | 359 | } |
377 | 360 | ||
@@ -382,7 +365,6 @@ static netdev_tx_t xircom_start_xmit(struct sk_buff *skb, | |||
382 | unsigned long flags; | 365 | unsigned long flags; |
383 | int nextdescriptor; | 366 | int nextdescriptor; |
384 | int desc; | 367 | int desc; |
385 | enter("xircom_start_xmit"); | ||
386 | 368 | ||
387 | card = netdev_priv(dev); | 369 | card = netdev_priv(dev); |
388 | spin_lock_irqsave(&card->lock,flags); | 370 | spin_lock_irqsave(&card->lock,flags); |
@@ -424,13 +406,10 @@ static netdev_tx_t xircom_start_xmit(struct sk_buff *skb, | |||
424 | netif_stop_queue(dev); | 406 | netif_stop_queue(dev); |
425 | } | 407 | } |
426 | card->transmit_used = nextdescriptor; | 408 | card->transmit_used = nextdescriptor; |
427 | leave("xircom-start_xmit - sent"); | ||
428 | spin_unlock_irqrestore(&card->lock,flags); | 409 | spin_unlock_irqrestore(&card->lock,flags); |
429 | return NETDEV_TX_OK; | 410 | return NETDEV_TX_OK; |
430 | } | 411 | } |
431 | 412 | ||
432 | |||
433 | |||
434 | /* Uh oh... no free descriptor... drop the packet */ | 413 | /* Uh oh... no free descriptor... drop the packet */ |
435 | netif_stop_queue(dev); | 414 | netif_stop_queue(dev); |
436 | spin_unlock_irqrestore(&card->lock,flags); | 415 | spin_unlock_irqrestore(&card->lock,flags); |
@@ -446,18 +425,16 @@ static int xircom_open(struct net_device *dev) | |||
446 | { | 425 | { |
447 | struct xircom_private *xp = netdev_priv(dev); | 426 | struct xircom_private *xp = netdev_priv(dev); |
448 | int retval; | 427 | int retval; |
449 | enter("xircom_open"); | 428 | |
450 | pr_info("xircom cardbus adaptor found, registering as %s, using irq %i\n", | 429 | netdev_info(dev, "xircom cardbus adaptor found, using irq %i\n", |
451 | dev->name, dev->irq); | 430 | dev->irq); |
452 | retval = request_irq(dev->irq, xircom_interrupt, IRQF_SHARED, dev->name, dev); | 431 | retval = request_irq(dev->irq, xircom_interrupt, IRQF_SHARED, dev->name, dev); |
453 | if (retval) { | 432 | if (retval) |
454 | leave("xircom_open - No IRQ"); | ||
455 | return retval; | 433 | return retval; |
456 | } | ||
457 | 434 | ||
458 | xircom_up(xp); | 435 | xircom_up(xp); |
459 | xp->open = 1; | 436 | xp->open = 1; |
460 | leave("xircom_open"); | 437 | |
461 | return 0; | 438 | return 0; |
462 | } | 439 | } |
463 | 440 | ||
@@ -466,7 +443,6 @@ static int xircom_close(struct net_device *dev) | |||
466 | struct xircom_private *card; | 443 | struct xircom_private *card; |
467 | unsigned long flags; | 444 | unsigned long flags; |
468 | 445 | ||
469 | enter("xircom_close"); | ||
470 | card = netdev_priv(dev); | 446 | card = netdev_priv(dev); |
471 | netif_stop_queue(dev); /* we don't want new packets */ | 447 | netif_stop_queue(dev); /* we don't want new packets */ |
472 | 448 | ||
@@ -486,8 +462,6 @@ static int xircom_close(struct net_device *dev) | |||
486 | card->open = 0; | 462 | card->open = 0; |
487 | free_irq(dev->irq,dev); | 463 | free_irq(dev->irq,dev); |
488 | 464 | ||
489 | leave("xircom_close"); | ||
490 | |||
491 | return 0; | 465 | return 0; |
492 | 466 | ||
493 | } | 467 | } |
@@ -507,8 +481,6 @@ static void initialize_card(struct xircom_private *card) | |||
507 | { | 481 | { |
508 | unsigned int val; | 482 | unsigned int val; |
509 | unsigned long flags; | 483 | unsigned long flags; |
510 | enter("initialize_card"); | ||
511 | |||
512 | 484 | ||
513 | spin_lock_irqsave(&card->lock, flags); | 485 | spin_lock_irqsave(&card->lock, flags); |
514 | 486 | ||
@@ -534,8 +506,6 @@ static void initialize_card(struct xircom_private *card) | |||
534 | deactivate_transmitter(card); | 506 | deactivate_transmitter(card); |
535 | 507 | ||
536 | spin_unlock_irqrestore(&card->lock, flags); | 508 | spin_unlock_irqrestore(&card->lock, flags); |
537 | |||
538 | leave("initialize_card"); | ||
539 | } | 509 | } |
540 | 510 | ||
541 | /* | 511 | /* |
@@ -547,12 +517,9 @@ ignored; I chose zero. | |||
547 | static void trigger_transmit(struct xircom_private *card) | 517 | static void trigger_transmit(struct xircom_private *card) |
548 | { | 518 | { |
549 | unsigned int val; | 519 | unsigned int val; |
550 | enter("trigger_transmit"); | ||
551 | 520 | ||
552 | val = 0; | 521 | val = 0; |
553 | outl(val, card->io_port + CSR1); | 522 | outl(val, card->io_port + CSR1); |
554 | |||
555 | leave("trigger_transmit"); | ||
556 | } | 523 | } |
557 | 524 | ||
558 | /* | 525 | /* |
@@ -565,12 +532,9 @@ ignored; I chose zero. | |||
565 | static void trigger_receive(struct xircom_private *card) | 532 | static void trigger_receive(struct xircom_private *card) |
566 | { | 533 | { |
567 | unsigned int val; | 534 | unsigned int val; |
568 | enter("trigger_receive"); | ||
569 | 535 | ||
570 | val = 0; | 536 | val = 0; |
571 | outl(val, card->io_port + CSR2); | 537 | outl(val, card->io_port + CSR2); |
572 | |||
573 | leave("trigger_receive"); | ||
574 | } | 538 | } |
575 | 539 | ||
576 | /* | 540 | /* |
@@ -581,8 +545,6 @@ static void setup_descriptors(struct xircom_private *card) | |||
581 | { | 545 | { |
582 | u32 address; | 546 | u32 address; |
583 | int i; | 547 | int i; |
584 | enter("setup_descriptors"); | ||
585 | |||
586 | 548 | ||
587 | BUG_ON(card->rx_buffer == NULL); | 549 | BUG_ON(card->rx_buffer == NULL); |
588 | BUG_ON(card->tx_buffer == NULL); | 550 | BUG_ON(card->tx_buffer == NULL); |
@@ -636,8 +598,6 @@ static void setup_descriptors(struct xircom_private *card) | |||
636 | /* wite the transmit descriptor ring to the card */ | 598 | /* wite the transmit descriptor ring to the card */ |
637 | address = card->tx_dma_handle; | 599 | address = card->tx_dma_handle; |
638 | outl(address, card->io_port + CSR4); /* xmit descr list address */ | 600 | outl(address, card->io_port + CSR4); /* xmit descr list address */ |
639 | |||
640 | leave("setup_descriptors"); | ||
641 | } | 601 | } |
642 | 602 | ||
643 | /* | 603 | /* |
@@ -647,13 +607,10 @@ valid by setting the address in the card to 0x00. | |||
647 | static void remove_descriptors(struct xircom_private *card) | 607 | static void remove_descriptors(struct xircom_private *card) |
648 | { | 608 | { |
649 | unsigned int val; | 609 | unsigned int val; |
650 | enter("remove_descriptors"); | ||
651 | 610 | ||
652 | val = 0; | 611 | val = 0; |
653 | outl(val, card->io_port + CSR3); /* Receive descriptor address */ | 612 | outl(val, card->io_port + CSR3); /* Receive descriptor address */ |
654 | outl(val, card->io_port + CSR4); /* Send descriptor address */ | 613 | outl(val, card->io_port + CSR4); /* Send descriptor address */ |
655 | |||
656 | leave("remove_descriptors"); | ||
657 | } | 614 | } |
658 | 615 | ||
659 | /* | 616 | /* |
@@ -665,21 +622,17 @@ This function also clears the status-bit. | |||
665 | static int link_status_changed(struct xircom_private *card) | 622 | static int link_status_changed(struct xircom_private *card) |
666 | { | 623 | { |
667 | unsigned int val; | 624 | unsigned int val; |
668 | enter("link_status_changed"); | ||
669 | 625 | ||
670 | val = inl(card->io_port + CSR5); /* Status register */ | 626 | val = inl(card->io_port + CSR5); /* Status register */ |
671 | 627 | ||
672 | if ((val & (1 << 27)) == 0) { /* no change */ | 628 | if ((val & (1 << 27)) == 0) /* no change */ |
673 | leave("link_status_changed - nochange"); | ||
674 | return 0; | 629 | return 0; |
675 | } | ||
676 | 630 | ||
677 | /* clear the event by writing a 1 to the bit in the | 631 | /* clear the event by writing a 1 to the bit in the |
678 | status register. */ | 632 | status register. */ |
679 | val = (1 << 27); | 633 | val = (1 << 27); |
680 | outl(val, card->io_port + CSR5); | 634 | outl(val, card->io_port + CSR5); |
681 | 635 | ||
682 | leave("link_status_changed - changed"); | ||
683 | return 1; | 636 | return 1; |
684 | } | 637 | } |
685 | 638 | ||
@@ -691,16 +644,12 @@ in a non-stopped state. | |||
691 | static int transmit_active(struct xircom_private *card) | 644 | static int transmit_active(struct xircom_private *card) |
692 | { | 645 | { |
693 | unsigned int val; | 646 | unsigned int val; |
694 | enter("transmit_active"); | ||
695 | 647 | ||
696 | val = inl(card->io_port + CSR5); /* Status register */ | 648 | val = inl(card->io_port + CSR5); /* Status register */ |
697 | 649 | ||
698 | if ((val & (7 << 20)) == 0) { /* transmitter disabled */ | 650 | if ((val & (7 << 20)) == 0) /* transmitter disabled */ |
699 | leave("transmit_active - inactive"); | ||
700 | return 0; | 651 | return 0; |
701 | } | ||
702 | 652 | ||
703 | leave("transmit_active - active"); | ||
704 | return 1; | 653 | return 1; |
705 | } | 654 | } |
706 | 655 | ||
@@ -711,17 +660,12 @@ in a non-stopped state. | |||
711 | static int receive_active(struct xircom_private *card) | 660 | static int receive_active(struct xircom_private *card) |
712 | { | 661 | { |
713 | unsigned int val; | 662 | unsigned int val; |
714 | enter("receive_active"); | ||
715 | |||
716 | 663 | ||
717 | val = inl(card->io_port + CSR5); /* Status register */ | 664 | val = inl(card->io_port + CSR5); /* Status register */ |
718 | 665 | ||
719 | if ((val & (7 << 17)) == 0) { /* receiver disabled */ | 666 | if ((val & (7 << 17)) == 0) /* receiver disabled */ |
720 | leave("receive_active - inactive"); | ||
721 | return 0; | 667 | return 0; |
722 | } | ||
723 | 668 | ||
724 | leave("receive_active - active"); | ||
725 | return 1; | 669 | return 1; |
726 | } | 670 | } |
727 | 671 | ||
@@ -739,8 +683,6 @@ static void activate_receiver(struct xircom_private *card) | |||
739 | { | 683 | { |
740 | unsigned int val; | 684 | unsigned int val; |
741 | int counter; | 685 | int counter; |
742 | enter("activate_receiver"); | ||
743 | |||
744 | 686 | ||
745 | val = inl(card->io_port + CSR6); /* Operation mode */ | 687 | val = inl(card->io_port + CSR6); /* Operation mode */ |
746 | 688 | ||
@@ -761,7 +703,7 @@ static void activate_receiver(struct xircom_private *card) | |||
761 | udelay(50); | 703 | udelay(50); |
762 | counter--; | 704 | counter--; |
763 | if (counter <= 0) | 705 | if (counter <= 0) |
764 | pr_err("Receiver failed to deactivate\n"); | 706 | netdev_err(card->dev, "Receiver failed to deactivate\n"); |
765 | } | 707 | } |
766 | 708 | ||
767 | /* enable the receiver */ | 709 | /* enable the receiver */ |
@@ -778,10 +720,9 @@ static void activate_receiver(struct xircom_private *card) | |||
778 | udelay(50); | 720 | udelay(50); |
779 | counter--; | 721 | counter--; |
780 | if (counter <= 0) | 722 | if (counter <= 0) |
781 | pr_err("Receiver failed to re-activate\n"); | 723 | netdev_err(card->dev, |
724 | "Receiver failed to re-activate\n"); | ||
782 | } | 725 | } |
783 | |||
784 | leave("activate_receiver"); | ||
785 | } | 726 | } |
786 | 727 | ||
787 | /* | 728 | /* |
@@ -795,7 +736,6 @@ static void deactivate_receiver(struct xircom_private *card) | |||
795 | { | 736 | { |
796 | unsigned int val; | 737 | unsigned int val; |
797 | int counter; | 738 | int counter; |
798 | enter("deactivate_receiver"); | ||
799 | 739 | ||
800 | val = inl(card->io_port + CSR6); /* Operation mode */ | 740 | val = inl(card->io_port + CSR6); /* Operation mode */ |
801 | val = val & ~2; /* disable the receiver */ | 741 | val = val & ~2; /* disable the receiver */ |
@@ -809,11 +749,8 @@ static void deactivate_receiver(struct xircom_private *card) | |||
809 | udelay(50); | 749 | udelay(50); |
810 | counter--; | 750 | counter--; |
811 | if (counter <= 0) | 751 | if (counter <= 0) |
812 | pr_err("Receiver failed to deactivate\n"); | 752 | netdev_err(card->dev, "Receiver failed to deactivate\n"); |
813 | } | 753 | } |
814 | |||
815 | |||
816 | leave("deactivate_receiver"); | ||
817 | } | 754 | } |
818 | 755 | ||
819 | 756 | ||
@@ -831,8 +768,6 @@ static void activate_transmitter(struct xircom_private *card) | |||
831 | { | 768 | { |
832 | unsigned int val; | 769 | unsigned int val; |
833 | int counter; | 770 | int counter; |
834 | enter("activate_transmitter"); | ||
835 | |||
836 | 771 | ||
837 | val = inl(card->io_port + CSR6); /* Operation mode */ | 772 | val = inl(card->io_port + CSR6); /* Operation mode */ |
838 | 773 | ||
@@ -852,7 +787,8 @@ static void activate_transmitter(struct xircom_private *card) | |||
852 | udelay(50); | 787 | udelay(50); |
853 | counter--; | 788 | counter--; |
854 | if (counter <= 0) | 789 | if (counter <= 0) |
855 | pr_err("Transmitter failed to deactivate\n"); | 790 | netdev_err(card->dev, |
791 | "Transmitter failed to deactivate\n"); | ||
856 | } | 792 | } |
857 | 793 | ||
858 | /* enable the transmitter */ | 794 | /* enable the transmitter */ |
@@ -869,10 +805,9 @@ static void activate_transmitter(struct xircom_private *card) | |||
869 | udelay(50); | 805 | udelay(50); |
870 | counter--; | 806 | counter--; |
871 | if (counter <= 0) | 807 | if (counter <= 0) |
872 | pr_err("Transmitter failed to re-activate\n"); | 808 | netdev_err(card->dev, |
809 | "Transmitter failed to re-activate\n"); | ||
873 | } | 810 | } |
874 | |||
875 | leave("activate_transmitter"); | ||
876 | } | 811 | } |
877 | 812 | ||
878 | /* | 813 | /* |
@@ -886,7 +821,6 @@ static void deactivate_transmitter(struct xircom_private *card) | |||
886 | { | 821 | { |
887 | unsigned int val; | 822 | unsigned int val; |
888 | int counter; | 823 | int counter; |
889 | enter("deactivate_transmitter"); | ||
890 | 824 | ||
891 | val = inl(card->io_port + CSR6); /* Operation mode */ | 825 | val = inl(card->io_port + CSR6); /* Operation mode */ |
892 | val = val & ~2; /* disable the transmitter */ | 826 | val = val & ~2; /* disable the transmitter */ |
@@ -900,11 +834,9 @@ static void deactivate_transmitter(struct xircom_private *card) | |||
900 | udelay(50); | 834 | udelay(50); |
901 | counter--; | 835 | counter--; |
902 | if (counter <= 0) | 836 | if (counter <= 0) |
903 | pr_err("Transmitter failed to deactivate\n"); | 837 | netdev_err(card->dev, |
838 | "Transmitter failed to deactivate\n"); | ||
904 | } | 839 | } |
905 | |||
906 | |||
907 | leave("deactivate_transmitter"); | ||
908 | } | 840 | } |
909 | 841 | ||
910 | 842 | ||
@@ -916,13 +848,10 @@ must be called with the lock held and interrupts disabled. | |||
916 | static void enable_transmit_interrupt(struct xircom_private *card) | 848 | static void enable_transmit_interrupt(struct xircom_private *card) |
917 | { | 849 | { |
918 | unsigned int val; | 850 | unsigned int val; |
919 | enter("enable_transmit_interrupt"); | ||
920 | 851 | ||
921 | val = inl(card->io_port + CSR7); /* Interrupt enable register */ | 852 | val = inl(card->io_port + CSR7); /* Interrupt enable register */ |
922 | val |= 1; /* enable the transmit interrupt */ | 853 | val |= 1; /* enable the transmit interrupt */ |
923 | outl(val, card->io_port + CSR7); | 854 | outl(val, card->io_port + CSR7); |
924 | |||
925 | leave("enable_transmit_interrupt"); | ||
926 | } | 855 | } |
927 | 856 | ||
928 | 857 | ||
@@ -934,13 +863,10 @@ must be called with the lock held and interrupts disabled. | |||
934 | static void enable_receive_interrupt(struct xircom_private *card) | 863 | static void enable_receive_interrupt(struct xircom_private *card) |
935 | { | 864 | { |
936 | unsigned int val; | 865 | unsigned int val; |
937 | enter("enable_receive_interrupt"); | ||
938 | 866 | ||
939 | val = inl(card->io_port + CSR7); /* Interrupt enable register */ | 867 | val = inl(card->io_port + CSR7); /* Interrupt enable register */ |
940 | val = val | (1 << 6); /* enable the receive interrupt */ | 868 | val = val | (1 << 6); /* enable the receive interrupt */ |
941 | outl(val, card->io_port + CSR7); | 869 | outl(val, card->io_port + CSR7); |
942 | |||
943 | leave("enable_receive_interrupt"); | ||
944 | } | 870 | } |
945 | 871 | ||
946 | /* | 872 | /* |
@@ -951,13 +877,10 @@ must be called with the lock held and interrupts disabled. | |||
951 | static void enable_link_interrupt(struct xircom_private *card) | 877 | static void enable_link_interrupt(struct xircom_private *card) |
952 | { | 878 | { |
953 | unsigned int val; | 879 | unsigned int val; |
954 | enter("enable_link_interrupt"); | ||
955 | 880 | ||
956 | val = inl(card->io_port + CSR7); /* Interrupt enable register */ | 881 | val = inl(card->io_port + CSR7); /* Interrupt enable register */ |
957 | val = val | (1 << 27); /* enable the link status chage interrupt */ | 882 | val = val | (1 << 27); /* enable the link status chage interrupt */ |
958 | outl(val, card->io_port + CSR7); | 883 | outl(val, card->io_port + CSR7); |
959 | |||
960 | leave("enable_link_interrupt"); | ||
961 | } | 884 | } |
962 | 885 | ||
963 | 886 | ||
@@ -970,12 +893,9 @@ must be called with the lock held and interrupts disabled. | |||
970 | static void disable_all_interrupts(struct xircom_private *card) | 893 | static void disable_all_interrupts(struct xircom_private *card) |
971 | { | 894 | { |
972 | unsigned int val; | 895 | unsigned int val; |
973 | enter("enable_all_interrupts"); | ||
974 | 896 | ||
975 | val = 0; /* disable all interrupts */ | 897 | val = 0; /* disable all interrupts */ |
976 | outl(val, card->io_port + CSR7); | 898 | outl(val, card->io_port + CSR7); |
977 | |||
978 | leave("disable_all_interrupts"); | ||
979 | } | 899 | } |
980 | 900 | ||
981 | /* | 901 | /* |
@@ -986,7 +906,6 @@ must be called with the lock held and interrupts disabled. | |||
986 | static void enable_common_interrupts(struct xircom_private *card) | 906 | static void enable_common_interrupts(struct xircom_private *card) |
987 | { | 907 | { |
988 | unsigned int val; | 908 | unsigned int val; |
989 | enter("enable_link_interrupt"); | ||
990 | 909 | ||
991 | val = inl(card->io_port + CSR7); /* Interrupt enable register */ | 910 | val = inl(card->io_port + CSR7); /* Interrupt enable register */ |
992 | val |= (1<<16); /* Normal Interrupt Summary */ | 911 | val |= (1<<16); /* Normal Interrupt Summary */ |
@@ -998,8 +917,6 @@ static void enable_common_interrupts(struct xircom_private *card) | |||
998 | val |= (1<<2); /* Transmit Buffer Unavailable */ | 917 | val |= (1<<2); /* Transmit Buffer Unavailable */ |
999 | val |= (1<<1); /* Transmit Process Stopped */ | 918 | val |= (1<<1); /* Transmit Process Stopped */ |
1000 | outl(val, card->io_port + CSR7); | 919 | outl(val, card->io_port + CSR7); |
1001 | |||
1002 | leave("enable_link_interrupt"); | ||
1003 | } | 920 | } |
1004 | 921 | ||
1005 | /* | 922 | /* |
@@ -1010,13 +927,11 @@ must be called with the lock held and interrupts disabled. | |||
1010 | static int enable_promisc(struct xircom_private *card) | 927 | static int enable_promisc(struct xircom_private *card) |
1011 | { | 928 | { |
1012 | unsigned int val; | 929 | unsigned int val; |
1013 | enter("enable_promisc"); | ||
1014 | 930 | ||
1015 | val = inl(card->io_port + CSR6); | 931 | val = inl(card->io_port + CSR6); |
1016 | val = val | (1 << 6); | 932 | val = val | (1 << 6); |
1017 | outl(val, card->io_port + CSR6); | 933 | outl(val, card->io_port + CSR6); |
1018 | 934 | ||
1019 | leave("enable_promisc"); | ||
1020 | return 1; | 935 | return 1; |
1021 | } | 936 | } |
1022 | 937 | ||
@@ -1031,7 +946,6 @@ Must be called in locked state with interrupts disabled | |||
1031 | static int link_status(struct xircom_private *card) | 946 | static int link_status(struct xircom_private *card) |
1032 | { | 947 | { |
1033 | unsigned int val; | 948 | unsigned int val; |
1034 | enter("link_status"); | ||
1035 | 949 | ||
1036 | val = inb(card->io_port + CSR12); | 950 | val = inb(card->io_port + CSR12); |
1037 | 951 | ||
@@ -1042,7 +956,6 @@ static int link_status(struct xircom_private *card) | |||
1042 | 956 | ||
1043 | /* If we get here -> no link at all */ | 957 | /* If we get here -> no link at all */ |
1044 | 958 | ||
1045 | leave("link_status"); | ||
1046 | return 0; | 959 | return 0; |
1047 | } | 960 | } |
1048 | 961 | ||
@@ -1061,8 +974,6 @@ static void read_mac_address(struct xircom_private *card) | |||
1061 | unsigned long flags; | 974 | unsigned long flags; |
1062 | int i; | 975 | int i; |
1063 | 976 | ||
1064 | enter("read_mac_address"); | ||
1065 | |||
1066 | spin_lock_irqsave(&card->lock, flags); | 977 | spin_lock_irqsave(&card->lock, flags); |
1067 | 978 | ||
1068 | outl(1 << 12, card->io_port + CSR9); /* enable boot rom access */ | 979 | outl(1 << 12, card->io_port + CSR9); /* enable boot rom access */ |
@@ -1090,7 +1001,6 @@ static void read_mac_address(struct xircom_private *card) | |||
1090 | } | 1001 | } |
1091 | spin_unlock_irqrestore(&card->lock, flags); | 1002 | spin_unlock_irqrestore(&card->lock, flags); |
1092 | pr_debug(" %pM\n", card->dev->dev_addr); | 1003 | pr_debug(" %pM\n", card->dev->dev_addr); |
1093 | leave("read_mac_address"); | ||
1094 | } | 1004 | } |
1095 | 1005 | ||
1096 | 1006 | ||
@@ -1103,8 +1013,6 @@ static void transceiver_voodoo(struct xircom_private *card) | |||
1103 | { | 1013 | { |
1104 | unsigned long flags; | 1014 | unsigned long flags; |
1105 | 1015 | ||
1106 | enter("transceiver_voodoo"); | ||
1107 | |||
1108 | /* disable all powermanagement */ | 1016 | /* disable all powermanagement */ |
1109 | pci_write_config_dword(card->pdev, PCI_POWERMGMT, 0x0000); | 1017 | pci_write_config_dword(card->pdev, PCI_POWERMGMT, 0x0000); |
1110 | 1018 | ||
@@ -1122,7 +1030,6 @@ static void transceiver_voodoo(struct xircom_private *card) | |||
1122 | spin_unlock_irqrestore(&card->lock, flags); | 1030 | spin_unlock_irqrestore(&card->lock, flags); |
1123 | 1031 | ||
1124 | netif_start_queue(card->dev); | 1032 | netif_start_queue(card->dev); |
1125 | leave("transceiver_voodoo"); | ||
1126 | } | 1033 | } |
1127 | 1034 | ||
1128 | 1035 | ||
@@ -1131,8 +1038,6 @@ static void xircom_up(struct xircom_private *card) | |||
1131 | unsigned long flags; | 1038 | unsigned long flags; |
1132 | int i; | 1039 | int i; |
1133 | 1040 | ||
1134 | enter("xircom_up"); | ||
1135 | |||
1136 | /* disable all powermanagement */ | 1041 | /* disable all powermanagement */ |
1137 | pci_write_config_dword(card->pdev, PCI_POWERMGMT, 0x0000); | 1042 | pci_write_config_dword(card->pdev, PCI_POWERMGMT, 0x0000); |
1138 | 1043 | ||
@@ -1156,87 +1061,84 @@ static void xircom_up(struct xircom_private *card) | |||
1156 | trigger_receive(card); | 1061 | trigger_receive(card); |
1157 | trigger_transmit(card); | 1062 | trigger_transmit(card); |
1158 | netif_start_queue(card->dev); | 1063 | netif_start_queue(card->dev); |
1159 | leave("xircom_up"); | ||
1160 | } | 1064 | } |
1161 | 1065 | ||
1162 | /* Bufferoffset is in BYTES */ | 1066 | /* Bufferoffset is in BYTES */ |
1163 | static void investigate_read_descriptor(struct net_device *dev,struct xircom_private *card, int descnr, unsigned int bufferoffset) | 1067 | static void |
1068 | investigate_read_descriptor(struct net_device *dev, struct xircom_private *card, | ||
1069 | int descnr, unsigned int bufferoffset) | ||
1164 | { | 1070 | { |
1165 | int status; | 1071 | int status; |
1166 | |||
1167 | enter("investigate_read_descriptor"); | ||
1168 | status = le32_to_cpu(card->rx_buffer[4*descnr]); | ||
1169 | 1072 | ||
1170 | if ((status > 0)) { /* packet received */ | 1073 | status = le32_to_cpu(card->rx_buffer[4*descnr]); |
1171 | 1074 | ||
1172 | /* TODO: discard error packets */ | 1075 | if (status > 0) { /* packet received */ |
1173 | 1076 | ||
1174 | short pkt_len = ((status >> 16) & 0x7ff) - 4; /* minus 4, we don't want the CRC */ | 1077 | /* TODO: discard error packets */ |
1175 | struct sk_buff *skb; | ||
1176 | 1078 | ||
1177 | if (pkt_len > 1518) { | 1079 | short pkt_len = ((status >> 16) & 0x7ff) - 4; |
1178 | pr_err("Packet length %i is bogus\n", pkt_len); | 1080 | /* minus 4, we don't want the CRC */ |
1179 | pkt_len = 1518; | 1081 | struct sk_buff *skb; |
1180 | } | ||
1181 | 1082 | ||
1182 | skb = dev_alloc_skb(pkt_len + 2); | 1083 | if (pkt_len > 1518) { |
1183 | if (skb == NULL) { | 1084 | netdev_err(dev, "Packet length %i is bogus\n", pkt_len); |
1184 | dev->stats.rx_dropped++; | 1085 | pkt_len = 1518; |
1185 | goto out; | ||
1186 | } | ||
1187 | skb_reserve(skb, 2); | ||
1188 | skb_copy_to_linear_data(skb, (unsigned char*)&card->rx_buffer[bufferoffset / 4], pkt_len); | ||
1189 | skb_put(skb, pkt_len); | ||
1190 | skb->protocol = eth_type_trans(skb, dev); | ||
1191 | netif_rx(skb); | ||
1192 | dev->stats.rx_packets++; | ||
1193 | dev->stats.rx_bytes += pkt_len; | ||
1194 | |||
1195 | out: | ||
1196 | /* give the buffer back to the card */ | ||
1197 | card->rx_buffer[4*descnr] = cpu_to_le32(0x80000000); | ||
1198 | trigger_receive(card); | ||
1199 | } | 1086 | } |
1200 | 1087 | ||
1201 | leave("investigate_read_descriptor"); | 1088 | skb = dev_alloc_skb(pkt_len + 2); |
1202 | 1089 | if (skb == NULL) { | |
1090 | dev->stats.rx_dropped++; | ||
1091 | goto out; | ||
1092 | } | ||
1093 | skb_reserve(skb, 2); | ||
1094 | skb_copy_to_linear_data(skb, | ||
1095 | &card->rx_buffer[bufferoffset / 4], | ||
1096 | pkt_len); | ||
1097 | skb_put(skb, pkt_len); | ||
1098 | skb->protocol = eth_type_trans(skb, dev); | ||
1099 | netif_rx(skb); | ||
1100 | dev->stats.rx_packets++; | ||
1101 | dev->stats.rx_bytes += pkt_len; | ||
1102 | |||
1103 | out: | ||
1104 | /* give the buffer back to the card */ | ||
1105 | card->rx_buffer[4*descnr] = cpu_to_le32(0x80000000); | ||
1106 | trigger_receive(card); | ||
1107 | } | ||
1203 | } | 1108 | } |
1204 | 1109 | ||
1205 | 1110 | ||
1206 | /* Bufferoffset is in BYTES */ | 1111 | /* Bufferoffset is in BYTES */ |
1207 | static void investigate_write_descriptor(struct net_device *dev, struct xircom_private *card, int descnr, unsigned int bufferoffset) | 1112 | static void |
1113 | investigate_write_descriptor(struct net_device *dev, | ||
1114 | struct xircom_private *card, | ||
1115 | int descnr, unsigned int bufferoffset) | ||
1208 | { | 1116 | { |
1209 | int status; | 1117 | int status; |
1210 | |||
1211 | enter("investigate_write_descriptor"); | ||
1212 | 1118 | ||
1213 | status = le32_to_cpu(card->tx_buffer[4*descnr]); | 1119 | status = le32_to_cpu(card->tx_buffer[4*descnr]); |
1214 | #if 0 | 1120 | #if 0 |
1215 | if (status & 0x8000) { /* Major error */ | 1121 | if (status & 0x8000) { /* Major error */ |
1216 | pr_err("Major transmit error status %x\n", status); | 1122 | pr_err("Major transmit error status %x\n", status); |
1217 | card->tx_buffer[4*descnr] = 0; | 1123 | card->tx_buffer[4*descnr] = 0; |
1218 | netif_wake_queue (dev); | 1124 | netif_wake_queue (dev); |
1219 | } | 1125 | } |
1220 | #endif | 1126 | #endif |
1221 | if (status > 0) { /* bit 31 is 0 when done */ | 1127 | if (status > 0) { /* bit 31 is 0 when done */ |
1222 | if (card->tx_skb[descnr]!=NULL) { | 1128 | if (card->tx_skb[descnr]!=NULL) { |
1223 | dev->stats.tx_bytes += card->tx_skb[descnr]->len; | 1129 | dev->stats.tx_bytes += card->tx_skb[descnr]->len; |
1224 | dev_kfree_skb_irq(card->tx_skb[descnr]); | 1130 | dev_kfree_skb_irq(card->tx_skb[descnr]); |
1225 | } | ||
1226 | card->tx_skb[descnr] = NULL; | ||
1227 | /* Bit 8 in the status field is 1 if there was a collision */ | ||
1228 | if (status&(1<<8)) | ||
1229 | dev->stats.collisions++; | ||
1230 | card->tx_buffer[4*descnr] = 0; /* descriptor is free again */ | ||
1231 | netif_wake_queue (dev); | ||
1232 | dev->stats.tx_packets++; | ||
1233 | } | 1131 | } |
1234 | 1132 | card->tx_skb[descnr] = NULL; | |
1235 | leave("investigate_write_descriptor"); | 1133 | /* Bit 8 in the status field is 1 if there was a collision */ |
1236 | 1134 | if (status & (1 << 8)) | |
1135 | dev->stats.collisions++; | ||
1136 | card->tx_buffer[4*descnr] = 0; /* descriptor is free again */ | ||
1137 | netif_wake_queue (dev); | ||
1138 | dev->stats.tx_packets++; | ||
1139 | } | ||
1237 | } | 1140 | } |
1238 | 1141 | ||
1239 | |||
1240 | static int __init xircom_init(void) | 1142 | static int __init xircom_init(void) |
1241 | { | 1143 | { |
1242 | return pci_register_driver(&xircom_ops); | 1144 | return pci_register_driver(&xircom_ops); |
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index be69043d2896..0f1325d98295 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h | |||
@@ -136,6 +136,7 @@ int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr); | |||
136 | extern struct ctl_table ether_table[]; | 136 | extern struct ctl_table ether_table[]; |
137 | #endif | 137 | #endif |
138 | 138 | ||
139 | int mac_pton(const char *s, u8 *mac); | ||
139 | extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len); | 140 | extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len); |
140 | 141 | ||
141 | #endif | 142 | #endif |
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 546d9d35fbd4..290bd8ac94cf 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h | |||
@@ -86,7 +86,6 @@ struct vlan_group { | |||
86 | * the vlan is attached to. | 86 | * the vlan is attached to. |
87 | */ | 87 | */ |
88 | unsigned int nr_vlans; | 88 | unsigned int nr_vlans; |
89 | int killall; | ||
90 | struct hlist_node hlist; /* linked list */ | 89 | struct hlist_node hlist; /* linked list */ |
91 | struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS]; | 90 | struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS]; |
92 | struct rcu_head rcu; | 91 | struct rcu_head rcu; |
diff --git a/include/net/garp.h b/include/net/garp.h index f4c295984c45..8cabbf087169 100644 --- a/include/net/garp.h +++ b/include/net/garp.h | |||
@@ -108,6 +108,7 @@ struct garp_applicant { | |||
108 | 108 | ||
109 | struct garp_port { | 109 | struct garp_port { |
110 | struct garp_applicant __rcu *applicants[GARP_APPLICATION_MAX + 1]; | 110 | struct garp_applicant __rcu *applicants[GARP_APPLICATION_MAX + 1]; |
111 | struct rcu_head rcu; | ||
111 | }; | 112 | }; |
112 | 113 | ||
113 | extern int garp_register_application(struct garp_application *app); | 114 | extern int garp_register_application(struct garp_application *app); |
diff --git a/include/net/ip.h b/include/net/ip.h index 0b30d3ab4a30..66dd49149208 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -174,8 +174,8 @@ static inline __u8 ip_reply_arg_flowi_flags(const struct ip_reply_arg *arg) | |||
174 | return (arg->flags & IP_REPLY_ARG_NOSRCCHECK) ? FLOWI_FLAG_ANYSRC : 0; | 174 | return (arg->flags & IP_REPLY_ARG_NOSRCCHECK) ? FLOWI_FLAG_ANYSRC : 0; |
175 | } | 175 | } |
176 | 176 | ||
177 | void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg, | 177 | void ip_send_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr, |
178 | unsigned int len); | 178 | struct ip_reply_arg *arg, unsigned int len); |
179 | 179 | ||
180 | struct ipv4_config { | 180 | struct ipv4_config { |
181 | int log_martians; | 181 | int log_martians; |
diff --git a/net/802/garp.c b/net/802/garp.c index c1df2dad8c6b..5dbe8967bbd5 100644 --- a/net/802/garp.c +++ b/net/802/garp.c | |||
@@ -544,6 +544,11 @@ static int garp_init_port(struct net_device *dev) | |||
544 | return 0; | 544 | return 0; |
545 | } | 545 | } |
546 | 546 | ||
547 | static void garp_kfree_rcu(struct rcu_head *head) | ||
548 | { | ||
549 | kfree(container_of(head, struct garp_port, rcu)); | ||
550 | } | ||
551 | |||
547 | static void garp_release_port(struct net_device *dev) | 552 | static void garp_release_port(struct net_device *dev) |
548 | { | 553 | { |
549 | struct garp_port *port = rtnl_dereference(dev->garp_port); | 554 | struct garp_port *port = rtnl_dereference(dev->garp_port); |
@@ -554,8 +559,7 @@ static void garp_release_port(struct net_device *dev) | |||
554 | return; | 559 | return; |
555 | } | 560 | } |
556 | rcu_assign_pointer(dev->garp_port, NULL); | 561 | rcu_assign_pointer(dev->garp_port, NULL); |
557 | synchronize_rcu(); | 562 | call_rcu(&port->rcu, garp_kfree_rcu); |
558 | kfree(port); | ||
559 | } | 563 | } |
560 | 564 | ||
561 | int garp_init_applicant(struct net_device *dev, struct garp_application *appl) | 565 | int garp_init_applicant(struct net_device *dev, struct garp_application *appl) |
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 969e7004cf86..718d635d3379 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c | |||
@@ -120,9 +120,10 @@ void unregister_vlan_dev(struct net_device *dev, struct list_head *head) | |||
120 | grp->nr_vlans--; | 120 | grp->nr_vlans--; |
121 | 121 | ||
122 | vlan_group_set_device(grp, vlan_id, NULL); | 122 | vlan_group_set_device(grp, vlan_id, NULL); |
123 | if (!grp->killall) | 123 | /* Because unregister_netdevice_queue() makes sure at least one rcu |
124 | synchronize_net(); | 124 | * grace period is respected before device freeing, |
125 | 125 | * we dont need to call synchronize_net() here. | |
126 | */ | ||
126 | unregister_netdevice_queue(dev, head); | 127 | unregister_netdevice_queue(dev, head); |
127 | 128 | ||
128 | /* If the group is now empty, kill off the group. */ | 129 | /* If the group is now empty, kill off the group. */ |
@@ -478,9 +479,6 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event, | |||
478 | if (dev->reg_state != NETREG_UNREGISTERING) | 479 | if (dev->reg_state != NETREG_UNREGISTERING) |
479 | break; | 480 | break; |
480 | 481 | ||
481 | /* Delete all VLANs for this dev. */ | ||
482 | grp->killall = 1; | ||
483 | |||
484 | for (i = 0; i < VLAN_N_VID; i++) { | 482 | for (i = 0; i < VLAN_N_VID; i++) { |
485 | vlandev = vlan_group_get_device(grp, i); | 483 | vlandev = vlan_group_get_device(grp, i); |
486 | if (!vlandev) | 484 | if (!vlandev) |
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 46d9c3a4de2f..2d7d6d473781 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -698,32 +698,8 @@ int netpoll_parse_options(struct netpoll *np, char *opt) | |||
698 | 698 | ||
699 | if (*cur != 0) { | 699 | if (*cur != 0) { |
700 | /* MAC address */ | 700 | /* MAC address */ |
701 | if ((delim = strchr(cur, ':')) == NULL) | 701 | if (!mac_pton(cur, np->remote_mac)) |
702 | goto parse_failed; | 702 | goto parse_failed; |
703 | *delim = 0; | ||
704 | np->remote_mac[0] = simple_strtol(cur, NULL, 16); | ||
705 | cur = delim + 1; | ||
706 | if ((delim = strchr(cur, ':')) == NULL) | ||
707 | goto parse_failed; | ||
708 | *delim = 0; | ||
709 | np->remote_mac[1] = simple_strtol(cur, NULL, 16); | ||
710 | cur = delim + 1; | ||
711 | if ((delim = strchr(cur, ':')) == NULL) | ||
712 | goto parse_failed; | ||
713 | *delim = 0; | ||
714 | np->remote_mac[2] = simple_strtol(cur, NULL, 16); | ||
715 | cur = delim + 1; | ||
716 | if ((delim = strchr(cur, ':')) == NULL) | ||
717 | goto parse_failed; | ||
718 | *delim = 0; | ||
719 | np->remote_mac[3] = simple_strtol(cur, NULL, 16); | ||
720 | cur = delim + 1; | ||
721 | if ((delim = strchr(cur, ':')) == NULL) | ||
722 | goto parse_failed; | ||
723 | *delim = 0; | ||
724 | np->remote_mac[4] = simple_strtol(cur, NULL, 16); | ||
725 | cur = delim + 1; | ||
726 | np->remote_mac[5] = simple_strtol(cur, NULL, 16); | ||
727 | } | 703 | } |
728 | 704 | ||
729 | netpoll_print_options(np); | 705 | netpoll_print_options(np); |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index d41d88b53e18..379270f14771 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -1420,11 +1420,6 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1420 | return count; | 1420 | return count; |
1421 | } | 1421 | } |
1422 | if (!strcmp(name, "dst_mac")) { | 1422 | if (!strcmp(name, "dst_mac")) { |
1423 | char *v = valstr; | ||
1424 | unsigned char old_dmac[ETH_ALEN]; | ||
1425 | unsigned char *m = pkt_dev->dst_mac; | ||
1426 | memcpy(old_dmac, pkt_dev->dst_mac, ETH_ALEN); | ||
1427 | |||
1428 | len = strn_len(&user_buffer[i], sizeof(valstr) - 1); | 1423 | len = strn_len(&user_buffer[i], sizeof(valstr) - 1); |
1429 | if (len < 0) | 1424 | if (len < 0) |
1430 | return len; | 1425 | return len; |
@@ -1432,35 +1427,16 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1432 | memset(valstr, 0, sizeof(valstr)); | 1427 | memset(valstr, 0, sizeof(valstr)); |
1433 | if (copy_from_user(valstr, &user_buffer[i], len)) | 1428 | if (copy_from_user(valstr, &user_buffer[i], len)) |
1434 | return -EFAULT; | 1429 | return -EFAULT; |
1435 | i += len; | ||
1436 | |||
1437 | for (*m = 0; *v && m < pkt_dev->dst_mac + 6; v++) { | ||
1438 | int value; | ||
1439 | |||
1440 | value = hex_to_bin(*v); | ||
1441 | if (value >= 0) | ||
1442 | *m = *m * 16 + value; | ||
1443 | |||
1444 | if (*v == ':') { | ||
1445 | m++; | ||
1446 | *m = 0; | ||
1447 | } | ||
1448 | } | ||
1449 | 1430 | ||
1431 | if (!mac_pton(valstr, pkt_dev->dst_mac)) | ||
1432 | return -EINVAL; | ||
1450 | /* Set up Dest MAC */ | 1433 | /* Set up Dest MAC */ |
1451 | if (compare_ether_addr(old_dmac, pkt_dev->dst_mac)) | 1434 | memcpy(&pkt_dev->hh[0], pkt_dev->dst_mac, ETH_ALEN); |
1452 | memcpy(&(pkt_dev->hh[0]), pkt_dev->dst_mac, ETH_ALEN); | ||
1453 | 1435 | ||
1454 | sprintf(pg_result, "OK: dstmac"); | 1436 | sprintf(pg_result, "OK: dstmac %pM", pkt_dev->dst_mac); |
1455 | return count; | 1437 | return count; |
1456 | } | 1438 | } |
1457 | if (!strcmp(name, "src_mac")) { | 1439 | if (!strcmp(name, "src_mac")) { |
1458 | char *v = valstr; | ||
1459 | unsigned char old_smac[ETH_ALEN]; | ||
1460 | unsigned char *m = pkt_dev->src_mac; | ||
1461 | |||
1462 | memcpy(old_smac, pkt_dev->src_mac, ETH_ALEN); | ||
1463 | |||
1464 | len = strn_len(&user_buffer[i], sizeof(valstr) - 1); | 1440 | len = strn_len(&user_buffer[i], sizeof(valstr) - 1); |
1465 | if (len < 0) | 1441 | if (len < 0) |
1466 | return len; | 1442 | return len; |
@@ -1468,26 +1444,13 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1468 | memset(valstr, 0, sizeof(valstr)); | 1444 | memset(valstr, 0, sizeof(valstr)); |
1469 | if (copy_from_user(valstr, &user_buffer[i], len)) | 1445 | if (copy_from_user(valstr, &user_buffer[i], len)) |
1470 | return -EFAULT; | 1446 | return -EFAULT; |
1471 | i += len; | ||
1472 | |||
1473 | for (*m = 0; *v && m < pkt_dev->src_mac + 6; v++) { | ||
1474 | int value; | ||
1475 | |||
1476 | value = hex_to_bin(*v); | ||
1477 | if (value >= 0) | ||
1478 | *m = *m * 16 + value; | ||
1479 | |||
1480 | if (*v == ':') { | ||
1481 | m++; | ||
1482 | *m = 0; | ||
1483 | } | ||
1484 | } | ||
1485 | 1447 | ||
1448 | if (!mac_pton(valstr, pkt_dev->src_mac)) | ||
1449 | return -EINVAL; | ||
1486 | /* Set up Src MAC */ | 1450 | /* Set up Src MAC */ |
1487 | if (compare_ether_addr(old_smac, pkt_dev->src_mac)) | 1451 | memcpy(&pkt_dev->hh[6], pkt_dev->src_mac, ETH_ALEN); |
1488 | memcpy(&(pkt_dev->hh[6]), pkt_dev->src_mac, ETH_ALEN); | ||
1489 | 1452 | ||
1490 | sprintf(pg_result, "OK: srcmac"); | 1453 | sprintf(pg_result, "OK: srcmac %pM", pkt_dev->src_mac); |
1491 | return count; | 1454 | return count; |
1492 | } | 1455 | } |
1493 | 1456 | ||
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 5a160f4a1ba0..d2ba2597c75a 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -1501,6 +1501,7 @@ static int rtnl_dellink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | |||
1501 | char ifname[IFNAMSIZ]; | 1501 | char ifname[IFNAMSIZ]; |
1502 | struct nlattr *tb[IFLA_MAX+1]; | 1502 | struct nlattr *tb[IFLA_MAX+1]; |
1503 | int err; | 1503 | int err; |
1504 | LIST_HEAD(list_kill); | ||
1504 | 1505 | ||
1505 | err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy); | 1506 | err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy); |
1506 | if (err < 0) | 1507 | if (err < 0) |
@@ -1524,7 +1525,9 @@ static int rtnl_dellink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | |||
1524 | if (!ops) | 1525 | if (!ops) |
1525 | return -EOPNOTSUPP; | 1526 | return -EOPNOTSUPP; |
1526 | 1527 | ||
1527 | ops->dellink(dev, NULL); | 1528 | ops->dellink(dev, &list_kill); |
1529 | unregister_netdevice_many(&list_kill); | ||
1530 | list_del(&list_kill); | ||
1528 | return 0; | 1531 | return 0; |
1529 | } | 1532 | } |
1530 | 1533 | ||
diff --git a/net/core/utils.c b/net/core/utils.c index 5fea0ab21902..2012bc797f9c 100644 --- a/net/core/utils.c +++ b/net/core/utils.c | |||
@@ -296,3 +296,27 @@ void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb, | |||
296 | csum_unfold(*sum))); | 296 | csum_unfold(*sum))); |
297 | } | 297 | } |
298 | EXPORT_SYMBOL(inet_proto_csum_replace4); | 298 | EXPORT_SYMBOL(inet_proto_csum_replace4); |
299 | |||
300 | int mac_pton(const char *s, u8 *mac) | ||
301 | { | ||
302 | int i; | ||
303 | |||
304 | /* XX:XX:XX:XX:XX:XX */ | ||
305 | if (strlen(s) < 3 * ETH_ALEN - 1) | ||
306 | return 0; | ||
307 | |||
308 | /* Don't dirty result unless string is valid MAC. */ | ||
309 | for (i = 0; i < ETH_ALEN; i++) { | ||
310 | if (!strchr("0123456789abcdefABCDEF", s[i * 3])) | ||
311 | return 0; | ||
312 | if (!strchr("0123456789abcdefABCDEF", s[i * 3 + 1])) | ||
313 | return 0; | ||
314 | if (i != ETH_ALEN - 1 && s[i * 3 + 2] != ':') | ||
315 | return 0; | ||
316 | } | ||
317 | for (i = 0; i < ETH_ALEN; i++) { | ||
318 | mac[i] = (hex_to_bin(s[i * 3]) << 4) | hex_to_bin(s[i * 3 + 1]); | ||
319 | } | ||
320 | return 1; | ||
321 | } | ||
322 | EXPORT_SYMBOL(mac_pton); | ||
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index cd9ca0811cfa..0d4a184af16f 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -1369,7 +1369,7 @@ errout: | |||
1369 | 1369 | ||
1370 | static size_t inet_get_link_af_size(const struct net_device *dev) | 1370 | static size_t inet_get_link_af_size(const struct net_device *dev) |
1371 | { | 1371 | { |
1372 | struct in_device *in_dev = __in_dev_get_rtnl(dev); | 1372 | struct in_device *in_dev = rcu_dereference_rtnl(dev->ip_ptr); |
1373 | 1373 | ||
1374 | if (!in_dev) | 1374 | if (!in_dev) |
1375 | return 0; | 1375 | return 0; |
@@ -1379,7 +1379,7 @@ static size_t inet_get_link_af_size(const struct net_device *dev) | |||
1379 | 1379 | ||
1380 | static int inet_fill_link_af(struct sk_buff *skb, const struct net_device *dev) | 1380 | static int inet_fill_link_af(struct sk_buff *skb, const struct net_device *dev) |
1381 | { | 1381 | { |
1382 | struct in_device *in_dev = __in_dev_get_rtnl(dev); | 1382 | struct in_device *in_dev = rcu_dereference_rtnl(dev->ip_ptr); |
1383 | struct nlattr *nla; | 1383 | struct nlattr *nla; |
1384 | int i; | 1384 | int i; |
1385 | 1385 | ||
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 853a670f6df6..3314394f0aab 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
@@ -345,7 +345,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb) | |||
345 | icmp_param->data.icmph.checksum = 0; | 345 | icmp_param->data.icmph.checksum = 0; |
346 | 346 | ||
347 | inet->tos = ip_hdr(skb)->tos; | 347 | inet->tos = ip_hdr(skb)->tos; |
348 | daddr = ipc.addr = rt->rt_src; | 348 | daddr = ipc.addr = ip_hdr(skb)->saddr; |
349 | ipc.opt = NULL; | 349 | ipc.opt = NULL; |
350 | ipc.tx_flags = 0; | 350 | ipc.tx_flags = 0; |
351 | if (icmp_param->replyopts.opt.opt.optlen) { | 351 | if (icmp_param->replyopts.opt.opt.optlen) { |
@@ -930,12 +930,12 @@ static void icmp_address_reply(struct sk_buff *skb) | |||
930 | BUG_ON(mp == NULL); | 930 | BUG_ON(mp == NULL); |
931 | for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { | 931 | for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { |
932 | if (*mp == ifa->ifa_mask && | 932 | if (*mp == ifa->ifa_mask && |
933 | inet_ifa_match(rt->rt_src, ifa)) | 933 | inet_ifa_match(ip_hdr(skb)->saddr, ifa)) |
934 | break; | 934 | break; |
935 | } | 935 | } |
936 | if (!ifa && net_ratelimit()) { | 936 | if (!ifa && net_ratelimit()) { |
937 | printk(KERN_INFO "Wrong address mask %pI4 from %s/%pI4\n", | 937 | printk(KERN_INFO "Wrong address mask %pI4 from %s/%pI4\n", |
938 | mp, dev->name, &rt->rt_src); | 938 | mp, dev->name, &ip_hdr(skb)->saddr); |
939 | } | 939 | } |
940 | } | 940 | } |
941 | } | 941 | } |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index cd89d22902a9..70778d48aa7b 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -1459,20 +1459,19 @@ static int ip_reply_glue_bits(void *dptr, char *to, int offset, | |||
1459 | * Should run single threaded per socket because it uses the sock | 1459 | * Should run single threaded per socket because it uses the sock |
1460 | * structure to pass arguments. | 1460 | * structure to pass arguments. |
1461 | */ | 1461 | */ |
1462 | void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg, | 1462 | void ip_send_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr, |
1463 | unsigned int len) | 1463 | struct ip_reply_arg *arg, unsigned int len) |
1464 | { | 1464 | { |
1465 | struct inet_sock *inet = inet_sk(sk); | 1465 | struct inet_sock *inet = inet_sk(sk); |
1466 | struct ip_options_data replyopts; | 1466 | struct ip_options_data replyopts; |
1467 | struct ipcm_cookie ipc; | 1467 | struct ipcm_cookie ipc; |
1468 | struct flowi4 fl4; | 1468 | struct flowi4 fl4; |
1469 | __be32 daddr; | ||
1470 | struct rtable *rt = skb_rtable(skb); | 1469 | struct rtable *rt = skb_rtable(skb); |
1471 | 1470 | ||
1472 | if (ip_options_echo(&replyopts.opt.opt, skb)) | 1471 | if (ip_options_echo(&replyopts.opt.opt, skb)) |
1473 | return; | 1472 | return; |
1474 | 1473 | ||
1475 | daddr = ipc.addr = rt->rt_src; | 1474 | ipc.addr = daddr; |
1476 | ipc.opt = NULL; | 1475 | ipc.opt = NULL; |
1477 | ipc.tx_flags = 0; | 1476 | ipc.tx_flags = 0; |
1478 | 1477 | ||
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 2b655031b392..f67fb34e16e5 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -651,7 +651,7 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb) | |||
651 | arg.flags = (sk && inet_sk(sk)->transparent) ? IP_REPLY_ARG_NOSRCCHECK : 0; | 651 | arg.flags = (sk && inet_sk(sk)->transparent) ? IP_REPLY_ARG_NOSRCCHECK : 0; |
652 | 652 | ||
653 | net = dev_net(skb_dst(skb)->dev); | 653 | net = dev_net(skb_dst(skb)->dev); |
654 | ip_send_reply(net->ipv4.tcp_sock, skb, | 654 | ip_send_reply(net->ipv4.tcp_sock, skb, ip_hdr(skb)->saddr, |
655 | &arg, arg.iov[0].iov_len); | 655 | &arg, arg.iov[0].iov_len); |
656 | 656 | ||
657 | TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS); | 657 | TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS); |
@@ -726,7 +726,7 @@ static void tcp_v4_send_ack(struct sk_buff *skb, u32 seq, u32 ack, | |||
726 | if (oif) | 726 | if (oif) |
727 | arg.bound_dev_if = oif; | 727 | arg.bound_dev_if = oif; |
728 | 728 | ||
729 | ip_send_reply(net->ipv4.tcp_sock, skb, | 729 | ip_send_reply(net->ipv4.tcp_sock, skb, ip_hdr(skb)->saddr, |
730 | &arg, arg.iov[0].iov_len); | 730 | &arg, arg.iov[0].iov_len); |
731 | 731 | ||
732 | TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS); | 732 | TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS); |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 66341a3c8d36..599374f65c76 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -706,12 +706,11 @@ static void udp4_hwcsum(struct sk_buff *skb, __be32 src, __be32 dst) | |||
706 | } | 706 | } |
707 | } | 707 | } |
708 | 708 | ||
709 | static int udp_send_skb(struct sk_buff *skb, __be32 daddr, __be32 dport) | 709 | static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4) |
710 | { | 710 | { |
711 | struct sock *sk = skb->sk; | 711 | struct sock *sk = skb->sk; |
712 | struct inet_sock *inet = inet_sk(sk); | 712 | struct inet_sock *inet = inet_sk(sk); |
713 | struct udphdr *uh; | 713 | struct udphdr *uh; |
714 | struct rtable *rt = (struct rtable *)skb_dst(skb); | ||
715 | int err = 0; | 714 | int err = 0; |
716 | int is_udplite = IS_UDPLITE(sk); | 715 | int is_udplite = IS_UDPLITE(sk); |
717 | int offset = skb_transport_offset(skb); | 716 | int offset = skb_transport_offset(skb); |
@@ -723,7 +722,7 @@ static int udp_send_skb(struct sk_buff *skb, __be32 daddr, __be32 dport) | |||
723 | */ | 722 | */ |
724 | uh = udp_hdr(skb); | 723 | uh = udp_hdr(skb); |
725 | uh->source = inet->inet_sport; | 724 | uh->source = inet->inet_sport; |
726 | uh->dest = dport; | 725 | uh->dest = fl4->fl4_dport; |
727 | uh->len = htons(len); | 726 | uh->len = htons(len); |
728 | uh->check = 0; | 727 | uh->check = 0; |
729 | 728 | ||
@@ -737,14 +736,14 @@ static int udp_send_skb(struct sk_buff *skb, __be32 daddr, __be32 dport) | |||
737 | 736 | ||
738 | } else if (skb->ip_summed == CHECKSUM_PARTIAL) { /* UDP hardware csum */ | 737 | } else if (skb->ip_summed == CHECKSUM_PARTIAL) { /* UDP hardware csum */ |
739 | 738 | ||
740 | udp4_hwcsum(skb, rt->rt_src, daddr); | 739 | udp4_hwcsum(skb, fl4->saddr, fl4->daddr); |
741 | goto send; | 740 | goto send; |
742 | 741 | ||
743 | } else | 742 | } else |
744 | csum = udp_csum(skb); | 743 | csum = udp_csum(skb); |
745 | 744 | ||
746 | /* add protocol-dependent pseudo-header */ | 745 | /* add protocol-dependent pseudo-header */ |
747 | uh->check = csum_tcpudp_magic(rt->rt_src, daddr, len, | 746 | uh->check = csum_tcpudp_magic(fl4->saddr, fl4->daddr, len, |
748 | sk->sk_protocol, csum); | 747 | sk->sk_protocol, csum); |
749 | if (uh->check == 0) | 748 | if (uh->check == 0) |
750 | uh->check = CSUM_MANGLED_0; | 749 | uh->check = CSUM_MANGLED_0; |
@@ -778,7 +777,7 @@ static int udp_push_pending_frames(struct sock *sk) | |||
778 | if (!skb) | 777 | if (!skb) |
779 | goto out; | 778 | goto out; |
780 | 779 | ||
781 | err = udp_send_skb(skb, fl4->daddr, fl4->fl4_dport); | 780 | err = udp_send_skb(skb, fl4); |
782 | 781 | ||
783 | out: | 782 | out: |
784 | up->len = 0; | 783 | up->len = 0; |
@@ -963,7 +962,7 @@ back_from_confirm: | |||
963 | msg->msg_flags); | 962 | msg->msg_flags); |
964 | err = PTR_ERR(skb); | 963 | err = PTR_ERR(skb); |
965 | if (skb && !IS_ERR(skb)) | 964 | if (skb && !IS_ERR(skb)) |
966 | err = udp_send_skb(skb, daddr, dport); | 965 | err = udp_send_skb(skb, fl4); |
967 | goto out; | 966 | goto out; |
968 | } | 967 | } |
969 | 968 | ||
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index 7ff973bd02dd..981e43eaf704 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
@@ -18,38 +18,46 @@ | |||
18 | 18 | ||
19 | static struct xfrm_policy_afinfo xfrm4_policy_afinfo; | 19 | static struct xfrm_policy_afinfo xfrm4_policy_afinfo; |
20 | 20 | ||
21 | static struct dst_entry *xfrm4_dst_lookup(struct net *net, int tos, | 21 | static struct dst_entry *__xfrm4_dst_lookup(struct net *net, struct flowi4 *fl4, |
22 | const xfrm_address_t *saddr, | 22 | int tos, |
23 | const xfrm_address_t *daddr) | 23 | const xfrm_address_t *saddr, |
24 | const xfrm_address_t *daddr) | ||
24 | { | 25 | { |
25 | struct flowi4 fl4 = { | ||
26 | .daddr = daddr->a4, | ||
27 | .flowi4_tos = tos, | ||
28 | }; | ||
29 | struct rtable *rt; | 26 | struct rtable *rt; |
30 | 27 | ||
28 | memset(fl4, 0, sizeof(*fl4)); | ||
29 | fl4->daddr = daddr->a4; | ||
30 | fl4->flowi4_tos = tos; | ||
31 | if (saddr) | 31 | if (saddr) |
32 | fl4.saddr = saddr->a4; | 32 | fl4->saddr = saddr->a4; |
33 | 33 | ||
34 | rt = __ip_route_output_key(net, &fl4); | 34 | rt = __ip_route_output_key(net, fl4); |
35 | if (!IS_ERR(rt)) | 35 | if (!IS_ERR(rt)) |
36 | return &rt->dst; | 36 | return &rt->dst; |
37 | 37 | ||
38 | return ERR_CAST(rt); | 38 | return ERR_CAST(rt); |
39 | } | 39 | } |
40 | 40 | ||
41 | static struct dst_entry *xfrm4_dst_lookup(struct net *net, int tos, | ||
42 | const xfrm_address_t *saddr, | ||
43 | const xfrm_address_t *daddr) | ||
44 | { | ||
45 | struct flowi4 fl4; | ||
46 | |||
47 | return __xfrm4_dst_lookup(net, &fl4, tos, saddr, daddr); | ||
48 | } | ||
49 | |||
41 | static int xfrm4_get_saddr(struct net *net, | 50 | static int xfrm4_get_saddr(struct net *net, |
42 | xfrm_address_t *saddr, xfrm_address_t *daddr) | 51 | xfrm_address_t *saddr, xfrm_address_t *daddr) |
43 | { | 52 | { |
44 | struct dst_entry *dst; | 53 | struct dst_entry *dst; |
45 | struct rtable *rt; | 54 | struct flowi4 fl4; |
46 | 55 | ||
47 | dst = xfrm4_dst_lookup(net, 0, NULL, daddr); | 56 | dst = __xfrm4_dst_lookup(net, &fl4, 0, NULL, daddr); |
48 | if (IS_ERR(dst)) | 57 | if (IS_ERR(dst)) |
49 | return -EHOSTUNREACH; | 58 | return -EHOSTUNREACH; |
50 | 59 | ||
51 | rt = (struct rtable *)dst; | 60 | saddr->a4 = fl4.saddr; |
52 | saddr->a4 = rt->rt_src; | ||
53 | dst_release(dst); | 61 | dst_release(dst); |
54 | return 0; | 62 | return 0; |
55 | } | 63 | } |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 4f270ac48226..4de77cb80d88 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -566,7 +566,7 @@ static void sctp_v4_get_saddr(struct sctp_sock *sk, | |||
566 | 566 | ||
567 | if (rt) { | 567 | if (rt) { |
568 | saddr->v4.sin_family = AF_INET; | 568 | saddr->v4.sin_family = AF_INET; |
569 | saddr->v4.sin_addr.s_addr = rt->rt_src; | 569 | saddr->v4.sin_addr.s_addr = fl->u.ip4.saddr; |
570 | } | 570 | } |
571 | } | 571 | } |
572 | 572 | ||