diff options
Diffstat (limited to 'drivers/net')
111 files changed, 1286 insertions, 749 deletions
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index fc58d118d844..390061d09693 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -2360,14 +2360,15 @@ int bond_3ad_set_carrier(struct bonding *bond) | |||
2360 | } | 2360 | } |
2361 | 2361 | ||
2362 | /** | 2362 | /** |
2363 | * bond_3ad_get_active_agg_info - get information of the active aggregator | 2363 | * __bond_3ad_get_active_agg_info - get information of the active aggregator |
2364 | * @bond: bonding struct to work on | 2364 | * @bond: bonding struct to work on |
2365 | * @ad_info: ad_info struct to fill with the bond's info | 2365 | * @ad_info: ad_info struct to fill with the bond's info |
2366 | * | 2366 | * |
2367 | * Returns: 0 on success | 2367 | * Returns: 0 on success |
2368 | * < 0 on error | 2368 | * < 0 on error |
2369 | */ | 2369 | */ |
2370 | int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info) | 2370 | int __bond_3ad_get_active_agg_info(struct bonding *bond, |
2371 | struct ad_info *ad_info) | ||
2371 | { | 2372 | { |
2372 | struct aggregator *aggregator = NULL; | 2373 | struct aggregator *aggregator = NULL; |
2373 | struct port *port; | 2374 | struct port *port; |
@@ -2391,6 +2392,18 @@ int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info) | |||
2391 | return -1; | 2392 | return -1; |
2392 | } | 2393 | } |
2393 | 2394 | ||
2395 | /* Wrapper used to hold bond->lock so no slave manipulation can occur */ | ||
2396 | int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info) | ||
2397 | { | ||
2398 | int ret; | ||
2399 | |||
2400 | read_lock(&bond->lock); | ||
2401 | ret = __bond_3ad_get_active_agg_info(bond, ad_info); | ||
2402 | read_unlock(&bond->lock); | ||
2403 | |||
2404 | return ret; | ||
2405 | } | ||
2406 | |||
2394 | int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) | 2407 | int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) |
2395 | { | 2408 | { |
2396 | struct slave *slave, *start_at; | 2409 | struct slave *slave, *start_at; |
@@ -2402,8 +2415,8 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) | |||
2402 | struct ad_info ad_info; | 2415 | struct ad_info ad_info; |
2403 | int res = 1; | 2416 | int res = 1; |
2404 | 2417 | ||
2405 | if (bond_3ad_get_active_agg_info(bond, &ad_info)) { | 2418 | if (__bond_3ad_get_active_agg_info(bond, &ad_info)) { |
2406 | pr_debug("%s: Error: bond_3ad_get_active_agg_info failed\n", | 2419 | pr_debug("%s: Error: __bond_3ad_get_active_agg_info failed\n", |
2407 | dev->name); | 2420 | dev->name); |
2408 | goto out; | 2421 | goto out; |
2409 | } | 2422 | } |
diff --git a/drivers/net/bonding/bond_3ad.h b/drivers/net/bonding/bond_3ad.h index 0cfaa4afdece..5d91ad0cc041 100644 --- a/drivers/net/bonding/bond_3ad.h +++ b/drivers/net/bonding/bond_3ad.h | |||
@@ -273,6 +273,8 @@ void bond_3ad_adapter_speed_changed(struct slave *slave); | |||
273 | void bond_3ad_adapter_duplex_changed(struct slave *slave); | 273 | void bond_3ad_adapter_duplex_changed(struct slave *slave); |
274 | void bond_3ad_handle_link_change(struct slave *slave, char link); | 274 | void bond_3ad_handle_link_change(struct slave *slave, char link); |
275 | int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info); | 275 | int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info); |
276 | int __bond_3ad_get_active_agg_info(struct bonding *bond, | ||
277 | struct ad_info *ad_info); | ||
276 | int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev); | 278 | int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev); |
277 | int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond, | 279 | int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond, |
278 | struct slave *slave); | 280 | struct slave *slave); |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index d0aade04e49a..02d9ae7d527e 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -764,8 +764,8 @@ static void bond_resend_igmp_join_requests(struct bonding *bond) | |||
764 | struct net_device *bond_dev, *vlan_dev, *upper_dev; | 764 | struct net_device *bond_dev, *vlan_dev, *upper_dev; |
765 | struct vlan_entry *vlan; | 765 | struct vlan_entry *vlan; |
766 | 766 | ||
767 | rcu_read_lock(); | ||
768 | read_lock(&bond->lock); | 767 | read_lock(&bond->lock); |
768 | rcu_read_lock(); | ||
769 | 769 | ||
770 | bond_dev = bond->dev; | 770 | bond_dev = bond->dev; |
771 | 771 | ||
@@ -787,12 +787,19 @@ static void bond_resend_igmp_join_requests(struct bonding *bond) | |||
787 | if (vlan_dev) | 787 | if (vlan_dev) |
788 | __bond_resend_igmp_join_requests(vlan_dev); | 788 | __bond_resend_igmp_join_requests(vlan_dev); |
789 | } | 789 | } |
790 | rcu_read_unlock(); | ||
790 | 791 | ||
791 | if (--bond->igmp_retrans > 0) | 792 | /* We use curr_slave_lock to protect against concurrent access to |
793 | * igmp_retrans from multiple running instances of this function and | ||
794 | * bond_change_active_slave | ||
795 | */ | ||
796 | write_lock_bh(&bond->curr_slave_lock); | ||
797 | if (bond->igmp_retrans > 1) { | ||
798 | bond->igmp_retrans--; | ||
792 | queue_delayed_work(bond->wq, &bond->mcast_work, HZ/5); | 799 | queue_delayed_work(bond->wq, &bond->mcast_work, HZ/5); |
793 | 800 | } | |
801 | write_unlock_bh(&bond->curr_slave_lock); | ||
794 | read_unlock(&bond->lock); | 802 | read_unlock(&bond->lock); |
795 | rcu_read_unlock(); | ||
796 | } | 803 | } |
797 | 804 | ||
798 | static void bond_resend_igmp_join_requests_delayed(struct work_struct *work) | 805 | static void bond_resend_igmp_join_requests_delayed(struct work_struct *work) |
@@ -1362,6 +1369,7 @@ static netdev_features_t bond_fix_features(struct net_device *dev, | |||
1362 | slave->dev->features, | 1369 | slave->dev->features, |
1363 | mask); | 1370 | mask); |
1364 | } | 1371 | } |
1372 | features = netdev_add_tso_features(features, mask); | ||
1365 | 1373 | ||
1366 | out: | 1374 | out: |
1367 | read_unlock(&bond->lock); | 1375 | read_unlock(&bond->lock); |
@@ -1956,6 +1964,10 @@ err_free: | |||
1956 | 1964 | ||
1957 | err_undo_flags: | 1965 | err_undo_flags: |
1958 | bond_compute_features(bond); | 1966 | bond_compute_features(bond); |
1967 | /* Enslave of first slave has failed and we need to fix master's mac */ | ||
1968 | if (bond->slave_cnt == 0 && | ||
1969 | ether_addr_equal(bond_dev->dev_addr, slave_dev->dev_addr)) | ||
1970 | eth_hw_addr_random(bond_dev); | ||
1959 | 1971 | ||
1960 | return res; | 1972 | return res; |
1961 | } | 1973 | } |
@@ -2555,8 +2567,8 @@ static void bond_arp_send(struct net_device *slave_dev, int arp_op, __be32 dest_ | |||
2555 | { | 2567 | { |
2556 | struct sk_buff *skb; | 2568 | struct sk_buff *skb; |
2557 | 2569 | ||
2558 | pr_debug("arp %d on slave %s: dst %x src %x vid %d\n", arp_op, | 2570 | pr_debug("arp %d on slave %s: dst %pI4 src %pI4 vid %d\n", arp_op, |
2559 | slave_dev->name, dest_ip, src_ip, vlan_id); | 2571 | slave_dev->name, &dest_ip, &src_ip, vlan_id); |
2560 | 2572 | ||
2561 | skb = arp_create(arp_op, ETH_P_ARP, dest_ip, slave_dev, src_ip, | 2573 | skb = arp_create(arp_op, ETH_P_ARP, dest_ip, slave_dev, src_ip, |
2562 | NULL, slave_dev->dev_addr, NULL); | 2574 | NULL, slave_dev->dev_addr, NULL); |
@@ -2588,7 +2600,7 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave) | |||
2588 | __be32 addr; | 2600 | __be32 addr; |
2589 | if (!targets[i]) | 2601 | if (!targets[i]) |
2590 | break; | 2602 | break; |
2591 | pr_debug("basa: target %x\n", targets[i]); | 2603 | pr_debug("basa: target %pI4\n", &targets[i]); |
2592 | if (!bond_vlan_used(bond)) { | 2604 | if (!bond_vlan_used(bond)) { |
2593 | pr_debug("basa: empty vlan: arp_send\n"); | 2605 | pr_debug("basa: empty vlan: arp_send\n"); |
2594 | addr = bond_confirm_addr(bond->dev, targets[i], 0); | 2606 | addr = bond_confirm_addr(bond->dev, targets[i], 0); |
@@ -4470,7 +4482,7 @@ int bond_parse_parm(const char *buf, const struct bond_parm_tbl *tbl) | |||
4470 | 4482 | ||
4471 | static int bond_check_params(struct bond_params *params) | 4483 | static int bond_check_params(struct bond_params *params) |
4472 | { | 4484 | { |
4473 | int arp_validate_value, fail_over_mac_value, primary_reselect_value; | 4485 | int arp_validate_value, fail_over_mac_value, primary_reselect_value, i; |
4474 | 4486 | ||
4475 | /* | 4487 | /* |
4476 | * Convert string parameters. | 4488 | * Convert string parameters. |
@@ -4650,19 +4662,18 @@ static int bond_check_params(struct bond_params *params) | |||
4650 | arp_interval = BOND_LINK_ARP_INTERV; | 4662 | arp_interval = BOND_LINK_ARP_INTERV; |
4651 | } | 4663 | } |
4652 | 4664 | ||
4653 | for (arp_ip_count = 0; | 4665 | for (arp_ip_count = 0, i = 0; |
4654 | (arp_ip_count < BOND_MAX_ARP_TARGETS) && arp_ip_target[arp_ip_count]; | 4666 | (arp_ip_count < BOND_MAX_ARP_TARGETS) && arp_ip_target[i]; i++) { |
4655 | arp_ip_count++) { | ||
4656 | /* not complete check, but should be good enough to | 4667 | /* not complete check, but should be good enough to |
4657 | catch mistakes */ | 4668 | catch mistakes */ |
4658 | __be32 ip = in_aton(arp_ip_target[arp_ip_count]); | 4669 | __be32 ip = in_aton(arp_ip_target[i]); |
4659 | if (!isdigit(arp_ip_target[arp_ip_count][0]) || | 4670 | if (!isdigit(arp_ip_target[i][0]) || ip == 0 || |
4660 | ip == 0 || ip == htonl(INADDR_BROADCAST)) { | 4671 | ip == htonl(INADDR_BROADCAST)) { |
4661 | pr_warning("Warning: bad arp_ip_target module parameter (%s), ARP monitoring will not be performed\n", | 4672 | pr_warning("Warning: bad arp_ip_target module parameter (%s), ARP monitoring will not be performed\n", |
4662 | arp_ip_target[arp_ip_count]); | 4673 | arp_ip_target[i]); |
4663 | arp_interval = 0; | 4674 | arp_interval = 0; |
4664 | } else { | 4675 | } else { |
4665 | arp_target[arp_ip_count] = ip; | 4676 | arp_target[arp_ip_count++] = ip; |
4666 | } | 4677 | } |
4667 | } | 4678 | } |
4668 | 4679 | ||
@@ -4696,8 +4707,6 @@ static int bond_check_params(struct bond_params *params) | |||
4696 | if (miimon) { | 4707 | if (miimon) { |
4697 | pr_info("MII link monitoring set to %d ms\n", miimon); | 4708 | pr_info("MII link monitoring set to %d ms\n", miimon); |
4698 | } else if (arp_interval) { | 4709 | } else if (arp_interval) { |
4699 | int i; | ||
4700 | |||
4701 | pr_info("ARP monitoring set to %d ms, validate %s, with %d target(s):", | 4710 | pr_info("ARP monitoring set to %d ms, validate %s, with %d target(s):", |
4702 | arp_interval, | 4711 | arp_interval, |
4703 | arp_validate_tbl[arp_validate_value].modename, | 4712 | arp_validate_tbl[arp_validate_value].modename, |
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c index 94d06f1307b8..4060d41f0ee7 100644 --- a/drivers/net/bonding/bond_procfs.c +++ b/drivers/net/bonding/bond_procfs.c | |||
@@ -130,7 +130,7 @@ static void bond_info_show_master(struct seq_file *seq) | |||
130 | seq_printf(seq, "Aggregator selection policy (ad_select): %s\n", | 130 | seq_printf(seq, "Aggregator selection policy (ad_select): %s\n", |
131 | ad_select_tbl[bond->params.ad_select].modename); | 131 | ad_select_tbl[bond->params.ad_select].modename); |
132 | 132 | ||
133 | if (bond_3ad_get_active_agg_info(bond, &ad_info)) { | 133 | if (__bond_3ad_get_active_agg_info(bond, &ad_info)) { |
134 | seq_printf(seq, "bond %s has no active aggregator\n", | 134 | seq_printf(seq, "bond %s has no active aggregator\n", |
135 | bond->dev->name); | 135 | bond->dev->name); |
136 | } else { | 136 | } else { |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index ea7a388f4843..d7434e0a610e 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -316,6 +316,9 @@ static ssize_t bonding_store_mode(struct device *d, | |||
316 | int new_value, ret = count; | 316 | int new_value, ret = count; |
317 | struct bonding *bond = to_bond(d); | 317 | struct bonding *bond = to_bond(d); |
318 | 318 | ||
319 | if (!rtnl_trylock()) | ||
320 | return restart_syscall(); | ||
321 | |||
319 | if (bond->dev->flags & IFF_UP) { | 322 | if (bond->dev->flags & IFF_UP) { |
320 | pr_err("unable to update mode of %s because interface is up.\n", | 323 | pr_err("unable to update mode of %s because interface is up.\n", |
321 | bond->dev->name); | 324 | bond->dev->name); |
@@ -352,6 +355,7 @@ static ssize_t bonding_store_mode(struct device *d, | |||
352 | bond->dev->name, bond_mode_tbl[new_value].modename, | 355 | bond->dev->name, bond_mode_tbl[new_value].modename, |
353 | new_value); | 356 | new_value); |
354 | out: | 357 | out: |
358 | rtnl_unlock(); | ||
355 | return ret; | 359 | return ret; |
356 | } | 360 | } |
357 | static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, | 361 | static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, |
@@ -1315,7 +1319,6 @@ static ssize_t bonding_show_mii_status(struct device *d, | |||
1315 | } | 1319 | } |
1316 | static DEVICE_ATTR(mii_status, S_IRUGO, bonding_show_mii_status, NULL); | 1320 | static DEVICE_ATTR(mii_status, S_IRUGO, bonding_show_mii_status, NULL); |
1317 | 1321 | ||
1318 | |||
1319 | /* | 1322 | /* |
1320 | * Show current 802.3ad aggregator ID. | 1323 | * Show current 802.3ad aggregator ID. |
1321 | */ | 1324 | */ |
@@ -1329,7 +1332,7 @@ static ssize_t bonding_show_ad_aggregator(struct device *d, | |||
1329 | if (bond->params.mode == BOND_MODE_8023AD) { | 1332 | if (bond->params.mode == BOND_MODE_8023AD) { |
1330 | struct ad_info ad_info; | 1333 | struct ad_info ad_info; |
1331 | count = sprintf(buf, "%d\n", | 1334 | count = sprintf(buf, "%d\n", |
1332 | (bond_3ad_get_active_agg_info(bond, &ad_info)) | 1335 | bond_3ad_get_active_agg_info(bond, &ad_info) |
1333 | ? 0 : ad_info.aggregator_id); | 1336 | ? 0 : ad_info.aggregator_id); |
1334 | } | 1337 | } |
1335 | 1338 | ||
@@ -1351,7 +1354,7 @@ static ssize_t bonding_show_ad_num_ports(struct device *d, | |||
1351 | if (bond->params.mode == BOND_MODE_8023AD) { | 1354 | if (bond->params.mode == BOND_MODE_8023AD) { |
1352 | struct ad_info ad_info; | 1355 | struct ad_info ad_info; |
1353 | count = sprintf(buf, "%d\n", | 1356 | count = sprintf(buf, "%d\n", |
1354 | (bond_3ad_get_active_agg_info(bond, &ad_info)) | 1357 | bond_3ad_get_active_agg_info(bond, &ad_info) |
1355 | ? 0 : ad_info.ports); | 1358 | ? 0 : ad_info.ports); |
1356 | } | 1359 | } |
1357 | 1360 | ||
@@ -1373,7 +1376,7 @@ static ssize_t bonding_show_ad_actor_key(struct device *d, | |||
1373 | if (bond->params.mode == BOND_MODE_8023AD) { | 1376 | if (bond->params.mode == BOND_MODE_8023AD) { |
1374 | struct ad_info ad_info; | 1377 | struct ad_info ad_info; |
1375 | count = sprintf(buf, "%d\n", | 1378 | count = sprintf(buf, "%d\n", |
1376 | (bond_3ad_get_active_agg_info(bond, &ad_info)) | 1379 | bond_3ad_get_active_agg_info(bond, &ad_info) |
1377 | ? 0 : ad_info.actor_key); | 1380 | ? 0 : ad_info.actor_key); |
1378 | } | 1381 | } |
1379 | 1382 | ||
@@ -1395,7 +1398,7 @@ static ssize_t bonding_show_ad_partner_key(struct device *d, | |||
1395 | if (bond->params.mode == BOND_MODE_8023AD) { | 1398 | if (bond->params.mode == BOND_MODE_8023AD) { |
1396 | struct ad_info ad_info; | 1399 | struct ad_info ad_info; |
1397 | count = sprintf(buf, "%d\n", | 1400 | count = sprintf(buf, "%d\n", |
1398 | (bond_3ad_get_active_agg_info(bond, &ad_info)) | 1401 | bond_3ad_get_active_agg_info(bond, &ad_info) |
1399 | ? 0 : ad_info.partner_key); | 1402 | ? 0 : ad_info.partner_key); |
1400 | } | 1403 | } |
1401 | 1404 | ||
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 2baec24388b1..f989e1529a29 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -225,7 +225,7 @@ struct bonding { | |||
225 | rwlock_t curr_slave_lock; | 225 | rwlock_t curr_slave_lock; |
226 | u8 send_peer_notif; | 226 | u8 send_peer_notif; |
227 | s8 setup_by_slave; | 227 | s8 setup_by_slave; |
228 | s8 igmp_retrans; | 228 | u8 igmp_retrans; |
229 | #ifdef CONFIG_PROC_FS | 229 | #ifdef CONFIG_PROC_FS |
230 | struct proc_dir_entry *proc_entry; | 230 | struct proc_dir_entry *proc_entry; |
231 | char proc_file_name[IFNAMSIZ]; | 231 | char proc_file_name[IFNAMSIZ]; |
diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c index 9b74d1e3ad44..6aa7b3266c80 100644 --- a/drivers/net/can/usb/esd_usb2.c +++ b/drivers/net/can/usb/esd_usb2.c | |||
@@ -612,9 +612,15 @@ static int esd_usb2_start(struct esd_usb2_net_priv *priv) | |||
612 | { | 612 | { |
613 | struct esd_usb2 *dev = priv->usb2; | 613 | struct esd_usb2 *dev = priv->usb2; |
614 | struct net_device *netdev = priv->netdev; | 614 | struct net_device *netdev = priv->netdev; |
615 | struct esd_usb2_msg msg; | 615 | struct esd_usb2_msg *msg; |
616 | int err, i; | 616 | int err, i; |
617 | 617 | ||
618 | msg = kmalloc(sizeof(*msg), GFP_KERNEL); | ||
619 | if (!msg) { | ||
620 | err = -ENOMEM; | ||
621 | goto out; | ||
622 | } | ||
623 | |||
618 | /* | 624 | /* |
619 | * Enable all IDs | 625 | * Enable all IDs |
620 | * The IDADD message takes up to 64 32 bit bitmasks (2048 bits). | 626 | * The IDADD message takes up to 64 32 bit bitmasks (2048 bits). |
@@ -628,33 +634,32 @@ static int esd_usb2_start(struct esd_usb2_net_priv *priv) | |||
628 | * the number of the starting bitmask (0..64) to the filter.option | 634 | * the number of the starting bitmask (0..64) to the filter.option |
629 | * field followed by only some bitmasks. | 635 | * field followed by only some bitmasks. |
630 | */ | 636 | */ |
631 | msg.msg.hdr.cmd = CMD_IDADD; | 637 | msg->msg.hdr.cmd = CMD_IDADD; |
632 | msg.msg.hdr.len = 2 + ESD_MAX_ID_SEGMENT; | 638 | msg->msg.hdr.len = 2 + ESD_MAX_ID_SEGMENT; |
633 | msg.msg.filter.net = priv->index; | 639 | msg->msg.filter.net = priv->index; |
634 | msg.msg.filter.option = ESD_ID_ENABLE; /* start with segment 0 */ | 640 | msg->msg.filter.option = ESD_ID_ENABLE; /* start with segment 0 */ |
635 | for (i = 0; i < ESD_MAX_ID_SEGMENT; i++) | 641 | for (i = 0; i < ESD_MAX_ID_SEGMENT; i++) |
636 | msg.msg.filter.mask[i] = cpu_to_le32(0xffffffff); | 642 | msg->msg.filter.mask[i] = cpu_to_le32(0xffffffff); |
637 | /* enable 29bit extended IDs */ | 643 | /* enable 29bit extended IDs */ |
638 | msg.msg.filter.mask[ESD_MAX_ID_SEGMENT] = cpu_to_le32(0x00000001); | 644 | msg->msg.filter.mask[ESD_MAX_ID_SEGMENT] = cpu_to_le32(0x00000001); |
639 | 645 | ||
640 | err = esd_usb2_send_msg(dev, &msg); | 646 | err = esd_usb2_send_msg(dev, msg); |
641 | if (err) | 647 | if (err) |
642 | goto failed; | 648 | goto out; |
643 | 649 | ||
644 | err = esd_usb2_setup_rx_urbs(dev); | 650 | err = esd_usb2_setup_rx_urbs(dev); |
645 | if (err) | 651 | if (err) |
646 | goto failed; | 652 | goto out; |
647 | 653 | ||
648 | priv->can.state = CAN_STATE_ERROR_ACTIVE; | 654 | priv->can.state = CAN_STATE_ERROR_ACTIVE; |
649 | 655 | ||
650 | return 0; | 656 | out: |
651 | |||
652 | failed: | ||
653 | if (err == -ENODEV) | 657 | if (err == -ENODEV) |
654 | netif_device_detach(netdev); | 658 | netif_device_detach(netdev); |
659 | if (err) | ||
660 | netdev_err(netdev, "couldn't start device: %d\n", err); | ||
655 | 661 | ||
656 | netdev_err(netdev, "couldn't start device: %d\n", err); | 662 | kfree(msg); |
657 | |||
658 | return err; | 663 | return err; |
659 | } | 664 | } |
660 | 665 | ||
@@ -833,26 +838,30 @@ nourbmem: | |||
833 | static int esd_usb2_close(struct net_device *netdev) | 838 | static int esd_usb2_close(struct net_device *netdev) |
834 | { | 839 | { |
835 | struct esd_usb2_net_priv *priv = netdev_priv(netdev); | 840 | struct esd_usb2_net_priv *priv = netdev_priv(netdev); |
836 | struct esd_usb2_msg msg; | 841 | struct esd_usb2_msg *msg; |
837 | int i; | 842 | int i; |
838 | 843 | ||
844 | msg = kmalloc(sizeof(*msg), GFP_KERNEL); | ||
845 | if (!msg) | ||
846 | return -ENOMEM; | ||
847 | |||
839 | /* Disable all IDs (see esd_usb2_start()) */ | 848 | /* Disable all IDs (see esd_usb2_start()) */ |
840 | msg.msg.hdr.cmd = CMD_IDADD; | 849 | msg->msg.hdr.cmd = CMD_IDADD; |
841 | msg.msg.hdr.len = 2 + ESD_MAX_ID_SEGMENT; | 850 | msg->msg.hdr.len = 2 + ESD_MAX_ID_SEGMENT; |
842 | msg.msg.filter.net = priv->index; | 851 | msg->msg.filter.net = priv->index; |
843 | msg.msg.filter.option = ESD_ID_ENABLE; /* start with segment 0 */ | 852 | msg->msg.filter.option = ESD_ID_ENABLE; /* start with segment 0 */ |
844 | for (i = 0; i <= ESD_MAX_ID_SEGMENT; i++) | 853 | for (i = 0; i <= ESD_MAX_ID_SEGMENT; i++) |
845 | msg.msg.filter.mask[i] = 0; | 854 | msg->msg.filter.mask[i] = 0; |
846 | if (esd_usb2_send_msg(priv->usb2, &msg) < 0) | 855 | if (esd_usb2_send_msg(priv->usb2, msg) < 0) |
847 | netdev_err(netdev, "sending idadd message failed\n"); | 856 | netdev_err(netdev, "sending idadd message failed\n"); |
848 | 857 | ||
849 | /* set CAN controller to reset mode */ | 858 | /* set CAN controller to reset mode */ |
850 | msg.msg.hdr.len = 2; | 859 | msg->msg.hdr.len = 2; |
851 | msg.msg.hdr.cmd = CMD_SETBAUD; | 860 | msg->msg.hdr.cmd = CMD_SETBAUD; |
852 | msg.msg.setbaud.net = priv->index; | 861 | msg->msg.setbaud.net = priv->index; |
853 | msg.msg.setbaud.rsvd = 0; | 862 | msg->msg.setbaud.rsvd = 0; |
854 | msg.msg.setbaud.baud = cpu_to_le32(ESD_USB2_NO_BAUDRATE); | 863 | msg->msg.setbaud.baud = cpu_to_le32(ESD_USB2_NO_BAUDRATE); |
855 | if (esd_usb2_send_msg(priv->usb2, &msg) < 0) | 864 | if (esd_usb2_send_msg(priv->usb2, msg) < 0) |
856 | netdev_err(netdev, "sending setbaud message failed\n"); | 865 | netdev_err(netdev, "sending setbaud message failed\n"); |
857 | 866 | ||
858 | priv->can.state = CAN_STATE_STOPPED; | 867 | priv->can.state = CAN_STATE_STOPPED; |
@@ -861,6 +870,8 @@ static int esd_usb2_close(struct net_device *netdev) | |||
861 | 870 | ||
862 | close_candev(netdev); | 871 | close_candev(netdev); |
863 | 872 | ||
873 | kfree(msg); | ||
874 | |||
864 | return 0; | 875 | return 0; |
865 | } | 876 | } |
866 | 877 | ||
@@ -886,7 +897,8 @@ static int esd_usb2_set_bittiming(struct net_device *netdev) | |||
886 | { | 897 | { |
887 | struct esd_usb2_net_priv *priv = netdev_priv(netdev); | 898 | struct esd_usb2_net_priv *priv = netdev_priv(netdev); |
888 | struct can_bittiming *bt = &priv->can.bittiming; | 899 | struct can_bittiming *bt = &priv->can.bittiming; |
889 | struct esd_usb2_msg msg; | 900 | struct esd_usb2_msg *msg; |
901 | int err; | ||
890 | u32 canbtr; | 902 | u32 canbtr; |
891 | int sjw_shift; | 903 | int sjw_shift; |
892 | 904 | ||
@@ -912,15 +924,22 @@ static int esd_usb2_set_bittiming(struct net_device *netdev) | |||
912 | if (priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES) | 924 | if (priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES) |
913 | canbtr |= ESD_USB2_3_SAMPLES; | 925 | canbtr |= ESD_USB2_3_SAMPLES; |
914 | 926 | ||
915 | msg.msg.hdr.len = 2; | 927 | msg = kmalloc(sizeof(*msg), GFP_KERNEL); |
916 | msg.msg.hdr.cmd = CMD_SETBAUD; | 928 | if (!msg) |
917 | msg.msg.setbaud.net = priv->index; | 929 | return -ENOMEM; |
918 | msg.msg.setbaud.rsvd = 0; | 930 | |
919 | msg.msg.setbaud.baud = cpu_to_le32(canbtr); | 931 | msg->msg.hdr.len = 2; |
932 | msg->msg.hdr.cmd = CMD_SETBAUD; | ||
933 | msg->msg.setbaud.net = priv->index; | ||
934 | msg->msg.setbaud.rsvd = 0; | ||
935 | msg->msg.setbaud.baud = cpu_to_le32(canbtr); | ||
920 | 936 | ||
921 | netdev_info(netdev, "setting BTR=%#x\n", canbtr); | 937 | netdev_info(netdev, "setting BTR=%#x\n", canbtr); |
922 | 938 | ||
923 | return esd_usb2_send_msg(priv->usb2, &msg); | 939 | err = esd_usb2_send_msg(priv->usb2, msg); |
940 | |||
941 | kfree(msg); | ||
942 | return err; | ||
924 | } | 943 | } |
925 | 944 | ||
926 | static int esd_usb2_get_berr_counter(const struct net_device *netdev, | 945 | static int esd_usb2_get_berr_counter(const struct net_device *netdev, |
@@ -1022,7 +1041,7 @@ static int esd_usb2_probe(struct usb_interface *intf, | |||
1022 | const struct usb_device_id *id) | 1041 | const struct usb_device_id *id) |
1023 | { | 1042 | { |
1024 | struct esd_usb2 *dev; | 1043 | struct esd_usb2 *dev; |
1025 | struct esd_usb2_msg msg; | 1044 | struct esd_usb2_msg *msg; |
1026 | int i, err; | 1045 | int i, err; |
1027 | 1046 | ||
1028 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | 1047 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
@@ -1037,27 +1056,33 @@ static int esd_usb2_probe(struct usb_interface *intf, | |||
1037 | 1056 | ||
1038 | usb_set_intfdata(intf, dev); | 1057 | usb_set_intfdata(intf, dev); |
1039 | 1058 | ||
1059 | msg = kmalloc(sizeof(*msg), GFP_KERNEL); | ||
1060 | if (!msg) { | ||
1061 | err = -ENOMEM; | ||
1062 | goto free_msg; | ||
1063 | } | ||
1064 | |||
1040 | /* query number of CAN interfaces (nets) */ | 1065 | /* query number of CAN interfaces (nets) */ |
1041 | msg.msg.hdr.cmd = CMD_VERSION; | 1066 | msg->msg.hdr.cmd = CMD_VERSION; |
1042 | msg.msg.hdr.len = 2; | 1067 | msg->msg.hdr.len = 2; |
1043 | msg.msg.version.rsvd = 0; | 1068 | msg->msg.version.rsvd = 0; |
1044 | msg.msg.version.flags = 0; | 1069 | msg->msg.version.flags = 0; |
1045 | msg.msg.version.drv_version = 0; | 1070 | msg->msg.version.drv_version = 0; |
1046 | 1071 | ||
1047 | err = esd_usb2_send_msg(dev, &msg); | 1072 | err = esd_usb2_send_msg(dev, msg); |
1048 | if (err < 0) { | 1073 | if (err < 0) { |
1049 | dev_err(&intf->dev, "sending version message failed\n"); | 1074 | dev_err(&intf->dev, "sending version message failed\n"); |
1050 | goto free_dev; | 1075 | goto free_msg; |
1051 | } | 1076 | } |
1052 | 1077 | ||
1053 | err = esd_usb2_wait_msg(dev, &msg); | 1078 | err = esd_usb2_wait_msg(dev, msg); |
1054 | if (err < 0) { | 1079 | if (err < 0) { |
1055 | dev_err(&intf->dev, "no version message answer\n"); | 1080 | dev_err(&intf->dev, "no version message answer\n"); |
1056 | goto free_dev; | 1081 | goto free_msg; |
1057 | } | 1082 | } |
1058 | 1083 | ||
1059 | dev->net_count = (int)msg.msg.version_reply.nets; | 1084 | dev->net_count = (int)msg->msg.version_reply.nets; |
1060 | dev->version = le32_to_cpu(msg.msg.version_reply.version); | 1085 | dev->version = le32_to_cpu(msg->msg.version_reply.version); |
1061 | 1086 | ||
1062 | if (device_create_file(&intf->dev, &dev_attr_firmware)) | 1087 | if (device_create_file(&intf->dev, &dev_attr_firmware)) |
1063 | dev_err(&intf->dev, | 1088 | dev_err(&intf->dev, |
@@ -1075,10 +1100,10 @@ static int esd_usb2_probe(struct usb_interface *intf, | |||
1075 | for (i = 0; i < dev->net_count; i++) | 1100 | for (i = 0; i < dev->net_count; i++) |
1076 | esd_usb2_probe_one_net(intf, i); | 1101 | esd_usb2_probe_one_net(intf, i); |
1077 | 1102 | ||
1078 | return 0; | 1103 | free_msg: |
1079 | 1104 | kfree(msg); | |
1080 | free_dev: | 1105 | if (err) |
1081 | kfree(dev); | 1106 | kfree(dev); |
1082 | done: | 1107 | done: |
1083 | return err; | 1108 | return err; |
1084 | } | 1109 | } |
diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c index 45cb9f3c1324..3b9546588240 100644 --- a/drivers/net/can/usb/kvaser_usb.c +++ b/drivers/net/can/usb/kvaser_usb.c | |||
@@ -136,6 +136,9 @@ | |||
136 | #define KVASER_CTRL_MODE_SELFRECEPTION 3 | 136 | #define KVASER_CTRL_MODE_SELFRECEPTION 3 |
137 | #define KVASER_CTRL_MODE_OFF 4 | 137 | #define KVASER_CTRL_MODE_OFF 4 |
138 | 138 | ||
139 | /* log message */ | ||
140 | #define KVASER_EXTENDED_FRAME BIT(31) | ||
141 | |||
139 | struct kvaser_msg_simple { | 142 | struct kvaser_msg_simple { |
140 | u8 tid; | 143 | u8 tid; |
141 | u8 channel; | 144 | u8 channel; |
@@ -817,8 +820,13 @@ static void kvaser_usb_rx_can_msg(const struct kvaser_usb *dev, | |||
817 | priv = dev->nets[channel]; | 820 | priv = dev->nets[channel]; |
818 | stats = &priv->netdev->stats; | 821 | stats = &priv->netdev->stats; |
819 | 822 | ||
820 | if (msg->u.rx_can.flag & (MSG_FLAG_ERROR_FRAME | MSG_FLAG_NERR | | 823 | if ((msg->u.rx_can.flag & MSG_FLAG_ERROR_FRAME) && |
821 | MSG_FLAG_OVERRUN)) { | 824 | (msg->id == CMD_LOG_MESSAGE)) { |
825 | kvaser_usb_rx_error(dev, msg); | ||
826 | return; | ||
827 | } else if (msg->u.rx_can.flag & (MSG_FLAG_ERROR_FRAME | | ||
828 | MSG_FLAG_NERR | | ||
829 | MSG_FLAG_OVERRUN)) { | ||
822 | kvaser_usb_rx_can_err(priv, msg); | 830 | kvaser_usb_rx_can_err(priv, msg); |
823 | return; | 831 | return; |
824 | } else if (msg->u.rx_can.flag & ~MSG_FLAG_REMOTE_FRAME) { | 832 | } else if (msg->u.rx_can.flag & ~MSG_FLAG_REMOTE_FRAME) { |
@@ -834,22 +842,40 @@ static void kvaser_usb_rx_can_msg(const struct kvaser_usb *dev, | |||
834 | return; | 842 | return; |
835 | } | 843 | } |
836 | 844 | ||
837 | cf->can_id = ((msg->u.rx_can.msg[0] & 0x1f) << 6) | | 845 | if (msg->id == CMD_LOG_MESSAGE) { |
838 | (msg->u.rx_can.msg[1] & 0x3f); | 846 | cf->can_id = le32_to_cpu(msg->u.log_message.id); |
839 | cf->can_dlc = get_can_dlc(msg->u.rx_can.msg[5]); | 847 | if (cf->can_id & KVASER_EXTENDED_FRAME) |
848 | cf->can_id &= CAN_EFF_MASK | CAN_EFF_FLAG; | ||
849 | else | ||
850 | cf->can_id &= CAN_SFF_MASK; | ||
840 | 851 | ||
841 | if (msg->id == CMD_RX_EXT_MESSAGE) { | 852 | cf->can_dlc = get_can_dlc(msg->u.log_message.dlc); |
842 | cf->can_id <<= 18; | ||
843 | cf->can_id |= ((msg->u.rx_can.msg[2] & 0x0f) << 14) | | ||
844 | ((msg->u.rx_can.msg[3] & 0xff) << 6) | | ||
845 | (msg->u.rx_can.msg[4] & 0x3f); | ||
846 | cf->can_id |= CAN_EFF_FLAG; | ||
847 | } | ||
848 | 853 | ||
849 | if (msg->u.rx_can.flag & MSG_FLAG_REMOTE_FRAME) | 854 | if (msg->u.log_message.flags & MSG_FLAG_REMOTE_FRAME) |
850 | cf->can_id |= CAN_RTR_FLAG; | 855 | cf->can_id |= CAN_RTR_FLAG; |
851 | else | 856 | else |
852 | memcpy(cf->data, &msg->u.rx_can.msg[6], cf->can_dlc); | 857 | memcpy(cf->data, &msg->u.log_message.data, |
858 | cf->can_dlc); | ||
859 | } else { | ||
860 | cf->can_id = ((msg->u.rx_can.msg[0] & 0x1f) << 6) | | ||
861 | (msg->u.rx_can.msg[1] & 0x3f); | ||
862 | |||
863 | if (msg->id == CMD_RX_EXT_MESSAGE) { | ||
864 | cf->can_id <<= 18; | ||
865 | cf->can_id |= ((msg->u.rx_can.msg[2] & 0x0f) << 14) | | ||
866 | ((msg->u.rx_can.msg[3] & 0xff) << 6) | | ||
867 | (msg->u.rx_can.msg[4] & 0x3f); | ||
868 | cf->can_id |= CAN_EFF_FLAG; | ||
869 | } | ||
870 | |||
871 | cf->can_dlc = get_can_dlc(msg->u.rx_can.msg[5]); | ||
872 | |||
873 | if (msg->u.rx_can.flag & MSG_FLAG_REMOTE_FRAME) | ||
874 | cf->can_id |= CAN_RTR_FLAG; | ||
875 | else | ||
876 | memcpy(cf->data, &msg->u.rx_can.msg[6], | ||
877 | cf->can_dlc); | ||
878 | } | ||
853 | 879 | ||
854 | netif_rx(skb); | 880 | netif_rx(skb); |
855 | 881 | ||
@@ -911,6 +937,7 @@ static void kvaser_usb_handle_message(const struct kvaser_usb *dev, | |||
911 | 937 | ||
912 | case CMD_RX_STD_MESSAGE: | 938 | case CMD_RX_STD_MESSAGE: |
913 | case CMD_RX_EXT_MESSAGE: | 939 | case CMD_RX_EXT_MESSAGE: |
940 | case CMD_LOG_MESSAGE: | ||
914 | kvaser_usb_rx_can_msg(dev, msg); | 941 | kvaser_usb_rx_can_msg(dev, msg); |
915 | break; | 942 | break; |
916 | 943 | ||
@@ -919,11 +946,6 @@ static void kvaser_usb_handle_message(const struct kvaser_usb *dev, | |||
919 | kvaser_usb_rx_error(dev, msg); | 946 | kvaser_usb_rx_error(dev, msg); |
920 | break; | 947 | break; |
921 | 948 | ||
922 | case CMD_LOG_MESSAGE: | ||
923 | if (msg->u.log_message.flags & MSG_FLAG_ERROR_FRAME) | ||
924 | kvaser_usb_rx_error(dev, msg); | ||
925 | break; | ||
926 | |||
927 | case CMD_TX_ACKNOWLEDGE: | 949 | case CMD_TX_ACKNOWLEDGE: |
928 | kvaser_usb_tx_acknowledge(dev, msg); | 950 | kvaser_usb_tx_acknowledge(dev, msg); |
929 | break; | 951 | break; |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c index 30d79bfa5b10..8ee9d1556e6e 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c | |||
@@ -504,15 +504,24 @@ static int pcan_usb_pro_restart_async(struct peak_usb_device *dev, | |||
504 | return usb_submit_urb(urb, GFP_ATOMIC); | 504 | return usb_submit_urb(urb, GFP_ATOMIC); |
505 | } | 505 | } |
506 | 506 | ||
507 | static void pcan_usb_pro_drv_loaded(struct peak_usb_device *dev, int loaded) | 507 | static int pcan_usb_pro_drv_loaded(struct peak_usb_device *dev, int loaded) |
508 | { | 508 | { |
509 | u8 buffer[16]; | 509 | u8 *buffer; |
510 | int err; | ||
511 | |||
512 | buffer = kmalloc(PCAN_USBPRO_FCT_DRVLD_REQ_LEN, GFP_KERNEL); | ||
513 | if (!buffer) | ||
514 | return -ENOMEM; | ||
510 | 515 | ||
511 | buffer[0] = 0; | 516 | buffer[0] = 0; |
512 | buffer[1] = !!loaded; | 517 | buffer[1] = !!loaded; |
513 | 518 | ||
514 | pcan_usb_pro_send_req(dev, PCAN_USBPRO_REQ_FCT, | 519 | err = pcan_usb_pro_send_req(dev, PCAN_USBPRO_REQ_FCT, |
515 | PCAN_USBPRO_FCT_DRVLD, buffer, sizeof(buffer)); | 520 | PCAN_USBPRO_FCT_DRVLD, buffer, |
521 | PCAN_USBPRO_FCT_DRVLD_REQ_LEN); | ||
522 | kfree(buffer); | ||
523 | |||
524 | return err; | ||
516 | } | 525 | } |
517 | 526 | ||
518 | static inline | 527 | static inline |
@@ -851,21 +860,24 @@ static int pcan_usb_pro_stop(struct peak_usb_device *dev) | |||
851 | */ | 860 | */ |
852 | static int pcan_usb_pro_init(struct peak_usb_device *dev) | 861 | static int pcan_usb_pro_init(struct peak_usb_device *dev) |
853 | { | 862 | { |
854 | struct pcan_usb_pro_interface *usb_if; | ||
855 | struct pcan_usb_pro_device *pdev = | 863 | struct pcan_usb_pro_device *pdev = |
856 | container_of(dev, struct pcan_usb_pro_device, dev); | 864 | container_of(dev, struct pcan_usb_pro_device, dev); |
865 | struct pcan_usb_pro_interface *usb_if = NULL; | ||
866 | struct pcan_usb_pro_fwinfo *fi = NULL; | ||
867 | struct pcan_usb_pro_blinfo *bi = NULL; | ||
868 | int err; | ||
857 | 869 | ||
858 | /* do this for 1st channel only */ | 870 | /* do this for 1st channel only */ |
859 | if (!dev->prev_siblings) { | 871 | if (!dev->prev_siblings) { |
860 | struct pcan_usb_pro_fwinfo fi; | ||
861 | struct pcan_usb_pro_blinfo bi; | ||
862 | int err; | ||
863 | |||
864 | /* allocate netdevices common structure attached to first one */ | 872 | /* allocate netdevices common structure attached to first one */ |
865 | usb_if = kzalloc(sizeof(struct pcan_usb_pro_interface), | 873 | usb_if = kzalloc(sizeof(struct pcan_usb_pro_interface), |
866 | GFP_KERNEL); | 874 | GFP_KERNEL); |
867 | if (!usb_if) | 875 | fi = kmalloc(sizeof(struct pcan_usb_pro_fwinfo), GFP_KERNEL); |
868 | return -ENOMEM; | 876 | bi = kmalloc(sizeof(struct pcan_usb_pro_blinfo), GFP_KERNEL); |
877 | if (!usb_if || !fi || !bi) { | ||
878 | err = -ENOMEM; | ||
879 | goto err_out; | ||
880 | } | ||
869 | 881 | ||
870 | /* number of ts msgs to ignore before taking one into account */ | 882 | /* number of ts msgs to ignore before taking one into account */ |
871 | usb_if->cm_ignore_count = 5; | 883 | usb_if->cm_ignore_count = 5; |
@@ -877,34 +889,34 @@ static int pcan_usb_pro_init(struct peak_usb_device *dev) | |||
877 | */ | 889 | */ |
878 | err = pcan_usb_pro_send_req(dev, PCAN_USBPRO_REQ_INFO, | 890 | err = pcan_usb_pro_send_req(dev, PCAN_USBPRO_REQ_INFO, |
879 | PCAN_USBPRO_INFO_FW, | 891 | PCAN_USBPRO_INFO_FW, |
880 | &fi, sizeof(fi)); | 892 | fi, sizeof(*fi)); |
881 | if (err) { | 893 | if (err) { |
882 | kfree(usb_if); | ||
883 | dev_err(dev->netdev->dev.parent, | 894 | dev_err(dev->netdev->dev.parent, |
884 | "unable to read %s firmware info (err %d)\n", | 895 | "unable to read %s firmware info (err %d)\n", |
885 | pcan_usb_pro.name, err); | 896 | pcan_usb_pro.name, err); |
886 | return err; | 897 | goto err_out; |
887 | } | 898 | } |
888 | 899 | ||
889 | err = pcan_usb_pro_send_req(dev, PCAN_USBPRO_REQ_INFO, | 900 | err = pcan_usb_pro_send_req(dev, PCAN_USBPRO_REQ_INFO, |
890 | PCAN_USBPRO_INFO_BL, | 901 | PCAN_USBPRO_INFO_BL, |
891 | &bi, sizeof(bi)); | 902 | bi, sizeof(*bi)); |
892 | if (err) { | 903 | if (err) { |
893 | kfree(usb_if); | ||
894 | dev_err(dev->netdev->dev.parent, | 904 | dev_err(dev->netdev->dev.parent, |
895 | "unable to read %s bootloader info (err %d)\n", | 905 | "unable to read %s bootloader info (err %d)\n", |
896 | pcan_usb_pro.name, err); | 906 | pcan_usb_pro.name, err); |
897 | return err; | 907 | goto err_out; |
898 | } | 908 | } |
899 | 909 | ||
910 | /* tell the device the can driver is running */ | ||
911 | err = pcan_usb_pro_drv_loaded(dev, 1); | ||
912 | if (err) | ||
913 | goto err_out; | ||
914 | |||
900 | dev_info(dev->netdev->dev.parent, | 915 | dev_info(dev->netdev->dev.parent, |
901 | "PEAK-System %s hwrev %u serial %08X.%08X (%u channels)\n", | 916 | "PEAK-System %s hwrev %u serial %08X.%08X (%u channels)\n", |
902 | pcan_usb_pro.name, | 917 | pcan_usb_pro.name, |
903 | bi.hw_rev, bi.serial_num_hi, bi.serial_num_lo, | 918 | bi->hw_rev, bi->serial_num_hi, bi->serial_num_lo, |
904 | pcan_usb_pro.ctrl_count); | 919 | pcan_usb_pro.ctrl_count); |
905 | |||
906 | /* tell the device the can driver is running */ | ||
907 | pcan_usb_pro_drv_loaded(dev, 1); | ||
908 | } else { | 920 | } else { |
909 | usb_if = pcan_usb_pro_dev_if(dev->prev_siblings); | 921 | usb_if = pcan_usb_pro_dev_if(dev->prev_siblings); |
910 | } | 922 | } |
@@ -916,6 +928,13 @@ static int pcan_usb_pro_init(struct peak_usb_device *dev) | |||
916 | pcan_usb_pro_set_led(dev, 0, 1); | 928 | pcan_usb_pro_set_led(dev, 0, 1); |
917 | 929 | ||
918 | return 0; | 930 | return 0; |
931 | |||
932 | err_out: | ||
933 | kfree(bi); | ||
934 | kfree(fi); | ||
935 | kfree(usb_if); | ||
936 | |||
937 | return err; | ||
919 | } | 938 | } |
920 | 939 | ||
921 | static void pcan_usb_pro_exit(struct peak_usb_device *dev) | 940 | static void pcan_usb_pro_exit(struct peak_usb_device *dev) |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.h b/drivers/net/can/usb/peak_usb/pcan_usb_pro.h index a869918c5620..32275af547e0 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.h +++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.h | |||
@@ -29,6 +29,7 @@ | |||
29 | 29 | ||
30 | /* Vendor Request value for XXX_FCT */ | 30 | /* Vendor Request value for XXX_FCT */ |
31 | #define PCAN_USBPRO_FCT_DRVLD 5 /* tell device driver is loaded */ | 31 | #define PCAN_USBPRO_FCT_DRVLD 5 /* tell device driver is loaded */ |
32 | #define PCAN_USBPRO_FCT_DRVLD_REQ_LEN 16 | ||
32 | 33 | ||
33 | /* PCAN_USBPRO_INFO_BL vendor request record type */ | 34 | /* PCAN_USBPRO_INFO_BL vendor request record type */ |
34 | struct __packed pcan_usb_pro_blinfo { | 35 | struct __packed pcan_usb_pro_blinfo { |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index b8fbe266ab68..638e55435b04 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -3192,11 +3192,11 @@ static u32 bnx2x_xmit_type(struct bnx2x *bp, struct sk_buff *skb) | |||
3192 | rc |= XMIT_CSUM_TCP; | 3192 | rc |= XMIT_CSUM_TCP; |
3193 | 3193 | ||
3194 | if (skb_is_gso_v6(skb)) { | 3194 | if (skb_is_gso_v6(skb)) { |
3195 | rc |= (XMIT_GSO_V6 | XMIT_CSUM_TCP | XMIT_CSUM_V6); | 3195 | rc |= (XMIT_GSO_V6 | XMIT_CSUM_TCP); |
3196 | if (rc & XMIT_CSUM_ENC) | 3196 | if (rc & XMIT_CSUM_ENC) |
3197 | rc |= XMIT_GSO_ENC_V6; | 3197 | rc |= XMIT_GSO_ENC_V6; |
3198 | } else if (skb_is_gso(skb)) { | 3198 | } else if (skb_is_gso(skb)) { |
3199 | rc |= (XMIT_GSO_V4 | XMIT_CSUM_V4 | XMIT_CSUM_TCP); | 3199 | rc |= (XMIT_GSO_V4 | XMIT_CSUM_TCP); |
3200 | if (rc & XMIT_CSUM_ENC) | 3200 | if (rc & XMIT_CSUM_ENC) |
3201 | rc |= XMIT_GSO_ENC_V4; | 3201 | rc |= XMIT_GSO_ENC_V4; |
3202 | } | 3202 | } |
@@ -3313,6 +3313,7 @@ static void bnx2x_set_pbd_gso_e2(struct sk_buff *skb, u32 *parsing_data, | |||
3313 | */ | 3313 | */ |
3314 | static void bnx2x_set_pbd_gso(struct sk_buff *skb, | 3314 | static void bnx2x_set_pbd_gso(struct sk_buff *skb, |
3315 | struct eth_tx_parse_bd_e1x *pbd, | 3315 | struct eth_tx_parse_bd_e1x *pbd, |
3316 | struct eth_tx_start_bd *tx_start_bd, | ||
3316 | u32 xmit_type) | 3317 | u32 xmit_type) |
3317 | { | 3318 | { |
3318 | pbd->lso_mss = cpu_to_le16(skb_shinfo(skb)->gso_size); | 3319 | pbd->lso_mss = cpu_to_le16(skb_shinfo(skb)->gso_size); |
@@ -3326,11 +3327,14 @@ static void bnx2x_set_pbd_gso(struct sk_buff *skb, | |||
3326 | ip_hdr(skb)->daddr, | 3327 | ip_hdr(skb)->daddr, |
3327 | 0, IPPROTO_TCP, 0)); | 3328 | 0, IPPROTO_TCP, 0)); |
3328 | 3329 | ||
3329 | } else | 3330 | /* GSO on 57710/57711 needs FW to calculate IP checksum */ |
3331 | tx_start_bd->bd_flags.as_bitfield |= ETH_TX_BD_FLAGS_IP_CSUM; | ||
3332 | } else { | ||
3330 | pbd->tcp_pseudo_csum = | 3333 | pbd->tcp_pseudo_csum = |
3331 | bswab16(~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, | 3334 | bswab16(~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
3332 | &ipv6_hdr(skb)->daddr, | 3335 | &ipv6_hdr(skb)->daddr, |
3333 | 0, IPPROTO_TCP, 0)); | 3336 | 0, IPPROTO_TCP, 0)); |
3337 | } | ||
3334 | 3338 | ||
3335 | pbd->global_data |= | 3339 | pbd->global_data |= |
3336 | cpu_to_le16(ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN); | 3340 | cpu_to_le16(ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN); |
@@ -3479,19 +3483,18 @@ static void bnx2x_update_pbds_gso_enc(struct sk_buff *skb, | |||
3479 | { | 3483 | { |
3480 | u16 hlen_w = 0; | 3484 | u16 hlen_w = 0; |
3481 | u8 outerip_off, outerip_len = 0; | 3485 | u8 outerip_off, outerip_len = 0; |
3486 | |||
3482 | /* from outer IP to transport */ | 3487 | /* from outer IP to transport */ |
3483 | hlen_w = (skb_inner_transport_header(skb) - | 3488 | hlen_w = (skb_inner_transport_header(skb) - |
3484 | skb_network_header(skb)) >> 1; | 3489 | skb_network_header(skb)) >> 1; |
3485 | 3490 | ||
3486 | /* transport len */ | 3491 | /* transport len */ |
3487 | if (xmit_type & XMIT_CSUM_TCP) | 3492 | hlen_w += inner_tcp_hdrlen(skb) >> 1; |
3488 | hlen_w += inner_tcp_hdrlen(skb) >> 1; | ||
3489 | else | ||
3490 | hlen_w += sizeof(struct udphdr) >> 1; | ||
3491 | 3493 | ||
3492 | pbd2->fw_ip_hdr_to_payload_w = hlen_w; | 3494 | pbd2->fw_ip_hdr_to_payload_w = hlen_w; |
3493 | 3495 | ||
3494 | if (xmit_type & XMIT_CSUM_ENC_V4) { | 3496 | /* outer IP header info */ |
3497 | if (xmit_type & XMIT_CSUM_V4) { | ||
3495 | struct iphdr *iph = ip_hdr(skb); | 3498 | struct iphdr *iph = ip_hdr(skb); |
3496 | pbd2->fw_ip_csum_wo_len_flags_frag = | 3499 | pbd2->fw_ip_csum_wo_len_flags_frag = |
3497 | bswab16(csum_fold((~iph->check) - | 3500 | bswab16(csum_fold((~iph->check) - |
@@ -3814,7 +3817,7 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3814 | bnx2x_set_pbd_gso_e2(skb, &pbd_e2_parsing_data, | 3817 | bnx2x_set_pbd_gso_e2(skb, &pbd_e2_parsing_data, |
3815 | xmit_type); | 3818 | xmit_type); |
3816 | else | 3819 | else |
3817 | bnx2x_set_pbd_gso(skb, pbd_e1x, xmit_type); | 3820 | bnx2x_set_pbd_gso(skb, pbd_e1x, first_bd, xmit_type); |
3818 | } | 3821 | } |
3819 | 3822 | ||
3820 | /* Set the PBD's parsing_data field if not zero | 3823 | /* Set the PBD's parsing_data field if not zero |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 728d42ab2a76..c777b9013164 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -94,10 +94,10 @@ static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits) | |||
94 | 94 | ||
95 | #define DRV_MODULE_NAME "tg3" | 95 | #define DRV_MODULE_NAME "tg3" |
96 | #define TG3_MAJ_NUM 3 | 96 | #define TG3_MAJ_NUM 3 |
97 | #define TG3_MIN_NUM 131 | 97 | #define TG3_MIN_NUM 132 |
98 | #define DRV_MODULE_VERSION \ | 98 | #define DRV_MODULE_VERSION \ |
99 | __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM) | 99 | __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM) |
100 | #define DRV_MODULE_RELDATE "April 09, 2013" | 100 | #define DRV_MODULE_RELDATE "May 21, 2013" |
101 | 101 | ||
102 | #define RESET_KIND_SHUTDOWN 0 | 102 | #define RESET_KIND_SHUTDOWN 0 |
103 | #define RESET_KIND_INIT 1 | 103 | #define RESET_KIND_INIT 1 |
@@ -1800,6 +1800,9 @@ static int tg3_poll_fw(struct tg3 *tp) | |||
1800 | int i; | 1800 | int i; |
1801 | u32 val; | 1801 | u32 val; |
1802 | 1802 | ||
1803 | if (tg3_flag(tp, NO_FWARE_REPORTED)) | ||
1804 | return 0; | ||
1805 | |||
1803 | if (tg3_flag(tp, IS_SSB_CORE)) { | 1806 | if (tg3_flag(tp, IS_SSB_CORE)) { |
1804 | /* We don't use firmware. */ | 1807 | /* We don't use firmware. */ |
1805 | return 0; | 1808 | return 0; |
@@ -2957,6 +2960,31 @@ static int tg3_5700_link_polarity(struct tg3 *tp, u32 speed) | |||
2957 | return 0; | 2960 | return 0; |
2958 | } | 2961 | } |
2959 | 2962 | ||
2963 | static bool tg3_phy_power_bug(struct tg3 *tp) | ||
2964 | { | ||
2965 | switch (tg3_asic_rev(tp)) { | ||
2966 | case ASIC_REV_5700: | ||
2967 | case ASIC_REV_5704: | ||
2968 | return true; | ||
2969 | case ASIC_REV_5780: | ||
2970 | if (tp->phy_flags & TG3_PHYFLG_MII_SERDES) | ||
2971 | return true; | ||
2972 | return false; | ||
2973 | case ASIC_REV_5717: | ||
2974 | if (!tp->pci_fn) | ||
2975 | return true; | ||
2976 | return false; | ||
2977 | case ASIC_REV_5719: | ||
2978 | case ASIC_REV_5720: | ||
2979 | if ((tp->phy_flags & TG3_PHYFLG_PHY_SERDES) && | ||
2980 | !tp->pci_fn) | ||
2981 | return true; | ||
2982 | return false; | ||
2983 | } | ||
2984 | |||
2985 | return false; | ||
2986 | } | ||
2987 | |||
2960 | static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power) | 2988 | static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power) |
2961 | { | 2989 | { |
2962 | u32 val; | 2990 | u32 val; |
@@ -3016,12 +3044,7 @@ static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power) | |||
3016 | /* The PHY should not be powered down on some chips because | 3044 | /* The PHY should not be powered down on some chips because |
3017 | * of bugs. | 3045 | * of bugs. |
3018 | */ | 3046 | */ |
3019 | if (tg3_asic_rev(tp) == ASIC_REV_5700 || | 3047 | if (tg3_phy_power_bug(tp)) |
3020 | tg3_asic_rev(tp) == ASIC_REV_5704 || | ||
3021 | (tg3_asic_rev(tp) == ASIC_REV_5780 && | ||
3022 | (tp->phy_flags & TG3_PHYFLG_MII_SERDES)) || | ||
3023 | (tg3_asic_rev(tp) == ASIC_REV_5717 && | ||
3024 | !tp->pci_fn)) | ||
3025 | return; | 3048 | return; |
3026 | 3049 | ||
3027 | if (tg3_chip_rev(tp) == CHIPREV_5784_AX || | 3050 | if (tg3_chip_rev(tp) == CHIPREV_5784_AX || |
@@ -7428,6 +7451,20 @@ static inline int tg3_4g_overflow_test(dma_addr_t mapping, int len) | |||
7428 | return (base > 0xffffdcc0) && (base + len + 8 < base); | 7451 | return (base > 0xffffdcc0) && (base + len + 8 < base); |
7429 | } | 7452 | } |
7430 | 7453 | ||
7454 | /* Test for TSO DMA buffers that cross into regions which are within MSS bytes | ||
7455 | * of any 4GB boundaries: 4G, 8G, etc | ||
7456 | */ | ||
7457 | static inline int tg3_4g_tso_overflow_test(struct tg3 *tp, dma_addr_t mapping, | ||
7458 | u32 len, u32 mss) | ||
7459 | { | ||
7460 | if (tg3_asic_rev(tp) == ASIC_REV_5762 && mss) { | ||
7461 | u32 base = (u32) mapping & 0xffffffff; | ||
7462 | |||
7463 | return ((base + len + (mss & 0x3fff)) < base); | ||
7464 | } | ||
7465 | return 0; | ||
7466 | } | ||
7467 | |||
7431 | /* Test for DMA addresses > 40-bit */ | 7468 | /* Test for DMA addresses > 40-bit */ |
7432 | static inline int tg3_40bit_overflow_test(struct tg3 *tp, dma_addr_t mapping, | 7469 | static inline int tg3_40bit_overflow_test(struct tg3 *tp, dma_addr_t mapping, |
7433 | int len) | 7470 | int len) |
@@ -7464,6 +7501,9 @@ static bool tg3_tx_frag_set(struct tg3_napi *tnapi, u32 *entry, u32 *budget, | |||
7464 | if (tg3_4g_overflow_test(map, len)) | 7501 | if (tg3_4g_overflow_test(map, len)) |
7465 | hwbug = true; | 7502 | hwbug = true; |
7466 | 7503 | ||
7504 | if (tg3_4g_tso_overflow_test(tp, map, len, mss)) | ||
7505 | hwbug = true; | ||
7506 | |||
7467 | if (tg3_40bit_overflow_test(tp, map, len)) | 7507 | if (tg3_40bit_overflow_test(tp, map, len)) |
7468 | hwbug = true; | 7508 | hwbug = true; |
7469 | 7509 | ||
@@ -8874,6 +8914,10 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
8874 | tg3_halt_cpu(tp, RX_CPU_BASE); | 8914 | tg3_halt_cpu(tp, RX_CPU_BASE); |
8875 | } | 8915 | } |
8876 | 8916 | ||
8917 | err = tg3_poll_fw(tp); | ||
8918 | if (err) | ||
8919 | return err; | ||
8920 | |||
8877 | tw32(GRC_MODE, tp->grc_mode); | 8921 | tw32(GRC_MODE, tp->grc_mode); |
8878 | 8922 | ||
8879 | if (tg3_chip_rev_id(tp) == CHIPREV_ID_5705_A0) { | 8923 | if (tg3_chip_rev_id(tp) == CHIPREV_ID_5705_A0) { |
@@ -8904,10 +8948,6 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
8904 | 8948 | ||
8905 | tg3_ape_unlock(tp, TG3_APE_LOCK_GRC); | 8949 | tg3_ape_unlock(tp, TG3_APE_LOCK_GRC); |
8906 | 8950 | ||
8907 | err = tg3_poll_fw(tp); | ||
8908 | if (err) | ||
8909 | return err; | ||
8910 | |||
8911 | tg3_mdio_start(tp); | 8951 | tg3_mdio_start(tp); |
8912 | 8952 | ||
8913 | if (tg3_flag(tp, PCI_EXPRESS) && | 8953 | if (tg3_flag(tp, PCI_EXPRESS) && |
@@ -9431,6 +9471,14 @@ static void tg3_rss_write_indir_tbl(struct tg3 *tp) | |||
9431 | } | 9471 | } |
9432 | } | 9472 | } |
9433 | 9473 | ||
9474 | static inline u32 tg3_lso_rd_dma_workaround_bit(struct tg3 *tp) | ||
9475 | { | ||
9476 | if (tg3_asic_rev(tp) == ASIC_REV_5719) | ||
9477 | return TG3_LSO_RD_DMA_TX_LENGTH_WA_5719; | ||
9478 | else | ||
9479 | return TG3_LSO_RD_DMA_TX_LENGTH_WA_5720; | ||
9480 | } | ||
9481 | |||
9434 | /* tp->lock is held. */ | 9482 | /* tp->lock is held. */ |
9435 | static int tg3_reset_hw(struct tg3 *tp, bool reset_phy) | 9483 | static int tg3_reset_hw(struct tg3 *tp, bool reset_phy) |
9436 | { | 9484 | { |
@@ -10116,16 +10164,17 @@ static int tg3_reset_hw(struct tg3 *tp, bool reset_phy) | |||
10116 | tw32_f(RDMAC_MODE, rdmac_mode); | 10164 | tw32_f(RDMAC_MODE, rdmac_mode); |
10117 | udelay(40); | 10165 | udelay(40); |
10118 | 10166 | ||
10119 | if (tg3_asic_rev(tp) == ASIC_REV_5719) { | 10167 | if (tg3_asic_rev(tp) == ASIC_REV_5719 || |
10168 | tg3_asic_rev(tp) == ASIC_REV_5720) { | ||
10120 | for (i = 0; i < TG3_NUM_RDMA_CHANNELS; i++) { | 10169 | for (i = 0; i < TG3_NUM_RDMA_CHANNELS; i++) { |
10121 | if (tr32(TG3_RDMA_LENGTH + (i << 2)) > TG3_MAX_MTU(tp)) | 10170 | if (tr32(TG3_RDMA_LENGTH + (i << 2)) > TG3_MAX_MTU(tp)) |
10122 | break; | 10171 | break; |
10123 | } | 10172 | } |
10124 | if (i < TG3_NUM_RDMA_CHANNELS) { | 10173 | if (i < TG3_NUM_RDMA_CHANNELS) { |
10125 | val = tr32(TG3_LSO_RD_DMA_CRPTEN_CTRL); | 10174 | val = tr32(TG3_LSO_RD_DMA_CRPTEN_CTRL); |
10126 | val |= TG3_LSO_RD_DMA_TX_LENGTH_WA; | 10175 | val |= tg3_lso_rd_dma_workaround_bit(tp); |
10127 | tw32(TG3_LSO_RD_DMA_CRPTEN_CTRL, val); | 10176 | tw32(TG3_LSO_RD_DMA_CRPTEN_CTRL, val); |
10128 | tg3_flag_set(tp, 5719_RDMA_BUG); | 10177 | tg3_flag_set(tp, 5719_5720_RDMA_BUG); |
10129 | } | 10178 | } |
10130 | } | 10179 | } |
10131 | 10180 | ||
@@ -10358,6 +10407,13 @@ static int tg3_reset_hw(struct tg3 *tp, bool reset_phy) | |||
10358 | */ | 10407 | */ |
10359 | static int tg3_init_hw(struct tg3 *tp, bool reset_phy) | 10408 | static int tg3_init_hw(struct tg3 *tp, bool reset_phy) |
10360 | { | 10409 | { |
10410 | /* Chip may have been just powered on. If so, the boot code may still | ||
10411 | * be running initialization. Wait for it to finish to avoid races in | ||
10412 | * accessing the hardware. | ||
10413 | */ | ||
10414 | tg3_enable_register_access(tp); | ||
10415 | tg3_poll_fw(tp); | ||
10416 | |||
10361 | tg3_switch_clocks(tp); | 10417 | tg3_switch_clocks(tp); |
10362 | 10418 | ||
10363 | tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0); | 10419 | tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0); |
@@ -10489,15 +10545,15 @@ static void tg3_periodic_fetch_stats(struct tg3 *tp) | |||
10489 | TG3_STAT_ADD32(&sp->tx_ucast_packets, MAC_TX_STATS_UCAST); | 10545 | TG3_STAT_ADD32(&sp->tx_ucast_packets, MAC_TX_STATS_UCAST); |
10490 | TG3_STAT_ADD32(&sp->tx_mcast_packets, MAC_TX_STATS_MCAST); | 10546 | TG3_STAT_ADD32(&sp->tx_mcast_packets, MAC_TX_STATS_MCAST); |
10491 | TG3_STAT_ADD32(&sp->tx_bcast_packets, MAC_TX_STATS_BCAST); | 10547 | TG3_STAT_ADD32(&sp->tx_bcast_packets, MAC_TX_STATS_BCAST); |
10492 | if (unlikely(tg3_flag(tp, 5719_RDMA_BUG) && | 10548 | if (unlikely(tg3_flag(tp, 5719_5720_RDMA_BUG) && |
10493 | (sp->tx_ucast_packets.low + sp->tx_mcast_packets.low + | 10549 | (sp->tx_ucast_packets.low + sp->tx_mcast_packets.low + |
10494 | sp->tx_bcast_packets.low) > TG3_NUM_RDMA_CHANNELS)) { | 10550 | sp->tx_bcast_packets.low) > TG3_NUM_RDMA_CHANNELS)) { |
10495 | u32 val; | 10551 | u32 val; |
10496 | 10552 | ||
10497 | val = tr32(TG3_LSO_RD_DMA_CRPTEN_CTRL); | 10553 | val = tr32(TG3_LSO_RD_DMA_CRPTEN_CTRL); |
10498 | val &= ~TG3_LSO_RD_DMA_TX_LENGTH_WA; | 10554 | val &= ~tg3_lso_rd_dma_workaround_bit(tp); |
10499 | tw32(TG3_LSO_RD_DMA_CRPTEN_CTRL, val); | 10555 | tw32(TG3_LSO_RD_DMA_CRPTEN_CTRL, val); |
10500 | tg3_flag_clear(tp, 5719_RDMA_BUG); | 10556 | tg3_flag_clear(tp, 5719_5720_RDMA_BUG); |
10501 | } | 10557 | } |
10502 | 10558 | ||
10503 | TG3_STAT_ADD32(&sp->rx_octets, MAC_RX_STATS_OCTETS); | 10559 | TG3_STAT_ADD32(&sp->rx_octets, MAC_RX_STATS_OCTETS); |
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h index 9b2d3ac2474a..ff6e30eeae35 100644 --- a/drivers/net/ethernet/broadcom/tg3.h +++ b/drivers/net/ethernet/broadcom/tg3.h | |||
@@ -1422,7 +1422,8 @@ | |||
1422 | #define TG3_LSO_RD_DMA_CRPTEN_CTRL 0x00004910 | 1422 | #define TG3_LSO_RD_DMA_CRPTEN_CTRL 0x00004910 |
1423 | #define TG3_LSO_RD_DMA_CRPTEN_CTRL_BLEN_BD_4K 0x00030000 | 1423 | #define TG3_LSO_RD_DMA_CRPTEN_CTRL_BLEN_BD_4K 0x00030000 |
1424 | #define TG3_LSO_RD_DMA_CRPTEN_CTRL_BLEN_LSO_4K 0x000c0000 | 1424 | #define TG3_LSO_RD_DMA_CRPTEN_CTRL_BLEN_LSO_4K 0x000c0000 |
1425 | #define TG3_LSO_RD_DMA_TX_LENGTH_WA 0x02000000 | 1425 | #define TG3_LSO_RD_DMA_TX_LENGTH_WA_5719 0x02000000 |
1426 | #define TG3_LSO_RD_DMA_TX_LENGTH_WA_5720 0x00200000 | ||
1426 | /* 0x4914 --> 0x4be0 unused */ | 1427 | /* 0x4914 --> 0x4be0 unused */ |
1427 | 1428 | ||
1428 | #define TG3_NUM_RDMA_CHANNELS 4 | 1429 | #define TG3_NUM_RDMA_CHANNELS 4 |
@@ -3059,7 +3060,7 @@ enum TG3_FLAGS { | |||
3059 | TG3_FLAG_APE_HAS_NCSI, | 3060 | TG3_FLAG_APE_HAS_NCSI, |
3060 | TG3_FLAG_TX_TSTAMP_EN, | 3061 | TG3_FLAG_TX_TSTAMP_EN, |
3061 | TG3_FLAG_4K_FIFO_LIMIT, | 3062 | TG3_FLAG_4K_FIFO_LIMIT, |
3062 | TG3_FLAG_5719_RDMA_BUG, | 3063 | TG3_FLAG_5719_5720_RDMA_BUG, |
3063 | TG3_FLAG_RESET_TASK_PENDING, | 3064 | TG3_FLAG_RESET_TASK_PENDING, |
3064 | TG3_FLAG_PTP_CAPABLE, | 3065 | TG3_FLAG_PTP_CAPABLE, |
3065 | TG3_FLAG_5705_PLUS, | 3066 | TG3_FLAG_5705_PLUS, |
diff --git a/drivers/net/ethernet/brocade/bna/bnad_debugfs.c b/drivers/net/ethernet/brocade/bna/bnad_debugfs.c index 6e8bc9d88c41..94d957d203a6 100644 --- a/drivers/net/ethernet/brocade/bna/bnad_debugfs.c +++ b/drivers/net/ethernet/brocade/bna/bnad_debugfs.c | |||
@@ -244,7 +244,7 @@ bnad_debugfs_lseek(struct file *file, loff_t offset, int orig) | |||
244 | file->f_pos += offset; | 244 | file->f_pos += offset; |
245 | break; | 245 | break; |
246 | case 2: | 246 | case 2: |
247 | file->f_pos = debug->buffer_len - offset; | 247 | file->f_pos = debug->buffer_len + offset; |
248 | break; | 248 | break; |
249 | default: | 249 | default: |
250 | return -EINVAL; | 250 | return -EINVAL; |
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 6be513deb17f..c89aa41dd448 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c | |||
@@ -485,7 +485,8 @@ static void macb_tx_interrupt(struct macb *bp) | |||
485 | status = macb_readl(bp, TSR); | 485 | status = macb_readl(bp, TSR); |
486 | macb_writel(bp, TSR, status); | 486 | macb_writel(bp, TSR, status); |
487 | 487 | ||
488 | macb_writel(bp, ISR, MACB_BIT(TCOMP)); | 488 | if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE) |
489 | macb_writel(bp, ISR, MACB_BIT(TCOMP)); | ||
489 | 490 | ||
490 | netdev_vdbg(bp->dev, "macb_tx_interrupt status = 0x%03lx\n", | 491 | netdev_vdbg(bp->dev, "macb_tx_interrupt status = 0x%03lx\n", |
491 | (unsigned long)status); | 492 | (unsigned long)status); |
@@ -738,7 +739,8 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) | |||
738 | * now. | 739 | * now. |
739 | */ | 740 | */ |
740 | macb_writel(bp, IDR, MACB_RX_INT_FLAGS); | 741 | macb_writel(bp, IDR, MACB_RX_INT_FLAGS); |
741 | macb_writel(bp, ISR, MACB_BIT(RCOMP)); | 742 | if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE) |
743 | macb_writel(bp, ISR, MACB_BIT(RCOMP)); | ||
742 | 744 | ||
743 | if (napi_schedule_prep(&bp->napi)) { | 745 | if (napi_schedule_prep(&bp->napi)) { |
744 | netdev_vdbg(bp->dev, "scheduling RX softirq\n"); | 746 | netdev_vdbg(bp->dev, "scheduling RX softirq\n"); |
@@ -1062,6 +1064,17 @@ static void macb_configure_dma(struct macb *bp) | |||
1062 | } | 1064 | } |
1063 | } | 1065 | } |
1064 | 1066 | ||
1067 | /* | ||
1068 | * Configure peripheral capacities according to integration options used | ||
1069 | */ | ||
1070 | static void macb_configure_caps(struct macb *bp) | ||
1071 | { | ||
1072 | if (macb_is_gem(bp)) { | ||
1073 | if (GEM_BF(IRQCOR, gem_readl(bp, DCFG1)) == 0) | ||
1074 | bp->caps |= MACB_CAPS_ISR_CLEAR_ON_WRITE; | ||
1075 | } | ||
1076 | } | ||
1077 | |||
1065 | static void macb_init_hw(struct macb *bp) | 1078 | static void macb_init_hw(struct macb *bp) |
1066 | { | 1079 | { |
1067 | u32 config; | 1080 | u32 config; |
@@ -1084,6 +1097,7 @@ static void macb_init_hw(struct macb *bp) | |||
1084 | bp->duplex = DUPLEX_HALF; | 1097 | bp->duplex = DUPLEX_HALF; |
1085 | 1098 | ||
1086 | macb_configure_dma(bp); | 1099 | macb_configure_dma(bp); |
1100 | macb_configure_caps(bp); | ||
1087 | 1101 | ||
1088 | /* Initialize TX and RX buffers */ | 1102 | /* Initialize TX and RX buffers */ |
1089 | macb_writel(bp, RBQP, bp->rx_ring_dma); | 1103 | macb_writel(bp, RBQP, bp->rx_ring_dma); |
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index 993d70380688..548c0ecae869 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h | |||
@@ -300,6 +300,8 @@ | |||
300 | #define MACB_REV_SIZE 16 | 300 | #define MACB_REV_SIZE 16 |
301 | 301 | ||
302 | /* Bitfields in DCFG1. */ | 302 | /* Bitfields in DCFG1. */ |
303 | #define GEM_IRQCOR_OFFSET 23 | ||
304 | #define GEM_IRQCOR_SIZE 1 | ||
303 | #define GEM_DBWDEF_OFFSET 25 | 305 | #define GEM_DBWDEF_OFFSET 25 |
304 | #define GEM_DBWDEF_SIZE 3 | 306 | #define GEM_DBWDEF_SIZE 3 |
305 | 307 | ||
@@ -323,6 +325,9 @@ | |||
323 | #define MACB_MAN_READ 2 | 325 | #define MACB_MAN_READ 2 |
324 | #define MACB_MAN_CODE 2 | 326 | #define MACB_MAN_CODE 2 |
325 | 327 | ||
328 | /* Capability mask bits */ | ||
329 | #define MACB_CAPS_ISR_CLEAR_ON_WRITE 0x1 | ||
330 | |||
326 | /* Bit manipulation macros */ | 331 | /* Bit manipulation macros */ |
327 | #define MACB_BIT(name) \ | 332 | #define MACB_BIT(name) \ |
328 | (1 << MACB_##name##_OFFSET) | 333 | (1 << MACB_##name##_OFFSET) |
@@ -574,6 +579,8 @@ struct macb { | |||
574 | unsigned int speed; | 579 | unsigned int speed; |
575 | unsigned int duplex; | 580 | unsigned int duplex; |
576 | 581 | ||
582 | u32 caps; | ||
583 | |||
577 | phy_interface_t phy_interface; | 584 | phy_interface_t phy_interface; |
578 | 585 | ||
579 | /* AT91RM9200 transmit */ | 586 | /* AT91RM9200 transmit */ |
diff --git a/drivers/net/ethernet/dec/tulip/interrupt.c b/drivers/net/ethernet/dec/tulip/interrupt.c index 28a5e425fecf..92306b320840 100644 --- a/drivers/net/ethernet/dec/tulip/interrupt.c +++ b/drivers/net/ethernet/dec/tulip/interrupt.c | |||
@@ -76,6 +76,12 @@ int tulip_refill_rx(struct net_device *dev) | |||
76 | 76 | ||
77 | mapping = pci_map_single(tp->pdev, skb->data, PKT_BUF_SZ, | 77 | mapping = pci_map_single(tp->pdev, skb->data, PKT_BUF_SZ, |
78 | PCI_DMA_FROMDEVICE); | 78 | PCI_DMA_FROMDEVICE); |
79 | if (dma_mapping_error(&tp->pdev->dev, mapping)) { | ||
80 | dev_kfree_skb(skb); | ||
81 | tp->rx_buffers[entry].skb = NULL; | ||
82 | break; | ||
83 | } | ||
84 | |||
79 | tp->rx_buffers[entry].mapping = mapping; | 85 | tp->rx_buffers[entry].mapping = mapping; |
80 | 86 | ||
81 | tp->rx_ring[entry].buffer1 = cpu_to_le32(mapping); | 87 | tp->rx_ring[entry].buffer1 = cpu_to_le32(mapping); |
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h index f544b297c9ab..0a510684e468 100644 --- a/drivers/net/ethernet/emulex/benet/be.h +++ b/drivers/net/ethernet/emulex/benet/be.h | |||
@@ -262,6 +262,7 @@ struct be_rx_compl_info { | |||
262 | u8 ipv6; | 262 | u8 ipv6; |
263 | u8 vtm; | 263 | u8 vtm; |
264 | u8 pkt_type; | 264 | u8 pkt_type; |
265 | u8 ip_frag; | ||
265 | }; | 266 | }; |
266 | 267 | ||
267 | struct be_rx_obj { | 268 | struct be_rx_obj { |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c index fd7b547698ab..1db2df61b8af 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.c +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c | |||
@@ -562,7 +562,7 @@ int lancer_test_and_set_rdy_state(struct be_adapter *adapter) | |||
562 | 562 | ||
563 | resource_error = lancer_provisioning_error(adapter); | 563 | resource_error = lancer_provisioning_error(adapter); |
564 | if (resource_error) | 564 | if (resource_error) |
565 | return -1; | 565 | return -EAGAIN; |
566 | 566 | ||
567 | status = lancer_wait_ready(adapter); | 567 | status = lancer_wait_ready(adapter); |
568 | if (!status) { | 568 | if (!status) { |
@@ -590,8 +590,8 @@ int lancer_test_and_set_rdy_state(struct be_adapter *adapter) | |||
590 | * when PF provisions resources. | 590 | * when PF provisions resources. |
591 | */ | 591 | */ |
592 | resource_error = lancer_provisioning_error(adapter); | 592 | resource_error = lancer_provisioning_error(adapter); |
593 | if (status == -1 && !resource_error) | 593 | if (resource_error) |
594 | adapter->eeh_error = true; | 594 | status = -EAGAIN; |
595 | 595 | ||
596 | return status; | 596 | return status; |
597 | } | 597 | } |
@@ -2976,22 +2976,17 @@ static struct be_nic_resource_desc *be_get_nic_desc(u8 *buf, u32 desc_count, | |||
2976 | for (i = 0; i < desc_count; i++) { | 2976 | for (i = 0; i < desc_count; i++) { |
2977 | desc->desc_len = desc->desc_len ? : RESOURCE_DESC_SIZE; | 2977 | desc->desc_len = desc->desc_len ? : RESOURCE_DESC_SIZE; |
2978 | if (((void *)desc + desc->desc_len) > | 2978 | if (((void *)desc + desc->desc_len) > |
2979 | (void *)(buf + max_buf_size)) { | 2979 | (void *)(buf + max_buf_size)) |
2980 | desc = NULL; | 2980 | return NULL; |
2981 | break; | ||
2982 | } | ||
2983 | 2981 | ||
2984 | if (desc->desc_type == NIC_RESOURCE_DESC_TYPE_V0 || | 2982 | if (desc->desc_type == NIC_RESOURCE_DESC_TYPE_V0 || |
2985 | desc->desc_type == NIC_RESOURCE_DESC_TYPE_V1) | 2983 | desc->desc_type == NIC_RESOURCE_DESC_TYPE_V1) |
2986 | break; | 2984 | return desc; |
2987 | 2985 | ||
2988 | desc = (void *)desc + desc->desc_len; | 2986 | desc = (void *)desc + desc->desc_len; |
2989 | } | 2987 | } |
2990 | 2988 | ||
2991 | if (!desc || i == MAX_RESOURCE_DESC) | 2989 | return NULL; |
2992 | return NULL; | ||
2993 | |||
2994 | return desc; | ||
2995 | } | 2990 | } |
2996 | 2991 | ||
2997 | /* Uses Mbox */ | 2992 | /* Uses Mbox */ |
diff --git a/drivers/net/ethernet/emulex/benet/be_hw.h b/drivers/net/ethernet/emulex/benet/be_hw.h index 3c1099b47f2a..8780183c6d1c 100644 --- a/drivers/net/ethernet/emulex/benet/be_hw.h +++ b/drivers/net/ethernet/emulex/benet/be_hw.h | |||
@@ -356,7 +356,7 @@ struct amap_eth_rx_compl_v0 { | |||
356 | u8 ip_version; /* dword 1 */ | 356 | u8 ip_version; /* dword 1 */ |
357 | u8 macdst[6]; /* dword 1 */ | 357 | u8 macdst[6]; /* dword 1 */ |
358 | u8 vtp; /* dword 1 */ | 358 | u8 vtp; /* dword 1 */ |
359 | u8 rsvd0; /* dword 1 */ | 359 | u8 ip_frag; /* dword 1 */ |
360 | u8 fragndx[10]; /* dword 1 */ | 360 | u8 fragndx[10]; /* dword 1 */ |
361 | u8 ct[2]; /* dword 1 */ | 361 | u8 ct[2]; /* dword 1 */ |
362 | u8 sw; /* dword 1 */ | 362 | u8 sw; /* dword 1 */ |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index a444110b060f..a0b4be51f0d1 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -780,26 +780,18 @@ static struct sk_buff *be_insert_vlan_in_pkt(struct be_adapter *adapter, | |||
780 | if (unlikely(!skb)) | 780 | if (unlikely(!skb)) |
781 | return skb; | 781 | return skb; |
782 | 782 | ||
783 | if (vlan_tx_tag_present(skb)) { | 783 | if (vlan_tx_tag_present(skb)) |
784 | vlan_tag = be_get_tx_vlan_tag(adapter, skb); | 784 | vlan_tag = be_get_tx_vlan_tag(adapter, skb); |
785 | skb = __vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_tag); | 785 | else if (qnq_async_evt_rcvd(adapter) && adapter->pvid) |
786 | if (skb) | 786 | vlan_tag = adapter->pvid; |
787 | skb->vlan_tci = 0; | ||
788 | } | ||
789 | |||
790 | if (qnq_async_evt_rcvd(adapter) && adapter->pvid) { | ||
791 | if (!vlan_tag) | ||
792 | vlan_tag = adapter->pvid; | ||
793 | if (skip_hw_vlan) | ||
794 | *skip_hw_vlan = true; | ||
795 | } | ||
796 | 787 | ||
797 | if (vlan_tag) { | 788 | if (vlan_tag) { |
798 | skb = __vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_tag); | 789 | skb = __vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_tag); |
799 | if (unlikely(!skb)) | 790 | if (unlikely(!skb)) |
800 | return skb; | 791 | return skb; |
801 | |||
802 | skb->vlan_tci = 0; | 792 | skb->vlan_tci = 0; |
793 | if (skip_hw_vlan) | ||
794 | *skip_hw_vlan = true; | ||
803 | } | 795 | } |
804 | 796 | ||
805 | /* Insert the outer VLAN, if any */ | 797 | /* Insert the outer VLAN, if any */ |
@@ -1607,6 +1599,8 @@ static void be_parse_rx_compl_v0(struct be_eth_rx_compl *compl, | |||
1607 | compl); | 1599 | compl); |
1608 | } | 1600 | } |
1609 | rxcp->port = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, port, compl); | 1601 | rxcp->port = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, port, compl); |
1602 | rxcp->ip_frag = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, | ||
1603 | ip_frag, compl); | ||
1610 | } | 1604 | } |
1611 | 1605 | ||
1612 | static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo) | 1606 | static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo) |
@@ -1628,6 +1622,9 @@ static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo) | |||
1628 | else | 1622 | else |
1629 | be_parse_rx_compl_v0(compl, rxcp); | 1623 | be_parse_rx_compl_v0(compl, rxcp); |
1630 | 1624 | ||
1625 | if (rxcp->ip_frag) | ||
1626 | rxcp->l4_csum = 0; | ||
1627 | |||
1631 | if (rxcp->vlanf) { | 1628 | if (rxcp->vlanf) { |
1632 | /* vlanf could be wrongly set in some cards. | 1629 | /* vlanf could be wrongly set in some cards. |
1633 | * ignore if vtm is not set */ | 1630 | * ignore if vtm is not set */ |
@@ -2176,7 +2173,7 @@ static irqreturn_t be_msix(int irq, void *dev) | |||
2176 | 2173 | ||
2177 | static inline bool do_gro(struct be_rx_compl_info *rxcp) | 2174 | static inline bool do_gro(struct be_rx_compl_info *rxcp) |
2178 | { | 2175 | { |
2179 | return (rxcp->tcpf && !rxcp->err) ? true : false; | 2176 | return (rxcp->tcpf && !rxcp->err && rxcp->l4_csum) ? true : false; |
2180 | } | 2177 | } |
2181 | 2178 | ||
2182 | static int be_process_rx(struct be_rx_obj *rxo, struct napi_struct *napi, | 2179 | static int be_process_rx(struct be_rx_obj *rxo, struct napi_struct *napi, |
@@ -4101,6 +4098,7 @@ static int be_get_initial_config(struct be_adapter *adapter) | |||
4101 | 4098 | ||
4102 | static int lancer_recover_func(struct be_adapter *adapter) | 4099 | static int lancer_recover_func(struct be_adapter *adapter) |
4103 | { | 4100 | { |
4101 | struct device *dev = &adapter->pdev->dev; | ||
4104 | int status; | 4102 | int status; |
4105 | 4103 | ||
4106 | status = lancer_test_and_set_rdy_state(adapter); | 4104 | status = lancer_test_and_set_rdy_state(adapter); |
@@ -4112,8 +4110,7 @@ static int lancer_recover_func(struct be_adapter *adapter) | |||
4112 | 4110 | ||
4113 | be_clear(adapter); | 4111 | be_clear(adapter); |
4114 | 4112 | ||
4115 | adapter->hw_error = false; | 4113 | be_clear_all_error(adapter); |
4116 | adapter->fw_timeout = false; | ||
4117 | 4114 | ||
4118 | status = be_setup(adapter); | 4115 | status = be_setup(adapter); |
4119 | if (status) | 4116 | if (status) |
@@ -4125,13 +4122,13 @@ static int lancer_recover_func(struct be_adapter *adapter) | |||
4125 | goto err; | 4122 | goto err; |
4126 | } | 4123 | } |
4127 | 4124 | ||
4128 | dev_err(&adapter->pdev->dev, | 4125 | dev_err(dev, "Error recovery successful\n"); |
4129 | "Adapter SLIPORT recovery succeeded\n"); | ||
4130 | return 0; | 4126 | return 0; |
4131 | err: | 4127 | err: |
4132 | if (adapter->eeh_error) | 4128 | if (status == -EAGAIN) |
4133 | dev_err(&adapter->pdev->dev, | 4129 | dev_err(dev, "Waiting for resource provisioning\n"); |
4134 | "Adapter SLIPORT recovery failed\n"); | 4130 | else |
4131 | dev_err(dev, "Error recovery failed\n"); | ||
4135 | 4132 | ||
4136 | return status; | 4133 | return status; |
4137 | } | 4134 | } |
@@ -4140,28 +4137,27 @@ static void be_func_recovery_task(struct work_struct *work) | |||
4140 | { | 4137 | { |
4141 | struct be_adapter *adapter = | 4138 | struct be_adapter *adapter = |
4142 | container_of(work, struct be_adapter, func_recovery_work.work); | 4139 | container_of(work, struct be_adapter, func_recovery_work.work); |
4143 | int status; | 4140 | int status = 0; |
4144 | 4141 | ||
4145 | be_detect_error(adapter); | 4142 | be_detect_error(adapter); |
4146 | 4143 | ||
4147 | if (adapter->hw_error && lancer_chip(adapter)) { | 4144 | if (adapter->hw_error && lancer_chip(adapter)) { |
4148 | 4145 | ||
4149 | if (adapter->eeh_error) | ||
4150 | goto out; | ||
4151 | |||
4152 | rtnl_lock(); | 4146 | rtnl_lock(); |
4153 | netif_device_detach(adapter->netdev); | 4147 | netif_device_detach(adapter->netdev); |
4154 | rtnl_unlock(); | 4148 | rtnl_unlock(); |
4155 | 4149 | ||
4156 | status = lancer_recover_func(adapter); | 4150 | status = lancer_recover_func(adapter); |
4157 | |||
4158 | if (!status) | 4151 | if (!status) |
4159 | netif_device_attach(adapter->netdev); | 4152 | netif_device_attach(adapter->netdev); |
4160 | } | 4153 | } |
4161 | 4154 | ||
4162 | out: | 4155 | /* In Lancer, for all errors other than provisioning error (-EAGAIN), |
4163 | schedule_delayed_work(&adapter->func_recovery_work, | 4156 | * no need to attempt further recovery. |
4164 | msecs_to_jiffies(1000)); | 4157 | */ |
4158 | if (!status || status == -EAGAIN) | ||
4159 | schedule_delayed_work(&adapter->func_recovery_work, | ||
4160 | msecs_to_jiffies(1000)); | ||
4165 | } | 4161 | } |
4166 | 4162 | ||
4167 | static void be_worker(struct work_struct *work) | 4163 | static void be_worker(struct work_struct *work) |
@@ -4266,6 +4262,9 @@ static int be_probe(struct pci_dev *pdev, const struct pci_device_id *pdev_id) | |||
4266 | netdev->features |= NETIF_F_HIGHDMA; | 4262 | netdev->features |= NETIF_F_HIGHDMA; |
4267 | } else { | 4263 | } else { |
4268 | status = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); | 4264 | status = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); |
4265 | if (!status) | ||
4266 | status = dma_set_coherent_mask(&pdev->dev, | ||
4267 | DMA_BIT_MASK(32)); | ||
4269 | if (status) { | 4268 | if (status) { |
4270 | dev_err(&pdev->dev, "Could not set PCI DMA Mask\n"); | 4269 | dev_err(&pdev->dev, "Could not set PCI DMA Mask\n"); |
4271 | goto free_netdev; | 4270 | goto free_netdev; |
@@ -4444,20 +4443,19 @@ static pci_ers_result_t be_eeh_err_detected(struct pci_dev *pdev, | |||
4444 | 4443 | ||
4445 | dev_err(&adapter->pdev->dev, "EEH error detected\n"); | 4444 | dev_err(&adapter->pdev->dev, "EEH error detected\n"); |
4446 | 4445 | ||
4447 | adapter->eeh_error = true; | 4446 | if (!adapter->eeh_error) { |
4447 | adapter->eeh_error = true; | ||
4448 | 4448 | ||
4449 | cancel_delayed_work_sync(&adapter->func_recovery_work); | 4449 | cancel_delayed_work_sync(&adapter->func_recovery_work); |
4450 | 4450 | ||
4451 | rtnl_lock(); | ||
4452 | netif_device_detach(netdev); | ||
4453 | rtnl_unlock(); | ||
4454 | |||
4455 | if (netif_running(netdev)) { | ||
4456 | rtnl_lock(); | 4451 | rtnl_lock(); |
4457 | be_close(netdev); | 4452 | netif_device_detach(netdev); |
4453 | if (netif_running(netdev)) | ||
4454 | be_close(netdev); | ||
4458 | rtnl_unlock(); | 4455 | rtnl_unlock(); |
4456 | |||
4457 | be_clear(adapter); | ||
4459 | } | 4458 | } |
4460 | be_clear(adapter); | ||
4461 | 4459 | ||
4462 | if (state == pci_channel_io_perm_failure) | 4460 | if (state == pci_channel_io_perm_failure) |
4463 | return PCI_ERS_RESULT_DISCONNECT; | 4461 | return PCI_ERS_RESULT_DISCONNECT; |
@@ -4482,7 +4480,6 @@ static pci_ers_result_t be_eeh_reset(struct pci_dev *pdev) | |||
4482 | int status; | 4480 | int status; |
4483 | 4481 | ||
4484 | dev_info(&adapter->pdev->dev, "EEH reset\n"); | 4482 | dev_info(&adapter->pdev->dev, "EEH reset\n"); |
4485 | be_clear_all_error(adapter); | ||
4486 | 4483 | ||
4487 | status = pci_enable_device(pdev); | 4484 | status = pci_enable_device(pdev); |
4488 | if (status) | 4485 | if (status) |
@@ -4500,6 +4497,7 @@ static pci_ers_result_t be_eeh_reset(struct pci_dev *pdev) | |||
4500 | return PCI_ERS_RESULT_DISCONNECT; | 4497 | return PCI_ERS_RESULT_DISCONNECT; |
4501 | 4498 | ||
4502 | pci_cleanup_aer_uncorrect_error_status(pdev); | 4499 | pci_cleanup_aer_uncorrect_error_status(pdev); |
4500 | be_clear_all_error(adapter); | ||
4503 | return PCI_ERS_RESULT_RECOVERED; | 4501 | return PCI_ERS_RESULT_RECOVERED; |
4504 | } | 4502 | } |
4505 | 4503 | ||
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index ca9825ca88c9..a667015be22a 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
@@ -109,7 +109,7 @@ static struct platform_device_id fec_devtype[] = { | |||
109 | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | | 109 | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | |
110 | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM, | 110 | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM, |
111 | }, { | 111 | }, { |
112 | .name = "mvf-fec", | 112 | .name = "mvf600-fec", |
113 | .driver_data = FEC_QUIRK_ENET_MAC, | 113 | .driver_data = FEC_QUIRK_ENET_MAC, |
114 | }, { | 114 | }, { |
115 | /* sentinel */ | 115 | /* sentinel */ |
@@ -122,7 +122,7 @@ enum imx_fec_type { | |||
122 | IMX27_FEC, /* runs on i.mx27/35/51 */ | 122 | IMX27_FEC, /* runs on i.mx27/35/51 */ |
123 | IMX28_FEC, | 123 | IMX28_FEC, |
124 | IMX6Q_FEC, | 124 | IMX6Q_FEC, |
125 | MVF_FEC, | 125 | MVF600_FEC, |
126 | }; | 126 | }; |
127 | 127 | ||
128 | static const struct of_device_id fec_dt_ids[] = { | 128 | static const struct of_device_id fec_dt_ids[] = { |
@@ -130,7 +130,7 @@ static const struct of_device_id fec_dt_ids[] = { | |||
130 | { .compatible = "fsl,imx27-fec", .data = &fec_devtype[IMX27_FEC], }, | 130 | { .compatible = "fsl,imx27-fec", .data = &fec_devtype[IMX27_FEC], }, |
131 | { .compatible = "fsl,imx28-fec", .data = &fec_devtype[IMX28_FEC], }, | 131 | { .compatible = "fsl,imx28-fec", .data = &fec_devtype[IMX28_FEC], }, |
132 | { .compatible = "fsl,imx6q-fec", .data = &fec_devtype[IMX6Q_FEC], }, | 132 | { .compatible = "fsl,imx6q-fec", .data = &fec_devtype[IMX6Q_FEC], }, |
133 | { .compatible = "fsl,mvf-fec", .data = &fec_devtype[MVF_FEC], }, | 133 | { .compatible = "fsl,mvf600-fec", .data = &fec_devtype[MVF600_FEC], }, |
134 | { /* sentinel */ } | 134 | { /* sentinel */ } |
135 | }; | 135 | }; |
136 | MODULE_DEVICE_TABLE(of, fec_dt_ids); | 136 | MODULE_DEVICE_TABLE(of, fec_dt_ids); |
@@ -451,7 +451,7 @@ fec_restart(struct net_device *ndev, int duplex) | |||
451 | netif_device_detach(ndev); | 451 | netif_device_detach(ndev); |
452 | napi_disable(&fep->napi); | 452 | napi_disable(&fep->napi); |
453 | netif_stop_queue(ndev); | 453 | netif_stop_queue(ndev); |
454 | netif_tx_lock(ndev); | 454 | netif_tx_lock_bh(ndev); |
455 | } | 455 | } |
456 | 456 | ||
457 | /* Whack a reset. We should wait for this. */ | 457 | /* Whack a reset. We should wait for this. */ |
@@ -616,10 +616,10 @@ fec_restart(struct net_device *ndev, int duplex) | |||
616 | writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK); | 616 | writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK); |
617 | 617 | ||
618 | if (netif_running(ndev)) { | 618 | if (netif_running(ndev)) { |
619 | netif_device_attach(ndev); | 619 | netif_tx_unlock_bh(ndev); |
620 | napi_enable(&fep->napi); | ||
621 | netif_wake_queue(ndev); | 620 | netif_wake_queue(ndev); |
622 | netif_tx_unlock(ndev); | 621 | napi_enable(&fep->napi); |
622 | netif_device_attach(ndev); | ||
623 | } | 623 | } |
624 | } | 624 | } |
625 | 625 | ||
@@ -1038,6 +1038,18 @@ static void fec_get_mac(struct net_device *ndev) | |||
1038 | iap = &tmpaddr[0]; | 1038 | iap = &tmpaddr[0]; |
1039 | } | 1039 | } |
1040 | 1040 | ||
1041 | /* | ||
1042 | * 5) random mac address | ||
1043 | */ | ||
1044 | if (!is_valid_ether_addr(iap)) { | ||
1045 | /* Report it and use a random ethernet address instead */ | ||
1046 | netdev_err(ndev, "Invalid MAC address: %pM\n", iap); | ||
1047 | eth_hw_addr_random(ndev); | ||
1048 | netdev_info(ndev, "Using random MAC address: %pM\n", | ||
1049 | ndev->dev_addr); | ||
1050 | return; | ||
1051 | } | ||
1052 | |||
1041 | memcpy(ndev->dev_addr, iap, ETH_ALEN); | 1053 | memcpy(ndev->dev_addr, iap, ETH_ALEN); |
1042 | 1054 | ||
1043 | /* Adjust MAC if using macaddr */ | 1055 | /* Adjust MAC if using macaddr */ |
diff --git a/drivers/net/ethernet/freescale/gianfar_ptp.c b/drivers/net/ethernet/freescale/gianfar_ptp.c index 576e4b858fce..083ea2b4d20a 100644 --- a/drivers/net/ethernet/freescale/gianfar_ptp.c +++ b/drivers/net/ethernet/freescale/gianfar_ptp.c | |||
@@ -524,6 +524,7 @@ static int gianfar_ptp_probe(struct platform_device *dev) | |||
524 | return 0; | 524 | return 0; |
525 | 525 | ||
526 | no_clock: | 526 | no_clock: |
527 | iounmap(etsects->regs); | ||
527 | no_ioremap: | 528 | no_ioremap: |
528 | release_resource(etsects->rsrc); | 529 | release_resource(etsects->rsrc); |
529 | no_resource: | 530 | no_resource: |
diff --git a/drivers/net/ethernet/icplus/ipg.h b/drivers/net/ethernet/icplus/ipg.h index 6ce027355fcf..abb300a31912 100644 --- a/drivers/net/ethernet/icplus/ipg.h +++ b/drivers/net/ethernet/icplus/ipg.h | |||
@@ -195,57 +195,57 @@ enum ipg_regs { | |||
195 | /* TFD data structure masks. */ | 195 | /* TFD data structure masks. */ |
196 | 196 | ||
197 | /* TFDList, TFC */ | 197 | /* TFDList, TFC */ |
198 | #define IPG_TFC_RSVD_MASK 0x0000FFFF9FFFFFFF | 198 | #define IPG_TFC_RSVD_MASK 0x0000FFFF9FFFFFFFULL |
199 | #define IPG_TFC_FRAMEID 0x000000000000FFFF | 199 | #define IPG_TFC_FRAMEID 0x000000000000FFFFULL |
200 | #define IPG_TFC_WORDALIGN 0x0000000000030000 | 200 | #define IPG_TFC_WORDALIGN 0x0000000000030000ULL |
201 | #define IPG_TFC_WORDALIGNTODWORD 0x0000000000000000 | 201 | #define IPG_TFC_WORDALIGNTODWORD 0x0000000000000000ULL |
202 | #define IPG_TFC_WORDALIGNTOWORD 0x0000000000020000 | 202 | #define IPG_TFC_WORDALIGNTOWORD 0x0000000000020000ULL |
203 | #define IPG_TFC_WORDALIGNDISABLED 0x0000000000030000 | 203 | #define IPG_TFC_WORDALIGNDISABLED 0x0000000000030000ULL |
204 | #define IPG_TFC_TCPCHECKSUMENABLE 0x0000000000040000 | 204 | #define IPG_TFC_TCPCHECKSUMENABLE 0x0000000000040000ULL |
205 | #define IPG_TFC_UDPCHECKSUMENABLE 0x0000000000080000 | 205 | #define IPG_TFC_UDPCHECKSUMENABLE 0x0000000000080000ULL |
206 | #define IPG_TFC_IPCHECKSUMENABLE 0x0000000000100000 | 206 | #define IPG_TFC_IPCHECKSUMENABLE 0x0000000000100000ULL |
207 | #define IPG_TFC_FCSAPPENDDISABLE 0x0000000000200000 | 207 | #define IPG_TFC_FCSAPPENDDISABLE 0x0000000000200000ULL |
208 | #define IPG_TFC_TXINDICATE 0x0000000000400000 | 208 | #define IPG_TFC_TXINDICATE 0x0000000000400000ULL |
209 | #define IPG_TFC_TXDMAINDICATE 0x0000000000800000 | 209 | #define IPG_TFC_TXDMAINDICATE 0x0000000000800000ULL |
210 | #define IPG_TFC_FRAGCOUNT 0x000000000F000000 | 210 | #define IPG_TFC_FRAGCOUNT 0x000000000F000000ULL |
211 | #define IPG_TFC_VLANTAGINSERT 0x0000000010000000 | 211 | #define IPG_TFC_VLANTAGINSERT 0x0000000010000000ULL |
212 | #define IPG_TFC_TFDDONE 0x0000000080000000 | 212 | #define IPG_TFC_TFDDONE 0x0000000080000000ULL |
213 | #define IPG_TFC_VID 0x00000FFF00000000 | 213 | #define IPG_TFC_VID 0x00000FFF00000000ULL |
214 | #define IPG_TFC_CFI 0x0000100000000000 | 214 | #define IPG_TFC_CFI 0x0000100000000000ULL |
215 | #define IPG_TFC_USERPRIORITY 0x0000E00000000000 | 215 | #define IPG_TFC_USERPRIORITY 0x0000E00000000000ULL |
216 | 216 | ||
217 | /* TFDList, FragInfo */ | 217 | /* TFDList, FragInfo */ |
218 | #define IPG_TFI_RSVD_MASK 0xFFFF00FFFFFFFFFF | 218 | #define IPG_TFI_RSVD_MASK 0xFFFF00FFFFFFFFFFULL |
219 | #define IPG_TFI_FRAGADDR 0x000000FFFFFFFFFF | 219 | #define IPG_TFI_FRAGADDR 0x000000FFFFFFFFFFULL |
220 | #define IPG_TFI_FRAGLEN 0xFFFF000000000000LL | 220 | #define IPG_TFI_FRAGLEN 0xFFFF000000000000ULL |
221 | 221 | ||
222 | /* RFD data structure masks. */ | 222 | /* RFD data structure masks. */ |
223 | 223 | ||
224 | /* RFDList, RFS */ | 224 | /* RFDList, RFS */ |
225 | #define IPG_RFS_RSVD_MASK 0x0000FFFFFFFFFFFF | 225 | #define IPG_RFS_RSVD_MASK 0x0000FFFFFFFFFFFFULL |
226 | #define IPG_RFS_RXFRAMELEN 0x000000000000FFFF | 226 | #define IPG_RFS_RXFRAMELEN 0x000000000000FFFFULL |
227 | #define IPG_RFS_RXFIFOOVERRUN 0x0000000000010000 | 227 | #define IPG_RFS_RXFIFOOVERRUN 0x0000000000010000ULL |
228 | #define IPG_RFS_RXRUNTFRAME 0x0000000000020000 | 228 | #define IPG_RFS_RXRUNTFRAME 0x0000000000020000ULL |
229 | #define IPG_RFS_RXALIGNMENTERROR 0x0000000000040000 | 229 | #define IPG_RFS_RXALIGNMENTERROR 0x0000000000040000ULL |
230 | #define IPG_RFS_RXFCSERROR 0x0000000000080000 | 230 | #define IPG_RFS_RXFCSERROR 0x0000000000080000ULL |
231 | #define IPG_RFS_RXOVERSIZEDFRAME 0x0000000000100000 | 231 | #define IPG_RFS_RXOVERSIZEDFRAME 0x0000000000100000ULL |
232 | #define IPG_RFS_RXLENGTHERROR 0x0000000000200000 | 232 | #define IPG_RFS_RXLENGTHERROR 0x0000000000200000ULL |
233 | #define IPG_RFS_VLANDETECTED 0x0000000000400000 | 233 | #define IPG_RFS_VLANDETECTED 0x0000000000400000ULL |
234 | #define IPG_RFS_TCPDETECTED 0x0000000000800000 | 234 | #define IPG_RFS_TCPDETECTED 0x0000000000800000ULL |
235 | #define IPG_RFS_TCPERROR 0x0000000001000000 | 235 | #define IPG_RFS_TCPERROR 0x0000000001000000ULL |
236 | #define IPG_RFS_UDPDETECTED 0x0000000002000000 | 236 | #define IPG_RFS_UDPDETECTED 0x0000000002000000ULL |
237 | #define IPG_RFS_UDPERROR 0x0000000004000000 | 237 | #define IPG_RFS_UDPERROR 0x0000000004000000ULL |
238 | #define IPG_RFS_IPDETECTED 0x0000000008000000 | 238 | #define IPG_RFS_IPDETECTED 0x0000000008000000ULL |
239 | #define IPG_RFS_IPERROR 0x0000000010000000 | 239 | #define IPG_RFS_IPERROR 0x0000000010000000ULL |
240 | #define IPG_RFS_FRAMESTART 0x0000000020000000 | 240 | #define IPG_RFS_FRAMESTART 0x0000000020000000ULL |
241 | #define IPG_RFS_FRAMEEND 0x0000000040000000 | 241 | #define IPG_RFS_FRAMEEND 0x0000000040000000ULL |
242 | #define IPG_RFS_RFDDONE 0x0000000080000000 | 242 | #define IPG_RFS_RFDDONE 0x0000000080000000ULL |
243 | #define IPG_RFS_TCI 0x0000FFFF00000000 | 243 | #define IPG_RFS_TCI 0x0000FFFF00000000ULL |
244 | 244 | ||
245 | /* RFDList, FragInfo */ | 245 | /* RFDList, FragInfo */ |
246 | #define IPG_RFI_RSVD_MASK 0xFFFF00FFFFFFFFFF | 246 | #define IPG_RFI_RSVD_MASK 0xFFFF00FFFFFFFFFFULL |
247 | #define IPG_RFI_FRAGADDR 0x000000FFFFFFFFFF | 247 | #define IPG_RFI_FRAGADDR 0x000000FFFFFFFFFFULL |
248 | #define IPG_RFI_FRAGLEN 0xFFFF000000000000LL | 248 | #define IPG_RFI_FRAGLEN 0xFFFF000000000000ULL |
249 | 249 | ||
250 | /* I/O Register masks. */ | 250 | /* I/O Register masks. */ |
251 | 251 | ||
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index d0afeea181fb..2ad1494efbb3 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c | |||
@@ -867,7 +867,7 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force) | |||
867 | struct netdev_queue *nq = netdev_get_tx_queue(mp->dev, txq->index); | 867 | struct netdev_queue *nq = netdev_get_tx_queue(mp->dev, txq->index); |
868 | int reclaimed; | 868 | int reclaimed; |
869 | 869 | ||
870 | __netif_tx_lock(nq, smp_processor_id()); | 870 | __netif_tx_lock_bh(nq); |
871 | 871 | ||
872 | reclaimed = 0; | 872 | reclaimed = 0; |
873 | while (reclaimed < budget && txq->tx_desc_count > 0) { | 873 | while (reclaimed < budget && txq->tx_desc_count > 0) { |
@@ -913,7 +913,7 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force) | |||
913 | dev_kfree_skb(skb); | 913 | dev_kfree_skb(skb); |
914 | } | 914 | } |
915 | 915 | ||
916 | __netif_tx_unlock(nq); | 916 | __netif_tx_unlock_bh(nq); |
917 | 917 | ||
918 | if (reclaimed < budget) | 918 | if (reclaimed < budget) |
919 | mp->work_tx &= ~(1 << txq->index); | 919 | mp->work_tx &= ~(1 << txq->index); |
@@ -2745,7 +2745,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
2745 | 2745 | ||
2746 | INIT_WORK(&mp->tx_timeout_task, tx_timeout_task); | 2746 | INIT_WORK(&mp->tx_timeout_task, tx_timeout_task); |
2747 | 2747 | ||
2748 | netif_napi_add(dev, &mp->napi, mv643xx_eth_poll, 128); | 2748 | netif_napi_add(dev, &mp->napi, mv643xx_eth_poll, NAPI_POLL_WEIGHT); |
2749 | 2749 | ||
2750 | init_timer(&mp->rx_oom); | 2750 | init_timer(&mp->rx_oom); |
2751 | mp->rx_oom.data = (unsigned long)mp; | 2751 | mp->rx_oom.data = (unsigned long)mp; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c index 1df56cc50ee9..0e572a527154 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c | |||
@@ -222,8 +222,6 @@ static int mlx4_comm_cmd_poll(struct mlx4_dev *dev, u8 cmd, u16 param, | |||
222 | * FLR process. The only non-zero result in the RESET command | 222 | * FLR process. The only non-zero result in the RESET command |
223 | * is MLX4_DELAY_RESET_SLAVE*/ | 223 | * is MLX4_DELAY_RESET_SLAVE*/ |
224 | if ((MLX4_COMM_CMD_RESET == cmd)) { | 224 | if ((MLX4_COMM_CMD_RESET == cmd)) { |
225 | mlx4_warn(dev, "Got slave FLRed from Communication" | ||
226 | " channel (ret:0x%x)\n", ret_from_pending); | ||
227 | err = MLX4_DELAY_RESET_SLAVE; | 225 | err = MLX4_DELAY_RESET_SLAVE; |
228 | } else { | 226 | } else { |
229 | mlx4_warn(dev, "Communication channel timed out\n"); | 227 | mlx4_warn(dev, "Communication channel timed out\n"); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index b35f94700093..89c47ea84b50 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -1323,6 +1323,7 @@ static void mlx4_en_auto_moderation(struct mlx4_en_priv *priv) | |||
1323 | priv->last_moder_time[ring] = moder_time; | 1323 | priv->last_moder_time[ring] = moder_time; |
1324 | cq = &priv->rx_cq[ring]; | 1324 | cq = &priv->rx_cq[ring]; |
1325 | cq->moder_time = moder_time; | 1325 | cq->moder_time = moder_time; |
1326 | cq->moder_cnt = priv->rx_frames; | ||
1326 | err = mlx4_en_set_cq_moder(priv, cq); | 1327 | err = mlx4_en_set_cq_moder(priv, cq); |
1327 | if (err) | 1328 | if (err) |
1328 | en_err(priv, "Failed modifying moderation for cq:%d\n", | 1329 | en_err(priv, "Failed modifying moderation for cq:%d\n", |
@@ -2118,6 +2119,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
2118 | struct mlx4_en_priv *priv; | 2119 | struct mlx4_en_priv *priv; |
2119 | int i; | 2120 | int i; |
2120 | int err; | 2121 | int err; |
2122 | u64 mac_u64; | ||
2121 | 2123 | ||
2122 | dev = alloc_etherdev_mqs(sizeof(struct mlx4_en_priv), | 2124 | dev = alloc_etherdev_mqs(sizeof(struct mlx4_en_priv), |
2123 | MAX_TX_RINGS, MAX_RX_RINGS); | 2125 | MAX_TX_RINGS, MAX_RX_RINGS); |
@@ -2191,10 +2193,17 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
2191 | dev->addr_len = ETH_ALEN; | 2193 | dev->addr_len = ETH_ALEN; |
2192 | mlx4_en_u64_to_mac(dev->dev_addr, mdev->dev->caps.def_mac[priv->port]); | 2194 | mlx4_en_u64_to_mac(dev->dev_addr, mdev->dev->caps.def_mac[priv->port]); |
2193 | if (!is_valid_ether_addr(dev->dev_addr)) { | 2195 | if (!is_valid_ether_addr(dev->dev_addr)) { |
2194 | en_err(priv, "Port: %d, invalid mac burned: %pM, quiting\n", | 2196 | if (mlx4_is_slave(priv->mdev->dev)) { |
2195 | priv->port, dev->dev_addr); | 2197 | eth_hw_addr_random(dev); |
2196 | err = -EINVAL; | 2198 | en_warn(priv, "Assigned random MAC address %pM\n", dev->dev_addr); |
2197 | goto out; | 2199 | mac_u64 = mlx4_en_mac_to_u64(dev->dev_addr); |
2200 | mdev->dev->caps.def_mac[priv->port] = mac_u64; | ||
2201 | } else { | ||
2202 | en_err(priv, "Port: %d, invalid mac burned: %pM, quiting\n", | ||
2203 | priv->port, dev->dev_addr); | ||
2204 | err = -EINVAL; | ||
2205 | goto out; | ||
2206 | } | ||
2198 | } | 2207 | } |
2199 | 2208 | ||
2200 | memcpy(priv->prev_mac, dev->dev_addr, sizeof(priv->prev_mac)); | 2209 | memcpy(priv->prev_mac, dev->dev_addr, sizeof(priv->prev_mac)); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c index 58a8e535d698..2c97901c6a6d 100644 --- a/drivers/net/ethernet/mellanox/mlx4/fw.c +++ b/drivers/net/ethernet/mellanox/mlx4/fw.c | |||
@@ -840,12 +840,16 @@ int mlx4_QUERY_PORT_wrapper(struct mlx4_dev *dev, int slave, | |||
840 | MLX4_CMD_NATIVE); | 840 | MLX4_CMD_NATIVE); |
841 | 841 | ||
842 | if (!err && dev->caps.function != slave) { | 842 | if (!err && dev->caps.function != slave) { |
843 | /* set slave default_mac address */ | ||
844 | MLX4_GET(def_mac, outbox->buf, QUERY_PORT_MAC_OFFSET); | ||
845 | def_mac += slave << 8; | ||
846 | /* if config MAC in DB use it */ | 843 | /* if config MAC in DB use it */ |
847 | if (priv->mfunc.master.vf_oper[slave].vport[vhcr->in_modifier].state.mac) | 844 | if (priv->mfunc.master.vf_oper[slave].vport[vhcr->in_modifier].state.mac) |
848 | def_mac = priv->mfunc.master.vf_oper[slave].vport[vhcr->in_modifier].state.mac; | 845 | def_mac = priv->mfunc.master.vf_oper[slave].vport[vhcr->in_modifier].state.mac; |
846 | else { | ||
847 | /* set slave default_mac address */ | ||
848 | MLX4_GET(def_mac, outbox->buf, QUERY_PORT_MAC_OFFSET); | ||
849 | def_mac += slave << 8; | ||
850 | priv->mfunc.master.vf_admin[slave].vport[vhcr->in_modifier].mac = def_mac; | ||
851 | } | ||
852 | |||
849 | MLX4_PUT(outbox->buf, def_mac, QUERY_PORT_MAC_OFFSET); | 853 | MLX4_PUT(outbox->buf, def_mac, QUERY_PORT_MAC_OFFSET); |
850 | 854 | ||
851 | /* get port type - currently only eth is enabled */ | 855 | /* get port type - currently only eth is enabled */ |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 0d32a82458bf..2f4a26039e80 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -1290,7 +1290,6 @@ static int mlx4_init_slave(struct mlx4_dev *dev) | |||
1290 | { | 1290 | { |
1291 | struct mlx4_priv *priv = mlx4_priv(dev); | 1291 | struct mlx4_priv *priv = mlx4_priv(dev); |
1292 | u64 dma = (u64) priv->mfunc.vhcr_dma; | 1292 | u64 dma = (u64) priv->mfunc.vhcr_dma; |
1293 | int num_of_reset_retries = NUM_OF_RESET_RETRIES; | ||
1294 | int ret_from_reset = 0; | 1293 | int ret_from_reset = 0; |
1295 | u32 slave_read; | 1294 | u32 slave_read; |
1296 | u32 cmd_channel_ver; | 1295 | u32 cmd_channel_ver; |
@@ -1304,18 +1303,10 @@ static int mlx4_init_slave(struct mlx4_dev *dev) | |||
1304 | * NUM_OF_RESET_RETRIES times before leaving.*/ | 1303 | * NUM_OF_RESET_RETRIES times before leaving.*/ |
1305 | if (ret_from_reset) { | 1304 | if (ret_from_reset) { |
1306 | if (MLX4_DELAY_RESET_SLAVE == ret_from_reset) { | 1305 | if (MLX4_DELAY_RESET_SLAVE == ret_from_reset) { |
1307 | msleep(SLEEP_TIME_IN_RESET); | 1306 | mlx4_warn(dev, "slave is currently in the " |
1308 | while (ret_from_reset && num_of_reset_retries) { | 1307 | "middle of FLR. Deferring probe.\n"); |
1309 | mlx4_warn(dev, "slave is currently in the" | 1308 | mutex_unlock(&priv->cmd.slave_cmd_mutex); |
1310 | "middle of FLR. retrying..." | 1309 | return -EPROBE_DEFER; |
1311 | "(try num:%d)\n", | ||
1312 | (NUM_OF_RESET_RETRIES - | ||
1313 | num_of_reset_retries + 1)); | ||
1314 | ret_from_reset = | ||
1315 | mlx4_comm_cmd(dev, MLX4_COMM_CMD_RESET, | ||
1316 | 0, MLX4_COMM_TIME); | ||
1317 | num_of_reset_retries = num_of_reset_retries - 1; | ||
1318 | } | ||
1319 | } else | 1310 | } else |
1320 | goto err; | 1311 | goto err; |
1321 | } | 1312 | } |
@@ -1526,7 +1517,8 @@ static int mlx4_init_hca(struct mlx4_dev *dev) | |||
1526 | } else { | 1517 | } else { |
1527 | err = mlx4_init_slave(dev); | 1518 | err = mlx4_init_slave(dev); |
1528 | if (err) { | 1519 | if (err) { |
1529 | mlx4_err(dev, "Failed to initialize slave\n"); | 1520 | if (err != -EPROBE_DEFER) |
1521 | mlx4_err(dev, "Failed to initialize slave\n"); | ||
1530 | return err; | 1522 | return err; |
1531 | } | 1523 | } |
1532 | 1524 | ||
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index 019c5f78732e..c1b693cb3df3 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | |||
@@ -907,8 +907,11 @@ struct qlcnic_ipaddr { | |||
907 | #define QLCNIC_FW_HANG 0x4000 | 907 | #define QLCNIC_FW_HANG 0x4000 |
908 | #define QLCNIC_FW_LRO_MSS_CAP 0x8000 | 908 | #define QLCNIC_FW_LRO_MSS_CAP 0x8000 |
909 | #define QLCNIC_TX_INTR_SHARED 0x10000 | 909 | #define QLCNIC_TX_INTR_SHARED 0x10000 |
910 | #define QLCNIC_APP_CHANGED_FLAGS 0x20000 | ||
910 | #define QLCNIC_IS_MSI_FAMILY(adapter) \ | 911 | #define QLCNIC_IS_MSI_FAMILY(adapter) \ |
911 | ((adapter)->flags & (QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED)) | 912 | ((adapter)->flags & (QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED)) |
913 | #define QLCNIC_IS_TSO_CAPABLE(adapter) \ | ||
914 | ((adapter)->ahw->capabilities & QLCNIC_FW_CAPABILITY_TSO) | ||
912 | 915 | ||
913 | #define QLCNIC_DEF_NUM_STS_DESC_RINGS 4 | 916 | #define QLCNIC_DEF_NUM_STS_DESC_RINGS 4 |
914 | #define QLCNIC_MSIX_TBL_SPACE 8192 | 917 | #define QLCNIC_MSIX_TBL_SPACE 8192 |
@@ -1034,6 +1037,7 @@ struct qlcnic_adapter { | |||
1034 | spinlock_t rx_mac_learn_lock; | 1037 | spinlock_t rx_mac_learn_lock; |
1035 | u32 file_prd_off; /*File fw product offset*/ | 1038 | u32 file_prd_off; /*File fw product offset*/ |
1036 | u32 fw_version; | 1039 | u32 fw_version; |
1040 | u32 offload_flags; | ||
1037 | const struct firmware *fw; | 1041 | const struct firmware *fw; |
1038 | }; | 1042 | }; |
1039 | 1043 | ||
@@ -1542,6 +1546,8 @@ void qlcnic_add_lb_filter(struct qlcnic_adapter *, struct sk_buff *, int, u16); | |||
1542 | int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter); | 1546 | int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter); |
1543 | int qlcnic_read_mac_addr(struct qlcnic_adapter *); | 1547 | int qlcnic_read_mac_addr(struct qlcnic_adapter *); |
1544 | int qlcnic_setup_netdev(struct qlcnic_adapter *, struct net_device *, int); | 1548 | int qlcnic_setup_netdev(struct qlcnic_adapter *, struct net_device *, int); |
1549 | void qlcnic_set_netdev_features(struct qlcnic_adapter *, | ||
1550 | struct qlcnic_esw_func_cfg *); | ||
1545 | void qlcnic_sriov_vf_schedule_multi(struct net_device *); | 1551 | void qlcnic_sriov_vf_schedule_multi(struct net_device *); |
1546 | void qlcnic_vf_add_mc_list(struct net_device *, u16); | 1552 | void qlcnic_vf_add_mc_list(struct net_device *, u16); |
1547 | 1553 | ||
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c index c67d1eb35e8f..5e7fb1dfb97b 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | |||
@@ -382,8 +382,6 @@ static int qlcnic_83xx_idc_tx_soft_reset(struct qlcnic_adapter *adapter) | |||
382 | clear_bit(__QLCNIC_RESETTING, &adapter->state); | 382 | clear_bit(__QLCNIC_RESETTING, &adapter->state); |
383 | dev_err(&adapter->pdev->dev, "%s:\n", __func__); | 383 | dev_err(&adapter->pdev->dev, "%s:\n", __func__); |
384 | 384 | ||
385 | adapter->netdev->trans_start = jiffies; | ||
386 | |||
387 | return 0; | 385 | return 0; |
388 | } | 386 | } |
389 | 387 | ||
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c index 6a6512ba9f38..106a12f2a02f 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c | |||
@@ -973,16 +973,57 @@ int qlcnic_change_mtu(struct net_device *netdev, int mtu) | |||
973 | return rc; | 973 | return rc; |
974 | } | 974 | } |
975 | 975 | ||
976 | static netdev_features_t qlcnic_process_flags(struct qlcnic_adapter *adapter, | ||
977 | netdev_features_t features) | ||
978 | { | ||
979 | u32 offload_flags = adapter->offload_flags; | ||
980 | |||
981 | if (offload_flags & BIT_0) { | ||
982 | features |= NETIF_F_RXCSUM | NETIF_F_IP_CSUM | | ||
983 | NETIF_F_IPV6_CSUM; | ||
984 | adapter->rx_csum = 1; | ||
985 | if (QLCNIC_IS_TSO_CAPABLE(adapter)) { | ||
986 | if (!(offload_flags & BIT_1)) | ||
987 | features &= ~NETIF_F_TSO; | ||
988 | else | ||
989 | features |= NETIF_F_TSO; | ||
990 | |||
991 | if (!(offload_flags & BIT_2)) | ||
992 | features &= ~NETIF_F_TSO6; | ||
993 | else | ||
994 | features |= NETIF_F_TSO6; | ||
995 | } | ||
996 | } else { | ||
997 | features &= ~(NETIF_F_RXCSUM | | ||
998 | NETIF_F_IP_CSUM | | ||
999 | NETIF_F_IPV6_CSUM); | ||
1000 | |||
1001 | if (QLCNIC_IS_TSO_CAPABLE(adapter)) | ||
1002 | features &= ~(NETIF_F_TSO | NETIF_F_TSO6); | ||
1003 | adapter->rx_csum = 0; | ||
1004 | } | ||
1005 | |||
1006 | return features; | ||
1007 | } | ||
976 | 1008 | ||
977 | netdev_features_t qlcnic_fix_features(struct net_device *netdev, | 1009 | netdev_features_t qlcnic_fix_features(struct net_device *netdev, |
978 | netdev_features_t features) | 1010 | netdev_features_t features) |
979 | { | 1011 | { |
980 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 1012 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
1013 | netdev_features_t changed; | ||
981 | 1014 | ||
982 | if ((adapter->flags & QLCNIC_ESWITCH_ENABLED) && | 1015 | if (qlcnic_82xx_check(adapter) && |
983 | qlcnic_82xx_check(adapter)) { | 1016 | (adapter->flags & QLCNIC_ESWITCH_ENABLED)) { |
984 | netdev_features_t changed = features ^ netdev->features; | 1017 | if (adapter->flags & QLCNIC_APP_CHANGED_FLAGS) { |
985 | features ^= changed & (NETIF_F_ALL_CSUM | NETIF_F_RXCSUM); | 1018 | features = qlcnic_process_flags(adapter, features); |
1019 | } else { | ||
1020 | changed = features ^ netdev->features; | ||
1021 | features ^= changed & (NETIF_F_RXCSUM | | ||
1022 | NETIF_F_IP_CSUM | | ||
1023 | NETIF_F_IPV6_CSUM | | ||
1024 | NETIF_F_TSO | | ||
1025 | NETIF_F_TSO6); | ||
1026 | } | ||
986 | } | 1027 | } |
987 | 1028 | ||
988 | if (!(features & NETIF_F_RXCSUM)) | 1029 | if (!(features & NETIF_F_RXCSUM)) |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 8fb836d4129f..aeb26a850679 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -84,14 +84,9 @@ static int qlcnic_start_firmware(struct qlcnic_adapter *); | |||
84 | static void qlcnic_free_lb_filters_mem(struct qlcnic_adapter *adapter); | 84 | static void qlcnic_free_lb_filters_mem(struct qlcnic_adapter *adapter); |
85 | static void qlcnic_dev_set_npar_ready(struct qlcnic_adapter *); | 85 | static void qlcnic_dev_set_npar_ready(struct qlcnic_adapter *); |
86 | static int qlcnicvf_start_firmware(struct qlcnic_adapter *); | 86 | static int qlcnicvf_start_firmware(struct qlcnic_adapter *); |
87 | static void qlcnic_set_netdev_features(struct qlcnic_adapter *, | ||
88 | struct qlcnic_esw_func_cfg *); | ||
89 | static int qlcnic_vlan_rx_add(struct net_device *, __be16, u16); | 87 | static int qlcnic_vlan_rx_add(struct net_device *, __be16, u16); |
90 | static int qlcnic_vlan_rx_del(struct net_device *, __be16, u16); | 88 | static int qlcnic_vlan_rx_del(struct net_device *, __be16, u16); |
91 | 89 | ||
92 | #define QLCNIC_IS_TSO_CAPABLE(adapter) \ | ||
93 | ((adapter)->ahw->capabilities & QLCNIC_FW_CAPABILITY_TSO) | ||
94 | |||
95 | static u32 qlcnic_vlan_tx_check(struct qlcnic_adapter *adapter) | 90 | static u32 qlcnic_vlan_tx_check(struct qlcnic_adapter *adapter) |
96 | { | 91 | { |
97 | struct qlcnic_hardware_context *ahw = adapter->ahw; | 92 | struct qlcnic_hardware_context *ahw = adapter->ahw; |
@@ -1074,8 +1069,6 @@ void qlcnic_set_eswitch_port_features(struct qlcnic_adapter *adapter, | |||
1074 | 1069 | ||
1075 | if (!esw_cfg->promisc_mode) | 1070 | if (!esw_cfg->promisc_mode) |
1076 | adapter->flags |= QLCNIC_PROMISC_DISABLED; | 1071 | adapter->flags |= QLCNIC_PROMISC_DISABLED; |
1077 | |||
1078 | qlcnic_set_netdev_features(adapter, esw_cfg); | ||
1079 | } | 1072 | } |
1080 | 1073 | ||
1081 | int qlcnic_set_eswitch_port_config(struct qlcnic_adapter *adapter) | 1074 | int qlcnic_set_eswitch_port_config(struct qlcnic_adapter *adapter) |
@@ -1090,51 +1083,23 @@ int qlcnic_set_eswitch_port_config(struct qlcnic_adapter *adapter) | |||
1090 | return -EIO; | 1083 | return -EIO; |
1091 | qlcnic_set_vlan_config(adapter, &esw_cfg); | 1084 | qlcnic_set_vlan_config(adapter, &esw_cfg); |
1092 | qlcnic_set_eswitch_port_features(adapter, &esw_cfg); | 1085 | qlcnic_set_eswitch_port_features(adapter, &esw_cfg); |
1086 | qlcnic_set_netdev_features(adapter, &esw_cfg); | ||
1093 | 1087 | ||
1094 | return 0; | 1088 | return 0; |
1095 | } | 1089 | } |
1096 | 1090 | ||
1097 | static void | 1091 | void qlcnic_set_netdev_features(struct qlcnic_adapter *adapter, |
1098 | qlcnic_set_netdev_features(struct qlcnic_adapter *adapter, | 1092 | struct qlcnic_esw_func_cfg *esw_cfg) |
1099 | struct qlcnic_esw_func_cfg *esw_cfg) | ||
1100 | { | 1093 | { |
1101 | struct net_device *netdev = adapter->netdev; | 1094 | struct net_device *netdev = adapter->netdev; |
1102 | unsigned long features, vlan_features; | ||
1103 | 1095 | ||
1104 | if (qlcnic_83xx_check(adapter)) | 1096 | if (qlcnic_83xx_check(adapter)) |
1105 | return; | 1097 | return; |
1106 | 1098 | ||
1107 | features = (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | | 1099 | adapter->offload_flags = esw_cfg->offload_flags; |
1108 | NETIF_F_IPV6_CSUM | NETIF_F_GRO); | 1100 | adapter->flags |= QLCNIC_APP_CHANGED_FLAGS; |
1109 | vlan_features = (NETIF_F_SG | NETIF_F_IP_CSUM | | 1101 | netdev_update_features(netdev); |
1110 | NETIF_F_IPV6_CSUM); | 1102 | adapter->flags &= ~QLCNIC_APP_CHANGED_FLAGS; |
1111 | |||
1112 | if (QLCNIC_IS_TSO_CAPABLE(adapter)) { | ||
1113 | features |= (NETIF_F_TSO | NETIF_F_TSO6); | ||
1114 | vlan_features |= (NETIF_F_TSO | NETIF_F_TSO6); | ||
1115 | } | ||
1116 | |||
1117 | if (netdev->features & NETIF_F_LRO) | ||
1118 | features |= NETIF_F_LRO; | ||
1119 | |||
1120 | if (esw_cfg->offload_flags & BIT_0) { | ||
1121 | netdev->features |= features; | ||
1122 | adapter->rx_csum = 1; | ||
1123 | if (!(esw_cfg->offload_flags & BIT_1)) { | ||
1124 | netdev->features &= ~NETIF_F_TSO; | ||
1125 | features &= ~NETIF_F_TSO; | ||
1126 | } | ||
1127 | if (!(esw_cfg->offload_flags & BIT_2)) { | ||
1128 | netdev->features &= ~NETIF_F_TSO6; | ||
1129 | features &= ~NETIF_F_TSO6; | ||
1130 | } | ||
1131 | } else { | ||
1132 | netdev->features &= ~features; | ||
1133 | features &= ~features; | ||
1134 | adapter->rx_csum = 0; | ||
1135 | } | ||
1136 | |||
1137 | netdev->vlan_features = (features & vlan_features); | ||
1138 | } | 1103 | } |
1139 | 1104 | ||
1140 | static int | 1105 | static int |
@@ -2016,8 +1981,10 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2016 | pci_enable_pcie_error_reporting(pdev); | 1981 | pci_enable_pcie_error_reporting(pdev); |
2017 | 1982 | ||
2018 | ahw = kzalloc(sizeof(struct qlcnic_hardware_context), GFP_KERNEL); | 1983 | ahw = kzalloc(sizeof(struct qlcnic_hardware_context), GFP_KERNEL); |
2019 | if (!ahw) | 1984 | if (!ahw) { |
1985 | err = -ENOMEM; | ||
2020 | goto err_out_free_res; | 1986 | goto err_out_free_res; |
1987 | } | ||
2021 | 1988 | ||
2022 | switch (ent->device) { | 1989 | switch (ent->device) { |
2023 | case PCI_DEVICE_ID_QLOGIC_QLE824X: | 1990 | case PCI_DEVICE_ID_QLOGIC_QLE824X: |
@@ -2053,6 +2020,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2053 | 2020 | ||
2054 | adapter->qlcnic_wq = create_singlethread_workqueue("qlcnic"); | 2021 | adapter->qlcnic_wq = create_singlethread_workqueue("qlcnic"); |
2055 | if (adapter->qlcnic_wq == NULL) { | 2022 | if (adapter->qlcnic_wq == NULL) { |
2023 | err = -ENOMEM; | ||
2056 | dev_err(&pdev->dev, "Failed to create workqueue\n"); | 2024 | dev_err(&pdev->dev, "Failed to create workqueue\n"); |
2057 | goto err_out_free_netdev; | 2025 | goto err_out_free_netdev; |
2058 | } | 2026 | } |
@@ -2133,6 +2101,10 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2133 | goto err_out_disable_msi; | 2101 | goto err_out_disable_msi; |
2134 | } | 2102 | } |
2135 | 2103 | ||
2104 | err = qlcnic_get_act_pci_func(adapter); | ||
2105 | if (err) | ||
2106 | goto err_out_disable_mbx_intr; | ||
2107 | |||
2136 | err = qlcnic_setup_netdev(adapter, netdev, pci_using_dac); | 2108 | err = qlcnic_setup_netdev(adapter, netdev, pci_using_dac); |
2137 | if (err) | 2109 | if (err) |
2138 | goto err_out_disable_mbx_intr; | 2110 | goto err_out_disable_mbx_intr; |
@@ -2162,9 +2134,6 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2162 | break; | 2134 | break; |
2163 | } | 2135 | } |
2164 | 2136 | ||
2165 | if (qlcnic_get_act_pci_func(adapter)) | ||
2166 | goto err_out_disable_mbx_intr; | ||
2167 | |||
2168 | if (adapter->drv_mac_learn) | 2137 | if (adapter->drv_mac_learn) |
2169 | qlcnic_alloc_lb_filters_mem(adapter); | 2138 | qlcnic_alloc_lb_filters_mem(adapter); |
2170 | 2139 | ||
@@ -3149,10 +3118,8 @@ qlcnic_check_health(struct qlcnic_adapter *adapter) | |||
3149 | if (adapter->need_fw_reset) | 3118 | if (adapter->need_fw_reset) |
3150 | goto detach; | 3119 | goto detach; |
3151 | 3120 | ||
3152 | if (adapter->ahw->reset_context && qlcnic_auto_fw_reset) { | 3121 | if (adapter->ahw->reset_context && qlcnic_auto_fw_reset) |
3153 | qlcnic_reset_hw_context(adapter); | 3122 | qlcnic_reset_hw_context(adapter); |
3154 | adapter->netdev->trans_start = jiffies; | ||
3155 | } | ||
3156 | 3123 | ||
3157 | return 0; | 3124 | return 0; |
3158 | } | 3125 | } |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c index 3869c3864deb..196b2d100407 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c | |||
@@ -1734,7 +1734,6 @@ static int qlcnic_sriov_vf_handle_context_reset(struct qlcnic_adapter *adapter) | |||
1734 | 1734 | ||
1735 | if (!qlcnic_sriov_vf_reinit_driver(adapter)) { | 1735 | if (!qlcnic_sriov_vf_reinit_driver(adapter)) { |
1736 | qlcnic_sriov_vf_attach(adapter); | 1736 | qlcnic_sriov_vf_attach(adapter); |
1737 | adapter->netdev->trans_start = jiffies; | ||
1738 | adapter->tx_timeo_cnt = 0; | 1737 | adapter->tx_timeo_cnt = 0; |
1739 | adapter->reset_ctx_cnt = 0; | 1738 | adapter->reset_ctx_cnt = 0; |
1740 | adapter->fw_fail_cnt = 0; | 1739 | adapter->fw_fail_cnt = 0; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c index 4e22e794a186..e7a2fe21b649 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c | |||
@@ -544,6 +544,9 @@ static ssize_t qlcnic_sysfs_write_esw_config(struct file *file, | |||
544 | switch (esw_cfg[i].op_mode) { | 544 | switch (esw_cfg[i].op_mode) { |
545 | case QLCNIC_PORT_DEFAULTS: | 545 | case QLCNIC_PORT_DEFAULTS: |
546 | qlcnic_set_eswitch_port_features(adapter, &esw_cfg[i]); | 546 | qlcnic_set_eswitch_port_features(adapter, &esw_cfg[i]); |
547 | rtnl_lock(); | ||
548 | qlcnic_set_netdev_features(adapter, &esw_cfg[i]); | ||
549 | rtnl_unlock(); | ||
547 | break; | 550 | break; |
548 | case QLCNIC_ADD_VLAN: | 551 | case QLCNIC_ADD_VLAN: |
549 | qlcnic_set_vlan_config(adapter, &esw_cfg[i]); | 552 | qlcnic_set_vlan_config(adapter, &esw_cfg[i]); |
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c index 50235d201592..f87cc216045b 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c +++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c | |||
@@ -4717,6 +4717,7 @@ static int qlge_probe(struct pci_dev *pdev, | |||
4717 | dev_err(&pdev->dev, "net device registration failed.\n"); | 4717 | dev_err(&pdev->dev, "net device registration failed.\n"); |
4718 | ql_release_all(pdev); | 4718 | ql_release_all(pdev); |
4719 | pci_disable_device(pdev); | 4719 | pci_disable_device(pdev); |
4720 | free_netdev(ndev); | ||
4720 | return err; | 4721 | return err; |
4721 | } | 4722 | } |
4722 | /* Start up the timer to trigger EEH if | 4723 | /* Start up the timer to trigger EEH if |
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index 7d1fb9ad1296..03523459c406 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c | |||
@@ -1136,6 +1136,7 @@ static void cp_clean_rings (struct cp_private *cp) | |||
1136 | cp->dev->stats.tx_dropped++; | 1136 | cp->dev->stats.tx_dropped++; |
1137 | } | 1137 | } |
1138 | } | 1138 | } |
1139 | netdev_reset_queue(cp->dev); | ||
1139 | 1140 | ||
1140 | memset(cp->rx_ring, 0, sizeof(struct cp_desc) * CP_RX_RING_SIZE); | 1141 | memset(cp->rx_ring, 0, sizeof(struct cp_desc) * CP_RX_RING_SIZE); |
1141 | memset(cp->tx_ring, 0, sizeof(struct cp_desc) * CP_TX_RING_SIZE); | 1142 | memset(cp->tx_ring, 0, sizeof(struct cp_desc) * CP_TX_RING_SIZE); |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 79c520b64fdd..393f961a013c 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -5856,7 +5856,20 @@ err_out: | |||
5856 | return -EIO; | 5856 | return -EIO; |
5857 | } | 5857 | } |
5858 | 5858 | ||
5859 | static inline void rtl8169_tso_csum(struct rtl8169_private *tp, | 5859 | static bool rtl_skb_pad(struct sk_buff *skb) |
5860 | { | ||
5861 | if (skb_padto(skb, ETH_ZLEN)) | ||
5862 | return false; | ||
5863 | skb_put(skb, ETH_ZLEN - skb->len); | ||
5864 | return true; | ||
5865 | } | ||
5866 | |||
5867 | static bool rtl_test_hw_pad_bug(struct rtl8169_private *tp, struct sk_buff *skb) | ||
5868 | { | ||
5869 | return skb->len < ETH_ZLEN && tp->mac_version == RTL_GIGA_MAC_VER_34; | ||
5870 | } | ||
5871 | |||
5872 | static inline bool rtl8169_tso_csum(struct rtl8169_private *tp, | ||
5860 | struct sk_buff *skb, u32 *opts) | 5873 | struct sk_buff *skb, u32 *opts) |
5861 | { | 5874 | { |
5862 | const struct rtl_tx_desc_info *info = tx_desc_info + tp->txd_version; | 5875 | const struct rtl_tx_desc_info *info = tx_desc_info + tp->txd_version; |
@@ -5869,13 +5882,20 @@ static inline void rtl8169_tso_csum(struct rtl8169_private *tp, | |||
5869 | } else if (skb->ip_summed == CHECKSUM_PARTIAL) { | 5882 | } else if (skb->ip_summed == CHECKSUM_PARTIAL) { |
5870 | const struct iphdr *ip = ip_hdr(skb); | 5883 | const struct iphdr *ip = ip_hdr(skb); |
5871 | 5884 | ||
5885 | if (unlikely(rtl_test_hw_pad_bug(tp, skb))) | ||
5886 | return skb_checksum_help(skb) == 0 && rtl_skb_pad(skb); | ||
5887 | |||
5872 | if (ip->protocol == IPPROTO_TCP) | 5888 | if (ip->protocol == IPPROTO_TCP) |
5873 | opts[offset] |= info->checksum.tcp; | 5889 | opts[offset] |= info->checksum.tcp; |
5874 | else if (ip->protocol == IPPROTO_UDP) | 5890 | else if (ip->protocol == IPPROTO_UDP) |
5875 | opts[offset] |= info->checksum.udp; | 5891 | opts[offset] |= info->checksum.udp; |
5876 | else | 5892 | else |
5877 | WARN_ON_ONCE(1); | 5893 | WARN_ON_ONCE(1); |
5894 | } else { | ||
5895 | if (unlikely(rtl_test_hw_pad_bug(tp, skb))) | ||
5896 | return rtl_skb_pad(skb); | ||
5878 | } | 5897 | } |
5898 | return true; | ||
5879 | } | 5899 | } |
5880 | 5900 | ||
5881 | static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | 5901 | static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, |
@@ -5896,17 +5916,15 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | |||
5896 | goto err_stop_0; | 5916 | goto err_stop_0; |
5897 | } | 5917 | } |
5898 | 5918 | ||
5899 | /* 8168evl does not automatically pad to minimum length. */ | ||
5900 | if (unlikely(tp->mac_version == RTL_GIGA_MAC_VER_34 && | ||
5901 | skb->len < ETH_ZLEN)) { | ||
5902 | if (skb_padto(skb, ETH_ZLEN)) | ||
5903 | goto err_update_stats; | ||
5904 | skb_put(skb, ETH_ZLEN - skb->len); | ||
5905 | } | ||
5906 | |||
5907 | if (unlikely(le32_to_cpu(txd->opts1) & DescOwn)) | 5919 | if (unlikely(le32_to_cpu(txd->opts1) & DescOwn)) |
5908 | goto err_stop_0; | 5920 | goto err_stop_0; |
5909 | 5921 | ||
5922 | opts[1] = cpu_to_le32(rtl8169_tx_vlan_tag(skb)); | ||
5923 | opts[0] = DescOwn; | ||
5924 | |||
5925 | if (!rtl8169_tso_csum(tp, skb, opts)) | ||
5926 | goto err_update_stats; | ||
5927 | |||
5910 | len = skb_headlen(skb); | 5928 | len = skb_headlen(skb); |
5911 | mapping = dma_map_single(d, skb->data, len, DMA_TO_DEVICE); | 5929 | mapping = dma_map_single(d, skb->data, len, DMA_TO_DEVICE); |
5912 | if (unlikely(dma_mapping_error(d, mapping))) { | 5930 | if (unlikely(dma_mapping_error(d, mapping))) { |
@@ -5918,11 +5936,6 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | |||
5918 | tp->tx_skb[entry].len = len; | 5936 | tp->tx_skb[entry].len = len; |
5919 | txd->addr = cpu_to_le64(mapping); | 5937 | txd->addr = cpu_to_le64(mapping); |
5920 | 5938 | ||
5921 | opts[1] = cpu_to_le32(rtl8169_tx_vlan_tag(skb)); | ||
5922 | opts[0] = DescOwn; | ||
5923 | |||
5924 | rtl8169_tso_csum(tp, skb, opts); | ||
5925 | |||
5926 | frags = rtl8169_xmit_frags(tp, skb, opts); | 5939 | frags = rtl8169_xmit_frags(tp, skb, opts); |
5927 | if (frags < 0) | 5940 | if (frags < 0) |
5928 | goto err_dma_1; | 5941 | goto err_dma_1; |
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 42e9dd05c936..5e3982fc5398 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -897,8 +897,8 @@ static int sh_eth_check_reset(struct net_device *ndev) | |||
897 | mdelay(1); | 897 | mdelay(1); |
898 | cnt--; | 898 | cnt--; |
899 | } | 899 | } |
900 | if (cnt < 0) { | 900 | if (cnt <= 0) { |
901 | pr_err("Device reset fail\n"); | 901 | pr_err("Device reset failed\n"); |
902 | ret = -ETIMEDOUT; | 902 | ret = -ETIMEDOUT; |
903 | } | 903 | } |
904 | return ret; | 904 | return ret; |
@@ -1401,16 +1401,23 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status) | |||
1401 | desc_status = edmac_to_cpu(mdp, rxdesc->status); | 1401 | desc_status = edmac_to_cpu(mdp, rxdesc->status); |
1402 | pkt_len = rxdesc->frame_length; | 1402 | pkt_len = rxdesc->frame_length; |
1403 | 1403 | ||
1404 | #if defined(CONFIG_ARCH_R8A7740) | ||
1405 | desc_status >>= 16; | ||
1406 | #endif | ||
1407 | |||
1408 | if (--boguscnt < 0) | 1404 | if (--boguscnt < 0) |
1409 | break; | 1405 | break; |
1410 | 1406 | ||
1411 | if (!(desc_status & RDFEND)) | 1407 | if (!(desc_status & RDFEND)) |
1412 | ndev->stats.rx_length_errors++; | 1408 | ndev->stats.rx_length_errors++; |
1413 | 1409 | ||
1410 | #if defined(CONFIG_ARCH_R8A7740) | ||
1411 | /* | ||
1412 | * In case of almost all GETHER/ETHERs, the Receive Frame State | ||
1413 | * (RFS) bits in the Receive Descriptor 0 are from bit 9 to | ||
1414 | * bit 0. However, in case of the R8A7740's GETHER, the RFS | ||
1415 | * bits are from bit 25 to bit 16. So, the driver needs right | ||
1416 | * shifting by 16. | ||
1417 | */ | ||
1418 | desc_status >>= 16; | ||
1419 | #endif | ||
1420 | |||
1414 | if (desc_status & (RD_RFS1 | RD_RFS2 | RD_RFS3 | RD_RFS4 | | 1421 | if (desc_status & (RD_RFS1 | RD_RFS2 | RD_RFS3 | RD_RFS4 | |
1415 | RD_RFS5 | RD_RFS6 | RD_RFS10)) { | 1422 | RD_RFS5 | RD_RFS6 | RD_RFS10)) { |
1416 | ndev->stats.rx_errors++; | 1423 | ndev->stats.rx_errors++; |
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index 01b99206139a..39e4cb39de29 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c | |||
@@ -638,14 +638,16 @@ static void efx_start_datapath(struct efx_nic *efx) | |||
638 | EFX_MAX_FRAME_LEN(efx->net_dev->mtu) + | 638 | EFX_MAX_FRAME_LEN(efx->net_dev->mtu) + |
639 | efx->type->rx_buffer_padding); | 639 | efx->type->rx_buffer_padding); |
640 | rx_buf_len = (sizeof(struct efx_rx_page_state) + | 640 | rx_buf_len = (sizeof(struct efx_rx_page_state) + |
641 | EFX_PAGE_IP_ALIGN + efx->rx_dma_len); | 641 | NET_IP_ALIGN + efx->rx_dma_len); |
642 | if (rx_buf_len <= PAGE_SIZE) { | 642 | if (rx_buf_len <= PAGE_SIZE) { |
643 | efx->rx_scatter = false; | 643 | efx->rx_scatter = false; |
644 | efx->rx_buffer_order = 0; | 644 | efx->rx_buffer_order = 0; |
645 | } else if (efx->type->can_rx_scatter) { | 645 | } else if (efx->type->can_rx_scatter) { |
646 | BUILD_BUG_ON(EFX_RX_USR_BUF_SIZE % L1_CACHE_BYTES); | ||
646 | BUILD_BUG_ON(sizeof(struct efx_rx_page_state) + | 647 | BUILD_BUG_ON(sizeof(struct efx_rx_page_state) + |
647 | EFX_PAGE_IP_ALIGN + EFX_RX_USR_BUF_SIZE > | 648 | 2 * ALIGN(NET_IP_ALIGN + EFX_RX_USR_BUF_SIZE, |
648 | PAGE_SIZE / 2); | 649 | EFX_RX_BUF_ALIGNMENT) > |
650 | PAGE_SIZE); | ||
649 | efx->rx_scatter = true; | 651 | efx->rx_scatter = true; |
650 | efx->rx_dma_len = EFX_RX_USR_BUF_SIZE; | 652 | efx->rx_dma_len = EFX_RX_USR_BUF_SIZE; |
651 | efx->rx_buffer_order = 0; | 653 | efx->rx_buffer_order = 0; |
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h index 9bd433a095c5..39d6bd77f015 100644 --- a/drivers/net/ethernet/sfc/net_driver.h +++ b/drivers/net/ethernet/sfc/net_driver.h | |||
@@ -72,8 +72,20 @@ | |||
72 | /* Maximum possible MTU the driver supports */ | 72 | /* Maximum possible MTU the driver supports */ |
73 | #define EFX_MAX_MTU (9 * 1024) | 73 | #define EFX_MAX_MTU (9 * 1024) |
74 | 74 | ||
75 | /* Size of an RX scatter buffer. Small enough to pack 2 into a 4K page. */ | 75 | /* Size of an RX scatter buffer. Small enough to pack 2 into a 4K page, |
76 | #define EFX_RX_USR_BUF_SIZE 1824 | 76 | * and should be a multiple of the cache line size. |
77 | */ | ||
78 | #define EFX_RX_USR_BUF_SIZE (2048 - 256) | ||
79 | |||
80 | /* If possible, we should ensure cache line alignment at start and end | ||
81 | * of every buffer. Otherwise, we just need to ensure 4-byte | ||
82 | * alignment of the network header. | ||
83 | */ | ||
84 | #if NET_IP_ALIGN == 0 | ||
85 | #define EFX_RX_BUF_ALIGNMENT L1_CACHE_BYTES | ||
86 | #else | ||
87 | #define EFX_RX_BUF_ALIGNMENT 4 | ||
88 | #endif | ||
77 | 89 | ||
78 | /* Forward declare Precision Time Protocol (PTP) support structure. */ | 90 | /* Forward declare Precision Time Protocol (PTP) support structure. */ |
79 | struct efx_ptp_data; | 91 | struct efx_ptp_data; |
@@ -468,24 +480,11 @@ enum nic_state { | |||
468 | }; | 480 | }; |
469 | 481 | ||
470 | /* | 482 | /* |
471 | * Alignment of page-allocated RX buffers | ||
472 | * | ||
473 | * Controls the number of bytes inserted at the start of an RX buffer. | ||
474 | * This is the equivalent of NET_IP_ALIGN [which controls the alignment | ||
475 | * of the skb->head for hardware DMA]. | ||
476 | */ | ||
477 | #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS | ||
478 | #define EFX_PAGE_IP_ALIGN 0 | ||
479 | #else | ||
480 | #define EFX_PAGE_IP_ALIGN NET_IP_ALIGN | ||
481 | #endif | ||
482 | |||
483 | /* | ||
484 | * Alignment of the skb->head which wraps a page-allocated RX buffer | 483 | * Alignment of the skb->head which wraps a page-allocated RX buffer |
485 | * | 484 | * |
486 | * The skb allocated to wrap an rx_buffer can have this alignment. Since | 485 | * The skb allocated to wrap an rx_buffer can have this alignment. Since |
487 | * the data is memcpy'd from the rx_buf, it does not need to be equal to | 486 | * the data is memcpy'd from the rx_buf, it does not need to be equal to |
488 | * EFX_PAGE_IP_ALIGN. | 487 | * NET_IP_ALIGN. |
489 | */ | 488 | */ |
490 | #define EFX_PAGE_SKB_ALIGN 2 | 489 | #define EFX_PAGE_SKB_ALIGN 2 |
491 | 490 | ||
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c index e73e30bac10e..a7dfe36cabf4 100644 --- a/drivers/net/ethernet/sfc/rx.c +++ b/drivers/net/ethernet/sfc/rx.c | |||
@@ -93,8 +93,8 @@ static inline void efx_sync_rx_buffer(struct efx_nic *efx, | |||
93 | 93 | ||
94 | void efx_rx_config_page_split(struct efx_nic *efx) | 94 | void efx_rx_config_page_split(struct efx_nic *efx) |
95 | { | 95 | { |
96 | efx->rx_page_buf_step = ALIGN(efx->rx_dma_len + EFX_PAGE_IP_ALIGN, | 96 | efx->rx_page_buf_step = ALIGN(efx->rx_dma_len + NET_IP_ALIGN, |
97 | L1_CACHE_BYTES); | 97 | EFX_RX_BUF_ALIGNMENT); |
98 | efx->rx_bufs_per_page = efx->rx_buffer_order ? 1 : | 98 | efx->rx_bufs_per_page = efx->rx_buffer_order ? 1 : |
99 | ((PAGE_SIZE - sizeof(struct efx_rx_page_state)) / | 99 | ((PAGE_SIZE - sizeof(struct efx_rx_page_state)) / |
100 | efx->rx_page_buf_step); | 100 | efx->rx_page_buf_step); |
@@ -188,9 +188,9 @@ static int efx_init_rx_buffers(struct efx_rx_queue *rx_queue) | |||
188 | do { | 188 | do { |
189 | index = rx_queue->added_count & rx_queue->ptr_mask; | 189 | index = rx_queue->added_count & rx_queue->ptr_mask; |
190 | rx_buf = efx_rx_buffer(rx_queue, index); | 190 | rx_buf = efx_rx_buffer(rx_queue, index); |
191 | rx_buf->dma_addr = dma_addr + EFX_PAGE_IP_ALIGN; | 191 | rx_buf->dma_addr = dma_addr + NET_IP_ALIGN; |
192 | rx_buf->page = page; | 192 | rx_buf->page = page; |
193 | rx_buf->page_offset = page_offset + EFX_PAGE_IP_ALIGN; | 193 | rx_buf->page_offset = page_offset + NET_IP_ALIGN; |
194 | rx_buf->len = efx->rx_dma_len; | 194 | rx_buf->len = efx->rx_dma_len; |
195 | rx_buf->flags = 0; | 195 | rx_buf->flags = 0; |
196 | ++rx_queue->added_count; | 196 | ++rx_queue->added_count; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 618446ae1ec1..ee919ca8b8a0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -1899,7 +1899,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1899 | 1899 | ||
1900 | #ifdef STMMAC_XMIT_DEBUG | 1900 | #ifdef STMMAC_XMIT_DEBUG |
1901 | if (netif_msg_pktdata(priv)) { | 1901 | if (netif_msg_pktdata(priv)) { |
1902 | pr_info("%s: curr %d dirty=%d entry=%d, first=%p, nfrags=%d" | 1902 | pr_info("%s: curr %d dirty=%d entry=%d, first=%p, nfrags=%d", |
1903 | __func__, (priv->cur_tx % txsize), | 1903 | __func__, (priv->cur_tx % txsize), |
1904 | (priv->dirty_tx % txsize), entry, first, nfrags); | 1904 | (priv->dirty_tx % txsize), entry, first, nfrags); |
1905 | if (priv->extend_desc) | 1905 | if (priv->extend_desc) |
diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c index 12aec173564c..c47f0dbcebb5 100644 --- a/drivers/net/ethernet/ti/davinci_mdio.c +++ b/drivers/net/ethernet/ti/davinci_mdio.c | |||
@@ -449,10 +449,9 @@ static int davinci_mdio_suspend(struct device *dev) | |||
449 | __raw_writel(ctrl, &data->regs->control); | 449 | __raw_writel(ctrl, &data->regs->control); |
450 | wait_for_idle(data); | 450 | wait_for_idle(data); |
451 | 451 | ||
452 | pm_runtime_put_sync(data->dev); | ||
453 | |||
454 | data->suspended = true; | 452 | data->suspended = true; |
455 | spin_unlock(&data->lock); | 453 | spin_unlock(&data->lock); |
454 | pm_runtime_put_sync(data->dev); | ||
456 | 455 | ||
457 | return 0; | 456 | return 0; |
458 | } | 457 | } |
@@ -460,15 +459,12 @@ static int davinci_mdio_suspend(struct device *dev) | |||
460 | static int davinci_mdio_resume(struct device *dev) | 459 | static int davinci_mdio_resume(struct device *dev) |
461 | { | 460 | { |
462 | struct davinci_mdio_data *data = dev_get_drvdata(dev); | 461 | struct davinci_mdio_data *data = dev_get_drvdata(dev); |
463 | u32 ctrl; | ||
464 | 462 | ||
465 | spin_lock(&data->lock); | ||
466 | pm_runtime_get_sync(data->dev); | 463 | pm_runtime_get_sync(data->dev); |
467 | 464 | ||
465 | spin_lock(&data->lock); | ||
468 | /* restart the scan state machine */ | 466 | /* restart the scan state machine */ |
469 | ctrl = __raw_readl(&data->regs->control); | 467 | __davinci_mdio_reset(data); |
470 | ctrl |= CONTROL_ENABLE; | ||
471 | __raw_writel(ctrl, &data->regs->control); | ||
472 | 468 | ||
473 | data->suspended = false; | 469 | data->suspended = false; |
474 | spin_unlock(&data->lock); | 470 | spin_unlock(&data->lock); |
@@ -477,8 +473,8 @@ static int davinci_mdio_resume(struct device *dev) | |||
477 | } | 473 | } |
478 | 474 | ||
479 | static const struct dev_pm_ops davinci_mdio_pm_ops = { | 475 | static const struct dev_pm_ops davinci_mdio_pm_ops = { |
480 | .suspend = davinci_mdio_suspend, | 476 | .suspend_late = davinci_mdio_suspend, |
481 | .resume = davinci_mdio_resume, | 477 | .resume_early = davinci_mdio_resume, |
482 | }; | 478 | }; |
483 | 479 | ||
484 | static const struct of_device_id davinci_mdio_of_mtable[] = { | 480 | static const struct of_device_id davinci_mdio_of_mtable[] = { |
diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c index 919b983114e9..b7268b3dae77 100644 --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c | |||
@@ -946,7 +946,8 @@ static int xemaclite_open(struct net_device *dev) | |||
946 | phy_write(lp->phy_dev, MII_CTRL1000, 0); | 946 | phy_write(lp->phy_dev, MII_CTRL1000, 0); |
947 | 947 | ||
948 | /* Advertise only 10 and 100mbps full/half duplex speeds */ | 948 | /* Advertise only 10 and 100mbps full/half duplex speeds */ |
949 | phy_write(lp->phy_dev, MII_ADVERTISE, ADVERTISE_ALL); | 949 | phy_write(lp->phy_dev, MII_ADVERTISE, ADVERTISE_ALL | |
950 | ADVERTISE_CSMA); | ||
950 | 951 | ||
951 | /* Restart auto negotiation */ | 952 | /* Restart auto negotiation */ |
952 | bmcr = phy_read(lp->phy_dev, MII_BMCR); | 953 | bmcr = phy_read(lp->phy_dev, MII_BMCR); |
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 088c55496191..ab2307b5d9a7 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/inetdevice.h> | 31 | #include <linux/inetdevice.h> |
32 | #include <linux/etherdevice.h> | 32 | #include <linux/etherdevice.h> |
33 | #include <linux/skbuff.h> | 33 | #include <linux/skbuff.h> |
34 | #include <linux/if_vlan.h> | ||
34 | #include <linux/in.h> | 35 | #include <linux/in.h> |
35 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
36 | #include <net/arp.h> | 37 | #include <net/arp.h> |
@@ -284,7 +285,7 @@ int netvsc_recv_callback(struct hv_device *device_obj, | |||
284 | 285 | ||
285 | skb->protocol = eth_type_trans(skb, net); | 286 | skb->protocol = eth_type_trans(skb, net); |
286 | skb->ip_summed = CHECKSUM_NONE; | 287 | skb->ip_summed = CHECKSUM_NONE; |
287 | skb->vlan_tci = packet->vlan_tci; | 288 | __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), packet->vlan_tci); |
288 | 289 | ||
289 | net->stats.rx_packets++; | 290 | net->stats.rx_packets++; |
290 | net->stats.rx_bytes += packet->total_data_buflen; | 291 | net->stats.rx_bytes += packet->total_data_buflen; |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 1c502bb0c916..6e91931a1c2c 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -853,18 +853,24 @@ static int macvlan_changelink(struct net_device *dev, | |||
853 | struct nlattr *tb[], struct nlattr *data[]) | 853 | struct nlattr *tb[], struct nlattr *data[]) |
854 | { | 854 | { |
855 | struct macvlan_dev *vlan = netdev_priv(dev); | 855 | struct macvlan_dev *vlan = netdev_priv(dev); |
856 | if (data && data[IFLA_MACVLAN_MODE]) | 856 | |
857 | vlan->mode = nla_get_u32(data[IFLA_MACVLAN_MODE]); | ||
858 | if (data && data[IFLA_MACVLAN_FLAGS]) { | 857 | if (data && data[IFLA_MACVLAN_FLAGS]) { |
859 | __u16 flags = nla_get_u16(data[IFLA_MACVLAN_FLAGS]); | 858 | __u16 flags = nla_get_u16(data[IFLA_MACVLAN_FLAGS]); |
860 | bool promisc = (flags ^ vlan->flags) & MACVLAN_FLAG_NOPROMISC; | 859 | bool promisc = (flags ^ vlan->flags) & MACVLAN_FLAG_NOPROMISC; |
861 | 860 | if (vlan->port->passthru && promisc) { | |
862 | if (promisc && (flags & MACVLAN_FLAG_NOPROMISC)) | 861 | int err; |
863 | dev_set_promiscuity(vlan->lowerdev, -1); | 862 | |
864 | else if (promisc && !(flags & MACVLAN_FLAG_NOPROMISC)) | 863 | if (flags & MACVLAN_FLAG_NOPROMISC) |
865 | dev_set_promiscuity(vlan->lowerdev, 1); | 864 | err = dev_set_promiscuity(vlan->lowerdev, -1); |
865 | else | ||
866 | err = dev_set_promiscuity(vlan->lowerdev, 1); | ||
867 | if (err < 0) | ||
868 | return err; | ||
869 | } | ||
866 | vlan->flags = flags; | 870 | vlan->flags = flags; |
867 | } | 871 | } |
872 | if (data && data[IFLA_MACVLAN_MODE]) | ||
873 | vlan->mode = nla_get_u32(data[IFLA_MACVLAN_MODE]); | ||
868 | return 0; | 874 | return 0; |
869 | } | 875 | } |
870 | 876 | ||
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index c14f14741b3f..38f0b312ff85 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -1044,7 +1044,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) | |||
1044 | adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv); | 1044 | adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv); |
1045 | lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp); | 1045 | lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp); |
1046 | idx = phy_find_setting(phydev->speed, phydev->duplex); | 1046 | idx = phy_find_setting(phydev->speed, phydev->duplex); |
1047 | if ((lp & adv & settings[idx].setting)) | 1047 | if (!(lp & adv & settings[idx].setting)) |
1048 | goto eee_exit; | 1048 | goto eee_exit; |
1049 | 1049 | ||
1050 | if (clk_stop_enable) { | 1050 | if (clk_stop_enable) { |
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 7c43261975bd..b3051052f3ad 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c | |||
@@ -1092,8 +1092,8 @@ static int team_port_add(struct team *team, struct net_device *port_dev) | |||
1092 | } | 1092 | } |
1093 | 1093 | ||
1094 | port->index = -1; | 1094 | port->index = -1; |
1095 | team_port_enable(team, port); | ||
1096 | list_add_tail_rcu(&port->list, &team->port_list); | 1095 | list_add_tail_rcu(&port->list, &team->port_list); |
1096 | team_port_enable(team, port); | ||
1097 | __team_compute_features(team); | 1097 | __team_compute_features(team); |
1098 | __team_port_change_port_added(port, !!netif_carrier_ok(port_dev)); | 1098 | __team_port_change_port_added(port, !!netif_carrier_ok(port_dev)); |
1099 | __team_options_change_check(team); | 1099 | __team_options_change_check(team); |
@@ -2374,7 +2374,8 @@ static int team_nl_send_port_list_get(struct team *team, u32 portid, u32 seq, | |||
2374 | bool incomplete; | 2374 | bool incomplete; |
2375 | int i; | 2375 | int i; |
2376 | 2376 | ||
2377 | port = list_first_entry(&team->port_list, struct team_port, list); | 2377 | port = list_first_entry_or_null(&team->port_list, |
2378 | struct team_port, list); | ||
2378 | 2379 | ||
2379 | start_again: | 2380 | start_again: |
2380 | err = __send_and_alloc_skb(&skb, team, portid, send_func); | 2381 | err = __send_and_alloc_skb(&skb, team, portid, send_func); |
@@ -2402,8 +2403,8 @@ start_again: | |||
2402 | err = team_nl_fill_one_port_get(skb, one_port); | 2403 | err = team_nl_fill_one_port_get(skb, one_port); |
2403 | if (err) | 2404 | if (err) |
2404 | goto errout; | 2405 | goto errout; |
2405 | } else { | 2406 | } else if (port) { |
2406 | list_for_each_entry(port, &team->port_list, list) { | 2407 | list_for_each_entry_from(port, &team->port_list, list) { |
2407 | err = team_nl_fill_one_port_get(skb, port); | 2408 | err = team_nl_fill_one_port_get(skb, port); |
2408 | if (err) { | 2409 | if (err) { |
2409 | if (err == -EMSGSIZE) { | 2410 | if (err == -EMSGSIZE) { |
diff --git a/drivers/net/team/team_mode_random.c b/drivers/net/team/team_mode_random.c index 5ca14d463ba7..7f032e211343 100644 --- a/drivers/net/team/team_mode_random.c +++ b/drivers/net/team/team_mode_random.c | |||
@@ -28,6 +28,8 @@ static bool rnd_transmit(struct team *team, struct sk_buff *skb) | |||
28 | 28 | ||
29 | port_index = random_N(team->en_port_count); | 29 | port_index = random_N(team->en_port_count); |
30 | port = team_get_port_by_index_rcu(team, port_index); | 30 | port = team_get_port_by_index_rcu(team, port_index); |
31 | if (unlikely(!port)) | ||
32 | goto drop; | ||
31 | port = team_get_first_port_txable_rcu(team, port); | 33 | port = team_get_first_port_txable_rcu(team, port); |
32 | if (unlikely(!port)) | 34 | if (unlikely(!port)) |
33 | goto drop; | 35 | goto drop; |
diff --git a/drivers/net/team/team_mode_roundrobin.c b/drivers/net/team/team_mode_roundrobin.c index d268e4de781b..472623f8ce3d 100644 --- a/drivers/net/team/team_mode_roundrobin.c +++ b/drivers/net/team/team_mode_roundrobin.c | |||
@@ -32,6 +32,8 @@ static bool rr_transmit(struct team *team, struct sk_buff *skb) | |||
32 | 32 | ||
33 | port_index = rr_priv(team)->sent_packets++ % team->en_port_count; | 33 | port_index = rr_priv(team)->sent_packets++ % team->en_port_count; |
34 | port = team_get_port_by_index_rcu(team, port_index); | 34 | port = team_get_port_by_index_rcu(team, port_index); |
35 | if (unlikely(!port)) | ||
36 | goto drop; | ||
35 | port = team_get_first_port_txable_rcu(team, port); | 37 | port = team_get_first_port_txable_rcu(team, port); |
36 | if (unlikely(!port)) | 38 | if (unlikely(!port)) |
37 | goto drop; | 39 | goto drop; |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index f042b0373e5d..bfa9bb48e42d 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -352,7 +352,7 @@ static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb) | |||
352 | u32 numqueues = 0; | 352 | u32 numqueues = 0; |
353 | 353 | ||
354 | rcu_read_lock(); | 354 | rcu_read_lock(); |
355 | numqueues = tun->numqueues; | 355 | numqueues = ACCESS_ONCE(tun->numqueues); |
356 | 356 | ||
357 | txq = skb_get_rxhash(skb); | 357 | txq = skb_get_rxhash(skb); |
358 | if (txq) { | 358 | if (txq) { |
@@ -1585,6 +1585,10 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
1585 | else | 1585 | else |
1586 | return -EINVAL; | 1586 | return -EINVAL; |
1587 | 1587 | ||
1588 | if (!!(ifr->ifr_flags & IFF_MULTI_QUEUE) != | ||
1589 | !!(tun->flags & TUN_TAP_MQ)) | ||
1590 | return -EINVAL; | ||
1591 | |||
1588 | if (tun_not_capable(tun)) | 1592 | if (tun_not_capable(tun)) |
1589 | return -EPERM; | 1593 | return -EPERM; |
1590 | err = security_tun_dev_open(tun->security); | 1594 | err = security_tun_dev_open(tun->security); |
@@ -2155,6 +2159,8 @@ static int tun_chr_open(struct inode *inode, struct file * file) | |||
2155 | set_bit(SOCK_EXTERNALLY_ALLOCATED, &tfile->socket.flags); | 2159 | set_bit(SOCK_EXTERNALLY_ALLOCATED, &tfile->socket.flags); |
2156 | INIT_LIST_HEAD(&tfile->next); | 2160 | INIT_LIST_HEAD(&tfile->next); |
2157 | 2161 | ||
2162 | sock_set_flag(&tfile->sk, SOCK_ZEROCOPY); | ||
2163 | |||
2158 | return 0; | 2164 | return 0; |
2159 | } | 2165 | } |
2160 | 2166 | ||
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 078795fe6e31..04ee044dde51 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
@@ -627,6 +627,12 @@ static const struct usb_device_id products [] = { | |||
627 | .driver_info = 0, | 627 | .driver_info = 0, |
628 | }, | 628 | }, |
629 | 629 | ||
630 | /* Huawei E1820 - handled by qmi_wwan */ | ||
631 | { | ||
632 | USB_DEVICE_INTERFACE_NUMBER(HUAWEI_VENDOR_ID, 0x14ac, 1), | ||
633 | .driver_info = 0, | ||
634 | }, | ||
635 | |||
630 | /* Realtek RTL8152 Based USB 2.0 Ethernet Adapters */ | 636 | /* Realtek RTL8152 Based USB 2.0 Ethernet Adapters */ |
631 | #if defined(CONFIG_USB_RTL8152) || defined(CONFIG_USB_RTL8152_MODULE) | 637 | #if defined(CONFIG_USB_RTL8152) || defined(CONFIG_USB_RTL8152_MODULE) |
632 | { | 638 | { |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index cf887c2384e9..d095d0d3056b 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -519,6 +519,7 @@ static const struct usb_device_id products[] = { | |||
519 | /* 3. Combined interface devices matching on interface number */ | 519 | /* 3. Combined interface devices matching on interface number */ |
520 | {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */ | 520 | {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */ |
521 | {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */ | 521 | {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */ |
522 | {QMI_FIXED_INTF(0x12d1, 0x14ac, 1)}, /* Huawei E1820 */ | ||
522 | {QMI_FIXED_INTF(0x19d2, 0x0002, 1)}, | 523 | {QMI_FIXED_INTF(0x19d2, 0x0002, 1)}, |
523 | {QMI_FIXED_INTF(0x19d2, 0x0012, 1)}, | 524 | {QMI_FIXED_INTF(0x19d2, 0x0012, 1)}, |
524 | {QMI_FIXED_INTF(0x19d2, 0x0017, 3)}, | 525 | {QMI_FIXED_INTF(0x19d2, 0x0017, 3)}, |
@@ -582,6 +583,7 @@ static const struct usb_device_id products[] = { | |||
582 | {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */ | 583 | {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */ |
583 | {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ | 584 | {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ |
584 | {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ | 585 | {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ |
586 | {QMI_FIXED_INTF(0x1e2d, 0x12d1, 4)}, /* Cinterion PLxx */ | ||
585 | 587 | ||
586 | /* 4. Gobi 1000 devices */ | 588 | /* 4. Gobi 1000 devices */ |
587 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ | 589 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ |
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c index a491d3a95393..6cbdac67f3a0 100644 --- a/drivers/net/usb/rtl8150.c +++ b/drivers/net/usb/rtl8150.c | |||
@@ -130,19 +130,23 @@ struct rtl8150 { | |||
130 | struct usb_device *udev; | 130 | struct usb_device *udev; |
131 | struct tasklet_struct tl; | 131 | struct tasklet_struct tl; |
132 | struct net_device *netdev; | 132 | struct net_device *netdev; |
133 | struct urb *rx_urb, *tx_urb, *intr_urb, *ctrl_urb; | 133 | struct urb *rx_urb, *tx_urb, *intr_urb; |
134 | struct sk_buff *tx_skb, *rx_skb; | 134 | struct sk_buff *tx_skb, *rx_skb; |
135 | struct sk_buff *rx_skb_pool[RX_SKB_POOL_SIZE]; | 135 | struct sk_buff *rx_skb_pool[RX_SKB_POOL_SIZE]; |
136 | spinlock_t rx_pool_lock; | 136 | spinlock_t rx_pool_lock; |
137 | struct usb_ctrlrequest dr; | 137 | struct usb_ctrlrequest dr; |
138 | int intr_interval; | 138 | int intr_interval; |
139 | __le16 rx_creg; | ||
140 | u8 *intr_buff; | 139 | u8 *intr_buff; |
141 | u8 phy; | 140 | u8 phy; |
142 | }; | 141 | }; |
143 | 142 | ||
144 | typedef struct rtl8150 rtl8150_t; | 143 | typedef struct rtl8150 rtl8150_t; |
145 | 144 | ||
145 | struct async_req { | ||
146 | struct usb_ctrlrequest dr; | ||
147 | u16 rx_creg; | ||
148 | }; | ||
149 | |||
146 | static const char driver_name [] = "rtl8150"; | 150 | static const char driver_name [] = "rtl8150"; |
147 | 151 | ||
148 | /* | 152 | /* |
@@ -164,51 +168,47 @@ static int set_registers(rtl8150_t * dev, u16 indx, u16 size, void *data) | |||
164 | indx, 0, data, size, 500); | 168 | indx, 0, data, size, 500); |
165 | } | 169 | } |
166 | 170 | ||
167 | static void ctrl_callback(struct urb *urb) | 171 | static void async_set_reg_cb(struct urb *urb) |
168 | { | 172 | { |
169 | rtl8150_t *dev; | 173 | struct async_req *req = (struct async_req *)urb->context; |
170 | int status = urb->status; | 174 | int status = urb->status; |
171 | 175 | ||
172 | switch (status) { | 176 | if (status < 0) |
173 | case 0: | 177 | dev_dbg(&urb->dev->dev, "%s failed with %d", __func__, status); |
174 | break; | 178 | kfree(req); |
175 | case -EINPROGRESS: | 179 | usb_free_urb(urb); |
176 | break; | ||
177 | case -ENOENT: | ||
178 | break; | ||
179 | default: | ||
180 | if (printk_ratelimit()) | ||
181 | dev_warn(&urb->dev->dev, "ctrl urb status %d\n", status); | ||
182 | } | ||
183 | dev = urb->context; | ||
184 | clear_bit(RX_REG_SET, &dev->flags); | ||
185 | } | 180 | } |
186 | 181 | ||
187 | static int async_set_registers(rtl8150_t * dev, u16 indx, u16 size) | 182 | static int async_set_registers(rtl8150_t *dev, u16 indx, u16 size, u16 reg) |
188 | { | 183 | { |
189 | int ret; | 184 | int res = -ENOMEM; |
190 | 185 | struct urb *async_urb; | |
191 | if (test_bit(RX_REG_SET, &dev->flags)) | 186 | struct async_req *req; |
192 | return -EAGAIN; | ||
193 | 187 | ||
194 | dev->dr.bRequestType = RTL8150_REQT_WRITE; | 188 | req = kmalloc(sizeof(struct async_req), GFP_ATOMIC); |
195 | dev->dr.bRequest = RTL8150_REQ_SET_REGS; | 189 | if (req == NULL) |
196 | dev->dr.wValue = cpu_to_le16(indx); | 190 | return res; |
197 | dev->dr.wIndex = 0; | 191 | async_urb = usb_alloc_urb(0, GFP_ATOMIC); |
198 | dev->dr.wLength = cpu_to_le16(size); | 192 | if (async_urb == NULL) { |
199 | dev->ctrl_urb->transfer_buffer_length = size; | 193 | kfree(req); |
200 | usb_fill_control_urb(dev->ctrl_urb, dev->udev, | 194 | return res; |
201 | usb_sndctrlpipe(dev->udev, 0), (char *) &dev->dr, | 195 | } |
202 | &dev->rx_creg, size, ctrl_callback, dev); | 196 | req->rx_creg = cpu_to_le16(reg); |
203 | if ((ret = usb_submit_urb(dev->ctrl_urb, GFP_ATOMIC))) { | 197 | req->dr.bRequestType = RTL8150_REQT_WRITE; |
204 | if (ret == -ENODEV) | 198 | req->dr.bRequest = RTL8150_REQ_SET_REGS; |
199 | req->dr.wIndex = 0; | ||
200 | req->dr.wValue = cpu_to_le16(indx); | ||
201 | req->dr.wLength = cpu_to_le16(size); | ||
202 | usb_fill_control_urb(async_urb, dev->udev, | ||
203 | usb_sndctrlpipe(dev->udev, 0), (void *)&req->dr, | ||
204 | &req->rx_creg, size, async_set_reg_cb, req); | ||
205 | res = usb_submit_urb(async_urb, GFP_ATOMIC); | ||
206 | if (res) { | ||
207 | if (res == -ENODEV) | ||
205 | netif_device_detach(dev->netdev); | 208 | netif_device_detach(dev->netdev); |
206 | dev_err(&dev->udev->dev, | 209 | dev_err(&dev->udev->dev, "%s failed with %d\n", __func__, res); |
207 | "control request submission failed: %d\n", ret); | 210 | } |
208 | } else | 211 | return res; |
209 | set_bit(RX_REG_SET, &dev->flags); | ||
210 | |||
211 | return ret; | ||
212 | } | 212 | } |
213 | 213 | ||
214 | static int read_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 * reg) | 214 | static int read_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 * reg) |
@@ -330,13 +330,6 @@ static int alloc_all_urbs(rtl8150_t * dev) | |||
330 | usb_free_urb(dev->tx_urb); | 330 | usb_free_urb(dev->tx_urb); |
331 | return 0; | 331 | return 0; |
332 | } | 332 | } |
333 | dev->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL); | ||
334 | if (!dev->ctrl_urb) { | ||
335 | usb_free_urb(dev->rx_urb); | ||
336 | usb_free_urb(dev->tx_urb); | ||
337 | usb_free_urb(dev->intr_urb); | ||
338 | return 0; | ||
339 | } | ||
340 | 333 | ||
341 | return 1; | 334 | return 1; |
342 | } | 335 | } |
@@ -346,7 +339,6 @@ static void free_all_urbs(rtl8150_t * dev) | |||
346 | usb_free_urb(dev->rx_urb); | 339 | usb_free_urb(dev->rx_urb); |
347 | usb_free_urb(dev->tx_urb); | 340 | usb_free_urb(dev->tx_urb); |
348 | usb_free_urb(dev->intr_urb); | 341 | usb_free_urb(dev->intr_urb); |
349 | usb_free_urb(dev->ctrl_urb); | ||
350 | } | 342 | } |
351 | 343 | ||
352 | static void unlink_all_urbs(rtl8150_t * dev) | 344 | static void unlink_all_urbs(rtl8150_t * dev) |
@@ -354,7 +346,6 @@ static void unlink_all_urbs(rtl8150_t * dev) | |||
354 | usb_kill_urb(dev->rx_urb); | 346 | usb_kill_urb(dev->rx_urb); |
355 | usb_kill_urb(dev->tx_urb); | 347 | usb_kill_urb(dev->tx_urb); |
356 | usb_kill_urb(dev->intr_urb); | 348 | usb_kill_urb(dev->intr_urb); |
357 | usb_kill_urb(dev->ctrl_urb); | ||
358 | } | 349 | } |
359 | 350 | ||
360 | static inline struct sk_buff *pull_skb(rtl8150_t *dev) | 351 | static inline struct sk_buff *pull_skb(rtl8150_t *dev) |
@@ -629,7 +620,6 @@ static int enable_net_traffic(rtl8150_t * dev) | |||
629 | } | 620 | } |
630 | /* RCR bit7=1 attach Rx info at the end; =0 HW CRC (which is broken) */ | 621 | /* RCR bit7=1 attach Rx info at the end; =0 HW CRC (which is broken) */ |
631 | rcr = 0x9e; | 622 | rcr = 0x9e; |
632 | dev->rx_creg = cpu_to_le16(rcr); | ||
633 | tcr = 0xd8; | 623 | tcr = 0xd8; |
634 | cr = 0x0c; | 624 | cr = 0x0c; |
635 | if (!(rcr & 0x80)) | 625 | if (!(rcr & 0x80)) |
@@ -662,20 +652,22 @@ static void rtl8150_tx_timeout(struct net_device *netdev) | |||
662 | static void rtl8150_set_multicast(struct net_device *netdev) | 652 | static void rtl8150_set_multicast(struct net_device *netdev) |
663 | { | 653 | { |
664 | rtl8150_t *dev = netdev_priv(netdev); | 654 | rtl8150_t *dev = netdev_priv(netdev); |
655 | u16 rx_creg = 0x9e; | ||
656 | |||
665 | netif_stop_queue(netdev); | 657 | netif_stop_queue(netdev); |
666 | if (netdev->flags & IFF_PROMISC) { | 658 | if (netdev->flags & IFF_PROMISC) { |
667 | dev->rx_creg |= cpu_to_le16(0x0001); | 659 | rx_creg |= 0x0001; |
668 | dev_info(&netdev->dev, "%s: promiscuous mode\n", netdev->name); | 660 | dev_info(&netdev->dev, "%s: promiscuous mode\n", netdev->name); |
669 | } else if (!netdev_mc_empty(netdev) || | 661 | } else if (!netdev_mc_empty(netdev) || |
670 | (netdev->flags & IFF_ALLMULTI)) { | 662 | (netdev->flags & IFF_ALLMULTI)) { |
671 | dev->rx_creg &= cpu_to_le16(0xfffe); | 663 | rx_creg &= 0xfffe; |
672 | dev->rx_creg |= cpu_to_le16(0x0002); | 664 | rx_creg |= 0x0002; |
673 | dev_info(&netdev->dev, "%s: allmulti set\n", netdev->name); | 665 | dev_info(&netdev->dev, "%s: allmulti set\n", netdev->name); |
674 | } else { | 666 | } else { |
675 | /* ~RX_MULTICAST, ~RX_PROMISCUOUS */ | 667 | /* ~RX_MULTICAST, ~RX_PROMISCUOUS */ |
676 | dev->rx_creg &= cpu_to_le16(0x00fc); | 668 | rx_creg &= 0x00fc; |
677 | } | 669 | } |
678 | async_set_registers(dev, RCR, 2); | 670 | async_set_registers(dev, RCR, sizeof(rx_creg), rx_creg); |
679 | netif_wake_queue(netdev); | 671 | netif_wake_queue(netdev); |
680 | } | 672 | } |
681 | 673 | ||
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 655bb25eed2b..c9e00387d999 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -636,10 +636,11 @@ static int virtnet_open(struct net_device *dev) | |||
636 | struct virtnet_info *vi = netdev_priv(dev); | 636 | struct virtnet_info *vi = netdev_priv(dev); |
637 | int i; | 637 | int i; |
638 | 638 | ||
639 | for (i = 0; i < vi->curr_queue_pairs; i++) { | 639 | for (i = 0; i < vi->max_queue_pairs; i++) { |
640 | /* Make sure we have some buffers: if oom use wq. */ | 640 | if (i < vi->curr_queue_pairs) |
641 | if (!try_fill_recv(&vi->rq[i], GFP_KERNEL)) | 641 | /* Make sure we have some buffers: if oom use wq. */ |
642 | schedule_delayed_work(&vi->refill, 0); | 642 | if (!try_fill_recv(&vi->rq[i], GFP_KERNEL)) |
643 | schedule_delayed_work(&vi->refill, 0); | ||
643 | virtnet_napi_enable(&vi->rq[i]); | 644 | virtnet_napi_enable(&vi->rq[i]); |
644 | } | 645 | } |
645 | 646 | ||
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index ba81f3c39a83..3b1d2ee7156b 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -301,7 +301,7 @@ static inline struct hlist_head *vxlan_fdb_head(struct vxlan_dev *vxlan, | |||
301 | } | 301 | } |
302 | 302 | ||
303 | /* Look up Ethernet address in forwarding table */ | 303 | /* Look up Ethernet address in forwarding table */ |
304 | static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan, | 304 | static struct vxlan_fdb *__vxlan_find_mac(struct vxlan_dev *vxlan, |
305 | const u8 *mac) | 305 | const u8 *mac) |
306 | 306 | ||
307 | { | 307 | { |
@@ -316,6 +316,18 @@ static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan, | |||
316 | return NULL; | 316 | return NULL; |
317 | } | 317 | } |
318 | 318 | ||
319 | static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan, | ||
320 | const u8 *mac) | ||
321 | { | ||
322 | struct vxlan_fdb *f; | ||
323 | |||
324 | f = __vxlan_find_mac(vxlan, mac); | ||
325 | if (f) | ||
326 | f->used = jiffies; | ||
327 | |||
328 | return f; | ||
329 | } | ||
330 | |||
319 | /* Add/update destinations for multicast */ | 331 | /* Add/update destinations for multicast */ |
320 | static int vxlan_fdb_append(struct vxlan_fdb *f, | 332 | static int vxlan_fdb_append(struct vxlan_fdb *f, |
321 | __be32 ip, __be16 port, __u32 vni, __u32 ifindex) | 333 | __be32 ip, __be16 port, __u32 vni, __u32 ifindex) |
@@ -353,7 +365,7 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan, | |||
353 | struct vxlan_fdb *f; | 365 | struct vxlan_fdb *f; |
354 | int notify = 0; | 366 | int notify = 0; |
355 | 367 | ||
356 | f = vxlan_find_mac(vxlan, mac); | 368 | f = __vxlan_find_mac(vxlan, mac); |
357 | if (f) { | 369 | if (f) { |
358 | if (flags & NLM_F_EXCL) { | 370 | if (flags & NLM_F_EXCL) { |
359 | netdev_dbg(vxlan->dev, | 371 | netdev_dbg(vxlan->dev, |
@@ -563,7 +575,6 @@ static void vxlan_snoop(struct net_device *dev, | |||
563 | 575 | ||
564 | f = vxlan_find_mac(vxlan, src_mac); | 576 | f = vxlan_find_mac(vxlan, src_mac); |
565 | if (likely(f)) { | 577 | if (likely(f)) { |
566 | f->used = jiffies; | ||
567 | if (likely(f->remote.remote_ip == src_ip)) | 578 | if (likely(f->remote.remote_ip == src_ip)) |
568 | return; | 579 | return; |
569 | 580 | ||
diff --git a/drivers/net/wireless/ath/ath9k/Kconfig b/drivers/net/wireless/ath/ath9k/Kconfig index f3dc124c60c7..3c2cbc9d6295 100644 --- a/drivers/net/wireless/ath/ath9k/Kconfig +++ b/drivers/net/wireless/ath/ath9k/Kconfig | |||
@@ -92,13 +92,17 @@ config ATH9K_MAC_DEBUG | |||
92 | This option enables collection of statistics for Rx/Tx status | 92 | This option enables collection of statistics for Rx/Tx status |
93 | data and some other MAC related statistics | 93 | data and some other MAC related statistics |
94 | 94 | ||
95 | config ATH9K_RATE_CONTROL | 95 | config ATH9K_LEGACY_RATE_CONTROL |
96 | bool "Atheros ath9k rate control" | 96 | bool "Atheros ath9k rate control" |
97 | depends on ATH9K | 97 | depends on ATH9K |
98 | default y | 98 | default n |
99 | ---help--- | 99 | ---help--- |
100 | Say Y, if you want to use the ath9k specific rate control | 100 | Say Y, if you want to use the ath9k specific rate control |
101 | module instead of minstrel_ht. | 101 | module instead of minstrel_ht. Be warned that there are various |
102 | issues with the ath9k RC and minstrel is a more robust algorithm. | ||
103 | Note that even if this option is selected, "ath9k_rate_control" | ||
104 | has to be passed to mac80211 using the module parameter, | ||
105 | ieee80211_default_rc_algo. | ||
102 | 106 | ||
103 | config ATH9K_HTC | 107 | config ATH9K_HTC |
104 | tristate "Atheros HTC based wireless cards support" | 108 | tristate "Atheros HTC based wireless cards support" |
diff --git a/drivers/net/wireless/ath/ath9k/Makefile b/drivers/net/wireless/ath/ath9k/Makefile index 2ad8f9474ba1..75ee9e7704ce 100644 --- a/drivers/net/wireless/ath/ath9k/Makefile +++ b/drivers/net/wireless/ath/ath9k/Makefile | |||
@@ -8,7 +8,7 @@ ath9k-y += beacon.o \ | |||
8 | antenna.o | 8 | antenna.o |
9 | 9 | ||
10 | ath9k-$(CONFIG_ATH9K_BTCOEX_SUPPORT) += mci.o | 10 | ath9k-$(CONFIG_ATH9K_BTCOEX_SUPPORT) += mci.o |
11 | ath9k-$(CONFIG_ATH9K_RATE_CONTROL) += rc.o | 11 | ath9k-$(CONFIG_ATH9K_LEGACY_RATE_CONTROL) += rc.o |
12 | ath9k-$(CONFIG_ATH9K_PCI) += pci.o | 12 | ath9k-$(CONFIG_ATH9K_PCI) += pci.o |
13 | ath9k-$(CONFIG_ATH9K_AHB) += ahb.o | 13 | ath9k-$(CONFIG_ATH9K_AHB) += ahb.o |
14 | ath9k-$(CONFIG_ATH9K_DEBUGFS) += debug.o | 14 | ath9k-$(CONFIG_ATH9K_DEBUGFS) += debug.o |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h index db5ffada2217..7546b9a7dcbf 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h | |||
@@ -958,11 +958,11 @@ static const u32 ar9300Common_rx_gain_table_2p2[][2] = { | |||
958 | {0x0000a074, 0x00000000}, | 958 | {0x0000a074, 0x00000000}, |
959 | {0x0000a078, 0x00000000}, | 959 | {0x0000a078, 0x00000000}, |
960 | {0x0000a07c, 0x00000000}, | 960 | {0x0000a07c, 0x00000000}, |
961 | {0x0000a080, 0x1a1a1a1a}, | 961 | {0x0000a080, 0x22222229}, |
962 | {0x0000a084, 0x1a1a1a1a}, | 962 | {0x0000a084, 0x1d1d1d1d}, |
963 | {0x0000a088, 0x1a1a1a1a}, | 963 | {0x0000a088, 0x1d1d1d1d}, |
964 | {0x0000a08c, 0x1a1a1a1a}, | 964 | {0x0000a08c, 0x1d1d1d1d}, |
965 | {0x0000a090, 0x171a1a1a}, | 965 | {0x0000a090, 0x171d1d1d}, |
966 | {0x0000a094, 0x11111717}, | 966 | {0x0000a094, 0x11111717}, |
967 | {0x0000a098, 0x00030311}, | 967 | {0x0000a098, 0x00030311}, |
968 | {0x0000a09c, 0x00000000}, | 968 | {0x0000a09c, 0x00000000}, |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c index 639ba7d18ea4..6988e1d081f2 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c | |||
@@ -965,7 +965,7 @@ static void ar9003_hw_do_manual_peak_cal(struct ath_hw *ah, | |||
965 | { | 965 | { |
966 | int i; | 966 | int i; |
967 | 967 | ||
968 | if (!AR_SREV_9462(ah) && !AR_SREV_9565(ah)) | 968 | if (!AR_SREV_9462(ah) && !AR_SREV_9565(ah) && !AR_SREV_9485(ah)) |
969 | return; | 969 | return; |
970 | 970 | ||
971 | for (i = 0; i < AR9300_MAX_CHAINS; i++) { | 971 | for (i = 0; i < AR9300_MAX_CHAINS; i++) { |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h index 54ba42f4108a..874f6570bd1c 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h | |||
@@ -68,13 +68,16 @@ | |||
68 | #define AR9300_BASE_ADDR 0x3ff | 68 | #define AR9300_BASE_ADDR 0x3ff |
69 | #define AR9300_BASE_ADDR_512 0x1ff | 69 | #define AR9300_BASE_ADDR_512 0x1ff |
70 | 70 | ||
71 | #define AR9300_OTP_BASE (AR_SREV_9340(ah) ? 0x30000 : 0x14000) | 71 | #define AR9300_OTP_BASE \ |
72 | #define AR9300_OTP_STATUS (AR_SREV_9340(ah) ? 0x30018 : 0x15f18) | 72 | ((AR_SREV_9340(ah) || AR_SREV_9550(ah)) ? 0x30000 : 0x14000) |
73 | #define AR9300_OTP_STATUS \ | ||
74 | ((AR_SREV_9340(ah) || AR_SREV_9550(ah)) ? 0x30018 : 0x15f18) | ||
73 | #define AR9300_OTP_STATUS_TYPE 0x7 | 75 | #define AR9300_OTP_STATUS_TYPE 0x7 |
74 | #define AR9300_OTP_STATUS_VALID 0x4 | 76 | #define AR9300_OTP_STATUS_VALID 0x4 |
75 | #define AR9300_OTP_STATUS_ACCESS_BUSY 0x2 | 77 | #define AR9300_OTP_STATUS_ACCESS_BUSY 0x2 |
76 | #define AR9300_OTP_STATUS_SM_BUSY 0x1 | 78 | #define AR9300_OTP_STATUS_SM_BUSY 0x1 |
77 | #define AR9300_OTP_READ_DATA (AR_SREV_9340(ah) ? 0x3001c : 0x15f1c) | 79 | #define AR9300_OTP_READ_DATA \ |
80 | ((AR_SREV_9340(ah) || AR_SREV_9550(ah)) ? 0x3001c : 0x15f1c) | ||
78 | 81 | ||
79 | enum targetPowerHTRates { | 82 | enum targetPowerHTRates { |
80 | HT_TARGET_RATE_0_8_16, | 83 | HT_TARGET_RATE_0_8_16, |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index 2bf6548dd143..e1714d7c9eeb 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | |||
@@ -334,7 +334,8 @@ static void ar9003_hw_spur_ofdm(struct ath_hw *ah, | |||
334 | REG_RMW_FIELD(ah, AR_PHY_SPUR_REG, | 334 | REG_RMW_FIELD(ah, AR_PHY_SPUR_REG, |
335 | AR_PHY_SPUR_REG_EN_VIT_SPUR_RSSI, 1); | 335 | AR_PHY_SPUR_REG_EN_VIT_SPUR_RSSI, 1); |
336 | 336 | ||
337 | if (REG_READ_FIELD(ah, AR_PHY_MODE, | 337 | if (!AR_SREV_9340(ah) && |
338 | REG_READ_FIELD(ah, AR_PHY_MODE, | ||
338 | AR_PHY_MODE_DYNAMIC) == 0x1) | 339 | AR_PHY_MODE_DYNAMIC) == 0x1) |
339 | REG_RMW_FIELD(ah, AR_PHY_SPUR_REG, | 340 | REG_RMW_FIELD(ah, AR_PHY_SPUR_REG, |
340 | AR_PHY_SPUR_REG_ENABLE_NF_RSSI_SPUR_MIT, 1); | 341 | AR_PHY_SPUR_REG_ENABLE_NF_RSSI_SPUR_MIT, 1); |
diff --git a/drivers/net/wireless/ath/ath9k/ar9485_initvals.h b/drivers/net/wireless/ath/ath9k/ar9485_initvals.h index 712f415b8c08..88ff1d7b53ab 100644 --- a/drivers/net/wireless/ath/ath9k/ar9485_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9485_initvals.h | |||
@@ -1020,7 +1020,7 @@ static const u32 ar9485_1_1_baseband_postamble[][5] = { | |||
1020 | {0x0000a284, 0x00000000, 0x00000000, 0x000002a0, 0x000002a0}, | 1020 | {0x0000a284, 0x00000000, 0x00000000, 0x000002a0, 0x000002a0}, |
1021 | {0x0000a288, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 1021 | {0x0000a288, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
1022 | {0x0000a28c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 1022 | {0x0000a28c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
1023 | {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18}, | 1023 | {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00058d18, 0x00058d18}, |
1024 | {0x0000a2d0, 0x00071981, 0x00071981, 0x00071982, 0x00071982}, | 1024 | {0x0000a2d0, 0x00071981, 0x00071981, 0x00071982, 0x00071982}, |
1025 | {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a}, | 1025 | {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a}, |
1026 | {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 1026 | {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index 8a1888d02070..42b03dc39d14 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -251,9 +251,9 @@ struct ath_atx_tid { | |||
251 | int tidno; | 251 | int tidno; |
252 | int baw_head; /* first un-acked tx buffer */ | 252 | int baw_head; /* first un-acked tx buffer */ |
253 | int baw_tail; /* next unused tx buffer slot */ | 253 | int baw_tail; /* next unused tx buffer slot */ |
254 | int sched; | 254 | bool sched; |
255 | int paused; | 255 | bool paused; |
256 | u8 state; | 256 | bool active; |
257 | }; | 257 | }; |
258 | 258 | ||
259 | struct ath_node { | 259 | struct ath_node { |
@@ -274,10 +274,6 @@ struct ath_node { | |||
274 | #endif | 274 | #endif |
275 | }; | 275 | }; |
276 | 276 | ||
277 | #define AGGR_CLEANUP BIT(1) | ||
278 | #define AGGR_ADDBA_COMPLETE BIT(2) | ||
279 | #define AGGR_ADDBA_PROGRESS BIT(3) | ||
280 | |||
281 | struct ath_tx_control { | 277 | struct ath_tx_control { |
282 | struct ath_txq *txq; | 278 | struct ath_txq *txq; |
283 | struct ath_node *an; | 279 | struct ath_node *an; |
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index e6307b86363a..b37eb8d38811 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -2008,6 +2008,14 @@ void ath9k_get_et_stats(struct ieee80211_hw *hw, | |||
2008 | WARN_ON(i != ATH9K_SSTATS_LEN); | 2008 | WARN_ON(i != ATH9K_SSTATS_LEN); |
2009 | } | 2009 | } |
2010 | 2010 | ||
2011 | void ath9k_deinit_debug(struct ath_softc *sc) | ||
2012 | { | ||
2013 | if (config_enabled(CONFIG_ATH9K_DEBUGFS) && sc->rfs_chan_spec_scan) { | ||
2014 | relay_close(sc->rfs_chan_spec_scan); | ||
2015 | sc->rfs_chan_spec_scan = NULL; | ||
2016 | } | ||
2017 | } | ||
2018 | |||
2011 | int ath9k_init_debug(struct ath_hw *ah) | 2019 | int ath9k_init_debug(struct ath_hw *ah) |
2012 | { | 2020 | { |
2013 | struct ath_common *common = ath9k_hw_common(ah); | 2021 | struct ath_common *common = ath9k_hw_common(ah); |
diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h index 794a7ec83a24..9d49aab8b989 100644 --- a/drivers/net/wireless/ath/ath9k/debug.h +++ b/drivers/net/wireless/ath/ath9k/debug.h | |||
@@ -304,6 +304,7 @@ struct ath9k_debug { | |||
304 | }; | 304 | }; |
305 | 305 | ||
306 | int ath9k_init_debug(struct ath_hw *ah); | 306 | int ath9k_init_debug(struct ath_hw *ah); |
307 | void ath9k_deinit_debug(struct ath_softc *sc); | ||
307 | 308 | ||
308 | void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status); | 309 | void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status); |
309 | void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf, | 310 | void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf, |
@@ -339,6 +340,10 @@ static inline int ath9k_init_debug(struct ath_hw *ah) | |||
339 | return 0; | 340 | return 0; |
340 | } | 341 | } |
341 | 342 | ||
343 | static inline void ath9k_deinit_debug(struct ath_softc *sc) | ||
344 | { | ||
345 | } | ||
346 | |||
342 | static inline void ath_debug_stat_interrupt(struct ath_softc *sc, | 347 | static inline void ath_debug_stat_interrupt(struct ath_softc *sc, |
343 | enum ath9k_int status) | 348 | enum ath9k_int status) |
344 | { | 349 | { |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 7f25da8444fe..15dfefcf2d0f 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -1172,6 +1172,7 @@ u32 ath9k_regd_get_ctl(struct ath_regulatory *reg, struct ath9k_channel *chan) | |||
1172 | static inline void ath9k_hw_set_dma(struct ath_hw *ah) | 1172 | static inline void ath9k_hw_set_dma(struct ath_hw *ah) |
1173 | { | 1173 | { |
1174 | struct ath_common *common = ath9k_hw_common(ah); | 1174 | struct ath_common *common = ath9k_hw_common(ah); |
1175 | int txbuf_size; | ||
1175 | 1176 | ||
1176 | ENABLE_REGWRITE_BUFFER(ah); | 1177 | ENABLE_REGWRITE_BUFFER(ah); |
1177 | 1178 | ||
@@ -1225,13 +1226,17 @@ static inline void ath9k_hw_set_dma(struct ath_hw *ah) | |||
1225 | * So set the usable tx buf size also to half to | 1226 | * So set the usable tx buf size also to half to |
1226 | * avoid data/delimiter underruns | 1227 | * avoid data/delimiter underruns |
1227 | */ | 1228 | */ |
1228 | REG_WRITE(ah, AR_PCU_TXBUF_CTRL, | 1229 | txbuf_size = AR_9285_PCU_TXBUF_CTRL_USABLE_SIZE; |
1229 | AR_9285_PCU_TXBUF_CTRL_USABLE_SIZE); | 1230 | } else if (AR_SREV_9340_13_OR_LATER(ah)) { |
1230 | } else if (!AR_SREV_9271(ah)) { | 1231 | /* Uses fewer entries for AR934x v1.3+ to prevent rx overruns */ |
1231 | REG_WRITE(ah, AR_PCU_TXBUF_CTRL, | 1232 | txbuf_size = AR_9340_PCU_TXBUF_CTRL_USABLE_SIZE; |
1232 | AR_PCU_TXBUF_CTRL_USABLE_SIZE); | 1233 | } else { |
1234 | txbuf_size = AR_PCU_TXBUF_CTRL_USABLE_SIZE; | ||
1233 | } | 1235 | } |
1234 | 1236 | ||
1237 | if (!AR_SREV_9271(ah)) | ||
1238 | REG_WRITE(ah, AR_PCU_TXBUF_CTRL, txbuf_size); | ||
1239 | |||
1235 | REGWRITE_BUFFER_FLUSH(ah); | 1240 | REGWRITE_BUFFER_FLUSH(ah); |
1236 | 1241 | ||
1237 | if (AR_SREV_9300_20_OR_LATER(ah)) | 1242 | if (AR_SREV_9300_20_OR_LATER(ah)) |
@@ -1306,9 +1311,13 @@ static bool ath9k_hw_set_reset(struct ath_hw *ah, int type) | |||
1306 | AR_RTC_RC_COLD_RESET | AR_RTC_RC_WARM_RESET; | 1311 | AR_RTC_RC_COLD_RESET | AR_RTC_RC_WARM_RESET; |
1307 | } else { | 1312 | } else { |
1308 | tmpReg = REG_READ(ah, AR_INTR_SYNC_CAUSE); | 1313 | tmpReg = REG_READ(ah, AR_INTR_SYNC_CAUSE); |
1309 | if (tmpReg & | 1314 | if (AR_SREV_9340(ah)) |
1310 | (AR_INTR_SYNC_LOCAL_TIMEOUT | | 1315 | tmpReg &= AR9340_INTR_SYNC_LOCAL_TIMEOUT; |
1311 | AR_INTR_SYNC_RADM_CPL_TIMEOUT)) { | 1316 | else |
1317 | tmpReg &= AR_INTR_SYNC_LOCAL_TIMEOUT | | ||
1318 | AR_INTR_SYNC_RADM_CPL_TIMEOUT; | ||
1319 | |||
1320 | if (tmpReg) { | ||
1312 | u32 val; | 1321 | u32 val; |
1313 | REG_WRITE(ah, AR_INTR_SYNC_ENABLE, 0); | 1322 | REG_WRITE(ah, AR_INTR_SYNC_ENABLE, 0); |
1314 | 1323 | ||
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 0237b2868961..2ba494567777 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -787,8 +787,7 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
787 | hw->wiphy->iface_combinations = if_comb; | 787 | hw->wiphy->iface_combinations = if_comb; |
788 | hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb); | 788 | hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb); |
789 | 789 | ||
790 | if (AR_SREV_5416(sc->sc_ah)) | 790 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; |
791 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | ||
792 | 791 | ||
793 | hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; | 792 | hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; |
794 | hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; | 793 | hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; |
@@ -830,10 +829,6 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
830 | sc->ant_rx = hw->wiphy->available_antennas_rx; | 829 | sc->ant_rx = hw->wiphy->available_antennas_rx; |
831 | sc->ant_tx = hw->wiphy->available_antennas_tx; | 830 | sc->ant_tx = hw->wiphy->available_antennas_tx; |
832 | 831 | ||
833 | #ifdef CONFIG_ATH9K_RATE_CONTROL | ||
834 | hw->rate_control_algorithm = "ath9k_rate_control"; | ||
835 | #endif | ||
836 | |||
837 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) | 832 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) |
838 | hw->wiphy->bands[IEEE80211_BAND_2GHZ] = | 833 | hw->wiphy->bands[IEEE80211_BAND_2GHZ] = |
839 | &sc->sbands[IEEE80211_BAND_2GHZ]; | 834 | &sc->sbands[IEEE80211_BAND_2GHZ]; |
@@ -906,7 +901,7 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, | |||
906 | if (!ath_is_world_regd(reg)) { | 901 | if (!ath_is_world_regd(reg)) { |
907 | error = regulatory_hint(hw->wiphy, reg->alpha2); | 902 | error = regulatory_hint(hw->wiphy, reg->alpha2); |
908 | if (error) | 903 | if (error) |
909 | goto unregister; | 904 | goto debug_cleanup; |
910 | } | 905 | } |
911 | 906 | ||
912 | ath_init_leds(sc); | 907 | ath_init_leds(sc); |
@@ -914,6 +909,8 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, | |||
914 | 909 | ||
915 | return 0; | 910 | return 0; |
916 | 911 | ||
912 | debug_cleanup: | ||
913 | ath9k_deinit_debug(sc); | ||
917 | unregister: | 914 | unregister: |
918 | ieee80211_unregister_hw(hw); | 915 | ieee80211_unregister_hw(hw); |
919 | rx_cleanup: | 916 | rx_cleanup: |
@@ -942,11 +939,6 @@ static void ath9k_deinit_softc(struct ath_softc *sc) | |||
942 | sc->dfs_detector->exit(sc->dfs_detector); | 939 | sc->dfs_detector->exit(sc->dfs_detector); |
943 | 940 | ||
944 | ath9k_eeprom_release(sc); | 941 | ath9k_eeprom_release(sc); |
945 | |||
946 | if (config_enabled(CONFIG_ATH9K_DEBUGFS) && sc->rfs_chan_spec_scan) { | ||
947 | relay_close(sc->rfs_chan_spec_scan); | ||
948 | sc->rfs_chan_spec_scan = NULL; | ||
949 | } | ||
950 | } | 942 | } |
951 | 943 | ||
952 | void ath9k_deinit_device(struct ath_softc *sc) | 944 | void ath9k_deinit_device(struct ath_softc *sc) |
@@ -960,6 +952,7 @@ void ath9k_deinit_device(struct ath_softc *sc) | |||
960 | 952 | ||
961 | ath9k_ps_restore(sc); | 953 | ath9k_ps_restore(sc); |
962 | 954 | ||
955 | ath9k_deinit_debug(sc); | ||
963 | ieee80211_unregister_hw(hw); | 956 | ieee80211_unregister_hw(hw); |
964 | ath_rx_cleanup(sc); | 957 | ath_rx_cleanup(sc); |
965 | ath9k_deinit_softc(sc); | 958 | ath9k_deinit_softc(sc); |
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c index 498fee04afa0..566109a40fb3 100644 --- a/drivers/net/wireless/ath/ath9k/mac.c +++ b/drivers/net/wireless/ath/ath9k/mac.c | |||
@@ -410,7 +410,7 @@ bool ath9k_hw_resettxqueue(struct ath_hw *ah, u32 q) | |||
410 | 410 | ||
411 | REG_WRITE(ah, AR_QMISC(q), AR_Q_MISC_DCU_EARLY_TERM_REQ); | 411 | REG_WRITE(ah, AR_QMISC(q), AR_Q_MISC_DCU_EARLY_TERM_REQ); |
412 | 412 | ||
413 | if (AR_SREV_9340(ah)) | 413 | if (AR_SREV_9340(ah) && !AR_SREV_9340_13_OR_LATER(ah)) |
414 | REG_WRITE(ah, AR_DMISC(q), | 414 | REG_WRITE(ah, AR_DMISC(q), |
415 | AR_D_MISC_CW_BKOFF_EN | AR_D_MISC_FRAG_WAIT_EN | 0x1); | 415 | AR_D_MISC_CW_BKOFF_EN | AR_D_MISC_FRAG_WAIT_EN | 0x1); |
416 | else | 416 | else |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index a18414b5948b..5092ecae7706 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -1687,6 +1687,7 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw, | |||
1687 | u16 tid, u16 *ssn, u8 buf_size) | 1687 | u16 tid, u16 *ssn, u8 buf_size) |
1688 | { | 1688 | { |
1689 | struct ath_softc *sc = hw->priv; | 1689 | struct ath_softc *sc = hw->priv; |
1690 | bool flush = false; | ||
1690 | int ret = 0; | 1691 | int ret = 0; |
1691 | 1692 | ||
1692 | local_bh_disable(); | 1693 | local_bh_disable(); |
@@ -1703,12 +1704,14 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw, | |||
1703 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); | 1704 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
1704 | ath9k_ps_restore(sc); | 1705 | ath9k_ps_restore(sc); |
1705 | break; | 1706 | break; |
1706 | case IEEE80211_AMPDU_TX_STOP_CONT: | ||
1707 | case IEEE80211_AMPDU_TX_STOP_FLUSH: | 1707 | case IEEE80211_AMPDU_TX_STOP_FLUSH: |
1708 | case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: | 1708 | case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: |
1709 | flush = true; | ||
1710 | case IEEE80211_AMPDU_TX_STOP_CONT: | ||
1709 | ath9k_ps_wakeup(sc); | 1711 | ath9k_ps_wakeup(sc); |
1710 | ath_tx_aggr_stop(sc, sta, tid); | 1712 | ath_tx_aggr_stop(sc, sta, tid); |
1711 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); | 1713 | if (!flush) |
1714 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); | ||
1712 | ath9k_ps_restore(sc); | 1715 | ath9k_ps_restore(sc); |
1713 | break; | 1716 | break; |
1714 | case IEEE80211_AMPDU_TX_OPERATIONAL: | 1717 | case IEEE80211_AMPDU_TX_OPERATIONAL: |
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c index aa4d368d8d3d..7eb1f4b458e4 100644 --- a/drivers/net/wireless/ath/ath9k/rc.c +++ b/drivers/net/wireless/ath/ath9k/rc.c | |||
@@ -1227,10 +1227,7 @@ static bool ath_tx_aggr_check(struct ath_softc *sc, struct ieee80211_sta *sta, | |||
1227 | return false; | 1227 | return false; |
1228 | 1228 | ||
1229 | txtid = ATH_AN_2_TID(an, tidno); | 1229 | txtid = ATH_AN_2_TID(an, tidno); |
1230 | 1230 | return !txtid->active; | |
1231 | if (!(txtid->state & (AGGR_ADDBA_COMPLETE | AGGR_ADDBA_PROGRESS))) | ||
1232 | return true; | ||
1233 | return false; | ||
1234 | } | 1231 | } |
1235 | 1232 | ||
1236 | 1233 | ||
diff --git a/drivers/net/wireless/ath/ath9k/rc.h b/drivers/net/wireless/ath/ath9k/rc.h index 267dbfcfaa96..b9a87383cb43 100644 --- a/drivers/net/wireless/ath/ath9k/rc.h +++ b/drivers/net/wireless/ath/ath9k/rc.h | |||
@@ -231,7 +231,7 @@ static inline void ath_debug_stat_retries(struct ath_rate_priv *rc, int rix, | |||
231 | } | 231 | } |
232 | #endif | 232 | #endif |
233 | 233 | ||
234 | #ifdef CONFIG_ATH9K_RATE_CONTROL | 234 | #ifdef CONFIG_ATH9K_LEGACY_RATE_CONTROL |
235 | int ath_rate_control_register(void); | 235 | int ath_rate_control_register(void); |
236 | void ath_rate_control_unregister(void); | 236 | void ath_rate_control_unregister(void); |
237 | #else | 237 | #else |
diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h index 5c4ab5026dca..f7c90cc58d56 100644 --- a/drivers/net/wireless/ath/ath9k/reg.h +++ b/drivers/net/wireless/ath/ath9k/reg.h | |||
@@ -798,6 +798,10 @@ | |||
798 | #define AR_SREV_REVISION_9485_10 0 | 798 | #define AR_SREV_REVISION_9485_10 0 |
799 | #define AR_SREV_REVISION_9485_11 1 | 799 | #define AR_SREV_REVISION_9485_11 1 |
800 | #define AR_SREV_VERSION_9340 0x300 | 800 | #define AR_SREV_VERSION_9340 0x300 |
801 | #define AR_SREV_REVISION_9340_10 0 | ||
802 | #define AR_SREV_REVISION_9340_11 1 | ||
803 | #define AR_SREV_REVISION_9340_12 2 | ||
804 | #define AR_SREV_REVISION_9340_13 3 | ||
801 | #define AR_SREV_VERSION_9580 0x1C0 | 805 | #define AR_SREV_VERSION_9580 0x1C0 |
802 | #define AR_SREV_REVISION_9580_10 4 /* AR9580 1.0 */ | 806 | #define AR_SREV_REVISION_9580_10 4 /* AR9580 1.0 */ |
803 | #define AR_SREV_VERSION_9462 0x280 | 807 | #define AR_SREV_VERSION_9462 0x280 |
@@ -897,6 +901,10 @@ | |||
897 | #define AR_SREV_9340(_ah) \ | 901 | #define AR_SREV_9340(_ah) \ |
898 | (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9340)) | 902 | (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9340)) |
899 | 903 | ||
904 | #define AR_SREV_9340_13_OR_LATER(_ah) \ | ||
905 | (AR_SREV_9340((_ah)) && \ | ||
906 | ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9340_13)) | ||
907 | |||
900 | #define AR_SREV_9285E_20(_ah) \ | 908 | #define AR_SREV_9285E_20(_ah) \ |
901 | (AR_SREV_9285_12_OR_LATER(_ah) && \ | 909 | (AR_SREV_9285_12_OR_LATER(_ah) && \ |
902 | ((REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1)) | 910 | ((REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1)) |
@@ -1007,6 +1015,8 @@ enum { | |||
1007 | AR_INTR_SYNC_LOCAL_TIMEOUT | | 1015 | AR_INTR_SYNC_LOCAL_TIMEOUT | |
1008 | AR_INTR_SYNC_MAC_SLEEP_ACCESS), | 1016 | AR_INTR_SYNC_MAC_SLEEP_ACCESS), |
1009 | 1017 | ||
1018 | AR9340_INTR_SYNC_LOCAL_TIMEOUT = 0x00000010, | ||
1019 | |||
1010 | AR_INTR_SYNC_SPURIOUS = 0xFFFFFFFF, | 1020 | AR_INTR_SYNC_SPURIOUS = 0xFFFFFFFF, |
1011 | 1021 | ||
1012 | }; | 1022 | }; |
@@ -1881,6 +1891,7 @@ enum { | |||
1881 | #define AR_PCU_TXBUF_CTRL_SIZE_MASK 0x7FF | 1891 | #define AR_PCU_TXBUF_CTRL_SIZE_MASK 0x7FF |
1882 | #define AR_PCU_TXBUF_CTRL_USABLE_SIZE 0x700 | 1892 | #define AR_PCU_TXBUF_CTRL_USABLE_SIZE 0x700 |
1883 | #define AR_9285_PCU_TXBUF_CTRL_USABLE_SIZE 0x380 | 1893 | #define AR_9285_PCU_TXBUF_CTRL_USABLE_SIZE 0x380 |
1894 | #define AR_9340_PCU_TXBUF_CTRL_USABLE_SIZE 0x500 | ||
1884 | 1895 | ||
1885 | #define AR_PCU_MISC_MODE2 0x8344 | 1896 | #define AR_PCU_MISC_MODE2 0x8344 |
1886 | #define AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE 0x00000002 | 1897 | #define AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE 0x00000002 |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index eab0fcb7ded6..1c9b1bac8b0d 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -125,24 +125,6 @@ static void ath_tx_queue_tid(struct ath_txq *txq, struct ath_atx_tid *tid) | |||
125 | list_add_tail(&ac->list, &txq->axq_acq); | 125 | list_add_tail(&ac->list, &txq->axq_acq); |
126 | } | 126 | } |
127 | 127 | ||
128 | static void ath_tx_resume_tid(struct ath_softc *sc, struct ath_atx_tid *tid) | ||
129 | { | ||
130 | struct ath_txq *txq = tid->ac->txq; | ||
131 | |||
132 | WARN_ON(!tid->paused); | ||
133 | |||
134 | ath_txq_lock(sc, txq); | ||
135 | tid->paused = false; | ||
136 | |||
137 | if (skb_queue_empty(&tid->buf_q)) | ||
138 | goto unlock; | ||
139 | |||
140 | ath_tx_queue_tid(txq, tid); | ||
141 | ath_txq_schedule(sc, txq); | ||
142 | unlock: | ||
143 | ath_txq_unlock_complete(sc, txq); | ||
144 | } | ||
145 | |||
146 | static struct ath_frame_info *get_frame_info(struct sk_buff *skb) | 128 | static struct ath_frame_info *get_frame_info(struct sk_buff *skb) |
147 | { | 129 | { |
148 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | 130 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); |
@@ -201,11 +183,6 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) | |||
201 | } | 183 | } |
202 | } | 184 | } |
203 | 185 | ||
204 | if (tid->baw_head == tid->baw_tail) { | ||
205 | tid->state &= ~AGGR_ADDBA_COMPLETE; | ||
206 | tid->state &= ~AGGR_CLEANUP; | ||
207 | } | ||
208 | |||
209 | if (sendbar) { | 186 | if (sendbar) { |
210 | ath_txq_unlock(sc, txq); | 187 | ath_txq_unlock(sc, txq); |
211 | ath_send_bar(tid, tid->seq_start); | 188 | ath_send_bar(tid, tid->seq_start); |
@@ -277,9 +254,7 @@ static void ath_tid_drain(struct ath_softc *sc, struct ath_txq *txq, | |||
277 | 254 | ||
278 | list_add_tail(&bf->list, &bf_head); | 255 | list_add_tail(&bf->list, &bf_head); |
279 | 256 | ||
280 | if (fi->retries) | 257 | ath_tx_update_baw(sc, tid, bf->bf_state.seqno); |
281 | ath_tx_update_baw(sc, tid, bf->bf_state.seqno); | ||
282 | |||
283 | ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); | 258 | ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); |
284 | } | 259 | } |
285 | 260 | ||
@@ -491,19 +466,19 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
491 | tx_info = IEEE80211_SKB_CB(skb); | 466 | tx_info = IEEE80211_SKB_CB(skb); |
492 | fi = get_frame_info(skb); | 467 | fi = get_frame_info(skb); |
493 | 468 | ||
494 | if (ATH_BA_ISSET(ba, ATH_BA_INDEX(seq_st, seqno))) { | 469 | if (!BAW_WITHIN(tid->seq_start, tid->baw_size, seqno)) { |
470 | /* | ||
471 | * Outside of the current BlockAck window, | ||
472 | * maybe part of a previous session | ||
473 | */ | ||
474 | txfail = 1; | ||
475 | } else if (ATH_BA_ISSET(ba, ATH_BA_INDEX(seq_st, seqno))) { | ||
495 | /* transmit completion, subframe is | 476 | /* transmit completion, subframe is |
496 | * acked by block ack */ | 477 | * acked by block ack */ |
497 | acked_cnt++; | 478 | acked_cnt++; |
498 | } else if (!isaggr && txok) { | 479 | } else if (!isaggr && txok) { |
499 | /* transmit completion */ | 480 | /* transmit completion */ |
500 | acked_cnt++; | 481 | acked_cnt++; |
501 | } else if (tid->state & AGGR_CLEANUP) { | ||
502 | /* | ||
503 | * cleanup in progress, just fail | ||
504 | * the un-acked sub-frames | ||
505 | */ | ||
506 | txfail = 1; | ||
507 | } else if (flush) { | 482 | } else if (flush) { |
508 | txpending = 1; | 483 | txpending = 1; |
509 | } else if (fi->retries < ATH_MAX_SW_RETRIES) { | 484 | } else if (fi->retries < ATH_MAX_SW_RETRIES) { |
@@ -527,7 +502,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
527 | if (bf_next != NULL || !bf_last->bf_stale) | 502 | if (bf_next != NULL || !bf_last->bf_stale) |
528 | list_move_tail(&bf->list, &bf_head); | 503 | list_move_tail(&bf->list, &bf_head); |
529 | 504 | ||
530 | if (!txpending || (tid->state & AGGR_CLEANUP)) { | 505 | if (!txpending) { |
531 | /* | 506 | /* |
532 | * complete the acked-ones/xretried ones; update | 507 | * complete the acked-ones/xretried ones; update |
533 | * block-ack window | 508 | * block-ack window |
@@ -601,9 +576,6 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
601 | ath_txq_lock(sc, txq); | 576 | ath_txq_lock(sc, txq); |
602 | } | 577 | } |
603 | 578 | ||
604 | if (tid->state & AGGR_CLEANUP) | ||
605 | ath_tx_flush_tid(sc, tid); | ||
606 | |||
607 | rcu_read_unlock(); | 579 | rcu_read_unlock(); |
608 | 580 | ||
609 | if (needreset) | 581 | if (needreset) |
@@ -620,6 +592,7 @@ static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq, | |||
620 | struct ath_tx_status *ts, struct ath_buf *bf, | 592 | struct ath_tx_status *ts, struct ath_buf *bf, |
621 | struct list_head *bf_head) | 593 | struct list_head *bf_head) |
622 | { | 594 | { |
595 | struct ieee80211_tx_info *info; | ||
623 | bool txok, flush; | 596 | bool txok, flush; |
624 | 597 | ||
625 | txok = !(ts->ts_status & ATH9K_TXERR_MASK); | 598 | txok = !(ts->ts_status & ATH9K_TXERR_MASK); |
@@ -631,8 +604,12 @@ static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq, | |||
631 | txq->axq_ampdu_depth--; | 604 | txq->axq_ampdu_depth--; |
632 | 605 | ||
633 | if (!bf_isampdu(bf)) { | 606 | if (!bf_isampdu(bf)) { |
634 | if (!flush) | 607 | if (!flush) { |
608 | info = IEEE80211_SKB_CB(bf->bf_mpdu); | ||
609 | memcpy(info->control.rates, bf->rates, | ||
610 | sizeof(info->control.rates)); | ||
635 | ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok); | 611 | ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok); |
612 | } | ||
636 | ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok); | 613 | ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok); |
637 | } else | 614 | } else |
638 | ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok); | 615 | ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok); |
@@ -676,7 +653,7 @@ static u32 ath_lookup_rate(struct ath_softc *sc, struct ath_buf *bf, | |||
676 | 653 | ||
677 | skb = bf->bf_mpdu; | 654 | skb = bf->bf_mpdu; |
678 | tx_info = IEEE80211_SKB_CB(skb); | 655 | tx_info = IEEE80211_SKB_CB(skb); |
679 | rates = tx_info->control.rates; | 656 | rates = bf->rates; |
680 | 657 | ||
681 | /* | 658 | /* |
682 | * Find the lowest frame length among the rate series that will have a | 659 | * Find the lowest frame length among the rate series that will have a |
@@ -1231,9 +1208,6 @@ int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, | |||
1231 | an = (struct ath_node *)sta->drv_priv; | 1208 | an = (struct ath_node *)sta->drv_priv; |
1232 | txtid = ATH_AN_2_TID(an, tid); | 1209 | txtid = ATH_AN_2_TID(an, tid); |
1233 | 1210 | ||
1234 | if (txtid->state & (AGGR_CLEANUP | AGGR_ADDBA_COMPLETE)) | ||
1235 | return -EAGAIN; | ||
1236 | |||
1237 | /* update ampdu factor/density, they may have changed. This may happen | 1211 | /* update ampdu factor/density, they may have changed. This may happen |
1238 | * in HT IBSS when a beacon with HT-info is received after the station | 1212 | * in HT IBSS when a beacon with HT-info is received after the station |
1239 | * has already been added. | 1213 | * has already been added. |
@@ -1245,7 +1219,7 @@ int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, | |||
1245 | an->mpdudensity = density; | 1219 | an->mpdudensity = density; |
1246 | } | 1220 | } |
1247 | 1221 | ||
1248 | txtid->state |= AGGR_ADDBA_PROGRESS; | 1222 | txtid->active = true; |
1249 | txtid->paused = true; | 1223 | txtid->paused = true; |
1250 | *ssn = txtid->seq_start = txtid->seq_next; | 1224 | *ssn = txtid->seq_start = txtid->seq_next; |
1251 | txtid->bar_index = -1; | 1225 | txtid->bar_index = -1; |
@@ -1262,28 +1236,9 @@ void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) | |||
1262 | struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid); | 1236 | struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid); |
1263 | struct ath_txq *txq = txtid->ac->txq; | 1237 | struct ath_txq *txq = txtid->ac->txq; |
1264 | 1238 | ||
1265 | if (txtid->state & AGGR_CLEANUP) | ||
1266 | return; | ||
1267 | |||
1268 | if (!(txtid->state & AGGR_ADDBA_COMPLETE)) { | ||
1269 | txtid->state &= ~AGGR_ADDBA_PROGRESS; | ||
1270 | return; | ||
1271 | } | ||
1272 | |||
1273 | ath_txq_lock(sc, txq); | 1239 | ath_txq_lock(sc, txq); |
1240 | txtid->active = false; | ||
1274 | txtid->paused = true; | 1241 | txtid->paused = true; |
1275 | |||
1276 | /* | ||
1277 | * If frames are still being transmitted for this TID, they will be | ||
1278 | * cleaned up during tx completion. To prevent race conditions, this | ||
1279 | * TID can only be reused after all in-progress subframes have been | ||
1280 | * completed. | ||
1281 | */ | ||
1282 | if (txtid->baw_head != txtid->baw_tail) | ||
1283 | txtid->state |= AGGR_CLEANUP; | ||
1284 | else | ||
1285 | txtid->state &= ~AGGR_ADDBA_COMPLETE; | ||
1286 | |||
1287 | ath_tx_flush_tid(sc, txtid); | 1242 | ath_tx_flush_tid(sc, txtid); |
1288 | ath_txq_unlock_complete(sc, txq); | 1243 | ath_txq_unlock_complete(sc, txq); |
1289 | } | 1244 | } |
@@ -1349,18 +1304,28 @@ void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an) | |||
1349 | } | 1304 | } |
1350 | } | 1305 | } |
1351 | 1306 | ||
1352 | void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) | 1307 | void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, |
1308 | u16 tidno) | ||
1353 | { | 1309 | { |
1354 | struct ath_atx_tid *txtid; | 1310 | struct ath_atx_tid *tid; |
1355 | struct ath_node *an; | 1311 | struct ath_node *an; |
1312 | struct ath_txq *txq; | ||
1356 | 1313 | ||
1357 | an = (struct ath_node *)sta->drv_priv; | 1314 | an = (struct ath_node *)sta->drv_priv; |
1315 | tid = ATH_AN_2_TID(an, tidno); | ||
1316 | txq = tid->ac->txq; | ||
1358 | 1317 | ||
1359 | txtid = ATH_AN_2_TID(an, tid); | 1318 | ath_txq_lock(sc, txq); |
1360 | txtid->baw_size = IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor; | 1319 | |
1361 | txtid->state |= AGGR_ADDBA_COMPLETE; | 1320 | tid->baw_size = IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor; |
1362 | txtid->state &= ~AGGR_ADDBA_PROGRESS; | 1321 | tid->paused = false; |
1363 | ath_tx_resume_tid(sc, txtid); | 1322 | |
1323 | if (!skb_queue_empty(&tid->buf_q)) { | ||
1324 | ath_tx_queue_tid(txq, tid); | ||
1325 | ath_txq_schedule(sc, txq); | ||
1326 | } | ||
1327 | |||
1328 | ath_txq_unlock_complete(sc, txq); | ||
1364 | } | 1329 | } |
1365 | 1330 | ||
1366 | /********************/ | 1331 | /********************/ |
@@ -2409,12 +2374,10 @@ void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an) | |||
2409 | tid->baw_head = tid->baw_tail = 0; | 2374 | tid->baw_head = tid->baw_tail = 0; |
2410 | tid->sched = false; | 2375 | tid->sched = false; |
2411 | tid->paused = false; | 2376 | tid->paused = false; |
2412 | tid->state &= ~AGGR_CLEANUP; | 2377 | tid->active = false; |
2413 | __skb_queue_head_init(&tid->buf_q); | 2378 | __skb_queue_head_init(&tid->buf_q); |
2414 | acno = TID_TO_WME_AC(tidno); | 2379 | acno = TID_TO_WME_AC(tidno); |
2415 | tid->ac = &an->ac[acno]; | 2380 | tid->ac = &an->ac[acno]; |
2416 | tid->state &= ~AGGR_ADDBA_COMPLETE; | ||
2417 | tid->state &= ~AGGR_ADDBA_PROGRESS; | ||
2418 | } | 2381 | } |
2419 | 2382 | ||
2420 | for (acno = 0, ac = &an->ac[acno]; | 2383 | for (acno = 0, ac = &an->ac[acno]; |
@@ -2451,8 +2414,7 @@ void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an) | |||
2451 | } | 2414 | } |
2452 | 2415 | ||
2453 | ath_tid_drain(sc, txq, tid); | 2416 | ath_tid_drain(sc, txq, tid); |
2454 | tid->state &= ~AGGR_ADDBA_COMPLETE; | 2417 | tid->active = false; |
2455 | tid->state &= ~AGGR_CLEANUP; | ||
2456 | 2418 | ||
2457 | ath_txq_unlock(sc, txq); | 2419 | ath_txq_unlock(sc, txq); |
2458 | } | 2420 | } |
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index 830bb1d1f957..b827d51c30a3 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c | |||
@@ -1624,7 +1624,7 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port, | |||
1624 | 1624 | ||
1625 | netif_carrier_off(dev); | 1625 | netif_carrier_off(dev); |
1626 | 1626 | ||
1627 | if (!proc_create_data("driver/atmel", 0, NULL, &atmel_proc_fops, priv)); | 1627 | if (!proc_create_data("driver/atmel", 0, NULL, &atmel_proc_fops, priv)) |
1628 | printk(KERN_WARNING "atmel: unable to create /proc entry.\n"); | 1628 | printk(KERN_WARNING "atmel: unable to create /proc entry.\n"); |
1629 | 1629 | ||
1630 | printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %pM\n", | 1630 | printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %pM\n", |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 6dd07e2ec595..a95b77ab360e 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -2458,7 +2458,7 @@ static void b43_request_firmware(struct work_struct *work) | |||
2458 | for (i = 0; i < B43_NR_FWTYPES; i++) { | 2458 | for (i = 0; i < B43_NR_FWTYPES; i++) { |
2459 | errmsg = ctx->errors[i]; | 2459 | errmsg = ctx->errors[i]; |
2460 | if (strlen(errmsg)) | 2460 | if (strlen(errmsg)) |
2461 | b43err(dev->wl, errmsg); | 2461 | b43err(dev->wl, "%s", errmsg); |
2462 | } | 2462 | } |
2463 | b43_print_fw_helptext(dev->wl, 1); | 2463 | b43_print_fw_helptext(dev->wl, 1); |
2464 | goto out; | 2464 | goto out; |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c index be0787cab24f..9431af2465f3 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include "tracepoint.h" | 27 | #include "tracepoint.h" |
28 | 28 | ||
29 | #define PKTFILTER_BUF_SIZE 128 | 29 | #define PKTFILTER_BUF_SIZE 128 |
30 | #define BRCMF_ARPOL_MODE 0xb /* agent|snoop|peer_autoreply */ | ||
31 | #define BRCMF_DEFAULT_BCN_TIMEOUT 3 | 30 | #define BRCMF_DEFAULT_BCN_TIMEOUT 3 |
32 | #define BRCMF_DEFAULT_SCAN_CHANNEL_TIME 40 | 31 | #define BRCMF_DEFAULT_SCAN_CHANNEL_TIME 40 |
33 | #define BRCMF_DEFAULT_SCAN_UNASSOC_TIME 40 | 32 | #define BRCMF_DEFAULT_SCAN_UNASSOC_TIME 40 |
@@ -338,23 +337,6 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) | |||
338 | goto done; | 337 | goto done; |
339 | } | 338 | } |
340 | 339 | ||
341 | /* Try to set and enable ARP offload feature, this may fail */ | ||
342 | err = brcmf_fil_iovar_int_set(ifp, "arp_ol", BRCMF_ARPOL_MODE); | ||
343 | if (err) { | ||
344 | brcmf_dbg(TRACE, "failed to set ARP offload mode to 0x%x, err = %d\n", | ||
345 | BRCMF_ARPOL_MODE, err); | ||
346 | err = 0; | ||
347 | } else { | ||
348 | err = brcmf_fil_iovar_int_set(ifp, "arpoe", 1); | ||
349 | if (err) { | ||
350 | brcmf_dbg(TRACE, "failed to enable ARP offload err = %d\n", | ||
351 | err); | ||
352 | err = 0; | ||
353 | } else | ||
354 | brcmf_dbg(TRACE, "successfully enabled ARP offload to 0x%x\n", | ||
355 | BRCMF_ARPOL_MODE); | ||
356 | } | ||
357 | |||
358 | /* Setup packet filter */ | 340 | /* Setup packet filter */ |
359 | brcmf_c_pktfilter_offload_set(ifp, BRCMF_DEFAULT_PACKET_FILTER); | 341 | brcmf_c_pktfilter_offload_set(ifp, BRCMF_DEFAULT_PACKET_FILTER); |
360 | brcmf_c_pktfilter_offload_enable(ifp, BRCMF_DEFAULT_PACKET_FILTER, | 342 | brcmf_c_pktfilter_offload_enable(ifp, BRCMF_DEFAULT_PACKET_FILTER, |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c index 59c25463e428..b98f2235978e 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c | |||
@@ -653,10 +653,13 @@ int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked) | |||
653 | 653 | ||
654 | brcmf_dbg(INFO, "%s: Broadcom Dongle Host Driver\n", ndev->name); | 654 | brcmf_dbg(INFO, "%s: Broadcom Dongle Host Driver\n", ndev->name); |
655 | 655 | ||
656 | ndev->destructor = free_netdev; | ||
656 | return 0; | 657 | return 0; |
657 | 658 | ||
658 | fail: | 659 | fail: |
660 | drvr->iflist[ifp->bssidx] = NULL; | ||
659 | ndev->netdev_ops = NULL; | 661 | ndev->netdev_ops = NULL; |
662 | free_netdev(ndev); | ||
660 | return -EBADE; | 663 | return -EBADE; |
661 | } | 664 | } |
662 | 665 | ||
@@ -720,6 +723,9 @@ static int brcmf_net_p2p_attach(struct brcmf_if *ifp) | |||
720 | return 0; | 723 | return 0; |
721 | 724 | ||
722 | fail: | 725 | fail: |
726 | ifp->drvr->iflist[ifp->bssidx] = NULL; | ||
727 | ndev->netdev_ops = NULL; | ||
728 | free_netdev(ndev); | ||
723 | return -EBADE; | 729 | return -EBADE; |
724 | } | 730 | } |
725 | 731 | ||
@@ -788,6 +794,7 @@ void brcmf_del_if(struct brcmf_pub *drvr, s32 bssidx) | |||
788 | struct brcmf_if *ifp; | 794 | struct brcmf_if *ifp; |
789 | 795 | ||
790 | ifp = drvr->iflist[bssidx]; | 796 | ifp = drvr->iflist[bssidx]; |
797 | drvr->iflist[bssidx] = NULL; | ||
791 | if (!ifp) { | 798 | if (!ifp) { |
792 | brcmf_err("Null interface, idx=%d\n", bssidx); | 799 | brcmf_err("Null interface, idx=%d\n", bssidx); |
793 | return; | 800 | return; |
@@ -808,15 +815,13 @@ void brcmf_del_if(struct brcmf_pub *drvr, s32 bssidx) | |||
808 | cancel_work_sync(&ifp->setmacaddr_work); | 815 | cancel_work_sync(&ifp->setmacaddr_work); |
809 | cancel_work_sync(&ifp->multicast_work); | 816 | cancel_work_sync(&ifp->multicast_work); |
810 | } | 817 | } |
811 | 818 | /* unregister will take care of freeing it */ | |
812 | unregister_netdev(ifp->ndev); | 819 | unregister_netdev(ifp->ndev); |
813 | if (bssidx == 0) | 820 | if (bssidx == 0) |
814 | brcmf_cfg80211_detach(drvr->config); | 821 | brcmf_cfg80211_detach(drvr->config); |
815 | free_netdev(ifp->ndev); | ||
816 | } else { | 822 | } else { |
817 | kfree(ifp); | 823 | kfree(ifp); |
818 | } | 824 | } |
819 | drvr->iflist[bssidx] = NULL; | ||
820 | } | 825 | } |
821 | 826 | ||
822 | int brcmf_attach(uint bus_hdrlen, struct device *dev) | 827 | int brcmf_attach(uint bus_hdrlen, struct device *dev) |
@@ -925,8 +930,6 @@ fail: | |||
925 | brcmf_fws_del_interface(ifp); | 930 | brcmf_fws_del_interface(ifp); |
926 | brcmf_fws_deinit(drvr); | 931 | brcmf_fws_deinit(drvr); |
927 | } | 932 | } |
928 | free_netdev(ifp->ndev); | ||
929 | drvr->iflist[0] = NULL; | ||
930 | if (p2p_ifp) { | 933 | if (p2p_ifp) { |
931 | free_netdev(p2p_ifp->ndev); | 934 | free_netdev(p2p_ifp->ndev); |
932 | drvr->iflist[1] = NULL; | 935 | drvr->iflist[1] = NULL; |
@@ -934,7 +937,8 @@ fail: | |||
934 | return ret; | 937 | return ret; |
935 | } | 938 | } |
936 | if ((brcmf_p2p_enable) && (p2p_ifp)) | 939 | if ((brcmf_p2p_enable) && (p2p_ifp)) |
937 | brcmf_net_p2p_attach(p2p_ifp); | 940 | if (brcmf_net_p2p_attach(p2p_ifp) < 0) |
941 | brcmf_p2p_enable = 0; | ||
938 | 942 | ||
939 | return 0; | 943 | return 0; |
940 | } | 944 | } |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c index 5a64280e6485..83ee53a7c76e 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c | |||
@@ -202,7 +202,8 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr, | |||
202 | return; | 202 | return; |
203 | brcmf_fws_add_interface(ifp); | 203 | brcmf_fws_add_interface(ifp); |
204 | if (!drvr->fweh.evt_handler[BRCMF_E_IF]) | 204 | if (!drvr->fweh.evt_handler[BRCMF_E_IF]) |
205 | err = brcmf_net_attach(ifp, false); | 205 | if (brcmf_net_attach(ifp, false) < 0) |
206 | return; | ||
206 | } | 207 | } |
207 | 208 | ||
208 | if (ifevent->action == BRCMF_E_IF_CHANGE) | 209 | if (ifevent->action == BRCMF_E_IF_CHANGE) |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h index 0f2c83bc95dc..665ef69e974b 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h | |||
@@ -23,6 +23,12 @@ | |||
23 | 23 | ||
24 | #define BRCMF_FIL_ACTION_FRAME_SIZE 1800 | 24 | #define BRCMF_FIL_ACTION_FRAME_SIZE 1800 |
25 | 25 | ||
26 | /* ARP Offload feature flags for arp_ol iovar */ | ||
27 | #define BRCMF_ARP_OL_AGENT 0x00000001 | ||
28 | #define BRCMF_ARP_OL_SNOOP 0x00000002 | ||
29 | #define BRCMF_ARP_OL_HOST_AUTO_REPLY 0x00000004 | ||
30 | #define BRCMF_ARP_OL_PEER_AUTO_REPLY 0x00000008 | ||
31 | |||
26 | 32 | ||
27 | enum brcmf_fil_p2p_if_types { | 33 | enum brcmf_fil_p2p_if_types { |
28 | BRCMF_FIL_P2P_IF_CLIENT, | 34 | BRCMF_FIL_P2P_IF_CLIENT, |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c index e7a1a4770996..79555f006d53 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #define IS_P2P_SOCIAL_CHANNEL(channel) ((channel == SOCIAL_CHAN_1) || \ | 47 | #define IS_P2P_SOCIAL_CHANNEL(channel) ((channel == SOCIAL_CHAN_1) || \ |
48 | (channel == SOCIAL_CHAN_2) || \ | 48 | (channel == SOCIAL_CHAN_2) || \ |
49 | (channel == SOCIAL_CHAN_3)) | 49 | (channel == SOCIAL_CHAN_3)) |
50 | #define BRCMF_P2P_TEMP_CHAN SOCIAL_CHAN_3 | ||
50 | #define SOCIAL_CHAN_CNT 3 | 51 | #define SOCIAL_CHAN_CNT 3 |
51 | #define AF_PEER_SEARCH_CNT 2 | 52 | #define AF_PEER_SEARCH_CNT 2 |
52 | 53 | ||
@@ -1954,21 +1955,21 @@ s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg) | |||
1954 | err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1); | 1955 | err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1); |
1955 | if (err < 0) { | 1956 | if (err < 0) { |
1956 | brcmf_err("set p2p_disc error\n"); | 1957 | brcmf_err("set p2p_disc error\n"); |
1957 | brcmf_free_vif(p2p_vif); | 1958 | brcmf_free_vif(cfg, p2p_vif); |
1958 | goto exit; | 1959 | goto exit; |
1959 | } | 1960 | } |
1960 | /* obtain bsscfg index for P2P discovery */ | 1961 | /* obtain bsscfg index for P2P discovery */ |
1961 | err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx); | 1962 | err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx); |
1962 | if (err < 0) { | 1963 | if (err < 0) { |
1963 | brcmf_err("retrieving discover bsscfg index failed\n"); | 1964 | brcmf_err("retrieving discover bsscfg index failed\n"); |
1964 | brcmf_free_vif(p2p_vif); | 1965 | brcmf_free_vif(cfg, p2p_vif); |
1965 | goto exit; | 1966 | goto exit; |
1966 | } | 1967 | } |
1967 | /* Verify that firmware uses same bssidx as driver !! */ | 1968 | /* Verify that firmware uses same bssidx as driver !! */ |
1968 | if (p2p_ifp->bssidx != bssidx) { | 1969 | if (p2p_ifp->bssidx != bssidx) { |
1969 | brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n", | 1970 | brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n", |
1970 | bssidx, p2p_ifp->bssidx); | 1971 | bssidx, p2p_ifp->bssidx); |
1971 | brcmf_free_vif(p2p_vif); | 1972 | brcmf_free_vif(cfg, p2p_vif); |
1972 | goto exit; | 1973 | goto exit; |
1973 | } | 1974 | } |
1974 | 1975 | ||
@@ -1996,7 +1997,7 @@ void brcmf_p2p_detach(struct brcmf_p2p_info *p2p) | |||
1996 | brcmf_p2p_cancel_remain_on_channel(vif->ifp); | 1997 | brcmf_p2p_cancel_remain_on_channel(vif->ifp); |
1997 | brcmf_p2p_deinit_discovery(p2p); | 1998 | brcmf_p2p_deinit_discovery(p2p); |
1998 | /* remove discovery interface */ | 1999 | /* remove discovery interface */ |
1999 | brcmf_free_vif(vif); | 2000 | brcmf_free_vif(p2p->cfg, vif); |
2000 | p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL; | 2001 | p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL; |
2001 | } | 2002 | } |
2002 | /* just set it all to zero */ | 2003 | /* just set it all to zero */ |
@@ -2013,17 +2014,30 @@ static void brcmf_p2p_get_current_chanspec(struct brcmf_p2p_info *p2p, | |||
2013 | u16 *chanspec) | 2014 | u16 *chanspec) |
2014 | { | 2015 | { |
2015 | struct brcmf_if *ifp; | 2016 | struct brcmf_if *ifp; |
2016 | struct brcmf_fil_chan_info_le ci; | 2017 | u8 mac_addr[ETH_ALEN]; |
2017 | struct brcmu_chan ch; | 2018 | struct brcmu_chan ch; |
2018 | s32 err; | 2019 | struct brcmf_bss_info_le *bi; |
2020 | u8 *buf; | ||
2019 | 2021 | ||
2020 | ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; | 2022 | ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; |
2021 | 2023 | ||
2022 | ch.chnum = 11; | 2024 | if (brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSSID, mac_addr, |
2023 | 2025 | ETH_ALEN) == 0) { | |
2024 | err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_CHANNEL, &ci, sizeof(ci)); | 2026 | buf = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL); |
2025 | if (!err) | 2027 | if (buf != NULL) { |
2026 | ch.chnum = le32_to_cpu(ci.hw_channel); | 2028 | *(__le32 *)buf = cpu_to_le32(WL_BSS_INFO_MAX); |
2029 | if (brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, | ||
2030 | buf, WL_BSS_INFO_MAX) == 0) { | ||
2031 | bi = (struct brcmf_bss_info_le *)(buf + 4); | ||
2032 | *chanspec = le16_to_cpu(bi->chanspec); | ||
2033 | kfree(buf); | ||
2034 | return; | ||
2035 | } | ||
2036 | kfree(buf); | ||
2037 | } | ||
2038 | } | ||
2039 | /* Use default channel for P2P */ | ||
2040 | ch.chnum = BRCMF_P2P_TEMP_CHAN; | ||
2027 | ch.bw = BRCMU_CHAN_BW_20; | 2041 | ch.bw = BRCMU_CHAN_BW_20; |
2028 | p2p->cfg->d11inf.encchspec(&ch); | 2042 | p2p->cfg->d11inf.encchspec(&ch); |
2029 | *chanspec = ch.chspec; | 2043 | *chanspec = ch.chspec; |
@@ -2208,7 +2222,7 @@ static struct wireless_dev *brcmf_p2p_create_p2pdev(struct brcmf_p2p_info *p2p, | |||
2208 | return &p2p_vif->wdev; | 2222 | return &p2p_vif->wdev; |
2209 | 2223 | ||
2210 | fail: | 2224 | fail: |
2211 | brcmf_free_vif(p2p_vif); | 2225 | brcmf_free_vif(p2p->cfg, p2p_vif); |
2212 | return ERR_PTR(err); | 2226 | return ERR_PTR(err); |
2213 | } | 2227 | } |
2214 | 2228 | ||
@@ -2217,13 +2231,31 @@ fail: | |||
2217 | * | 2231 | * |
2218 | * @vif: virtual interface object to delete. | 2232 | * @vif: virtual interface object to delete. |
2219 | */ | 2233 | */ |
2220 | static void brcmf_p2p_delete_p2pdev(struct brcmf_cfg80211_vif *vif) | 2234 | static void brcmf_p2p_delete_p2pdev(struct brcmf_cfg80211_info *cfg, |
2235 | struct brcmf_cfg80211_vif *vif) | ||
2221 | { | 2236 | { |
2222 | struct brcmf_p2p_info *p2p = &vif->ifp->drvr->config->p2p; | ||
2223 | |||
2224 | cfg80211_unregister_wdev(&vif->wdev); | 2237 | cfg80211_unregister_wdev(&vif->wdev); |
2225 | p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL; | 2238 | cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL; |
2226 | brcmf_free_vif(vif); | 2239 | brcmf_free_vif(cfg, vif); |
2240 | } | ||
2241 | |||
2242 | /** | ||
2243 | * brcmf_p2p_free_p2p_if() - free up net device related data. | ||
2244 | * | ||
2245 | * @ndev: net device that needs to be freed. | ||
2246 | */ | ||
2247 | static void brcmf_p2p_free_p2p_if(struct net_device *ndev) | ||
2248 | { | ||
2249 | struct brcmf_cfg80211_info *cfg; | ||
2250 | struct brcmf_cfg80211_vif *vif; | ||
2251 | struct brcmf_if *ifp; | ||
2252 | |||
2253 | ifp = netdev_priv(ndev); | ||
2254 | cfg = ifp->drvr->config; | ||
2255 | vif = ifp->vif; | ||
2256 | |||
2257 | brcmf_free_vif(cfg, vif); | ||
2258 | free_netdev(ifp->ndev); | ||
2227 | } | 2259 | } |
2228 | 2260 | ||
2229 | /** | 2261 | /** |
@@ -2303,6 +2335,9 @@ struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name, | |||
2303 | brcmf_err("Registering netdevice failed\n"); | 2335 | brcmf_err("Registering netdevice failed\n"); |
2304 | goto fail; | 2336 | goto fail; |
2305 | } | 2337 | } |
2338 | /* override destructor */ | ||
2339 | ifp->ndev->destructor = brcmf_p2p_free_p2p_if; | ||
2340 | |||
2306 | cfg->p2p.bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = vif; | 2341 | cfg->p2p.bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = vif; |
2307 | /* Disable firmware roaming for P2P interface */ | 2342 | /* Disable firmware roaming for P2P interface */ |
2308 | brcmf_fil_iovar_int_set(ifp, "roam_off", 1); | 2343 | brcmf_fil_iovar_int_set(ifp, "roam_off", 1); |
@@ -2314,7 +2349,7 @@ struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name, | |||
2314 | return &ifp->vif->wdev; | 2349 | return &ifp->vif->wdev; |
2315 | 2350 | ||
2316 | fail: | 2351 | fail: |
2317 | brcmf_free_vif(vif); | 2352 | brcmf_free_vif(cfg, vif); |
2318 | return ERR_PTR(err); | 2353 | return ERR_PTR(err); |
2319 | } | 2354 | } |
2320 | 2355 | ||
@@ -2350,7 +2385,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev) | |||
2350 | break; | 2385 | break; |
2351 | 2386 | ||
2352 | case NL80211_IFTYPE_P2P_DEVICE: | 2387 | case NL80211_IFTYPE_P2P_DEVICE: |
2353 | brcmf_p2p_delete_p2pdev(vif); | 2388 | brcmf_p2p_delete_p2pdev(cfg, vif); |
2354 | return 0; | 2389 | return 0; |
2355 | default: | 2390 | default: |
2356 | return -ENOTSUPP; | 2391 | return -ENOTSUPP; |
@@ -2378,7 +2413,6 @@ int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev) | |||
2378 | err = 0; | 2413 | err = 0; |
2379 | } | 2414 | } |
2380 | brcmf_cfg80211_arm_vif_event(cfg, NULL); | 2415 | brcmf_cfg80211_arm_vif_event(cfg, NULL); |
2381 | brcmf_free_vif(vif); | ||
2382 | p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = NULL; | 2416 | p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = NULL; |
2383 | 2417 | ||
2384 | return err; | 2418 | return err; |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 6d758f285352..301e572e8923 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -459,6 +459,38 @@ send_key_to_dongle(struct net_device *ndev, struct brcmf_wsec_key *key) | |||
459 | return err; | 459 | return err; |
460 | } | 460 | } |
461 | 461 | ||
462 | static s32 | ||
463 | brcmf_configure_arp_offload(struct brcmf_if *ifp, bool enable) | ||
464 | { | ||
465 | s32 err; | ||
466 | u32 mode; | ||
467 | |||
468 | if (enable) | ||
469 | mode = BRCMF_ARP_OL_AGENT | BRCMF_ARP_OL_PEER_AUTO_REPLY; | ||
470 | else | ||
471 | mode = 0; | ||
472 | |||
473 | /* Try to set and enable ARP offload feature, this may fail, then it */ | ||
474 | /* is simply not supported and err 0 will be returned */ | ||
475 | err = brcmf_fil_iovar_int_set(ifp, "arp_ol", mode); | ||
476 | if (err) { | ||
477 | brcmf_dbg(TRACE, "failed to set ARP offload mode to 0x%x, err = %d\n", | ||
478 | mode, err); | ||
479 | err = 0; | ||
480 | } else { | ||
481 | err = brcmf_fil_iovar_int_set(ifp, "arpoe", enable); | ||
482 | if (err) { | ||
483 | brcmf_dbg(TRACE, "failed to configure (%d) ARP offload err = %d\n", | ||
484 | enable, err); | ||
485 | err = 0; | ||
486 | } else | ||
487 | brcmf_dbg(TRACE, "successfully configured (%d) ARP offload to 0x%x\n", | ||
488 | enable, mode); | ||
489 | } | ||
490 | |||
491 | return err; | ||
492 | } | ||
493 | |||
462 | static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy, | 494 | static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy, |
463 | const char *name, | 495 | const char *name, |
464 | enum nl80211_iftype type, | 496 | enum nl80211_iftype type, |
@@ -2216,6 +2248,11 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev, | |||
2216 | } | 2248 | } |
2217 | 2249 | ||
2218 | pm = enabled ? PM_FAST : PM_OFF; | 2250 | pm = enabled ? PM_FAST : PM_OFF; |
2251 | /* Do not enable the power save after assoc if it is a p2p interface */ | ||
2252 | if (ifp->vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT) { | ||
2253 | brcmf_dbg(INFO, "Do not enable power save for P2P clients\n"); | ||
2254 | pm = PM_OFF; | ||
2255 | } | ||
2219 | brcmf_dbg(INFO, "power save %s\n", (pm ? "enabled" : "disabled")); | 2256 | brcmf_dbg(INFO, "power save %s\n", (pm ? "enabled" : "disabled")); |
2220 | 2257 | ||
2221 | err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm); | 2258 | err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm); |
@@ -3640,10 +3677,28 @@ brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif, | |||
3640 | } | 3677 | } |
3641 | 3678 | ||
3642 | static s32 | 3679 | static s32 |
3680 | brcmf_cfg80211_set_channel(struct brcmf_cfg80211_info *cfg, | ||
3681 | struct brcmf_if *ifp, | ||
3682 | struct ieee80211_channel *channel) | ||
3683 | { | ||
3684 | u16 chanspec; | ||
3685 | s32 err; | ||
3686 | |||
3687 | brcmf_dbg(TRACE, "band=%d, center_freq=%d\n", channel->band, | ||
3688 | channel->center_freq); | ||
3689 | |||
3690 | chanspec = channel_to_chanspec(&cfg->d11inf, channel); | ||
3691 | err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); | ||
3692 | |||
3693 | return err; | ||
3694 | } | ||
3695 | |||
3696 | static s32 | ||
3643 | brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, | 3697 | brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, |
3644 | struct cfg80211_ap_settings *settings) | 3698 | struct cfg80211_ap_settings *settings) |
3645 | { | 3699 | { |
3646 | s32 ie_offset; | 3700 | s32 ie_offset; |
3701 | struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); | ||
3647 | struct brcmf_if *ifp = netdev_priv(ndev); | 3702 | struct brcmf_if *ifp = netdev_priv(ndev); |
3648 | struct brcmf_tlv *ssid_ie; | 3703 | struct brcmf_tlv *ssid_ie; |
3649 | struct brcmf_ssid_le ssid_le; | 3704 | struct brcmf_ssid_le ssid_le; |
@@ -3683,6 +3738,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, | |||
3683 | } | 3738 | } |
3684 | 3739 | ||
3685 | brcmf_set_mpc(ifp, 0); | 3740 | brcmf_set_mpc(ifp, 0); |
3741 | brcmf_configure_arp_offload(ifp, false); | ||
3686 | 3742 | ||
3687 | /* find the RSN_IE */ | 3743 | /* find the RSN_IE */ |
3688 | rsn_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail, | 3744 | rsn_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail, |
@@ -3713,6 +3769,12 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, | |||
3713 | 3769 | ||
3714 | brcmf_config_ap_mgmt_ie(ifp->vif, &settings->beacon); | 3770 | brcmf_config_ap_mgmt_ie(ifp->vif, &settings->beacon); |
3715 | 3771 | ||
3772 | err = brcmf_cfg80211_set_channel(cfg, ifp, settings->chandef.chan); | ||
3773 | if (err < 0) { | ||
3774 | brcmf_err("Set Channel failed, %d\n", err); | ||
3775 | goto exit; | ||
3776 | } | ||
3777 | |||
3716 | if (settings->beacon_interval) { | 3778 | if (settings->beacon_interval) { |
3717 | err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, | 3779 | err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, |
3718 | settings->beacon_interval); | 3780 | settings->beacon_interval); |
@@ -3789,8 +3851,10 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, | |||
3789 | set_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); | 3851 | set_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); |
3790 | 3852 | ||
3791 | exit: | 3853 | exit: |
3792 | if (err) | 3854 | if (err) { |
3793 | brcmf_set_mpc(ifp, 1); | 3855 | brcmf_set_mpc(ifp, 1); |
3856 | brcmf_configure_arp_offload(ifp, true); | ||
3857 | } | ||
3794 | return err; | 3858 | return err; |
3795 | } | 3859 | } |
3796 | 3860 | ||
@@ -3831,6 +3895,7 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) | |||
3831 | brcmf_err("bss_enable config failed %d\n", err); | 3895 | brcmf_err("bss_enable config failed %d\n", err); |
3832 | } | 3896 | } |
3833 | brcmf_set_mpc(ifp, 1); | 3897 | brcmf_set_mpc(ifp, 1); |
3898 | brcmf_configure_arp_offload(ifp, true); | ||
3834 | set_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state); | 3899 | set_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state); |
3835 | clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); | 3900 | clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); |
3836 | 3901 | ||
@@ -4140,11 +4205,15 @@ static const struct ieee80211_iface_limit brcmf_iface_limits[] = { | |||
4140 | .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | | 4205 | .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | |
4141 | BIT(NL80211_IFTYPE_P2P_GO) | 4206 | BIT(NL80211_IFTYPE_P2P_GO) |
4142 | }, | 4207 | }, |
4208 | { | ||
4209 | .max = 1, | ||
4210 | .types = BIT(NL80211_IFTYPE_P2P_DEVICE) | ||
4211 | } | ||
4143 | }; | 4212 | }; |
4144 | static const struct ieee80211_iface_combination brcmf_iface_combos[] = { | 4213 | static const struct ieee80211_iface_combination brcmf_iface_combos[] = { |
4145 | { | 4214 | { |
4146 | .max_interfaces = BRCMF_IFACE_MAX_CNT, | 4215 | .max_interfaces = BRCMF_IFACE_MAX_CNT, |
4147 | .num_different_channels = 1, /* no multi-channel for now */ | 4216 | .num_different_channels = 2, |
4148 | .n_limits = ARRAY_SIZE(brcmf_iface_limits), | 4217 | .n_limits = ARRAY_SIZE(brcmf_iface_limits), |
4149 | .limits = brcmf_iface_limits | 4218 | .limits = brcmf_iface_limits |
4150 | } | 4219 | } |
@@ -4197,7 +4266,8 @@ static struct wiphy *brcmf_setup_wiphy(struct device *phydev) | |||
4197 | BIT(NL80211_IFTYPE_ADHOC) | | 4266 | BIT(NL80211_IFTYPE_ADHOC) | |
4198 | BIT(NL80211_IFTYPE_AP) | | 4267 | BIT(NL80211_IFTYPE_AP) | |
4199 | BIT(NL80211_IFTYPE_P2P_CLIENT) | | 4268 | BIT(NL80211_IFTYPE_P2P_CLIENT) | |
4200 | BIT(NL80211_IFTYPE_P2P_GO); | 4269 | BIT(NL80211_IFTYPE_P2P_GO) | |
4270 | BIT(NL80211_IFTYPE_P2P_DEVICE); | ||
4201 | wiphy->iface_combinations = brcmf_iface_combos; | 4271 | wiphy->iface_combinations = brcmf_iface_combos; |
4202 | wiphy->n_iface_combinations = ARRAY_SIZE(brcmf_iface_combos); | 4272 | wiphy->n_iface_combinations = ARRAY_SIZE(brcmf_iface_combos); |
4203 | wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz; | 4273 | wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz; |
@@ -4251,20 +4321,16 @@ struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg, | |||
4251 | return vif; | 4321 | return vif; |
4252 | } | 4322 | } |
4253 | 4323 | ||
4254 | void brcmf_free_vif(struct brcmf_cfg80211_vif *vif) | 4324 | void brcmf_free_vif(struct brcmf_cfg80211_info *cfg, |
4325 | struct brcmf_cfg80211_vif *vif) | ||
4255 | { | 4326 | { |
4256 | struct brcmf_cfg80211_info *cfg; | ||
4257 | struct wiphy *wiphy; | ||
4258 | |||
4259 | wiphy = vif->wdev.wiphy; | ||
4260 | cfg = wiphy_priv(wiphy); | ||
4261 | list_del(&vif->list); | 4327 | list_del(&vif->list); |
4262 | cfg->vif_cnt--; | 4328 | cfg->vif_cnt--; |
4263 | 4329 | ||
4264 | kfree(vif); | 4330 | kfree(vif); |
4265 | if (!cfg->vif_cnt) { | 4331 | if (!cfg->vif_cnt) { |
4266 | wiphy_unregister(wiphy); | 4332 | wiphy_unregister(cfg->wiphy); |
4267 | wiphy_free(wiphy); | 4333 | wiphy_free(cfg->wiphy); |
4268 | } | 4334 | } |
4269 | } | 4335 | } |
4270 | 4336 | ||
@@ -4641,7 +4707,6 @@ static s32 brcmf_notify_vif_event(struct brcmf_if *ifp, | |||
4641 | return 0; | 4707 | return 0; |
4642 | 4708 | ||
4643 | case BRCMF_E_IF_DEL: | 4709 | case BRCMF_E_IF_DEL: |
4644 | ifp->vif = NULL; | ||
4645 | mutex_unlock(&event->vif_event_lock); | 4710 | mutex_unlock(&event->vif_event_lock); |
4646 | /* event may not be upon user request */ | 4711 | /* event may not be upon user request */ |
4647 | if (brcmf_cfg80211_vif_event_armed(cfg)) | 4712 | if (brcmf_cfg80211_vif_event_armed(cfg)) |
@@ -4847,8 +4912,7 @@ cfg80211_p2p_attach_out: | |||
4847 | wl_deinit_priv(cfg); | 4912 | wl_deinit_priv(cfg); |
4848 | 4913 | ||
4849 | cfg80211_attach_out: | 4914 | cfg80211_attach_out: |
4850 | brcmf_free_vif(vif); | 4915 | brcmf_free_vif(cfg, vif); |
4851 | wiphy_free(wiphy); | ||
4852 | return NULL; | 4916 | return NULL; |
4853 | } | 4917 | } |
4854 | 4918 | ||
@@ -4860,7 +4924,7 @@ void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg) | |||
4860 | wl_deinit_priv(cfg); | 4924 | wl_deinit_priv(cfg); |
4861 | brcmf_btcoex_detach(cfg); | 4925 | brcmf_btcoex_detach(cfg); |
4862 | list_for_each_entry_safe(vif, tmp, &cfg->vif_list, list) { | 4926 | list_for_each_entry_safe(vif, tmp, &cfg->vif_list, list) { |
4863 | brcmf_free_vif(vif); | 4927 | brcmf_free_vif(cfg, vif); |
4864 | } | 4928 | } |
4865 | } | 4929 | } |
4866 | 4930 | ||
@@ -5224,6 +5288,8 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg) | |||
5224 | if (err) | 5288 | if (err) |
5225 | goto default_conf_out; | 5289 | goto default_conf_out; |
5226 | 5290 | ||
5291 | brcmf_configure_arp_offload(ifp, true); | ||
5292 | |||
5227 | cfg->dongle_up = true; | 5293 | cfg->dongle_up = true; |
5228 | default_conf_out: | 5294 | default_conf_out: |
5229 | 5295 | ||
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h index a71cff84cdcf..d9bdaf9a72d0 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h | |||
@@ -487,7 +487,8 @@ enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp); | |||
487 | struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg, | 487 | struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg, |
488 | enum nl80211_iftype type, | 488 | enum nl80211_iftype type, |
489 | bool pm_block); | 489 | bool pm_block); |
490 | void brcmf_free_vif(struct brcmf_cfg80211_vif *vif); | 490 | void brcmf_free_vif(struct brcmf_cfg80211_info *cfg, |
491 | struct brcmf_cfg80211_vif *vif); | ||
491 | 492 | ||
492 | s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag, | 493 | s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag, |
493 | const u8 *vndr_ie_buf, u32 vndr_ie_len); | 494 | const u8 *vndr_ie_buf, u32 vndr_ie_len); |
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c index 592d0aa634a8..e9a3cbc409ae 100644 --- a/drivers/net/wireless/iwlegacy/common.c +++ b/drivers/net/wireless/iwlegacy/common.c | |||
@@ -1423,7 +1423,7 @@ il_setup_rx_scan_handlers(struct il_priv *il) | |||
1423 | } | 1423 | } |
1424 | EXPORT_SYMBOL(il_setup_rx_scan_handlers); | 1424 | EXPORT_SYMBOL(il_setup_rx_scan_handlers); |
1425 | 1425 | ||
1426 | inline u16 | 1426 | u16 |
1427 | il_get_active_dwell_time(struct il_priv *il, enum ieee80211_band band, | 1427 | il_get_active_dwell_time(struct il_priv *il, enum ieee80211_band band, |
1428 | u8 n_probes) | 1428 | u8 n_probes) |
1429 | { | 1429 | { |
diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h index f8246f2d88f9..4caaf52986a4 100644 --- a/drivers/net/wireless/iwlegacy/common.h +++ b/drivers/net/wireless/iwlegacy/common.h | |||
@@ -1832,16 +1832,16 @@ u32 il_usecs_to_beacons(struct il_priv *il, u32 usec, u32 beacon_interval); | |||
1832 | __le32 il_add_beacon_time(struct il_priv *il, u32 base, u32 addon, | 1832 | __le32 il_add_beacon_time(struct il_priv *il, u32 base, u32 addon, |
1833 | u32 beacon_interval); | 1833 | u32 beacon_interval); |
1834 | 1834 | ||
1835 | #ifdef CONFIG_PM | 1835 | #ifdef CONFIG_PM_SLEEP |
1836 | extern const struct dev_pm_ops il_pm_ops; | 1836 | extern const struct dev_pm_ops il_pm_ops; |
1837 | 1837 | ||
1838 | #define IL_LEGACY_PM_OPS (&il_pm_ops) | 1838 | #define IL_LEGACY_PM_OPS (&il_pm_ops) |
1839 | 1839 | ||
1840 | #else /* !CONFIG_PM */ | 1840 | #else /* !CONFIG_PM_SLEEP */ |
1841 | 1841 | ||
1842 | #define IL_LEGACY_PM_OPS NULL | 1842 | #define IL_LEGACY_PM_OPS NULL |
1843 | 1843 | ||
1844 | #endif /* !CONFIG_PM */ | 1844 | #endif /* !CONFIG_PM_SLEEP */ |
1845 | 1845 | ||
1846 | /***************************************************** | 1846 | /***************************************************** |
1847 | * Error Handling Debugging | 1847 | * Error Handling Debugging |
diff --git a/drivers/net/wireless/iwlwifi/dvm/sta.c b/drivers/net/wireless/iwlwifi/dvm/sta.c index db183b44e038..c3c13ce96eb0 100644 --- a/drivers/net/wireless/iwlwifi/dvm/sta.c +++ b/drivers/net/wireless/iwlwifi/dvm/sta.c | |||
@@ -735,7 +735,7 @@ void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx) | |||
735 | memcpy(&lq, priv->stations[i].lq, | 735 | memcpy(&lq, priv->stations[i].lq, |
736 | sizeof(struct iwl_link_quality_cmd)); | 736 | sizeof(struct iwl_link_quality_cmd)); |
737 | 737 | ||
738 | if (!memcmp(&lq, &zero_lq, sizeof(lq))) | 738 | if (memcmp(&lq, &zero_lq, sizeof(lq))) |
739 | send_lq = true; | 739 | send_lq = true; |
740 | } | 740 | } |
741 | spin_unlock_bh(&priv->sta_lock); | 741 | spin_unlock_bh(&priv->sta_lock); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api.h b/drivers/net/wireless/iwlwifi/mvm/fw-api.h index 191dcae8ba47..c6384555aab4 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api.h | |||
@@ -173,6 +173,8 @@ enum { | |||
173 | REPLY_DEBUG_CMD = 0xf0, | 173 | REPLY_DEBUG_CMD = 0xf0, |
174 | DEBUG_LOG_MSG = 0xf7, | 174 | DEBUG_LOG_MSG = 0xf7, |
175 | 175 | ||
176 | MCAST_FILTER_CMD = 0xd0, | ||
177 | |||
176 | /* D3 commands/notifications */ | 178 | /* D3 commands/notifications */ |
177 | D3_CONFIG_CMD = 0xd3, | 179 | D3_CONFIG_CMD = 0xd3, |
178 | PROT_OFFLOAD_CONFIG_CMD = 0xd4, | 180 | PROT_OFFLOAD_CONFIG_CMD = 0xd4, |
@@ -948,4 +950,29 @@ struct iwl_set_calib_default_cmd { | |||
948 | u8 data[0]; | 950 | u8 data[0]; |
949 | } __packed; /* PHY_CALIB_OVERRIDE_VALUES_S */ | 951 | } __packed; /* PHY_CALIB_OVERRIDE_VALUES_S */ |
950 | 952 | ||
953 | #define MAX_PORT_ID_NUM 2 | ||
954 | |||
955 | /** | ||
956 | * struct iwl_mcast_filter_cmd - configure multicast filter. | ||
957 | * @filter_own: Set 1 to filter out multicast packets sent by station itself | ||
958 | * @port_id: Multicast MAC addresses array specifier. This is a strange way | ||
959 | * to identify network interface adopted in host-device IF. | ||
960 | * It is used by FW as index in array of addresses. This array has | ||
961 | * MAX_PORT_ID_NUM members. | ||
962 | * @count: Number of MAC addresses in the array | ||
963 | * @pass_all: Set 1 to pass all multicast packets. | ||
964 | * @bssid: current association BSSID. | ||
965 | * @addr_list: Place holder for array of MAC addresses. | ||
966 | * IMPORTANT: add padding if necessary to ensure DWORD alignment. | ||
967 | */ | ||
968 | struct iwl_mcast_filter_cmd { | ||
969 | u8 filter_own; | ||
970 | u8 port_id; | ||
971 | u8 count; | ||
972 | u8 pass_all; | ||
973 | u8 bssid[6]; | ||
974 | u8 reserved[2]; | ||
975 | u8 addr_list[0]; | ||
976 | } __packed; /* MCAST_FILTERING_CMD_API_S_VER_1 */ | ||
977 | |||
951 | #endif /* __fw_api_h__ */ | 978 | #endif /* __fw_api_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c index e6eca4d66f6c..b2cc3d98e0f7 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c | |||
@@ -586,10 +586,12 @@ static int iwl_mvm_mac_ctxt_send_cmd(struct iwl_mvm *mvm, | |||
586 | */ | 586 | */ |
587 | static void iwl_mvm_mac_ctxt_cmd_fill_sta(struct iwl_mvm *mvm, | 587 | static void iwl_mvm_mac_ctxt_cmd_fill_sta(struct iwl_mvm *mvm, |
588 | struct ieee80211_vif *vif, | 588 | struct ieee80211_vif *vif, |
589 | struct iwl_mac_data_sta *ctxt_sta) | 589 | struct iwl_mac_data_sta *ctxt_sta, |
590 | bool force_assoc_off) | ||
590 | { | 591 | { |
591 | /* We need the dtim_period to set the MAC as associated */ | 592 | /* We need the dtim_period to set the MAC as associated */ |
592 | if (vif->bss_conf.assoc && vif->bss_conf.dtim_period) { | 593 | if (vif->bss_conf.assoc && vif->bss_conf.dtim_period && |
594 | !force_assoc_off) { | ||
593 | u32 dtim_offs; | 595 | u32 dtim_offs; |
594 | 596 | ||
595 | /* | 597 | /* |
@@ -659,7 +661,8 @@ static int iwl_mvm_mac_ctxt_cmd_station(struct iwl_mvm *mvm, | |||
659 | cmd.filter_flags &= ~cpu_to_le32(MAC_FILTER_IN_BEACON); | 661 | cmd.filter_flags &= ~cpu_to_le32(MAC_FILTER_IN_BEACON); |
660 | 662 | ||
661 | /* Fill the data specific for station mode */ | 663 | /* Fill the data specific for station mode */ |
662 | iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.sta); | 664 | iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.sta, |
665 | action == FW_CTXT_ACTION_ADD); | ||
663 | 666 | ||
664 | return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); | 667 | return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); |
665 | } | 668 | } |
@@ -677,7 +680,8 @@ static int iwl_mvm_mac_ctxt_cmd_p2p_client(struct iwl_mvm *mvm, | |||
677 | iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action); | 680 | iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action); |
678 | 681 | ||
679 | /* Fill the data specific for station mode */ | 682 | /* Fill the data specific for station mode */ |
680 | iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.p2p_sta.sta); | 683 | iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.p2p_sta.sta, |
684 | action == FW_CTXT_ACTION_ADD); | ||
681 | 685 | ||
682 | cmd.p2p_sta.ctwin = cpu_to_le32(noa->oppps_ctwindow & | 686 | cmd.p2p_sta.ctwin = cpu_to_le32(noa->oppps_ctwindow & |
683 | IEEE80211_P2P_OPPPS_CTWINDOW_MASK); | 687 | IEEE80211_P2P_OPPPS_CTWINDOW_MASK); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index dd158ec571fb..a5eb8c82f16a 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
@@ -701,6 +701,20 @@ static void iwl_mvm_configure_filter(struct ieee80211_hw *hw, | |||
701 | *total_flags = 0; | 701 | *total_flags = 0; |
702 | } | 702 | } |
703 | 703 | ||
704 | static int iwl_mvm_configure_mcast_filter(struct iwl_mvm *mvm, | ||
705 | struct ieee80211_vif *vif) | ||
706 | { | ||
707 | struct iwl_mcast_filter_cmd mcast_filter_cmd = { | ||
708 | .pass_all = 1, | ||
709 | }; | ||
710 | |||
711 | memcpy(mcast_filter_cmd.bssid, vif->bss_conf.bssid, ETH_ALEN); | ||
712 | |||
713 | return iwl_mvm_send_cmd_pdu(mvm, MCAST_FILTER_CMD, CMD_SYNC, | ||
714 | sizeof(mcast_filter_cmd), | ||
715 | &mcast_filter_cmd); | ||
716 | } | ||
717 | |||
704 | static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, | 718 | static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, |
705 | struct ieee80211_vif *vif, | 719 | struct ieee80211_vif *vif, |
706 | struct ieee80211_bss_conf *bss_conf, | 720 | struct ieee80211_bss_conf *bss_conf, |
@@ -722,6 +736,7 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, | |||
722 | return; | 736 | return; |
723 | } | 737 | } |
724 | iwl_mvm_bt_coex_vif_assoc(mvm, vif); | 738 | iwl_mvm_bt_coex_vif_assoc(mvm, vif); |
739 | iwl_mvm_configure_mcast_filter(mvm, vif); | ||
725 | } else if (mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) { | 740 | } else if (mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) { |
726 | /* remove AP station now that the MAC is unassoc */ | 741 | /* remove AP station now that the MAC is unassoc */ |
727 | ret = iwl_mvm_rm_sta_id(mvm, vif, mvmvif->ap_sta_id); | 742 | ret = iwl_mvm_rm_sta_id(mvm, vif, mvmvif->ap_sta_id); |
@@ -931,7 +946,7 @@ static void iwl_mvm_mac_sta_notify(struct ieee80211_hw *hw, | |||
931 | 946 | ||
932 | switch (cmd) { | 947 | switch (cmd) { |
933 | case STA_NOTIFY_SLEEP: | 948 | case STA_NOTIFY_SLEEP: |
934 | if (atomic_read(&mvmsta->pending_frames) > 0) | 949 | if (atomic_read(&mvm->pending_frames[mvmsta->sta_id]) > 0) |
935 | ieee80211_sta_block_awake(hw, sta, true); | 950 | ieee80211_sta_block_awake(hw, sta, true); |
936 | /* | 951 | /* |
937 | * The fw updates the STA to be asleep. Tx packets on the Tx | 952 | * The fw updates the STA to be asleep. Tx packets on the Tx |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h index 8269bc562951..9f46b23801bc 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h | |||
@@ -292,6 +292,7 @@ struct iwl_mvm { | |||
292 | struct ieee80211_sta __rcu *fw_id_to_mac_id[IWL_MVM_STATION_COUNT]; | 292 | struct ieee80211_sta __rcu *fw_id_to_mac_id[IWL_MVM_STATION_COUNT]; |
293 | struct work_struct sta_drained_wk; | 293 | struct work_struct sta_drained_wk; |
294 | unsigned long sta_drained[BITS_TO_LONGS(IWL_MVM_STATION_COUNT)]; | 294 | unsigned long sta_drained[BITS_TO_LONGS(IWL_MVM_STATION_COUNT)]; |
295 | atomic_t pending_frames[IWL_MVM_STATION_COUNT]; | ||
295 | 296 | ||
296 | /* configured by mac80211 */ | 297 | /* configured by mac80211 */ |
297 | u32 rts_threshold; | 298 | u32 rts_threshold; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c index fe031d304d1e..b29c31a41594 100644 --- a/drivers/net/wireless/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/iwlwifi/mvm/ops.c | |||
@@ -292,6 +292,7 @@ static const char *iwl_mvm_cmd_strings[REPLY_MAX] = { | |||
292 | CMD(BT_COEX_PROT_ENV), | 292 | CMD(BT_COEX_PROT_ENV), |
293 | CMD(BT_PROFILE_NOTIFICATION), | 293 | CMD(BT_PROFILE_NOTIFICATION), |
294 | CMD(BT_CONFIG), | 294 | CMD(BT_CONFIG), |
295 | CMD(MCAST_FILTER_CMD), | ||
295 | }; | 296 | }; |
296 | #undef CMD | 297 | #undef CMD |
297 | 298 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c index 2157b0f8ced5..2476e43799d5 100644 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/iwlwifi/mvm/scan.c | |||
@@ -298,6 +298,12 @@ int iwl_mvm_scan_request(struct iwl_mvm *mvm, | |||
298 | else | 298 | else |
299 | cmd->type = cpu_to_le32(SCAN_TYPE_FORCED); | 299 | cmd->type = cpu_to_le32(SCAN_TYPE_FORCED); |
300 | 300 | ||
301 | /* | ||
302 | * TODO: This is a WA due to a bug in the FW AUX framework that does not | ||
303 | * properly handle time events that fail to be scheduled | ||
304 | */ | ||
305 | cmd->type = cpu_to_le32(SCAN_TYPE_FORCED); | ||
306 | |||
301 | cmd->repeats = cpu_to_le32(1); | 307 | cmd->repeats = cpu_to_le32(1); |
302 | 308 | ||
303 | /* | 309 | /* |
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c b/drivers/net/wireless/iwlwifi/mvm/sta.c index 0fd96e4da461..5c664ed54400 100644 --- a/drivers/net/wireless/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/iwlwifi/mvm/sta.c | |||
@@ -219,7 +219,7 @@ int iwl_mvm_add_sta(struct iwl_mvm *mvm, | |||
219 | mvm_sta->max_agg_bufsize = LINK_QUAL_AGG_FRAME_LIMIT_DEF; | 219 | mvm_sta->max_agg_bufsize = LINK_QUAL_AGG_FRAME_LIMIT_DEF; |
220 | 220 | ||
221 | /* HW restart, don't assume the memory has been zeroed */ | 221 | /* HW restart, don't assume the memory has been zeroed */ |
222 | atomic_set(&mvm_sta->pending_frames, 0); | 222 | atomic_set(&mvm->pending_frames[sta_id], 0); |
223 | mvm_sta->tid_disable_agg = 0; | 223 | mvm_sta->tid_disable_agg = 0; |
224 | mvm_sta->tfd_queue_msk = 0; | 224 | mvm_sta->tfd_queue_msk = 0; |
225 | for (i = 0; i < IEEE80211_NUM_ACS; i++) | 225 | for (i = 0; i < IEEE80211_NUM_ACS; i++) |
@@ -407,14 +407,21 @@ int iwl_mvm_rm_sta(struct iwl_mvm *mvm, | |||
407 | } | 407 | } |
408 | 408 | ||
409 | /* | 409 | /* |
410 | * Make sure that the tx response code sees the station as -EBUSY and | ||
411 | * calls the drain worker. | ||
412 | */ | ||
413 | spin_lock_bh(&mvm_sta->lock); | ||
414 | /* | ||
410 | * There are frames pending on the AC queues for this station. | 415 | * There are frames pending on the AC queues for this station. |
411 | * We need to wait until all the frames are drained... | 416 | * We need to wait until all the frames are drained... |
412 | */ | 417 | */ |
413 | if (atomic_read(&mvm_sta->pending_frames)) { | 418 | if (atomic_read(&mvm->pending_frames[mvm_sta->sta_id])) { |
414 | ret = iwl_mvm_drain_sta(mvm, mvm_sta, true); | ||
415 | rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id], | 419 | rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id], |
416 | ERR_PTR(-EBUSY)); | 420 | ERR_PTR(-EBUSY)); |
421 | spin_unlock_bh(&mvm_sta->lock); | ||
422 | ret = iwl_mvm_drain_sta(mvm, mvm_sta, true); | ||
417 | } else { | 423 | } else { |
424 | spin_unlock_bh(&mvm_sta->lock); | ||
418 | ret = iwl_mvm_rm_sta_common(mvm, mvm_sta->sta_id); | 425 | ret = iwl_mvm_rm_sta_common(mvm, mvm_sta->sta_id); |
419 | rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id], NULL); | 426 | rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id], NULL); |
420 | } | 427 | } |
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.h b/drivers/net/wireless/iwlwifi/mvm/sta.h index 12abd2d71835..a4ddce77aaae 100644 --- a/drivers/net/wireless/iwlwifi/mvm/sta.h +++ b/drivers/net/wireless/iwlwifi/mvm/sta.h | |||
@@ -274,7 +274,6 @@ struct iwl_mvm_tid_data { | |||
274 | * @bt_reduced_txpower: is reduced tx power enabled for this station | 274 | * @bt_reduced_txpower: is reduced tx power enabled for this station |
275 | * @lock: lock to protect the whole struct. Since %tid_data is access from Tx | 275 | * @lock: lock to protect the whole struct. Since %tid_data is access from Tx |
276 | * and from Tx response flow, it needs a spinlock. | 276 | * and from Tx response flow, it needs a spinlock. |
277 | * @pending_frames: number of frames for this STA on the shared Tx queues. | ||
278 | * @tid_data: per tid data. Look at %iwl_mvm_tid_data. | 277 | * @tid_data: per tid data. Look at %iwl_mvm_tid_data. |
279 | * | 278 | * |
280 | * When mac80211 creates a station it reserves some space (hw->sta_data_size) | 279 | * When mac80211 creates a station it reserves some space (hw->sta_data_size) |
@@ -290,7 +289,6 @@ struct iwl_mvm_sta { | |||
290 | u8 max_agg_bufsize; | 289 | u8 max_agg_bufsize; |
291 | bool bt_reduced_txpower; | 290 | bool bt_reduced_txpower; |
292 | spinlock_t lock; | 291 | spinlock_t lock; |
293 | atomic_t pending_frames; | ||
294 | struct iwl_mvm_tid_data tid_data[IWL_MAX_TID_COUNT]; | 292 | struct iwl_mvm_tid_data tid_data[IWL_MAX_TID_COUNT]; |
295 | struct iwl_lq_sta lq_sta; | 293 | struct iwl_lq_sta lq_sta; |
296 | struct ieee80211_vif *vif; | 294 | struct ieee80211_vif *vif; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c index 479074303bd7..f212f16502ff 100644 --- a/drivers/net/wireless/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/iwlwifi/mvm/tx.c | |||
@@ -416,9 +416,8 @@ int iwl_mvm_tx_skb(struct iwl_mvm *mvm, struct sk_buff *skb, | |||
416 | 416 | ||
417 | spin_unlock(&mvmsta->lock); | 417 | spin_unlock(&mvmsta->lock); |
418 | 418 | ||
419 | if (mvmsta->vif->type == NL80211_IFTYPE_AP && | 419 | if (txq_id < IWL_MVM_FIRST_AGG_QUEUE) |
420 | txq_id < IWL_MVM_FIRST_AGG_QUEUE) | 420 | atomic_inc(&mvm->pending_frames[mvmsta->sta_id]); |
421 | atomic_inc(&mvmsta->pending_frames); | ||
422 | 421 | ||
423 | return 0; | 422 | return 0; |
424 | 423 | ||
@@ -680,16 +679,41 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm, | |||
680 | /* | 679 | /* |
681 | * If the txq is not an AMPDU queue, there is no chance we freed | 680 | * If the txq is not an AMPDU queue, there is no chance we freed |
682 | * several skbs. Check that out... | 681 | * several skbs. Check that out... |
683 | * If there are no pending frames for this STA, notify mac80211 that | ||
684 | * this station can go to sleep in its STA table. | ||
685 | */ | 682 | */ |
686 | if (txq_id < IWL_MVM_FIRST_AGG_QUEUE && mvmsta && | 683 | if (txq_id < IWL_MVM_FIRST_AGG_QUEUE && !WARN_ON(skb_freed > 1) && |
687 | !WARN_ON(skb_freed > 1) && | 684 | atomic_sub_and_test(skb_freed, &mvm->pending_frames[sta_id])) { |
688 | mvmsta->vif->type == NL80211_IFTYPE_AP && | 685 | if (mvmsta) { |
689 | atomic_sub_and_test(skb_freed, &mvmsta->pending_frames)) { | 686 | /* |
690 | ieee80211_sta_block_awake(mvm->hw, sta, false); | 687 | * If there are no pending frames for this STA, notify |
691 | set_bit(sta_id, mvm->sta_drained); | 688 | * mac80211 that this station can go to sleep in its |
692 | schedule_work(&mvm->sta_drained_wk); | 689 | * STA table. |
690 | */ | ||
691 | if (mvmsta->vif->type == NL80211_IFTYPE_AP) | ||
692 | ieee80211_sta_block_awake(mvm->hw, sta, false); | ||
693 | /* | ||
694 | * We might very well have taken mvmsta pointer while | ||
695 | * the station was being removed. The remove flow might | ||
696 | * have seen a pending_frame (because we didn't take | ||
697 | * the lock) even if now the queues are drained. So make | ||
698 | * really sure now that this the station is not being | ||
699 | * removed. If it is, run the drain worker to remove it. | ||
700 | */ | ||
701 | spin_lock_bh(&mvmsta->lock); | ||
702 | sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); | ||
703 | if (IS_ERR_OR_NULL(sta)) { | ||
704 | /* | ||
705 | * Station disappeared in the meantime: | ||
706 | * so we are draining. | ||
707 | */ | ||
708 | set_bit(sta_id, mvm->sta_drained); | ||
709 | schedule_work(&mvm->sta_drained_wk); | ||
710 | } | ||
711 | spin_unlock_bh(&mvmsta->lock); | ||
712 | } else if (!mvmsta) { | ||
713 | /* Tx response without STA, so we are draining */ | ||
714 | set_bit(sta_id, mvm->sta_drained); | ||
715 | schedule_work(&mvm->sta_drained_wk); | ||
716 | } | ||
693 | } | 717 | } |
694 | 718 | ||
695 | rcu_read_unlock(); | 719 | rcu_read_unlock(); |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index b878a32e7a98..cb34c7895f2a 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -1723,11 +1723,11 @@ static void mac80211_hwsim_free(void) | |||
1723 | class_destroy(hwsim_class); | 1723 | class_destroy(hwsim_class); |
1724 | } | 1724 | } |
1725 | 1725 | ||
1726 | 1726 | static struct platform_driver mac80211_hwsim_driver = { | |
1727 | static struct device_driver mac80211_hwsim_driver = { | 1727 | .driver = { |
1728 | .name = "mac80211_hwsim", | 1728 | .name = "mac80211_hwsim", |
1729 | .bus = &platform_bus_type, | 1729 | .owner = THIS_MODULE, |
1730 | .owner = THIS_MODULE, | 1730 | }, |
1731 | }; | 1731 | }; |
1732 | 1732 | ||
1733 | static const struct net_device_ops hwsim_netdev_ops = { | 1733 | static const struct net_device_ops hwsim_netdev_ops = { |
@@ -2219,7 +2219,7 @@ static int __init init_mac80211_hwsim(void) | |||
2219 | spin_lock_init(&hwsim_radio_lock); | 2219 | spin_lock_init(&hwsim_radio_lock); |
2220 | INIT_LIST_HEAD(&hwsim_radios); | 2220 | INIT_LIST_HEAD(&hwsim_radios); |
2221 | 2221 | ||
2222 | err = driver_register(&mac80211_hwsim_driver); | 2222 | err = platform_driver_register(&mac80211_hwsim_driver); |
2223 | if (err) | 2223 | if (err) |
2224 | return err; | 2224 | return err; |
2225 | 2225 | ||
@@ -2254,7 +2254,7 @@ static int __init init_mac80211_hwsim(void) | |||
2254 | err = -ENOMEM; | 2254 | err = -ENOMEM; |
2255 | goto failed_drvdata; | 2255 | goto failed_drvdata; |
2256 | } | 2256 | } |
2257 | data->dev->driver = &mac80211_hwsim_driver; | 2257 | data->dev->driver = &mac80211_hwsim_driver.driver; |
2258 | err = device_bind_driver(data->dev); | 2258 | err = device_bind_driver(data->dev); |
2259 | if (err != 0) { | 2259 | if (err != 0) { |
2260 | printk(KERN_DEBUG | 2260 | printk(KERN_DEBUG |
@@ -2564,7 +2564,7 @@ failed_drvdata: | |||
2564 | failed: | 2564 | failed: |
2565 | mac80211_hwsim_free(); | 2565 | mac80211_hwsim_free(); |
2566 | failed_unregister_driver: | 2566 | failed_unregister_driver: |
2567 | driver_unregister(&mac80211_hwsim_driver); | 2567 | platform_driver_unregister(&mac80211_hwsim_driver); |
2568 | return err; | 2568 | return err; |
2569 | } | 2569 | } |
2570 | module_init(init_mac80211_hwsim); | 2570 | module_init(init_mac80211_hwsim); |
@@ -2577,6 +2577,6 @@ static void __exit exit_mac80211_hwsim(void) | |||
2577 | 2577 | ||
2578 | mac80211_hwsim_free(); | 2578 | mac80211_hwsim_free(); |
2579 | unregister_netdev(hwsim_mon); | 2579 | unregister_netdev(hwsim_mon); |
2580 | driver_unregister(&mac80211_hwsim_driver); | 2580 | platform_driver_unregister(&mac80211_hwsim_driver); |
2581 | } | 2581 | } |
2582 | module_exit(exit_mac80211_hwsim); | 2582 | module_exit(exit_mac80211_hwsim); |
diff --git a/drivers/net/wireless/mwifiex/debugfs.c b/drivers/net/wireless/mwifiex/debugfs.c index 753b5682d53f..a5f9875cfd6e 100644 --- a/drivers/net/wireless/mwifiex/debugfs.c +++ b/drivers/net/wireless/mwifiex/debugfs.c | |||
@@ -26,10 +26,17 @@ | |||
26 | static struct dentry *mwifiex_dfs_dir; | 26 | static struct dentry *mwifiex_dfs_dir; |
27 | 27 | ||
28 | static char *bss_modes[] = { | 28 | static char *bss_modes[] = { |
29 | "Unknown", | 29 | "UNSPECIFIED", |
30 | "Ad-hoc", | 30 | "ADHOC", |
31 | "Managed", | 31 | "STATION", |
32 | "Auto" | 32 | "AP", |
33 | "AP_VLAN", | ||
34 | "WDS", | ||
35 | "MONITOR", | ||
36 | "MESH_POINT", | ||
37 | "P2P_CLIENT", | ||
38 | "P2P_GO", | ||
39 | "P2P_DEVICE", | ||
33 | }; | 40 | }; |
34 | 41 | ||
35 | /* size/addr for mwifiex_debug_info */ | 42 | /* size/addr for mwifiex_debug_info */ |
@@ -200,7 +207,12 @@ mwifiex_info_read(struct file *file, char __user *ubuf, | |||
200 | p += sprintf(p, "driver_version = %s", fmt); | 207 | p += sprintf(p, "driver_version = %s", fmt); |
201 | p += sprintf(p, "\nverext = %s", priv->version_str); | 208 | p += sprintf(p, "\nverext = %s", priv->version_str); |
202 | p += sprintf(p, "\ninterface_name=\"%s\"\n", netdev->name); | 209 | p += sprintf(p, "\ninterface_name=\"%s\"\n", netdev->name); |
203 | p += sprintf(p, "bss_mode=\"%s\"\n", bss_modes[info.bss_mode]); | 210 | |
211 | if (info.bss_mode >= ARRAY_SIZE(bss_modes)) | ||
212 | p += sprintf(p, "bss_mode=\"%d\"\n", info.bss_mode); | ||
213 | else | ||
214 | p += sprintf(p, "bss_mode=\"%s\"\n", bss_modes[info.bss_mode]); | ||
215 | |||
204 | p += sprintf(p, "media_state=\"%s\"\n", | 216 | p += sprintf(p, "media_state=\"%s\"\n", |
205 | (!priv->media_connected ? "Disconnected" : "Connected")); | 217 | (!priv->media_connected ? "Disconnected" : "Connected")); |
206 | p += sprintf(p, "mac_address=\"%pM\"\n", netdev->dev_addr); | 218 | p += sprintf(p, "mac_address=\"%pM\"\n", netdev->dev_addr); |
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 999ffc12578b..c97e9d327331 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
@@ -764,6 +764,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) | |||
764 | "can't alloc skb for rx\n"); | 764 | "can't alloc skb for rx\n"); |
765 | goto done; | 765 | goto done; |
766 | } | 766 | } |
767 | kmemleak_not_leak(new_skb); | ||
767 | 768 | ||
768 | pci_unmap_single(rtlpci->pdev, | 769 | pci_unmap_single(rtlpci->pdev, |
769 | *((dma_addr_t *) skb->cb), | 770 | *((dma_addr_t *) skb->cb), |
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h index d3a02e73f53a..21ca33a7c770 100644 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h +++ b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h | |||
@@ -550,7 +550,7 @@ do { \ | |||
550 | rxmcs == DESC92C_RATE11M) | 550 | rxmcs == DESC92C_RATE11M) |
551 | 551 | ||
552 | struct phy_rx_agc_info_t { | 552 | struct phy_rx_agc_info_t { |
553 | #if __LITTLE_ENDIAN | 553 | #ifdef __LITTLE_ENDIAN |
554 | u8 gain:7, trsw:1; | 554 | u8 gain:7, trsw:1; |
555 | #else | 555 | #else |
556 | u8 trsw:1, gain:7; | 556 | u8 trsw:1, gain:7; |
@@ -574,7 +574,7 @@ struct phy_status_rpt { | |||
574 | u8 stream_target_csi[2]; | 574 | u8 stream_target_csi[2]; |
575 | u8 sig_evm; | 575 | u8 sig_evm; |
576 | u8 rsvd_3; | 576 | u8 rsvd_3; |
577 | #if __LITTLE_ENDIAN | 577 | #ifdef __LITTLE_ENDIAN |
578 | u8 antsel_rx_keep_2:1; /*ex_intf_flg:1;*/ | 578 | u8 antsel_rx_keep_2:1; /*ex_intf_flg:1;*/ |
579 | u8 sgi_en:1; | 579 | u8 sgi_en:1; |
580 | u8 rxsc:2; | 580 | u8 rxsc:2; |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c index 3d0498e69c8c..189ba124a8c6 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | |||
@@ -1973,26 +1973,35 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
1973 | } | 1973 | } |
1974 | } | 1974 | } |
1975 | 1975 | ||
1976 | void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw, | 1976 | static void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw, |
1977 | struct ieee80211_sta *sta, | 1977 | struct ieee80211_sta *sta) |
1978 | u8 rssi_level) | ||
1979 | { | 1978 | { |
1980 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1979 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1981 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | 1980 | struct rtl_phy *rtlphy = &(rtlpriv->phy); |
1982 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | 1981 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
1983 | u32 ratr_value = (u32) mac->basic_rates; | 1982 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
1984 | u8 *mcsrate = mac->mcs; | 1983 | u32 ratr_value; |
1985 | u8 ratr_index = 0; | 1984 | u8 ratr_index = 0; |
1986 | u8 nmode = mac->ht_enable; | 1985 | u8 nmode = mac->ht_enable; |
1987 | u8 mimo_ps = 1; | 1986 | u8 mimo_ps = IEEE80211_SMPS_OFF; |
1988 | u16 shortgi_rate = 0; | 1987 | u16 shortgi_rate; |
1989 | u32 tmp_ratr_value = 0; | 1988 | u32 tmp_ratr_value; |
1990 | u8 curtxbw_40mhz = mac->bw_40; | 1989 | u8 curtxbw_40mhz = mac->bw_40; |
1991 | u8 curshortgi_40mhz = mac->sgi_40; | 1990 | u8 curshortgi_40mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ? |
1992 | u8 curshortgi_20mhz = mac->sgi_20; | 1991 | 1 : 0; |
1992 | u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ? | ||
1993 | 1 : 0; | ||
1993 | enum wireless_mode wirelessmode = mac->mode; | 1994 | enum wireless_mode wirelessmode = mac->mode; |
1994 | 1995 | ||
1995 | ratr_value |= ((*(u16 *) (mcsrate))) << 12; | 1996 | if (rtlhal->current_bandtype == BAND_ON_5G) |
1997 | ratr_value = sta->supp_rates[1] << 4; | ||
1998 | else | ||
1999 | ratr_value = sta->supp_rates[0]; | ||
2000 | if (mac->opmode == NL80211_IFTYPE_ADHOC) | ||
2001 | ratr_value = 0xfff; | ||
2002 | |||
2003 | ratr_value |= (sta->ht_cap.mcs.rx_mask[1] << 20 | | ||
2004 | sta->ht_cap.mcs.rx_mask[0] << 12); | ||
1996 | switch (wirelessmode) { | 2005 | switch (wirelessmode) { |
1997 | case WIRELESS_MODE_B: | 2006 | case WIRELESS_MODE_B: |
1998 | if (ratr_value & 0x0000000c) | 2007 | if (ratr_value & 0x0000000c) |
@@ -2006,7 +2015,7 @@ void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw, | |||
2006 | case WIRELESS_MODE_N_24G: | 2015 | case WIRELESS_MODE_N_24G: |
2007 | case WIRELESS_MODE_N_5G: | 2016 | case WIRELESS_MODE_N_5G: |
2008 | nmode = 1; | 2017 | nmode = 1; |
2009 | if (mimo_ps == 0) { | 2018 | if (mimo_ps == IEEE80211_SMPS_STATIC) { |
2010 | ratr_value &= 0x0007F005; | 2019 | ratr_value &= 0x0007F005; |
2011 | } else { | 2020 | } else { |
2012 | u32 ratr_mask; | 2021 | u32 ratr_mask; |
@@ -2016,8 +2025,7 @@ void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw, | |||
2016 | ratr_mask = 0x000ff005; | 2025 | ratr_mask = 0x000ff005; |
2017 | else | 2026 | else |
2018 | ratr_mask = 0x0f0ff005; | 2027 | ratr_mask = 0x0f0ff005; |
2019 | if (curtxbw_40mhz) | 2028 | |
2020 | ratr_mask |= 0x00000010; | ||
2021 | ratr_value &= ratr_mask; | 2029 | ratr_value &= ratr_mask; |
2022 | } | 2030 | } |
2023 | break; | 2031 | break; |
@@ -2026,41 +2034,74 @@ void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw, | |||
2026 | ratr_value &= 0x000ff0ff; | 2034 | ratr_value &= 0x000ff0ff; |
2027 | else | 2035 | else |
2028 | ratr_value &= 0x0f0ff0ff; | 2036 | ratr_value &= 0x0f0ff0ff; |
2037 | |||
2029 | break; | 2038 | break; |
2030 | } | 2039 | } |
2040 | |||
2031 | ratr_value &= 0x0FFFFFFF; | 2041 | ratr_value &= 0x0FFFFFFF; |
2032 | if (nmode && ((curtxbw_40mhz && curshortgi_40mhz) || | 2042 | |
2033 | (!curtxbw_40mhz && curshortgi_20mhz))) { | 2043 | if (nmode && ((curtxbw_40mhz && |
2044 | curshortgi_40mhz) || (!curtxbw_40mhz && | ||
2045 | curshortgi_20mhz))) { | ||
2046 | |||
2034 | ratr_value |= 0x10000000; | 2047 | ratr_value |= 0x10000000; |
2035 | tmp_ratr_value = (ratr_value >> 12); | 2048 | tmp_ratr_value = (ratr_value >> 12); |
2049 | |||
2036 | for (shortgi_rate = 15; shortgi_rate > 0; shortgi_rate--) { | 2050 | for (shortgi_rate = 15; shortgi_rate > 0; shortgi_rate--) { |
2037 | if ((1 << shortgi_rate) & tmp_ratr_value) | 2051 | if ((1 << shortgi_rate) & tmp_ratr_value) |
2038 | break; | 2052 | break; |
2039 | } | 2053 | } |
2054 | |||
2040 | shortgi_rate = (shortgi_rate << 12) | (shortgi_rate << 8) | | 2055 | shortgi_rate = (shortgi_rate << 12) | (shortgi_rate << 8) | |
2041 | (shortgi_rate << 4) | (shortgi_rate); | 2056 | (shortgi_rate << 4) | (shortgi_rate); |
2042 | } | 2057 | } |
2058 | |||
2043 | rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value); | 2059 | rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value); |
2060 | |||
2061 | RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, "%x\n", | ||
2062 | rtl_read_dword(rtlpriv, REG_ARFR0)); | ||
2044 | } | 2063 | } |
2045 | 2064 | ||
2046 | void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level) | 2065 | static void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, |
2066 | struct ieee80211_sta *sta, | ||
2067 | u8 rssi_level) | ||
2047 | { | 2068 | { |
2048 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 2069 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
2049 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | 2070 | struct rtl_phy *rtlphy = &(rtlpriv->phy); |
2050 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | 2071 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
2051 | u32 ratr_bitmap = (u32) mac->basic_rates; | 2072 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
2052 | u8 *p_mcsrate = mac->mcs; | 2073 | struct rtl_sta_info *sta_entry = NULL; |
2053 | u8 ratr_index = 0; | 2074 | u32 ratr_bitmap; |
2054 | u8 curtxbw_40mhz = mac->bw_40; | 2075 | u8 ratr_index; |
2055 | u8 curshortgi_40mhz = mac->sgi_40; | 2076 | u8 curtxbw_40mhz = (sta->bandwidth >= IEEE80211_STA_RX_BW_40) ? 1 : 0; |
2056 | u8 curshortgi_20mhz = mac->sgi_20; | 2077 | u8 curshortgi_40mhz = curtxbw_40mhz && |
2057 | enum wireless_mode wirelessmode = mac->mode; | 2078 | (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ? |
2079 | 1 : 0; | ||
2080 | u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ? | ||
2081 | 1 : 0; | ||
2082 | enum wireless_mode wirelessmode = 0; | ||
2058 | bool shortgi = false; | 2083 | bool shortgi = false; |
2059 | u8 rate_mask[5]; | 2084 | u8 rate_mask[5]; |
2060 | u8 macid = 0; | 2085 | u8 macid = 0; |
2061 | u8 mimops = 1; | 2086 | u8 mimo_ps = IEEE80211_SMPS_OFF; |
2062 | 2087 | ||
2063 | ratr_bitmap |= (p_mcsrate[1] << 20) | (p_mcsrate[0] << 12); | 2088 | sta_entry = (struct rtl_sta_info *) sta->drv_priv; |
2089 | wirelessmode = sta_entry->wireless_mode; | ||
2090 | if (mac->opmode == NL80211_IFTYPE_STATION || | ||
2091 | mac->opmode == NL80211_IFTYPE_MESH_POINT) | ||
2092 | curtxbw_40mhz = mac->bw_40; | ||
2093 | else if (mac->opmode == NL80211_IFTYPE_AP || | ||
2094 | mac->opmode == NL80211_IFTYPE_ADHOC) | ||
2095 | macid = sta->aid + 1; | ||
2096 | |||
2097 | if (rtlhal->current_bandtype == BAND_ON_5G) | ||
2098 | ratr_bitmap = sta->supp_rates[1] << 4; | ||
2099 | else | ||
2100 | ratr_bitmap = sta->supp_rates[0]; | ||
2101 | if (mac->opmode == NL80211_IFTYPE_ADHOC) | ||
2102 | ratr_bitmap = 0xfff; | ||
2103 | ratr_bitmap |= (sta->ht_cap.mcs.rx_mask[1] << 20 | | ||
2104 | sta->ht_cap.mcs.rx_mask[0] << 12); | ||
2064 | switch (wirelessmode) { | 2105 | switch (wirelessmode) { |
2065 | case WIRELESS_MODE_B: | 2106 | case WIRELESS_MODE_B: |
2066 | ratr_index = RATR_INX_WIRELESS_B; | 2107 | ratr_index = RATR_INX_WIRELESS_B; |
@@ -2071,6 +2112,7 @@ void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level) | |||
2071 | break; | 2112 | break; |
2072 | case WIRELESS_MODE_G: | 2113 | case WIRELESS_MODE_G: |
2073 | ratr_index = RATR_INX_WIRELESS_GB; | 2114 | ratr_index = RATR_INX_WIRELESS_GB; |
2115 | |||
2074 | if (rssi_level == 1) | 2116 | if (rssi_level == 1) |
2075 | ratr_bitmap &= 0x00000f00; | 2117 | ratr_bitmap &= 0x00000f00; |
2076 | else if (rssi_level == 2) | 2118 | else if (rssi_level == 2) |
@@ -2085,7 +2127,8 @@ void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level) | |||
2085 | case WIRELESS_MODE_N_24G: | 2127 | case WIRELESS_MODE_N_24G: |
2086 | case WIRELESS_MODE_N_5G: | 2128 | case WIRELESS_MODE_N_5G: |
2087 | ratr_index = RATR_INX_WIRELESS_NGB; | 2129 | ratr_index = RATR_INX_WIRELESS_NGB; |
2088 | if (mimops == 0) { | 2130 | |
2131 | if (mimo_ps == IEEE80211_SMPS_STATIC) { | ||
2089 | if (rssi_level == 1) | 2132 | if (rssi_level == 1) |
2090 | ratr_bitmap &= 0x00070000; | 2133 | ratr_bitmap &= 0x00070000; |
2091 | else if (rssi_level == 2) | 2134 | else if (rssi_level == 2) |
@@ -2128,8 +2171,10 @@ void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level) | |||
2128 | } | 2171 | } |
2129 | } | 2172 | } |
2130 | } | 2173 | } |
2174 | |||
2131 | if ((curtxbw_40mhz && curshortgi_40mhz) || | 2175 | if ((curtxbw_40mhz && curshortgi_40mhz) || |
2132 | (!curtxbw_40mhz && curshortgi_20mhz)) { | 2176 | (!curtxbw_40mhz && curshortgi_20mhz)) { |
2177 | |||
2133 | if (macid == 0) | 2178 | if (macid == 0) |
2134 | shortgi = true; | 2179 | shortgi = true; |
2135 | else if (macid == 1) | 2180 | else if (macid == 1) |
@@ -2138,21 +2183,42 @@ void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level) | |||
2138 | break; | 2183 | break; |
2139 | default: | 2184 | default: |
2140 | ratr_index = RATR_INX_WIRELESS_NGB; | 2185 | ratr_index = RATR_INX_WIRELESS_NGB; |
2186 | |||
2141 | if (rtlphy->rf_type == RF_1T2R) | 2187 | if (rtlphy->rf_type == RF_1T2R) |
2142 | ratr_bitmap &= 0x000ff0ff; | 2188 | ratr_bitmap &= 0x000ff0ff; |
2143 | else | 2189 | else |
2144 | ratr_bitmap &= 0x0f0ff0ff; | 2190 | ratr_bitmap &= 0x0f0ff0ff; |
2145 | break; | 2191 | break; |
2146 | } | 2192 | } |
2147 | RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, "ratr_bitmap :%x\n", | 2193 | sta_entry->ratr_index = ratr_index; |
2148 | ratr_bitmap); | 2194 | |
2149 | *(u32 *)&rate_mask = ((ratr_bitmap & 0x0fffffff) | | 2195 | RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, |
2150 | ratr_index << 28); | 2196 | "ratr_bitmap :%x\n", ratr_bitmap); |
2197 | *(u32 *)&rate_mask = (ratr_bitmap & 0x0fffffff) | | ||
2198 | (ratr_index << 28); | ||
2151 | rate_mask[4] = macid | (shortgi ? 0x20 : 0x00) | 0x80; | 2199 | rate_mask[4] = macid | (shortgi ? 0x20 : 0x00) | 0x80; |
2152 | RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, | 2200 | RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, |
2153 | "Rate_index:%x, ratr_val:%x, %5phC\n", | 2201 | "Rate_index:%x, ratr_val:%x, %5phC\n", |
2154 | ratr_index, ratr_bitmap, rate_mask); | 2202 | ratr_index, ratr_bitmap, rate_mask); |
2155 | rtl92c_fill_h2c_cmd(hw, H2C_RA_MASK, 5, rate_mask); | 2203 | memcpy(rtlpriv->rate_mask, rate_mask, 5); |
2204 | /* rtl92c_fill_h2c_cmd() does USB I/O and will result in a | ||
2205 | * "scheduled while atomic" if called directly */ | ||
2206 | schedule_work(&rtlpriv->works.fill_h2c_cmd); | ||
2207 | |||
2208 | if (macid != 0) | ||
2209 | sta_entry->ratr_index = ratr_index; | ||
2210 | } | ||
2211 | |||
2212 | void rtl92cu_update_hal_rate_tbl(struct ieee80211_hw *hw, | ||
2213 | struct ieee80211_sta *sta, | ||
2214 | u8 rssi_level) | ||
2215 | { | ||
2216 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
2217 | |||
2218 | if (rtlpriv->dm.useramask) | ||
2219 | rtl92cu_update_hal_rate_mask(hw, sta, rssi_level); | ||
2220 | else | ||
2221 | rtl92cu_update_hal_rate_table(hw, sta); | ||
2156 | } | 2222 | } |
2157 | 2223 | ||
2158 | void rtl92cu_update_channel_access_setting(struct ieee80211_hw *hw) | 2224 | void rtl92cu_update_channel_access_setting(struct ieee80211_hw *hw) |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h index f41a3aa4a26f..8e3ec1e25644 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h | |||
@@ -98,10 +98,6 @@ void rtl92cu_update_interrupt_mask(struct ieee80211_hw *hw, | |||
98 | u32 add_msr, u32 rm_msr); | 98 | u32 add_msr, u32 rm_msr); |
99 | void rtl92cu_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); | 99 | void rtl92cu_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); |
100 | void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); | 100 | void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); |
101 | void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw, | ||
102 | struct ieee80211_sta *sta, | ||
103 | u8 rssi_level); | ||
104 | void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level); | ||
105 | 101 | ||
106 | void rtl92cu_update_channel_access_setting(struct ieee80211_hw *hw); | 102 | void rtl92cu_update_channel_access_setting(struct ieee80211_hw *hw); |
107 | bool rtl92cu_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 * valid); | 103 | bool rtl92cu_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 * valid); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c index 85b6bdb163c0..da4f587199ee 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c | |||
@@ -289,14 +289,30 @@ void rtl92c_set_key(struct ieee80211_hw *hw, u32 key_index, | |||
289 | macaddr = cam_const_broad; | 289 | macaddr = cam_const_broad; |
290 | entry_id = key_index; | 290 | entry_id = key_index; |
291 | } else { | 291 | } else { |
292 | if (mac->opmode == NL80211_IFTYPE_AP || | ||
293 | mac->opmode == NL80211_IFTYPE_MESH_POINT) { | ||
294 | entry_id = rtl_cam_get_free_entry(hw, | ||
295 | p_macaddr); | ||
296 | if (entry_id >= TOTAL_CAM_ENTRY) { | ||
297 | RT_TRACE(rtlpriv, COMP_SEC, | ||
298 | DBG_EMERG, | ||
299 | "Can not find free hw security cam entry\n"); | ||
300 | return; | ||
301 | } | ||
302 | } else { | ||
303 | entry_id = CAM_PAIRWISE_KEY_POSITION; | ||
304 | } | ||
305 | |||
292 | key_index = PAIRWISE_KEYIDX; | 306 | key_index = PAIRWISE_KEYIDX; |
293 | entry_id = CAM_PAIRWISE_KEY_POSITION; | ||
294 | is_pairwise = true; | 307 | is_pairwise = true; |
295 | } | 308 | } |
296 | } | 309 | } |
297 | if (rtlpriv->sec.key_len[key_index] == 0) { | 310 | if (rtlpriv->sec.key_len[key_index] == 0) { |
298 | RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, | 311 | RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, |
299 | "delete one entry\n"); | 312 | "delete one entry\n"); |
313 | if (mac->opmode == NL80211_IFTYPE_AP || | ||
314 | mac->opmode == NL80211_IFTYPE_MESH_POINT) | ||
315 | rtl_cam_del_entry(hw, p_macaddr); | ||
300 | rtl_cam_delete_one_entry(hw, p_macaddr, entry_id); | 316 | rtl_cam_delete_one_entry(hw, p_macaddr, entry_id); |
301 | } else { | 317 | } else { |
302 | RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, | 318 | RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c index 23d640a4debd..826f085c29dd 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | |||
@@ -106,8 +106,7 @@ static struct rtl_hal_ops rtl8192cu_hal_ops = { | |||
106 | .update_interrupt_mask = rtl92cu_update_interrupt_mask, | 106 | .update_interrupt_mask = rtl92cu_update_interrupt_mask, |
107 | .get_hw_reg = rtl92cu_get_hw_reg, | 107 | .get_hw_reg = rtl92cu_get_hw_reg, |
108 | .set_hw_reg = rtl92cu_set_hw_reg, | 108 | .set_hw_reg = rtl92cu_set_hw_reg, |
109 | .update_rate_tbl = rtl92cu_update_hal_rate_table, | 109 | .update_rate_tbl = rtl92cu_update_hal_rate_tbl, |
110 | .update_rate_mask = rtl92cu_update_hal_rate_mask, | ||
111 | .fill_tx_desc = rtl92cu_tx_fill_desc, | 110 | .fill_tx_desc = rtl92cu_tx_fill_desc, |
112 | .fill_fake_txdesc = rtl92cu_fill_fake_txdesc, | 111 | .fill_fake_txdesc = rtl92cu_fill_fake_txdesc, |
113 | .fill_tx_cmddesc = rtl92cu_tx_fill_cmddesc, | 112 | .fill_tx_cmddesc = rtl92cu_tx_fill_cmddesc, |
@@ -137,6 +136,7 @@ static struct rtl_hal_ops rtl8192cu_hal_ops = { | |||
137 | .phy_lc_calibrate = _rtl92cu_phy_lc_calibrate, | 136 | .phy_lc_calibrate = _rtl92cu_phy_lc_calibrate, |
138 | .phy_set_bw_mode_callback = rtl92cu_phy_set_bw_mode_callback, | 137 | .phy_set_bw_mode_callback = rtl92cu_phy_set_bw_mode_callback, |
139 | .dm_dynamic_txpower = rtl92cu_dm_dynamic_txpower, | 138 | .dm_dynamic_txpower = rtl92cu_dm_dynamic_txpower, |
139 | .fill_h2c_cmd = rtl92c_fill_h2c_cmd, | ||
140 | }; | 140 | }; |
141 | 141 | ||
142 | static struct rtl_mod_params rtl92cu_mod_params = { | 142 | static struct rtl_mod_params rtl92cu_mod_params = { |
@@ -349,6 +349,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = { | |||
349 | {RTL_USB_DEVICE(0x07aa, 0x0056, rtl92cu_hal_cfg)}, /*ATKK-Gemtek*/ | 349 | {RTL_USB_DEVICE(0x07aa, 0x0056, rtl92cu_hal_cfg)}, /*ATKK-Gemtek*/ |
350 | {RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Funai -Abocom*/ | 350 | {RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Funai -Abocom*/ |
351 | {RTL_USB_DEVICE(0x0846, 0x9021, rtl92cu_hal_cfg)}, /*Netgear-Sercomm*/ | 351 | {RTL_USB_DEVICE(0x0846, 0x9021, rtl92cu_hal_cfg)}, /*Netgear-Sercomm*/ |
352 | {RTL_USB_DEVICE(0x0846, 0xf001, rtl92cu_hal_cfg)}, /*On Netwrks N300MA*/ | ||
352 | {RTL_USB_DEVICE(0x0b05, 0x17ab, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/ | 353 | {RTL_USB_DEVICE(0x0b05, 0x17ab, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/ |
353 | {RTL_USB_DEVICE(0x0bda, 0x8186, rtl92cu_hal_cfg)}, /*Realtek 92CE-VAU*/ | 354 | {RTL_USB_DEVICE(0x0bda, 0x8186, rtl92cu_hal_cfg)}, /*Realtek 92CE-VAU*/ |
354 | {RTL_USB_DEVICE(0x0df6, 0x0061, rtl92cu_hal_cfg)}, /*Sitecom-Edimax*/ | 355 | {RTL_USB_DEVICE(0x0df6, 0x0061, rtl92cu_hal_cfg)}, /*Sitecom-Edimax*/ |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h index a1310abd0d54..262e1e4c6e5b 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h | |||
@@ -49,5 +49,8 @@ bool rtl92cu_phy_set_rf_power_state(struct ieee80211_hw *hw, | |||
49 | u32 rtl92cu_phy_query_rf_reg(struct ieee80211_hw *hw, | 49 | u32 rtl92cu_phy_query_rf_reg(struct ieee80211_hw *hw, |
50 | enum radio_path rfpath, u32 regaddr, u32 bitmask); | 50 | enum radio_path rfpath, u32 regaddr, u32 bitmask); |
51 | void rtl92cu_phy_set_bw_mode_callback(struct ieee80211_hw *hw); | 51 | void rtl92cu_phy_set_bw_mode_callback(struct ieee80211_hw *hw); |
52 | void rtl92cu_update_hal_rate_tbl(struct ieee80211_hw *hw, | ||
53 | struct ieee80211_sta *sta, | ||
54 | u8 rssi_level); | ||
52 | 55 | ||
53 | #endif | 56 | #endif |
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index 76732b0cd221..a3532e077871 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c | |||
@@ -824,6 +824,7 @@ static void rtl_usb_stop(struct ieee80211_hw *hw) | |||
824 | 824 | ||
825 | /* should after adapter start and interrupt enable. */ | 825 | /* should after adapter start and interrupt enable. */ |
826 | set_hal_stop(rtlhal); | 826 | set_hal_stop(rtlhal); |
827 | cancel_work_sync(&rtlpriv->works.fill_h2c_cmd); | ||
827 | /* Enable software */ | 828 | /* Enable software */ |
828 | SET_USB_STOP(rtlusb); | 829 | SET_USB_STOP(rtlusb); |
829 | rtl_usb_deinit(hw); | 830 | rtl_usb_deinit(hw); |
@@ -1026,6 +1027,16 @@ static bool rtl_usb_tx_chk_waitq_insert(struct ieee80211_hw *hw, | |||
1026 | return false; | 1027 | return false; |
1027 | } | 1028 | } |
1028 | 1029 | ||
1030 | static void rtl_fill_h2c_cmd_work_callback(struct work_struct *work) | ||
1031 | { | ||
1032 | struct rtl_works *rtlworks = | ||
1033 | container_of(work, struct rtl_works, fill_h2c_cmd); | ||
1034 | struct ieee80211_hw *hw = rtlworks->hw; | ||
1035 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
1036 | |||
1037 | rtlpriv->cfg->ops->fill_h2c_cmd(hw, H2C_RA_MASK, 5, rtlpriv->rate_mask); | ||
1038 | } | ||
1039 | |||
1029 | static struct rtl_intf_ops rtl_usb_ops = { | 1040 | static struct rtl_intf_ops rtl_usb_ops = { |
1030 | .adapter_start = rtl_usb_start, | 1041 | .adapter_start = rtl_usb_start, |
1031 | .adapter_stop = rtl_usb_stop, | 1042 | .adapter_stop = rtl_usb_stop, |
@@ -1057,6 +1068,8 @@ int rtl_usb_probe(struct usb_interface *intf, | |||
1057 | 1068 | ||
1058 | /* this spin lock must be initialized early */ | 1069 | /* this spin lock must be initialized early */ |
1059 | spin_lock_init(&rtlpriv->locks.usb_lock); | 1070 | spin_lock_init(&rtlpriv->locks.usb_lock); |
1071 | INIT_WORK(&rtlpriv->works.fill_h2c_cmd, | ||
1072 | rtl_fill_h2c_cmd_work_callback); | ||
1060 | 1073 | ||
1061 | rtlpriv->usb_data_index = 0; | 1074 | rtlpriv->usb_data_index = 0; |
1062 | init_completion(&rtlpriv->firmware_loading_complete); | 1075 | init_completion(&rtlpriv->firmware_loading_complete); |
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h index 44328baa6389..cc03e7c87cbe 100644 --- a/drivers/net/wireless/rtlwifi/wifi.h +++ b/drivers/net/wireless/rtlwifi/wifi.h | |||
@@ -1736,6 +1736,8 @@ struct rtl_hal_ops { | |||
1736 | void (*bt_wifi_media_status_notify) (struct ieee80211_hw *hw, | 1736 | void (*bt_wifi_media_status_notify) (struct ieee80211_hw *hw, |
1737 | bool mstate); | 1737 | bool mstate); |
1738 | void (*bt_coex_off_before_lps) (struct ieee80211_hw *hw); | 1738 | void (*bt_coex_off_before_lps) (struct ieee80211_hw *hw); |
1739 | void (*fill_h2c_cmd) (struct ieee80211_hw *hw, u8 element_id, | ||
1740 | u32 cmd_len, u8 *p_cmdbuffer); | ||
1739 | }; | 1741 | }; |
1740 | 1742 | ||
1741 | struct rtl_intf_ops { | 1743 | struct rtl_intf_ops { |
@@ -1869,6 +1871,7 @@ struct rtl_works { | |||
1869 | struct delayed_work fwevt_wq; | 1871 | struct delayed_work fwevt_wq; |
1870 | 1872 | ||
1871 | struct work_struct lps_change_work; | 1873 | struct work_struct lps_change_work; |
1874 | struct work_struct fill_h2c_cmd; | ||
1872 | }; | 1875 | }; |
1873 | 1876 | ||
1874 | struct rtl_debug { | 1877 | struct rtl_debug { |
@@ -2048,6 +2051,7 @@ struct rtl_priv { | |||
2048 | }; | 2051 | }; |
2049 | }; | 2052 | }; |
2050 | bool enter_ps; /* true when entering PS */ | 2053 | bool enter_ps; /* true when entering PS */ |
2054 | u8 rate_mask[5]; | ||
2051 | 2055 | ||
2052 | /*This must be the last item so | 2056 | /*This must be the last item so |
2053 | that it points to the data allocated | 2057 | that it points to the data allocated |
diff --git a/drivers/net/wireless/ti/wl12xx/scan.c b/drivers/net/wireless/ti/wl12xx/scan.c index affdb3ec6225..4a0bbb13806b 100644 --- a/drivers/net/wireless/ti/wl12xx/scan.c +++ b/drivers/net/wireless/ti/wl12xx/scan.c | |||
@@ -310,7 +310,7 @@ static void wl12xx_adjust_channels(struct wl1271_cmd_sched_scan_config *cmd, | |||
310 | memcpy(cmd->channels_2, cmd_channels->channels_2, | 310 | memcpy(cmd->channels_2, cmd_channels->channels_2, |
311 | sizeof(cmd->channels_2)); | 311 | sizeof(cmd->channels_2)); |
312 | memcpy(cmd->channels_5, cmd_channels->channels_5, | 312 | memcpy(cmd->channels_5, cmd_channels->channels_5, |
313 | sizeof(cmd->channels_2)); | 313 | sizeof(cmd->channels_5)); |
314 | /* channels_4 are not supported, so no need to copy them */ | 314 | /* channels_4 are not supported, so no need to copy them */ |
315 | } | 315 | } |
316 | 316 | ||
diff --git a/drivers/net/wireless/ti/wl12xx/wl12xx.h b/drivers/net/wireless/ti/wl12xx/wl12xx.h index 222d03540200..9e5484a73667 100644 --- a/drivers/net/wireless/ti/wl12xx/wl12xx.h +++ b/drivers/net/wireless/ti/wl12xx/wl12xx.h | |||
@@ -36,12 +36,12 @@ | |||
36 | #define WL127X_IFTYPE_SR_VER 3 | 36 | #define WL127X_IFTYPE_SR_VER 3 |
37 | #define WL127X_MAJOR_SR_VER 10 | 37 | #define WL127X_MAJOR_SR_VER 10 |
38 | #define WL127X_SUBTYPE_SR_VER WLCORE_FW_VER_IGNORE | 38 | #define WL127X_SUBTYPE_SR_VER WLCORE_FW_VER_IGNORE |
39 | #define WL127X_MINOR_SR_VER 115 | 39 | #define WL127X_MINOR_SR_VER 133 |
40 | /* minimum multi-role FW version for wl127x */ | 40 | /* minimum multi-role FW version for wl127x */ |
41 | #define WL127X_IFTYPE_MR_VER 5 | 41 | #define WL127X_IFTYPE_MR_VER 5 |
42 | #define WL127X_MAJOR_MR_VER 7 | 42 | #define WL127X_MAJOR_MR_VER 7 |
43 | #define WL127X_SUBTYPE_MR_VER WLCORE_FW_VER_IGNORE | 43 | #define WL127X_SUBTYPE_MR_VER WLCORE_FW_VER_IGNORE |
44 | #define WL127X_MINOR_MR_VER 115 | 44 | #define WL127X_MINOR_MR_VER 42 |
45 | 45 | ||
46 | /* FW chip version for wl128x */ | 46 | /* FW chip version for wl128x */ |
47 | #define WL128X_CHIP_VER 7 | 47 | #define WL128X_CHIP_VER 7 |
@@ -49,7 +49,7 @@ | |||
49 | #define WL128X_IFTYPE_SR_VER 3 | 49 | #define WL128X_IFTYPE_SR_VER 3 |
50 | #define WL128X_MAJOR_SR_VER 10 | 50 | #define WL128X_MAJOR_SR_VER 10 |
51 | #define WL128X_SUBTYPE_SR_VER WLCORE_FW_VER_IGNORE | 51 | #define WL128X_SUBTYPE_SR_VER WLCORE_FW_VER_IGNORE |
52 | #define WL128X_MINOR_SR_VER 115 | 52 | #define WL128X_MINOR_SR_VER 133 |
53 | /* minimum multi-role FW version for wl128x */ | 53 | /* minimum multi-role FW version for wl128x */ |
54 | #define WL128X_IFTYPE_MR_VER 5 | 54 | #define WL128X_IFTYPE_MR_VER 5 |
55 | #define WL128X_MAJOR_MR_VER 7 | 55 | #define WL128X_MAJOR_MR_VER 7 |
diff --git a/drivers/net/wireless/ti/wl18xx/scan.c b/drivers/net/wireless/ti/wl18xx/scan.c index 09d944505ac0..2b642f8c9266 100644 --- a/drivers/net/wireless/ti/wl18xx/scan.c +++ b/drivers/net/wireless/ti/wl18xx/scan.c | |||
@@ -34,7 +34,7 @@ static void wl18xx_adjust_channels(struct wl18xx_cmd_scan_params *cmd, | |||
34 | memcpy(cmd->channels_2, cmd_channels->channels_2, | 34 | memcpy(cmd->channels_2, cmd_channels->channels_2, |
35 | sizeof(cmd->channels_2)); | 35 | sizeof(cmd->channels_2)); |
36 | memcpy(cmd->channels_5, cmd_channels->channels_5, | 36 | memcpy(cmd->channels_5, cmd_channels->channels_5, |
37 | sizeof(cmd->channels_2)); | 37 | sizeof(cmd->channels_5)); |
38 | /* channels_4 are not supported, so no need to copy them */ | 38 | /* channels_4 are not supported, so no need to copy them */ |
39 | } | 39 | } |
40 | 40 | ||
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index 37984e6d4e99..8c20935d72c9 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c | |||
@@ -662,7 +662,7 @@ static void xen_netbk_rx_action(struct xen_netbk *netbk) | |||
662 | { | 662 | { |
663 | struct xenvif *vif = NULL, *tmp; | 663 | struct xenvif *vif = NULL, *tmp; |
664 | s8 status; | 664 | s8 status; |
665 | u16 irq, flags; | 665 | u16 flags; |
666 | struct xen_netif_rx_response *resp; | 666 | struct xen_netif_rx_response *resp; |
667 | struct sk_buff_head rxq; | 667 | struct sk_buff_head rxq; |
668 | struct sk_buff *skb; | 668 | struct sk_buff *skb; |
@@ -771,13 +771,13 @@ static void xen_netbk_rx_action(struct xen_netbk *netbk) | |||
771 | sco->meta_slots_used); | 771 | sco->meta_slots_used); |
772 | 772 | ||
773 | RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&vif->rx, ret); | 773 | RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&vif->rx, ret); |
774 | irq = vif->irq; | ||
775 | if (ret && list_empty(&vif->notify_list)) | ||
776 | list_add_tail(&vif->notify_list, ¬ify); | ||
777 | 774 | ||
778 | xenvif_notify_tx_completion(vif); | 775 | xenvif_notify_tx_completion(vif); |
779 | 776 | ||
780 | xenvif_put(vif); | 777 | if (ret && list_empty(&vif->notify_list)) |
778 | list_add_tail(&vif->notify_list, ¬ify); | ||
779 | else | ||
780 | xenvif_put(vif); | ||
781 | npo.meta_cons += sco->meta_slots_used; | 781 | npo.meta_cons += sco->meta_slots_used; |
782 | dev_kfree_skb(skb); | 782 | dev_kfree_skb(skb); |
783 | } | 783 | } |
@@ -785,6 +785,7 @@ static void xen_netbk_rx_action(struct xen_netbk *netbk) | |||
785 | list_for_each_entry_safe(vif, tmp, ¬ify, notify_list) { | 785 | list_for_each_entry_safe(vif, tmp, ¬ify, notify_list) { |
786 | notify_remote_via_irq(vif->irq); | 786 | notify_remote_via_irq(vif->irq); |
787 | list_del_init(&vif->notify_list); | 787 | list_del_init(&vif->notify_list); |
788 | xenvif_put(vif); | ||
788 | } | 789 | } |
789 | 790 | ||
790 | /* More work to do? */ | 791 | /* More work to do? */ |