diff options
184 files changed, 2035 insertions, 1647 deletions
diff --git a/Documentation/ABI/testing/sysfs-class-scsi_host b/Documentation/ABI/testing/sysfs-class-scsi_host new file mode 100644 index 000000000000..29a4f892e433 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-class-scsi_host | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | What: /sys/class/scsi_host/hostX/isci_id | ||
| 2 | Date: June 2011 | ||
| 3 | Contact: Dave Jiang <dave.jiang@intel.com> | ||
| 4 | Description: | ||
| 5 | This file contains the enumerated host ID for the Intel | ||
| 6 | SCU controller. The Intel(R) C600 Series Chipset SATA/SAS | ||
| 7 | Storage Control Unit embeds up to two 4-port controllers in | ||
| 8 | a single PCI device. The controllers are enumerated in order | ||
| 9 | which usually means the lowest number scsi_host corresponds | ||
| 10 | with the first controller, but this association is not | ||
| 11 | guaranteed. The 'isci_id' attribute unambiguously identifies | ||
| 12 | the controller index: '0' for the first controller, | ||
| 13 | '1' for the second. | ||
diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt index 6f3c598971fc..06eb6d957c83 100644 --- a/Documentation/cgroups/memory.txt +++ b/Documentation/cgroups/memory.txt | |||
| @@ -380,7 +380,7 @@ will be charged as a new owner of it. | |||
| 380 | 380 | ||
| 381 | 5.2 stat file | 381 | 5.2 stat file |
| 382 | 382 | ||
| 383 | 5.2.1 memory.stat file includes following statistics | 383 | memory.stat file includes following statistics |
| 384 | 384 | ||
| 385 | # per-memory cgroup local status | 385 | # per-memory cgroup local status |
| 386 | cache - # of bytes of page cache memory. | 386 | cache - # of bytes of page cache memory. |
| @@ -438,89 +438,6 @@ Note: | |||
| 438 | file_mapped is accounted only when the memory cgroup is owner of page | 438 | file_mapped is accounted only when the memory cgroup is owner of page |
| 439 | cache.) | 439 | cache.) |
| 440 | 440 | ||
| 441 | 5.2.2 memory.vmscan_stat | ||
| 442 | |||
| 443 | memory.vmscan_stat includes statistics information for memory scanning and | ||
| 444 | freeing, reclaiming. The statistics shows memory scanning information since | ||
| 445 | memory cgroup creation and can be reset to 0 by writing 0 as | ||
| 446 | |||
| 447 | #echo 0 > ../memory.vmscan_stat | ||
| 448 | |||
| 449 | This file contains following statistics. | ||
| 450 | |||
| 451 | [param]_[file_or_anon]_pages_by_[reason]_[under_heararchy] | ||
| 452 | [param]_elapsed_ns_by_[reason]_[under_hierarchy] | ||
| 453 | |||
| 454 | For example, | ||
| 455 | |||
| 456 | scanned_file_pages_by_limit indicates the number of scanned | ||
| 457 | file pages at vmscan. | ||
| 458 | |||
| 459 | Now, 3 parameters are supported | ||
| 460 | |||
| 461 | scanned - the number of pages scanned by vmscan | ||
| 462 | rotated - the number of pages activated at vmscan | ||
| 463 | freed - the number of pages freed by vmscan | ||
| 464 | |||
| 465 | If "rotated" is high against scanned/freed, the memcg seems busy. | ||
| 466 | |||
| 467 | Now, 2 reason are supported | ||
| 468 | |||
| 469 | limit - the memory cgroup's limit | ||
| 470 | system - global memory pressure + softlimit | ||
| 471 | (global memory pressure not under softlimit is not handled now) | ||
| 472 | |||
| 473 | When under_hierarchy is added in the tail, the number indicates the | ||
| 474 | total memcg scan of its children and itself. | ||
| 475 | |||
| 476 | elapsed_ns is a elapsed time in nanosecond. This may include sleep time | ||
| 477 | and not indicates CPU usage. So, please take this as just showing | ||
| 478 | latency. | ||
| 479 | |||
| 480 | Here is an example. | ||
| 481 | |||
| 482 | # cat /cgroup/memory/A/memory.vmscan_stat | ||
| 483 | scanned_pages_by_limit 9471864 | ||
| 484 | scanned_anon_pages_by_limit 6640629 | ||
| 485 | scanned_file_pages_by_limit 2831235 | ||
| 486 | rotated_pages_by_limit 4243974 | ||
| 487 | rotated_anon_pages_by_limit 3971968 | ||
| 488 | rotated_file_pages_by_limit 272006 | ||
| 489 | freed_pages_by_limit 2318492 | ||
| 490 | freed_anon_pages_by_limit 962052 | ||
| 491 | freed_file_pages_by_limit 1356440 | ||
| 492 | elapsed_ns_by_limit 351386416101 | ||
| 493 | scanned_pages_by_system 0 | ||
| 494 | scanned_anon_pages_by_system 0 | ||
| 495 | scanned_file_pages_by_system 0 | ||
| 496 | rotated_pages_by_system 0 | ||
| 497 | rotated_anon_pages_by_system 0 | ||
| 498 | rotated_file_pages_by_system 0 | ||
| 499 | freed_pages_by_system 0 | ||
| 500 | freed_anon_pages_by_system 0 | ||
| 501 | freed_file_pages_by_system 0 | ||
| 502 | elapsed_ns_by_system 0 | ||
| 503 | scanned_pages_by_limit_under_hierarchy 9471864 | ||
| 504 | scanned_anon_pages_by_limit_under_hierarchy 6640629 | ||
| 505 | scanned_file_pages_by_limit_under_hierarchy 2831235 | ||
| 506 | rotated_pages_by_limit_under_hierarchy 4243974 | ||
| 507 | rotated_anon_pages_by_limit_under_hierarchy 3971968 | ||
| 508 | rotated_file_pages_by_limit_under_hierarchy 272006 | ||
| 509 | freed_pages_by_limit_under_hierarchy 2318492 | ||
| 510 | freed_anon_pages_by_limit_under_hierarchy 962052 | ||
| 511 | freed_file_pages_by_limit_under_hierarchy 1356440 | ||
| 512 | elapsed_ns_by_limit_under_hierarchy 351386416101 | ||
| 513 | scanned_pages_by_system_under_hierarchy 0 | ||
| 514 | scanned_anon_pages_by_system_under_hierarchy 0 | ||
| 515 | scanned_file_pages_by_system_under_hierarchy 0 | ||
| 516 | rotated_pages_by_system_under_hierarchy 0 | ||
| 517 | rotated_anon_pages_by_system_under_hierarchy 0 | ||
| 518 | rotated_file_pages_by_system_under_hierarchy 0 | ||
| 519 | freed_pages_by_system_under_hierarchy 0 | ||
| 520 | freed_anon_pages_by_system_under_hierarchy 0 | ||
| 521 | freed_file_pages_by_system_under_hierarchy 0 | ||
| 522 | elapsed_ns_by_system_under_hierarchy 0 | ||
| 523 | |||
| 524 | 5.3 swappiness | 441 | 5.3 swappiness |
| 525 | 442 | ||
| 526 | Similar to /proc/sys/vm/swappiness, but affecting a hierarchy of groups only. | 443 | Similar to /proc/sys/vm/swappiness, but affecting a hierarchy of groups only. |
diff --git a/Documentation/networking/dmfe.txt b/Documentation/networking/dmfe.txt index 8006c227fda2..25320bf19c86 100644 --- a/Documentation/networking/dmfe.txt +++ b/Documentation/networking/dmfe.txt | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | Note: This driver doesn't have a maintainer. | ||
| 2 | |||
| 1 | Davicom DM9102(A)/DM9132/DM9801 fast ethernet driver for Linux. | 3 | Davicom DM9102(A)/DM9132/DM9801 fast ethernet driver for Linux. |
| 2 | 4 | ||
| 3 | This program is free software; you can redistribute it and/or | 5 | This program is free software; you can redistribute it and/or |
| @@ -55,7 +57,6 @@ Test and make sure PCI latency is now correct for all cases. | |||
| 55 | Authors: | 57 | Authors: |
| 56 | 58 | ||
| 57 | Sten Wang <sten_wang@davicom.com.tw > : Original Author | 59 | Sten Wang <sten_wang@davicom.com.tw > : Original Author |
| 58 | Tobias Ringstrom <tori@unhappy.mine.nu> : Current Maintainer | ||
| 59 | 60 | ||
| 60 | Contributors: | 61 | Contributors: |
| 61 | 62 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index 28f65c249b97..ae8820e173a2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -1278,7 +1278,6 @@ F: drivers/input/misc/ati_remote2.c | |||
| 1278 | ATLX ETHERNET DRIVERS | 1278 | ATLX ETHERNET DRIVERS |
| 1279 | M: Jay Cliburn <jcliburn@gmail.com> | 1279 | M: Jay Cliburn <jcliburn@gmail.com> |
| 1280 | M: Chris Snook <chris.snook@gmail.com> | 1280 | M: Chris Snook <chris.snook@gmail.com> |
| 1281 | M: Jie Yang <jie.yang@atheros.com> | ||
| 1282 | L: netdev@vger.kernel.org | 1281 | L: netdev@vger.kernel.org |
| 1283 | W: http://sourceforge.net/projects/atl1 | 1282 | W: http://sourceforge.net/projects/atl1 |
| 1284 | W: http://atl1.sourceforge.net | 1283 | W: http://atl1.sourceforge.net |
| @@ -1574,7 +1573,6 @@ F: drivers/scsi/bfa/ | |||
| 1574 | 1573 | ||
| 1575 | BROCADE BNA 10 GIGABIT ETHERNET DRIVER | 1574 | BROCADE BNA 10 GIGABIT ETHERNET DRIVER |
| 1576 | M: Rasesh Mody <rmody@brocade.com> | 1575 | M: Rasesh Mody <rmody@brocade.com> |
| 1577 | M: Debashis Dutt <ddutt@brocade.com> | ||
| 1578 | L: netdev@vger.kernel.org | 1576 | L: netdev@vger.kernel.org |
| 1579 | S: Supported | 1577 | S: Supported |
| 1580 | F: drivers/net/bna/ | 1578 | F: drivers/net/bna/ |
| @@ -1758,7 +1756,6 @@ F: Documentation/zh_CN/ | |||
| 1758 | 1756 | ||
| 1759 | CISCO VIC ETHERNET NIC DRIVER | 1757 | CISCO VIC ETHERNET NIC DRIVER |
| 1760 | M: Christian Benvenuti <benve@cisco.com> | 1758 | M: Christian Benvenuti <benve@cisco.com> |
| 1761 | M: Vasanthy Kolluri <vkolluri@cisco.com> | ||
| 1762 | M: Roopa Prabhu <roprabhu@cisco.com> | 1759 | M: Roopa Prabhu <roprabhu@cisco.com> |
| 1763 | M: David Wang <dwang2@cisco.com> | 1760 | M: David Wang <dwang2@cisco.com> |
| 1764 | S: Supported | 1761 | S: Supported |
| @@ -3262,6 +3259,17 @@ F: Documentation/input/multi-touch-protocol.txt | |||
| 3262 | F: drivers/input/input-mt.c | 3259 | F: drivers/input/input-mt.c |
| 3263 | K: \b(ABS|SYN)_MT_ | 3260 | K: \b(ABS|SYN)_MT_ |
| 3264 | 3261 | ||
| 3262 | INTEL C600 SERIES SAS CONTROLLER DRIVER | ||
| 3263 | M: Intel SCU Linux support <intel-linux-scu@intel.com> | ||
| 3264 | M: Dan Williams <dan.j.williams@intel.com> | ||
| 3265 | M: Dave Jiang <dave.jiang@intel.com> | ||
| 3266 | M: Ed Nadolski <edmund.nadolski@intel.com> | ||
| 3267 | L: linux-scsi@vger.kernel.org | ||
| 3268 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/djbw/isci.git | ||
| 3269 | S: Maintained | ||
| 3270 | F: drivers/scsi/isci/ | ||
| 3271 | F: firmware/isci/ | ||
| 3272 | |||
| 3265 | INTEL IDLE DRIVER | 3273 | INTEL IDLE DRIVER |
| 3266 | M: Len Brown <lenb@kernel.org> | 3274 | M: Len Brown <lenb@kernel.org> |
| 3267 | L: linux-pm@lists.linux-foundation.org | 3275 | L: linux-pm@lists.linux-foundation.org |
| @@ -4404,7 +4412,8 @@ L: netfilter@vger.kernel.org | |||
| 4404 | L: coreteam@netfilter.org | 4412 | L: coreteam@netfilter.org |
| 4405 | W: http://www.netfilter.org/ | 4413 | W: http://www.netfilter.org/ |
| 4406 | W: http://www.iptables.org/ | 4414 | W: http://www.iptables.org/ |
| 4407 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6.git | 4415 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-2.6.git |
| 4416 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next-2.6.git | ||
| 4408 | S: Supported | 4417 | S: Supported |
| 4409 | F: include/linux/netfilter* | 4418 | F: include/linux/netfilter* |
| 4410 | F: include/linux/netfilter/ | 4419 | F: include/linux/netfilter/ |
| @@ -4774,7 +4783,7 @@ F: drivers/net/wireless/orinoco/ | |||
| 4774 | 4783 | ||
| 4775 | OSD LIBRARY and FILESYSTEM | 4784 | OSD LIBRARY and FILESYSTEM |
| 4776 | M: Boaz Harrosh <bharrosh@panasas.com> | 4785 | M: Boaz Harrosh <bharrosh@panasas.com> |
| 4777 | M: Benny Halevy <bhalevy@panasas.com> | 4786 | M: Benny Halevy <bhalevy@tonian.com> |
| 4778 | L: osd-dev@open-osd.org | 4787 | L: osd-dev@open-osd.org |
| 4779 | W: http://open-osd.org | 4788 | W: http://open-osd.org |
| 4780 | T: git git://git.open-osd.org/open-osd.git | 4789 | T: git git://git.open-osd.org/open-osd.git |
| @@ -7200,6 +7209,9 @@ W: http://opensource.wolfsonmicro.com/content/linux-drivers-wolfson-devices | |||
| 7200 | S: Supported | 7209 | S: Supported |
| 7201 | F: Documentation/hwmon/wm83?? | 7210 | F: Documentation/hwmon/wm83?? |
| 7202 | F: drivers/leds/leds-wm83*.c | 7211 | F: drivers/leds/leds-wm83*.c |
| 7212 | F: drivers/input/misc/wm831x-on.c | ||
| 7213 | F: drivers/input/touchscreen/wm831x-ts.c | ||
| 7214 | F: drivers/input/touchscreen/wm97*.c | ||
| 7203 | F: drivers/mfd/wm8*.c | 7215 | F: drivers/mfd/wm8*.c |
| 7204 | F: drivers/power/wm83*.c | 7216 | F: drivers/power/wm83*.c |
| 7205 | F: drivers/rtc/rtc-wm83*.c | 7217 | F: drivers/rtc/rtc-wm83*.c |
| @@ -7209,6 +7221,7 @@ F: drivers/watchdog/wm83*_wdt.c | |||
| 7209 | F: include/linux/mfd/wm831x/ | 7221 | F: include/linux/mfd/wm831x/ |
| 7210 | F: include/linux/mfd/wm8350/ | 7222 | F: include/linux/mfd/wm8350/ |
| 7211 | F: include/linux/mfd/wm8400* | 7223 | F: include/linux/mfd/wm8400* |
| 7224 | F: include/linux/wm97xx.h | ||
| 7212 | F: include/sound/wm????.h | 7225 | F: include/sound/wm????.h |
| 7213 | F: sound/soc/codecs/wm* | 7226 | F: sound/soc/codecs/wm* |
| 7214 | 7227 | ||
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index 60cde53d266c..8bb936226dee 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig | |||
| @@ -51,7 +51,7 @@ config GENERIC_CMOS_UPDATE | |||
| 51 | def_bool y | 51 | def_bool y |
| 52 | 52 | ||
| 53 | config GENERIC_GPIO | 53 | config GENERIC_GPIO |
| 54 | def_bool y | 54 | bool |
| 55 | 55 | ||
| 56 | config ZONE_DMA | 56 | config ZONE_DMA |
| 57 | bool | 57 | bool |
diff --git a/arch/um/Kconfig.x86 b/arch/um/Kconfig.x86 index d31ecf346b4e..21bebe63df66 100644 --- a/arch/um/Kconfig.x86 +++ b/arch/um/Kconfig.x86 | |||
| @@ -10,6 +10,10 @@ config CMPXCHG_LOCAL | |||
| 10 | bool | 10 | bool |
| 11 | default n | 11 | default n |
| 12 | 12 | ||
| 13 | config CMPXCHG_DOUBLE | ||
| 14 | bool | ||
| 15 | default n | ||
| 16 | |||
| 13 | source "arch/x86/Kconfig.cpu" | 17 | source "arch/x86/Kconfig.cpu" |
| 14 | 18 | ||
| 15 | endmenu | 19 | endmenu |
diff --git a/arch/um/Makefile b/arch/um/Makefile index fab8121d2b32..c0f712cc7c5f 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile | |||
| @@ -41,7 +41,7 @@ KBUILD_CPPFLAGS += -I$(srctree)/$(ARCH_DIR)/sys-$(SUBARCH) | |||
| 41 | KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \ | 41 | KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \ |
| 42 | $(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap \ | 42 | $(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap \ |
| 43 | -Din6addr_loopback=kernel_in6addr_loopback \ | 43 | -Din6addr_loopback=kernel_in6addr_loopback \ |
| 44 | -Din6addr_any=kernel_in6addr_any | 44 | -Din6addr_any=kernel_in6addr_any -Dstrrchr=kernel_strrchr |
| 45 | 45 | ||
| 46 | KBUILD_AFLAGS += $(ARCH_INCLUDE) | 46 | KBUILD_AFLAGS += $(ARCH_INCLUDE) |
| 47 | 47 | ||
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index d51c404239a8..364c8a15c4c3 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c | |||
| @@ -399,8 +399,8 @@ int line_setup_irq(int fd, int input, int output, struct line *line, void *data) | |||
| 399 | * is done under a spinlock. Checking whether the device is in use is | 399 | * is done under a spinlock. Checking whether the device is in use is |
| 400 | * line->tty->count > 1, also under the spinlock. | 400 | * line->tty->count > 1, also under the spinlock. |
| 401 | * | 401 | * |
| 402 | * tty->count serves to decide whether the device should be enabled or | 402 | * line->count serves to decide whether the device should be enabled or |
| 403 | * disabled on the host. If it's equal to 1, then we are doing the | 403 | * disabled on the host. If it's equal to 0, then we are doing the |
| 404 | * first open or last close. Otherwise, open and close just return. | 404 | * first open or last close. Otherwise, open and close just return. |
| 405 | */ | 405 | */ |
| 406 | 406 | ||
| @@ -414,16 +414,16 @@ int line_open(struct line *lines, struct tty_struct *tty) | |||
| 414 | goto out_unlock; | 414 | goto out_unlock; |
| 415 | 415 | ||
| 416 | err = 0; | 416 | err = 0; |
| 417 | if (tty->count > 1) | 417 | if (line->count++) |
| 418 | goto out_unlock; | 418 | goto out_unlock; |
| 419 | 419 | ||
| 420 | spin_unlock(&line->count_lock); | 420 | BUG_ON(tty->driver_data); |
| 421 | |||
| 422 | tty->driver_data = line; | 421 | tty->driver_data = line; |
| 423 | line->tty = tty; | 422 | line->tty = tty; |
| 424 | 423 | ||
| 424 | spin_unlock(&line->count_lock); | ||
| 425 | err = enable_chan(line); | 425 | err = enable_chan(line); |
| 426 | if (err) | 426 | if (err) /* line_close() will be called by our caller */ |
| 427 | return err; | 427 | return err; |
| 428 | 428 | ||
| 429 | INIT_DELAYED_WORK(&line->task, line_timer_cb); | 429 | INIT_DELAYED_WORK(&line->task, line_timer_cb); |
| @@ -436,7 +436,7 @@ int line_open(struct line *lines, struct tty_struct *tty) | |||
| 436 | chan_window_size(&line->chan_list, &tty->winsize.ws_row, | 436 | chan_window_size(&line->chan_list, &tty->winsize.ws_row, |
| 437 | &tty->winsize.ws_col); | 437 | &tty->winsize.ws_col); |
| 438 | 438 | ||
| 439 | return err; | 439 | return 0; |
| 440 | 440 | ||
| 441 | out_unlock: | 441 | out_unlock: |
| 442 | spin_unlock(&line->count_lock); | 442 | spin_unlock(&line->count_lock); |
| @@ -460,17 +460,16 @@ void line_close(struct tty_struct *tty, struct file * filp) | |||
| 460 | flush_buffer(line); | 460 | flush_buffer(line); |
| 461 | 461 | ||
| 462 | spin_lock(&line->count_lock); | 462 | spin_lock(&line->count_lock); |
| 463 | if (!line->valid) | 463 | BUG_ON(!line->valid); |
| 464 | goto out_unlock; | ||
| 465 | 464 | ||
| 466 | if (tty->count > 1) | 465 | if (--line->count) |
| 467 | goto out_unlock; | 466 | goto out_unlock; |
| 468 | 467 | ||
| 469 | spin_unlock(&line->count_lock); | ||
| 470 | |||
| 471 | line->tty = NULL; | 468 | line->tty = NULL; |
| 472 | tty->driver_data = NULL; | 469 | tty->driver_data = NULL; |
| 473 | 470 | ||
| 471 | spin_unlock(&line->count_lock); | ||
| 472 | |||
| 474 | if (line->sigio) { | 473 | if (line->sigio) { |
| 475 | unregister_winch(tty); | 474 | unregister_winch(tty); |
| 476 | line->sigio = 0; | 475 | line->sigio = 0; |
| @@ -498,7 +497,7 @@ static int setup_one_line(struct line *lines, int n, char *init, int init_prio, | |||
| 498 | 497 | ||
| 499 | spin_lock(&line->count_lock); | 498 | spin_lock(&line->count_lock); |
| 500 | 499 | ||
| 501 | if (line->tty != NULL) { | 500 | if (line->count) { |
| 502 | *error_out = "Device is already open"; | 501 | *error_out = "Device is already open"; |
| 503 | goto out; | 502 | goto out; |
| 504 | } | 503 | } |
| @@ -722,41 +721,53 @@ struct winch { | |||
| 722 | int pid; | 721 | int pid; |
| 723 | struct tty_struct *tty; | 722 | struct tty_struct *tty; |
| 724 | unsigned long stack; | 723 | unsigned long stack; |
| 724 | struct work_struct work; | ||
| 725 | }; | 725 | }; |
| 726 | 726 | ||
| 727 | static void free_winch(struct winch *winch, int free_irq_ok) | 727 | static void __free_winch(struct work_struct *work) |
| 728 | { | 728 | { |
| 729 | if (free_irq_ok) | 729 | struct winch *winch = container_of(work, struct winch, work); |
| 730 | free_irq(WINCH_IRQ, winch); | 730 | free_irq(WINCH_IRQ, winch); |
| 731 | |||
| 732 | list_del(&winch->list); | ||
| 733 | 731 | ||
| 734 | if (winch->pid != -1) | 732 | if (winch->pid != -1) |
| 735 | os_kill_process(winch->pid, 1); | 733 | os_kill_process(winch->pid, 1); |
| 736 | if (winch->fd != -1) | ||
| 737 | os_close_file(winch->fd); | ||
| 738 | if (winch->stack != 0) | 734 | if (winch->stack != 0) |
| 739 | free_stack(winch->stack, 0); | 735 | free_stack(winch->stack, 0); |
| 740 | kfree(winch); | 736 | kfree(winch); |
| 741 | } | 737 | } |
| 742 | 738 | ||
| 739 | static void free_winch(struct winch *winch) | ||
| 740 | { | ||
| 741 | int fd = winch->fd; | ||
| 742 | winch->fd = -1; | ||
| 743 | if (fd != -1) | ||
| 744 | os_close_file(fd); | ||
| 745 | list_del(&winch->list); | ||
| 746 | __free_winch(&winch->work); | ||
| 747 | } | ||
| 748 | |||
| 743 | static irqreturn_t winch_interrupt(int irq, void *data) | 749 | static irqreturn_t winch_interrupt(int irq, void *data) |
| 744 | { | 750 | { |
| 745 | struct winch *winch = data; | 751 | struct winch *winch = data; |
| 746 | struct tty_struct *tty; | 752 | struct tty_struct *tty; |
| 747 | struct line *line; | 753 | struct line *line; |
| 754 | int fd = winch->fd; | ||
| 748 | int err; | 755 | int err; |
| 749 | char c; | 756 | char c; |
| 750 | 757 | ||
| 751 | if (winch->fd != -1) { | 758 | if (fd != -1) { |
| 752 | err = generic_read(winch->fd, &c, NULL); | 759 | err = generic_read(fd, &c, NULL); |
| 753 | if (err < 0) { | 760 | if (err < 0) { |
| 754 | if (err != -EAGAIN) { | 761 | if (err != -EAGAIN) { |
| 762 | winch->fd = -1; | ||
| 763 | list_del(&winch->list); | ||
| 764 | os_close_file(fd); | ||
| 755 | printk(KERN_ERR "winch_interrupt : " | 765 | printk(KERN_ERR "winch_interrupt : " |
| 756 | "read failed, errno = %d\n", -err); | 766 | "read failed, errno = %d\n", -err); |
| 757 | printk(KERN_ERR "fd %d is losing SIGWINCH " | 767 | printk(KERN_ERR "fd %d is losing SIGWINCH " |
| 758 | "support\n", winch->tty_fd); | 768 | "support\n", winch->tty_fd); |
| 759 | free_winch(winch, 0); | 769 | INIT_WORK(&winch->work, __free_winch); |
| 770 | schedule_work(&winch->work); | ||
| 760 | return IRQ_HANDLED; | 771 | return IRQ_HANDLED; |
| 761 | } | 772 | } |
| 762 | goto out; | 773 | goto out; |
| @@ -828,7 +839,7 @@ static void unregister_winch(struct tty_struct *tty) | |||
| 828 | list_for_each_safe(ele, next, &winch_handlers) { | 839 | list_for_each_safe(ele, next, &winch_handlers) { |
| 829 | winch = list_entry(ele, struct winch, list); | 840 | winch = list_entry(ele, struct winch, list); |
| 830 | if (winch->tty == tty) { | 841 | if (winch->tty == tty) { |
| 831 | free_winch(winch, 1); | 842 | free_winch(winch); |
| 832 | break; | 843 | break; |
| 833 | } | 844 | } |
| 834 | } | 845 | } |
| @@ -844,7 +855,7 @@ static void winch_cleanup(void) | |||
| 844 | 855 | ||
| 845 | list_for_each_safe(ele, next, &winch_handlers) { | 856 | list_for_each_safe(ele, next, &winch_handlers) { |
| 846 | winch = list_entry(ele, struct winch, list); | 857 | winch = list_entry(ele, struct winch, list); |
| 847 | free_winch(winch, 1); | 858 | free_winch(winch); |
| 848 | } | 859 | } |
| 849 | 860 | ||
| 850 | spin_unlock(&winch_handler_lock); | 861 | spin_unlock(&winch_handler_lock); |
diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c index 8ac7146c237f..2e1de5728604 100644 --- a/arch/um/drivers/xterm.c +++ b/arch/um/drivers/xterm.c | |||
| @@ -123,6 +123,7 @@ static int xterm_open(int input, int output, int primary, void *d, | |||
| 123 | err = -errno; | 123 | err = -errno; |
| 124 | printk(UM_KERN_ERR "xterm_open : unlink failed, errno = %d\n", | 124 | printk(UM_KERN_ERR "xterm_open : unlink failed, errno = %d\n", |
| 125 | errno); | 125 | errno); |
| 126 | close(fd); | ||
| 126 | return err; | 127 | return err; |
| 127 | } | 128 | } |
| 128 | close(fd); | 129 | close(fd); |
diff --git a/arch/um/include/asm/ptrace-generic.h b/arch/um/include/asm/ptrace-generic.h index ae084ad1a3a0..1a7d2757fe05 100644 --- a/arch/um/include/asm/ptrace-generic.h +++ b/arch/um/include/asm/ptrace-generic.h | |||
| @@ -42,10 +42,6 @@ extern long subarch_ptrace(struct task_struct *child, long request, | |||
| 42 | unsigned long addr, unsigned long data); | 42 | unsigned long addr, unsigned long data); |
| 43 | extern unsigned long getreg(struct task_struct *child, int regno); | 43 | extern unsigned long getreg(struct task_struct *child, int regno); |
| 44 | extern int putreg(struct task_struct *child, int regno, unsigned long value); | 44 | extern int putreg(struct task_struct *child, int regno, unsigned long value); |
| 45 | extern int get_fpregs(struct user_i387_struct __user *buf, | ||
| 46 | struct task_struct *child); | ||
| 47 | extern int set_fpregs(struct user_i387_struct __user *buf, | ||
| 48 | struct task_struct *child); | ||
| 49 | 45 | ||
| 50 | extern int arch_copy_tls(struct task_struct *new); | 46 | extern int arch_copy_tls(struct task_struct *new); |
| 51 | extern void clear_flushed_tls(struct task_struct *task); | 47 | extern void clear_flushed_tls(struct task_struct *task); |
diff --git a/arch/um/include/shared/line.h b/arch/um/include/shared/line.h index 72f4f25af247..63df3ca02ac2 100644 --- a/arch/um/include/shared/line.h +++ b/arch/um/include/shared/line.h | |||
| @@ -33,6 +33,7 @@ struct line_driver { | |||
| 33 | struct line { | 33 | struct line { |
| 34 | struct tty_struct *tty; | 34 | struct tty_struct *tty; |
| 35 | spinlock_t count_lock; | 35 | spinlock_t count_lock; |
| 36 | unsigned long count; | ||
| 36 | int valid; | 37 | int valid; |
| 37 | 38 | ||
| 38 | char *init_str; | 39 | char *init_str; |
diff --git a/arch/um/include/shared/registers.h b/arch/um/include/shared/registers.h index b0b4589e0ebc..f1e0aa56c52a 100644 --- a/arch/um/include/shared/registers.h +++ b/arch/um/include/shared/registers.h | |||
| @@ -16,7 +16,7 @@ extern int restore_fpx_registers(int pid, unsigned long *fp_regs); | |||
| 16 | extern int save_registers(int pid, struct uml_pt_regs *regs); | 16 | extern int save_registers(int pid, struct uml_pt_regs *regs); |
| 17 | extern int restore_registers(int pid, struct uml_pt_regs *regs); | 17 | extern int restore_registers(int pid, struct uml_pt_regs *regs); |
| 18 | extern int init_registers(int pid); | 18 | extern int init_registers(int pid); |
| 19 | extern void get_safe_registers(unsigned long *regs); | 19 | extern void get_safe_registers(unsigned long *regs, unsigned long *fp_regs); |
| 20 | extern unsigned long get_thread_reg(int reg, jmp_buf *buf); | 20 | extern unsigned long get_thread_reg(int reg, jmp_buf *buf); |
| 21 | extern int get_fp_registers(int pid, unsigned long *regs); | 21 | extern int get_fp_registers(int pid, unsigned long *regs); |
| 22 | extern int put_fp_registers(int pid, unsigned long *regs); | 22 | extern int put_fp_registers(int pid, unsigned long *regs); |
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index fab4371184f6..21c1ae7c3d75 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c | |||
| @@ -202,7 +202,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, | |||
| 202 | arch_copy_thread(¤t->thread.arch, &p->thread.arch); | 202 | arch_copy_thread(¤t->thread.arch, &p->thread.arch); |
| 203 | } | 203 | } |
| 204 | else { | 204 | else { |
| 205 | get_safe_registers(p->thread.regs.regs.gp); | 205 | get_safe_registers(p->thread.regs.regs.gp, p->thread.regs.regs.fp); |
| 206 | p->thread.request.u.thread = current->thread.request.u.thread; | 206 | p->thread.request.u.thread = current->thread.request.u.thread; |
| 207 | handler = new_thread_handler; | 207 | handler = new_thread_handler; |
| 208 | } | 208 | } |
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c index 701b672c1122..c9da32b0c707 100644 --- a/arch/um/kernel/ptrace.c +++ b/arch/um/kernel/ptrace.c | |||
| @@ -50,23 +50,11 @@ long arch_ptrace(struct task_struct *child, long request, | |||
| 50 | void __user *vp = p; | 50 | void __user *vp = p; |
| 51 | 51 | ||
| 52 | switch (request) { | 52 | switch (request) { |
| 53 | /* read word at location addr. */ | ||
| 54 | case PTRACE_PEEKTEXT: | ||
| 55 | case PTRACE_PEEKDATA: | ||
| 56 | ret = generic_ptrace_peekdata(child, addr, data); | ||
| 57 | break; | ||
| 58 | |||
| 59 | /* read the word at location addr in the USER area. */ | 53 | /* read the word at location addr in the USER area. */ |
| 60 | case PTRACE_PEEKUSR: | 54 | case PTRACE_PEEKUSR: |
| 61 | ret = peek_user(child, addr, data); | 55 | ret = peek_user(child, addr, data); |
| 62 | break; | 56 | break; |
| 63 | 57 | ||
| 64 | /* write the word at location addr. */ | ||
| 65 | case PTRACE_POKETEXT: | ||
| 66 | case PTRACE_POKEDATA: | ||
| 67 | ret = generic_ptrace_pokedata(child, addr, data); | ||
| 68 | break; | ||
| 69 | |||
| 70 | /* write the word at location addr in the USER area */ | 58 | /* write the word at location addr in the USER area */ |
| 71 | case PTRACE_POKEUSR: | 59 | case PTRACE_POKEUSR: |
| 72 | ret = poke_user(child, addr, data); | 60 | ret = poke_user(child, addr, data); |
| @@ -107,16 +95,6 @@ long arch_ptrace(struct task_struct *child, long request, | |||
| 107 | break; | 95 | break; |
| 108 | } | 96 | } |
| 109 | #endif | 97 | #endif |
| 110 | #ifdef PTRACE_GETFPREGS | ||
| 111 | case PTRACE_GETFPREGS: /* Get the child FPU state. */ | ||
| 112 | ret = get_fpregs(vp, child); | ||
| 113 | break; | ||
| 114 | #endif | ||
| 115 | #ifdef PTRACE_SETFPREGS | ||
| 116 | case PTRACE_SETFPREGS: /* Set the child FPU state. */ | ||
| 117 | ret = set_fpregs(vp, child); | ||
| 118 | break; | ||
| 119 | #endif | ||
| 120 | case PTRACE_GET_THREAD_AREA: | 98 | case PTRACE_GET_THREAD_AREA: |
| 121 | ret = ptrace_get_thread_area(child, addr, vp); | 99 | ret = ptrace_get_thread_area(child, addr, vp); |
| 122 | break; | 100 | break; |
| @@ -154,12 +132,6 @@ long arch_ptrace(struct task_struct *child, long request, | |||
| 154 | break; | 132 | break; |
| 155 | } | 133 | } |
| 156 | #endif | 134 | #endif |
| 157 | #ifdef PTRACE_ARCH_PRCTL | ||
| 158 | case PTRACE_ARCH_PRCTL: | ||
| 159 | /* XXX Calls ptrace on the host - needs some SMP thinking */ | ||
| 160 | ret = arch_prctl(child, data, (void __user *) addr); | ||
| 161 | break; | ||
| 162 | #endif | ||
| 163 | default: | 135 | default: |
| 164 | ret = ptrace_request(child, request, addr, data); | 136 | ret = ptrace_request(child, request, addr, data); |
| 165 | if (ret == -EIO) | 137 | if (ret == -EIO) |
diff --git a/arch/um/os-Linux/registers.c b/arch/um/os-Linux/registers.c index 830fe6a1518a..b866b9e3bef9 100644 --- a/arch/um/os-Linux/registers.c +++ b/arch/um/os-Linux/registers.c | |||
| @@ -8,6 +8,8 @@ | |||
| 8 | #include <string.h> | 8 | #include <string.h> |
| 9 | #include <sys/ptrace.h> | 9 | #include <sys/ptrace.h> |
| 10 | #include "sysdep/ptrace.h" | 10 | #include "sysdep/ptrace.h" |
| 11 | #include "sysdep/ptrace_user.h" | ||
| 12 | #include "registers.h" | ||
| 11 | 13 | ||
| 12 | int save_registers(int pid, struct uml_pt_regs *regs) | 14 | int save_registers(int pid, struct uml_pt_regs *regs) |
| 13 | { | 15 | { |
| @@ -32,6 +34,7 @@ int restore_registers(int pid, struct uml_pt_regs *regs) | |||
| 32 | /* This is set once at boot time and not changed thereafter */ | 34 | /* This is set once at boot time and not changed thereafter */ |
| 33 | 35 | ||
| 34 | static unsigned long exec_regs[MAX_REG_NR]; | 36 | static unsigned long exec_regs[MAX_REG_NR]; |
| 37 | static unsigned long exec_fp_regs[FP_SIZE]; | ||
| 35 | 38 | ||
| 36 | int init_registers(int pid) | 39 | int init_registers(int pid) |
| 37 | { | 40 | { |
| @@ -42,10 +45,14 @@ int init_registers(int pid) | |||
| 42 | return -errno; | 45 | return -errno; |
| 43 | 46 | ||
| 44 | arch_init_registers(pid); | 47 | arch_init_registers(pid); |
| 48 | get_fp_registers(pid, exec_fp_regs); | ||
| 45 | return 0; | 49 | return 0; |
| 46 | } | 50 | } |
| 47 | 51 | ||
| 48 | void get_safe_registers(unsigned long *regs) | 52 | void get_safe_registers(unsigned long *regs, unsigned long *fp_regs) |
| 49 | { | 53 | { |
| 50 | memcpy(regs, exec_regs, sizeof(exec_regs)); | 54 | memcpy(regs, exec_regs, sizeof(exec_regs)); |
| 55 | |||
| 56 | if (fp_regs) | ||
| 57 | memcpy(fp_regs, exec_fp_regs, sizeof(exec_fp_regs)); | ||
| 51 | } | 58 | } |
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c index d261f170d120..e771398be5f3 100644 --- a/arch/um/os-Linux/skas/mem.c +++ b/arch/um/os-Linux/skas/mem.c | |||
| @@ -39,7 +39,7 @@ static unsigned long syscall_regs[MAX_REG_NR]; | |||
| 39 | 39 | ||
| 40 | static int __init init_syscall_regs(void) | 40 | static int __init init_syscall_regs(void) |
| 41 | { | 41 | { |
| 42 | get_safe_registers(syscall_regs); | 42 | get_safe_registers(syscall_regs, NULL); |
| 43 | syscall_regs[REGS_IP_INDEX] = STUB_CODE + | 43 | syscall_regs[REGS_IP_INDEX] = STUB_CODE + |
| 44 | ((unsigned long) &batch_syscall_stub - | 44 | ((unsigned long) &batch_syscall_stub - |
| 45 | (unsigned long) &__syscall_stub_start); | 45 | (unsigned long) &__syscall_stub_start); |
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c index d6e0a2234b86..dee0e8cf8ad0 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c | |||
| @@ -373,6 +373,9 @@ void userspace(struct uml_pt_regs *regs) | |||
| 373 | if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp)) | 373 | if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp)) |
| 374 | fatal_sigsegv(); | 374 | fatal_sigsegv(); |
| 375 | 375 | ||
| 376 | if (put_fp_registers(pid, regs->fp)) | ||
| 377 | fatal_sigsegv(); | ||
| 378 | |||
| 376 | /* Now we set local_using_sysemu to be used for one loop */ | 379 | /* Now we set local_using_sysemu to be used for one loop */ |
| 377 | local_using_sysemu = get_using_sysemu(); | 380 | local_using_sysemu = get_using_sysemu(); |
| 378 | 381 | ||
| @@ -399,6 +402,12 @@ void userspace(struct uml_pt_regs *regs) | |||
| 399 | fatal_sigsegv(); | 402 | fatal_sigsegv(); |
| 400 | } | 403 | } |
| 401 | 404 | ||
| 405 | if (get_fp_registers(pid, regs->fp)) { | ||
| 406 | printk(UM_KERN_ERR "userspace - get_fp_registers failed, " | ||
| 407 | "errno = %d\n", errno); | ||
| 408 | fatal_sigsegv(); | ||
| 409 | } | ||
| 410 | |||
| 402 | UPT_SYSCALL_NR(regs) = -1; /* Assume: It's not a syscall */ | 411 | UPT_SYSCALL_NR(regs) = -1; /* Assume: It's not a syscall */ |
| 403 | 412 | ||
| 404 | if (WIFSTOPPED(status)) { | 413 | if (WIFSTOPPED(status)) { |
| @@ -457,10 +466,11 @@ void userspace(struct uml_pt_regs *regs) | |||
| 457 | } | 466 | } |
| 458 | 467 | ||
| 459 | static unsigned long thread_regs[MAX_REG_NR]; | 468 | static unsigned long thread_regs[MAX_REG_NR]; |
| 469 | static unsigned long thread_fp_regs[FP_SIZE]; | ||
| 460 | 470 | ||
| 461 | static int __init init_thread_regs(void) | 471 | static int __init init_thread_regs(void) |
| 462 | { | 472 | { |
| 463 | get_safe_registers(thread_regs); | 473 | get_safe_registers(thread_regs, thread_fp_regs); |
| 464 | /* Set parent's instruction pointer to start of clone-stub */ | 474 | /* Set parent's instruction pointer to start of clone-stub */ |
| 465 | thread_regs[REGS_IP_INDEX] = STUB_CODE + | 475 | thread_regs[REGS_IP_INDEX] = STUB_CODE + |
| 466 | (unsigned long) stub_clone_handler - | 476 | (unsigned long) stub_clone_handler - |
| @@ -503,6 +513,13 @@ int copy_context_skas0(unsigned long new_stack, int pid) | |||
| 503 | return err; | 513 | return err; |
| 504 | } | 514 | } |
| 505 | 515 | ||
| 516 | err = put_fp_registers(pid, thread_fp_regs); | ||
| 517 | if (err < 0) { | ||
| 518 | printk(UM_KERN_ERR "copy_context_skas0 : put_fp_registers " | ||
| 519 | "failed, pid = %d, err = %d\n", pid, err); | ||
| 520 | return err; | ||
| 521 | } | ||
| 522 | |||
| 506 | /* set a well known return code for detection of child write failure */ | 523 | /* set a well known return code for detection of child write failure */ |
| 507 | child_data->err = 12345678; | 524 | child_data->err = 12345678; |
| 508 | 525 | ||
diff --git a/arch/um/sys-i386/asm/ptrace.h b/arch/um/sys-i386/asm/ptrace.h index 0273e4d09af7..5d2a59112537 100644 --- a/arch/um/sys-i386/asm/ptrace.h +++ b/arch/um/sys-i386/asm/ptrace.h | |||
| @@ -42,11 +42,6 @@ | |||
| 42 | */ | 42 | */ |
| 43 | struct user_desc; | 43 | struct user_desc; |
| 44 | 44 | ||
| 45 | extern int get_fpxregs(struct user_fxsr_struct __user *buf, | ||
| 46 | struct task_struct *child); | ||
| 47 | extern int set_fpxregs(struct user_fxsr_struct __user *buf, | ||
| 48 | struct task_struct *tsk); | ||
| 49 | |||
| 50 | extern int ptrace_get_thread_area(struct task_struct *child, int idx, | 45 | extern int ptrace_get_thread_area(struct task_struct *child, int idx, |
| 51 | struct user_desc __user *user_desc); | 46 | struct user_desc __user *user_desc); |
| 52 | 47 | ||
diff --git a/arch/um/sys-i386/ptrace.c b/arch/um/sys-i386/ptrace.c index d23b2d3ea384..3375c2717851 100644 --- a/arch/um/sys-i386/ptrace.c +++ b/arch/um/sys-i386/ptrace.c | |||
| @@ -145,7 +145,7 @@ int peek_user(struct task_struct *child, long addr, long data) | |||
| 145 | return put_user(tmp, (unsigned long __user *) data); | 145 | return put_user(tmp, (unsigned long __user *) data); |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) | 148 | static int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) |
| 149 | { | 149 | { |
| 150 | int err, n, cpu = ((struct thread_info *) child->stack)->cpu; | 150 | int err, n, cpu = ((struct thread_info *) child->stack)->cpu; |
| 151 | struct user_i387_struct fpregs; | 151 | struct user_i387_struct fpregs; |
| @@ -161,7 +161,7 @@ int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) | |||
| 161 | return n; | 161 | return n; |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) | 164 | static int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) |
| 165 | { | 165 | { |
| 166 | int n, cpu = ((struct thread_info *) child->stack)->cpu; | 166 | int n, cpu = ((struct thread_info *) child->stack)->cpu; |
| 167 | struct user_i387_struct fpregs; | 167 | struct user_i387_struct fpregs; |
| @@ -174,7 +174,7 @@ int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) | |||
| 174 | (unsigned long *) &fpregs); | 174 | (unsigned long *) &fpregs); |
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child) | 177 | static int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child) |
| 178 | { | 178 | { |
| 179 | int err, n, cpu = ((struct thread_info *) child->stack)->cpu; | 179 | int err, n, cpu = ((struct thread_info *) child->stack)->cpu; |
| 180 | struct user_fxsr_struct fpregs; | 180 | struct user_fxsr_struct fpregs; |
| @@ -190,7 +190,7 @@ int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child) | |||
| 190 | return n; | 190 | return n; |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child) | 193 | static int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child) |
| 194 | { | 194 | { |
| 195 | int n, cpu = ((struct thread_info *) child->stack)->cpu; | 195 | int n, cpu = ((struct thread_info *) child->stack)->cpu; |
| 196 | struct user_fxsr_struct fpregs; | 196 | struct user_fxsr_struct fpregs; |
| @@ -206,5 +206,23 @@ int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child) | |||
| 206 | long subarch_ptrace(struct task_struct *child, long request, | 206 | long subarch_ptrace(struct task_struct *child, long request, |
| 207 | unsigned long addr, unsigned long data) | 207 | unsigned long addr, unsigned long data) |
| 208 | { | 208 | { |
| 209 | return -EIO; | 209 | int ret = -EIO; |
| 210 | void __user *datap = (void __user *) data; | ||
| 211 | switch (request) { | ||
| 212 | case PTRACE_GETFPREGS: /* Get the child FPU state. */ | ||
| 213 | ret = get_fpregs(datap, child); | ||
| 214 | break; | ||
| 215 | case PTRACE_SETFPREGS: /* Set the child FPU state. */ | ||
| 216 | ret = set_fpregs(datap, child); | ||
| 217 | break; | ||
| 218 | case PTRACE_GETFPXREGS: /* Get the child FPU state. */ | ||
| 219 | ret = get_fpxregs(datap, child); | ||
| 220 | break; | ||
| 221 | case PTRACE_SETFPXREGS: /* Set the child FPU state. */ | ||
| 222 | ret = set_fpxregs(datap, child); | ||
| 223 | break; | ||
| 224 | default: | ||
| 225 | ret = -EIO; | ||
| 226 | } | ||
| 227 | return ret; | ||
| 210 | } | 228 | } |
diff --git a/arch/um/sys-i386/shared/sysdep/ptrace.h b/arch/um/sys-i386/shared/sysdep/ptrace.h index d50e62e07070..c398a5076111 100644 --- a/arch/um/sys-i386/shared/sysdep/ptrace.h +++ b/arch/um/sys-i386/shared/sysdep/ptrace.h | |||
| @@ -53,6 +53,7 @@ extern int sysemu_supported; | |||
| 53 | 53 | ||
| 54 | struct uml_pt_regs { | 54 | struct uml_pt_regs { |
| 55 | unsigned long gp[MAX_REG_NR]; | 55 | unsigned long gp[MAX_REG_NR]; |
| 56 | unsigned long fp[HOST_FPX_SIZE]; | ||
| 56 | struct faultinfo faultinfo; | 57 | struct faultinfo faultinfo; |
| 57 | long syscall; | 58 | long syscall; |
| 58 | int is_user; | 59 | int is_user; |
diff --git a/arch/um/sys-x86_64/ptrace.c b/arch/um/sys-x86_64/ptrace.c index f43613643cdb..4005506834fd 100644 --- a/arch/um/sys-x86_64/ptrace.c +++ b/arch/um/sys-x86_64/ptrace.c | |||
| @@ -145,7 +145,7 @@ int is_syscall(unsigned long addr) | |||
| 145 | return instr == 0x050f; | 145 | return instr == 0x050f; |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) | 148 | static int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) |
| 149 | { | 149 | { |
| 150 | int err, n, cpu = ((struct thread_info *) child->stack)->cpu; | 150 | int err, n, cpu = ((struct thread_info *) child->stack)->cpu; |
| 151 | long fpregs[HOST_FP_SIZE]; | 151 | long fpregs[HOST_FP_SIZE]; |
| @@ -162,7 +162,7 @@ int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) | |||
| 162 | return n; | 162 | return n; |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) | 165 | static int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) |
| 166 | { | 166 | { |
| 167 | int n, cpu = ((struct thread_info *) child->stack)->cpu; | 167 | int n, cpu = ((struct thread_info *) child->stack)->cpu; |
| 168 | long fpregs[HOST_FP_SIZE]; | 168 | long fpregs[HOST_FP_SIZE]; |
| @@ -182,12 +182,16 @@ long subarch_ptrace(struct task_struct *child, long request, | |||
| 182 | void __user *datap = (void __user *) data; | 182 | void __user *datap = (void __user *) data; |
| 183 | 183 | ||
| 184 | switch (request) { | 184 | switch (request) { |
| 185 | case PTRACE_GETFPXREGS: /* Get the child FPU state. */ | 185 | case PTRACE_GETFPREGS: /* Get the child FPU state. */ |
| 186 | ret = get_fpregs(datap, child); | 186 | ret = get_fpregs(datap, child); |
| 187 | break; | 187 | break; |
| 188 | case PTRACE_SETFPXREGS: /* Set the child FPU state. */ | 188 | case PTRACE_SETFPREGS: /* Set the child FPU state. */ |
| 189 | ret = set_fpregs(datap, child); | 189 | ret = set_fpregs(datap, child); |
| 190 | break; | 190 | break; |
| 191 | case PTRACE_ARCH_PRCTL: | ||
| 192 | /* XXX Calls ptrace on the host - needs some SMP thinking */ | ||
| 193 | ret = arch_prctl(child, data, (void __user *) addr); | ||
| 194 | break; | ||
| 191 | } | 195 | } |
| 192 | 196 | ||
| 193 | return ret; | 197 | return ret; |
diff --git a/arch/um/sys-x86_64/shared/sysdep/ptrace.h b/arch/um/sys-x86_64/shared/sysdep/ptrace.h index fdba5457947a..8ee8f8e12af1 100644 --- a/arch/um/sys-x86_64/shared/sysdep/ptrace.h +++ b/arch/um/sys-x86_64/shared/sysdep/ptrace.h | |||
| @@ -85,6 +85,7 @@ | |||
| 85 | 85 | ||
| 86 | struct uml_pt_regs { | 86 | struct uml_pt_regs { |
| 87 | unsigned long gp[MAX_REG_NR]; | 87 | unsigned long gp[MAX_REG_NR]; |
| 88 | unsigned long fp[HOST_FP_SIZE]; | ||
| 88 | struct faultinfo faultinfo; | 89 | struct faultinfo faultinfo; |
| 89 | long syscall; | 90 | long syscall; |
| 90 | int is_user; | 91 | int is_user; |
diff --git a/arch/x86/include/asm/alternative-asm.h b/arch/x86/include/asm/alternative-asm.h index 4554cc6fb96a..091508b533b4 100644 --- a/arch/x86/include/asm/alternative-asm.h +++ b/arch/x86/include/asm/alternative-asm.h | |||
| @@ -16,7 +16,6 @@ | |||
| 16 | #endif | 16 | #endif |
| 17 | 17 | ||
| 18 | .macro altinstruction_entry orig alt feature orig_len alt_len | 18 | .macro altinstruction_entry orig alt feature orig_len alt_len |
| 19 | .align 8 | ||
| 20 | .long \orig - . | 19 | .long \orig - . |
| 21 | .long \alt - . | 20 | .long \alt - . |
| 22 | .word \feature | 21 | .word \feature |
diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h index 23fb6d79f209..37ad100a2210 100644 --- a/arch/x86/include/asm/alternative.h +++ b/arch/x86/include/asm/alternative.h | |||
| @@ -48,9 +48,6 @@ struct alt_instr { | |||
| 48 | u16 cpuid; /* cpuid bit set for replacement */ | 48 | u16 cpuid; /* cpuid bit set for replacement */ |
| 49 | u8 instrlen; /* length of original instruction */ | 49 | u8 instrlen; /* length of original instruction */ |
| 50 | u8 replacementlen; /* length of new instruction, <= instrlen */ | 50 | u8 replacementlen; /* length of new instruction, <= instrlen */ |
| 51 | #ifdef CONFIG_X86_64 | ||
| 52 | u32 pad2; | ||
| 53 | #endif | ||
| 54 | }; | 51 | }; |
| 55 | 52 | ||
| 56 | extern void alternative_instructions(void); | 53 | extern void alternative_instructions(void); |
| @@ -83,7 +80,6 @@ static inline int alternatives_text_reserved(void *start, void *end) | |||
| 83 | \ | 80 | \ |
| 84 | "661:\n\t" oldinstr "\n662:\n" \ | 81 | "661:\n\t" oldinstr "\n662:\n" \ |
| 85 | ".section .altinstructions,\"a\"\n" \ | 82 | ".section .altinstructions,\"a\"\n" \ |
| 86 | _ASM_ALIGN "\n" \ | ||
| 87 | " .long 661b - .\n" /* label */ \ | 83 | " .long 661b - .\n" /* label */ \ |
| 88 | " .long 663f - .\n" /* new instruction */ \ | 84 | " .long 663f - .\n" /* new instruction */ \ |
| 89 | " .word " __stringify(feature) "\n" /* feature bit */ \ | 85 | " .word " __stringify(feature) "\n" /* feature bit */ \ |
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index 4258aac99a6e..88b23a43f340 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h | |||
| @@ -332,7 +332,6 @@ static __always_inline __pure bool __static_cpu_has(u16 bit) | |||
| 332 | asm goto("1: jmp %l[t_no]\n" | 332 | asm goto("1: jmp %l[t_no]\n" |
| 333 | "2:\n" | 333 | "2:\n" |
| 334 | ".section .altinstructions,\"a\"\n" | 334 | ".section .altinstructions,\"a\"\n" |
| 335 | _ASM_ALIGN "\n" | ||
| 336 | " .long 1b - .\n" | 335 | " .long 1b - .\n" |
| 337 | " .long 0\n" /* no replacement */ | 336 | " .long 0\n" /* no replacement */ |
| 338 | " .word %P0\n" /* feature bit */ | 337 | " .word %P0\n" /* feature bit */ |
| @@ -350,7 +349,6 @@ static __always_inline __pure bool __static_cpu_has(u16 bit) | |||
| 350 | asm volatile("1: movb $0,%0\n" | 349 | asm volatile("1: movb $0,%0\n" |
| 351 | "2:\n" | 350 | "2:\n" |
| 352 | ".section .altinstructions,\"a\"\n" | 351 | ".section .altinstructions,\"a\"\n" |
| 353 | _ASM_ALIGN "\n" | ||
| 354 | " .long 1b - .\n" | 352 | " .long 1b - .\n" |
| 355 | " .long 3f - .\n" | 353 | " .long 3f - .\n" |
| 356 | " .word %P1\n" /* feature bit */ | 354 | " .word %P1\n" /* feature bit */ |
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index 20a614275064..3dd53f997b11 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
| @@ -1721,10 +1721,8 @@ void __init xen_setup_machphys_mapping(void) | |||
| 1721 | machine_to_phys_nr = MACH2PHYS_NR_ENTRIES; | 1721 | machine_to_phys_nr = MACH2PHYS_NR_ENTRIES; |
| 1722 | } | 1722 | } |
| 1723 | #ifdef CONFIG_X86_32 | 1723 | #ifdef CONFIG_X86_32 |
| 1724 | if ((machine_to_phys_mapping + machine_to_phys_nr) | 1724 | WARN_ON((machine_to_phys_mapping + (machine_to_phys_nr - 1)) |
| 1725 | < machine_to_phys_mapping) | 1725 | < machine_to_phys_mapping); |
| 1726 | machine_to_phys_nr = (unsigned long *)NULL | ||
| 1727 | - machine_to_phys_mapping; | ||
| 1728 | #endif | 1726 | #endif |
| 1729 | } | 1727 | } |
| 1730 | 1728 | ||
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index c3b8d440873c..46d6d21dbdbe 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
| @@ -306,10 +306,12 @@ char * __init xen_memory_setup(void) | |||
| 306 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); | 306 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); |
| 307 | 307 | ||
| 308 | extra_limit = xen_get_max_pages(); | 308 | extra_limit = xen_get_max_pages(); |
| 309 | if (extra_limit >= max_pfn) | 309 | if (max_pfn + extra_pages > extra_limit) { |
| 310 | extra_pages = extra_limit - max_pfn; | 310 | if (extra_limit > max_pfn) |
| 311 | else | 311 | extra_pages = extra_limit - max_pfn; |
| 312 | extra_pages = 0; | 312 | else |
| 313 | extra_pages = 0; | ||
| 314 | } | ||
| 313 | 315 | ||
| 314 | extra_pages += xen_return_unused_memory(xen_start_info->nr_pages, &e820); | 316 | extra_pages += xen_return_unused_memory(xen_start_info->nr_pages, &e820); |
| 315 | 317 | ||
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c index d4fc6d454f8d..041d4fe9dfe4 100644 --- a/arch/x86/xen/smp.c +++ b/arch/x86/xen/smp.c | |||
| @@ -532,7 +532,6 @@ static void __init xen_hvm_smp_prepare_cpus(unsigned int max_cpus) | |||
| 532 | WARN_ON(xen_smp_intr_init(0)); | 532 | WARN_ON(xen_smp_intr_init(0)); |
| 533 | 533 | ||
| 534 | xen_init_lock_cpu(0); | 534 | xen_init_lock_cpu(0); |
| 535 | xen_init_spinlocks(); | ||
| 536 | } | 535 | } |
| 537 | 536 | ||
| 538 | static int __cpuinit xen_hvm_cpu_up(unsigned int cpu) | 537 | static int __cpuinit xen_hvm_cpu_up(unsigned int cpu) |
diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-cpufreq.c index 7b0603eb0129..cdc02ac8f41a 100644 --- a/drivers/cpufreq/pcc-cpufreq.c +++ b/drivers/cpufreq/pcc-cpufreq.c | |||
| @@ -261,6 +261,9 @@ static int pcc_get_offset(int cpu) | |||
| 261 | pr = per_cpu(processors, cpu); | 261 | pr = per_cpu(processors, cpu); |
| 262 | pcc_cpu_data = per_cpu_ptr(pcc_cpu_info, cpu); | 262 | pcc_cpu_data = per_cpu_ptr(pcc_cpu_info, cpu); |
| 263 | 263 | ||
| 264 | if (!pr) | ||
| 265 | return -ENODEV; | ||
| 266 | |||
| 264 | status = acpi_evaluate_object(pr->handle, "PCCP", NULL, &buffer); | 267 | status = acpi_evaluate_object(pr->handle, "PCCP", NULL, &buffer); |
| 265 | if (ACPI_FAILURE(status)) | 268 | if (ACPI_FAILURE(status)) |
| 266 | return -ENODEV; | 269 | return -ENODEV; |
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 57cd3a406edf..fd7170a9ad2c 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
| @@ -290,6 +290,9 @@ static const struct { | |||
| 290 | {PCI_VENDOR_ID_NEC, PCI_ANY_ID, PCI_ANY_ID, | 290 | {PCI_VENDOR_ID_NEC, PCI_ANY_ID, PCI_ANY_ID, |
| 291 | QUIRK_CYCLE_TIMER}, | 291 | QUIRK_CYCLE_TIMER}, |
| 292 | 292 | ||
| 293 | {PCI_VENDOR_ID_O2, PCI_ANY_ID, PCI_ANY_ID, | ||
| 294 | QUIRK_NO_MSI}, | ||
| 295 | |||
| 293 | {PCI_VENDOR_ID_RICOH, PCI_ANY_ID, PCI_ANY_ID, | 296 | {PCI_VENDOR_ID_RICOH, PCI_ANY_ID, PCI_ANY_ID, |
| 294 | QUIRK_CYCLE_TIMER}, | 297 | QUIRK_CYCLE_TIMER}, |
| 295 | 298 | ||
diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c index 231714def4d2..4e24436b0f82 100644 --- a/drivers/gpio/gpio-generic.c +++ b/drivers/gpio/gpio-generic.c | |||
| @@ -351,7 +351,7 @@ static int bgpio_setup_direction(struct bgpio_chip *bgc, | |||
| 351 | return 0; | 351 | return 0; |
| 352 | } | 352 | } |
| 353 | 353 | ||
| 354 | int __devexit bgpio_remove(struct bgpio_chip *bgc) | 354 | int bgpio_remove(struct bgpio_chip *bgc) |
| 355 | { | 355 | { |
| 356 | int err = gpiochip_remove(&bgc->gc); | 356 | int err = gpiochip_remove(&bgc->gc); |
| 357 | 357 | ||
| @@ -361,15 +361,10 @@ int __devexit bgpio_remove(struct bgpio_chip *bgc) | |||
| 361 | } | 361 | } |
| 362 | EXPORT_SYMBOL_GPL(bgpio_remove); | 362 | EXPORT_SYMBOL_GPL(bgpio_remove); |
| 363 | 363 | ||
| 364 | int __devinit bgpio_init(struct bgpio_chip *bgc, | 364 | int bgpio_init(struct bgpio_chip *bgc, struct device *dev, |
| 365 | struct device *dev, | 365 | unsigned long sz, void __iomem *dat, void __iomem *set, |
| 366 | unsigned long sz, | 366 | void __iomem *clr, void __iomem *dirout, void __iomem *dirin, |
| 367 | void __iomem *dat, | 367 | bool big_endian) |
| 368 | void __iomem *set, | ||
| 369 | void __iomem *clr, | ||
| 370 | void __iomem *dirout, | ||
| 371 | void __iomem *dirin, | ||
| 372 | bool big_endian) | ||
| 373 | { | 368 | { |
| 374 | int ret; | 369 | int ret; |
| 375 | 370 | ||
diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c index a597039d0755..72ca689b6474 100644 --- a/drivers/hid/hid-wacom.c +++ b/drivers/hid/hid-wacom.c | |||
| @@ -373,6 +373,8 @@ static int wacom_probe(struct hid_device *hdev, | |||
| 373 | hidinput = list_entry(hdev->inputs.next, struct hid_input, list); | 373 | hidinput = list_entry(hdev->inputs.next, struct hid_input, list); |
| 374 | input = hidinput->input; | 374 | input = hidinput->input; |
| 375 | 375 | ||
| 376 | __set_bit(INPUT_PROP_POINTER, input->propbit); | ||
| 377 | |||
| 376 | /* Basics */ | 378 | /* Basics */ |
| 377 | input->evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_REL); | 379 | input->evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_REL); |
| 378 | 380 | ||
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 59d83e83da7f..411257676133 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
| @@ -601,7 +601,12 @@ static int create_core_data(struct platform_data *pdata, | |||
| 601 | err = rdmsr_safe_on_cpu(cpu, tdata->intrpt_reg, &eax, &edx); | 601 | err = rdmsr_safe_on_cpu(cpu, tdata->intrpt_reg, &eax, &edx); |
| 602 | if (!err) { | 602 | if (!err) { |
| 603 | tdata->attr_size += MAX_THRESH_ATTRS; | 603 | tdata->attr_size += MAX_THRESH_ATTRS; |
| 604 | tdata->ttarget = tdata->tjmax - ((eax >> 16) & 0x7f) * 1000; | 604 | tdata->tmin = tdata->tjmax - |
| 605 | ((eax & THERM_MASK_THRESHOLD0) >> | ||
| 606 | THERM_SHIFT_THRESHOLD0) * 1000; | ||
| 607 | tdata->ttarget = tdata->tjmax - | ||
| 608 | ((eax & THERM_MASK_THRESHOLD1) >> | ||
| 609 | THERM_SHIFT_THRESHOLD1) * 1000; | ||
| 605 | } | 610 | } |
| 606 | 611 | ||
| 607 | pdata->core_data[attr_no] = tdata; | 612 | pdata->core_data[attr_no] = tdata; |
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index a561c3a0e916..397fc59b5682 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c | |||
| @@ -978,6 +978,8 @@ static void pmbus_find_max_attr(struct i2c_client *client, | |||
| 978 | struct pmbus_limit_attr { | 978 | struct pmbus_limit_attr { |
| 979 | u16 reg; /* Limit register */ | 979 | u16 reg; /* Limit register */ |
| 980 | bool update; /* True if register needs updates */ | 980 | bool update; /* True if register needs updates */ |
| 981 | bool low; /* True if low limit; for limits with compare | ||
| 982 | functions only */ | ||
| 981 | const char *attr; /* Attribute name */ | 983 | const char *attr; /* Attribute name */ |
| 982 | const char *alarm; /* Alarm attribute name */ | 984 | const char *alarm; /* Alarm attribute name */ |
| 983 | u32 sbit; /* Alarm attribute status bit */ | 985 | u32 sbit; /* Alarm attribute status bit */ |
| @@ -1029,7 +1031,8 @@ static bool pmbus_add_limit_attrs(struct i2c_client *client, | |||
| 1029 | if (attr->compare) { | 1031 | if (attr->compare) { |
| 1030 | pmbus_add_boolean_cmp(data, name, | 1032 | pmbus_add_boolean_cmp(data, name, |
| 1031 | l->alarm, index, | 1033 | l->alarm, index, |
| 1032 | cbase, cindex, | 1034 | l->low ? cindex : cbase, |
| 1035 | l->low ? cbase : cindex, | ||
| 1033 | attr->sbase + page, l->sbit); | 1036 | attr->sbase + page, l->sbit); |
| 1034 | } else { | 1037 | } else { |
| 1035 | pmbus_add_boolean_reg(data, name, | 1038 | pmbus_add_boolean_reg(data, name, |
| @@ -1366,11 +1369,13 @@ static const struct pmbus_sensor_attr power_attributes[] = { | |||
| 1366 | static const struct pmbus_limit_attr temp_limit_attrs[] = { | 1369 | static const struct pmbus_limit_attr temp_limit_attrs[] = { |
| 1367 | { | 1370 | { |
| 1368 | .reg = PMBUS_UT_WARN_LIMIT, | 1371 | .reg = PMBUS_UT_WARN_LIMIT, |
| 1372 | .low = true, | ||
| 1369 | .attr = "min", | 1373 | .attr = "min", |
| 1370 | .alarm = "min_alarm", | 1374 | .alarm = "min_alarm", |
| 1371 | .sbit = PB_TEMP_UT_WARNING, | 1375 | .sbit = PB_TEMP_UT_WARNING, |
| 1372 | }, { | 1376 | }, { |
| 1373 | .reg = PMBUS_UT_FAULT_LIMIT, | 1377 | .reg = PMBUS_UT_FAULT_LIMIT, |
| 1378 | .low = true, | ||
| 1374 | .attr = "lcrit", | 1379 | .attr = "lcrit", |
| 1375 | .alarm = "lcrit_alarm", | 1380 | .alarm = "lcrit_alarm", |
| 1376 | .sbit = PB_TEMP_UT_FAULT, | 1381 | .sbit = PB_TEMP_UT_FAULT, |
| @@ -1399,11 +1404,13 @@ static const struct pmbus_limit_attr temp_limit_attrs[] = { | |||
| 1399 | static const struct pmbus_limit_attr temp_limit_attrs23[] = { | 1404 | static const struct pmbus_limit_attr temp_limit_attrs23[] = { |
| 1400 | { | 1405 | { |
| 1401 | .reg = PMBUS_UT_WARN_LIMIT, | 1406 | .reg = PMBUS_UT_WARN_LIMIT, |
| 1407 | .low = true, | ||
| 1402 | .attr = "min", | 1408 | .attr = "min", |
| 1403 | .alarm = "min_alarm", | 1409 | .alarm = "min_alarm", |
| 1404 | .sbit = PB_TEMP_UT_WARNING, | 1410 | .sbit = PB_TEMP_UT_WARNING, |
| 1405 | }, { | 1411 | }, { |
| 1406 | .reg = PMBUS_UT_FAULT_LIMIT, | 1412 | .reg = PMBUS_UT_FAULT_LIMIT, |
| 1413 | .low = true, | ||
| 1407 | .attr = "lcrit", | 1414 | .attr = "lcrit", |
| 1408 | .alarm = "lcrit_alarm", | 1415 | .alarm = "lcrit_alarm", |
| 1409 | .sbit = PB_TEMP_UT_FAULT, | 1416 | .sbit = PB_TEMP_UT_FAULT, |
diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c index 7b404e5443ed..e34eeb8ae371 100644 --- a/drivers/input/keyboard/adp5588-keys.c +++ b/drivers/input/keyboard/adp5588-keys.c | |||
| @@ -668,4 +668,3 @@ module_exit(adp5588_exit); | |||
| 668 | MODULE_LICENSE("GPL"); | 668 | MODULE_LICENSE("GPL"); |
| 669 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); | 669 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); |
| 670 | MODULE_DESCRIPTION("ADP5588/87 Keypad driver"); | 670 | MODULE_DESCRIPTION("ADP5588/87 Keypad driver"); |
| 671 | MODULE_ALIAS("platform:adp5588-keys"); | ||
diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c index b09c7d127219..ab860511f016 100644 --- a/drivers/input/misc/cm109.c +++ b/drivers/input/misc/cm109.c | |||
| @@ -475,7 +475,7 @@ static void cm109_toggle_buzzer_sync(struct cm109_dev *dev, int on) | |||
| 475 | le16_to_cpu(dev->ctl_req->wIndex), | 475 | le16_to_cpu(dev->ctl_req->wIndex), |
| 476 | dev->ctl_data, | 476 | dev->ctl_data, |
| 477 | USB_PKT_LEN, USB_CTRL_SET_TIMEOUT); | 477 | USB_PKT_LEN, USB_CTRL_SET_TIMEOUT); |
| 478 | if (error && error != EINTR) | 478 | if (error < 0 && error != -EINTR) |
| 479 | err("%s: usb_control_msg() failed %d", __func__, error); | 479 | err("%s: usb_control_msg() failed %d", __func__, error); |
| 480 | } | 480 | } |
| 481 | 481 | ||
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c index da280189ef07..5ec617e28f7e 100644 --- a/drivers/input/mouse/bcm5974.c +++ b/drivers/input/mouse/bcm5974.c | |||
| @@ -67,6 +67,10 @@ | |||
| 67 | #define USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI 0x0245 | 67 | #define USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI 0x0245 |
| 68 | #define USB_DEVICE_ID_APPLE_WELLSPRING5_ISO 0x0246 | 68 | #define USB_DEVICE_ID_APPLE_WELLSPRING5_ISO 0x0246 |
| 69 | #define USB_DEVICE_ID_APPLE_WELLSPRING5_JIS 0x0247 | 69 | #define USB_DEVICE_ID_APPLE_WELLSPRING5_JIS 0x0247 |
| 70 | /* MacbookAir4,1 (unibody, July 2011) */ | ||
| 71 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI 0x0249 | ||
| 72 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO 0x024a | ||
| 73 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS 0x024b | ||
| 70 | /* MacbookAir4,2 (unibody, July 2011) */ | 74 | /* MacbookAir4,2 (unibody, July 2011) */ |
| 71 | #define USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI 0x024c | 75 | #define USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI 0x024c |
| 72 | #define USB_DEVICE_ID_APPLE_WELLSPRING6_ISO 0x024d | 76 | #define USB_DEVICE_ID_APPLE_WELLSPRING6_ISO 0x024d |
| @@ -112,6 +116,10 @@ static const struct usb_device_id bcm5974_table[] = { | |||
| 112 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI), | 116 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI), |
| 113 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING5_ISO), | 117 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING5_ISO), |
| 114 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING5_JIS), | 118 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING5_JIS), |
| 119 | /* MacbookAir4,1 */ | ||
| 120 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI), | ||
| 121 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO), | ||
| 122 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS), | ||
| 115 | /* MacbookAir4,2 */ | 123 | /* MacbookAir4,2 */ |
| 116 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI), | 124 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI), |
| 117 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING6_ISO), | 125 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING6_ISO), |
| @@ -334,6 +342,18 @@ static const struct bcm5974_config bcm5974_config_table[] = { | |||
| 334 | { DIM_X, DIM_X / SN_COORD, -4750, 5280 }, | 342 | { DIM_X, DIM_X / SN_COORD, -4750, 5280 }, |
| 335 | { DIM_Y, DIM_Y / SN_COORD, -150, 6730 } | 343 | { DIM_Y, DIM_Y / SN_COORD, -150, 6730 } |
| 336 | }, | 344 | }, |
| 345 | { | ||
| 346 | USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI, | ||
| 347 | USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO, | ||
| 348 | USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS, | ||
| 349 | HAS_INTEGRATED_BUTTON, | ||
| 350 | 0x84, sizeof(struct bt_data), | ||
| 351 | 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, | ||
| 352 | { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 300 }, | ||
| 353 | { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 }, | ||
| 354 | { DIM_X, DIM_X / SN_COORD, -4620, 5140 }, | ||
| 355 | { DIM_Y, DIM_Y / SN_COORD, -150, 6600 } | ||
| 356 | }, | ||
| 337 | {} | 357 | {} |
| 338 | }; | 358 | }; |
| 339 | 359 | ||
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index d27c9d91630b..958b4eb6369d 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
| @@ -229,13 +229,6 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi | |||
| 229 | get_unaligned_le16(&report[i + 3]); | 229 | get_unaligned_le16(&report[i + 3]); |
| 230 | i += 4; | 230 | i += 4; |
| 231 | } | 231 | } |
| 232 | } else if (usage == WCM_DIGITIZER) { | ||
| 233 | /* max pressure isn't reported | ||
| 234 | features->pressure_max = (unsigned short) | ||
| 235 | (report[i+4] << 8 | report[i + 3]); | ||
| 236 | */ | ||
| 237 | features->pressure_max = 255; | ||
| 238 | i += 4; | ||
| 239 | } | 232 | } |
| 240 | break; | 233 | break; |
| 241 | 234 | ||
| @@ -291,13 +284,6 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi | |||
| 291 | pen = 1; | 284 | pen = 1; |
| 292 | i++; | 285 | i++; |
| 293 | break; | 286 | break; |
| 294 | |||
| 295 | case HID_USAGE_UNDEFINED: | ||
| 296 | if (usage == WCM_DESKTOP && finger) /* capacity */ | ||
| 297 | features->pressure_max = | ||
| 298 | get_unaligned_le16(&report[i + 3]); | ||
| 299 | i += 4; | ||
| 300 | break; | ||
| 301 | } | 287 | } |
| 302 | break; | 288 | break; |
| 303 | 289 | ||
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index c1c2f7b28d89..0dc97ec15c28 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
| @@ -800,25 +800,26 @@ static int wacom_bpt_touch(struct wacom_wac *wacom) | |||
| 800 | int i; | 800 | int i; |
| 801 | 801 | ||
| 802 | for (i = 0; i < 2; i++) { | 802 | for (i = 0; i < 2; i++) { |
| 803 | int p = data[9 * i + 2]; | 803 | int offset = (data[1] & 0x80) ? (8 * i) : (9 * i); |
| 804 | bool touch = p && !wacom->shared->stylus_in_proximity; | 804 | bool touch = data[offset + 3] & 0x80; |
| 805 | 805 | ||
| 806 | input_mt_slot(input, i); | ||
| 807 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); | ||
| 808 | /* | 806 | /* |
| 809 | * Touch events need to be disabled while stylus is | 807 | * Touch events need to be disabled while stylus is |
| 810 | * in proximity because user's hand is resting on touchpad | 808 | * in proximity because user's hand is resting on touchpad |
| 811 | * and sending unwanted events. User expects tablet buttons | 809 | * and sending unwanted events. User expects tablet buttons |
| 812 | * to continue working though. | 810 | * to continue working though. |
| 813 | */ | 811 | */ |
| 812 | touch = touch && !wacom->shared->stylus_in_proximity; | ||
| 813 | |||
| 814 | input_mt_slot(input, i); | ||
| 815 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); | ||
| 814 | if (touch) { | 816 | if (touch) { |
| 815 | int x = get_unaligned_be16(&data[9 * i + 3]) & 0x7ff; | 817 | int x = get_unaligned_be16(&data[offset + 3]) & 0x7ff; |
| 816 | int y = get_unaligned_be16(&data[9 * i + 5]) & 0x7ff; | 818 | int y = get_unaligned_be16(&data[offset + 5]) & 0x7ff; |
| 817 | if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) { | 819 | if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) { |
| 818 | x <<= 5; | 820 | x <<= 5; |
| 819 | y <<= 5; | 821 | y <<= 5; |
| 820 | } | 822 | } |
| 821 | input_report_abs(input, ABS_MT_PRESSURE, p); | ||
| 822 | input_report_abs(input, ABS_MT_POSITION_X, x); | 823 | input_report_abs(input, ABS_MT_POSITION_X, x); |
| 823 | input_report_abs(input, ABS_MT_POSITION_Y, y); | 824 | input_report_abs(input, ABS_MT_POSITION_Y, y); |
| 824 | } | 825 | } |
| @@ -1056,10 +1057,11 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1056 | features->x_fuzz, 0); | 1057 | features->x_fuzz, 0); |
| 1057 | input_set_abs_params(input_dev, ABS_Y, 0, features->y_max, | 1058 | input_set_abs_params(input_dev, ABS_Y, 0, features->y_max, |
| 1058 | features->y_fuzz, 0); | 1059 | features->y_fuzz, 0); |
| 1059 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, features->pressure_max, | ||
| 1060 | features->pressure_fuzz, 0); | ||
| 1061 | 1060 | ||
| 1062 | if (features->device_type == BTN_TOOL_PEN) { | 1061 | if (features->device_type == BTN_TOOL_PEN) { |
| 1062 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, features->pressure_max, | ||
| 1063 | features->pressure_fuzz, 0); | ||
| 1064 | |||
| 1063 | /* penabled devices have fixed resolution for each model */ | 1065 | /* penabled devices have fixed resolution for each model */ |
| 1064 | input_abs_set_res(input_dev, ABS_X, features->x_resolution); | 1066 | input_abs_set_res(input_dev, ABS_X, features->x_resolution); |
| 1065 | input_abs_set_res(input_dev, ABS_Y, features->y_resolution); | 1067 | input_abs_set_res(input_dev, ABS_Y, features->y_resolution); |
| @@ -1098,6 +1100,8 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1098 | __set_bit(BTN_TOOL_MOUSE, input_dev->keybit); | 1100 | __set_bit(BTN_TOOL_MOUSE, input_dev->keybit); |
| 1099 | __set_bit(BTN_STYLUS, input_dev->keybit); | 1101 | __set_bit(BTN_STYLUS, input_dev->keybit); |
| 1100 | __set_bit(BTN_STYLUS2, input_dev->keybit); | 1102 | __set_bit(BTN_STYLUS2, input_dev->keybit); |
| 1103 | |||
| 1104 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | ||
| 1101 | break; | 1105 | break; |
| 1102 | 1106 | ||
| 1103 | case WACOM_21UX2: | 1107 | case WACOM_21UX2: |
| @@ -1126,6 +1130,9 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1126 | } | 1130 | } |
| 1127 | 1131 | ||
| 1128 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | 1132 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
| 1133 | |||
| 1134 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); | ||
| 1135 | |||
| 1129 | wacom_setup_cintiq(wacom_wac); | 1136 | wacom_setup_cintiq(wacom_wac); |
| 1130 | break; | 1137 | break; |
| 1131 | 1138 | ||
| @@ -1150,6 +1157,8 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1150 | /* fall through */ | 1157 | /* fall through */ |
| 1151 | 1158 | ||
| 1152 | case INTUOS: | 1159 | case INTUOS: |
| 1160 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | ||
| 1161 | |||
| 1153 | wacom_setup_intuos(wacom_wac); | 1162 | wacom_setup_intuos(wacom_wac); |
| 1154 | break; | 1163 | break; |
| 1155 | 1164 | ||
| @@ -1165,6 +1174,8 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1165 | 1174 | ||
| 1166 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | 1175 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
| 1167 | wacom_setup_intuos(wacom_wac); | 1176 | wacom_setup_intuos(wacom_wac); |
| 1177 | |||
| 1178 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | ||
| 1168 | break; | 1179 | break; |
| 1169 | 1180 | ||
| 1170 | case TABLETPC2FG: | 1181 | case TABLETPC2FG: |
| @@ -1183,26 +1194,40 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1183 | case TABLETPC: | 1194 | case TABLETPC: |
| 1184 | __clear_bit(ABS_MISC, input_dev->absbit); | 1195 | __clear_bit(ABS_MISC, input_dev->absbit); |
| 1185 | 1196 | ||
| 1197 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); | ||
| 1198 | |||
| 1186 | if (features->device_type != BTN_TOOL_PEN) | 1199 | if (features->device_type != BTN_TOOL_PEN) |
| 1187 | break; /* no need to process stylus stuff */ | 1200 | break; /* no need to process stylus stuff */ |
| 1188 | 1201 | ||
| 1189 | /* fall through */ | 1202 | /* fall through */ |
| 1190 | 1203 | ||
| 1191 | case PL: | 1204 | case PL: |
| 1192 | case PTU: | ||
| 1193 | case DTU: | 1205 | case DTU: |
| 1194 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); | 1206 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
| 1207 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); | ||
| 1195 | __set_bit(BTN_STYLUS, input_dev->keybit); | 1208 | __set_bit(BTN_STYLUS, input_dev->keybit); |
| 1196 | __set_bit(BTN_STYLUS2, input_dev->keybit); | 1209 | __set_bit(BTN_STYLUS2, input_dev->keybit); |
| 1210 | |||
| 1211 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); | ||
| 1212 | break; | ||
| 1213 | |||
| 1214 | case PTU: | ||
| 1215 | __set_bit(BTN_STYLUS2, input_dev->keybit); | ||
| 1197 | /* fall through */ | 1216 | /* fall through */ |
| 1198 | 1217 | ||
| 1199 | case PENPARTNER: | 1218 | case PENPARTNER: |
| 1219 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); | ||
| 1200 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); | 1220 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
| 1221 | __set_bit(BTN_STYLUS, input_dev->keybit); | ||
| 1222 | |||
| 1223 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | ||
| 1201 | break; | 1224 | break; |
| 1202 | 1225 | ||
| 1203 | case BAMBOO_PT: | 1226 | case BAMBOO_PT: |
| 1204 | __clear_bit(ABS_MISC, input_dev->absbit); | 1227 | __clear_bit(ABS_MISC, input_dev->absbit); |
| 1205 | 1228 | ||
| 1229 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | ||
| 1230 | |||
| 1206 | if (features->device_type == BTN_TOOL_DOUBLETAP) { | 1231 | if (features->device_type == BTN_TOOL_DOUBLETAP) { |
| 1207 | __set_bit(BTN_LEFT, input_dev->keybit); | 1232 | __set_bit(BTN_LEFT, input_dev->keybit); |
| 1208 | __set_bit(BTN_FORWARD, input_dev->keybit); | 1233 | __set_bit(BTN_FORWARD, input_dev->keybit); |
diff --git a/drivers/input/touchscreen/wacom_w8001.c b/drivers/input/touchscreen/wacom_w8001.c index c14412ef4648..9941d39df43d 100644 --- a/drivers/input/touchscreen/wacom_w8001.c +++ b/drivers/input/touchscreen/wacom_w8001.c | |||
| @@ -383,6 +383,8 @@ static int w8001_setup(struct w8001 *w8001) | |||
| 383 | dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | 383 | dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
| 384 | strlcat(w8001->name, "Wacom Serial", sizeof(w8001->name)); | 384 | strlcat(w8001->name, "Wacom Serial", sizeof(w8001->name)); |
| 385 | 385 | ||
| 386 | __set_bit(INPUT_PROP_DIRECT, dev->propbit); | ||
| 387 | |||
| 386 | /* penabled? */ | 388 | /* penabled? */ |
| 387 | error = w8001_command(w8001, W8001_CMD_QUERY, true); | 389 | error = w8001_command(w8001, W8001_CMD_QUERY, true); |
| 388 | if (!error) { | 390 | if (!error) { |
diff --git a/drivers/leds/ledtrig-timer.c b/drivers/leds/ledtrig-timer.c index d87c9d02f786..328c64c0841c 100644 --- a/drivers/leds/ledtrig-timer.c +++ b/drivers/leds/ledtrig-timer.c | |||
| @@ -41,6 +41,7 @@ static ssize_t led_delay_on_store(struct device *dev, | |||
| 41 | 41 | ||
| 42 | if (count == size) { | 42 | if (count == size) { |
| 43 | led_blink_set(led_cdev, &state, &led_cdev->blink_delay_off); | 43 | led_blink_set(led_cdev, &state, &led_cdev->blink_delay_off); |
| 44 | led_cdev->blink_delay_on = state; | ||
| 44 | ret = count; | 45 | ret = count; |
| 45 | } | 46 | } |
| 46 | 47 | ||
| @@ -69,6 +70,7 @@ static ssize_t led_delay_off_store(struct device *dev, | |||
| 69 | 70 | ||
| 70 | if (count == size) { | 71 | if (count == size) { |
| 71 | led_blink_set(led_cdev, &led_cdev->blink_delay_on, &state); | 72 | led_blink_set(led_cdev, &led_cdev->blink_delay_on, &state); |
| 73 | led_cdev->blink_delay_off = state; | ||
| 72 | ret = count; | 74 | ret = count; |
| 73 | } | 75 | } |
| 74 | 76 | ||
diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c index 5d1fca0277ef..f83103b8970d 100644 --- a/drivers/mfd/max8997.c +++ b/drivers/mfd/max8997.c | |||
| @@ -135,10 +135,13 @@ static int max8997_i2c_probe(struct i2c_client *i2c, | |||
| 135 | max8997->dev = &i2c->dev; | 135 | max8997->dev = &i2c->dev; |
| 136 | max8997->i2c = i2c; | 136 | max8997->i2c = i2c; |
| 137 | max8997->type = id->driver_data; | 137 | max8997->type = id->driver_data; |
| 138 | max8997->irq = i2c->irq; | ||
| 138 | 139 | ||
| 139 | if (!pdata) | 140 | if (!pdata) |
| 140 | goto err; | 141 | goto err; |
| 141 | 142 | ||
| 143 | max8997->irq_base = pdata->irq_base; | ||
| 144 | max8997->ono = pdata->ono; | ||
| 142 | max8997->wakeup = pdata->wakeup; | 145 | max8997->wakeup = pdata->wakeup; |
| 143 | 146 | ||
| 144 | mutex_init(&max8997->iolock); | 147 | mutex_init(&max8997->iolock); |
| @@ -152,6 +155,8 @@ static int max8997_i2c_probe(struct i2c_client *i2c, | |||
| 152 | 155 | ||
| 153 | pm_runtime_set_active(max8997->dev); | 156 | pm_runtime_set_active(max8997->dev); |
| 154 | 157 | ||
| 158 | max8997_irq_init(max8997); | ||
| 159 | |||
| 155 | mfd_add_devices(max8997->dev, -1, max8997_devs, | 160 | mfd_add_devices(max8997->dev, -1, max8997_devs, |
| 156 | ARRAY_SIZE(max8997_devs), | 161 | ARRAY_SIZE(max8997_devs), |
| 157 | NULL, 0); | 162 | NULL, 0); |
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index 29601e7d606d..86e14583a082 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ | 18 | */ |
| 19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
| 20 | #include <linux/module.h> | ||
| 20 | #include <linux/types.h> | 21 | #include <linux/types.h> |
| 21 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
| 22 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
| @@ -676,7 +677,6 @@ static void usbhs_omap_tll_init(struct device *dev, u8 tll_channel_count) | |||
| 676 | | OMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF | 677 | | OMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF |
| 677 | | OMAP_TLL_CHANNEL_CONF_ULPIDDRMODE); | 678 | | OMAP_TLL_CHANNEL_CONF_ULPIDDRMODE); |
| 678 | 679 | ||
| 679 | reg |= (1 << (i + 1)); | ||
| 680 | } else | 680 | } else |
| 681 | continue; | 681 | continue; |
| 682 | 682 | ||
diff --git a/drivers/mfd/tps65910-irq.c b/drivers/mfd/tps65910-irq.c index 2bfad5c86cc7..a56be931551c 100644 --- a/drivers/mfd/tps65910-irq.c +++ b/drivers/mfd/tps65910-irq.c | |||
| @@ -178,8 +178,10 @@ int tps65910_irq_init(struct tps65910 *tps65910, int irq, | |||
| 178 | switch (tps65910_chip_id(tps65910)) { | 178 | switch (tps65910_chip_id(tps65910)) { |
| 179 | case TPS65910: | 179 | case TPS65910: |
| 180 | tps65910->irq_num = TPS65910_NUM_IRQ; | 180 | tps65910->irq_num = TPS65910_NUM_IRQ; |
| 181 | break; | ||
| 181 | case TPS65911: | 182 | case TPS65911: |
| 182 | tps65910->irq_num = TPS65911_NUM_IRQ; | 183 | tps65910->irq_num = TPS65911_NUM_IRQ; |
| 184 | break; | ||
| 183 | } | 185 | } |
| 184 | 186 | ||
| 185 | /* Register with genirq */ | 187 | /* Register with genirq */ |
diff --git a/drivers/mfd/twl4030-madc.c b/drivers/mfd/twl4030-madc.c index b5d598c3aa71..7cbf2aa9e64f 100644 --- a/drivers/mfd/twl4030-madc.c +++ b/drivers/mfd/twl4030-madc.c | |||
| @@ -510,8 +510,9 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req) | |||
| 510 | u8 ch_msb, ch_lsb; | 510 | u8 ch_msb, ch_lsb; |
| 511 | int ret; | 511 | int ret; |
| 512 | 512 | ||
| 513 | if (!req) | 513 | if (!req || !twl4030_madc) |
| 514 | return -EINVAL; | 514 | return -EINVAL; |
| 515 | |||
| 515 | mutex_lock(&twl4030_madc->lock); | 516 | mutex_lock(&twl4030_madc->lock); |
| 516 | if (req->method < TWL4030_MADC_RT || req->method > TWL4030_MADC_SW2) { | 517 | if (req->method < TWL4030_MADC_RT || req->method > TWL4030_MADC_SW2) { |
| 517 | ret = -EINVAL; | 518 | ret = -EINVAL; |
| @@ -706,6 +707,8 @@ static int __devinit twl4030_madc_probe(struct platform_device *pdev) | |||
| 706 | if (!madc) | 707 | if (!madc) |
| 707 | return -ENOMEM; | 708 | return -ENOMEM; |
| 708 | 709 | ||
| 710 | madc->dev = &pdev->dev; | ||
| 711 | |||
| 709 | /* | 712 | /* |
| 710 | * Phoenix provides 2 interrupt lines. The first one is connected to | 713 | * Phoenix provides 2 interrupt lines. The first one is connected to |
| 711 | * the OMAP. The other one can be connected to the other processor such | 714 | * the OMAP. The other one can be connected to the other processor such |
diff --git a/drivers/mfd/wm8350-gpio.c b/drivers/mfd/wm8350-gpio.c index ebf99bef392f..d584f6b4d6e2 100644 --- a/drivers/mfd/wm8350-gpio.c +++ b/drivers/mfd/wm8350-gpio.c | |||
| @@ -37,7 +37,7 @@ static int gpio_set_dir(struct wm8350 *wm8350, int gpio, int dir) | |||
| 37 | return ret; | 37 | return ret; |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | static int gpio_set_debounce(struct wm8350 *wm8350, int gpio, int db) | 40 | static int wm8350_gpio_set_debounce(struct wm8350 *wm8350, int gpio, int db) |
| 41 | { | 41 | { |
| 42 | if (db == WM8350_GPIO_DEBOUNCE_ON) | 42 | if (db == WM8350_GPIO_DEBOUNCE_ON) |
| 43 | return wm8350_set_bits(wm8350, WM8350_GPIO_DEBOUNCE, | 43 | return wm8350_set_bits(wm8350, WM8350_GPIO_DEBOUNCE, |
| @@ -210,7 +210,7 @@ int wm8350_gpio_config(struct wm8350 *wm8350, int gpio, int dir, int func, | |||
| 210 | goto err; | 210 | goto err; |
| 211 | if (gpio_set_polarity(wm8350, gpio, pol)) | 211 | if (gpio_set_polarity(wm8350, gpio, pol)) |
| 212 | goto err; | 212 | goto err; |
| 213 | if (gpio_set_debounce(wm8350, gpio, debounce)) | 213 | if (wm8350_gpio_set_debounce(wm8350, gpio, debounce)) |
| 214 | goto err; | 214 | goto err; |
| 215 | if (gpio_set_dir(wm8350, gpio, dir)) | 215 | if (gpio_set_dir(wm8350, gpio, dir)) |
| 216 | goto err; | 216 | goto err; |
diff --git a/drivers/misc/pti.c b/drivers/misc/pti.c index 06df1877ad0f..0b56e3f43573 100644 --- a/drivers/misc/pti.c +++ b/drivers/misc/pti.c | |||
| @@ -165,6 +165,11 @@ static void pti_write_to_aperture(struct pti_masterchannel *mc, | |||
| 165 | static void pti_control_frame_built_and_sent(struct pti_masterchannel *mc, | 165 | static void pti_control_frame_built_and_sent(struct pti_masterchannel *mc, |
| 166 | const char *thread_name) | 166 | const char *thread_name) |
| 167 | { | 167 | { |
| 168 | /* | ||
| 169 | * Since we access the comm member in current's task_struct, we only | ||
| 170 | * need to be as large as what 'comm' in that structure is. | ||
| 171 | */ | ||
| 172 | char comm[TASK_COMM_LEN]; | ||
| 168 | struct pti_masterchannel mccontrol = {.master = CONTROL_ID, | 173 | struct pti_masterchannel mccontrol = {.master = CONTROL_ID, |
| 169 | .channel = 0}; | 174 | .channel = 0}; |
| 170 | const char *thread_name_p; | 175 | const char *thread_name_p; |
| @@ -172,13 +177,6 @@ static void pti_control_frame_built_and_sent(struct pti_masterchannel *mc, | |||
| 172 | u8 control_frame[CONTROL_FRAME_LEN]; | 177 | u8 control_frame[CONTROL_FRAME_LEN]; |
| 173 | 178 | ||
| 174 | if (!thread_name) { | 179 | if (!thread_name) { |
| 175 | /* | ||
| 176 | * Since we access the comm member in current's task_struct, | ||
| 177 | * we only need to be as large as what 'comm' in that | ||
| 178 | * structure is. | ||
| 179 | */ | ||
| 180 | char comm[TASK_COMM_LEN]; | ||
| 181 | |||
| 182 | if (!in_interrupt()) | 180 | if (!in_interrupt()) |
| 183 | get_task_comm(comm, current); | 181 | get_task_comm(comm, current); |
| 184 | else | 182 | else |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 8d0314dbd946..a44874e24f2a 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
| @@ -2535,7 +2535,7 @@ config S6GMAC | |||
| 2535 | source "drivers/net/stmmac/Kconfig" | 2535 | source "drivers/net/stmmac/Kconfig" |
| 2536 | 2536 | ||
| 2537 | config PCH_GBE | 2537 | config PCH_GBE |
| 2538 | tristate "Intel EG20T PCH / OKI SEMICONDUCTOR ML7223 IOH GbE" | 2538 | tristate "Intel EG20T PCH/OKI SEMICONDUCTOR IOH(ML7223/ML7831) GbE" |
| 2539 | depends on PCI | 2539 | depends on PCI |
| 2540 | select MII | 2540 | select MII |
| 2541 | ---help--- | 2541 | ---help--- |
| @@ -2548,10 +2548,11 @@ config PCH_GBE | |||
| 2548 | This driver enables Gigabit Ethernet function. | 2548 | This driver enables Gigabit Ethernet function. |
| 2549 | 2549 | ||
| 2550 | This driver also can be used for OKI SEMICONDUCTOR IOH(Input/ | 2550 | This driver also can be used for OKI SEMICONDUCTOR IOH(Input/ |
| 2551 | Output Hub), ML7223. | 2551 | Output Hub), ML7223/ML7831. |
| 2552 | ML7223 IOH is for MP(Media Phone) use. | 2552 | ML7223 IOH is for MP(Media Phone) use. ML7831 IOH is for general |
| 2553 | ML7223 is companion chip for Intel Atom E6xx series. | 2553 | purpose use. |
| 2554 | ML7223 is completely compatible for Intel EG20T PCH. | 2554 | ML7223/ML7831 is companion chip for Intel Atom E6xx series. |
| 2555 | ML7223/ML7831 is completely compatible for Intel EG20T PCH. | ||
| 2555 | 2556 | ||
| 2556 | config FTGMAC100 | 2557 | config FTGMAC100 |
| 2557 | tristate "Faraday FTGMAC100 Gigabit Ethernet support" | 2558 | tristate "Faraday FTGMAC100 Gigabit Ethernet support" |
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h index c423504a755f..e46df5331c55 100644 --- a/drivers/net/bnx2x/bnx2x.h +++ b/drivers/net/bnx2x/bnx2x.h | |||
| @@ -315,6 +315,14 @@ union db_prod { | |||
| 315 | u32 raw; | 315 | u32 raw; |
| 316 | }; | 316 | }; |
| 317 | 317 | ||
| 318 | /* dropless fc FW/HW related params */ | ||
| 319 | #define BRB_SIZE(bp) (CHIP_IS_E3(bp) ? 1024 : 512) | ||
| 320 | #define MAX_AGG_QS(bp) (CHIP_IS_E1(bp) ? \ | ||
| 321 | ETH_MAX_AGGREGATION_QUEUES_E1 :\ | ||
| 322 | ETH_MAX_AGGREGATION_QUEUES_E1H_E2) | ||
| 323 | #define FW_DROP_LEVEL(bp) (3 + MAX_SPQ_PENDING + MAX_AGG_QS(bp)) | ||
| 324 | #define FW_PREFETCH_CNT 16 | ||
| 325 | #define DROPLESS_FC_HEADROOM 100 | ||
| 318 | 326 | ||
| 319 | /* MC hsi */ | 327 | /* MC hsi */ |
| 320 | #define BCM_PAGE_SHIFT 12 | 328 | #define BCM_PAGE_SHIFT 12 |
| @@ -331,15 +339,35 @@ union db_prod { | |||
| 331 | /* SGE ring related macros */ | 339 | /* SGE ring related macros */ |
| 332 | #define NUM_RX_SGE_PAGES 2 | 340 | #define NUM_RX_SGE_PAGES 2 |
| 333 | #define RX_SGE_CNT (BCM_PAGE_SIZE / sizeof(struct eth_rx_sge)) | 341 | #define RX_SGE_CNT (BCM_PAGE_SIZE / sizeof(struct eth_rx_sge)) |
| 334 | #define MAX_RX_SGE_CNT (RX_SGE_CNT - 2) | 342 | #define NEXT_PAGE_SGE_DESC_CNT 2 |
| 343 | #define MAX_RX_SGE_CNT (RX_SGE_CNT - NEXT_PAGE_SGE_DESC_CNT) | ||
| 335 | /* RX_SGE_CNT is promised to be a power of 2 */ | 344 | /* RX_SGE_CNT is promised to be a power of 2 */ |
| 336 | #define RX_SGE_MASK (RX_SGE_CNT - 1) | 345 | #define RX_SGE_MASK (RX_SGE_CNT - 1) |
| 337 | #define NUM_RX_SGE (RX_SGE_CNT * NUM_RX_SGE_PAGES) | 346 | #define NUM_RX_SGE (RX_SGE_CNT * NUM_RX_SGE_PAGES) |
| 338 | #define MAX_RX_SGE (NUM_RX_SGE - 1) | 347 | #define MAX_RX_SGE (NUM_RX_SGE - 1) |
| 339 | #define NEXT_SGE_IDX(x) ((((x) & RX_SGE_MASK) == \ | 348 | #define NEXT_SGE_IDX(x) ((((x) & RX_SGE_MASK) == \ |
| 340 | (MAX_RX_SGE_CNT - 1)) ? (x) + 3 : (x) + 1) | 349 | (MAX_RX_SGE_CNT - 1)) ? \ |
| 350 | (x) + 1 + NEXT_PAGE_SGE_DESC_CNT : \ | ||
| 351 | (x) + 1) | ||
| 341 | #define RX_SGE(x) ((x) & MAX_RX_SGE) | 352 | #define RX_SGE(x) ((x) & MAX_RX_SGE) |
| 342 | 353 | ||
| 354 | /* | ||
| 355 | * Number of required SGEs is the sum of two: | ||
| 356 | * 1. Number of possible opened aggregations (next packet for | ||
| 357 | * these aggregations will probably consume SGE immidiatelly) | ||
| 358 | * 2. Rest of BRB blocks divided by 2 (block will consume new SGE only | ||
| 359 | * after placement on BD for new TPA aggregation) | ||
| 360 | * | ||
| 361 | * Takes into account NEXT_PAGE_SGE_DESC_CNT "next" elements on each page | ||
| 362 | */ | ||
| 363 | #define NUM_SGE_REQ (MAX_AGG_QS(bp) + \ | ||
| 364 | (BRB_SIZE(bp) - MAX_AGG_QS(bp)) / 2) | ||
| 365 | #define NUM_SGE_PG_REQ ((NUM_SGE_REQ + MAX_RX_SGE_CNT - 1) / \ | ||
| 366 | MAX_RX_SGE_CNT) | ||
| 367 | #define SGE_TH_LO(bp) (NUM_SGE_REQ + \ | ||
| 368 | NUM_SGE_PG_REQ * NEXT_PAGE_SGE_DESC_CNT) | ||
| 369 | #define SGE_TH_HI(bp) (SGE_TH_LO(bp) + DROPLESS_FC_HEADROOM) | ||
| 370 | |||
| 343 | /* Manipulate a bit vector defined as an array of u64 */ | 371 | /* Manipulate a bit vector defined as an array of u64 */ |
| 344 | 372 | ||
| 345 | /* Number of bits in one sge_mask array element */ | 373 | /* Number of bits in one sge_mask array element */ |
| @@ -551,24 +579,43 @@ struct bnx2x_fastpath { | |||
| 551 | 579 | ||
| 552 | #define NUM_TX_RINGS 16 | 580 | #define NUM_TX_RINGS 16 |
| 553 | #define TX_DESC_CNT (BCM_PAGE_SIZE / sizeof(union eth_tx_bd_types)) | 581 | #define TX_DESC_CNT (BCM_PAGE_SIZE / sizeof(union eth_tx_bd_types)) |
| 554 | #define MAX_TX_DESC_CNT (TX_DESC_CNT - 1) | 582 | #define NEXT_PAGE_TX_DESC_CNT 1 |
| 583 | #define MAX_TX_DESC_CNT (TX_DESC_CNT - NEXT_PAGE_TX_DESC_CNT) | ||
| 555 | #define NUM_TX_BD (TX_DESC_CNT * NUM_TX_RINGS) | 584 | #define NUM_TX_BD (TX_DESC_CNT * NUM_TX_RINGS) |
| 556 | #define MAX_TX_BD (NUM_TX_BD - 1) | 585 | #define MAX_TX_BD (NUM_TX_BD - 1) |
| 557 | #define MAX_TX_AVAIL (MAX_TX_DESC_CNT * NUM_TX_RINGS - 2) | 586 | #define MAX_TX_AVAIL (MAX_TX_DESC_CNT * NUM_TX_RINGS - 2) |
| 558 | #define NEXT_TX_IDX(x) ((((x) & MAX_TX_DESC_CNT) == \ | 587 | #define NEXT_TX_IDX(x) ((((x) & MAX_TX_DESC_CNT) == \ |
| 559 | (MAX_TX_DESC_CNT - 1)) ? (x) + 2 : (x) + 1) | 588 | (MAX_TX_DESC_CNT - 1)) ? \ |
| 589 | (x) + 1 + NEXT_PAGE_TX_DESC_CNT : \ | ||
| 590 | (x) + 1) | ||
| 560 | #define TX_BD(x) ((x) & MAX_TX_BD) | 591 | #define TX_BD(x) ((x) & MAX_TX_BD) |
| 561 | #define TX_BD_POFF(x) ((x) & MAX_TX_DESC_CNT) | 592 | #define TX_BD_POFF(x) ((x) & MAX_TX_DESC_CNT) |
| 562 | 593 | ||
| 563 | /* The RX BD ring is special, each bd is 8 bytes but the last one is 16 */ | 594 | /* The RX BD ring is special, each bd is 8 bytes but the last one is 16 */ |
| 564 | #define NUM_RX_RINGS 8 | 595 | #define NUM_RX_RINGS 8 |
| 565 | #define RX_DESC_CNT (BCM_PAGE_SIZE / sizeof(struct eth_rx_bd)) | 596 | #define RX_DESC_CNT (BCM_PAGE_SIZE / sizeof(struct eth_rx_bd)) |
| 566 | #define MAX_RX_DESC_CNT (RX_DESC_CNT - 2) | 597 | #define NEXT_PAGE_RX_DESC_CNT 2 |
| 598 | #define MAX_RX_DESC_CNT (RX_DESC_CNT - NEXT_PAGE_RX_DESC_CNT) | ||
| 567 | #define RX_DESC_MASK (RX_DESC_CNT - 1) | 599 | #define RX_DESC_MASK (RX_DESC_CNT - 1) |
| 568 | #define NUM_RX_BD (RX_DESC_CNT * NUM_RX_RINGS) | 600 | #define NUM_RX_BD (RX_DESC_CNT * NUM_RX_RINGS) |
| 569 | #define MAX_RX_BD (NUM_RX_BD - 1) | 601 | #define MAX_RX_BD (NUM_RX_BD - 1) |
| 570 | #define MAX_RX_AVAIL (MAX_RX_DESC_CNT * NUM_RX_RINGS - 2) | 602 | #define MAX_RX_AVAIL (MAX_RX_DESC_CNT * NUM_RX_RINGS - 2) |
| 571 | #define MIN_RX_AVAIL 128 | 603 | |
| 604 | /* dropless fc calculations for BDs | ||
| 605 | * | ||
| 606 | * Number of BDs should as number of buffers in BRB: | ||
| 607 | * Low threshold takes into account NEXT_PAGE_RX_DESC_CNT | ||
| 608 | * "next" elements on each page | ||
| 609 | */ | ||
| 610 | #define NUM_BD_REQ BRB_SIZE(bp) | ||
| 611 | #define NUM_BD_PG_REQ ((NUM_BD_REQ + MAX_RX_DESC_CNT - 1) / \ | ||
| 612 | MAX_RX_DESC_CNT) | ||
| 613 | #define BD_TH_LO(bp) (NUM_BD_REQ + \ | ||
| 614 | NUM_BD_PG_REQ * NEXT_PAGE_RX_DESC_CNT + \ | ||
| 615 | FW_DROP_LEVEL(bp)) | ||
| 616 | #define BD_TH_HI(bp) (BD_TH_LO(bp) + DROPLESS_FC_HEADROOM) | ||
| 617 | |||
| 618 | #define MIN_RX_AVAIL ((bp)->dropless_fc ? BD_TH_HI(bp) + 128 : 128) | ||
| 572 | 619 | ||
| 573 | #define MIN_RX_SIZE_TPA_HW (CHIP_IS_E1(bp) ? \ | 620 | #define MIN_RX_SIZE_TPA_HW (CHIP_IS_E1(bp) ? \ |
| 574 | ETH_MIN_RX_CQES_WITH_TPA_E1 : \ | 621 | ETH_MIN_RX_CQES_WITH_TPA_E1 : \ |
| @@ -579,7 +626,9 @@ struct bnx2x_fastpath { | |||
| 579 | MIN_RX_AVAIL)) | 626 | MIN_RX_AVAIL)) |
| 580 | 627 | ||
| 581 | #define NEXT_RX_IDX(x) ((((x) & RX_DESC_MASK) == \ | 628 | #define NEXT_RX_IDX(x) ((((x) & RX_DESC_MASK) == \ |
| 582 | (MAX_RX_DESC_CNT - 1)) ? (x) + 3 : (x) + 1) | 629 | (MAX_RX_DESC_CNT - 1)) ? \ |
| 630 | (x) + 1 + NEXT_PAGE_RX_DESC_CNT : \ | ||
| 631 | (x) + 1) | ||
| 583 | #define RX_BD(x) ((x) & MAX_RX_BD) | 632 | #define RX_BD(x) ((x) & MAX_RX_BD) |
| 584 | 633 | ||
| 585 | /* | 634 | /* |
| @@ -589,14 +638,31 @@ struct bnx2x_fastpath { | |||
| 589 | #define CQE_BD_REL (sizeof(union eth_rx_cqe) / sizeof(struct eth_rx_bd)) | 638 | #define CQE_BD_REL (sizeof(union eth_rx_cqe) / sizeof(struct eth_rx_bd)) |
| 590 | #define NUM_RCQ_RINGS (NUM_RX_RINGS * CQE_BD_REL) | 639 | #define NUM_RCQ_RINGS (NUM_RX_RINGS * CQE_BD_REL) |
| 591 | #define RCQ_DESC_CNT (BCM_PAGE_SIZE / sizeof(union eth_rx_cqe)) | 640 | #define RCQ_DESC_CNT (BCM_PAGE_SIZE / sizeof(union eth_rx_cqe)) |
| 592 | #define MAX_RCQ_DESC_CNT (RCQ_DESC_CNT - 1) | 641 | #define NEXT_PAGE_RCQ_DESC_CNT 1 |
| 642 | #define MAX_RCQ_DESC_CNT (RCQ_DESC_CNT - NEXT_PAGE_RCQ_DESC_CNT) | ||
| 593 | #define NUM_RCQ_BD (RCQ_DESC_CNT * NUM_RCQ_RINGS) | 643 | #define NUM_RCQ_BD (RCQ_DESC_CNT * NUM_RCQ_RINGS) |
| 594 | #define MAX_RCQ_BD (NUM_RCQ_BD - 1) | 644 | #define MAX_RCQ_BD (NUM_RCQ_BD - 1) |
| 595 | #define MAX_RCQ_AVAIL (MAX_RCQ_DESC_CNT * NUM_RCQ_RINGS - 2) | 645 | #define MAX_RCQ_AVAIL (MAX_RCQ_DESC_CNT * NUM_RCQ_RINGS - 2) |
| 596 | #define NEXT_RCQ_IDX(x) ((((x) & MAX_RCQ_DESC_CNT) == \ | 646 | #define NEXT_RCQ_IDX(x) ((((x) & MAX_RCQ_DESC_CNT) == \ |
| 597 | (MAX_RCQ_DESC_CNT - 1)) ? (x) + 2 : (x) + 1) | 647 | (MAX_RCQ_DESC_CNT - 1)) ? \ |
| 648 | (x) + 1 + NEXT_PAGE_RCQ_DESC_CNT : \ | ||
| 649 | (x) + 1) | ||
| 598 | #define RCQ_BD(x) ((x) & MAX_RCQ_BD) | 650 | #define RCQ_BD(x) ((x) & MAX_RCQ_BD) |
| 599 | 651 | ||
| 652 | /* dropless fc calculations for RCQs | ||
| 653 | * | ||
| 654 | * Number of RCQs should be as number of buffers in BRB: | ||
| 655 | * Low threshold takes into account NEXT_PAGE_RCQ_DESC_CNT | ||
| 656 | * "next" elements on each page | ||
| 657 | */ | ||
| 658 | #define NUM_RCQ_REQ BRB_SIZE(bp) | ||
| 659 | #define NUM_RCQ_PG_REQ ((NUM_BD_REQ + MAX_RCQ_DESC_CNT - 1) / \ | ||
| 660 | MAX_RCQ_DESC_CNT) | ||
| 661 | #define RCQ_TH_LO(bp) (NUM_RCQ_REQ + \ | ||
| 662 | NUM_RCQ_PG_REQ * NEXT_PAGE_RCQ_DESC_CNT + \ | ||
| 663 | FW_DROP_LEVEL(bp)) | ||
| 664 | #define RCQ_TH_HI(bp) (RCQ_TH_LO(bp) + DROPLESS_FC_HEADROOM) | ||
| 665 | |||
| 600 | 666 | ||
| 601 | /* This is needed for determining of last_max */ | 667 | /* This is needed for determining of last_max */ |
| 602 | #define SUB_S16(a, b) (s16)((s16)(a) - (s16)(b)) | 668 | #define SUB_S16(a, b) (s16)((s16)(a) - (s16)(b)) |
| @@ -685,24 +751,17 @@ struct bnx2x_fastpath { | |||
| 685 | #define FP_CSB_FUNC_OFF \ | 751 | #define FP_CSB_FUNC_OFF \ |
| 686 | offsetof(struct cstorm_status_block_c, func) | 752 | offsetof(struct cstorm_status_block_c, func) |
| 687 | 753 | ||
| 688 | #define HC_INDEX_TOE_RX_CQ_CONS 0 /* Formerly Ustorm TOE CQ index */ | 754 | #define HC_INDEX_ETH_RX_CQ_CONS 1 |
| 689 | /* (HC_INDEX_U_TOE_RX_CQ_CONS) */ | ||
| 690 | #define HC_INDEX_ETH_RX_CQ_CONS 1 /* Formerly Ustorm ETH CQ index */ | ||
| 691 | /* (HC_INDEX_U_ETH_RX_CQ_CONS) */ | ||
| 692 | #define HC_INDEX_ETH_RX_BD_CONS 2 /* Formerly Ustorm ETH BD index */ | ||
| 693 | /* (HC_INDEX_U_ETH_RX_BD_CONS) */ | ||
| 694 | |||
| 695 | #define HC_INDEX_TOE_TX_CQ_CONS 4 /* Formerly Cstorm TOE CQ index */ | ||
| 696 | /* (HC_INDEX_C_TOE_TX_CQ_CONS) */ | ||
| 697 | #define HC_INDEX_ETH_TX_CQ_CONS_COS0 5 /* Formerly Cstorm ETH CQ index */ | ||
| 698 | /* (HC_INDEX_C_ETH_TX_CQ_CONS) */ | ||
| 699 | #define HC_INDEX_ETH_TX_CQ_CONS_COS1 6 /* Formerly Cstorm ETH CQ index */ | ||
| 700 | /* (HC_INDEX_C_ETH_TX_CQ_CONS) */ | ||
| 701 | #define HC_INDEX_ETH_TX_CQ_CONS_COS2 7 /* Formerly Cstorm ETH CQ index */ | ||
| 702 | /* (HC_INDEX_C_ETH_TX_CQ_CONS) */ | ||
| 703 | 755 | ||
| 704 | #define HC_INDEX_ETH_FIRST_TX_CQ_CONS HC_INDEX_ETH_TX_CQ_CONS_COS0 | 756 | #define HC_INDEX_OOO_TX_CQ_CONS 4 |
| 705 | 757 | ||
| 758 | #define HC_INDEX_ETH_TX_CQ_CONS_COS0 5 | ||
| 759 | |||
| 760 | #define HC_INDEX_ETH_TX_CQ_CONS_COS1 6 | ||
| 761 | |||
| 762 | #define HC_INDEX_ETH_TX_CQ_CONS_COS2 7 | ||
| 763 | |||
| 764 | #define HC_INDEX_ETH_FIRST_TX_CQ_CONS HC_INDEX_ETH_TX_CQ_CONS_COS0 | ||
| 706 | 765 | ||
| 707 | #define BNX2X_RX_SB_INDEX \ | 766 | #define BNX2X_RX_SB_INDEX \ |
| 708 | (&fp->sb_index_values[HC_INDEX_ETH_RX_CQ_CONS]) | 767 | (&fp->sb_index_values[HC_INDEX_ETH_RX_CQ_CONS]) |
| @@ -1100,11 +1159,12 @@ struct bnx2x { | |||
| 1100 | #define BP_PORT(bp) (bp->pfid & 1) | 1159 | #define BP_PORT(bp) (bp->pfid & 1) |
| 1101 | #define BP_FUNC(bp) (bp->pfid) | 1160 | #define BP_FUNC(bp) (bp->pfid) |
| 1102 | #define BP_ABS_FUNC(bp) (bp->pf_num) | 1161 | #define BP_ABS_FUNC(bp) (bp->pf_num) |
| 1103 | #define BP_E1HVN(bp) (bp->pfid >> 1) | 1162 | #define BP_VN(bp) ((bp)->pfid >> 1) |
| 1104 | #define BP_VN(bp) (BP_E1HVN(bp)) /*remove when approved*/ | 1163 | #define BP_MAX_VN_NUM(bp) (CHIP_MODE_IS_4_PORT(bp) ? 2 : 4) |
| 1105 | #define BP_L_ID(bp) (BP_E1HVN(bp) << 2) | 1164 | #define BP_L_ID(bp) (BP_VN(bp) << 2) |
| 1106 | #define BP_FW_MB_IDX(bp) (BP_PORT(bp) +\ | 1165 | #define BP_FW_MB_IDX_VN(bp, vn) (BP_PORT(bp) +\ |
| 1107 | BP_VN(bp) * ((CHIP_IS_E1x(bp) || (CHIP_MODE_IS_4_PORT(bp))) ? 2 : 1)) | 1166 | (vn) * ((CHIP_IS_E1x(bp) || (CHIP_MODE_IS_4_PORT(bp))) ? 2 : 1)) |
| 1167 | #define BP_FW_MB_IDX(bp) BP_FW_MB_IDX_VN(bp, BP_VN(bp)) | ||
| 1108 | 1168 | ||
| 1109 | struct net_device *dev; | 1169 | struct net_device *dev; |
| 1110 | struct pci_dev *pdev; | 1170 | struct pci_dev *pdev; |
| @@ -1767,7 +1827,7 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms, | |||
| 1767 | 1827 | ||
| 1768 | #define MAX_DMAE_C_PER_PORT 8 | 1828 | #define MAX_DMAE_C_PER_PORT 8 |
| 1769 | #define INIT_DMAE_C(bp) (BP_PORT(bp) * MAX_DMAE_C_PER_PORT + \ | 1829 | #define INIT_DMAE_C(bp) (BP_PORT(bp) * MAX_DMAE_C_PER_PORT + \ |
| 1770 | BP_E1HVN(bp)) | 1830 | BP_VN(bp)) |
| 1771 | #define PMF_DMAE_C(bp) (BP_PORT(bp) * MAX_DMAE_C_PER_PORT + \ | 1831 | #define PMF_DMAE_C(bp) (BP_PORT(bp) * MAX_DMAE_C_PER_PORT + \ |
| 1772 | E1HVN_MAX) | 1832 | E1HVN_MAX) |
| 1773 | 1833 | ||
| @@ -1793,7 +1853,7 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms, | |||
| 1793 | 1853 | ||
| 1794 | /* must be used on a CID before placing it on a HW ring */ | 1854 | /* must be used on a CID before placing it on a HW ring */ |
| 1795 | #define HW_CID(bp, x) ((BP_PORT(bp) << 23) | \ | 1855 | #define HW_CID(bp, x) ((BP_PORT(bp) << 23) | \ |
| 1796 | (BP_E1HVN(bp) << BNX2X_SWCID_SHIFT) | \ | 1856 | (BP_VN(bp) << BNX2X_SWCID_SHIFT) | \ |
| 1797 | (x)) | 1857 | (x)) |
| 1798 | 1858 | ||
| 1799 | #define SP_DESC_CNT (BCM_PAGE_SIZE / sizeof(struct eth_spe)) | 1859 | #define SP_DESC_CNT (BCM_PAGE_SIZE / sizeof(struct eth_spe)) |
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c index 37e5790681ad..c4cbf9736414 100644 --- a/drivers/net/bnx2x/bnx2x_cmn.c +++ b/drivers/net/bnx2x/bnx2x_cmn.c | |||
| @@ -987,8 +987,6 @@ void __bnx2x_link_report(struct bnx2x *bp) | |||
| 987 | void bnx2x_init_rx_rings(struct bnx2x *bp) | 987 | void bnx2x_init_rx_rings(struct bnx2x *bp) |
| 988 | { | 988 | { |
| 989 | int func = BP_FUNC(bp); | 989 | int func = BP_FUNC(bp); |
| 990 | int max_agg_queues = CHIP_IS_E1(bp) ? ETH_MAX_AGGREGATION_QUEUES_E1 : | ||
| 991 | ETH_MAX_AGGREGATION_QUEUES_E1H_E2; | ||
| 992 | u16 ring_prod; | 990 | u16 ring_prod; |
| 993 | int i, j; | 991 | int i, j; |
| 994 | 992 | ||
| @@ -1001,7 +999,7 @@ void bnx2x_init_rx_rings(struct bnx2x *bp) | |||
| 1001 | 999 | ||
| 1002 | if (!fp->disable_tpa) { | 1000 | if (!fp->disable_tpa) { |
| 1003 | /* Fill the per-aggregtion pool */ | 1001 | /* Fill the per-aggregtion pool */ |
| 1004 | for (i = 0; i < max_agg_queues; i++) { | 1002 | for (i = 0; i < MAX_AGG_QS(bp); i++) { |
| 1005 | struct bnx2x_agg_info *tpa_info = | 1003 | struct bnx2x_agg_info *tpa_info = |
| 1006 | &fp->tpa_info[i]; | 1004 | &fp->tpa_info[i]; |
| 1007 | struct sw_rx_bd *first_buf = | 1005 | struct sw_rx_bd *first_buf = |
| @@ -1041,7 +1039,7 @@ void bnx2x_init_rx_rings(struct bnx2x *bp) | |||
| 1041 | bnx2x_free_rx_sge_range(bp, fp, | 1039 | bnx2x_free_rx_sge_range(bp, fp, |
| 1042 | ring_prod); | 1040 | ring_prod); |
| 1043 | bnx2x_free_tpa_pool(bp, fp, | 1041 | bnx2x_free_tpa_pool(bp, fp, |
| 1044 | max_agg_queues); | 1042 | MAX_AGG_QS(bp)); |
| 1045 | fp->disable_tpa = 1; | 1043 | fp->disable_tpa = 1; |
| 1046 | ring_prod = 0; | 1044 | ring_prod = 0; |
| 1047 | break; | 1045 | break; |
| @@ -1137,9 +1135,7 @@ static void bnx2x_free_rx_skbs(struct bnx2x *bp) | |||
| 1137 | bnx2x_free_rx_bds(fp); | 1135 | bnx2x_free_rx_bds(fp); |
| 1138 | 1136 | ||
| 1139 | if (!fp->disable_tpa) | 1137 | if (!fp->disable_tpa) |
| 1140 | bnx2x_free_tpa_pool(bp, fp, CHIP_IS_E1(bp) ? | 1138 | bnx2x_free_tpa_pool(bp, fp, MAX_AGG_QS(bp)); |
| 1141 | ETH_MAX_AGGREGATION_QUEUES_E1 : | ||
| 1142 | ETH_MAX_AGGREGATION_QUEUES_E1H_E2); | ||
| 1143 | } | 1139 | } |
| 1144 | } | 1140 | } |
| 1145 | 1141 | ||
| @@ -3095,15 +3091,20 @@ static int bnx2x_alloc_fp_mem_at(struct bnx2x *bp, int index) | |||
| 3095 | struct bnx2x_fastpath *fp = &bp->fp[index]; | 3091 | struct bnx2x_fastpath *fp = &bp->fp[index]; |
| 3096 | int ring_size = 0; | 3092 | int ring_size = 0; |
| 3097 | u8 cos; | 3093 | u8 cos; |
| 3094 | int rx_ring_size = 0; | ||
| 3098 | 3095 | ||
| 3099 | /* if rx_ring_size specified - use it */ | 3096 | /* if rx_ring_size specified - use it */ |
| 3100 | int rx_ring_size = bp->rx_ring_size ? bp->rx_ring_size : | 3097 | if (!bp->rx_ring_size) { |
| 3101 | MAX_RX_AVAIL/BNX2X_NUM_RX_QUEUES(bp); | ||
| 3102 | 3098 | ||
| 3103 | /* allocate at least number of buffers required by FW */ | 3099 | rx_ring_size = MAX_RX_AVAIL/BNX2X_NUM_RX_QUEUES(bp); |
| 3104 | rx_ring_size = max_t(int, bp->disable_tpa ? MIN_RX_SIZE_NONTPA : | 3100 | |
| 3105 | MIN_RX_SIZE_TPA, | 3101 | /* allocate at least number of buffers required by FW */ |
| 3106 | rx_ring_size); | 3102 | rx_ring_size = max_t(int, bp->disable_tpa ? MIN_RX_SIZE_NONTPA : |
| 3103 | MIN_RX_SIZE_TPA, rx_ring_size); | ||
| 3104 | |||
| 3105 | bp->rx_ring_size = rx_ring_size; | ||
| 3106 | } else | ||
| 3107 | rx_ring_size = bp->rx_ring_size; | ||
| 3107 | 3108 | ||
| 3108 | /* Common */ | 3109 | /* Common */ |
| 3109 | sb = &bnx2x_fp(bp, index, status_blk); | 3110 | sb = &bnx2x_fp(bp, index, status_blk); |
diff --git a/drivers/net/bnx2x/bnx2x_ethtool.c b/drivers/net/bnx2x/bnx2x_ethtool.c index 221863059dae..cf3e47914dd7 100644 --- a/drivers/net/bnx2x/bnx2x_ethtool.c +++ b/drivers/net/bnx2x/bnx2x_ethtool.c | |||
| @@ -363,13 +363,50 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
| 363 | } | 363 | } |
| 364 | 364 | ||
| 365 | /* advertise the requested speed and duplex if supported */ | 365 | /* advertise the requested speed and duplex if supported */ |
| 366 | cmd->advertising &= bp->port.supported[cfg_idx]; | 366 | if (cmd->advertising & ~(bp->port.supported[cfg_idx])) { |
| 367 | DP(NETIF_MSG_LINK, "Advertisement parameters " | ||
| 368 | "are not supported\n"); | ||
| 369 | return -EINVAL; | ||
| 370 | } | ||
| 367 | 371 | ||
| 368 | bp->link_params.req_line_speed[cfg_idx] = SPEED_AUTO_NEG; | 372 | bp->link_params.req_line_speed[cfg_idx] = SPEED_AUTO_NEG; |
| 369 | bp->link_params.req_duplex[cfg_idx] = DUPLEX_FULL; | 373 | bp->link_params.req_duplex[cfg_idx] = cmd->duplex; |
| 370 | bp->port.advertising[cfg_idx] |= (ADVERTISED_Autoneg | | 374 | bp->port.advertising[cfg_idx] = (ADVERTISED_Autoneg | |
| 371 | cmd->advertising); | 375 | cmd->advertising); |
| 376 | if (cmd->advertising) { | ||
| 377 | |||
| 378 | bp->link_params.speed_cap_mask[cfg_idx] = 0; | ||
| 379 | if (cmd->advertising & ADVERTISED_10baseT_Half) { | ||
| 380 | bp->link_params.speed_cap_mask[cfg_idx] |= | ||
| 381 | PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_HALF; | ||
| 382 | } | ||
| 383 | if (cmd->advertising & ADVERTISED_10baseT_Full) | ||
| 384 | bp->link_params.speed_cap_mask[cfg_idx] |= | ||
| 385 | PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_FULL; | ||
| 372 | 386 | ||
| 387 | if (cmd->advertising & ADVERTISED_100baseT_Full) | ||
| 388 | bp->link_params.speed_cap_mask[cfg_idx] |= | ||
| 389 | PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_FULL; | ||
| 390 | |||
| 391 | if (cmd->advertising & ADVERTISED_100baseT_Half) { | ||
| 392 | bp->link_params.speed_cap_mask[cfg_idx] |= | ||
| 393 | PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_HALF; | ||
| 394 | } | ||
| 395 | if (cmd->advertising & ADVERTISED_1000baseT_Half) { | ||
| 396 | bp->link_params.speed_cap_mask[cfg_idx] |= | ||
| 397 | PORT_HW_CFG_SPEED_CAPABILITY_D0_1G; | ||
| 398 | } | ||
| 399 | if (cmd->advertising & (ADVERTISED_1000baseT_Full | | ||
| 400 | ADVERTISED_1000baseKX_Full)) | ||
| 401 | bp->link_params.speed_cap_mask[cfg_idx] |= | ||
| 402 | PORT_HW_CFG_SPEED_CAPABILITY_D0_1G; | ||
| 403 | |||
| 404 | if (cmd->advertising & (ADVERTISED_10000baseT_Full | | ||
| 405 | ADVERTISED_10000baseKX4_Full | | ||
| 406 | ADVERTISED_10000baseKR_Full)) | ||
| 407 | bp->link_params.speed_cap_mask[cfg_idx] |= | ||
| 408 | PORT_HW_CFG_SPEED_CAPABILITY_D0_10G; | ||
| 409 | } | ||
| 373 | } else { /* forced speed */ | 410 | } else { /* forced speed */ |
| 374 | /* advertise the requested speed and duplex if supported */ | 411 | /* advertise the requested speed and duplex if supported */ |
| 375 | switch (speed) { | 412 | switch (speed) { |
| @@ -1310,10 +1347,7 @@ static void bnx2x_get_ringparam(struct net_device *dev, | |||
| 1310 | if (bp->rx_ring_size) | 1347 | if (bp->rx_ring_size) |
| 1311 | ering->rx_pending = bp->rx_ring_size; | 1348 | ering->rx_pending = bp->rx_ring_size; |
| 1312 | else | 1349 | else |
| 1313 | if (bp->state == BNX2X_STATE_OPEN && bp->num_queues) | 1350 | ering->rx_pending = MAX_RX_AVAIL; |
| 1314 | ering->rx_pending = MAX_RX_AVAIL/bp->num_queues; | ||
| 1315 | else | ||
| 1316 | ering->rx_pending = MAX_RX_AVAIL; | ||
| 1317 | 1351 | ||
| 1318 | ering->rx_mini_pending = 0; | 1352 | ering->rx_mini_pending = 0; |
| 1319 | ering->rx_jumbo_pending = 0; | 1353 | ering->rx_jumbo_pending = 0; |
diff --git a/drivers/net/bnx2x/bnx2x_link.c b/drivers/net/bnx2x/bnx2x_link.c index d45b1555a602..ba15bdc5a1a9 100644 --- a/drivers/net/bnx2x/bnx2x_link.c +++ b/drivers/net/bnx2x/bnx2x_link.c | |||
| @@ -778,9 +778,9 @@ static int bnx2x_ets_e3b0_set_cos_bw(struct bnx2x *bp, | |||
| 778 | { | 778 | { |
| 779 | u32 nig_reg_adress_crd_weight = 0; | 779 | u32 nig_reg_adress_crd_weight = 0; |
| 780 | u32 pbf_reg_adress_crd_weight = 0; | 780 | u32 pbf_reg_adress_crd_weight = 0; |
| 781 | /* Calculate and set BW for this COS*/ | 781 | /* Calculate and set BW for this COS - use 1 instead of 0 for BW */ |
| 782 | const u32 cos_bw_nig = (bw * min_w_val_nig) / total_bw; | 782 | const u32 cos_bw_nig = ((bw ? bw : 1) * min_w_val_nig) / total_bw; |
| 783 | const u32 cos_bw_pbf = (bw * min_w_val_pbf) / total_bw; | 783 | const u32 cos_bw_pbf = ((bw ? bw : 1) * min_w_val_pbf) / total_bw; |
| 784 | 784 | ||
| 785 | switch (cos_entry) { | 785 | switch (cos_entry) { |
| 786 | case 0: | 786 | case 0: |
| @@ -852,18 +852,12 @@ static int bnx2x_ets_e3b0_get_total_bw( | |||
| 852 | /* Calculate total BW requested */ | 852 | /* Calculate total BW requested */ |
| 853 | for (cos_idx = 0; cos_idx < ets_params->num_of_cos; cos_idx++) { | 853 | for (cos_idx = 0; cos_idx < ets_params->num_of_cos; cos_idx++) { |
| 854 | if (bnx2x_cos_state_bw == ets_params->cos[cos_idx].state) { | 854 | if (bnx2x_cos_state_bw == ets_params->cos[cos_idx].state) { |
| 855 | 855 | *total_bw += | |
| 856 | if (0 == ets_params->cos[cos_idx].params.bw_params.bw) { | 856 | ets_params->cos[cos_idx].params.bw_params.bw; |
| 857 | DP(NETIF_MSG_LINK, "bnx2x_ets_E3B0_config BW" | ||
| 858 | "was set to 0\n"); | ||
| 859 | return -EINVAL; | ||
| 860 | } | 857 | } |
| 861 | *total_bw += | ||
| 862 | ets_params->cos[cos_idx].params.bw_params.bw; | ||
| 863 | } | ||
| 864 | } | 858 | } |
| 865 | 859 | ||
| 866 | /*Check taotl BW is valid */ | 860 | /* Check total BW is valid */ |
| 867 | if ((100 != *total_bw) || (0 == *total_bw)) { | 861 | if ((100 != *total_bw) || (0 == *total_bw)) { |
| 868 | if (0 == *total_bw) { | 862 | if (0 == *total_bw) { |
| 869 | DP(NETIF_MSG_LINK, "bnx2x_ets_E3B0_config toatl BW" | 863 | DP(NETIF_MSG_LINK, "bnx2x_ets_E3B0_config toatl BW" |
| @@ -1726,7 +1720,7 @@ static int bnx2x_xmac_enable(struct link_params *params, | |||
| 1726 | 1720 | ||
| 1727 | /* Check loopback mode */ | 1721 | /* Check loopback mode */ |
| 1728 | if (lb) | 1722 | if (lb) |
| 1729 | val |= XMAC_CTRL_REG_CORE_LOCAL_LPBK; | 1723 | val |= XMAC_CTRL_REG_LINE_LOCAL_LPBK; |
| 1730 | REG_WR(bp, xmac_base + XMAC_REG_CTRL, val); | 1724 | REG_WR(bp, xmac_base + XMAC_REG_CTRL, val); |
| 1731 | bnx2x_set_xumac_nig(params, | 1725 | bnx2x_set_xumac_nig(params, |
| 1732 | ((vars->flow_ctrl & BNX2X_FLOW_CTRL_TX) != 0), 1); | 1726 | ((vars->flow_ctrl & BNX2X_FLOW_CTRL_TX) != 0), 1); |
| @@ -3630,6 +3624,12 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, | |||
| 3630 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, | 3624 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, |
| 3631 | MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT1, val16); | 3625 | MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT1, val16); |
| 3632 | 3626 | ||
| 3627 | /* Advertised and set FEC (Forward Error Correction) */ | ||
| 3628 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, | ||
| 3629 | MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT2, | ||
| 3630 | (MDIO_WC_REG_AN_IEEE1BLK_AN_ADV2_FEC_ABILITY | | ||
| 3631 | MDIO_WC_REG_AN_IEEE1BLK_AN_ADV2_FEC_REQ)); | ||
| 3632 | |||
| 3633 | /* Enable CL37 BAM */ | 3633 | /* Enable CL37 BAM */ |
| 3634 | if (REG_RD(bp, params->shmem_base + | 3634 | if (REG_RD(bp, params->shmem_base + |
| 3635 | offsetof(struct shmem_region, dev_info. | 3635 | offsetof(struct shmem_region, dev_info. |
| @@ -5924,7 +5924,7 @@ int bnx2x_set_led(struct link_params *params, | |||
| 5924 | (tmp | EMAC_LED_OVERRIDE)); | 5924 | (tmp | EMAC_LED_OVERRIDE)); |
| 5925 | /* | 5925 | /* |
| 5926 | * return here without enabling traffic | 5926 | * return here without enabling traffic |
| 5927 | * LED blink andsetting rate in ON mode. | 5927 | * LED blink and setting rate in ON mode. |
| 5928 | * In oper mode, enabling LED blink | 5928 | * In oper mode, enabling LED blink |
| 5929 | * and setting rate is needed. | 5929 | * and setting rate is needed. |
| 5930 | */ | 5930 | */ |
| @@ -5936,7 +5936,11 @@ int bnx2x_set_led(struct link_params *params, | |||
| 5936 | * This is a work-around for HW issue found when link | 5936 | * This is a work-around for HW issue found when link |
| 5937 | * is up in CL73 | 5937 | * is up in CL73 |
| 5938 | */ | 5938 | */ |
| 5939 | REG_WR(bp, NIG_REG_LED_10G_P0 + port*4, 1); | 5939 | if ((!CHIP_IS_E3(bp)) || |
| 5940 | (CHIP_IS_E3(bp) && | ||
| 5941 | mode == LED_MODE_ON)) | ||
| 5942 | REG_WR(bp, NIG_REG_LED_10G_P0 + port*4, 1); | ||
| 5943 | |||
| 5940 | if (CHIP_IS_E1x(bp) || | 5944 | if (CHIP_IS_E1x(bp) || |
| 5941 | CHIP_IS_E2(bp) || | 5945 | CHIP_IS_E2(bp) || |
| 5942 | (mode == LED_MODE_ON)) | 5946 | (mode == LED_MODE_ON)) |
| @@ -10638,8 +10642,7 @@ static struct bnx2x_phy phy_warpcore = { | |||
| 10638 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT, | 10642 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT, |
| 10639 | .addr = 0xff, | 10643 | .addr = 0xff, |
| 10640 | .def_md_devad = 0, | 10644 | .def_md_devad = 0, |
| 10641 | .flags = (FLAGS_HW_LOCK_REQUIRED | | 10645 | .flags = FLAGS_HW_LOCK_REQUIRED, |
| 10642 | FLAGS_TX_ERROR_CHECK), | ||
| 10643 | .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, | 10646 | .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, |
| 10644 | .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, | 10647 | .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, |
| 10645 | .mdio_ctrl = 0, | 10648 | .mdio_ctrl = 0, |
| @@ -10765,8 +10768,7 @@ static struct bnx2x_phy phy_8706 = { | |||
| 10765 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706, | 10768 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706, |
| 10766 | .addr = 0xff, | 10769 | .addr = 0xff, |
| 10767 | .def_md_devad = 0, | 10770 | .def_md_devad = 0, |
| 10768 | .flags = (FLAGS_INIT_XGXS_FIRST | | 10771 | .flags = FLAGS_INIT_XGXS_FIRST, |
| 10769 | FLAGS_TX_ERROR_CHECK), | ||
| 10770 | .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, | 10772 | .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, |
| 10771 | .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, | 10773 | .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, |
| 10772 | .mdio_ctrl = 0, | 10774 | .mdio_ctrl = 0, |
| @@ -10797,8 +10799,7 @@ static struct bnx2x_phy phy_8726 = { | |||
| 10797 | .addr = 0xff, | 10799 | .addr = 0xff, |
| 10798 | .def_md_devad = 0, | 10800 | .def_md_devad = 0, |
| 10799 | .flags = (FLAGS_HW_LOCK_REQUIRED | | 10801 | .flags = (FLAGS_HW_LOCK_REQUIRED | |
| 10800 | FLAGS_INIT_XGXS_FIRST | | 10802 | FLAGS_INIT_XGXS_FIRST), |
| 10801 | FLAGS_TX_ERROR_CHECK), | ||
| 10802 | .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, | 10803 | .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, |
| 10803 | .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, | 10804 | .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, |
| 10804 | .mdio_ctrl = 0, | 10805 | .mdio_ctrl = 0, |
| @@ -10829,8 +10830,7 @@ static struct bnx2x_phy phy_8727 = { | |||
| 10829 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727, | 10830 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727, |
| 10830 | .addr = 0xff, | 10831 | .addr = 0xff, |
| 10831 | .def_md_devad = 0, | 10832 | .def_md_devad = 0, |
| 10832 | .flags = (FLAGS_FAN_FAILURE_DET_REQ | | 10833 | .flags = FLAGS_FAN_FAILURE_DET_REQ, |
| 10833 | FLAGS_TX_ERROR_CHECK), | ||
| 10834 | .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, | 10834 | .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, |
| 10835 | .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, | 10835 | .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, |
| 10836 | .mdio_ctrl = 0, | 10836 | .mdio_ctrl = 0, |
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c index f74582a22c68..c027e9341a1a 100644 --- a/drivers/net/bnx2x/bnx2x_main.c +++ b/drivers/net/bnx2x/bnx2x_main.c | |||
| @@ -407,8 +407,8 @@ u32 bnx2x_dmae_opcode(struct bnx2x *bp, u8 src_type, u8 dst_type, | |||
| 407 | opcode |= (DMAE_CMD_SRC_RESET | DMAE_CMD_DST_RESET); | 407 | opcode |= (DMAE_CMD_SRC_RESET | DMAE_CMD_DST_RESET); |
| 408 | 408 | ||
| 409 | opcode |= (BP_PORT(bp) ? DMAE_CMD_PORT_1 : DMAE_CMD_PORT_0); | 409 | opcode |= (BP_PORT(bp) ? DMAE_CMD_PORT_1 : DMAE_CMD_PORT_0); |
| 410 | opcode |= ((BP_E1HVN(bp) << DMAE_CMD_E1HVN_SHIFT) | | 410 | opcode |= ((BP_VN(bp) << DMAE_CMD_E1HVN_SHIFT) | |
| 411 | (BP_E1HVN(bp) << DMAE_COMMAND_DST_VN_SHIFT)); | 411 | (BP_VN(bp) << DMAE_COMMAND_DST_VN_SHIFT)); |
| 412 | opcode |= (DMAE_COM_SET_ERR << DMAE_COMMAND_ERR_POLICY_SHIFT); | 412 | opcode |= (DMAE_COM_SET_ERR << DMAE_COMMAND_ERR_POLICY_SHIFT); |
| 413 | 413 | ||
| 414 | #ifdef __BIG_ENDIAN | 414 | #ifdef __BIG_ENDIAN |
| @@ -1419,7 +1419,7 @@ static void bnx2x_hc_int_enable(struct bnx2x *bp) | |||
| 1419 | if (!CHIP_IS_E1(bp)) { | 1419 | if (!CHIP_IS_E1(bp)) { |
| 1420 | /* init leading/trailing edge */ | 1420 | /* init leading/trailing edge */ |
| 1421 | if (IS_MF(bp)) { | 1421 | if (IS_MF(bp)) { |
| 1422 | val = (0xee0f | (1 << (BP_E1HVN(bp) + 4))); | 1422 | val = (0xee0f | (1 << (BP_VN(bp) + 4))); |
| 1423 | if (bp->port.pmf) | 1423 | if (bp->port.pmf) |
| 1424 | /* enable nig and gpio3 attention */ | 1424 | /* enable nig and gpio3 attention */ |
| 1425 | val |= 0x1100; | 1425 | val |= 0x1100; |
| @@ -1471,7 +1471,7 @@ static void bnx2x_igu_int_enable(struct bnx2x *bp) | |||
| 1471 | 1471 | ||
| 1472 | /* init leading/trailing edge */ | 1472 | /* init leading/trailing edge */ |
| 1473 | if (IS_MF(bp)) { | 1473 | if (IS_MF(bp)) { |
| 1474 | val = (0xee0f | (1 << (BP_E1HVN(bp) + 4))); | 1474 | val = (0xee0f | (1 << (BP_VN(bp) + 4))); |
| 1475 | if (bp->port.pmf) | 1475 | if (bp->port.pmf) |
| 1476 | /* enable nig and gpio3 attention */ | 1476 | /* enable nig and gpio3 attention */ |
| 1477 | val |= 0x1100; | 1477 | val |= 0x1100; |
| @@ -2287,7 +2287,7 @@ static void bnx2x_calc_vn_weight_sum(struct bnx2x *bp) | |||
| 2287 | int vn; | 2287 | int vn; |
| 2288 | 2288 | ||
| 2289 | bp->vn_weight_sum = 0; | 2289 | bp->vn_weight_sum = 0; |
| 2290 | for (vn = VN_0; vn < E1HVN_MAX; vn++) { | 2290 | for (vn = VN_0; vn < BP_MAX_VN_NUM(bp); vn++) { |
| 2291 | u32 vn_cfg = bp->mf_config[vn]; | 2291 | u32 vn_cfg = bp->mf_config[vn]; |
| 2292 | u32 vn_min_rate = ((vn_cfg & FUNC_MF_CFG_MIN_BW_MASK) >> | 2292 | u32 vn_min_rate = ((vn_cfg & FUNC_MF_CFG_MIN_BW_MASK) >> |
| 2293 | FUNC_MF_CFG_MIN_BW_SHIFT) * 100; | 2293 | FUNC_MF_CFG_MIN_BW_SHIFT) * 100; |
| @@ -2320,12 +2320,18 @@ static void bnx2x_calc_vn_weight_sum(struct bnx2x *bp) | |||
| 2320 | CMNG_FLAGS_PER_PORT_FAIRNESS_VN; | 2320 | CMNG_FLAGS_PER_PORT_FAIRNESS_VN; |
| 2321 | } | 2321 | } |
| 2322 | 2322 | ||
| 2323 | /* returns func by VN for current port */ | ||
| 2324 | static inline int func_by_vn(struct bnx2x *bp, int vn) | ||
| 2325 | { | ||
| 2326 | return 2 * vn + BP_PORT(bp); | ||
| 2327 | } | ||
| 2328 | |||
| 2323 | static void bnx2x_init_vn_minmax(struct bnx2x *bp, int vn) | 2329 | static void bnx2x_init_vn_minmax(struct bnx2x *bp, int vn) |
| 2324 | { | 2330 | { |
| 2325 | struct rate_shaping_vars_per_vn m_rs_vn; | 2331 | struct rate_shaping_vars_per_vn m_rs_vn; |
| 2326 | struct fairness_vars_per_vn m_fair_vn; | 2332 | struct fairness_vars_per_vn m_fair_vn; |
| 2327 | u32 vn_cfg = bp->mf_config[vn]; | 2333 | u32 vn_cfg = bp->mf_config[vn]; |
| 2328 | int func = 2*vn + BP_PORT(bp); | 2334 | int func = func_by_vn(bp, vn); |
| 2329 | u16 vn_min_rate, vn_max_rate; | 2335 | u16 vn_min_rate, vn_max_rate; |
| 2330 | int i; | 2336 | int i; |
| 2331 | 2337 | ||
| @@ -2422,7 +2428,7 @@ void bnx2x_read_mf_cfg(struct bnx2x *bp) | |||
| 2422 | * | 2428 | * |
| 2423 | * and there are 2 functions per port | 2429 | * and there are 2 functions per port |
| 2424 | */ | 2430 | */ |
| 2425 | for (vn = VN_0; vn < E1HVN_MAX; vn++) { | 2431 | for (vn = VN_0; vn < BP_MAX_VN_NUM(bp); vn++) { |
| 2426 | int /*abs*/func = n * (2 * vn + BP_PORT(bp)) + BP_PATH(bp); | 2432 | int /*abs*/func = n * (2 * vn + BP_PORT(bp)) + BP_PATH(bp); |
| 2427 | 2433 | ||
| 2428 | if (func >= E1H_FUNC_MAX) | 2434 | if (func >= E1H_FUNC_MAX) |
| @@ -2454,7 +2460,7 @@ static void bnx2x_cmng_fns_init(struct bnx2x *bp, u8 read_cfg, u8 cmng_type) | |||
| 2454 | 2460 | ||
| 2455 | /* calculate and set min-max rate for each vn */ | 2461 | /* calculate and set min-max rate for each vn */ |
| 2456 | if (bp->port.pmf) | 2462 | if (bp->port.pmf) |
| 2457 | for (vn = VN_0; vn < E1HVN_MAX; vn++) | 2463 | for (vn = VN_0; vn < BP_MAX_VN_NUM(bp); vn++) |
| 2458 | bnx2x_init_vn_minmax(bp, vn); | 2464 | bnx2x_init_vn_minmax(bp, vn); |
| 2459 | 2465 | ||
| 2460 | /* always enable rate shaping and fairness */ | 2466 | /* always enable rate shaping and fairness */ |
| @@ -2473,16 +2479,15 @@ static void bnx2x_cmng_fns_init(struct bnx2x *bp, u8 read_cfg, u8 cmng_type) | |||
| 2473 | 2479 | ||
| 2474 | static inline void bnx2x_link_sync_notify(struct bnx2x *bp) | 2480 | static inline void bnx2x_link_sync_notify(struct bnx2x *bp) |
| 2475 | { | 2481 | { |
| 2476 | int port = BP_PORT(bp); | ||
| 2477 | int func; | 2482 | int func; |
| 2478 | int vn; | 2483 | int vn; |
| 2479 | 2484 | ||
| 2480 | /* Set the attention towards other drivers on the same port */ | 2485 | /* Set the attention towards other drivers on the same port */ |
| 2481 | for (vn = VN_0; vn < E1HVN_MAX; vn++) { | 2486 | for (vn = VN_0; vn < BP_MAX_VN_NUM(bp); vn++) { |
| 2482 | if (vn == BP_E1HVN(bp)) | 2487 | if (vn == BP_VN(bp)) |
| 2483 | continue; | 2488 | continue; |
| 2484 | 2489 | ||
| 2485 | func = ((vn << 1) | port); | 2490 | func = func_by_vn(bp, vn); |
| 2486 | REG_WR(bp, MISC_REG_AEU_GENERAL_ATTN_0 + | 2491 | REG_WR(bp, MISC_REG_AEU_GENERAL_ATTN_0 + |
| 2487 | (LINK_SYNC_ATTENTION_BIT_FUNC_0 + func)*4, 1); | 2492 | (LINK_SYNC_ATTENTION_BIT_FUNC_0 + func)*4, 1); |
| 2488 | } | 2493 | } |
| @@ -2577,7 +2582,7 @@ static void bnx2x_pmf_update(struct bnx2x *bp) | |||
| 2577 | bnx2x_dcbx_pmf_update(bp); | 2582 | bnx2x_dcbx_pmf_update(bp); |
| 2578 | 2583 | ||
| 2579 | /* enable nig attention */ | 2584 | /* enable nig attention */ |
| 2580 | val = (0xff0f | (1 << (BP_E1HVN(bp) + 4))); | 2585 | val = (0xff0f | (1 << (BP_VN(bp) + 4))); |
| 2581 | if (bp->common.int_block == INT_BLOCK_HC) { | 2586 | if (bp->common.int_block == INT_BLOCK_HC) { |
| 2582 | REG_WR(bp, HC_REG_TRAILING_EDGE_0 + port*8, val); | 2587 | REG_WR(bp, HC_REG_TRAILING_EDGE_0 + port*8, val); |
| 2583 | REG_WR(bp, HC_REG_LEADING_EDGE_0 + port*8, val); | 2588 | REG_WR(bp, HC_REG_LEADING_EDGE_0 + port*8, val); |
| @@ -2756,8 +2761,14 @@ static void bnx2x_pf_rx_q_prep(struct bnx2x *bp, | |||
| 2756 | u16 tpa_agg_size = 0; | 2761 | u16 tpa_agg_size = 0; |
| 2757 | 2762 | ||
| 2758 | if (!fp->disable_tpa) { | 2763 | if (!fp->disable_tpa) { |
| 2759 | pause->sge_th_hi = 250; | 2764 | pause->sge_th_lo = SGE_TH_LO(bp); |
| 2760 | pause->sge_th_lo = 150; | 2765 | pause->sge_th_hi = SGE_TH_HI(bp); |
| 2766 | |||
| 2767 | /* validate SGE ring has enough to cross high threshold */ | ||
| 2768 | WARN_ON(bp->dropless_fc && | ||
| 2769 | pause->sge_th_hi + FW_PREFETCH_CNT > | ||
| 2770 | MAX_RX_SGE_CNT * NUM_RX_SGE_PAGES); | ||
| 2771 | |||
| 2761 | tpa_agg_size = min_t(u32, | 2772 | tpa_agg_size = min_t(u32, |
| 2762 | (min_t(u32, 8, MAX_SKB_FRAGS) * | 2773 | (min_t(u32, 8, MAX_SKB_FRAGS) * |
| 2763 | SGE_PAGE_SIZE * PAGES_PER_SGE), 0xffff); | 2774 | SGE_PAGE_SIZE * PAGES_PER_SGE), 0xffff); |
| @@ -2771,10 +2782,21 @@ static void bnx2x_pf_rx_q_prep(struct bnx2x *bp, | |||
| 2771 | 2782 | ||
| 2772 | /* pause - not for e1 */ | 2783 | /* pause - not for e1 */ |
| 2773 | if (!CHIP_IS_E1(bp)) { | 2784 | if (!CHIP_IS_E1(bp)) { |
| 2774 | pause->bd_th_hi = 350; | 2785 | pause->bd_th_lo = BD_TH_LO(bp); |
| 2775 | pause->bd_th_lo = 250; | 2786 | pause->bd_th_hi = BD_TH_HI(bp); |
| 2776 | pause->rcq_th_hi = 350; | 2787 | |
| 2777 | pause->rcq_th_lo = 250; | 2788 | pause->rcq_th_lo = RCQ_TH_LO(bp); |
| 2789 | pause->rcq_th_hi = RCQ_TH_HI(bp); | ||
| 2790 | /* | ||
| 2791 | * validate that rings have enough entries to cross | ||
| 2792 | * high thresholds | ||
| 2793 | */ | ||
| 2794 | WARN_ON(bp->dropless_fc && | ||
| 2795 | pause->bd_th_hi + FW_PREFETCH_CNT > | ||
| 2796 | bp->rx_ring_size); | ||
| 2797 | WARN_ON(bp->dropless_fc && | ||
| 2798 | pause->rcq_th_hi + FW_PREFETCH_CNT > | ||
| 2799 | NUM_RCQ_RINGS * MAX_RCQ_DESC_CNT); | ||
| 2778 | 2800 | ||
| 2779 | pause->pri_map = 1; | 2801 | pause->pri_map = 1; |
| 2780 | } | 2802 | } |
| @@ -2802,9 +2824,7 @@ static void bnx2x_pf_rx_q_prep(struct bnx2x *bp, | |||
| 2802 | * For PF Clients it should be the maximum avaliable number. | 2824 | * For PF Clients it should be the maximum avaliable number. |
| 2803 | * VF driver(s) may want to define it to a smaller value. | 2825 | * VF driver(s) may want to define it to a smaller value. |
| 2804 | */ | 2826 | */ |
| 2805 | rxq_init->max_tpa_queues = | 2827 | rxq_init->max_tpa_queues = MAX_AGG_QS(bp); |
| 2806 | (CHIP_IS_E1(bp) ? ETH_MAX_AGGREGATION_QUEUES_E1 : | ||
| 2807 | ETH_MAX_AGGREGATION_QUEUES_E1H_E2); | ||
| 2808 | 2828 | ||
| 2809 | rxq_init->cache_line_log = BNX2X_RX_ALIGN_SHIFT; | 2829 | rxq_init->cache_line_log = BNX2X_RX_ALIGN_SHIFT; |
| 2810 | rxq_init->fw_sb_id = fp->fw_sb_id; | 2830 | rxq_init->fw_sb_id = fp->fw_sb_id; |
| @@ -4808,6 +4828,37 @@ void bnx2x_setup_ndsb_state_machine(struct hc_status_block_sm *hc_sm, | |||
| 4808 | hc_sm->time_to_expire = 0xFFFFFFFF; | 4828 | hc_sm->time_to_expire = 0xFFFFFFFF; |
| 4809 | } | 4829 | } |
| 4810 | 4830 | ||
| 4831 | |||
| 4832 | /* allocates state machine ids. */ | ||
| 4833 | static inline | ||
| 4834 | void bnx2x_map_sb_state_machines(struct hc_index_data *index_data) | ||
| 4835 | { | ||
| 4836 | /* zero out state machine indices */ | ||
| 4837 | /* rx indices */ | ||
| 4838 | index_data[HC_INDEX_ETH_RX_CQ_CONS].flags &= ~HC_INDEX_DATA_SM_ID; | ||
| 4839 | |||
| 4840 | /* tx indices */ | ||
| 4841 | index_data[HC_INDEX_OOO_TX_CQ_CONS].flags &= ~HC_INDEX_DATA_SM_ID; | ||
| 4842 | index_data[HC_INDEX_ETH_TX_CQ_CONS_COS0].flags &= ~HC_INDEX_DATA_SM_ID; | ||
| 4843 | index_data[HC_INDEX_ETH_TX_CQ_CONS_COS1].flags &= ~HC_INDEX_DATA_SM_ID; | ||
| 4844 | index_data[HC_INDEX_ETH_TX_CQ_CONS_COS2].flags &= ~HC_INDEX_DATA_SM_ID; | ||
| 4845 | |||
| 4846 | /* map indices */ | ||
| 4847 | /* rx indices */ | ||
| 4848 | index_data[HC_INDEX_ETH_RX_CQ_CONS].flags |= | ||
| 4849 | SM_RX_ID << HC_INDEX_DATA_SM_ID_SHIFT; | ||
| 4850 | |||
| 4851 | /* tx indices */ | ||
| 4852 | index_data[HC_INDEX_OOO_TX_CQ_CONS].flags |= | ||
| 4853 | SM_TX_ID << HC_INDEX_DATA_SM_ID_SHIFT; | ||
| 4854 | index_data[HC_INDEX_ETH_TX_CQ_CONS_COS0].flags |= | ||
| 4855 | SM_TX_ID << HC_INDEX_DATA_SM_ID_SHIFT; | ||
| 4856 | index_data[HC_INDEX_ETH_TX_CQ_CONS_COS1].flags |= | ||
| 4857 | SM_TX_ID << HC_INDEX_DATA_SM_ID_SHIFT; | ||
| 4858 | index_data[HC_INDEX_ETH_TX_CQ_CONS_COS2].flags |= | ||
| 4859 | SM_TX_ID << HC_INDEX_DATA_SM_ID_SHIFT; | ||
| 4860 | } | ||
| 4861 | |||
| 4811 | static void bnx2x_init_sb(struct bnx2x *bp, dma_addr_t mapping, int vfid, | 4862 | static void bnx2x_init_sb(struct bnx2x *bp, dma_addr_t mapping, int vfid, |
| 4812 | u8 vf_valid, int fw_sb_id, int igu_sb_id) | 4863 | u8 vf_valid, int fw_sb_id, int igu_sb_id) |
| 4813 | { | 4864 | { |
| @@ -4839,6 +4890,7 @@ static void bnx2x_init_sb(struct bnx2x *bp, dma_addr_t mapping, int vfid, | |||
| 4839 | hc_sm_p = sb_data_e2.common.state_machine; | 4890 | hc_sm_p = sb_data_e2.common.state_machine; |
| 4840 | sb_data_p = (u32 *)&sb_data_e2; | 4891 | sb_data_p = (u32 *)&sb_data_e2; |
| 4841 | data_size = sizeof(struct hc_status_block_data_e2)/sizeof(u32); | 4892 | data_size = sizeof(struct hc_status_block_data_e2)/sizeof(u32); |
| 4893 | bnx2x_map_sb_state_machines(sb_data_e2.index_data); | ||
| 4842 | } else { | 4894 | } else { |
| 4843 | memset(&sb_data_e1x, 0, | 4895 | memset(&sb_data_e1x, 0, |
| 4844 | sizeof(struct hc_status_block_data_e1x)); | 4896 | sizeof(struct hc_status_block_data_e1x)); |
| @@ -4853,6 +4905,7 @@ static void bnx2x_init_sb(struct bnx2x *bp, dma_addr_t mapping, int vfid, | |||
| 4853 | hc_sm_p = sb_data_e1x.common.state_machine; | 4905 | hc_sm_p = sb_data_e1x.common.state_machine; |
| 4854 | sb_data_p = (u32 *)&sb_data_e1x; | 4906 | sb_data_p = (u32 *)&sb_data_e1x; |
| 4855 | data_size = sizeof(struct hc_status_block_data_e1x)/sizeof(u32); | 4907 | data_size = sizeof(struct hc_status_block_data_e1x)/sizeof(u32); |
| 4908 | bnx2x_map_sb_state_machines(sb_data_e1x.index_data); | ||
| 4856 | } | 4909 | } |
| 4857 | 4910 | ||
| 4858 | bnx2x_setup_ndsb_state_machine(&hc_sm_p[SM_RX_ID], | 4911 | bnx2x_setup_ndsb_state_machine(&hc_sm_p[SM_RX_ID], |
| @@ -5802,7 +5855,7 @@ static int bnx2x_init_hw_common(struct bnx2x *bp) | |||
| 5802 | * take the UNDI lock to protect undi_unload flow from accessing | 5855 | * take the UNDI lock to protect undi_unload flow from accessing |
| 5803 | * registers while we're resetting the chip | 5856 | * registers while we're resetting the chip |
| 5804 | */ | 5857 | */ |
| 5805 | bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_UNDI); | 5858 | bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_RESET); |
| 5806 | 5859 | ||
| 5807 | bnx2x_reset_common(bp); | 5860 | bnx2x_reset_common(bp); |
| 5808 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, 0xffffffff); | 5861 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, 0xffffffff); |
| @@ -5814,7 +5867,7 @@ static int bnx2x_init_hw_common(struct bnx2x *bp) | |||
| 5814 | } | 5867 | } |
| 5815 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET, val); | 5868 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET, val); |
| 5816 | 5869 | ||
| 5817 | bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_UNDI); | 5870 | bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_RESET); |
| 5818 | 5871 | ||
| 5819 | bnx2x_init_block(bp, BLOCK_MISC, PHASE_COMMON); | 5872 | bnx2x_init_block(bp, BLOCK_MISC, PHASE_COMMON); |
| 5820 | 5873 | ||
| @@ -6671,12 +6724,16 @@ static int bnx2x_init_hw_func(struct bnx2x *bp) | |||
| 6671 | if (CHIP_MODE_IS_4_PORT(bp)) | 6724 | if (CHIP_MODE_IS_4_PORT(bp)) |
| 6672 | dsb_idx = BP_FUNC(bp); | 6725 | dsb_idx = BP_FUNC(bp); |
| 6673 | else | 6726 | else |
| 6674 | dsb_idx = BP_E1HVN(bp); | 6727 | dsb_idx = BP_VN(bp); |
| 6675 | 6728 | ||
| 6676 | prod_offset = (CHIP_INT_MODE_IS_BC(bp) ? | 6729 | prod_offset = (CHIP_INT_MODE_IS_BC(bp) ? |
| 6677 | IGU_BC_BASE_DSB_PROD + dsb_idx : | 6730 | IGU_BC_BASE_DSB_PROD + dsb_idx : |
| 6678 | IGU_NORM_BASE_DSB_PROD + dsb_idx); | 6731 | IGU_NORM_BASE_DSB_PROD + dsb_idx); |
| 6679 | 6732 | ||
| 6733 | /* | ||
| 6734 | * igu prods come in chunks of E1HVN_MAX (4) - | ||
| 6735 | * does not matters what is the current chip mode | ||
| 6736 | */ | ||
| 6680 | for (i = 0; i < (num_segs * E1HVN_MAX); | 6737 | for (i = 0; i < (num_segs * E1HVN_MAX); |
| 6681 | i += E1HVN_MAX) { | 6738 | i += E1HVN_MAX) { |
| 6682 | addr = IGU_REG_PROD_CONS_MEMORY + | 6739 | addr = IGU_REG_PROD_CONS_MEMORY + |
| @@ -7570,7 +7627,7 @@ u32 bnx2x_send_unload_req(struct bnx2x *bp, int unload_mode) | |||
| 7570 | u32 val; | 7627 | u32 val; |
| 7571 | /* The mac address is written to entries 1-4 to | 7628 | /* The mac address is written to entries 1-4 to |
| 7572 | preserve entry 0 which is used by the PMF */ | 7629 | preserve entry 0 which is used by the PMF */ |
| 7573 | u8 entry = (BP_E1HVN(bp) + 1)*8; | 7630 | u8 entry = (BP_VN(bp) + 1)*8; |
| 7574 | 7631 | ||
| 7575 | val = (mac_addr[0] << 8) | mac_addr[1]; | 7632 | val = (mac_addr[0] << 8) | mac_addr[1]; |
| 7576 | EMAC_WR(bp, EMAC_REG_EMAC_MAC_MATCH + entry, val); | 7633 | EMAC_WR(bp, EMAC_REG_EMAC_MAC_MATCH + entry, val); |
| @@ -8546,10 +8603,12 @@ static void __devinit bnx2x_undi_unload(struct bnx2x *bp) | |||
| 8546 | /* Check if there is any driver already loaded */ | 8603 | /* Check if there is any driver already loaded */ |
| 8547 | val = REG_RD(bp, MISC_REG_UNPREPARED); | 8604 | val = REG_RD(bp, MISC_REG_UNPREPARED); |
| 8548 | if (val == 0x1) { | 8605 | if (val == 0x1) { |
| 8549 | /* Check if it is the UNDI driver | 8606 | |
| 8607 | bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_RESET); | ||
| 8608 | /* | ||
| 8609 | * Check if it is the UNDI driver | ||
| 8550 | * UNDI driver initializes CID offset for normal bell to 0x7 | 8610 | * UNDI driver initializes CID offset for normal bell to 0x7 |
| 8551 | */ | 8611 | */ |
| 8552 | bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_UNDI); | ||
| 8553 | val = REG_RD(bp, DORQ_REG_NORM_CID_OFST); | 8612 | val = REG_RD(bp, DORQ_REG_NORM_CID_OFST); |
| 8554 | if (val == 0x7) { | 8613 | if (val == 0x7) { |
| 8555 | u32 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS; | 8614 | u32 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS; |
| @@ -8587,9 +8646,6 @@ static void __devinit bnx2x_undi_unload(struct bnx2x *bp) | |||
| 8587 | bnx2x_fw_command(bp, reset_code, 0); | 8646 | bnx2x_fw_command(bp, reset_code, 0); |
| 8588 | } | 8647 | } |
| 8589 | 8648 | ||
| 8590 | /* now it's safe to release the lock */ | ||
| 8591 | bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_UNDI); | ||
| 8592 | |||
| 8593 | bnx2x_undi_int_disable(bp); | 8649 | bnx2x_undi_int_disable(bp); |
| 8594 | port = BP_PORT(bp); | 8650 | port = BP_PORT(bp); |
| 8595 | 8651 | ||
| @@ -8639,8 +8695,10 @@ static void __devinit bnx2x_undi_unload(struct bnx2x *bp) | |||
| 8639 | bp->fw_seq = | 8695 | bp->fw_seq = |
| 8640 | (SHMEM_RD(bp, func_mb[bp->pf_num].drv_mb_header) & | 8696 | (SHMEM_RD(bp, func_mb[bp->pf_num].drv_mb_header) & |
| 8641 | DRV_MSG_SEQ_NUMBER_MASK); | 8697 | DRV_MSG_SEQ_NUMBER_MASK); |
| 8642 | } else | 8698 | } |
| 8643 | bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_UNDI); | 8699 | |
| 8700 | /* now it's safe to release the lock */ | ||
| 8701 | bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_RESET); | ||
| 8644 | } | 8702 | } |
| 8645 | } | 8703 | } |
| 8646 | 8704 | ||
| @@ -8777,13 +8835,13 @@ static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp) | |||
| 8777 | static void __devinit bnx2x_get_igu_cam_info(struct bnx2x *bp) | 8835 | static void __devinit bnx2x_get_igu_cam_info(struct bnx2x *bp) |
| 8778 | { | 8836 | { |
| 8779 | int pfid = BP_FUNC(bp); | 8837 | int pfid = BP_FUNC(bp); |
| 8780 | int vn = BP_E1HVN(bp); | ||
| 8781 | int igu_sb_id; | 8838 | int igu_sb_id; |
| 8782 | u32 val; | 8839 | u32 val; |
| 8783 | u8 fid, igu_sb_cnt = 0; | 8840 | u8 fid, igu_sb_cnt = 0; |
| 8784 | 8841 | ||
| 8785 | bp->igu_base_sb = 0xff; | 8842 | bp->igu_base_sb = 0xff; |
| 8786 | if (CHIP_INT_MODE_IS_BC(bp)) { | 8843 | if (CHIP_INT_MODE_IS_BC(bp)) { |
| 8844 | int vn = BP_VN(bp); | ||
| 8787 | igu_sb_cnt = bp->igu_sb_cnt; | 8845 | igu_sb_cnt = bp->igu_sb_cnt; |
| 8788 | bp->igu_base_sb = (CHIP_MODE_IS_4_PORT(bp) ? pfid : vn) * | 8846 | bp->igu_base_sb = (CHIP_MODE_IS_4_PORT(bp) ? pfid : vn) * |
| 8789 | FP_SB_MAX_E1x; | 8847 | FP_SB_MAX_E1x; |
| @@ -9416,6 +9474,10 @@ static int __devinit bnx2x_get_hwinfo(struct bnx2x *bp) | |||
| 9416 | bp->igu_base_sb = 0; | 9474 | bp->igu_base_sb = 0; |
| 9417 | } else { | 9475 | } else { |
| 9418 | bp->common.int_block = INT_BLOCK_IGU; | 9476 | bp->common.int_block = INT_BLOCK_IGU; |
| 9477 | |||
| 9478 | /* do not allow device reset during IGU info preocessing */ | ||
| 9479 | bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_RESET); | ||
| 9480 | |||
| 9419 | val = REG_RD(bp, IGU_REG_BLOCK_CONFIGURATION); | 9481 | val = REG_RD(bp, IGU_REG_BLOCK_CONFIGURATION); |
| 9420 | 9482 | ||
| 9421 | if (val & IGU_BLOCK_CONFIGURATION_REG_BACKWARD_COMP_EN) { | 9483 | if (val & IGU_BLOCK_CONFIGURATION_REG_BACKWARD_COMP_EN) { |
| @@ -9447,6 +9509,7 @@ static int __devinit bnx2x_get_hwinfo(struct bnx2x *bp) | |||
| 9447 | 9509 | ||
| 9448 | bnx2x_get_igu_cam_info(bp); | 9510 | bnx2x_get_igu_cam_info(bp); |
| 9449 | 9511 | ||
| 9512 | bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_RESET); | ||
| 9450 | } | 9513 | } |
| 9451 | 9514 | ||
| 9452 | /* | 9515 | /* |
| @@ -9473,7 +9536,7 @@ static int __devinit bnx2x_get_hwinfo(struct bnx2x *bp) | |||
| 9473 | 9536 | ||
| 9474 | bp->mf_ov = 0; | 9537 | bp->mf_ov = 0; |
| 9475 | bp->mf_mode = 0; | 9538 | bp->mf_mode = 0; |
| 9476 | vn = BP_E1HVN(bp); | 9539 | vn = BP_VN(bp); |
| 9477 | 9540 | ||
| 9478 | if (!CHIP_IS_E1(bp) && !BP_NOMCP(bp)) { | 9541 | if (!CHIP_IS_E1(bp) && !BP_NOMCP(bp)) { |
| 9479 | BNX2X_DEV_INFO("shmem2base 0x%x, size %d, mfcfg offset %d\n", | 9542 | BNX2X_DEV_INFO("shmem2base 0x%x, size %d, mfcfg offset %d\n", |
| @@ -9593,13 +9656,6 @@ static int __devinit bnx2x_get_hwinfo(struct bnx2x *bp) | |||
| 9593 | /* port info */ | 9656 | /* port info */ |
| 9594 | bnx2x_get_port_hwinfo(bp); | 9657 | bnx2x_get_port_hwinfo(bp); |
| 9595 | 9658 | ||
| 9596 | if (!BP_NOMCP(bp)) { | ||
| 9597 | bp->fw_seq = | ||
| 9598 | (SHMEM_RD(bp, func_mb[BP_FW_MB_IDX(bp)].drv_mb_header) & | ||
| 9599 | DRV_MSG_SEQ_NUMBER_MASK); | ||
| 9600 | BNX2X_DEV_INFO("fw_seq 0x%08x\n", bp->fw_seq); | ||
| 9601 | } | ||
| 9602 | |||
| 9603 | /* Get MAC addresses */ | 9659 | /* Get MAC addresses */ |
| 9604 | bnx2x_get_mac_hwinfo(bp); | 9660 | bnx2x_get_mac_hwinfo(bp); |
| 9605 | 9661 | ||
| @@ -9765,6 +9821,14 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp) | |||
| 9765 | if (!BP_NOMCP(bp)) | 9821 | if (!BP_NOMCP(bp)) |
| 9766 | bnx2x_undi_unload(bp); | 9822 | bnx2x_undi_unload(bp); |
| 9767 | 9823 | ||
| 9824 | /* init fw_seq after undi_unload! */ | ||
| 9825 | if (!BP_NOMCP(bp)) { | ||
| 9826 | bp->fw_seq = | ||
| 9827 | (SHMEM_RD(bp, func_mb[BP_FW_MB_IDX(bp)].drv_mb_header) & | ||
| 9828 | DRV_MSG_SEQ_NUMBER_MASK); | ||
| 9829 | BNX2X_DEV_INFO("fw_seq 0x%08x\n", bp->fw_seq); | ||
| 9830 | } | ||
| 9831 | |||
| 9768 | if (CHIP_REV_IS_FPGA(bp)) | 9832 | if (CHIP_REV_IS_FPGA(bp)) |
| 9769 | dev_err(&bp->pdev->dev, "FPGA detected\n"); | 9833 | dev_err(&bp->pdev->dev, "FPGA detected\n"); |
| 9770 | 9834 | ||
| @@ -10259,17 +10323,21 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev, | |||
| 10259 | /* clean indirect addresses */ | 10323 | /* clean indirect addresses */ |
| 10260 | pci_write_config_dword(bp->pdev, PCICFG_GRC_ADDRESS, | 10324 | pci_write_config_dword(bp->pdev, PCICFG_GRC_ADDRESS, |
| 10261 | PCICFG_VENDOR_ID_OFFSET); | 10325 | PCICFG_VENDOR_ID_OFFSET); |
| 10262 | /* Clean the following indirect addresses for all functions since it | 10326 | /* |
| 10327 | * Clean the following indirect addresses for all functions since it | ||
| 10263 | * is not used by the driver. | 10328 | * is not used by the driver. |
| 10264 | */ | 10329 | */ |
| 10265 | REG_WR(bp, PXP2_REG_PGL_ADDR_88_F0, 0); | 10330 | REG_WR(bp, PXP2_REG_PGL_ADDR_88_F0, 0); |
| 10266 | REG_WR(bp, PXP2_REG_PGL_ADDR_8C_F0, 0); | 10331 | REG_WR(bp, PXP2_REG_PGL_ADDR_8C_F0, 0); |
| 10267 | REG_WR(bp, PXP2_REG_PGL_ADDR_90_F0, 0); | 10332 | REG_WR(bp, PXP2_REG_PGL_ADDR_90_F0, 0); |
| 10268 | REG_WR(bp, PXP2_REG_PGL_ADDR_94_F0, 0); | 10333 | REG_WR(bp, PXP2_REG_PGL_ADDR_94_F0, 0); |
| 10269 | REG_WR(bp, PXP2_REG_PGL_ADDR_88_F1, 0); | 10334 | |
| 10270 | REG_WR(bp, PXP2_REG_PGL_ADDR_8C_F1, 0); | 10335 | if (CHIP_IS_E1x(bp)) { |
| 10271 | REG_WR(bp, PXP2_REG_PGL_ADDR_90_F1, 0); | 10336 | REG_WR(bp, PXP2_REG_PGL_ADDR_88_F1, 0); |
| 10272 | REG_WR(bp, PXP2_REG_PGL_ADDR_94_F1, 0); | 10337 | REG_WR(bp, PXP2_REG_PGL_ADDR_8C_F1, 0); |
| 10338 | REG_WR(bp, PXP2_REG_PGL_ADDR_90_F1, 0); | ||
| 10339 | REG_WR(bp, PXP2_REG_PGL_ADDR_94_F1, 0); | ||
| 10340 | } | ||
| 10273 | 10341 | ||
| 10274 | /* | 10342 | /* |
| 10275 | * Enable internal target-read (in case we are probed after PF FLR). | 10343 | * Enable internal target-read (in case we are probed after PF FLR). |
diff --git a/drivers/net/bnx2x/bnx2x_reg.h b/drivers/net/bnx2x/bnx2x_reg.h index 40266c14e6dc..750e8445dac4 100644 --- a/drivers/net/bnx2x/bnx2x_reg.h +++ b/drivers/net/bnx2x/bnx2x_reg.h | |||
| @@ -5320,7 +5320,7 @@ | |||
| 5320 | #define XCM_REG_XX_OVFL_EVNT_ID 0x20058 | 5320 | #define XCM_REG_XX_OVFL_EVNT_ID 0x20058 |
| 5321 | #define XMAC_CLEAR_RX_LSS_STATUS_REG_CLEAR_LOCAL_FAULT_STATUS (0x1<<0) | 5321 | #define XMAC_CLEAR_RX_LSS_STATUS_REG_CLEAR_LOCAL_FAULT_STATUS (0x1<<0) |
| 5322 | #define XMAC_CLEAR_RX_LSS_STATUS_REG_CLEAR_REMOTE_FAULT_STATUS (0x1<<1) | 5322 | #define XMAC_CLEAR_RX_LSS_STATUS_REG_CLEAR_REMOTE_FAULT_STATUS (0x1<<1) |
| 5323 | #define XMAC_CTRL_REG_CORE_LOCAL_LPBK (0x1<<3) | 5323 | #define XMAC_CTRL_REG_LINE_LOCAL_LPBK (0x1<<2) |
| 5324 | #define XMAC_CTRL_REG_RX_EN (0x1<<1) | 5324 | #define XMAC_CTRL_REG_RX_EN (0x1<<1) |
| 5325 | #define XMAC_CTRL_REG_SOFT_RESET (0x1<<6) | 5325 | #define XMAC_CTRL_REG_SOFT_RESET (0x1<<6) |
| 5326 | #define XMAC_CTRL_REG_TX_EN (0x1<<0) | 5326 | #define XMAC_CTRL_REG_TX_EN (0x1<<0) |
| @@ -5766,7 +5766,7 @@ | |||
| 5766 | #define HW_LOCK_RESOURCE_RECOVERY_LEADER_0 8 | 5766 | #define HW_LOCK_RESOURCE_RECOVERY_LEADER_0 8 |
| 5767 | #define HW_LOCK_RESOURCE_RECOVERY_LEADER_1 9 | 5767 | #define HW_LOCK_RESOURCE_RECOVERY_LEADER_1 9 |
| 5768 | #define HW_LOCK_RESOURCE_SPIO 2 | 5768 | #define HW_LOCK_RESOURCE_SPIO 2 |
| 5769 | #define HW_LOCK_RESOURCE_UNDI 5 | 5769 | #define HW_LOCK_RESOURCE_RESET 5 |
| 5770 | #define AEU_INPUTS_ATTN_BITS_ATC_HW_INTERRUPT (0x1<<4) | 5770 | #define AEU_INPUTS_ATTN_BITS_ATC_HW_INTERRUPT (0x1<<4) |
| 5771 | #define AEU_INPUTS_ATTN_BITS_ATC_PARITY_ERROR (0x1<<5) | 5771 | #define AEU_INPUTS_ATTN_BITS_ATC_PARITY_ERROR (0x1<<5) |
| 5772 | #define AEU_INPUTS_ATTN_BITS_BRB_PARITY_ERROR (0x1<<18) | 5772 | #define AEU_INPUTS_ATTN_BITS_BRB_PARITY_ERROR (0x1<<18) |
| @@ -6853,6 +6853,9 @@ Theotherbitsarereservedandshouldbezero*/ | |||
| 6853 | #define MDIO_WC_REG_IEEE0BLK_AUTONEGNP 0x7 | 6853 | #define MDIO_WC_REG_IEEE0BLK_AUTONEGNP 0x7 |
| 6854 | #define MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT0 0x10 | 6854 | #define MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT0 0x10 |
| 6855 | #define MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT1 0x11 | 6855 | #define MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT1 0x11 |
| 6856 | #define MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT2 0x12 | ||
| 6857 | #define MDIO_WC_REG_AN_IEEE1BLK_AN_ADV2_FEC_ABILITY 0x4000 | ||
| 6858 | #define MDIO_WC_REG_AN_IEEE1BLK_AN_ADV2_FEC_REQ 0x8000 | ||
| 6856 | #define MDIO_WC_REG_PMD_IEEE9BLK_TENGBASE_KR_PMD_CONTROL_REGISTER_150 0x96 | 6859 | #define MDIO_WC_REG_PMD_IEEE9BLK_TENGBASE_KR_PMD_CONTROL_REGISTER_150 0x96 |
| 6857 | #define MDIO_WC_REG_XGXSBLK0_XGXSCONTROL 0x8000 | 6860 | #define MDIO_WC_REG_XGXSBLK0_XGXSCONTROL 0x8000 |
| 6858 | #define MDIO_WC_REG_XGXSBLK0_MISCCONTROL1 0x800e | 6861 | #define MDIO_WC_REG_XGXSBLK0_MISCCONTROL1 0x800e |
diff --git a/drivers/net/bnx2x/bnx2x_stats.c b/drivers/net/bnx2x/bnx2x_stats.c index 771f6803b238..9908f2bbcf73 100644 --- a/drivers/net/bnx2x/bnx2x_stats.c +++ b/drivers/net/bnx2x/bnx2x_stats.c | |||
| @@ -710,7 +710,8 @@ static int bnx2x_hw_stats_update(struct bnx2x *bp) | |||
| 710 | break; | 710 | break; |
| 711 | 711 | ||
| 712 | case MAC_TYPE_NONE: /* unreached */ | 712 | case MAC_TYPE_NONE: /* unreached */ |
| 713 | BNX2X_ERR("stats updated by DMAE but no MAC active\n"); | 713 | DP(BNX2X_MSG_STATS, |
| 714 | "stats updated by DMAE but no MAC active\n"); | ||
| 714 | return -1; | 715 | return -1; |
| 715 | 716 | ||
| 716 | default: /* unreached */ | 717 | default: /* unreached */ |
| @@ -1391,7 +1392,7 @@ static void bnx2x_port_stats_base_init(struct bnx2x *bp) | |||
| 1391 | 1392 | ||
| 1392 | static void bnx2x_func_stats_base_init(struct bnx2x *bp) | 1393 | static void bnx2x_func_stats_base_init(struct bnx2x *bp) |
| 1393 | { | 1394 | { |
| 1394 | int vn, vn_max = IS_MF(bp) ? E1HVN_MAX : E1VN_MAX; | 1395 | int vn, vn_max = IS_MF(bp) ? BP_MAX_VN_NUM(bp) : E1VN_MAX; |
| 1395 | u32 func_stx; | 1396 | u32 func_stx; |
| 1396 | 1397 | ||
| 1397 | /* sanity */ | 1398 | /* sanity */ |
| @@ -1404,7 +1405,7 @@ static void bnx2x_func_stats_base_init(struct bnx2x *bp) | |||
| 1404 | func_stx = bp->func_stx; | 1405 | func_stx = bp->func_stx; |
| 1405 | 1406 | ||
| 1406 | for (vn = VN_0; vn < vn_max; vn++) { | 1407 | for (vn = VN_0; vn < vn_max; vn++) { |
| 1407 | int mb_idx = CHIP_IS_E1x(bp) ? 2*vn + BP_PORT(bp) : vn; | 1408 | int mb_idx = BP_FW_MB_IDX_VN(bp, vn); |
| 1408 | 1409 | ||
| 1409 | bp->func_stx = SHMEM_RD(bp, func_mb[mb_idx].fw_mb_param); | 1410 | bp->func_stx = SHMEM_RD(bp, func_mb[mb_idx].fw_mb_param); |
| 1410 | bnx2x_func_stats_init(bp); | 1411 | bnx2x_func_stats_init(bp); |
diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c index a81249246ece..2adc294f512a 100644 --- a/drivers/net/can/ti_hecc.c +++ b/drivers/net/can/ti_hecc.c | |||
| @@ -46,6 +46,7 @@ | |||
| 46 | #include <linux/skbuff.h> | 46 | #include <linux/skbuff.h> |
| 47 | #include <linux/platform_device.h> | 47 | #include <linux/platform_device.h> |
| 48 | #include <linux/clk.h> | 48 | #include <linux/clk.h> |
| 49 | #include <linux/io.h> | ||
| 49 | 50 | ||
| 50 | #include <linux/can/dev.h> | 51 | #include <linux/can/dev.h> |
| 51 | #include <linux/can/error.h> | 52 | #include <linux/can/error.h> |
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c index 8545c7aa93eb..a5a89ecb6f36 100644 --- a/drivers/net/e1000/e1000_hw.c +++ b/drivers/net/e1000/e1000_hw.c | |||
| @@ -4026,6 +4026,12 @@ s32 e1000_validate_eeprom_checksum(struct e1000_hw *hw) | |||
| 4026 | checksum += eeprom_data; | 4026 | checksum += eeprom_data; |
| 4027 | } | 4027 | } |
| 4028 | 4028 | ||
| 4029 | #ifdef CONFIG_PARISC | ||
| 4030 | /* This is a signature and not a checksum on HP c8000 */ | ||
| 4031 | if ((hw->subsystem_vendor_id == 0x103C) && (eeprom_data == 0x16d6)) | ||
| 4032 | return E1000_SUCCESS; | ||
| 4033 | |||
| 4034 | #endif | ||
| 4029 | if (checksum == (u16) EEPROM_SUM) | 4035 | if (checksum == (u16) EEPROM_SUM) |
| 4030 | return E1000_SUCCESS; | 4036 | return E1000_SUCCESS; |
| 4031 | else { | 4037 | else { |
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index 3e6679269400..8dd5fccef725 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
| @@ -757,7 +757,7 @@ static int ibmveth_set_csum_offload(struct net_device *dev, u32 data) | |||
| 757 | struct ibmveth_adapter *adapter = netdev_priv(dev); | 757 | struct ibmveth_adapter *adapter = netdev_priv(dev); |
| 758 | unsigned long set_attr, clr_attr, ret_attr; | 758 | unsigned long set_attr, clr_attr, ret_attr; |
| 759 | unsigned long set_attr6, clr_attr6; | 759 | unsigned long set_attr6, clr_attr6; |
| 760 | long ret, ret6; | 760 | long ret, ret4, ret6; |
| 761 | int rc1 = 0, rc2 = 0; | 761 | int rc1 = 0, rc2 = 0; |
| 762 | int restart = 0; | 762 | int restart = 0; |
| 763 | 763 | ||
| @@ -770,6 +770,8 @@ static int ibmveth_set_csum_offload(struct net_device *dev, u32 data) | |||
| 770 | 770 | ||
| 771 | set_attr = 0; | 771 | set_attr = 0; |
| 772 | clr_attr = 0; | 772 | clr_attr = 0; |
| 773 | set_attr6 = 0; | ||
| 774 | clr_attr6 = 0; | ||
| 773 | 775 | ||
| 774 | if (data) { | 776 | if (data) { |
| 775 | set_attr = IBMVETH_ILLAN_IPV4_TCP_CSUM; | 777 | set_attr = IBMVETH_ILLAN_IPV4_TCP_CSUM; |
| @@ -784,16 +786,20 @@ static int ibmveth_set_csum_offload(struct net_device *dev, u32 data) | |||
| 784 | if (ret == H_SUCCESS && !(ret_attr & IBMVETH_ILLAN_ACTIVE_TRUNK) && | 786 | if (ret == H_SUCCESS && !(ret_attr & IBMVETH_ILLAN_ACTIVE_TRUNK) && |
| 785 | !(ret_attr & IBMVETH_ILLAN_TRUNK_PRI_MASK) && | 787 | !(ret_attr & IBMVETH_ILLAN_TRUNK_PRI_MASK) && |
| 786 | (ret_attr & IBMVETH_ILLAN_PADDED_PKT_CSUM)) { | 788 | (ret_attr & IBMVETH_ILLAN_PADDED_PKT_CSUM)) { |
| 787 | ret = h_illan_attributes(adapter->vdev->unit_address, clr_attr, | 789 | ret4 = h_illan_attributes(adapter->vdev->unit_address, clr_attr, |
| 788 | set_attr, &ret_attr); | 790 | set_attr, &ret_attr); |
| 789 | 791 | ||
| 790 | if (ret != H_SUCCESS) { | 792 | if (ret4 != H_SUCCESS) { |
| 791 | netdev_err(dev, "unable to change IPv4 checksum " | 793 | netdev_err(dev, "unable to change IPv4 checksum " |
| 792 | "offload settings. %d rc=%ld\n", | 794 | "offload settings. %d rc=%ld\n", |
| 793 | data, ret); | 795 | data, ret4); |
| 796 | |||
| 797 | h_illan_attributes(adapter->vdev->unit_address, | ||
| 798 | set_attr, clr_attr, &ret_attr); | ||
| 799 | |||
| 800 | if (data == 1) | ||
| 801 | dev->features &= ~NETIF_F_IP_CSUM; | ||
| 794 | 802 | ||
| 795 | ret = h_illan_attributes(adapter->vdev->unit_address, | ||
| 796 | set_attr, clr_attr, &ret_attr); | ||
| 797 | } else { | 803 | } else { |
| 798 | adapter->fw_ipv4_csum_support = data; | 804 | adapter->fw_ipv4_csum_support = data; |
| 799 | } | 805 | } |
| @@ -804,15 +810,18 @@ static int ibmveth_set_csum_offload(struct net_device *dev, u32 data) | |||
| 804 | if (ret6 != H_SUCCESS) { | 810 | if (ret6 != H_SUCCESS) { |
| 805 | netdev_err(dev, "unable to change IPv6 checksum " | 811 | netdev_err(dev, "unable to change IPv6 checksum " |
| 806 | "offload settings. %d rc=%ld\n", | 812 | "offload settings. %d rc=%ld\n", |
| 807 | data, ret); | 813 | data, ret6); |
| 814 | |||
| 815 | h_illan_attributes(adapter->vdev->unit_address, | ||
| 816 | set_attr6, clr_attr6, &ret_attr); | ||
| 817 | |||
| 818 | if (data == 1) | ||
| 819 | dev->features &= ~NETIF_F_IPV6_CSUM; | ||
| 808 | 820 | ||
| 809 | ret = h_illan_attributes(adapter->vdev->unit_address, | ||
| 810 | set_attr6, clr_attr6, | ||
| 811 | &ret_attr); | ||
| 812 | } else | 821 | } else |
| 813 | adapter->fw_ipv6_csum_support = data; | 822 | adapter->fw_ipv6_csum_support = data; |
| 814 | 823 | ||
| 815 | if (ret != H_SUCCESS || ret6 != H_SUCCESS) | 824 | if (ret4 == H_SUCCESS || ret6 == H_SUCCESS) |
| 816 | adapter->rx_csum = data; | 825 | adapter->rx_csum = data; |
| 817 | else | 826 | else |
| 818 | rc1 = -EIO; | 827 | rc1 = -EIO; |
| @@ -930,6 +939,7 @@ static netdev_tx_t ibmveth_start_xmit(struct sk_buff *skb, | |||
| 930 | union ibmveth_buf_desc descs[6]; | 939 | union ibmveth_buf_desc descs[6]; |
| 931 | int last, i; | 940 | int last, i; |
| 932 | int force_bounce = 0; | 941 | int force_bounce = 0; |
| 942 | dma_addr_t dma_addr; | ||
| 933 | 943 | ||
| 934 | /* | 944 | /* |
| 935 | * veth handles a maximum of 6 segments including the header, so | 945 | * veth handles a maximum of 6 segments including the header, so |
| @@ -994,17 +1004,16 @@ retry_bounce: | |||
| 994 | } | 1004 | } |
| 995 | 1005 | ||
| 996 | /* Map the header */ | 1006 | /* Map the header */ |
| 997 | descs[0].fields.address = dma_map_single(&adapter->vdev->dev, skb->data, | 1007 | dma_addr = dma_map_single(&adapter->vdev->dev, skb->data, |
| 998 | skb_headlen(skb), | 1008 | skb_headlen(skb), DMA_TO_DEVICE); |
| 999 | DMA_TO_DEVICE); | 1009 | if (dma_mapping_error(&adapter->vdev->dev, dma_addr)) |
| 1000 | if (dma_mapping_error(&adapter->vdev->dev, descs[0].fields.address)) | ||
| 1001 | goto map_failed; | 1010 | goto map_failed; |
| 1002 | 1011 | ||
| 1003 | descs[0].fields.flags_len = desc_flags | skb_headlen(skb); | 1012 | descs[0].fields.flags_len = desc_flags | skb_headlen(skb); |
| 1013 | descs[0].fields.address = dma_addr; | ||
| 1004 | 1014 | ||
| 1005 | /* Map the frags */ | 1015 | /* Map the frags */ |
| 1006 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 1016 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
| 1007 | unsigned long dma_addr; | ||
| 1008 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 1017 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
| 1009 | 1018 | ||
| 1010 | dma_addr = dma_map_page(&adapter->vdev->dev, frag->page, | 1019 | dma_addr = dma_map_page(&adapter->vdev->dev, frag->page, |
| @@ -1026,7 +1035,12 @@ retry_bounce: | |||
| 1026 | netdev->stats.tx_bytes += skb->len; | 1035 | netdev->stats.tx_bytes += skb->len; |
| 1027 | } | 1036 | } |
| 1028 | 1037 | ||
| 1029 | for (i = 0; i < skb_shinfo(skb)->nr_frags + 1; i++) | 1038 | dma_unmap_single(&adapter->vdev->dev, |
| 1039 | descs[0].fields.address, | ||
| 1040 | descs[0].fields.flags_len & IBMVETH_BUF_LEN_MASK, | ||
| 1041 | DMA_TO_DEVICE); | ||
| 1042 | |||
| 1043 | for (i = 1; i < skb_shinfo(skb)->nr_frags + 1; i++) | ||
| 1030 | dma_unmap_page(&adapter->vdev->dev, descs[i].fields.address, | 1044 | dma_unmap_page(&adapter->vdev->dev, descs[i].fields.address, |
| 1031 | descs[i].fields.flags_len & IBMVETH_BUF_LEN_MASK, | 1045 | descs[i].fields.flags_len & IBMVETH_BUF_LEN_MASK, |
| 1032 | DMA_TO_DEVICE); | 1046 | DMA_TO_DEVICE); |
diff --git a/drivers/net/pch_gbe/pch_gbe.h b/drivers/net/pch_gbe/pch_gbe.h index 59fac77d0dbb..a09a07197eb5 100644 --- a/drivers/net/pch_gbe/pch_gbe.h +++ b/drivers/net/pch_gbe/pch_gbe.h | |||
| @@ -127,8 +127,8 @@ struct pch_gbe_regs { | |||
| 127 | 127 | ||
| 128 | /* Reset */ | 128 | /* Reset */ |
| 129 | #define PCH_GBE_ALL_RST 0x80000000 /* All reset */ | 129 | #define PCH_GBE_ALL_RST 0x80000000 /* All reset */ |
| 130 | #define PCH_GBE_TX_RST 0x40000000 /* TX MAC, TX FIFO, TX DMA reset */ | 130 | #define PCH_GBE_TX_RST 0x00008000 /* TX MAC, TX FIFO, TX DMA reset */ |
| 131 | #define PCH_GBE_RX_RST 0x04000000 /* RX MAC, RX FIFO, RX DMA reset */ | 131 | #define PCH_GBE_RX_RST 0x00004000 /* RX MAC, RX FIFO, RX DMA reset */ |
| 132 | 132 | ||
| 133 | /* TCP/IP Accelerator Control */ | 133 | /* TCP/IP Accelerator Control */ |
| 134 | #define PCH_GBE_EX_LIST_EN 0x00000008 /* External List Enable */ | 134 | #define PCH_GBE_EX_LIST_EN 0x00000008 /* External List Enable */ |
| @@ -276,6 +276,9 @@ struct pch_gbe_regs { | |||
| 276 | #define PCH_GBE_RX_DMA_EN 0x00000002 /* Enables Receive DMA */ | 276 | #define PCH_GBE_RX_DMA_EN 0x00000002 /* Enables Receive DMA */ |
| 277 | #define PCH_GBE_TX_DMA_EN 0x00000001 /* Enables Transmission DMA */ | 277 | #define PCH_GBE_TX_DMA_EN 0x00000001 /* Enables Transmission DMA */ |
| 278 | 278 | ||
| 279 | /* RX DMA STATUS */ | ||
| 280 | #define PCH_GBE_IDLE_CHECK 0xFFFFFFFE | ||
| 281 | |||
| 279 | /* Wake On LAN Status */ | 282 | /* Wake On LAN Status */ |
| 280 | #define PCH_GBE_WLS_BR 0x00000008 /* Broadcas Address */ | 283 | #define PCH_GBE_WLS_BR 0x00000008 /* Broadcas Address */ |
| 281 | #define PCH_GBE_WLS_MLT 0x00000004 /* Multicast Address */ | 284 | #define PCH_GBE_WLS_MLT 0x00000004 /* Multicast Address */ |
| @@ -471,6 +474,7 @@ struct pch_gbe_tx_desc { | |||
| 471 | struct pch_gbe_buffer { | 474 | struct pch_gbe_buffer { |
| 472 | struct sk_buff *skb; | 475 | struct sk_buff *skb; |
| 473 | dma_addr_t dma; | 476 | dma_addr_t dma; |
| 477 | unsigned char *rx_buffer; | ||
| 474 | unsigned long time_stamp; | 478 | unsigned long time_stamp; |
| 475 | u16 length; | 479 | u16 length; |
| 476 | bool mapped; | 480 | bool mapped; |
| @@ -511,6 +515,9 @@ struct pch_gbe_tx_ring { | |||
| 511 | struct pch_gbe_rx_ring { | 515 | struct pch_gbe_rx_ring { |
| 512 | struct pch_gbe_rx_desc *desc; | 516 | struct pch_gbe_rx_desc *desc; |
| 513 | dma_addr_t dma; | 517 | dma_addr_t dma; |
| 518 | unsigned char *rx_buff_pool; | ||
| 519 | dma_addr_t rx_buff_pool_logic; | ||
| 520 | unsigned int rx_buff_pool_size; | ||
| 514 | unsigned int size; | 521 | unsigned int size; |
| 515 | unsigned int count; | 522 | unsigned int count; |
| 516 | unsigned int next_to_use; | 523 | unsigned int next_to_use; |
| @@ -622,6 +629,7 @@ struct pch_gbe_adapter { | |||
| 622 | unsigned long rx_buffer_len; | 629 | unsigned long rx_buffer_len; |
| 623 | unsigned long tx_queue_len; | 630 | unsigned long tx_queue_len; |
| 624 | bool have_msi; | 631 | bool have_msi; |
| 632 | bool rx_stop_flag; | ||
| 625 | }; | 633 | }; |
| 626 | 634 | ||
| 627 | extern const char pch_driver_version[]; | 635 | extern const char pch_driver_version[]; |
diff --git a/drivers/net/pch_gbe/pch_gbe_main.c b/drivers/net/pch_gbe/pch_gbe_main.c index eac3c5ca9731..567ff10889be 100644 --- a/drivers/net/pch_gbe/pch_gbe_main.c +++ b/drivers/net/pch_gbe/pch_gbe_main.c | |||
| @@ -20,7 +20,6 @@ | |||
| 20 | 20 | ||
| 21 | #include "pch_gbe.h" | 21 | #include "pch_gbe.h" |
| 22 | #include "pch_gbe_api.h" | 22 | #include "pch_gbe_api.h" |
| 23 | #include <linux/prefetch.h> | ||
| 24 | 23 | ||
| 25 | #define DRV_VERSION "1.00" | 24 | #define DRV_VERSION "1.00" |
| 26 | const char pch_driver_version[] = DRV_VERSION; | 25 | const char pch_driver_version[] = DRV_VERSION; |
| @@ -34,11 +33,15 @@ const char pch_driver_version[] = DRV_VERSION; | |||
| 34 | #define PCH_GBE_WATCHDOG_PERIOD (1 * HZ) /* watchdog time */ | 33 | #define PCH_GBE_WATCHDOG_PERIOD (1 * HZ) /* watchdog time */ |
| 35 | #define PCH_GBE_COPYBREAK_DEFAULT 256 | 34 | #define PCH_GBE_COPYBREAK_DEFAULT 256 |
| 36 | #define PCH_GBE_PCI_BAR 1 | 35 | #define PCH_GBE_PCI_BAR 1 |
| 36 | #define PCH_GBE_RESERVE_MEMORY 0x200000 /* 2MB */ | ||
| 37 | 37 | ||
| 38 | /* Macros for ML7223 */ | 38 | /* Macros for ML7223 */ |
| 39 | #define PCI_VENDOR_ID_ROHM 0x10db | 39 | #define PCI_VENDOR_ID_ROHM 0x10db |
| 40 | #define PCI_DEVICE_ID_ROHM_ML7223_GBE 0x8013 | 40 | #define PCI_DEVICE_ID_ROHM_ML7223_GBE 0x8013 |
| 41 | 41 | ||
| 42 | /* Macros for ML7831 */ | ||
| 43 | #define PCI_DEVICE_ID_ROHM_ML7831_GBE 0x8802 | ||
| 44 | |||
| 42 | #define PCH_GBE_TX_WEIGHT 64 | 45 | #define PCH_GBE_TX_WEIGHT 64 |
| 43 | #define PCH_GBE_RX_WEIGHT 64 | 46 | #define PCH_GBE_RX_WEIGHT 64 |
| 44 | #define PCH_GBE_RX_BUFFER_WRITE 16 | 47 | #define PCH_GBE_RX_BUFFER_WRITE 16 |
| @@ -52,6 +55,7 @@ const char pch_driver_version[] = DRV_VERSION; | |||
| 52 | ) | 55 | ) |
| 53 | 56 | ||
| 54 | /* Ethertype field values */ | 57 | /* Ethertype field values */ |
| 58 | #define PCH_GBE_MAX_RX_BUFFER_SIZE 0x2880 | ||
| 55 | #define PCH_GBE_MAX_JUMBO_FRAME_SIZE 10318 | 59 | #define PCH_GBE_MAX_JUMBO_FRAME_SIZE 10318 |
| 56 | #define PCH_GBE_FRAME_SIZE_2048 2048 | 60 | #define PCH_GBE_FRAME_SIZE_2048 2048 |
| 57 | #define PCH_GBE_FRAME_SIZE_4096 4096 | 61 | #define PCH_GBE_FRAME_SIZE_4096 4096 |
| @@ -83,10 +87,12 @@ const char pch_driver_version[] = DRV_VERSION; | |||
| 83 | #define PCH_GBE_INT_ENABLE_MASK ( \ | 87 | #define PCH_GBE_INT_ENABLE_MASK ( \ |
| 84 | PCH_GBE_INT_RX_DMA_CMPLT | \ | 88 | PCH_GBE_INT_RX_DMA_CMPLT | \ |
| 85 | PCH_GBE_INT_RX_DSC_EMP | \ | 89 | PCH_GBE_INT_RX_DSC_EMP | \ |
| 90 | PCH_GBE_INT_RX_FIFO_ERR | \ | ||
| 86 | PCH_GBE_INT_WOL_DET | \ | 91 | PCH_GBE_INT_WOL_DET | \ |
| 87 | PCH_GBE_INT_TX_CMPLT \ | 92 | PCH_GBE_INT_TX_CMPLT \ |
| 88 | ) | 93 | ) |
| 89 | 94 | ||
| 95 | #define PCH_GBE_INT_DISABLE_ALL 0 | ||
| 90 | 96 | ||
| 91 | static unsigned int copybreak __read_mostly = PCH_GBE_COPYBREAK_DEFAULT; | 97 | static unsigned int copybreak __read_mostly = PCH_GBE_COPYBREAK_DEFAULT; |
| 92 | 98 | ||
| @@ -138,6 +144,27 @@ static void pch_gbe_wait_clr_bit(void *reg, u32 bit) | |||
| 138 | if (!tmp) | 144 | if (!tmp) |
| 139 | pr_err("Error: busy bit is not cleared\n"); | 145 | pr_err("Error: busy bit is not cleared\n"); |
| 140 | } | 146 | } |
| 147 | |||
| 148 | /** | ||
| 149 | * pch_gbe_wait_clr_bit_irq - Wait to clear a bit for interrupt context | ||
| 150 | * @reg: Pointer of register | ||
| 151 | * @busy: Busy bit | ||
| 152 | */ | ||
| 153 | static int pch_gbe_wait_clr_bit_irq(void *reg, u32 bit) | ||
| 154 | { | ||
| 155 | u32 tmp; | ||
| 156 | int ret = -1; | ||
| 157 | /* wait busy */ | ||
| 158 | tmp = 20; | ||
| 159 | while ((ioread32(reg) & bit) && --tmp) | ||
| 160 | udelay(5); | ||
| 161 | if (!tmp) | ||
| 162 | pr_err("Error: busy bit is not cleared\n"); | ||
| 163 | else | ||
| 164 | ret = 0; | ||
| 165 | return ret; | ||
| 166 | } | ||
| 167 | |||
| 141 | /** | 168 | /** |
| 142 | * pch_gbe_mac_mar_set - Set MAC address register | 169 | * pch_gbe_mac_mar_set - Set MAC address register |
| 143 | * @hw: Pointer to the HW structure | 170 | * @hw: Pointer to the HW structure |
| @@ -189,6 +216,17 @@ static void pch_gbe_mac_reset_hw(struct pch_gbe_hw *hw) | |||
| 189 | return; | 216 | return; |
| 190 | } | 217 | } |
| 191 | 218 | ||
| 219 | static void pch_gbe_mac_reset_rx(struct pch_gbe_hw *hw) | ||
| 220 | { | ||
| 221 | /* Read the MAC address. and store to the private data */ | ||
| 222 | pch_gbe_mac_read_mac_addr(hw); | ||
| 223 | iowrite32(PCH_GBE_RX_RST, &hw->reg->RESET); | ||
| 224 | pch_gbe_wait_clr_bit_irq(&hw->reg->RESET, PCH_GBE_RX_RST); | ||
| 225 | /* Setup the MAC address */ | ||
| 226 | pch_gbe_mac_mar_set(hw, hw->mac.addr, 0); | ||
| 227 | return; | ||
| 228 | } | ||
| 229 | |||
| 192 | /** | 230 | /** |
| 193 | * pch_gbe_mac_init_rx_addrs - Initialize receive address's | 231 | * pch_gbe_mac_init_rx_addrs - Initialize receive address's |
| 194 | * @hw: Pointer to the HW structure | 232 | * @hw: Pointer to the HW structure |
| @@ -671,13 +709,8 @@ static void pch_gbe_setup_rctl(struct pch_gbe_adapter *adapter) | |||
| 671 | 709 | ||
| 672 | tcpip = ioread32(&hw->reg->TCPIP_ACC); | 710 | tcpip = ioread32(&hw->reg->TCPIP_ACC); |
| 673 | 711 | ||
| 674 | if (netdev->features & NETIF_F_RXCSUM) { | 712 | tcpip |= PCH_GBE_RX_TCPIPACC_OFF; |
| 675 | tcpip &= ~PCH_GBE_RX_TCPIPACC_OFF; | 713 | tcpip &= ~PCH_GBE_RX_TCPIPACC_EN; |
| 676 | tcpip |= PCH_GBE_RX_TCPIPACC_EN; | ||
| 677 | } else { | ||
| 678 | tcpip |= PCH_GBE_RX_TCPIPACC_OFF; | ||
| 679 | tcpip &= ~PCH_GBE_RX_TCPIPACC_EN; | ||
| 680 | } | ||
| 681 | iowrite32(tcpip, &hw->reg->TCPIP_ACC); | 714 | iowrite32(tcpip, &hw->reg->TCPIP_ACC); |
| 682 | return; | 715 | return; |
| 683 | } | 716 | } |
| @@ -717,13 +750,6 @@ static void pch_gbe_configure_rx(struct pch_gbe_adapter *adapter) | |||
| 717 | iowrite32(rdba, &hw->reg->RX_DSC_BASE); | 750 | iowrite32(rdba, &hw->reg->RX_DSC_BASE); |
| 718 | iowrite32(rdlen, &hw->reg->RX_DSC_SIZE); | 751 | iowrite32(rdlen, &hw->reg->RX_DSC_SIZE); |
| 719 | iowrite32((rdba + rdlen), &hw->reg->RX_DSC_SW_P); | 752 | iowrite32((rdba + rdlen), &hw->reg->RX_DSC_SW_P); |
| 720 | |||
| 721 | /* Enables Receive DMA */ | ||
| 722 | rxdma = ioread32(&hw->reg->DMA_CTRL); | ||
| 723 | rxdma |= PCH_GBE_RX_DMA_EN; | ||
| 724 | iowrite32(rxdma, &hw->reg->DMA_CTRL); | ||
| 725 | /* Enables Receive */ | ||
| 726 | iowrite32(PCH_GBE_MRE_MAC_RX_EN, &hw->reg->MAC_RX_EN); | ||
| 727 | } | 753 | } |
| 728 | 754 | ||
| 729 | /** | 755 | /** |
| @@ -1097,6 +1123,48 @@ void pch_gbe_update_stats(struct pch_gbe_adapter *adapter) | |||
| 1097 | spin_unlock_irqrestore(&adapter->stats_lock, flags); | 1123 | spin_unlock_irqrestore(&adapter->stats_lock, flags); |
| 1098 | } | 1124 | } |
| 1099 | 1125 | ||
| 1126 | static void pch_gbe_stop_receive(struct pch_gbe_adapter *adapter) | ||
| 1127 | { | ||
| 1128 | struct pch_gbe_hw *hw = &adapter->hw; | ||
| 1129 | u32 rxdma; | ||
| 1130 | u16 value; | ||
| 1131 | int ret; | ||
| 1132 | |||
| 1133 | /* Disable Receive DMA */ | ||
| 1134 | rxdma = ioread32(&hw->reg->DMA_CTRL); | ||
| 1135 | rxdma &= ~PCH_GBE_RX_DMA_EN; | ||
| 1136 | iowrite32(rxdma, &hw->reg->DMA_CTRL); | ||
| 1137 | /* Wait Rx DMA BUS is IDLE */ | ||
| 1138 | ret = pch_gbe_wait_clr_bit_irq(&hw->reg->RX_DMA_ST, PCH_GBE_IDLE_CHECK); | ||
| 1139 | if (ret) { | ||
| 1140 | /* Disable Bus master */ | ||
| 1141 | pci_read_config_word(adapter->pdev, PCI_COMMAND, &value); | ||
| 1142 | value &= ~PCI_COMMAND_MASTER; | ||
| 1143 | pci_write_config_word(adapter->pdev, PCI_COMMAND, value); | ||
| 1144 | /* Stop Receive */ | ||
| 1145 | pch_gbe_mac_reset_rx(hw); | ||
| 1146 | /* Enable Bus master */ | ||
| 1147 | value |= PCI_COMMAND_MASTER; | ||
| 1148 | pci_write_config_word(adapter->pdev, PCI_COMMAND, value); | ||
| 1149 | } else { | ||
| 1150 | /* Stop Receive */ | ||
| 1151 | pch_gbe_mac_reset_rx(hw); | ||
| 1152 | } | ||
| 1153 | } | ||
| 1154 | |||
| 1155 | static void pch_gbe_start_receive(struct pch_gbe_hw *hw) | ||
| 1156 | { | ||
| 1157 | u32 rxdma; | ||
| 1158 | |||
| 1159 | /* Enables Receive DMA */ | ||
| 1160 | rxdma = ioread32(&hw->reg->DMA_CTRL); | ||
| 1161 | rxdma |= PCH_GBE_RX_DMA_EN; | ||
| 1162 | iowrite32(rxdma, &hw->reg->DMA_CTRL); | ||
| 1163 | /* Enables Receive */ | ||
| 1164 | iowrite32(PCH_GBE_MRE_MAC_RX_EN, &hw->reg->MAC_RX_EN); | ||
| 1165 | return; | ||
| 1166 | } | ||
| 1167 | |||
| 1100 | /** | 1168 | /** |
| 1101 | * pch_gbe_intr - Interrupt Handler | 1169 | * pch_gbe_intr - Interrupt Handler |
| 1102 | * @irq: Interrupt number | 1170 | * @irq: Interrupt number |
| @@ -1123,7 +1191,15 @@ static irqreturn_t pch_gbe_intr(int irq, void *data) | |||
| 1123 | if (int_st & PCH_GBE_INT_RX_FRAME_ERR) | 1191 | if (int_st & PCH_GBE_INT_RX_FRAME_ERR) |
| 1124 | adapter->stats.intr_rx_frame_err_count++; | 1192 | adapter->stats.intr_rx_frame_err_count++; |
| 1125 | if (int_st & PCH_GBE_INT_RX_FIFO_ERR) | 1193 | if (int_st & PCH_GBE_INT_RX_FIFO_ERR) |
| 1126 | adapter->stats.intr_rx_fifo_err_count++; | 1194 | if (!adapter->rx_stop_flag) { |
| 1195 | adapter->stats.intr_rx_fifo_err_count++; | ||
| 1196 | pr_debug("Rx fifo over run\n"); | ||
| 1197 | adapter->rx_stop_flag = true; | ||
| 1198 | int_en = ioread32(&hw->reg->INT_EN); | ||
| 1199 | iowrite32((int_en & ~PCH_GBE_INT_RX_FIFO_ERR), | ||
| 1200 | &hw->reg->INT_EN); | ||
| 1201 | pch_gbe_stop_receive(adapter); | ||
| 1202 | } | ||
| 1127 | if (int_st & PCH_GBE_INT_RX_DMA_ERR) | 1203 | if (int_st & PCH_GBE_INT_RX_DMA_ERR) |
| 1128 | adapter->stats.intr_rx_dma_err_count++; | 1204 | adapter->stats.intr_rx_dma_err_count++; |
| 1129 | if (int_st & PCH_GBE_INT_TX_FIFO_ERR) | 1205 | if (int_st & PCH_GBE_INT_TX_FIFO_ERR) |
| @@ -1135,7 +1211,7 @@ static irqreturn_t pch_gbe_intr(int irq, void *data) | |||
| 1135 | /* When Rx descriptor is empty */ | 1211 | /* When Rx descriptor is empty */ |
| 1136 | if ((int_st & PCH_GBE_INT_RX_DSC_EMP)) { | 1212 | if ((int_st & PCH_GBE_INT_RX_DSC_EMP)) { |
| 1137 | adapter->stats.intr_rx_dsc_empty_count++; | 1213 | adapter->stats.intr_rx_dsc_empty_count++; |
| 1138 | pr_err("Rx descriptor is empty\n"); | 1214 | pr_debug("Rx descriptor is empty\n"); |
| 1139 | int_en = ioread32(&hw->reg->INT_EN); | 1215 | int_en = ioread32(&hw->reg->INT_EN); |
| 1140 | iowrite32((int_en & ~PCH_GBE_INT_RX_DSC_EMP), &hw->reg->INT_EN); | 1216 | iowrite32((int_en & ~PCH_GBE_INT_RX_DSC_EMP), &hw->reg->INT_EN); |
| 1141 | if (hw->mac.tx_fc_enable) { | 1217 | if (hw->mac.tx_fc_enable) { |
| @@ -1185,29 +1261,23 @@ pch_gbe_alloc_rx_buffers(struct pch_gbe_adapter *adapter, | |||
| 1185 | unsigned int i; | 1261 | unsigned int i; |
| 1186 | unsigned int bufsz; | 1262 | unsigned int bufsz; |
| 1187 | 1263 | ||
| 1188 | bufsz = adapter->rx_buffer_len + PCH_GBE_DMA_ALIGN; | 1264 | bufsz = adapter->rx_buffer_len + NET_IP_ALIGN; |
| 1189 | i = rx_ring->next_to_use; | 1265 | i = rx_ring->next_to_use; |
| 1190 | 1266 | ||
| 1191 | while ((cleaned_count--)) { | 1267 | while ((cleaned_count--)) { |
| 1192 | buffer_info = &rx_ring->buffer_info[i]; | 1268 | buffer_info = &rx_ring->buffer_info[i]; |
| 1193 | skb = buffer_info->skb; | 1269 | skb = netdev_alloc_skb(netdev, bufsz); |
| 1194 | if (skb) { | 1270 | if (unlikely(!skb)) { |
| 1195 | skb_trim(skb, 0); | 1271 | /* Better luck next round */ |
| 1196 | } else { | 1272 | adapter->stats.rx_alloc_buff_failed++; |
| 1197 | skb = netdev_alloc_skb(netdev, bufsz); | 1273 | break; |
| 1198 | if (unlikely(!skb)) { | ||
| 1199 | /* Better luck next round */ | ||
| 1200 | adapter->stats.rx_alloc_buff_failed++; | ||
| 1201 | break; | ||
| 1202 | } | ||
| 1203 | /* 64byte align */ | ||
| 1204 | skb_reserve(skb, PCH_GBE_DMA_ALIGN); | ||
| 1205 | |||
| 1206 | buffer_info->skb = skb; | ||
| 1207 | buffer_info->length = adapter->rx_buffer_len; | ||
| 1208 | } | 1274 | } |
| 1275 | /* align */ | ||
| 1276 | skb_reserve(skb, NET_IP_ALIGN); | ||
| 1277 | buffer_info->skb = skb; | ||
| 1278 | |||
| 1209 | buffer_info->dma = dma_map_single(&pdev->dev, | 1279 | buffer_info->dma = dma_map_single(&pdev->dev, |
| 1210 | skb->data, | 1280 | buffer_info->rx_buffer, |
| 1211 | buffer_info->length, | 1281 | buffer_info->length, |
| 1212 | DMA_FROM_DEVICE); | 1282 | DMA_FROM_DEVICE); |
| 1213 | if (dma_mapping_error(&adapter->pdev->dev, buffer_info->dma)) { | 1283 | if (dma_mapping_error(&adapter->pdev->dev, buffer_info->dma)) { |
| @@ -1240,6 +1310,36 @@ pch_gbe_alloc_rx_buffers(struct pch_gbe_adapter *adapter, | |||
| 1240 | return; | 1310 | return; |
| 1241 | } | 1311 | } |
| 1242 | 1312 | ||
| 1313 | static int | ||
| 1314 | pch_gbe_alloc_rx_buffers_pool(struct pch_gbe_adapter *adapter, | ||
| 1315 | struct pch_gbe_rx_ring *rx_ring, int cleaned_count) | ||
| 1316 | { | ||
| 1317 | struct pci_dev *pdev = adapter->pdev; | ||
| 1318 | struct pch_gbe_buffer *buffer_info; | ||
| 1319 | unsigned int i; | ||
| 1320 | unsigned int bufsz; | ||
| 1321 | unsigned int size; | ||
| 1322 | |||
| 1323 | bufsz = adapter->rx_buffer_len; | ||
| 1324 | |||
| 1325 | size = rx_ring->count * bufsz + PCH_GBE_RESERVE_MEMORY; | ||
| 1326 | rx_ring->rx_buff_pool = dma_alloc_coherent(&pdev->dev, size, | ||
| 1327 | &rx_ring->rx_buff_pool_logic, | ||
| 1328 | GFP_KERNEL); | ||
| 1329 | if (!rx_ring->rx_buff_pool) { | ||
| 1330 | pr_err("Unable to allocate memory for the receive poll buffer\n"); | ||
| 1331 | return -ENOMEM; | ||
| 1332 | } | ||
| 1333 | memset(rx_ring->rx_buff_pool, 0, size); | ||
| 1334 | rx_ring->rx_buff_pool_size = size; | ||
| 1335 | for (i = 0; i < rx_ring->count; i++) { | ||
| 1336 | buffer_info = &rx_ring->buffer_info[i]; | ||
| 1337 | buffer_info->rx_buffer = rx_ring->rx_buff_pool + bufsz * i; | ||
| 1338 | buffer_info->length = bufsz; | ||
| 1339 | } | ||
| 1340 | return 0; | ||
| 1341 | } | ||
| 1342 | |||
| 1243 | /** | 1343 | /** |
| 1244 | * pch_gbe_alloc_tx_buffers - Allocate transmit buffers | 1344 | * pch_gbe_alloc_tx_buffers - Allocate transmit buffers |
| 1245 | * @adapter: Board private structure | 1345 | * @adapter: Board private structure |
| @@ -1380,7 +1480,7 @@ pch_gbe_clean_rx(struct pch_gbe_adapter *adapter, | |||
| 1380 | unsigned int i; | 1480 | unsigned int i; |
| 1381 | unsigned int cleaned_count = 0; | 1481 | unsigned int cleaned_count = 0; |
| 1382 | bool cleaned = false; | 1482 | bool cleaned = false; |
| 1383 | struct sk_buff *skb, *new_skb; | 1483 | struct sk_buff *skb; |
| 1384 | u8 dma_status; | 1484 | u8 dma_status; |
| 1385 | u16 gbec_status; | 1485 | u16 gbec_status; |
| 1386 | u32 tcp_ip_status; | 1486 | u32 tcp_ip_status; |
| @@ -1401,13 +1501,12 @@ pch_gbe_clean_rx(struct pch_gbe_adapter *adapter, | |||
| 1401 | rx_desc->gbec_status = DSC_INIT16; | 1501 | rx_desc->gbec_status = DSC_INIT16; |
| 1402 | buffer_info = &rx_ring->buffer_info[i]; | 1502 | buffer_info = &rx_ring->buffer_info[i]; |
| 1403 | skb = buffer_info->skb; | 1503 | skb = buffer_info->skb; |
| 1504 | buffer_info->skb = NULL; | ||
| 1404 | 1505 | ||
| 1405 | /* unmap dma */ | 1506 | /* unmap dma */ |
| 1406 | dma_unmap_single(&pdev->dev, buffer_info->dma, | 1507 | dma_unmap_single(&pdev->dev, buffer_info->dma, |
| 1407 | buffer_info->length, DMA_FROM_DEVICE); | 1508 | buffer_info->length, DMA_FROM_DEVICE); |
| 1408 | buffer_info->mapped = false; | 1509 | buffer_info->mapped = false; |
| 1409 | /* Prefetch the packet */ | ||
| 1410 | prefetch(skb->data); | ||
| 1411 | 1510 | ||
| 1412 | pr_debug("RxDecNo = 0x%04x Status[DMA:0x%02x GBE:0x%04x " | 1511 | pr_debug("RxDecNo = 0x%04x Status[DMA:0x%02x GBE:0x%04x " |
| 1413 | "TCP:0x%08x] BufInf = 0x%p\n", | 1512 | "TCP:0x%08x] BufInf = 0x%p\n", |
| @@ -1427,70 +1526,16 @@ pch_gbe_clean_rx(struct pch_gbe_adapter *adapter, | |||
| 1427 | pr_err("Receive CRC Error\n"); | 1526 | pr_err("Receive CRC Error\n"); |
| 1428 | } else { | 1527 | } else { |
| 1429 | /* get receive length */ | 1528 | /* get receive length */ |
| 1430 | /* length convert[-3] */ | 1529 | /* length convert[-3], length includes FCS length */ |
| 1431 | length = (rx_desc->rx_words_eob) - 3; | 1530 | length = (rx_desc->rx_words_eob) - 3 - ETH_FCS_LEN; |
| 1432 | 1531 | if (rx_desc->rx_words_eob & 0x02) | |
| 1433 | /* Decide the data conversion method */ | 1532 | length = length - 4; |
| 1434 | if (!(netdev->features & NETIF_F_RXCSUM)) { | 1533 | /* |
| 1435 | /* [Header:14][payload] */ | 1534 | * buffer_info->rx_buffer: [Header:14][payload] |
| 1436 | if (NET_IP_ALIGN) { | 1535 | * skb->data: [Reserve:2][Header:14][payload] |
| 1437 | /* Because alignment differs, | 1536 | */ |
| 1438 | * the new_skb is newly allocated, | 1537 | memcpy(skb->data, buffer_info->rx_buffer, length); |
| 1439 | * and data is copied to new_skb.*/ | 1538 | |
| 1440 | new_skb = netdev_alloc_skb(netdev, | ||
| 1441 | length + NET_IP_ALIGN); | ||
| 1442 | if (!new_skb) { | ||
| 1443 | /* dorrop error */ | ||
| 1444 | pr_err("New skb allocation " | ||
| 1445 | "Error\n"); | ||
| 1446 | goto dorrop; | ||
| 1447 | } | ||
| 1448 | skb_reserve(new_skb, NET_IP_ALIGN); | ||
| 1449 | memcpy(new_skb->data, skb->data, | ||
| 1450 | length); | ||
| 1451 | skb = new_skb; | ||
| 1452 | } else { | ||
| 1453 | /* DMA buffer is used as SKB as it is.*/ | ||
| 1454 | buffer_info->skb = NULL; | ||
| 1455 | } | ||
| 1456 | } else { | ||
| 1457 | /* [Header:14][padding:2][payload] */ | ||
| 1458 | /* The length includes padding length */ | ||
| 1459 | length = length - PCH_GBE_DMA_PADDING; | ||
| 1460 | if ((length < copybreak) || | ||
| 1461 | (NET_IP_ALIGN != PCH_GBE_DMA_PADDING)) { | ||
| 1462 | /* Because alignment differs, | ||
| 1463 | * the new_skb is newly allocated, | ||
| 1464 | * and data is copied to new_skb. | ||
| 1465 | * Padding data is deleted | ||
| 1466 | * at the time of a copy.*/ | ||
| 1467 | new_skb = netdev_alloc_skb(netdev, | ||
| 1468 | length + NET_IP_ALIGN); | ||
| 1469 | if (!new_skb) { | ||
| 1470 | /* dorrop error */ | ||
| 1471 | pr_err("New skb allocation " | ||
| 1472 | "Error\n"); | ||
| 1473 | goto dorrop; | ||
| 1474 | } | ||
| 1475 | skb_reserve(new_skb, NET_IP_ALIGN); | ||
| 1476 | memcpy(new_skb->data, skb->data, | ||
| 1477 | ETH_HLEN); | ||
| 1478 | memcpy(&new_skb->data[ETH_HLEN], | ||
| 1479 | &skb->data[ETH_HLEN + | ||
| 1480 | PCH_GBE_DMA_PADDING], | ||
| 1481 | length - ETH_HLEN); | ||
| 1482 | skb = new_skb; | ||
| 1483 | } else { | ||
| 1484 | /* Padding data is deleted | ||
| 1485 | * by moving header data.*/ | ||
| 1486 | memmove(&skb->data[PCH_GBE_DMA_PADDING], | ||
| 1487 | &skb->data[0], ETH_HLEN); | ||
| 1488 | skb_reserve(skb, NET_IP_ALIGN); | ||
| 1489 | buffer_info->skb = NULL; | ||
| 1490 | } | ||
| 1491 | } | ||
| 1492 | /* The length includes FCS length */ | ||
| 1493 | length = length - ETH_FCS_LEN; | ||
| 1494 | /* update status of driver */ | 1539 | /* update status of driver */ |
| 1495 | adapter->stats.rx_bytes += length; | 1540 | adapter->stats.rx_bytes += length; |
| 1496 | adapter->stats.rx_packets++; | 1541 | adapter->stats.rx_packets++; |
| @@ -1509,7 +1554,6 @@ pch_gbe_clean_rx(struct pch_gbe_adapter *adapter, | |||
| 1509 | pr_debug("Receive skb->ip_summed: %d length: %d\n", | 1554 | pr_debug("Receive skb->ip_summed: %d length: %d\n", |
| 1510 | skb->ip_summed, length); | 1555 | skb->ip_summed, length); |
| 1511 | } | 1556 | } |
| 1512 | dorrop: | ||
| 1513 | /* return some buffers to hardware, one at a time is too slow */ | 1557 | /* return some buffers to hardware, one at a time is too slow */ |
| 1514 | if (unlikely(cleaned_count >= PCH_GBE_RX_BUFFER_WRITE)) { | 1558 | if (unlikely(cleaned_count >= PCH_GBE_RX_BUFFER_WRITE)) { |
| 1515 | pch_gbe_alloc_rx_buffers(adapter, rx_ring, | 1559 | pch_gbe_alloc_rx_buffers(adapter, rx_ring, |
| @@ -1714,9 +1758,15 @@ int pch_gbe_up(struct pch_gbe_adapter *adapter) | |||
| 1714 | pr_err("Error: can't bring device up\n"); | 1758 | pr_err("Error: can't bring device up\n"); |
| 1715 | return err; | 1759 | return err; |
| 1716 | } | 1760 | } |
| 1761 | err = pch_gbe_alloc_rx_buffers_pool(adapter, rx_ring, rx_ring->count); | ||
| 1762 | if (err) { | ||
| 1763 | pr_err("Error: can't bring device up\n"); | ||
| 1764 | return err; | ||
| 1765 | } | ||
| 1717 | pch_gbe_alloc_tx_buffers(adapter, tx_ring); | 1766 | pch_gbe_alloc_tx_buffers(adapter, tx_ring); |
| 1718 | pch_gbe_alloc_rx_buffers(adapter, rx_ring, rx_ring->count); | 1767 | pch_gbe_alloc_rx_buffers(adapter, rx_ring, rx_ring->count); |
| 1719 | adapter->tx_queue_len = netdev->tx_queue_len; | 1768 | adapter->tx_queue_len = netdev->tx_queue_len; |
| 1769 | pch_gbe_start_receive(&adapter->hw); | ||
| 1720 | 1770 | ||
| 1721 | mod_timer(&adapter->watchdog_timer, jiffies); | 1771 | mod_timer(&adapter->watchdog_timer, jiffies); |
| 1722 | 1772 | ||
| @@ -1734,6 +1784,7 @@ int pch_gbe_up(struct pch_gbe_adapter *adapter) | |||
| 1734 | void pch_gbe_down(struct pch_gbe_adapter *adapter) | 1784 | void pch_gbe_down(struct pch_gbe_adapter *adapter) |
| 1735 | { | 1785 | { |
| 1736 | struct net_device *netdev = adapter->netdev; | 1786 | struct net_device *netdev = adapter->netdev; |
| 1787 | struct pch_gbe_rx_ring *rx_ring = adapter->rx_ring; | ||
| 1737 | 1788 | ||
| 1738 | /* signal that we're down so the interrupt handler does not | 1789 | /* signal that we're down so the interrupt handler does not |
| 1739 | * reschedule our watchdog timer */ | 1790 | * reschedule our watchdog timer */ |
| @@ -1752,6 +1803,12 @@ void pch_gbe_down(struct pch_gbe_adapter *adapter) | |||
| 1752 | pch_gbe_reset(adapter); | 1803 | pch_gbe_reset(adapter); |
| 1753 | pch_gbe_clean_tx_ring(adapter, adapter->tx_ring); | 1804 | pch_gbe_clean_tx_ring(adapter, adapter->tx_ring); |
| 1754 | pch_gbe_clean_rx_ring(adapter, adapter->rx_ring); | 1805 | pch_gbe_clean_rx_ring(adapter, adapter->rx_ring); |
| 1806 | |||
| 1807 | pci_free_consistent(adapter->pdev, rx_ring->rx_buff_pool_size, | ||
| 1808 | rx_ring->rx_buff_pool, rx_ring->rx_buff_pool_logic); | ||
| 1809 | rx_ring->rx_buff_pool_logic = 0; | ||
| 1810 | rx_ring->rx_buff_pool_size = 0; | ||
| 1811 | rx_ring->rx_buff_pool = NULL; | ||
| 1755 | } | 1812 | } |
| 1756 | 1813 | ||
| 1757 | /** | 1814 | /** |
| @@ -2004,6 +2061,8 @@ static int pch_gbe_change_mtu(struct net_device *netdev, int new_mtu) | |||
| 2004 | { | 2061 | { |
| 2005 | struct pch_gbe_adapter *adapter = netdev_priv(netdev); | 2062 | struct pch_gbe_adapter *adapter = netdev_priv(netdev); |
| 2006 | int max_frame; | 2063 | int max_frame; |
| 2064 | unsigned long old_rx_buffer_len = adapter->rx_buffer_len; | ||
| 2065 | int err; | ||
| 2007 | 2066 | ||
| 2008 | max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; | 2067 | max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; |
| 2009 | if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) || | 2068 | if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) || |
| @@ -2018,14 +2077,24 @@ static int pch_gbe_change_mtu(struct net_device *netdev, int new_mtu) | |||
| 2018 | else if (max_frame <= PCH_GBE_FRAME_SIZE_8192) | 2077 | else if (max_frame <= PCH_GBE_FRAME_SIZE_8192) |
| 2019 | adapter->rx_buffer_len = PCH_GBE_FRAME_SIZE_8192; | 2078 | adapter->rx_buffer_len = PCH_GBE_FRAME_SIZE_8192; |
| 2020 | else | 2079 | else |
| 2021 | adapter->rx_buffer_len = PCH_GBE_MAX_JUMBO_FRAME_SIZE; | 2080 | adapter->rx_buffer_len = PCH_GBE_MAX_RX_BUFFER_SIZE; |
| 2022 | netdev->mtu = new_mtu; | ||
| 2023 | adapter->hw.mac.max_frame_size = max_frame; | ||
| 2024 | 2081 | ||
| 2025 | if (netif_running(netdev)) | 2082 | if (netif_running(netdev)) { |
| 2026 | pch_gbe_reinit_locked(adapter); | 2083 | pch_gbe_down(adapter); |
| 2027 | else | 2084 | err = pch_gbe_up(adapter); |
| 2085 | if (err) { | ||
| 2086 | adapter->rx_buffer_len = old_rx_buffer_len; | ||
| 2087 | pch_gbe_up(adapter); | ||
| 2088 | return -ENOMEM; | ||
| 2089 | } else { | ||
| 2090 | netdev->mtu = new_mtu; | ||
| 2091 | adapter->hw.mac.max_frame_size = max_frame; | ||
| 2092 | } | ||
| 2093 | } else { | ||
| 2028 | pch_gbe_reset(adapter); | 2094 | pch_gbe_reset(adapter); |
| 2095 | netdev->mtu = new_mtu; | ||
| 2096 | adapter->hw.mac.max_frame_size = max_frame; | ||
| 2097 | } | ||
| 2029 | 2098 | ||
| 2030 | pr_debug("max_frame : %d rx_buffer_len : %d mtu : %d max_frame_size : %d\n", | 2099 | pr_debug("max_frame : %d rx_buffer_len : %d mtu : %d max_frame_size : %d\n", |
| 2031 | max_frame, (u32) adapter->rx_buffer_len, netdev->mtu, | 2100 | max_frame, (u32) adapter->rx_buffer_len, netdev->mtu, |
| @@ -2103,6 +2172,7 @@ static int pch_gbe_napi_poll(struct napi_struct *napi, int budget) | |||
| 2103 | int work_done = 0; | 2172 | int work_done = 0; |
| 2104 | bool poll_end_flag = false; | 2173 | bool poll_end_flag = false; |
| 2105 | bool cleaned = false; | 2174 | bool cleaned = false; |
| 2175 | u32 int_en; | ||
| 2106 | 2176 | ||
| 2107 | pr_debug("budget : %d\n", budget); | 2177 | pr_debug("budget : %d\n", budget); |
| 2108 | 2178 | ||
| @@ -2110,8 +2180,15 @@ static int pch_gbe_napi_poll(struct napi_struct *napi, int budget) | |||
| 2110 | if (!netif_carrier_ok(netdev)) { | 2180 | if (!netif_carrier_ok(netdev)) { |
| 2111 | poll_end_flag = true; | 2181 | poll_end_flag = true; |
| 2112 | } else { | 2182 | } else { |
| 2113 | cleaned = pch_gbe_clean_tx(adapter, adapter->tx_ring); | ||
| 2114 | pch_gbe_clean_rx(adapter, adapter->rx_ring, &work_done, budget); | 2183 | pch_gbe_clean_rx(adapter, adapter->rx_ring, &work_done, budget); |
| 2184 | if (adapter->rx_stop_flag) { | ||
| 2185 | adapter->rx_stop_flag = false; | ||
| 2186 | pch_gbe_start_receive(&adapter->hw); | ||
| 2187 | int_en = ioread32(&adapter->hw.reg->INT_EN); | ||
| 2188 | iowrite32((int_en | PCH_GBE_INT_RX_FIFO_ERR), | ||
| 2189 | &adapter->hw.reg->INT_EN); | ||
| 2190 | } | ||
| 2191 | cleaned = pch_gbe_clean_tx(adapter, adapter->tx_ring); | ||
| 2115 | 2192 | ||
| 2116 | if (cleaned) | 2193 | if (cleaned) |
| 2117 | work_done = budget; | 2194 | work_done = budget; |
| @@ -2452,6 +2529,13 @@ static DEFINE_PCI_DEVICE_TABLE(pch_gbe_pcidev_id) = { | |||
| 2452 | .class = (PCI_CLASS_NETWORK_ETHERNET << 8), | 2529 | .class = (PCI_CLASS_NETWORK_ETHERNET << 8), |
| 2453 | .class_mask = (0xFFFF00) | 2530 | .class_mask = (0xFFFF00) |
| 2454 | }, | 2531 | }, |
| 2532 | {.vendor = PCI_VENDOR_ID_ROHM, | ||
| 2533 | .device = PCI_DEVICE_ID_ROHM_ML7831_GBE, | ||
| 2534 | .subvendor = PCI_ANY_ID, | ||
| 2535 | .subdevice = PCI_ANY_ID, | ||
| 2536 | .class = (PCI_CLASS_NETWORK_ETHERNET << 8), | ||
| 2537 | .class_mask = (0xFFFF00) | ||
| 2538 | }, | ||
| 2455 | /* required last entry */ | 2539 | /* required last entry */ |
| 2456 | {0} | 2540 | {0} |
| 2457 | }; | 2541 | }; |
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c index faca764aa21b..b59abc706d93 100644 --- a/drivers/net/sfc/efx.c +++ b/drivers/net/sfc/efx.c | |||
| @@ -1050,7 +1050,6 @@ static int efx_init_io(struct efx_nic *efx) | |||
| 1050 | { | 1050 | { |
| 1051 | struct pci_dev *pci_dev = efx->pci_dev; | 1051 | struct pci_dev *pci_dev = efx->pci_dev; |
| 1052 | dma_addr_t dma_mask = efx->type->max_dma_mask; | 1052 | dma_addr_t dma_mask = efx->type->max_dma_mask; |
| 1053 | bool use_wc; | ||
| 1054 | int rc; | 1053 | int rc; |
| 1055 | 1054 | ||
| 1056 | netif_dbg(efx, probe, efx->net_dev, "initialising I/O\n"); | 1055 | netif_dbg(efx, probe, efx->net_dev, "initialising I/O\n"); |
| @@ -1101,21 +1100,8 @@ static int efx_init_io(struct efx_nic *efx) | |||
| 1101 | rc = -EIO; | 1100 | rc = -EIO; |
| 1102 | goto fail3; | 1101 | goto fail3; |
| 1103 | } | 1102 | } |
| 1104 | 1103 | efx->membase = ioremap_nocache(efx->membase_phys, | |
| 1105 | /* bug22643: If SR-IOV is enabled then tx push over a write combined | 1104 | efx->type->mem_map_size); |
| 1106 | * mapping is unsafe. We need to disable write combining in this case. | ||
| 1107 | * MSI is unsupported when SR-IOV is enabled, and the firmware will | ||
| 1108 | * have removed the MSI capability. So write combining is safe if | ||
| 1109 | * there is an MSI capability. | ||
| 1110 | */ | ||
| 1111 | use_wc = (!EFX_WORKAROUND_22643(efx) || | ||
| 1112 | pci_find_capability(pci_dev, PCI_CAP_ID_MSI)); | ||
| 1113 | if (use_wc) | ||
| 1114 | efx->membase = ioremap_wc(efx->membase_phys, | ||
| 1115 | efx->type->mem_map_size); | ||
| 1116 | else | ||
| 1117 | efx->membase = ioremap_nocache(efx->membase_phys, | ||
| 1118 | efx->type->mem_map_size); | ||
| 1119 | if (!efx->membase) { | 1105 | if (!efx->membase) { |
| 1120 | netif_err(efx, probe, efx->net_dev, | 1106 | netif_err(efx, probe, efx->net_dev, |
| 1121 | "could not map memory BAR at %llx+%x\n", | 1107 | "could not map memory BAR at %llx+%x\n", |
diff --git a/drivers/net/sfc/io.h b/drivers/net/sfc/io.h index cc978803d484..751d1ec112cc 100644 --- a/drivers/net/sfc/io.h +++ b/drivers/net/sfc/io.h | |||
| @@ -103,7 +103,6 @@ static inline void efx_writeo(struct efx_nic *efx, efx_oword_t *value, | |||
| 103 | _efx_writed(efx, value->u32[2], reg + 8); | 103 | _efx_writed(efx, value->u32[2], reg + 8); |
| 104 | _efx_writed(efx, value->u32[3], reg + 12); | 104 | _efx_writed(efx, value->u32[3], reg + 12); |
| 105 | #endif | 105 | #endif |
| 106 | wmb(); | ||
| 107 | mmiowb(); | 106 | mmiowb(); |
| 108 | spin_unlock_irqrestore(&efx->biu_lock, flags); | 107 | spin_unlock_irqrestore(&efx->biu_lock, flags); |
| 109 | } | 108 | } |
| @@ -126,7 +125,6 @@ static inline void efx_sram_writeq(struct efx_nic *efx, void __iomem *membase, | |||
| 126 | __raw_writel((__force u32)value->u32[0], membase + addr); | 125 | __raw_writel((__force u32)value->u32[0], membase + addr); |
| 127 | __raw_writel((__force u32)value->u32[1], membase + addr + 4); | 126 | __raw_writel((__force u32)value->u32[1], membase + addr + 4); |
| 128 | #endif | 127 | #endif |
| 129 | wmb(); | ||
| 130 | mmiowb(); | 128 | mmiowb(); |
| 131 | spin_unlock_irqrestore(&efx->biu_lock, flags); | 129 | spin_unlock_irqrestore(&efx->biu_lock, flags); |
| 132 | } | 130 | } |
| @@ -141,7 +139,6 @@ static inline void efx_writed(struct efx_nic *efx, efx_dword_t *value, | |||
| 141 | 139 | ||
| 142 | /* No lock required */ | 140 | /* No lock required */ |
| 143 | _efx_writed(efx, value->u32[0], reg); | 141 | _efx_writed(efx, value->u32[0], reg); |
| 144 | wmb(); | ||
| 145 | } | 142 | } |
| 146 | 143 | ||
| 147 | /* Read a 128-bit CSR, locking as appropriate. */ | 144 | /* Read a 128-bit CSR, locking as appropriate. */ |
| @@ -152,7 +149,6 @@ static inline void efx_reado(struct efx_nic *efx, efx_oword_t *value, | |||
| 152 | 149 | ||
| 153 | spin_lock_irqsave(&efx->biu_lock, flags); | 150 | spin_lock_irqsave(&efx->biu_lock, flags); |
| 154 | value->u32[0] = _efx_readd(efx, reg + 0); | 151 | value->u32[0] = _efx_readd(efx, reg + 0); |
| 155 | rmb(); | ||
| 156 | value->u32[1] = _efx_readd(efx, reg + 4); | 152 | value->u32[1] = _efx_readd(efx, reg + 4); |
| 157 | value->u32[2] = _efx_readd(efx, reg + 8); | 153 | value->u32[2] = _efx_readd(efx, reg + 8); |
| 158 | value->u32[3] = _efx_readd(efx, reg + 12); | 154 | value->u32[3] = _efx_readd(efx, reg + 12); |
| @@ -175,7 +171,6 @@ static inline void efx_sram_readq(struct efx_nic *efx, void __iomem *membase, | |||
| 175 | value->u64[0] = (__force __le64)__raw_readq(membase + addr); | 171 | value->u64[0] = (__force __le64)__raw_readq(membase + addr); |
| 176 | #else | 172 | #else |
| 177 | value->u32[0] = (__force __le32)__raw_readl(membase + addr); | 173 | value->u32[0] = (__force __le32)__raw_readl(membase + addr); |
| 178 | rmb(); | ||
| 179 | value->u32[1] = (__force __le32)__raw_readl(membase + addr + 4); | 174 | value->u32[1] = (__force __le32)__raw_readl(membase + addr + 4); |
| 180 | #endif | 175 | #endif |
| 181 | spin_unlock_irqrestore(&efx->biu_lock, flags); | 176 | spin_unlock_irqrestore(&efx->biu_lock, flags); |
| @@ -249,7 +244,6 @@ static inline void _efx_writeo_page(struct efx_nic *efx, efx_oword_t *value, | |||
| 249 | _efx_writed(efx, value->u32[2], reg + 8); | 244 | _efx_writed(efx, value->u32[2], reg + 8); |
| 250 | _efx_writed(efx, value->u32[3], reg + 12); | 245 | _efx_writed(efx, value->u32[3], reg + 12); |
| 251 | #endif | 246 | #endif |
| 252 | wmb(); | ||
| 253 | } | 247 | } |
| 254 | #define efx_writeo_page(efx, value, reg, page) \ | 248 | #define efx_writeo_page(efx, value, reg, page) \ |
| 255 | _efx_writeo_page(efx, value, \ | 249 | _efx_writeo_page(efx, value, \ |
diff --git a/drivers/net/sfc/mcdi.c b/drivers/net/sfc/mcdi.c index 3dd45ed61f0a..81a425397468 100644 --- a/drivers/net/sfc/mcdi.c +++ b/drivers/net/sfc/mcdi.c | |||
| @@ -50,20 +50,6 @@ static inline struct efx_mcdi_iface *efx_mcdi(struct efx_nic *efx) | |||
| 50 | return &nic_data->mcdi; | 50 | return &nic_data->mcdi; |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | static inline void | ||
| 54 | efx_mcdi_readd(struct efx_nic *efx, efx_dword_t *value, unsigned reg) | ||
| 55 | { | ||
| 56 | struct siena_nic_data *nic_data = efx->nic_data; | ||
| 57 | value->u32[0] = (__force __le32)__raw_readl(nic_data->mcdi_smem + reg); | ||
| 58 | } | ||
| 59 | |||
| 60 | static inline void | ||
| 61 | efx_mcdi_writed(struct efx_nic *efx, const efx_dword_t *value, unsigned reg) | ||
| 62 | { | ||
| 63 | struct siena_nic_data *nic_data = efx->nic_data; | ||
| 64 | __raw_writel((__force u32)value->u32[0], nic_data->mcdi_smem + reg); | ||
| 65 | } | ||
| 66 | |||
| 67 | void efx_mcdi_init(struct efx_nic *efx) | 53 | void efx_mcdi_init(struct efx_nic *efx) |
| 68 | { | 54 | { |
| 69 | struct efx_mcdi_iface *mcdi; | 55 | struct efx_mcdi_iface *mcdi; |
| @@ -84,8 +70,8 @@ static void efx_mcdi_copyin(struct efx_nic *efx, unsigned cmd, | |||
| 84 | const u8 *inbuf, size_t inlen) | 70 | const u8 *inbuf, size_t inlen) |
| 85 | { | 71 | { |
| 86 | struct efx_mcdi_iface *mcdi = efx_mcdi(efx); | 72 | struct efx_mcdi_iface *mcdi = efx_mcdi(efx); |
| 87 | unsigned pdu = MCDI_PDU(efx); | 73 | unsigned pdu = FR_CZ_MC_TREG_SMEM + MCDI_PDU(efx); |
| 88 | unsigned doorbell = MCDI_DOORBELL(efx); | 74 | unsigned doorbell = FR_CZ_MC_TREG_SMEM + MCDI_DOORBELL(efx); |
| 89 | unsigned int i; | 75 | unsigned int i; |
| 90 | efx_dword_t hdr; | 76 | efx_dword_t hdr; |
| 91 | u32 xflags, seqno; | 77 | u32 xflags, seqno; |
| @@ -106,28 +92,29 @@ static void efx_mcdi_copyin(struct efx_nic *efx, unsigned cmd, | |||
| 106 | MCDI_HEADER_SEQ, seqno, | 92 | MCDI_HEADER_SEQ, seqno, |
| 107 | MCDI_HEADER_XFLAGS, xflags); | 93 | MCDI_HEADER_XFLAGS, xflags); |
| 108 | 94 | ||
| 109 | efx_mcdi_writed(efx, &hdr, pdu); | 95 | efx_writed(efx, &hdr, pdu); |
| 110 | 96 | ||
| 111 | for (i = 0; i < inlen; i += 4) | 97 | for (i = 0; i < inlen; i += 4) |
| 112 | efx_mcdi_writed(efx, (const efx_dword_t *)(inbuf + i), | 98 | _efx_writed(efx, *((__le32 *)(inbuf + i)), pdu + 4 + i); |
| 113 | pdu + 4 + i); | 99 | |
| 100 | /* Ensure the payload is written out before the header */ | ||
| 101 | wmb(); | ||
| 114 | 102 | ||
| 115 | /* ring the doorbell with a distinctive value */ | 103 | /* ring the doorbell with a distinctive value */ |
| 116 | EFX_POPULATE_DWORD_1(hdr, EFX_DWORD_0, 0x45789abc); | 104 | _efx_writed(efx, (__force __le32) 0x45789abc, doorbell); |
| 117 | efx_mcdi_writed(efx, &hdr, doorbell); | ||
| 118 | } | 105 | } |
| 119 | 106 | ||
| 120 | static void efx_mcdi_copyout(struct efx_nic *efx, u8 *outbuf, size_t outlen) | 107 | static void efx_mcdi_copyout(struct efx_nic *efx, u8 *outbuf, size_t outlen) |
| 121 | { | 108 | { |
| 122 | struct efx_mcdi_iface *mcdi = efx_mcdi(efx); | 109 | struct efx_mcdi_iface *mcdi = efx_mcdi(efx); |
| 123 | unsigned int pdu = MCDI_PDU(efx); | 110 | unsigned int pdu = FR_CZ_MC_TREG_SMEM + MCDI_PDU(efx); |
| 124 | int i; | 111 | int i; |
| 125 | 112 | ||
| 126 | BUG_ON(atomic_read(&mcdi->state) == MCDI_STATE_QUIESCENT); | 113 | BUG_ON(atomic_read(&mcdi->state) == MCDI_STATE_QUIESCENT); |
| 127 | BUG_ON(outlen & 3 || outlen >= 0x100); | 114 | BUG_ON(outlen & 3 || outlen >= 0x100); |
| 128 | 115 | ||
| 129 | for (i = 0; i < outlen; i += 4) | 116 | for (i = 0; i < outlen; i += 4) |
| 130 | efx_mcdi_readd(efx, (efx_dword_t *)(outbuf + i), pdu + 4 + i); | 117 | *((__le32 *)(outbuf + i)) = _efx_readd(efx, pdu + 4 + i); |
| 131 | } | 118 | } |
| 132 | 119 | ||
| 133 | static int efx_mcdi_poll(struct efx_nic *efx) | 120 | static int efx_mcdi_poll(struct efx_nic *efx) |
| @@ -135,7 +122,7 @@ static int efx_mcdi_poll(struct efx_nic *efx) | |||
| 135 | struct efx_mcdi_iface *mcdi = efx_mcdi(efx); | 122 | struct efx_mcdi_iface *mcdi = efx_mcdi(efx); |
| 136 | unsigned int time, finish; | 123 | unsigned int time, finish; |
| 137 | unsigned int respseq, respcmd, error; | 124 | unsigned int respseq, respcmd, error; |
| 138 | unsigned int pdu = MCDI_PDU(efx); | 125 | unsigned int pdu = FR_CZ_MC_TREG_SMEM + MCDI_PDU(efx); |
| 139 | unsigned int rc, spins; | 126 | unsigned int rc, spins; |
| 140 | efx_dword_t reg; | 127 | efx_dword_t reg; |
| 141 | 128 | ||
| @@ -161,7 +148,8 @@ static int efx_mcdi_poll(struct efx_nic *efx) | |||
| 161 | 148 | ||
| 162 | time = get_seconds(); | 149 | time = get_seconds(); |
| 163 | 150 | ||
| 164 | efx_mcdi_readd(efx, ®, pdu); | 151 | rmb(); |
| 152 | efx_readd(efx, ®, pdu); | ||
| 165 | 153 | ||
| 166 | /* All 1's indicates that shared memory is in reset (and is | 154 | /* All 1's indicates that shared memory is in reset (and is |
| 167 | * not a valid header). Wait for it to come out reset before | 155 | * not a valid header). Wait for it to come out reset before |
| @@ -188,7 +176,7 @@ static int efx_mcdi_poll(struct efx_nic *efx) | |||
| 188 | respseq, mcdi->seqno); | 176 | respseq, mcdi->seqno); |
| 189 | rc = EIO; | 177 | rc = EIO; |
| 190 | } else if (error) { | 178 | } else if (error) { |
| 191 | efx_mcdi_readd(efx, ®, pdu + 4); | 179 | efx_readd(efx, ®, pdu + 4); |
| 192 | switch (EFX_DWORD_FIELD(reg, EFX_DWORD_0)) { | 180 | switch (EFX_DWORD_FIELD(reg, EFX_DWORD_0)) { |
| 193 | #define TRANSLATE_ERROR(name) \ | 181 | #define TRANSLATE_ERROR(name) \ |
| 194 | case MC_CMD_ERR_ ## name: \ | 182 | case MC_CMD_ERR_ ## name: \ |
| @@ -222,21 +210,21 @@ out: | |||
| 222 | /* Test and clear MC-rebooted flag for this port/function */ | 210 | /* Test and clear MC-rebooted flag for this port/function */ |
| 223 | int efx_mcdi_poll_reboot(struct efx_nic *efx) | 211 | int efx_mcdi_poll_reboot(struct efx_nic *efx) |
| 224 | { | 212 | { |
| 225 | unsigned int addr = MCDI_REBOOT_FLAG(efx); | 213 | unsigned int addr = FR_CZ_MC_TREG_SMEM + MCDI_REBOOT_FLAG(efx); |
| 226 | efx_dword_t reg; | 214 | efx_dword_t reg; |
| 227 | uint32_t value; | 215 | uint32_t value; |
| 228 | 216 | ||
| 229 | if (efx_nic_rev(efx) < EFX_REV_SIENA_A0) | 217 | if (efx_nic_rev(efx) < EFX_REV_SIENA_A0) |
| 230 | return false; | 218 | return false; |
| 231 | 219 | ||
| 232 | efx_mcdi_readd(efx, ®, addr); | 220 | efx_readd(efx, ®, addr); |
| 233 | value = EFX_DWORD_FIELD(reg, EFX_DWORD_0); | 221 | value = EFX_DWORD_FIELD(reg, EFX_DWORD_0); |
| 234 | 222 | ||
| 235 | if (value == 0) | 223 | if (value == 0) |
| 236 | return 0; | 224 | return 0; |
| 237 | 225 | ||
| 238 | EFX_ZERO_DWORD(reg); | 226 | EFX_ZERO_DWORD(reg); |
| 239 | efx_mcdi_writed(efx, ®, addr); | 227 | efx_writed(efx, ®, addr); |
| 240 | 228 | ||
| 241 | if (value == MC_STATUS_DWORD_ASSERT) | 229 | if (value == MC_STATUS_DWORD_ASSERT) |
| 242 | return -EINTR; | 230 | return -EINTR; |
diff --git a/drivers/net/sfc/nic.c b/drivers/net/sfc/nic.c index bafa23a6874c..3edfbaf5f022 100644 --- a/drivers/net/sfc/nic.c +++ b/drivers/net/sfc/nic.c | |||
| @@ -1936,13 +1936,6 @@ void efx_nic_get_regs(struct efx_nic *efx, void *buf) | |||
| 1936 | 1936 | ||
| 1937 | size = min_t(size_t, table->step, 16); | 1937 | size = min_t(size_t, table->step, 16); |
| 1938 | 1938 | ||
| 1939 | if (table->offset >= efx->type->mem_map_size) { | ||
| 1940 | /* No longer mapped; return dummy data */ | ||
| 1941 | memcpy(buf, "\xde\xc0\xad\xde", 4); | ||
| 1942 | buf += table->rows * size; | ||
| 1943 | continue; | ||
| 1944 | } | ||
| 1945 | |||
| 1946 | for (i = 0; i < table->rows; i++) { | 1939 | for (i = 0; i < table->rows; i++) { |
| 1947 | switch (table->step) { | 1940 | switch (table->step) { |
| 1948 | case 4: /* 32-bit register or SRAM */ | 1941 | case 4: /* 32-bit register or SRAM */ |
diff --git a/drivers/net/sfc/nic.h b/drivers/net/sfc/nic.h index 4bd1f2839dfe..7443f99c977f 100644 --- a/drivers/net/sfc/nic.h +++ b/drivers/net/sfc/nic.h | |||
| @@ -143,12 +143,10 @@ static inline struct falcon_board *falcon_board(struct efx_nic *efx) | |||
| 143 | /** | 143 | /** |
| 144 | * struct siena_nic_data - Siena NIC state | 144 | * struct siena_nic_data - Siena NIC state |
| 145 | * @mcdi: Management-Controller-to-Driver Interface | 145 | * @mcdi: Management-Controller-to-Driver Interface |
| 146 | * @mcdi_smem: MCDI shared memory mapping. The mapping is always uncacheable. | ||
| 147 | * @wol_filter_id: Wake-on-LAN packet filter id | 146 | * @wol_filter_id: Wake-on-LAN packet filter id |
| 148 | */ | 147 | */ |
| 149 | struct siena_nic_data { | 148 | struct siena_nic_data { |
| 150 | struct efx_mcdi_iface mcdi; | 149 | struct efx_mcdi_iface mcdi; |
| 151 | void __iomem *mcdi_smem; | ||
| 152 | int wol_filter_id; | 150 | int wol_filter_id; |
| 153 | }; | 151 | }; |
| 154 | 152 | ||
diff --git a/drivers/net/sfc/siena.c b/drivers/net/sfc/siena.c index 5735e84c69de..2c3bd93fab54 100644 --- a/drivers/net/sfc/siena.c +++ b/drivers/net/sfc/siena.c | |||
| @@ -250,26 +250,12 @@ static int siena_probe_nic(struct efx_nic *efx) | |||
| 250 | efx_reado(efx, ®, FR_AZ_CS_DEBUG); | 250 | efx_reado(efx, ®, FR_AZ_CS_DEBUG); |
| 251 | efx->net_dev->dev_id = EFX_OWORD_FIELD(reg, FRF_CZ_CS_PORT_NUM) - 1; | 251 | efx->net_dev->dev_id = EFX_OWORD_FIELD(reg, FRF_CZ_CS_PORT_NUM) - 1; |
| 252 | 252 | ||
| 253 | /* Initialise MCDI */ | ||
| 254 | nic_data->mcdi_smem = ioremap_nocache(efx->membase_phys + | ||
| 255 | FR_CZ_MC_TREG_SMEM, | ||
| 256 | FR_CZ_MC_TREG_SMEM_STEP * | ||
| 257 | FR_CZ_MC_TREG_SMEM_ROWS); | ||
| 258 | if (!nic_data->mcdi_smem) { | ||
| 259 | netif_err(efx, probe, efx->net_dev, | ||
| 260 | "could not map MCDI at %llx+%x\n", | ||
| 261 | (unsigned long long)efx->membase_phys + | ||
| 262 | FR_CZ_MC_TREG_SMEM, | ||
| 263 | FR_CZ_MC_TREG_SMEM_STEP * FR_CZ_MC_TREG_SMEM_ROWS); | ||
| 264 | rc = -ENOMEM; | ||
| 265 | goto fail1; | ||
| 266 | } | ||
| 267 | efx_mcdi_init(efx); | 253 | efx_mcdi_init(efx); |
| 268 | 254 | ||
| 269 | /* Recover from a failed assertion before probing */ | 255 | /* Recover from a failed assertion before probing */ |
| 270 | rc = efx_mcdi_handle_assertion(efx); | 256 | rc = efx_mcdi_handle_assertion(efx); |
| 271 | if (rc) | 257 | if (rc) |
| 272 | goto fail2; | 258 | goto fail1; |
| 273 | 259 | ||
| 274 | /* Let the BMC know that the driver is now in charge of link and | 260 | /* Let the BMC know that the driver is now in charge of link and |
| 275 | * filter settings. We must do this before we reset the NIC */ | 261 | * filter settings. We must do this before we reset the NIC */ |
| @@ -324,7 +310,6 @@ fail4: | |||
| 324 | fail3: | 310 | fail3: |
| 325 | efx_mcdi_drv_attach(efx, false, NULL); | 311 | efx_mcdi_drv_attach(efx, false, NULL); |
| 326 | fail2: | 312 | fail2: |
| 327 | iounmap(nic_data->mcdi_smem); | ||
| 328 | fail1: | 313 | fail1: |
| 329 | kfree(efx->nic_data); | 314 | kfree(efx->nic_data); |
| 330 | return rc; | 315 | return rc; |
| @@ -404,8 +389,6 @@ static int siena_init_nic(struct efx_nic *efx) | |||
| 404 | 389 | ||
| 405 | static void siena_remove_nic(struct efx_nic *efx) | 390 | static void siena_remove_nic(struct efx_nic *efx) |
| 406 | { | 391 | { |
| 407 | struct siena_nic_data *nic_data = efx->nic_data; | ||
| 408 | |||
| 409 | efx_nic_free_buffer(efx, &efx->irq_status); | 392 | efx_nic_free_buffer(efx, &efx->irq_status); |
| 410 | 393 | ||
| 411 | siena_reset_hw(efx, RESET_TYPE_ALL); | 394 | siena_reset_hw(efx, RESET_TYPE_ALL); |
| @@ -415,8 +398,7 @@ static void siena_remove_nic(struct efx_nic *efx) | |||
| 415 | efx_mcdi_drv_attach(efx, false, NULL); | 398 | efx_mcdi_drv_attach(efx, false, NULL); |
| 416 | 399 | ||
| 417 | /* Tear down the private nic state */ | 400 | /* Tear down the private nic state */ |
| 418 | iounmap(nic_data->mcdi_smem); | 401 | kfree(efx->nic_data); |
| 419 | kfree(nic_data); | ||
| 420 | efx->nic_data = NULL; | 402 | efx->nic_data = NULL; |
| 421 | } | 403 | } |
| 422 | 404 | ||
| @@ -656,7 +638,8 @@ const struct efx_nic_type siena_a0_nic_type = { | |||
| 656 | .default_mac_ops = &efx_mcdi_mac_operations, | 638 | .default_mac_ops = &efx_mcdi_mac_operations, |
| 657 | 639 | ||
| 658 | .revision = EFX_REV_SIENA_A0, | 640 | .revision = EFX_REV_SIENA_A0, |
| 659 | .mem_map_size = FR_CZ_MC_TREG_SMEM, /* MC_TREG_SMEM mapped separately */ | 641 | .mem_map_size = (FR_CZ_MC_TREG_SMEM + |
| 642 | FR_CZ_MC_TREG_SMEM_STEP * FR_CZ_MC_TREG_SMEM_ROWS), | ||
| 660 | .txd_ptr_tbl_base = FR_BZ_TX_DESC_PTR_TBL, | 643 | .txd_ptr_tbl_base = FR_BZ_TX_DESC_PTR_TBL, |
| 661 | .rxd_ptr_tbl_base = FR_BZ_RX_DESC_PTR_TBL, | 644 | .rxd_ptr_tbl_base = FR_BZ_RX_DESC_PTR_TBL, |
| 662 | .buf_tbl_base = FR_BZ_BUF_FULL_TBL, | 645 | .buf_tbl_base = FR_BZ_BUF_FULL_TBL, |
diff --git a/drivers/net/sfc/workarounds.h b/drivers/net/sfc/workarounds.h index 99ff11400cef..e4dd3a7f304b 100644 --- a/drivers/net/sfc/workarounds.h +++ b/drivers/net/sfc/workarounds.h | |||
| @@ -38,8 +38,6 @@ | |||
| 38 | #define EFX_WORKAROUND_15783 EFX_WORKAROUND_ALWAYS | 38 | #define EFX_WORKAROUND_15783 EFX_WORKAROUND_ALWAYS |
| 39 | /* Legacy interrupt storm when interrupt fifo fills */ | 39 | /* Legacy interrupt storm when interrupt fifo fills */ |
| 40 | #define EFX_WORKAROUND_17213 EFX_WORKAROUND_SIENA | 40 | #define EFX_WORKAROUND_17213 EFX_WORKAROUND_SIENA |
| 41 | /* Write combining and sriov=enabled are incompatible */ | ||
| 42 | #define EFX_WORKAROUND_22643 EFX_WORKAROUND_SIENA | ||
| 43 | 41 | ||
| 44 | /* Spurious parity errors in TSORT buffers */ | 42 | /* Spurious parity errors in TSORT buffers */ |
| 45 | #define EFX_WORKAROUND_5129 EFX_WORKAROUND_FALCON_A | 43 | #define EFX_WORKAROUND_5129 EFX_WORKAROUND_FALCON_A |
diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c index 15772b1b6a91..13c1f044b40d 100644 --- a/drivers/net/usb/ipheth.c +++ b/drivers/net/usb/ipheth.c | |||
| @@ -59,6 +59,7 @@ | |||
| 59 | #define USB_PRODUCT_IPHONE_3G 0x1292 | 59 | #define USB_PRODUCT_IPHONE_3G 0x1292 |
| 60 | #define USB_PRODUCT_IPHONE_3GS 0x1294 | 60 | #define USB_PRODUCT_IPHONE_3GS 0x1294 |
| 61 | #define USB_PRODUCT_IPHONE_4 0x1297 | 61 | #define USB_PRODUCT_IPHONE_4 0x1297 |
| 62 | #define USB_PRODUCT_IPHONE_4_VZW 0x129c | ||
| 62 | 63 | ||
| 63 | #define IPHETH_USBINTF_CLASS 255 | 64 | #define IPHETH_USBINTF_CLASS 255 |
| 64 | #define IPHETH_USBINTF_SUBCLASS 253 | 65 | #define IPHETH_USBINTF_SUBCLASS 253 |
| @@ -98,6 +99,10 @@ static struct usb_device_id ipheth_table[] = { | |||
| 98 | USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4, | 99 | USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4, |
| 99 | IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, | 100 | IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, |
| 100 | IPHETH_USBINTF_PROTO) }, | 101 | IPHETH_USBINTF_PROTO) }, |
| 102 | { USB_DEVICE_AND_INTERFACE_INFO( | ||
| 103 | USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4_VZW, | ||
| 104 | IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, | ||
| 105 | IPHETH_USBINTF_PROTO) }, | ||
| 101 | { } | 106 | { } |
| 102 | }; | 107 | }; |
| 103 | MODULE_DEVICE_TABLE(usb, ipheth_table); | 108 | MODULE_DEVICE_TABLE(usb, ipheth_table); |
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_calib.c b/drivers/net/wireless/ath/ath9k/ar9002_calib.c index 2d4c0910295b..2d394af82171 100644 --- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c +++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c | |||
| @@ -41,7 +41,8 @@ static bool ar9002_hw_is_cal_supported(struct ath_hw *ah, | |||
| 41 | case ADC_DC_CAL: | 41 | case ADC_DC_CAL: |
| 42 | /* Run ADC Gain Cal for non-CCK & non 2GHz-HT20 only */ | 42 | /* Run ADC Gain Cal for non-CCK & non 2GHz-HT20 only */ |
| 43 | if (!IS_CHAN_B(chan) && | 43 | if (!IS_CHAN_B(chan) && |
| 44 | !(IS_CHAN_2GHZ(chan) && IS_CHAN_HT20(chan))) | 44 | !((IS_CHAN_2GHZ(chan) || IS_CHAN_A_FAST_CLOCK(ah, chan)) && |
| 45 | IS_CHAN_HT20(chan))) | ||
| 45 | supported = true; | 46 | supported = true; |
| 46 | break; | 47 | break; |
| 47 | } | 48 | } |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index 1baca8e4715d..fcafec0605f4 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | |||
| @@ -671,7 +671,7 @@ static int ar9003_hw_process_ini(struct ath_hw *ah, | |||
| 671 | REG_WRITE_ARRAY(&ah->iniModesAdditional, | 671 | REG_WRITE_ARRAY(&ah->iniModesAdditional, |
| 672 | modesIndex, regWrites); | 672 | modesIndex, regWrites); |
| 673 | 673 | ||
| 674 | if (AR_SREV_9300(ah)) | 674 | if (AR_SREV_9330(ah)) |
| 675 | REG_WRITE_ARRAY(&ah->iniModesAdditional, 1, regWrites); | 675 | REG_WRITE_ARRAY(&ah->iniModesAdditional, 1, regWrites); |
| 676 | 676 | ||
| 677 | if (AR_SREV_9340(ah) && !ah->is_clk_25mhz) | 677 | if (AR_SREV_9340(ah) && !ah->is_clk_25mhz) |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 6530694a59ae..722967b86cf1 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
| @@ -2303,6 +2303,12 @@ static void ath9k_flush(struct ieee80211_hw *hw, bool drop) | |||
| 2303 | mutex_lock(&sc->mutex); | 2303 | mutex_lock(&sc->mutex); |
| 2304 | cancel_delayed_work_sync(&sc->tx_complete_work); | 2304 | cancel_delayed_work_sync(&sc->tx_complete_work); |
| 2305 | 2305 | ||
| 2306 | if (ah->ah_flags & AH_UNPLUGGED) { | ||
| 2307 | ath_dbg(common, ATH_DBG_ANY, "Device has been unplugged!\n"); | ||
| 2308 | mutex_unlock(&sc->mutex); | ||
| 2309 | return; | ||
| 2310 | } | ||
| 2311 | |||
| 2306 | if (sc->sc_flags & SC_OP_INVALID) { | 2312 | if (sc->sc_flags & SC_OP_INVALID) { |
| 2307 | ath_dbg(common, ATH_DBG_ANY, "Device not present\n"); | 2313 | ath_dbg(common, ATH_DBG_ANY, "Device not present\n"); |
| 2308 | mutex_unlock(&sc->mutex); | 2314 | mutex_unlock(&sc->mutex); |
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-rs.c b/drivers/net/wireless/iwlegacy/iwl-3945-rs.c index 977bd2477c6a..164bcae821f8 100644 --- a/drivers/net/wireless/iwlegacy/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlegacy/iwl-3945-rs.c | |||
| @@ -822,12 +822,15 @@ static void iwl3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
| 822 | 822 | ||
| 823 | out: | 823 | out: |
| 824 | 824 | ||
| 825 | rs_sta->last_txrate_idx = index; | 825 | if (sband->band == IEEE80211_BAND_5GHZ) { |
| 826 | if (sband->band == IEEE80211_BAND_5GHZ) | 826 | if (WARN_ON_ONCE(index < IWL_FIRST_OFDM_RATE)) |
| 827 | info->control.rates[0].idx = rs_sta->last_txrate_idx - | 827 | index = IWL_FIRST_OFDM_RATE; |
| 828 | IWL_FIRST_OFDM_RATE; | 828 | rs_sta->last_txrate_idx = index; |
| 829 | else | 829 | info->control.rates[0].idx = index - IWL_FIRST_OFDM_RATE; |
| 830 | } else { | ||
| 831 | rs_sta->last_txrate_idx = index; | ||
| 830 | info->control.rates[0].idx = rs_sta->last_txrate_idx; | 832 | info->control.rates[0].idx = rs_sta->last_txrate_idx; |
| 833 | } | ||
| 831 | 834 | ||
| 832 | IWL_DEBUG_RATE(priv, "leave: %d\n", index); | 835 | IWL_DEBUG_RATE(priv, "leave: %d\n", index); |
| 833 | } | 836 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c index a895a099d086..56211006a182 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c | |||
| @@ -167,7 +167,7 @@ static int iwlagn_set_temperature_offset_calib(struct iwl_priv *priv) | |||
| 167 | 167 | ||
| 168 | memset(&cmd, 0, sizeof(cmd)); | 168 | memset(&cmd, 0, sizeof(cmd)); |
| 169 | iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD); | 169 | iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD); |
| 170 | memcpy(&cmd.radio_sensor_offset, offset_calib, sizeof(offset_calib)); | 170 | memcpy(&cmd.radio_sensor_offset, offset_calib, sizeof(*offset_calib)); |
| 171 | if (!(cmd.radio_sensor_offset)) | 171 | if (!(cmd.radio_sensor_offset)) |
| 172 | cmd.radio_sensor_offset = DEFAULT_RADIO_SENSOR_OFFSET; | 172 | cmd.radio_sensor_offset = DEFAULT_RADIO_SENSOR_OFFSET; |
| 173 | 173 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c index a6b2b1db0b1d..222d410c586e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c | |||
| @@ -771,6 +771,8 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) | |||
| 771 | cmd = txq->cmd[cmd_index]; | 771 | cmd = txq->cmd[cmd_index]; |
| 772 | meta = &txq->meta[cmd_index]; | 772 | meta = &txq->meta[cmd_index]; |
| 773 | 773 | ||
| 774 | txq->time_stamp = jiffies; | ||
| 775 | |||
| 774 | iwlagn_unmap_tfd(priv, meta, &txq->tfds[index], DMA_BIDIRECTIONAL); | 776 | iwlagn_unmap_tfd(priv, meta, &txq->tfds[index], DMA_BIDIRECTIONAL); |
| 775 | 777 | ||
| 776 | /* Input error checking is done when commands are added to queue. */ | 778 | /* Input error checking is done when commands are added to queue. */ |
diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c index 1bdc1aa305c0..04c4e9eb6ee6 100644 --- a/drivers/net/wireless/rtlwifi/core.c +++ b/drivers/net/wireless/rtlwifi/core.c | |||
| @@ -610,6 +610,11 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw, | |||
| 610 | 610 | ||
| 611 | mac->link_state = MAC80211_NOLINK; | 611 | mac->link_state = MAC80211_NOLINK; |
| 612 | memset(mac->bssid, 0, 6); | 612 | memset(mac->bssid, 0, 6); |
| 613 | |||
| 614 | /* reset sec info */ | ||
| 615 | rtl_cam_reset_sec_info(hw); | ||
| 616 | |||
| 617 | rtl_cam_reset_all_entry(hw); | ||
| 613 | mac->vendor = PEER_UNKNOWN; | 618 | mac->vendor = PEER_UNKNOWN; |
| 614 | 619 | ||
| 615 | RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG, | 620 | RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG, |
| @@ -1063,6 +1068,9 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
| 1063 | *or clear all entry here. | 1068 | *or clear all entry here. |
| 1064 | */ | 1069 | */ |
| 1065 | rtl_cam_delete_one_entry(hw, mac_addr, key_idx); | 1070 | rtl_cam_delete_one_entry(hw, mac_addr, key_idx); |
| 1071 | |||
| 1072 | rtl_cam_reset_sec_info(hw); | ||
| 1073 | |||
| 1066 | break; | 1074 | break; |
| 1067 | default: | 1075 | default: |
| 1068 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | 1076 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c index 906e7aa55bc3..3e52a5496224 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c | |||
| @@ -549,15 +549,16 @@ void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw, | |||
| 549 | (tcb_desc->rts_use_shortpreamble ? 1 : 0) | 549 | (tcb_desc->rts_use_shortpreamble ? 1 : 0) |
| 550 | : (tcb_desc->rts_use_shortgi ? 1 : 0))); | 550 | : (tcb_desc->rts_use_shortgi ? 1 : 0))); |
| 551 | if (mac->bw_40) { | 551 | if (mac->bw_40) { |
| 552 | if (tcb_desc->packet_bw) { | 552 | if (rate_flag & IEEE80211_TX_RC_DUP_DATA) { |
| 553 | SET_TX_DESC_DATA_BW(txdesc, 1); | 553 | SET_TX_DESC_DATA_BW(txdesc, 1); |
| 554 | SET_TX_DESC_DATA_SC(txdesc, 3); | 554 | SET_TX_DESC_DATA_SC(txdesc, 3); |
| 555 | } else if(rate_flag & IEEE80211_TX_RC_40_MHZ_WIDTH){ | ||
| 556 | SET_TX_DESC_DATA_BW(txdesc, 1); | ||
| 557 | SET_TX_DESC_DATA_SC(txdesc, mac->cur_40_prime_sc); | ||
| 555 | } else { | 558 | } else { |
| 556 | SET_TX_DESC_DATA_BW(txdesc, 0); | 559 | SET_TX_DESC_DATA_BW(txdesc, 0); |
| 557 | if (rate_flag & IEEE80211_TX_RC_DUP_DATA) | 560 | SET_TX_DESC_DATA_SC(txdesc, 0); |
| 558 | SET_TX_DESC_DATA_SC(txdesc, | 561 | } |
| 559 | mac->cur_40_prime_sc); | ||
| 560 | } | ||
| 561 | } else { | 562 | } else { |
| 562 | SET_TX_DESC_DATA_BW(txdesc, 0); | 563 | SET_TX_DESC_DATA_BW(txdesc, 0); |
| 563 | SET_TX_DESC_DATA_SC(txdesc, 0); | 564 | SET_TX_DESC_DATA_SC(txdesc, 0); |
diff --git a/drivers/rtc/rtc-imxdi.c b/drivers/rtc/rtc-imxdi.c index 2dd3c0163272..d93a9608b1f0 100644 --- a/drivers/rtc/rtc-imxdi.c +++ b/drivers/rtc/rtc-imxdi.c | |||
| @@ -35,6 +35,7 @@ | |||
| 35 | #include <linux/module.h> | 35 | #include <linux/module.h> |
| 36 | #include <linux/platform_device.h> | 36 | #include <linux/platform_device.h> |
| 37 | #include <linux/rtc.h> | 37 | #include <linux/rtc.h> |
| 38 | #include <linux/sched.h> | ||
| 38 | #include <linux/workqueue.h> | 39 | #include <linux/workqueue.h> |
| 39 | 40 | ||
| 40 | /* DryIce Register Definitions */ | 41 | /* DryIce Register Definitions */ |
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 4e7c04e773e0..7639ab906f02 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
| @@ -51,6 +51,27 @@ static enum s3c_cpu_type s3c_rtc_cpu_type; | |||
| 51 | 51 | ||
| 52 | static DEFINE_SPINLOCK(s3c_rtc_pie_lock); | 52 | static DEFINE_SPINLOCK(s3c_rtc_pie_lock); |
| 53 | 53 | ||
| 54 | static void s3c_rtc_alarm_clk_enable(bool enable) | ||
| 55 | { | ||
| 56 | static DEFINE_SPINLOCK(s3c_rtc_alarm_clk_lock); | ||
| 57 | static bool alarm_clk_enabled; | ||
| 58 | unsigned long irq_flags; | ||
| 59 | |||
| 60 | spin_lock_irqsave(&s3c_rtc_alarm_clk_lock, irq_flags); | ||
| 61 | if (enable) { | ||
| 62 | if (!alarm_clk_enabled) { | ||
| 63 | clk_enable(rtc_clk); | ||
| 64 | alarm_clk_enabled = true; | ||
| 65 | } | ||
| 66 | } else { | ||
| 67 | if (alarm_clk_enabled) { | ||
| 68 | clk_disable(rtc_clk); | ||
| 69 | alarm_clk_enabled = false; | ||
| 70 | } | ||
| 71 | } | ||
| 72 | spin_unlock_irqrestore(&s3c_rtc_alarm_clk_lock, irq_flags); | ||
| 73 | } | ||
| 74 | |||
| 54 | /* IRQ Handlers */ | 75 | /* IRQ Handlers */ |
| 55 | 76 | ||
| 56 | static irqreturn_t s3c_rtc_alarmirq(int irq, void *id) | 77 | static irqreturn_t s3c_rtc_alarmirq(int irq, void *id) |
| @@ -64,6 +85,9 @@ static irqreturn_t s3c_rtc_alarmirq(int irq, void *id) | |||
| 64 | writeb(S3C2410_INTP_ALM, s3c_rtc_base + S3C2410_INTP); | 85 | writeb(S3C2410_INTP_ALM, s3c_rtc_base + S3C2410_INTP); |
| 65 | 86 | ||
| 66 | clk_disable(rtc_clk); | 87 | clk_disable(rtc_clk); |
| 88 | |||
| 89 | s3c_rtc_alarm_clk_enable(false); | ||
| 90 | |||
| 67 | return IRQ_HANDLED; | 91 | return IRQ_HANDLED; |
| 68 | } | 92 | } |
| 69 | 93 | ||
| @@ -97,6 +121,8 @@ static int s3c_rtc_setaie(struct device *dev, unsigned int enabled) | |||
| 97 | writeb(tmp, s3c_rtc_base + S3C2410_RTCALM); | 121 | writeb(tmp, s3c_rtc_base + S3C2410_RTCALM); |
| 98 | clk_disable(rtc_clk); | 122 | clk_disable(rtc_clk); |
| 99 | 123 | ||
| 124 | s3c_rtc_alarm_clk_enable(enabled); | ||
| 125 | |||
| 100 | return 0; | 126 | return 0; |
| 101 | } | 127 | } |
| 102 | 128 | ||
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c index 9ae80cd5953b..dba72a4e6a1c 100644 --- a/drivers/scsi/bnx2i/bnx2i_hwi.c +++ b/drivers/scsi/bnx2i/bnx2i_hwi.c | |||
| @@ -563,7 +563,7 @@ int bnx2i_send_iscsi_nopout(struct bnx2i_conn *bnx2i_conn, | |||
| 563 | nopout_wqe->itt = ((u16)task->itt | | 563 | nopout_wqe->itt = ((u16)task->itt | |
| 564 | (ISCSI_TASK_TYPE_MPATH << | 564 | (ISCSI_TASK_TYPE_MPATH << |
| 565 | ISCSI_TMF_REQUEST_TYPE_SHIFT)); | 565 | ISCSI_TMF_REQUEST_TYPE_SHIFT)); |
| 566 | nopout_wqe->ttt = nopout_hdr->ttt; | 566 | nopout_wqe->ttt = be32_to_cpu(nopout_hdr->ttt); |
| 567 | nopout_wqe->flags = 0; | 567 | nopout_wqe->flags = 0; |
| 568 | if (!unsol) | 568 | if (!unsol) |
| 569 | nopout_wqe->flags = ISCSI_NOP_OUT_REQUEST_LOCAL_COMPLETION; | 569 | nopout_wqe->flags = ISCSI_NOP_OUT_REQUEST_LOCAL_COMPLETION; |
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index ba710e350ac5..5d0e9a24ae94 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c | |||
| @@ -432,6 +432,8 @@ void fcoe_interface_cleanup(struct fcoe_interface *fcoe) | |||
| 432 | u8 flogi_maddr[ETH_ALEN]; | 432 | u8 flogi_maddr[ETH_ALEN]; |
| 433 | const struct net_device_ops *ops; | 433 | const struct net_device_ops *ops; |
| 434 | 434 | ||
| 435 | rtnl_lock(); | ||
| 436 | |||
| 435 | /* | 437 | /* |
| 436 | * Don't listen for Ethernet packets anymore. | 438 | * Don't listen for Ethernet packets anymore. |
| 437 | * synchronize_net() ensures that the packet handlers are not running | 439 | * synchronize_net() ensures that the packet handlers are not running |
| @@ -461,6 +463,8 @@ void fcoe_interface_cleanup(struct fcoe_interface *fcoe) | |||
| 461 | " specific feature for LLD.\n"); | 463 | " specific feature for LLD.\n"); |
| 462 | } | 464 | } |
| 463 | 465 | ||
| 466 | rtnl_unlock(); | ||
| 467 | |||
| 464 | /* Release the self-reference taken during fcoe_interface_create() */ | 468 | /* Release the self-reference taken during fcoe_interface_create() */ |
| 465 | fcoe_interface_put(fcoe); | 469 | fcoe_interface_put(fcoe); |
| 466 | } | 470 | } |
| @@ -1951,11 +1955,8 @@ static void fcoe_destroy_work(struct work_struct *work) | |||
| 1951 | fcoe_if_destroy(port->lport); | 1955 | fcoe_if_destroy(port->lport); |
| 1952 | 1956 | ||
| 1953 | /* Do not tear down the fcoe interface for NPIV port */ | 1957 | /* Do not tear down the fcoe interface for NPIV port */ |
| 1954 | if (!npiv) { | 1958 | if (!npiv) |
| 1955 | rtnl_lock(); | ||
| 1956 | fcoe_interface_cleanup(fcoe); | 1959 | fcoe_interface_cleanup(fcoe); |
| 1957 | rtnl_unlock(); | ||
| 1958 | } | ||
| 1959 | 1960 | ||
| 1960 | mutex_unlock(&fcoe_config_mutex); | 1961 | mutex_unlock(&fcoe_config_mutex); |
| 1961 | } | 1962 | } |
| @@ -2009,8 +2010,9 @@ static int fcoe_create(struct net_device *netdev, enum fip_state fip_mode) | |||
| 2009 | printk(KERN_ERR "fcoe: Failed to create interface (%s)\n", | 2010 | printk(KERN_ERR "fcoe: Failed to create interface (%s)\n", |
| 2010 | netdev->name); | 2011 | netdev->name); |
| 2011 | rc = -EIO; | 2012 | rc = -EIO; |
| 2013 | rtnl_unlock(); | ||
| 2012 | fcoe_interface_cleanup(fcoe); | 2014 | fcoe_interface_cleanup(fcoe); |
| 2013 | goto out_nodev; | 2015 | goto out_nortnl; |
| 2014 | } | 2016 | } |
| 2015 | 2017 | ||
| 2016 | /* Make this the "master" N_Port */ | 2018 | /* Make this the "master" N_Port */ |
| @@ -2027,6 +2029,7 @@ static int fcoe_create(struct net_device *netdev, enum fip_state fip_mode) | |||
| 2027 | 2029 | ||
| 2028 | out_nodev: | 2030 | out_nodev: |
| 2029 | rtnl_unlock(); | 2031 | rtnl_unlock(); |
| 2032 | out_nortnl: | ||
| 2030 | mutex_unlock(&fcoe_config_mutex); | 2033 | mutex_unlock(&fcoe_config_mutex); |
| 2031 | return rc; | 2034 | return rc; |
| 2032 | } | 2035 | } |
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index ec61bdb833ac..b200b736b000 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
| @@ -676,6 +676,16 @@ static void hpsa_scsi_replace_entry(struct ctlr_info *h, int hostno, | |||
| 676 | BUG_ON(entry < 0 || entry >= HPSA_MAX_SCSI_DEVS_PER_HBA); | 676 | BUG_ON(entry < 0 || entry >= HPSA_MAX_SCSI_DEVS_PER_HBA); |
| 677 | removed[*nremoved] = h->dev[entry]; | 677 | removed[*nremoved] = h->dev[entry]; |
| 678 | (*nremoved)++; | 678 | (*nremoved)++; |
| 679 | |||
| 680 | /* | ||
| 681 | * New physical devices won't have target/lun assigned yet | ||
| 682 | * so we need to preserve the values in the slot we are replacing. | ||
| 683 | */ | ||
| 684 | if (new_entry->target == -1) { | ||
| 685 | new_entry->target = h->dev[entry]->target; | ||
| 686 | new_entry->lun = h->dev[entry]->lun; | ||
| 687 | } | ||
| 688 | |||
| 679 | h->dev[entry] = new_entry; | 689 | h->dev[entry] = new_entry; |
| 680 | added[*nadded] = new_entry; | 690 | added[*nadded] = new_entry; |
| 681 | (*nadded)++; | 691 | (*nadded)++; |
| @@ -1548,10 +1558,17 @@ static inline void hpsa_set_bus_target_lun(struct hpsa_scsi_dev_t *device, | |||
| 1548 | } | 1558 | } |
| 1549 | 1559 | ||
| 1550 | static int hpsa_update_device_info(struct ctlr_info *h, | 1560 | static int hpsa_update_device_info(struct ctlr_info *h, |
| 1551 | unsigned char scsi3addr[], struct hpsa_scsi_dev_t *this_device) | 1561 | unsigned char scsi3addr[], struct hpsa_scsi_dev_t *this_device, |
| 1562 | unsigned char *is_OBDR_device) | ||
| 1552 | { | 1563 | { |
| 1553 | #define OBDR_TAPE_INQ_SIZE 49 | 1564 | |
| 1565 | #define OBDR_SIG_OFFSET 43 | ||
| 1566 | #define OBDR_TAPE_SIG "$DR-10" | ||
| 1567 | #define OBDR_SIG_LEN (sizeof(OBDR_TAPE_SIG) - 1) | ||
| 1568 | #define OBDR_TAPE_INQ_SIZE (OBDR_SIG_OFFSET + OBDR_SIG_LEN) | ||
| 1569 | |||
| 1554 | unsigned char *inq_buff; | 1570 | unsigned char *inq_buff; |
| 1571 | unsigned char *obdr_sig; | ||
| 1555 | 1572 | ||
| 1556 | inq_buff = kzalloc(OBDR_TAPE_INQ_SIZE, GFP_KERNEL); | 1573 | inq_buff = kzalloc(OBDR_TAPE_INQ_SIZE, GFP_KERNEL); |
| 1557 | if (!inq_buff) | 1574 | if (!inq_buff) |
| @@ -1583,6 +1600,16 @@ static int hpsa_update_device_info(struct ctlr_info *h, | |||
| 1583 | else | 1600 | else |
| 1584 | this_device->raid_level = RAID_UNKNOWN; | 1601 | this_device->raid_level = RAID_UNKNOWN; |
| 1585 | 1602 | ||
| 1603 | if (is_OBDR_device) { | ||
| 1604 | /* See if this is a One-Button-Disaster-Recovery device | ||
| 1605 | * by looking for "$DR-10" at offset 43 in inquiry data. | ||
| 1606 | */ | ||
| 1607 | obdr_sig = &inq_buff[OBDR_SIG_OFFSET]; | ||
| 1608 | *is_OBDR_device = (this_device->devtype == TYPE_ROM && | ||
| 1609 | strncmp(obdr_sig, OBDR_TAPE_SIG, | ||
| 1610 | OBDR_SIG_LEN) == 0); | ||
| 1611 | } | ||
| 1612 | |||
| 1586 | kfree(inq_buff); | 1613 | kfree(inq_buff); |
| 1587 | return 0; | 1614 | return 0; |
| 1588 | 1615 | ||
| @@ -1716,7 +1743,7 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h, | |||
| 1716 | return 0; | 1743 | return 0; |
| 1717 | } | 1744 | } |
| 1718 | 1745 | ||
| 1719 | if (hpsa_update_device_info(h, scsi3addr, this_device)) | 1746 | if (hpsa_update_device_info(h, scsi3addr, this_device, NULL)) |
| 1720 | return 0; | 1747 | return 0; |
| 1721 | (*nmsa2xxx_enclosures)++; | 1748 | (*nmsa2xxx_enclosures)++; |
| 1722 | hpsa_set_bus_target_lun(this_device, bus, target, 0); | 1749 | hpsa_set_bus_target_lun(this_device, bus, target, 0); |
| @@ -1808,7 +1835,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) | |||
| 1808 | */ | 1835 | */ |
| 1809 | struct ReportLUNdata *physdev_list = NULL; | 1836 | struct ReportLUNdata *physdev_list = NULL; |
| 1810 | struct ReportLUNdata *logdev_list = NULL; | 1837 | struct ReportLUNdata *logdev_list = NULL; |
| 1811 | unsigned char *inq_buff = NULL; | ||
| 1812 | u32 nphysicals = 0; | 1838 | u32 nphysicals = 0; |
| 1813 | u32 nlogicals = 0; | 1839 | u32 nlogicals = 0; |
| 1814 | u32 ndev_allocated = 0; | 1840 | u32 ndev_allocated = 0; |
| @@ -1824,11 +1850,9 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) | |||
| 1824 | GFP_KERNEL); | 1850 | GFP_KERNEL); |
| 1825 | physdev_list = kzalloc(reportlunsize, GFP_KERNEL); | 1851 | physdev_list = kzalloc(reportlunsize, GFP_KERNEL); |
| 1826 | logdev_list = kzalloc(reportlunsize, GFP_KERNEL); | 1852 | logdev_list = kzalloc(reportlunsize, GFP_KERNEL); |
| 1827 | inq_buff = kmalloc(OBDR_TAPE_INQ_SIZE, GFP_KERNEL); | ||
| 1828 | tmpdevice = kzalloc(sizeof(*tmpdevice), GFP_KERNEL); | 1853 | tmpdevice = kzalloc(sizeof(*tmpdevice), GFP_KERNEL); |
| 1829 | 1854 | ||
| 1830 | if (!currentsd || !physdev_list || !logdev_list || | 1855 | if (!currentsd || !physdev_list || !logdev_list || !tmpdevice) { |
| 1831 | !inq_buff || !tmpdevice) { | ||
| 1832 | dev_err(&h->pdev->dev, "out of memory\n"); | 1856 | dev_err(&h->pdev->dev, "out of memory\n"); |
| 1833 | goto out; | 1857 | goto out; |
| 1834 | } | 1858 | } |
| @@ -1863,7 +1887,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) | |||
| 1863 | /* adjust our table of devices */ | 1887 | /* adjust our table of devices */ |
| 1864 | nmsa2xxx_enclosures = 0; | 1888 | nmsa2xxx_enclosures = 0; |
| 1865 | for (i = 0; i < nphysicals + nlogicals + 1; i++) { | 1889 | for (i = 0; i < nphysicals + nlogicals + 1; i++) { |
| 1866 | u8 *lunaddrbytes; | 1890 | u8 *lunaddrbytes, is_OBDR = 0; |
| 1867 | 1891 | ||
| 1868 | /* Figure out where the LUN ID info is coming from */ | 1892 | /* Figure out where the LUN ID info is coming from */ |
| 1869 | lunaddrbytes = figure_lunaddrbytes(h, raid_ctlr_position, | 1893 | lunaddrbytes = figure_lunaddrbytes(h, raid_ctlr_position, |
| @@ -1874,7 +1898,8 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) | |||
| 1874 | continue; | 1898 | continue; |
| 1875 | 1899 | ||
| 1876 | /* Get device type, vendor, model, device id */ | 1900 | /* Get device type, vendor, model, device id */ |
| 1877 | if (hpsa_update_device_info(h, lunaddrbytes, tmpdevice)) | 1901 | if (hpsa_update_device_info(h, lunaddrbytes, tmpdevice, |
| 1902 | &is_OBDR)) | ||
| 1878 | continue; /* skip it if we can't talk to it. */ | 1903 | continue; /* skip it if we can't talk to it. */ |
| 1879 | figure_bus_target_lun(h, lunaddrbytes, &bus, &target, &lun, | 1904 | figure_bus_target_lun(h, lunaddrbytes, &bus, &target, &lun, |
| 1880 | tmpdevice); | 1905 | tmpdevice); |
| @@ -1898,7 +1923,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) | |||
| 1898 | hpsa_set_bus_target_lun(this_device, bus, target, lun); | 1923 | hpsa_set_bus_target_lun(this_device, bus, target, lun); |
| 1899 | 1924 | ||
| 1900 | switch (this_device->devtype) { | 1925 | switch (this_device->devtype) { |
| 1901 | case TYPE_ROM: { | 1926 | case TYPE_ROM: |
| 1902 | /* We don't *really* support actual CD-ROM devices, | 1927 | /* We don't *really* support actual CD-ROM devices, |
| 1903 | * just "One Button Disaster Recovery" tape drive | 1928 | * just "One Button Disaster Recovery" tape drive |
| 1904 | * which temporarily pretends to be a CD-ROM drive. | 1929 | * which temporarily pretends to be a CD-ROM drive. |
| @@ -1906,15 +1931,8 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) | |||
| 1906 | * device by checking for "$DR-10" in bytes 43-48 of | 1931 | * device by checking for "$DR-10" in bytes 43-48 of |
| 1907 | * the inquiry data. | 1932 | * the inquiry data. |
| 1908 | */ | 1933 | */ |
| 1909 | char obdr_sig[7]; | 1934 | if (is_OBDR) |
| 1910 | #define OBDR_TAPE_SIG "$DR-10" | 1935 | ncurrent++; |
| 1911 | strncpy(obdr_sig, &inq_buff[43], 6); | ||
| 1912 | obdr_sig[6] = '\0'; | ||
| 1913 | if (strncmp(obdr_sig, OBDR_TAPE_SIG, 6) != 0) | ||
| 1914 | /* Not OBDR device, ignore it. */ | ||
| 1915 | break; | ||
| 1916 | } | ||
| 1917 | ncurrent++; | ||
| 1918 | break; | 1936 | break; |
| 1919 | case TYPE_DISK: | 1937 | case TYPE_DISK: |
| 1920 | if (i < nphysicals) | 1938 | if (i < nphysicals) |
| @@ -1947,7 +1965,6 @@ out: | |||
| 1947 | for (i = 0; i < ndev_allocated; i++) | 1965 | for (i = 0; i < ndev_allocated; i++) |
| 1948 | kfree(currentsd[i]); | 1966 | kfree(currentsd[i]); |
| 1949 | kfree(currentsd); | 1967 | kfree(currentsd); |
| 1950 | kfree(inq_buff); | ||
| 1951 | kfree(physdev_list); | 1968 | kfree(physdev_list); |
| 1952 | kfree(logdev_list); | 1969 | kfree(logdev_list); |
| 1953 | } | 1970 | } |
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c index 26072f1e9852..6981b773a88d 100644 --- a/drivers/scsi/isci/host.c +++ b/drivers/scsi/isci/host.c | |||
| @@ -531,6 +531,9 @@ static void sci_controller_process_completions(struct isci_host *ihost) | |||
| 531 | break; | 531 | break; |
| 532 | 532 | ||
| 533 | case SCU_COMPLETION_TYPE_EVENT: | 533 | case SCU_COMPLETION_TYPE_EVENT: |
| 534 | sci_controller_event_completion(ihost, ent); | ||
| 535 | break; | ||
| 536 | |||
| 534 | case SCU_COMPLETION_TYPE_NOTIFY: { | 537 | case SCU_COMPLETION_TYPE_NOTIFY: { |
| 535 | event_cycle ^= ((event_get+1) & SCU_MAX_EVENTS) << | 538 | event_cycle ^= ((event_get+1) & SCU_MAX_EVENTS) << |
| 536 | (SMU_COMPLETION_QUEUE_GET_EVENT_CYCLE_BIT_SHIFT - SCU_MAX_EVENTS_SHIFT); | 539 | (SMU_COMPLETION_QUEUE_GET_EVENT_CYCLE_BIT_SHIFT - SCU_MAX_EVENTS_SHIFT); |
| @@ -1091,6 +1094,7 @@ static void isci_host_completion_routine(unsigned long data) | |||
| 1091 | struct isci_request *request; | 1094 | struct isci_request *request; |
| 1092 | struct isci_request *next_request; | 1095 | struct isci_request *next_request; |
| 1093 | struct sas_task *task; | 1096 | struct sas_task *task; |
| 1097 | u16 active; | ||
| 1094 | 1098 | ||
| 1095 | INIT_LIST_HEAD(&completed_request_list); | 1099 | INIT_LIST_HEAD(&completed_request_list); |
| 1096 | INIT_LIST_HEAD(&errored_request_list); | 1100 | INIT_LIST_HEAD(&errored_request_list); |
| @@ -1181,6 +1185,13 @@ static void isci_host_completion_routine(unsigned long data) | |||
| 1181 | } | 1185 | } |
| 1182 | } | 1186 | } |
| 1183 | 1187 | ||
| 1188 | /* the coalesence timeout doubles at each encoding step, so | ||
| 1189 | * update it based on the ilog2 value of the outstanding requests | ||
| 1190 | */ | ||
| 1191 | active = isci_tci_active(ihost); | ||
| 1192 | writel(SMU_ICC_GEN_VAL(NUMBER, active) | | ||
| 1193 | SMU_ICC_GEN_VAL(TIMER, ISCI_COALESCE_BASE + ilog2(active)), | ||
| 1194 | &ihost->smu_registers->interrupt_coalesce_control); | ||
| 1184 | } | 1195 | } |
| 1185 | 1196 | ||
| 1186 | /** | 1197 | /** |
| @@ -1471,7 +1482,7 @@ static void sci_controller_ready_state_enter(struct sci_base_state_machine *sm) | |||
| 1471 | struct isci_host *ihost = container_of(sm, typeof(*ihost), sm); | 1482 | struct isci_host *ihost = container_of(sm, typeof(*ihost), sm); |
| 1472 | 1483 | ||
| 1473 | /* set the default interrupt coalescence number and timeout value. */ | 1484 | /* set the default interrupt coalescence number and timeout value. */ |
| 1474 | sci_controller_set_interrupt_coalescence(ihost, 0x10, 250); | 1485 | sci_controller_set_interrupt_coalescence(ihost, 0, 0); |
| 1475 | } | 1486 | } |
| 1476 | 1487 | ||
| 1477 | static void sci_controller_ready_state_exit(struct sci_base_state_machine *sm) | 1488 | static void sci_controller_ready_state_exit(struct sci_base_state_machine *sm) |
diff --git a/drivers/scsi/isci/host.h b/drivers/scsi/isci/host.h index 062101a39f79..9f33831a2f04 100644 --- a/drivers/scsi/isci/host.h +++ b/drivers/scsi/isci/host.h | |||
| @@ -369,6 +369,9 @@ static inline struct isci_host *dev_to_ihost(struct domain_device *dev) | |||
| 369 | #define ISCI_TAG_SEQ(tag) (((tag) >> 12) & (SCI_MAX_SEQ-1)) | 369 | #define ISCI_TAG_SEQ(tag) (((tag) >> 12) & (SCI_MAX_SEQ-1)) |
| 370 | #define ISCI_TAG_TCI(tag) ((tag) & (SCI_MAX_IO_REQUESTS-1)) | 370 | #define ISCI_TAG_TCI(tag) ((tag) & (SCI_MAX_IO_REQUESTS-1)) |
| 371 | 371 | ||
| 372 | /* interrupt coalescing baseline: 9 == 3 to 5us interrupt delay per command */ | ||
| 373 | #define ISCI_COALESCE_BASE 9 | ||
| 374 | |||
| 372 | /* expander attached sata devices require 3 rnc slots */ | 375 | /* expander attached sata devices require 3 rnc slots */ |
| 373 | static inline int sci_remote_device_node_count(struct isci_remote_device *idev) | 376 | static inline int sci_remote_device_node_count(struct isci_remote_device *idev) |
| 374 | { | 377 | { |
diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c index 61e0d09e2b57..29aa34efb0f5 100644 --- a/drivers/scsi/isci/init.c +++ b/drivers/scsi/isci/init.c | |||
| @@ -59,10 +59,19 @@ | |||
| 59 | #include <linux/firmware.h> | 59 | #include <linux/firmware.h> |
| 60 | #include <linux/efi.h> | 60 | #include <linux/efi.h> |
| 61 | #include <asm/string.h> | 61 | #include <asm/string.h> |
| 62 | #include <scsi/scsi_host.h> | ||
| 62 | #include "isci.h" | 63 | #include "isci.h" |
| 63 | #include "task.h" | 64 | #include "task.h" |
| 64 | #include "probe_roms.h" | 65 | #include "probe_roms.h" |
| 65 | 66 | ||
| 67 | #define MAJ 1 | ||
| 68 | #define MIN 0 | ||
| 69 | #define BUILD 0 | ||
| 70 | #define DRV_VERSION __stringify(MAJ) "." __stringify(MIN) "." \ | ||
| 71 | __stringify(BUILD) | ||
| 72 | |||
| 73 | MODULE_VERSION(DRV_VERSION); | ||
| 74 | |||
| 66 | static struct scsi_transport_template *isci_transport_template; | 75 | static struct scsi_transport_template *isci_transport_template; |
| 67 | 76 | ||
| 68 | static DEFINE_PCI_DEVICE_TABLE(isci_id_table) = { | 77 | static DEFINE_PCI_DEVICE_TABLE(isci_id_table) = { |
| @@ -113,6 +122,22 @@ unsigned char max_concurr_spinup = 1; | |||
| 113 | module_param(max_concurr_spinup, byte, 0); | 122 | module_param(max_concurr_spinup, byte, 0); |
| 114 | MODULE_PARM_DESC(max_concurr_spinup, "Max concurrent device spinup"); | 123 | MODULE_PARM_DESC(max_concurr_spinup, "Max concurrent device spinup"); |
| 115 | 124 | ||
| 125 | static ssize_t isci_show_id(struct device *dev, struct device_attribute *attr, char *buf) | ||
| 126 | { | ||
| 127 | struct Scsi_Host *shost = container_of(dev, typeof(*shost), shost_dev); | ||
| 128 | struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost); | ||
| 129 | struct isci_host *ihost = container_of(sas_ha, typeof(*ihost), sas_ha); | ||
| 130 | |||
| 131 | return snprintf(buf, PAGE_SIZE, "%d\n", ihost->id); | ||
| 132 | } | ||
| 133 | |||
| 134 | static DEVICE_ATTR(isci_id, S_IRUGO, isci_show_id, NULL); | ||
| 135 | |||
| 136 | struct device_attribute *isci_host_attrs[] = { | ||
| 137 | &dev_attr_isci_id, | ||
| 138 | NULL | ||
| 139 | }; | ||
| 140 | |||
| 116 | static struct scsi_host_template isci_sht = { | 141 | static struct scsi_host_template isci_sht = { |
| 117 | 142 | ||
| 118 | .module = THIS_MODULE, | 143 | .module = THIS_MODULE, |
| @@ -138,6 +163,7 @@ static struct scsi_host_template isci_sht = { | |||
| 138 | .slave_alloc = sas_slave_alloc, | 163 | .slave_alloc = sas_slave_alloc, |
| 139 | .target_destroy = sas_target_destroy, | 164 | .target_destroy = sas_target_destroy, |
| 140 | .ioctl = sas_ioctl, | 165 | .ioctl = sas_ioctl, |
| 166 | .shost_attrs = isci_host_attrs, | ||
| 141 | }; | 167 | }; |
| 142 | 168 | ||
| 143 | static struct sas_domain_function_template isci_transport_ops = { | 169 | static struct sas_domain_function_template isci_transport_ops = { |
| @@ -232,17 +258,6 @@ static int isci_register_sas_ha(struct isci_host *isci_host) | |||
| 232 | return 0; | 258 | return 0; |
| 233 | } | 259 | } |
| 234 | 260 | ||
| 235 | static ssize_t isci_show_id(struct device *dev, struct device_attribute *attr, char *buf) | ||
| 236 | { | ||
| 237 | struct Scsi_Host *shost = container_of(dev, typeof(*shost), shost_dev); | ||
| 238 | struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost); | ||
| 239 | struct isci_host *ihost = container_of(sas_ha, typeof(*ihost), sas_ha); | ||
| 240 | |||
| 241 | return snprintf(buf, PAGE_SIZE, "%d\n", ihost->id); | ||
| 242 | } | ||
| 243 | |||
| 244 | static DEVICE_ATTR(isci_id, S_IRUGO, isci_show_id, NULL); | ||
| 245 | |||
| 246 | static void isci_unregister(struct isci_host *isci_host) | 261 | static void isci_unregister(struct isci_host *isci_host) |
| 247 | { | 262 | { |
| 248 | struct Scsi_Host *shost; | 263 | struct Scsi_Host *shost; |
| @@ -251,7 +266,6 @@ static void isci_unregister(struct isci_host *isci_host) | |||
| 251 | return; | 266 | return; |
| 252 | 267 | ||
| 253 | shost = isci_host->shost; | 268 | shost = isci_host->shost; |
| 254 | device_remove_file(&shost->shost_dev, &dev_attr_isci_id); | ||
| 255 | 269 | ||
| 256 | sas_unregister_ha(&isci_host->sas_ha); | 270 | sas_unregister_ha(&isci_host->sas_ha); |
| 257 | 271 | ||
| @@ -415,14 +429,8 @@ static struct isci_host *isci_host_alloc(struct pci_dev *pdev, int id) | |||
| 415 | if (err) | 429 | if (err) |
| 416 | goto err_shost_remove; | 430 | goto err_shost_remove; |
| 417 | 431 | ||
| 418 | err = device_create_file(&shost->shost_dev, &dev_attr_isci_id); | ||
| 419 | if (err) | ||
| 420 | goto err_unregister_ha; | ||
| 421 | |||
| 422 | return isci_host; | 432 | return isci_host; |
| 423 | 433 | ||
| 424 | err_unregister_ha: | ||
| 425 | sas_unregister_ha(&(isci_host->sas_ha)); | ||
| 426 | err_shost_remove: | 434 | err_shost_remove: |
| 427 | scsi_remove_host(shost); | 435 | scsi_remove_host(shost); |
| 428 | err_shost: | 436 | err_shost: |
| @@ -540,7 +548,8 @@ static __init int isci_init(void) | |||
| 540 | { | 548 | { |
| 541 | int err; | 549 | int err; |
| 542 | 550 | ||
| 543 | pr_info("%s: Intel(R) C600 SAS Controller Driver\n", DRV_NAME); | 551 | pr_info("%s: Intel(R) C600 SAS Controller Driver - version %s\n", |
| 552 | DRV_NAME, DRV_VERSION); | ||
| 544 | 553 | ||
| 545 | isci_transport_template = sas_domain_attach_transport(&isci_transport_ops); | 554 | isci_transport_template = sas_domain_attach_transport(&isci_transport_ops); |
| 546 | if (!isci_transport_template) | 555 | if (!isci_transport_template) |
diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c index 79313a7a2356..430fc8ff014a 100644 --- a/drivers/scsi/isci/phy.c +++ b/drivers/scsi/isci/phy.c | |||
| @@ -104,6 +104,7 @@ sci_phy_link_layer_initialization(struct isci_phy *iphy, | |||
| 104 | u32 parity_count = 0; | 104 | u32 parity_count = 0; |
| 105 | u32 llctl, link_rate; | 105 | u32 llctl, link_rate; |
| 106 | u32 clksm_value = 0; | 106 | u32 clksm_value = 0; |
| 107 | u32 sp_timeouts = 0; | ||
| 107 | 108 | ||
| 108 | iphy->link_layer_registers = reg; | 109 | iphy->link_layer_registers = reg; |
| 109 | 110 | ||
| @@ -211,6 +212,18 @@ sci_phy_link_layer_initialization(struct isci_phy *iphy, | |||
| 211 | llctl |= SCU_SAS_LLCTL_GEN_VAL(MAX_LINK_RATE, link_rate); | 212 | llctl |= SCU_SAS_LLCTL_GEN_VAL(MAX_LINK_RATE, link_rate); |
| 212 | writel(llctl, &iphy->link_layer_registers->link_layer_control); | 213 | writel(llctl, &iphy->link_layer_registers->link_layer_control); |
| 213 | 214 | ||
| 215 | sp_timeouts = readl(&iphy->link_layer_registers->sas_phy_timeouts); | ||
| 216 | |||
| 217 | /* Clear the default 0x36 (54us) RATE_CHANGE timeout value. */ | ||
| 218 | sp_timeouts &= ~SCU_SAS_PHYTOV_GEN_VAL(RATE_CHANGE, 0xFF); | ||
| 219 | |||
| 220 | /* Set RATE_CHANGE timeout value to 0x3B (59us). This ensures SCU can | ||
| 221 | * lock with 3Gb drive when SCU max rate is set to 1.5Gb. | ||
| 222 | */ | ||
| 223 | sp_timeouts |= SCU_SAS_PHYTOV_GEN_VAL(RATE_CHANGE, 0x3B); | ||
| 224 | |||
| 225 | writel(sp_timeouts, &iphy->link_layer_registers->sas_phy_timeouts); | ||
| 226 | |||
| 214 | if (is_a2(ihost->pdev)) { | 227 | if (is_a2(ihost->pdev)) { |
| 215 | /* Program the max ARB time for the PHY to 700us so we inter-operate with | 228 | /* Program the max ARB time for the PHY to 700us so we inter-operate with |
| 216 | * the PMC expander which shuts down PHYs if the expander PHY generates too | 229 | * the PMC expander which shuts down PHYs if the expander PHY generates too |
diff --git a/drivers/scsi/isci/registers.h b/drivers/scsi/isci/registers.h index 9b266c7428e8..00afc738bbed 100644 --- a/drivers/scsi/isci/registers.h +++ b/drivers/scsi/isci/registers.h | |||
| @@ -1299,6 +1299,18 @@ struct scu_transport_layer_registers { | |||
| 1299 | #define SCU_AFE_XCVRCR_OFFSET 0x00DC | 1299 | #define SCU_AFE_XCVRCR_OFFSET 0x00DC |
| 1300 | #define SCU_AFE_LUTCR_OFFSET 0x00E0 | 1300 | #define SCU_AFE_LUTCR_OFFSET 0x00E0 |
| 1301 | 1301 | ||
| 1302 | #define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_ALIGN_DETECTION_SHIFT (0UL) | ||
| 1303 | #define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_ALIGN_DETECTION_MASK (0x000000FFUL) | ||
| 1304 | #define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_HOT_PLUG_SHIFT (8UL) | ||
| 1305 | #define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_HOT_PLUG_MASK (0x0000FF00UL) | ||
| 1306 | #define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_COMSAS_DETECTION_SHIFT (16UL) | ||
| 1307 | #define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_COMSAS_DETECTION_MASK (0x00FF0000UL) | ||
| 1308 | #define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_RATE_CHANGE_SHIFT (24UL) | ||
| 1309 | #define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_RATE_CHANGE_MASK (0xFF000000UL) | ||
| 1310 | |||
| 1311 | #define SCU_SAS_PHYTOV_GEN_VAL(name, value) \ | ||
| 1312 | SCU_GEN_VALUE(SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_##name, value) | ||
| 1313 | |||
| 1302 | #define SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_SHIFT (0) | 1314 | #define SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_SHIFT (0) |
| 1303 | #define SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_MASK (0x00000003) | 1315 | #define SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_MASK (0x00000003) |
| 1304 | #define SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_GEN1 (0) | 1316 | #define SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_GEN1 (0) |
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c index a46e07ac789f..b5d3a8c4d329 100644 --- a/drivers/scsi/isci/request.c +++ b/drivers/scsi/isci/request.c | |||
| @@ -732,12 +732,20 @@ sci_io_request_terminate(struct isci_request *ireq) | |||
| 732 | sci_change_state(&ireq->sm, SCI_REQ_ABORTING); | 732 | sci_change_state(&ireq->sm, SCI_REQ_ABORTING); |
| 733 | return SCI_SUCCESS; | 733 | return SCI_SUCCESS; |
| 734 | case SCI_REQ_TASK_WAIT_TC_RESP: | 734 | case SCI_REQ_TASK_WAIT_TC_RESP: |
| 735 | /* The task frame was already confirmed to have been | ||
| 736 | * sent by the SCU HW. Since the state machine is | ||
| 737 | * now only waiting for the task response itself, | ||
| 738 | * abort the request and complete it immediately | ||
| 739 | * and don't wait for the task response. | ||
| 740 | */ | ||
| 735 | sci_change_state(&ireq->sm, SCI_REQ_ABORTING); | 741 | sci_change_state(&ireq->sm, SCI_REQ_ABORTING); |
| 736 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 742 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
| 737 | return SCI_SUCCESS; | 743 | return SCI_SUCCESS; |
| 738 | case SCI_REQ_ABORTING: | 744 | case SCI_REQ_ABORTING: |
| 739 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 745 | /* If a request has a termination requested twice, return |
| 740 | return SCI_SUCCESS; | 746 | * a failure indication, since HW confirmation of the first |
| 747 | * abort is still outstanding. | ||
| 748 | */ | ||
| 741 | case SCI_REQ_COMPLETED: | 749 | case SCI_REQ_COMPLETED: |
| 742 | default: | 750 | default: |
| 743 | dev_warn(&ireq->owning_controller->pdev->dev, | 751 | dev_warn(&ireq->owning_controller->pdev->dev, |
| @@ -2399,22 +2407,19 @@ static void isci_task_save_for_upper_layer_completion( | |||
| 2399 | } | 2407 | } |
| 2400 | } | 2408 | } |
| 2401 | 2409 | ||
| 2402 | static void isci_request_process_stp_response(struct sas_task *task, | 2410 | static void isci_process_stp_response(struct sas_task *task, struct dev_to_host_fis *fis) |
| 2403 | void *response_buffer) | ||
| 2404 | { | 2411 | { |
| 2405 | struct dev_to_host_fis *d2h_reg_fis = response_buffer; | ||
| 2406 | struct task_status_struct *ts = &task->task_status; | 2412 | struct task_status_struct *ts = &task->task_status; |
| 2407 | struct ata_task_resp *resp = (void *)&ts->buf[0]; | 2413 | struct ata_task_resp *resp = (void *)&ts->buf[0]; |
| 2408 | 2414 | ||
| 2409 | resp->frame_len = le16_to_cpu(*(__le16 *)(response_buffer + 6)); | 2415 | resp->frame_len = sizeof(*fis); |
| 2410 | memcpy(&resp->ending_fis[0], response_buffer + 16, 24); | 2416 | memcpy(resp->ending_fis, fis, sizeof(*fis)); |
| 2411 | ts->buf_valid_size = sizeof(*resp); | 2417 | ts->buf_valid_size = sizeof(*resp); |
| 2412 | 2418 | ||
| 2413 | /** | 2419 | /* If the device fault bit is set in the status register, then |
| 2414 | * If the device fault bit is set in the status register, then | ||
| 2415 | * set the sense data and return. | 2420 | * set the sense data and return. |
| 2416 | */ | 2421 | */ |
| 2417 | if (d2h_reg_fis->status & ATA_DF) | 2422 | if (fis->status & ATA_DF) |
| 2418 | ts->stat = SAS_PROTO_RESPONSE; | 2423 | ts->stat = SAS_PROTO_RESPONSE; |
| 2419 | else | 2424 | else |
| 2420 | ts->stat = SAM_STAT_GOOD; | 2425 | ts->stat = SAM_STAT_GOOD; |
| @@ -2428,7 +2433,6 @@ static void isci_request_io_request_complete(struct isci_host *ihost, | |||
| 2428 | { | 2433 | { |
| 2429 | struct sas_task *task = isci_request_access_task(request); | 2434 | struct sas_task *task = isci_request_access_task(request); |
| 2430 | struct ssp_response_iu *resp_iu; | 2435 | struct ssp_response_iu *resp_iu; |
| 2431 | void *resp_buf; | ||
| 2432 | unsigned long task_flags; | 2436 | unsigned long task_flags; |
| 2433 | struct isci_remote_device *idev = isci_lookup_device(task->dev); | 2437 | struct isci_remote_device *idev = isci_lookup_device(task->dev); |
| 2434 | enum service_response response = SAS_TASK_UNDELIVERED; | 2438 | enum service_response response = SAS_TASK_UNDELIVERED; |
| @@ -2565,9 +2569,7 @@ static void isci_request_io_request_complete(struct isci_host *ihost, | |||
| 2565 | task); | 2569 | task); |
| 2566 | 2570 | ||
| 2567 | if (sas_protocol_ata(task->task_proto)) { | 2571 | if (sas_protocol_ata(task->task_proto)) { |
| 2568 | resp_buf = &request->stp.rsp; | 2572 | isci_process_stp_response(task, &request->stp.rsp); |
| 2569 | isci_request_process_stp_response(task, | ||
| 2570 | resp_buf); | ||
| 2571 | } else if (SAS_PROTOCOL_SSP == task->task_proto) { | 2573 | } else if (SAS_PROTOCOL_SSP == task->task_proto) { |
| 2572 | 2574 | ||
| 2573 | /* crack the iu response buffer. */ | 2575 | /* crack the iu response buffer. */ |
diff --git a/drivers/scsi/isci/unsolicited_frame_control.c b/drivers/scsi/isci/unsolicited_frame_control.c index e9e1e2abacb9..16f88ab939c8 100644 --- a/drivers/scsi/isci/unsolicited_frame_control.c +++ b/drivers/scsi/isci/unsolicited_frame_control.c | |||
| @@ -72,7 +72,7 @@ int sci_unsolicited_frame_control_construct(struct isci_host *ihost) | |||
| 72 | */ | 72 | */ |
| 73 | buf_len = SCU_MAX_UNSOLICITED_FRAMES * SCU_UNSOLICITED_FRAME_BUFFER_SIZE; | 73 | buf_len = SCU_MAX_UNSOLICITED_FRAMES * SCU_UNSOLICITED_FRAME_BUFFER_SIZE; |
| 74 | header_len = SCU_MAX_UNSOLICITED_FRAMES * sizeof(struct scu_unsolicited_frame_header); | 74 | header_len = SCU_MAX_UNSOLICITED_FRAMES * sizeof(struct scu_unsolicited_frame_header); |
| 75 | size = buf_len + header_len + SCU_MAX_UNSOLICITED_FRAMES * sizeof(dma_addr_t); | 75 | size = buf_len + header_len + SCU_MAX_UNSOLICITED_FRAMES * sizeof(uf_control->address_table.array[0]); |
| 76 | 76 | ||
| 77 | /* | 77 | /* |
| 78 | * The Unsolicited Frame buffers are set at the start of the UF | 78 | * The Unsolicited Frame buffers are set at the start of the UF |
diff --git a/drivers/scsi/isci/unsolicited_frame_control.h b/drivers/scsi/isci/unsolicited_frame_control.h index 31cb9506f52d..75d896686f5a 100644 --- a/drivers/scsi/isci/unsolicited_frame_control.h +++ b/drivers/scsi/isci/unsolicited_frame_control.h | |||
| @@ -214,7 +214,7 @@ struct sci_uf_address_table_array { | |||
| 214 | * starting address of the UF address table. | 214 | * starting address of the UF address table. |
| 215 | * 64-bit pointers are required by the hardware. | 215 | * 64-bit pointers are required by the hardware. |
| 216 | */ | 216 | */ |
| 217 | dma_addr_t *array; | 217 | u64 *array; |
| 218 | 218 | ||
| 219 | /** | 219 | /** |
| 220 | * This field specifies the physical address location for the UF | 220 | * This field specifies the physical address location for the UF |
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c index 01ff082dc34c..d261e982a2fa 100644 --- a/drivers/scsi/libfc/fc_exch.c +++ b/drivers/scsi/libfc/fc_exch.c | |||
| @@ -494,6 +494,9 @@ static int fc_seq_send(struct fc_lport *lport, struct fc_seq *sp, | |||
| 494 | */ | 494 | */ |
| 495 | error = lport->tt.frame_send(lport, fp); | 495 | error = lport->tt.frame_send(lport, fp); |
| 496 | 496 | ||
| 497 | if (fh->fh_type == FC_TYPE_BLS) | ||
| 498 | return error; | ||
| 499 | |||
| 497 | /* | 500 | /* |
| 498 | * Update the exchange and sequence flags, | 501 | * Update the exchange and sequence flags, |
| 499 | * assuming all frames for the sequence have been sent. | 502 | * assuming all frames for the sequence have been sent. |
| @@ -575,42 +578,35 @@ static void fc_seq_set_resp(struct fc_seq *sp, | |||
| 575 | } | 578 | } |
| 576 | 579 | ||
| 577 | /** | 580 | /** |
| 578 | * fc_seq_exch_abort() - Abort an exchange and sequence | 581 | * fc_exch_abort_locked() - Abort an exchange |
| 579 | * @req_sp: The sequence to be aborted | 582 | * @ep: The exchange to be aborted |
| 580 | * @timer_msec: The period of time to wait before aborting | 583 | * @timer_msec: The period of time to wait before aborting |
| 581 | * | 584 | * |
| 582 | * Generally called because of a timeout or an abort from the upper layer. | 585 | * Locking notes: Called with exch lock held |
| 586 | * | ||
| 587 | * Return value: 0 on success else error code | ||
| 583 | */ | 588 | */ |
| 584 | static int fc_seq_exch_abort(const struct fc_seq *req_sp, | 589 | static int fc_exch_abort_locked(struct fc_exch *ep, |
| 585 | unsigned int timer_msec) | 590 | unsigned int timer_msec) |
| 586 | { | 591 | { |
| 587 | struct fc_seq *sp; | 592 | struct fc_seq *sp; |
| 588 | struct fc_exch *ep; | ||
| 589 | struct fc_frame *fp; | 593 | struct fc_frame *fp; |
| 590 | int error; | 594 | int error; |
| 591 | 595 | ||
| 592 | ep = fc_seq_exch(req_sp); | ||
| 593 | |||
| 594 | spin_lock_bh(&ep->ex_lock); | ||
| 595 | if (ep->esb_stat & (ESB_ST_COMPLETE | ESB_ST_ABNORMAL) || | 596 | if (ep->esb_stat & (ESB_ST_COMPLETE | ESB_ST_ABNORMAL) || |
| 596 | ep->state & (FC_EX_DONE | FC_EX_RST_CLEANUP)) { | 597 | ep->state & (FC_EX_DONE | FC_EX_RST_CLEANUP)) |
| 597 | spin_unlock_bh(&ep->ex_lock); | ||
| 598 | return -ENXIO; | 598 | return -ENXIO; |
| 599 | } | ||
| 600 | 599 | ||
| 601 | /* | 600 | /* |
| 602 | * Send the abort on a new sequence if possible. | 601 | * Send the abort on a new sequence if possible. |
| 603 | */ | 602 | */ |
| 604 | sp = fc_seq_start_next_locked(&ep->seq); | 603 | sp = fc_seq_start_next_locked(&ep->seq); |
| 605 | if (!sp) { | 604 | if (!sp) |
| 606 | spin_unlock_bh(&ep->ex_lock); | ||
| 607 | return -ENOMEM; | 605 | return -ENOMEM; |
| 608 | } | ||
| 609 | 606 | ||
| 610 | ep->esb_stat |= ESB_ST_SEQ_INIT | ESB_ST_ABNORMAL; | 607 | ep->esb_stat |= ESB_ST_SEQ_INIT | ESB_ST_ABNORMAL; |
| 611 | if (timer_msec) | 608 | if (timer_msec) |
| 612 | fc_exch_timer_set_locked(ep, timer_msec); | 609 | fc_exch_timer_set_locked(ep, timer_msec); |
| 613 | spin_unlock_bh(&ep->ex_lock); | ||
| 614 | 610 | ||
| 615 | /* | 611 | /* |
| 616 | * If not logged into the fabric, don't send ABTS but leave | 612 | * If not logged into the fabric, don't send ABTS but leave |
| @@ -633,6 +629,28 @@ static int fc_seq_exch_abort(const struct fc_seq *req_sp, | |||
| 633 | } | 629 | } |
| 634 | 630 | ||
| 635 | /** | 631 | /** |
| 632 | * fc_seq_exch_abort() - Abort an exchange and sequence | ||
| 633 | * @req_sp: The sequence to be aborted | ||
| 634 | * @timer_msec: The period of time to wait before aborting | ||
| 635 | * | ||
| 636 | * Generally called because of a timeout or an abort from the upper layer. | ||
| 637 | * | ||
| 638 | * Return value: 0 on success else error code | ||
| 639 | */ | ||
| 640 | static int fc_seq_exch_abort(const struct fc_seq *req_sp, | ||
| 641 | unsigned int timer_msec) | ||
| 642 | { | ||
| 643 | struct fc_exch *ep; | ||
| 644 | int error; | ||
| 645 | |||
| 646 | ep = fc_seq_exch(req_sp); | ||
| 647 | spin_lock_bh(&ep->ex_lock); | ||
| 648 | error = fc_exch_abort_locked(ep, timer_msec); | ||
| 649 | spin_unlock_bh(&ep->ex_lock); | ||
| 650 | return error; | ||
| 651 | } | ||
| 652 | |||
| 653 | /** | ||
| 636 | * fc_exch_timeout() - Handle exchange timer expiration | 654 | * fc_exch_timeout() - Handle exchange timer expiration |
| 637 | * @work: The work_struct identifying the exchange that timed out | 655 | * @work: The work_struct identifying the exchange that timed out |
| 638 | */ | 656 | */ |
| @@ -1715,6 +1733,7 @@ static void fc_exch_reset(struct fc_exch *ep) | |||
| 1715 | int rc = 1; | 1733 | int rc = 1; |
| 1716 | 1734 | ||
| 1717 | spin_lock_bh(&ep->ex_lock); | 1735 | spin_lock_bh(&ep->ex_lock); |
| 1736 | fc_exch_abort_locked(ep, 0); | ||
| 1718 | ep->state |= FC_EX_RST_CLEANUP; | 1737 | ep->state |= FC_EX_RST_CLEANUP; |
| 1719 | if (cancel_delayed_work(&ep->timeout_work)) | 1738 | if (cancel_delayed_work(&ep->timeout_work)) |
| 1720 | atomic_dec(&ep->ex_refcnt); /* drop hold for timer */ | 1739 | atomic_dec(&ep->ex_refcnt); /* drop hold for timer */ |
| @@ -1962,6 +1981,7 @@ static struct fc_seq *fc_exch_seq_send(struct fc_lport *lport, | |||
| 1962 | struct fc_exch *ep; | 1981 | struct fc_exch *ep; |
| 1963 | struct fc_seq *sp = NULL; | 1982 | struct fc_seq *sp = NULL; |
| 1964 | struct fc_frame_header *fh; | 1983 | struct fc_frame_header *fh; |
| 1984 | struct fc_fcp_pkt *fsp = NULL; | ||
| 1965 | int rc = 1; | 1985 | int rc = 1; |
| 1966 | 1986 | ||
| 1967 | ep = fc_exch_alloc(lport, fp); | 1987 | ep = fc_exch_alloc(lport, fp); |
| @@ -1984,8 +2004,10 @@ static struct fc_seq *fc_exch_seq_send(struct fc_lport *lport, | |||
| 1984 | fc_exch_setup_hdr(ep, fp, ep->f_ctl); | 2004 | fc_exch_setup_hdr(ep, fp, ep->f_ctl); |
| 1985 | sp->cnt++; | 2005 | sp->cnt++; |
| 1986 | 2006 | ||
| 1987 | if (ep->xid <= lport->lro_xid && fh->fh_r_ctl == FC_RCTL_DD_UNSOL_CMD) | 2007 | if (ep->xid <= lport->lro_xid && fh->fh_r_ctl == FC_RCTL_DD_UNSOL_CMD) { |
| 2008 | fsp = fr_fsp(fp); | ||
| 1988 | fc_fcp_ddp_setup(fr_fsp(fp), ep->xid); | 2009 | fc_fcp_ddp_setup(fr_fsp(fp), ep->xid); |
| 2010 | } | ||
| 1989 | 2011 | ||
| 1990 | if (unlikely(lport->tt.frame_send(lport, fp))) | 2012 | if (unlikely(lport->tt.frame_send(lport, fp))) |
| 1991 | goto err; | 2013 | goto err; |
| @@ -1999,7 +2021,8 @@ static struct fc_seq *fc_exch_seq_send(struct fc_lport *lport, | |||
| 1999 | spin_unlock_bh(&ep->ex_lock); | 2021 | spin_unlock_bh(&ep->ex_lock); |
| 2000 | return sp; | 2022 | return sp; |
| 2001 | err: | 2023 | err: |
| 2002 | fc_fcp_ddp_done(fr_fsp(fp)); | 2024 | if (fsp) |
| 2025 | fc_fcp_ddp_done(fsp); | ||
| 2003 | rc = fc_exch_done_locked(ep); | 2026 | rc = fc_exch_done_locked(ep); |
| 2004 | spin_unlock_bh(&ep->ex_lock); | 2027 | spin_unlock_bh(&ep->ex_lock); |
| 2005 | if (!rc) | 2028 | if (!rc) |
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c index afb63c843144..4c41ee816f0b 100644 --- a/drivers/scsi/libfc/fc_fcp.c +++ b/drivers/scsi/libfc/fc_fcp.c | |||
| @@ -2019,6 +2019,11 @@ int fc_eh_abort(struct scsi_cmnd *sc_cmd) | |||
| 2019 | struct fc_fcp_internal *si; | 2019 | struct fc_fcp_internal *si; |
| 2020 | int rc = FAILED; | 2020 | int rc = FAILED; |
| 2021 | unsigned long flags; | 2021 | unsigned long flags; |
| 2022 | int rval; | ||
| 2023 | |||
| 2024 | rval = fc_block_scsi_eh(sc_cmd); | ||
| 2025 | if (rval) | ||
| 2026 | return rval; | ||
| 2022 | 2027 | ||
| 2023 | lport = shost_priv(sc_cmd->device->host); | 2028 | lport = shost_priv(sc_cmd->device->host); |
| 2024 | if (lport->state != LPORT_ST_READY) | 2029 | if (lport->state != LPORT_ST_READY) |
| @@ -2068,9 +2073,9 @@ int fc_eh_device_reset(struct scsi_cmnd *sc_cmd) | |||
| 2068 | int rc = FAILED; | 2073 | int rc = FAILED; |
| 2069 | int rval; | 2074 | int rval; |
| 2070 | 2075 | ||
| 2071 | rval = fc_remote_port_chkready(rport); | 2076 | rval = fc_block_scsi_eh(sc_cmd); |
| 2072 | if (rval) | 2077 | if (rval) |
| 2073 | goto out; | 2078 | return rval; |
| 2074 | 2079 | ||
| 2075 | lport = shost_priv(sc_cmd->device->host); | 2080 | lport = shost_priv(sc_cmd->device->host); |
| 2076 | 2081 | ||
| @@ -2116,6 +2121,8 @@ int fc_eh_host_reset(struct scsi_cmnd *sc_cmd) | |||
| 2116 | 2121 | ||
| 2117 | FC_SCSI_DBG(lport, "Resetting host\n"); | 2122 | FC_SCSI_DBG(lport, "Resetting host\n"); |
| 2118 | 2123 | ||
| 2124 | fc_block_scsi_eh(sc_cmd); | ||
| 2125 | |||
| 2119 | lport->tt.lport_reset(lport); | 2126 | lport->tt.lport_reset(lport); |
| 2120 | wait_tmo = jiffies + FC_HOST_RESET_TIMEOUT; | 2127 | wait_tmo = jiffies + FC_HOST_RESET_TIMEOUT; |
| 2121 | while (!fc_fcp_lport_queue_ready(lport) && time_before(jiffies, | 2128 | while (!fc_fcp_lport_queue_ready(lport) && time_before(jiffies, |
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index e55ed9cf23fb..628f347404f9 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c | |||
| @@ -88,6 +88,7 @@ | |||
| 88 | */ | 88 | */ |
| 89 | 89 | ||
| 90 | #include <linux/timer.h> | 90 | #include <linux/timer.h> |
| 91 | #include <linux/delay.h> | ||
| 91 | #include <linux/slab.h> | 92 | #include <linux/slab.h> |
| 92 | #include <asm/unaligned.h> | 93 | #include <asm/unaligned.h> |
| 93 | 94 | ||
| @@ -1029,8 +1030,16 @@ static void fc_lport_enter_reset(struct fc_lport *lport) | |||
| 1029 | FCH_EVT_LIPRESET, 0); | 1030 | FCH_EVT_LIPRESET, 0); |
| 1030 | fc_vports_linkchange(lport); | 1031 | fc_vports_linkchange(lport); |
| 1031 | fc_lport_reset_locked(lport); | 1032 | fc_lport_reset_locked(lport); |
| 1032 | if (lport->link_up) | 1033 | if (lport->link_up) { |
| 1034 | /* | ||
| 1035 | * Wait upto resource allocation time out before | ||
| 1036 | * doing re-login since incomplete FIP exchanged | ||
| 1037 | * from last session may collide with exchanges | ||
| 1038 | * in new session. | ||
| 1039 | */ | ||
| 1040 | msleep(lport->r_a_tov); | ||
| 1033 | fc_lport_enter_flogi(lport); | 1041 | fc_lport_enter_flogi(lport); |
| 1042 | } | ||
| 1034 | } | 1043 | } |
| 1035 | 1044 | ||
| 1036 | /** | 1045 | /** |
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 7836eb01c7fc..a31e05f3bfd4 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
| @@ -1786,13 +1786,16 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable) | |||
| 1786 | fc_vport_set_state(fc_vport, FC_VPORT_LINKDOWN); | 1786 | fc_vport_set_state(fc_vport, FC_VPORT_LINKDOWN); |
| 1787 | } | 1787 | } |
| 1788 | 1788 | ||
| 1789 | if ((IS_QLA25XX(ha) || IS_QLA81XX(ha)) && ql2xenabledif) { | 1789 | if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif) { |
| 1790 | if (ha->fw_attributes & BIT_4) { | 1790 | if (ha->fw_attributes & BIT_4) { |
| 1791 | int prot = 0; | ||
| 1791 | vha->flags.difdix_supported = 1; | 1792 | vha->flags.difdix_supported = 1; |
| 1792 | ql_dbg(ql_dbg_user, vha, 0x7082, | 1793 | ql_dbg(ql_dbg_user, vha, 0x7082, |
| 1793 | "Registered for DIF/DIX type 1 and 3 protection.\n"); | 1794 | "Registered for DIF/DIX type 1 and 3 protection.\n"); |
| 1795 | if (ql2xenabledif == 1) | ||
| 1796 | prot = SHOST_DIX_TYPE0_PROTECTION; | ||
| 1794 | scsi_host_set_prot(vha->host, | 1797 | scsi_host_set_prot(vha->host, |
| 1795 | SHOST_DIF_TYPE1_PROTECTION | 1798 | prot | SHOST_DIF_TYPE1_PROTECTION |
| 1796 | | SHOST_DIF_TYPE2_PROTECTION | 1799 | | SHOST_DIF_TYPE2_PROTECTION |
| 1797 | | SHOST_DIF_TYPE3_PROTECTION | 1800 | | SHOST_DIF_TYPE3_PROTECTION |
| 1798 | | SHOST_DIX_TYPE1_PROTECTION | 1801 | | SHOST_DIX_TYPE1_PROTECTION |
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index 2155071f3100..d79cd8a5f831 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c | |||
| @@ -8,24 +8,24 @@ | |||
| 8 | /* | 8 | /* |
| 9 | * Table for showing the current message id in use for particular level | 9 | * Table for showing the current message id in use for particular level |
| 10 | * Change this table for addition of log/debug messages. | 10 | * Change this table for addition of log/debug messages. |
| 11 | * ----------------------------------------------------- | 11 | * ---------------------------------------------------------------------- |
| 12 | * | Level | Last Value Used | | 12 | * | Level | Last Value Used | Holes | |
| 13 | * ----------------------------------------------------- | 13 | * ---------------------------------------------------------------------- |
| 14 | * | Module Init and Probe | 0x0116 | | 14 | * | Module Init and Probe | 0x0116 | | |
| 15 | * | Mailbox commands | 0x111e | | 15 | * | Mailbox commands | 0x1126 | | |
| 16 | * | Device Discovery | 0x2083 | | 16 | * | Device Discovery | 0x2083 | | |
| 17 | * | Queue Command and IO tracing | 0x302e | | 17 | * | Queue Command and IO tracing | 0x302e | 0x3008 | |
| 18 | * | DPC Thread | 0x401c | | 18 | * | DPC Thread | 0x401c | | |
| 19 | * | Async Events | 0x5059 | | 19 | * | Async Events | 0x5059 | | |
| 20 | * | Timer Routines | 0x600d | | 20 | * | Timer Routines | 0x600d | | |
| 21 | * | User Space Interactions | 0x709c | | 21 | * | User Space Interactions | 0x709d | | |
| 22 | * | Task Management | 0x8043 | | 22 | * | Task Management | 0x8041 | | |
| 23 | * | AER/EEH | 0x900f | | 23 | * | AER/EEH | 0x900f | | |
| 24 | * | Virtual Port | 0xa007 | | 24 | * | Virtual Port | 0xa007 | | |
| 25 | * | ISP82XX Specific | 0xb027 | | 25 | * | ISP82XX Specific | 0xb04f | | |
| 26 | * | MultiQ | 0xc00b | | 26 | * | MultiQ | 0xc00b | | |
| 27 | * | Misc | 0xd00b | | 27 | * | Misc | 0xd00b | | |
| 28 | * ----------------------------------------------------- | 28 | * ---------------------------------------------------------------------- |
| 29 | */ | 29 | */ |
| 30 | 30 | ||
| 31 | #include "qla_def.h" | 31 | #include "qla_def.h" |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index cc5a79259d33..a03eaf40f377 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h | |||
| @@ -2529,6 +2529,7 @@ struct qla_hw_data { | |||
| 2529 | #define DT_ISP8021 BIT_14 | 2529 | #define DT_ISP8021 BIT_14 |
| 2530 | #define DT_ISP_LAST (DT_ISP8021 << 1) | 2530 | #define DT_ISP_LAST (DT_ISP8021 << 1) |
| 2531 | 2531 | ||
| 2532 | #define DT_T10_PI BIT_25 | ||
| 2532 | #define DT_IIDMA BIT_26 | 2533 | #define DT_IIDMA BIT_26 |
| 2533 | #define DT_FWI2 BIT_27 | 2534 | #define DT_FWI2 BIT_27 |
| 2534 | #define DT_ZIO_SUPPORTED BIT_28 | 2535 | #define DT_ZIO_SUPPORTED BIT_28 |
| @@ -2572,6 +2573,7 @@ struct qla_hw_data { | |||
| 2572 | #define IS_NOCACHE_VPD_TYPE(ha) (IS_QLA81XX(ha)) | 2573 | #define IS_NOCACHE_VPD_TYPE(ha) (IS_QLA81XX(ha)) |
| 2573 | #define IS_ALOGIO_CAPABLE(ha) (IS_QLA23XX(ha) || IS_FWI2_CAPABLE(ha)) | 2574 | #define IS_ALOGIO_CAPABLE(ha) (IS_QLA23XX(ha) || IS_FWI2_CAPABLE(ha)) |
| 2574 | 2575 | ||
| 2576 | #define IS_T10_PI_CAPABLE(ha) ((ha)->device_type & DT_T10_PI) | ||
| 2575 | #define IS_IIDMA_CAPABLE(ha) ((ha)->device_type & DT_IIDMA) | 2577 | #define IS_IIDMA_CAPABLE(ha) ((ha)->device_type & DT_IIDMA) |
| 2576 | #define IS_FWI2_CAPABLE(ha) ((ha)->device_type & DT_FWI2) | 2578 | #define IS_FWI2_CAPABLE(ha) ((ha)->device_type & DT_FWI2) |
| 2577 | #define IS_ZIO_SUPPORTED(ha) ((ha)->device_type & DT_ZIO_SUPPORTED) | 2579 | #define IS_ZIO_SUPPORTED(ha) ((ha)->device_type & DT_ZIO_SUPPORTED) |
diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h index 691783abfb69..aa69486dc064 100644 --- a/drivers/scsi/qla2xxx/qla_fw.h +++ b/drivers/scsi/qla2xxx/qla_fw.h | |||
| @@ -537,6 +537,11 @@ struct sts_entry_24xx { | |||
| 537 | /* | 537 | /* |
| 538 | * If DIF Error is set in comp_status, these additional fields are | 538 | * If DIF Error is set in comp_status, these additional fields are |
| 539 | * defined: | 539 | * defined: |
| 540 | * | ||
| 541 | * !!! NOTE: Firmware sends expected/actual DIF data in big endian | ||
| 542 | * format; but all of the "data" field gets swab32-d in the beginning | ||
| 543 | * of qla2x00_status_entry(). | ||
| 544 | * | ||
| 540 | * &data[10] : uint8_t report_runt_bg[2]; - computed guard | 545 | * &data[10] : uint8_t report_runt_bg[2]; - computed guard |
| 541 | * &data[12] : uint8_t actual_dif[8]; - DIF Data received | 546 | * &data[12] : uint8_t actual_dif[8]; - DIF Data received |
| 542 | * &data[20] : uint8_t expected_dif[8]; - DIF Data computed | 547 | * &data[20] : uint8_t expected_dif[8]; - DIF Data computed |
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index def694271bf7..37da04d3db26 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
| @@ -3838,15 +3838,12 @@ qla2x00_loop_resync(scsi_qla_host_t *vha) | |||
| 3838 | req = vha->req; | 3838 | req = vha->req; |
| 3839 | rsp = req->rsp; | 3839 | rsp = req->rsp; |
| 3840 | 3840 | ||
| 3841 | atomic_set(&vha->loop_state, LOOP_UPDATE); | ||
| 3842 | clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags); | 3841 | clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags); |
| 3843 | if (vha->flags.online) { | 3842 | if (vha->flags.online) { |
| 3844 | if (!(rval = qla2x00_fw_ready(vha))) { | 3843 | if (!(rval = qla2x00_fw_ready(vha))) { |
| 3845 | /* Wait at most MAX_TARGET RSCNs for a stable link. */ | 3844 | /* Wait at most MAX_TARGET RSCNs for a stable link. */ |
| 3846 | wait_time = 256; | 3845 | wait_time = 256; |
| 3847 | do { | 3846 | do { |
| 3848 | atomic_set(&vha->loop_state, LOOP_UPDATE); | ||
| 3849 | |||
| 3850 | /* Issue a marker after FW becomes ready. */ | 3847 | /* Issue a marker after FW becomes ready. */ |
| 3851 | qla2x00_marker(vha, req, rsp, 0, 0, | 3848 | qla2x00_marker(vha, req, rsp, 0, 0, |
| 3852 | MK_SYNC_ALL); | 3849 | MK_SYNC_ALL); |
diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h index d2e904bc21c0..9902834e0b74 100644 --- a/drivers/scsi/qla2xxx/qla_inline.h +++ b/drivers/scsi/qla2xxx/qla_inline.h | |||
| @@ -102,3 +102,32 @@ qla2x00_set_fcport_state(fc_port_t *fcport, int state) | |||
| 102 | fcport->d_id.b.al_pa); | 102 | fcport->d_id.b.al_pa); |
| 103 | } | 103 | } |
| 104 | } | 104 | } |
| 105 | |||
| 106 | static inline int | ||
| 107 | qla2x00_hba_err_chk_enabled(srb_t *sp) | ||
| 108 | { | ||
| 109 | /* | ||
| 110 | * Uncomment when corresponding SCSI changes are done. | ||
| 111 | * | ||
| 112 | if (!sp->cmd->prot_chk) | ||
| 113 | return 0; | ||
| 114 | * | ||
| 115 | */ | ||
| 116 | |||
| 117 | switch (scsi_get_prot_op(sp->cmd)) { | ||
| 118 | case SCSI_PROT_READ_STRIP: | ||
| 119 | case SCSI_PROT_WRITE_INSERT: | ||
| 120 | if (ql2xenablehba_err_chk >= 1) | ||
| 121 | return 1; | ||
| 122 | break; | ||
| 123 | case SCSI_PROT_READ_PASS: | ||
| 124 | case SCSI_PROT_WRITE_PASS: | ||
| 125 | if (ql2xenablehba_err_chk >= 2) | ||
| 126 | return 1; | ||
| 127 | break; | ||
| 128 | case SCSI_PROT_READ_INSERT: | ||
| 129 | case SCSI_PROT_WRITE_STRIP: | ||
| 130 | return 1; | ||
| 131 | } | ||
| 132 | return 0; | ||
| 133 | } | ||
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 49d6906af886..dbec89622a0f 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c | |||
| @@ -709,20 +709,28 @@ struct fw_dif_context { | |||
| 709 | * | 709 | * |
| 710 | */ | 710 | */ |
| 711 | static inline void | 711 | static inline void |
| 712 | qla24xx_set_t10dif_tags(struct scsi_cmnd *cmd, struct fw_dif_context *pkt, | 712 | qla24xx_set_t10dif_tags(srb_t *sp, struct fw_dif_context *pkt, |
| 713 | unsigned int protcnt) | 713 | unsigned int protcnt) |
| 714 | { | 714 | { |
| 715 | struct sd_dif_tuple *spt; | 715 | struct scsi_cmnd *cmd = sp->cmd; |
| 716 | scsi_qla_host_t *vha = shost_priv(cmd->device->host); | 716 | scsi_qla_host_t *vha = shost_priv(cmd->device->host); |
| 717 | unsigned char op = scsi_get_prot_op(cmd); | ||
| 718 | 717 | ||
| 719 | switch (scsi_get_prot_type(cmd)) { | 718 | switch (scsi_get_prot_type(cmd)) { |
| 720 | /* For TYPE 0 protection: no checking */ | ||
| 721 | case SCSI_PROT_DIF_TYPE0: | 719 | case SCSI_PROT_DIF_TYPE0: |
| 722 | pkt->ref_tag_mask[0] = 0x00; | 720 | /* |
| 723 | pkt->ref_tag_mask[1] = 0x00; | 721 | * No check for ql2xenablehba_err_chk, as it would be an |
| 724 | pkt->ref_tag_mask[2] = 0x00; | 722 | * I/O error if hba tag generation is not done. |
| 725 | pkt->ref_tag_mask[3] = 0x00; | 723 | */ |
| 724 | pkt->ref_tag = cpu_to_le32((uint32_t) | ||
| 725 | (0xffffffff & scsi_get_lba(cmd))); | ||
| 726 | |||
| 727 | if (!qla2x00_hba_err_chk_enabled(sp)) | ||
| 728 | break; | ||
| 729 | |||
| 730 | pkt->ref_tag_mask[0] = 0xff; | ||
| 731 | pkt->ref_tag_mask[1] = 0xff; | ||
| 732 | pkt->ref_tag_mask[2] = 0xff; | ||
| 733 | pkt->ref_tag_mask[3] = 0xff; | ||
| 726 | break; | 734 | break; |
| 727 | 735 | ||
| 728 | /* | 736 | /* |
| @@ -730,20 +738,16 @@ qla24xx_set_t10dif_tags(struct scsi_cmnd *cmd, struct fw_dif_context *pkt, | |||
| 730 | * match LBA in CDB + N | 738 | * match LBA in CDB + N |
| 731 | */ | 739 | */ |
| 732 | case SCSI_PROT_DIF_TYPE2: | 740 | case SCSI_PROT_DIF_TYPE2: |
| 733 | if (!ql2xenablehba_err_chk) | 741 | pkt->app_tag = __constant_cpu_to_le16(0); |
| 734 | break; | 742 | pkt->app_tag_mask[0] = 0x0; |
| 735 | 743 | pkt->app_tag_mask[1] = 0x0; | |
| 736 | if (scsi_prot_sg_count(cmd)) { | ||
| 737 | spt = page_address(sg_page(scsi_prot_sglist(cmd))) + | ||
| 738 | scsi_prot_sglist(cmd)[0].offset; | ||
| 739 | pkt->app_tag = swab32(spt->app_tag); | ||
| 740 | pkt->app_tag_mask[0] = 0xff; | ||
| 741 | pkt->app_tag_mask[1] = 0xff; | ||
| 742 | } | ||
| 743 | 744 | ||
| 744 | pkt->ref_tag = cpu_to_le32((uint32_t) | 745 | pkt->ref_tag = cpu_to_le32((uint32_t) |
| 745 | (0xffffffff & scsi_get_lba(cmd))); | 746 | (0xffffffff & scsi_get_lba(cmd))); |
| 746 | 747 | ||
| 748 | if (!qla2x00_hba_err_chk_enabled(sp)) | ||
| 749 | break; | ||
| 750 | |||
| 747 | /* enable ALL bytes of the ref tag */ | 751 | /* enable ALL bytes of the ref tag */ |
| 748 | pkt->ref_tag_mask[0] = 0xff; | 752 | pkt->ref_tag_mask[0] = 0xff; |
| 749 | pkt->ref_tag_mask[1] = 0xff; | 753 | pkt->ref_tag_mask[1] = 0xff; |
| @@ -763,26 +767,15 @@ qla24xx_set_t10dif_tags(struct scsi_cmnd *cmd, struct fw_dif_context *pkt, | |||
| 763 | * 16 bit app tag. | 767 | * 16 bit app tag. |
| 764 | */ | 768 | */ |
| 765 | case SCSI_PROT_DIF_TYPE1: | 769 | case SCSI_PROT_DIF_TYPE1: |
| 766 | if (!ql2xenablehba_err_chk) | 770 | pkt->ref_tag = cpu_to_le32((uint32_t) |
| 771 | (0xffffffff & scsi_get_lba(cmd))); | ||
| 772 | pkt->app_tag = __constant_cpu_to_le16(0); | ||
| 773 | pkt->app_tag_mask[0] = 0x0; | ||
| 774 | pkt->app_tag_mask[1] = 0x0; | ||
| 775 | |||
| 776 | if (!qla2x00_hba_err_chk_enabled(sp)) | ||
| 767 | break; | 777 | break; |
| 768 | 778 | ||
| 769 | if (protcnt && (op == SCSI_PROT_WRITE_STRIP || | ||
| 770 | op == SCSI_PROT_WRITE_PASS)) { | ||
| 771 | spt = page_address(sg_page(scsi_prot_sglist(cmd))) + | ||
| 772 | scsi_prot_sglist(cmd)[0].offset; | ||
| 773 | ql_dbg(ql_dbg_io, vha, 0x3008, | ||
| 774 | "LBA from user %p, lba = 0x%x for cmd=%p.\n", | ||
| 775 | spt, (int)spt->ref_tag, cmd); | ||
| 776 | pkt->ref_tag = swab32(spt->ref_tag); | ||
| 777 | pkt->app_tag_mask[0] = 0x0; | ||
| 778 | pkt->app_tag_mask[1] = 0x0; | ||
| 779 | } else { | ||
| 780 | pkt->ref_tag = cpu_to_le32((uint32_t) | ||
| 781 | (0xffffffff & scsi_get_lba(cmd))); | ||
| 782 | pkt->app_tag = __constant_cpu_to_le16(0); | ||
| 783 | pkt->app_tag_mask[0] = 0x0; | ||
| 784 | pkt->app_tag_mask[1] = 0x0; | ||
| 785 | } | ||
| 786 | /* enable ALL bytes of the ref tag */ | 779 | /* enable ALL bytes of the ref tag */ |
| 787 | pkt->ref_tag_mask[0] = 0xff; | 780 | pkt->ref_tag_mask[0] = 0xff; |
| 788 | pkt->ref_tag_mask[1] = 0xff; | 781 | pkt->ref_tag_mask[1] = 0xff; |
| @@ -798,8 +791,162 @@ qla24xx_set_t10dif_tags(struct scsi_cmnd *cmd, struct fw_dif_context *pkt, | |||
| 798 | scsi_get_prot_type(cmd), cmd); | 791 | scsi_get_prot_type(cmd), cmd); |
| 799 | } | 792 | } |
| 800 | 793 | ||
| 794 | struct qla2_sgx { | ||
| 795 | dma_addr_t dma_addr; /* OUT */ | ||
| 796 | uint32_t dma_len; /* OUT */ | ||
| 797 | |||
| 798 | uint32_t tot_bytes; /* IN */ | ||
| 799 | struct scatterlist *cur_sg; /* IN */ | ||
| 800 | |||
| 801 | /* for book keeping, bzero on initial invocation */ | ||
| 802 | uint32_t bytes_consumed; | ||
| 803 | uint32_t num_bytes; | ||
| 804 | uint32_t tot_partial; | ||
| 805 | |||
| 806 | /* for debugging */ | ||
| 807 | uint32_t num_sg; | ||
| 808 | srb_t *sp; | ||
| 809 | }; | ||
| 801 | 810 | ||
| 802 | static int | 811 | static int |
| 812 | qla24xx_get_one_block_sg(uint32_t blk_sz, struct qla2_sgx *sgx, | ||
| 813 | uint32_t *partial) | ||
| 814 | { | ||
| 815 | struct scatterlist *sg; | ||
| 816 | uint32_t cumulative_partial, sg_len; | ||
| 817 | dma_addr_t sg_dma_addr; | ||
| 818 | |||
| 819 | if (sgx->num_bytes == sgx->tot_bytes) | ||
| 820 | return 0; | ||
| 821 | |||
| 822 | sg = sgx->cur_sg; | ||
| 823 | cumulative_partial = sgx->tot_partial; | ||
| 824 | |||
| 825 | sg_dma_addr = sg_dma_address(sg); | ||
| 826 | sg_len = sg_dma_len(sg); | ||
| 827 | |||
| 828 | sgx->dma_addr = sg_dma_addr + sgx->bytes_consumed; | ||
| 829 | |||
| 830 | if ((cumulative_partial + (sg_len - sgx->bytes_consumed)) >= blk_sz) { | ||
| 831 | sgx->dma_len = (blk_sz - cumulative_partial); | ||
| 832 | sgx->tot_partial = 0; | ||
| 833 | sgx->num_bytes += blk_sz; | ||
| 834 | *partial = 0; | ||
| 835 | } else { | ||
| 836 | sgx->dma_len = sg_len - sgx->bytes_consumed; | ||
| 837 | sgx->tot_partial += sgx->dma_len; | ||
| 838 | *partial = 1; | ||
| 839 | } | ||
| 840 | |||
| 841 | sgx->bytes_consumed += sgx->dma_len; | ||
| 842 | |||
| 843 | if (sg_len == sgx->bytes_consumed) { | ||
| 844 | sg = sg_next(sg); | ||
| 845 | sgx->num_sg++; | ||
| 846 | sgx->cur_sg = sg; | ||
| 847 | sgx->bytes_consumed = 0; | ||
| 848 | } | ||
| 849 | |||
| 850 | return 1; | ||
| 851 | } | ||
| 852 | |||
| 853 | static int | ||
| 854 | qla24xx_walk_and_build_sglist_no_difb(struct qla_hw_data *ha, srb_t *sp, | ||
| 855 | uint32_t *dsd, uint16_t tot_dsds) | ||
| 856 | { | ||
| 857 | void *next_dsd; | ||
| 858 | uint8_t avail_dsds = 0; | ||
| 859 | uint32_t dsd_list_len; | ||
| 860 | struct dsd_dma *dsd_ptr; | ||
| 861 | struct scatterlist *sg_prot; | ||
| 862 | uint32_t *cur_dsd = dsd; | ||
| 863 | uint16_t used_dsds = tot_dsds; | ||
| 864 | |||
| 865 | uint32_t prot_int; | ||
| 866 | uint32_t partial; | ||
| 867 | struct qla2_sgx sgx; | ||
| 868 | dma_addr_t sle_dma; | ||
| 869 | uint32_t sle_dma_len, tot_prot_dma_len = 0; | ||
| 870 | struct scsi_cmnd *cmd = sp->cmd; | ||
| 871 | |||
| 872 | prot_int = cmd->device->sector_size; | ||
| 873 | |||
| 874 | memset(&sgx, 0, sizeof(struct qla2_sgx)); | ||
| 875 | sgx.tot_bytes = scsi_bufflen(sp->cmd); | ||
| 876 | sgx.cur_sg = scsi_sglist(sp->cmd); | ||
| 877 | sgx.sp = sp; | ||
| 878 | |||
| 879 | sg_prot = scsi_prot_sglist(sp->cmd); | ||
| 880 | |||
| 881 | while (qla24xx_get_one_block_sg(prot_int, &sgx, &partial)) { | ||
| 882 | |||
| 883 | sle_dma = sgx.dma_addr; | ||
| 884 | sle_dma_len = sgx.dma_len; | ||
| 885 | alloc_and_fill: | ||
| 886 | /* Allocate additional continuation packets? */ | ||
| 887 | if (avail_dsds == 0) { | ||
| 888 | avail_dsds = (used_dsds > QLA_DSDS_PER_IOCB) ? | ||
| 889 | QLA_DSDS_PER_IOCB : used_dsds; | ||
| 890 | dsd_list_len = (avail_dsds + 1) * 12; | ||
| 891 | used_dsds -= avail_dsds; | ||
| 892 | |||
| 893 | /* allocate tracking DS */ | ||
| 894 | dsd_ptr = kzalloc(sizeof(struct dsd_dma), GFP_ATOMIC); | ||
| 895 | if (!dsd_ptr) | ||
| 896 | return 1; | ||
| 897 | |||
| 898 | /* allocate new list */ | ||
| 899 | dsd_ptr->dsd_addr = next_dsd = | ||
| 900 | dma_pool_alloc(ha->dl_dma_pool, GFP_ATOMIC, | ||
| 901 | &dsd_ptr->dsd_list_dma); | ||
| 902 | |||
| 903 | if (!next_dsd) { | ||
| 904 | /* | ||
| 905 | * Need to cleanup only this dsd_ptr, rest | ||
| 906 | * will be done by sp_free_dma() | ||
| 907 | */ | ||
| 908 | kfree(dsd_ptr); | ||
| 909 | return 1; | ||
| 910 | } | ||
| 911 | |||
| 912 | list_add_tail(&dsd_ptr->list, | ||
| 913 | &((struct crc_context *)sp->ctx)->dsd_list); | ||
| 914 | |||
| 915 | sp->flags |= SRB_CRC_CTX_DSD_VALID; | ||
| 916 | |||
| 917 | /* add new list to cmd iocb or last list */ | ||
| 918 | *cur_dsd++ = cpu_to_le32(LSD(dsd_ptr->dsd_list_dma)); | ||
| 919 | *cur_dsd++ = cpu_to_le32(MSD(dsd_ptr->dsd_list_dma)); | ||
| 920 | *cur_dsd++ = dsd_list_len; | ||
| 921 | cur_dsd = (uint32_t *)next_dsd; | ||
| 922 | } | ||
| 923 | *cur_dsd++ = cpu_to_le32(LSD(sle_dma)); | ||
| 924 | *cur_dsd++ = cpu_to_le32(MSD(sle_dma)); | ||
| 925 | *cur_dsd++ = cpu_to_le32(sle_dma_len); | ||
| 926 | avail_dsds--; | ||
| 927 | |||
| 928 | if (partial == 0) { | ||
| 929 | /* Got a full protection interval */ | ||
| 930 | sle_dma = sg_dma_address(sg_prot) + tot_prot_dma_len; | ||
| 931 | sle_dma_len = 8; | ||
| 932 | |||
| 933 | tot_prot_dma_len += sle_dma_len; | ||
| 934 | if (tot_prot_dma_len == sg_dma_len(sg_prot)) { | ||
| 935 | tot_prot_dma_len = 0; | ||
| 936 | sg_prot = sg_next(sg_prot); | ||
| 937 | } | ||
| 938 | |||
| 939 | partial = 1; /* So as to not re-enter this block */ | ||
| 940 | goto alloc_and_fill; | ||
| 941 | } | ||
| 942 | } | ||
| 943 | /* Null termination */ | ||
| 944 | *cur_dsd++ = 0; | ||
| 945 | *cur_dsd++ = 0; | ||
| 946 | *cur_dsd++ = 0; | ||
| 947 | return 0; | ||
| 948 | } | ||
| 949 | static int | ||
| 803 | qla24xx_walk_and_build_sglist(struct qla_hw_data *ha, srb_t *sp, uint32_t *dsd, | 950 | qla24xx_walk_and_build_sglist(struct qla_hw_data *ha, srb_t *sp, uint32_t *dsd, |
| 804 | uint16_t tot_dsds) | 951 | uint16_t tot_dsds) |
| 805 | { | 952 | { |
| @@ -981,7 +1128,7 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt, | |||
| 981 | struct scsi_cmnd *cmd; | 1128 | struct scsi_cmnd *cmd; |
| 982 | struct scatterlist *cur_seg; | 1129 | struct scatterlist *cur_seg; |
| 983 | int sgc; | 1130 | int sgc; |
| 984 | uint32_t total_bytes; | 1131 | uint32_t total_bytes = 0; |
| 985 | uint32_t data_bytes; | 1132 | uint32_t data_bytes; |
| 986 | uint32_t dif_bytes; | 1133 | uint32_t dif_bytes; |
| 987 | uint8_t bundling = 1; | 1134 | uint8_t bundling = 1; |
| @@ -1023,8 +1170,10 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt, | |||
| 1023 | __constant_cpu_to_le16(CF_READ_DATA); | 1170 | __constant_cpu_to_le16(CF_READ_DATA); |
| 1024 | } | 1171 | } |
| 1025 | 1172 | ||
| 1026 | tot_prot_dsds = scsi_prot_sg_count(cmd); | 1173 | if ((scsi_get_prot_op(sp->cmd) == SCSI_PROT_READ_INSERT) || |
| 1027 | if (!tot_prot_dsds) | 1174 | (scsi_get_prot_op(sp->cmd) == SCSI_PROT_WRITE_STRIP) || |
| 1175 | (scsi_get_prot_op(sp->cmd) == SCSI_PROT_READ_STRIP) || | ||
| 1176 | (scsi_get_prot_op(sp->cmd) == SCSI_PROT_WRITE_INSERT)) | ||
| 1028 | bundling = 0; | 1177 | bundling = 0; |
| 1029 | 1178 | ||
| 1030 | /* Allocate CRC context from global pool */ | 1179 | /* Allocate CRC context from global pool */ |
| @@ -1047,7 +1196,7 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt, | |||
| 1047 | 1196 | ||
| 1048 | INIT_LIST_HEAD(&crc_ctx_pkt->dsd_list); | 1197 | INIT_LIST_HEAD(&crc_ctx_pkt->dsd_list); |
| 1049 | 1198 | ||
| 1050 | qla24xx_set_t10dif_tags(cmd, (struct fw_dif_context *) | 1199 | qla24xx_set_t10dif_tags(sp, (struct fw_dif_context *) |
| 1051 | &crc_ctx_pkt->ref_tag, tot_prot_dsds); | 1200 | &crc_ctx_pkt->ref_tag, tot_prot_dsds); |
| 1052 | 1201 | ||
| 1053 | cmd_pkt->crc_context_address[0] = cpu_to_le32(LSD(crc_ctx_dma)); | 1202 | cmd_pkt->crc_context_address[0] = cpu_to_le32(LSD(crc_ctx_dma)); |
| @@ -1076,7 +1225,6 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt, | |||
| 1076 | fcp_cmnd->additional_cdb_len |= 2; | 1225 | fcp_cmnd->additional_cdb_len |= 2; |
| 1077 | 1226 | ||
| 1078 | int_to_scsilun(sp->cmd->device->lun, &fcp_cmnd->lun); | 1227 | int_to_scsilun(sp->cmd->device->lun, &fcp_cmnd->lun); |
| 1079 | host_to_fcp_swap((uint8_t *)&fcp_cmnd->lun, sizeof(fcp_cmnd->lun)); | ||
| 1080 | memcpy(fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len); | 1228 | memcpy(fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len); |
| 1081 | cmd_pkt->fcp_cmnd_dseg_len = cpu_to_le16(fcp_cmnd_len); | 1229 | cmd_pkt->fcp_cmnd_dseg_len = cpu_to_le16(fcp_cmnd_len); |
| 1082 | cmd_pkt->fcp_cmnd_dseg_address[0] = cpu_to_le32( | 1230 | cmd_pkt->fcp_cmnd_dseg_address[0] = cpu_to_le32( |
| @@ -1107,15 +1255,28 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt, | |||
| 1107 | cmd_pkt->fcp_rsp_dseg_len = 0; /* Let response come in status iocb */ | 1255 | cmd_pkt->fcp_rsp_dseg_len = 0; /* Let response come in status iocb */ |
| 1108 | 1256 | ||
| 1109 | /* Compute dif len and adjust data len to incude protection */ | 1257 | /* Compute dif len and adjust data len to incude protection */ |
| 1110 | total_bytes = data_bytes; | ||
| 1111 | dif_bytes = 0; | 1258 | dif_bytes = 0; |
| 1112 | blk_size = cmd->device->sector_size; | 1259 | blk_size = cmd->device->sector_size; |
| 1113 | if (scsi_get_prot_op(cmd) != SCSI_PROT_NORMAL) { | 1260 | dif_bytes = (data_bytes / blk_size) * 8; |
| 1114 | dif_bytes = (data_bytes / blk_size) * 8; | 1261 | |
| 1115 | total_bytes += dif_bytes; | 1262 | switch (scsi_get_prot_op(sp->cmd)) { |
| 1263 | case SCSI_PROT_READ_INSERT: | ||
| 1264 | case SCSI_PROT_WRITE_STRIP: | ||
| 1265 | total_bytes = data_bytes; | ||
| 1266 | data_bytes += dif_bytes; | ||
| 1267 | break; | ||
| 1268 | |||
| 1269 | case SCSI_PROT_READ_STRIP: | ||
| 1270 | case SCSI_PROT_WRITE_INSERT: | ||
| 1271 | case SCSI_PROT_READ_PASS: | ||
| 1272 | case SCSI_PROT_WRITE_PASS: | ||
| 1273 | total_bytes = data_bytes + dif_bytes; | ||
| 1274 | break; | ||
| 1275 | default: | ||
| 1276 | BUG(); | ||
| 1116 | } | 1277 | } |
| 1117 | 1278 | ||
| 1118 | if (!ql2xenablehba_err_chk) | 1279 | if (!qla2x00_hba_err_chk_enabled(sp)) |
| 1119 | fw_prot_opts |= 0x10; /* Disable Guard tag checking */ | 1280 | fw_prot_opts |= 0x10; /* Disable Guard tag checking */ |
| 1120 | 1281 | ||
| 1121 | if (!bundling) { | 1282 | if (!bundling) { |
| @@ -1151,7 +1312,12 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt, | |||
| 1151 | 1312 | ||
| 1152 | cmd_pkt->control_flags |= | 1313 | cmd_pkt->control_flags |= |
| 1153 | __constant_cpu_to_le16(CF_DATA_SEG_DESCR_ENABLE); | 1314 | __constant_cpu_to_le16(CF_DATA_SEG_DESCR_ENABLE); |
| 1154 | if (qla24xx_walk_and_build_sglist(ha, sp, cur_dsd, | 1315 | |
| 1316 | if (!bundling && tot_prot_dsds) { | ||
| 1317 | if (qla24xx_walk_and_build_sglist_no_difb(ha, sp, | ||
| 1318 | cur_dsd, tot_dsds)) | ||
| 1319 | goto crc_queuing_error; | ||
| 1320 | } else if (qla24xx_walk_and_build_sglist(ha, sp, cur_dsd, | ||
| 1155 | (tot_dsds - tot_prot_dsds))) | 1321 | (tot_dsds - tot_prot_dsds))) |
| 1156 | goto crc_queuing_error; | 1322 | goto crc_queuing_error; |
| 1157 | 1323 | ||
| @@ -1414,6 +1580,22 @@ qla24xx_dif_start_scsi(srb_t *sp) | |||
| 1414 | goto queuing_error; | 1580 | goto queuing_error; |
| 1415 | else | 1581 | else |
| 1416 | sp->flags |= SRB_DMA_VALID; | 1582 | sp->flags |= SRB_DMA_VALID; |
| 1583 | |||
| 1584 | if ((scsi_get_prot_op(cmd) == SCSI_PROT_READ_INSERT) || | ||
| 1585 | (scsi_get_prot_op(cmd) == SCSI_PROT_WRITE_STRIP)) { | ||
| 1586 | struct qla2_sgx sgx; | ||
| 1587 | uint32_t partial; | ||
| 1588 | |||
| 1589 | memset(&sgx, 0, sizeof(struct qla2_sgx)); | ||
| 1590 | sgx.tot_bytes = scsi_bufflen(cmd); | ||
| 1591 | sgx.cur_sg = scsi_sglist(cmd); | ||
| 1592 | sgx.sp = sp; | ||
| 1593 | |||
| 1594 | nseg = 0; | ||
| 1595 | while (qla24xx_get_one_block_sg( | ||
| 1596 | cmd->device->sector_size, &sgx, &partial)) | ||
| 1597 | nseg++; | ||
| 1598 | } | ||
| 1417 | } else | 1599 | } else |
| 1418 | nseg = 0; | 1600 | nseg = 0; |
| 1419 | 1601 | ||
| @@ -1428,6 +1610,11 @@ qla24xx_dif_start_scsi(srb_t *sp) | |||
| 1428 | goto queuing_error; | 1610 | goto queuing_error; |
| 1429 | else | 1611 | else |
| 1430 | sp->flags |= SRB_CRC_PROT_DMA_VALID; | 1612 | sp->flags |= SRB_CRC_PROT_DMA_VALID; |
| 1613 | |||
| 1614 | if ((scsi_get_prot_op(cmd) == SCSI_PROT_READ_INSERT) || | ||
| 1615 | (scsi_get_prot_op(cmd) == SCSI_PROT_WRITE_STRIP)) { | ||
| 1616 | nseg = scsi_bufflen(cmd) / cmd->device->sector_size; | ||
| 1617 | } | ||
| 1431 | } else { | 1618 | } else { |
| 1432 | nseg = 0; | 1619 | nseg = 0; |
| 1433 | } | 1620 | } |
| @@ -1454,6 +1641,7 @@ qla24xx_dif_start_scsi(srb_t *sp) | |||
| 1454 | /* Build header part of command packet (excluding the OPCODE). */ | 1641 | /* Build header part of command packet (excluding the OPCODE). */ |
| 1455 | req->current_outstanding_cmd = handle; | 1642 | req->current_outstanding_cmd = handle; |
| 1456 | req->outstanding_cmds[handle] = sp; | 1643 | req->outstanding_cmds[handle] = sp; |
| 1644 | sp->handle = handle; | ||
| 1457 | sp->cmd->host_scribble = (unsigned char *)(unsigned long)handle; | 1645 | sp->cmd->host_scribble = (unsigned char *)(unsigned long)handle; |
| 1458 | req->cnt -= req_cnt; | 1646 | req->cnt -= req_cnt; |
| 1459 | 1647 | ||
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index b16b7725dee0..646fc5263d50 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c | |||
| @@ -719,7 +719,6 @@ skip_rio: | |||
| 719 | vha->flags.rscn_queue_overflow = 1; | 719 | vha->flags.rscn_queue_overflow = 1; |
| 720 | } | 720 | } |
| 721 | 721 | ||
| 722 | atomic_set(&vha->loop_state, LOOP_UPDATE); | ||
| 723 | atomic_set(&vha->loop_down_timer, 0); | 722 | atomic_set(&vha->loop_down_timer, 0); |
| 724 | vha->flags.management_server_logged_in = 0; | 723 | vha->flags.management_server_logged_in = 0; |
| 725 | 724 | ||
| @@ -1435,25 +1434,27 @@ struct scsi_dif_tuple { | |||
| 1435 | * ASC/ASCQ fields in the sense buffer with ILLEGAL_REQUEST | 1434 | * ASC/ASCQ fields in the sense buffer with ILLEGAL_REQUEST |
| 1436 | * to indicate to the kernel that the HBA detected error. | 1435 | * to indicate to the kernel that the HBA detected error. |
| 1437 | */ | 1436 | */ |
| 1438 | static inline void | 1437 | static inline int |
| 1439 | qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24) | 1438 | qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24) |
| 1440 | { | 1439 | { |
| 1441 | struct scsi_qla_host *vha = sp->fcport->vha; | 1440 | struct scsi_qla_host *vha = sp->fcport->vha; |
| 1442 | struct scsi_cmnd *cmd = sp->cmd; | 1441 | struct scsi_cmnd *cmd = sp->cmd; |
| 1443 | struct scsi_dif_tuple *ep = | 1442 | uint8_t *ap = &sts24->data[12]; |
| 1444 | (struct scsi_dif_tuple *)&sts24->data[20]; | 1443 | uint8_t *ep = &sts24->data[20]; |
| 1445 | struct scsi_dif_tuple *ap = | ||
| 1446 | (struct scsi_dif_tuple *)&sts24->data[12]; | ||
| 1447 | uint32_t e_ref_tag, a_ref_tag; | 1444 | uint32_t e_ref_tag, a_ref_tag; |
| 1448 | uint16_t e_app_tag, a_app_tag; | 1445 | uint16_t e_app_tag, a_app_tag; |
| 1449 | uint16_t e_guard, a_guard; | 1446 | uint16_t e_guard, a_guard; |
| 1450 | 1447 | ||
| 1451 | e_ref_tag = be32_to_cpu(ep->ref_tag); | 1448 | /* |
| 1452 | a_ref_tag = be32_to_cpu(ap->ref_tag); | 1449 | * swab32 of the "data" field in the beginning of qla2x00_status_entry() |
| 1453 | e_app_tag = be16_to_cpu(ep->app_tag); | 1450 | * would make guard field appear at offset 2 |
| 1454 | a_app_tag = be16_to_cpu(ap->app_tag); | 1451 | */ |
| 1455 | e_guard = be16_to_cpu(ep->guard); | 1452 | a_guard = le16_to_cpu(*(uint16_t *)(ap + 2)); |
| 1456 | a_guard = be16_to_cpu(ap->guard); | 1453 | a_app_tag = le16_to_cpu(*(uint16_t *)(ap + 0)); |
| 1454 | a_ref_tag = le32_to_cpu(*(uint32_t *)(ap + 4)); | ||
| 1455 | e_guard = le16_to_cpu(*(uint16_t *)(ep + 2)); | ||
| 1456 | e_app_tag = le16_to_cpu(*(uint16_t *)(ep + 0)); | ||
| 1457 | e_ref_tag = le32_to_cpu(*(uint32_t *)(ep + 4)); | ||
| 1457 | 1458 | ||
| 1458 | ql_dbg(ql_dbg_io, vha, 0x3023, | 1459 | ql_dbg(ql_dbg_io, vha, 0x3023, |
| 1459 | "iocb(s) %p Returned STATUS.\n", sts24); | 1460 | "iocb(s) %p Returned STATUS.\n", sts24); |
| @@ -1465,6 +1466,63 @@ qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24) | |||
| 1465 | cmd->cmnd[0], (u64)scsi_get_lba(cmd), a_ref_tag, e_ref_tag, | 1466 | cmd->cmnd[0], (u64)scsi_get_lba(cmd), a_ref_tag, e_ref_tag, |
| 1466 | a_app_tag, e_app_tag, a_guard, e_guard); | 1467 | a_app_tag, e_app_tag, a_guard, e_guard); |
| 1467 | 1468 | ||
| 1469 | /* | ||
| 1470 | * Ignore sector if: | ||
| 1471 | * For type 3: ref & app tag is all 'f's | ||
| 1472 | * For type 0,1,2: app tag is all 'f's | ||
| 1473 | */ | ||
| 1474 | if ((a_app_tag == 0xffff) && | ||
| 1475 | ((scsi_get_prot_type(cmd) != SCSI_PROT_DIF_TYPE3) || | ||
| 1476 | (a_ref_tag == 0xffffffff))) { | ||
| 1477 | uint32_t blocks_done, resid; | ||
| 1478 | sector_t lba_s = scsi_get_lba(cmd); | ||
| 1479 | |||
| 1480 | /* 2TB boundary case covered automatically with this */ | ||
| 1481 | blocks_done = e_ref_tag - (uint32_t)lba_s + 1; | ||
| 1482 | |||
| 1483 | resid = scsi_bufflen(cmd) - (blocks_done * | ||
| 1484 | cmd->device->sector_size); | ||
| 1485 | |||
| 1486 | scsi_set_resid(cmd, resid); | ||
| 1487 | cmd->result = DID_OK << 16; | ||
| 1488 | |||
| 1489 | /* Update protection tag */ | ||
| 1490 | if (scsi_prot_sg_count(cmd)) { | ||
| 1491 | uint32_t i, j = 0, k = 0, num_ent; | ||
| 1492 | struct scatterlist *sg; | ||
| 1493 | struct sd_dif_tuple *spt; | ||
| 1494 | |||
| 1495 | /* Patch the corresponding protection tags */ | ||
| 1496 | scsi_for_each_prot_sg(cmd, sg, | ||
| 1497 | scsi_prot_sg_count(cmd), i) { | ||
| 1498 | num_ent = sg_dma_len(sg) / 8; | ||
| 1499 | if (k + num_ent < blocks_done) { | ||
| 1500 | k += num_ent; | ||
| 1501 | continue; | ||
| 1502 | } | ||
| 1503 | j = blocks_done - k - 1; | ||
| 1504 | k = blocks_done; | ||
| 1505 | break; | ||
| 1506 | } | ||
| 1507 | |||
| 1508 | if (k != blocks_done) { | ||
| 1509 | qla_printk(KERN_WARNING, sp->fcport->vha->hw, | ||
| 1510 | "unexpected tag values tag:lba=%x:%lx)\n", | ||
| 1511 | e_ref_tag, lba_s); | ||
| 1512 | return 1; | ||
| 1513 | } | ||
| 1514 | |||
| 1515 | spt = page_address(sg_page(sg)) + sg->offset; | ||
| 1516 | spt += j; | ||
| 1517 | |||
| 1518 | spt->app_tag = 0xffff; | ||
| 1519 | if (scsi_get_prot_type(cmd) == SCSI_PROT_DIF_TYPE3) | ||
| 1520 | spt->ref_tag = 0xffffffff; | ||
| 1521 | } | ||
| 1522 | |||
| 1523 | return 0; | ||
| 1524 | } | ||
| 1525 | |||
| 1468 | /* check guard */ | 1526 | /* check guard */ |
| 1469 | if (e_guard != a_guard) { | 1527 | if (e_guard != a_guard) { |
| 1470 | scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, | 1528 | scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, |
| @@ -1472,28 +1530,30 @@ qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24) | |||
| 1472 | set_driver_byte(cmd, DRIVER_SENSE); | 1530 | set_driver_byte(cmd, DRIVER_SENSE); |
| 1473 | set_host_byte(cmd, DID_ABORT); | 1531 | set_host_byte(cmd, DID_ABORT); |
| 1474 | cmd->result |= SAM_STAT_CHECK_CONDITION << 1; | 1532 | cmd->result |= SAM_STAT_CHECK_CONDITION << 1; |
| 1475 | return; | 1533 | return 1; |
| 1476 | } | 1534 | } |
| 1477 | 1535 | ||
| 1478 | /* check appl tag */ | 1536 | /* check ref tag */ |
| 1479 | if (e_app_tag != a_app_tag) { | 1537 | if (e_ref_tag != a_ref_tag) { |
| 1480 | scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, | 1538 | scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, |
| 1481 | 0x10, 0x2); | 1539 | 0x10, 0x3); |
| 1482 | set_driver_byte(cmd, DRIVER_SENSE); | 1540 | set_driver_byte(cmd, DRIVER_SENSE); |
| 1483 | set_host_byte(cmd, DID_ABORT); | 1541 | set_host_byte(cmd, DID_ABORT); |
| 1484 | cmd->result |= SAM_STAT_CHECK_CONDITION << 1; | 1542 | cmd->result |= SAM_STAT_CHECK_CONDITION << 1; |
| 1485 | return; | 1543 | return 1; |
| 1486 | } | 1544 | } |
| 1487 | 1545 | ||
| 1488 | /* check ref tag */ | 1546 | /* check appl tag */ |
| 1489 | if (e_ref_tag != a_ref_tag) { | 1547 | if (e_app_tag != a_app_tag) { |
| 1490 | scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, | 1548 | scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, |
| 1491 | 0x10, 0x3); | 1549 | 0x10, 0x2); |
| 1492 | set_driver_byte(cmd, DRIVER_SENSE); | 1550 | set_driver_byte(cmd, DRIVER_SENSE); |
| 1493 | set_host_byte(cmd, DID_ABORT); | 1551 | set_host_byte(cmd, DID_ABORT); |
| 1494 | cmd->result |= SAM_STAT_CHECK_CONDITION << 1; | 1552 | cmd->result |= SAM_STAT_CHECK_CONDITION << 1; |
| 1495 | return; | 1553 | return 1; |
| 1496 | } | 1554 | } |
| 1555 | |||
| 1556 | return 1; | ||
| 1497 | } | 1557 | } |
| 1498 | 1558 | ||
| 1499 | /** | 1559 | /** |
| @@ -1767,7 +1827,7 @@ check_scsi_status: | |||
| 1767 | break; | 1827 | break; |
| 1768 | 1828 | ||
| 1769 | case CS_DIF_ERROR: | 1829 | case CS_DIF_ERROR: |
| 1770 | qla2x00_handle_dif_error(sp, sts24); | 1830 | logit = qla2x00_handle_dif_error(sp, sts24); |
| 1771 | break; | 1831 | break; |
| 1772 | default: | 1832 | default: |
| 1773 | cp->result = DID_ERROR << 16; | 1833 | cp->result = DID_ERROR << 16; |
| @@ -2468,11 +2528,10 @@ qla2x00_request_irqs(struct qla_hw_data *ha, struct rsp_que *rsp) | |||
| 2468 | goto skip_msi; | 2528 | goto skip_msi; |
| 2469 | } | 2529 | } |
| 2470 | 2530 | ||
| 2471 | if (IS_QLA2432(ha) && (ha->pdev->revision < QLA_MSIX_CHIP_REV_24XX || | 2531 | if (IS_QLA2432(ha) && (ha->pdev->revision < QLA_MSIX_CHIP_REV_24XX)) { |
| 2472 | !QLA_MSIX_FW_MODE_1(ha->fw_attributes))) { | ||
| 2473 | ql_log(ql_log_warn, vha, 0x0035, | 2532 | ql_log(ql_log_warn, vha, 0x0035, |
| 2474 | "MSI-X; Unsupported ISP2432 (0x%X, 0x%X).\n", | 2533 | "MSI-X; Unsupported ISP2432 (0x%X, 0x%X).\n", |
| 2475 | ha->pdev->revision, ha->fw_attributes); | 2534 | ha->pdev->revision, QLA_MSIX_CHIP_REV_24XX); |
| 2476 | goto skip_msix; | 2535 | goto skip_msix; |
| 2477 | } | 2536 | } |
| 2478 | 2537 | ||
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index c706ed370000..f488cc69fc79 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c | |||
| @@ -472,7 +472,7 @@ qla24xx_create_vhost(struct fc_vport *fc_vport) | |||
| 472 | host->can_queue = base_vha->req->length + 128; | 472 | host->can_queue = base_vha->req->length + 128; |
| 473 | host->this_id = 255; | 473 | host->this_id = 255; |
| 474 | host->cmd_per_lun = 3; | 474 | host->cmd_per_lun = 3; |
| 475 | if ((IS_QLA25XX(ha) || IS_QLA81XX(ha)) && ql2xenabledif) | 475 | if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif) |
| 476 | host->max_cmd_len = 32; | 476 | host->max_cmd_len = 32; |
| 477 | else | 477 | else |
| 478 | host->max_cmd_len = MAX_CMDSZ; | 478 | host->max_cmd_len = MAX_CMDSZ; |
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c index 5cbf33a50b14..049807cda419 100644 --- a/drivers/scsi/qla2xxx/qla_nx.c +++ b/drivers/scsi/qla2xxx/qla_nx.c | |||
| @@ -2208,6 +2208,7 @@ qla82xx_msix_rsp_q(int irq, void *dev_id) | |||
| 2208 | struct qla_hw_data *ha; | 2208 | struct qla_hw_data *ha; |
| 2209 | struct rsp_que *rsp; | 2209 | struct rsp_que *rsp; |
| 2210 | struct device_reg_82xx __iomem *reg; | 2210 | struct device_reg_82xx __iomem *reg; |
| 2211 | unsigned long flags; | ||
| 2211 | 2212 | ||
| 2212 | rsp = (struct rsp_que *) dev_id; | 2213 | rsp = (struct rsp_que *) dev_id; |
| 2213 | if (!rsp) { | 2214 | if (!rsp) { |
| @@ -2218,11 +2219,11 @@ qla82xx_msix_rsp_q(int irq, void *dev_id) | |||
| 2218 | 2219 | ||
| 2219 | ha = rsp->hw; | 2220 | ha = rsp->hw; |
| 2220 | reg = &ha->iobase->isp82; | 2221 | reg = &ha->iobase->isp82; |
| 2221 | spin_lock_irq(&ha->hardware_lock); | 2222 | spin_lock_irqsave(&ha->hardware_lock, flags); |
| 2222 | vha = pci_get_drvdata(ha->pdev); | 2223 | vha = pci_get_drvdata(ha->pdev); |
| 2223 | qla24xx_process_response_queue(vha, rsp); | 2224 | qla24xx_process_response_queue(vha, rsp); |
| 2224 | WRT_REG_DWORD(®->host_int, 0); | 2225 | WRT_REG_DWORD(®->host_int, 0); |
| 2225 | spin_unlock_irq(&ha->hardware_lock); | 2226 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
| 2226 | return IRQ_HANDLED; | 2227 | return IRQ_HANDLED; |
| 2227 | } | 2228 | } |
| 2228 | 2229 | ||
| @@ -2838,6 +2839,16 @@ sufficient_dsds: | |||
| 2838 | int_to_scsilun(sp->cmd->device->lun, &cmd_pkt->lun); | 2839 | int_to_scsilun(sp->cmd->device->lun, &cmd_pkt->lun); |
| 2839 | host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun)); | 2840 | host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun)); |
| 2840 | 2841 | ||
| 2842 | /* build FCP_CMND IU */ | ||
| 2843 | memset(ctx->fcp_cmnd, 0, sizeof(struct fcp_cmnd)); | ||
| 2844 | int_to_scsilun(sp->cmd->device->lun, &ctx->fcp_cmnd->lun); | ||
| 2845 | ctx->fcp_cmnd->additional_cdb_len = additional_cdb_len; | ||
| 2846 | |||
| 2847 | if (cmd->sc_data_direction == DMA_TO_DEVICE) | ||
| 2848 | ctx->fcp_cmnd->additional_cdb_len |= 1; | ||
| 2849 | else if (cmd->sc_data_direction == DMA_FROM_DEVICE) | ||
| 2850 | ctx->fcp_cmnd->additional_cdb_len |= 2; | ||
| 2851 | |||
| 2841 | /* | 2852 | /* |
| 2842 | * Update tagged queuing modifier -- default is TSK_SIMPLE (0). | 2853 | * Update tagged queuing modifier -- default is TSK_SIMPLE (0). |
| 2843 | */ | 2854 | */ |
| @@ -2854,16 +2865,6 @@ sufficient_dsds: | |||
| 2854 | } | 2865 | } |
| 2855 | } | 2866 | } |
| 2856 | 2867 | ||
| 2857 | /* build FCP_CMND IU */ | ||
| 2858 | memset(ctx->fcp_cmnd, 0, sizeof(struct fcp_cmnd)); | ||
| 2859 | int_to_scsilun(sp->cmd->device->lun, &ctx->fcp_cmnd->lun); | ||
| 2860 | ctx->fcp_cmnd->additional_cdb_len = additional_cdb_len; | ||
| 2861 | |||
| 2862 | if (cmd->sc_data_direction == DMA_TO_DEVICE) | ||
| 2863 | ctx->fcp_cmnd->additional_cdb_len |= 1; | ||
| 2864 | else if (cmd->sc_data_direction == DMA_FROM_DEVICE) | ||
| 2865 | ctx->fcp_cmnd->additional_cdb_len |= 2; | ||
| 2866 | |||
| 2867 | memcpy(ctx->fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len); | 2868 | memcpy(ctx->fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len); |
| 2868 | 2869 | ||
| 2869 | fcp_dl = (uint32_t *)(ctx->fcp_cmnd->cdb + 16 + | 2870 | fcp_dl = (uint32_t *)(ctx->fcp_cmnd->cdb + 16 + |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index e02df276804e..4cace3f20c04 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
| @@ -106,17 +106,21 @@ MODULE_PARM_DESC(ql2xmaxqdepth, | |||
| 106 | "Maximum queue depth to report for target devices."); | 106 | "Maximum queue depth to report for target devices."); |
| 107 | 107 | ||
| 108 | /* Do not change the value of this after module load */ | 108 | /* Do not change the value of this after module load */ |
| 109 | int ql2xenabledif = 1; | 109 | int ql2xenabledif = 0; |
| 110 | module_param(ql2xenabledif, int, S_IRUGO|S_IWUSR); | 110 | module_param(ql2xenabledif, int, S_IRUGO|S_IWUSR); |
| 111 | MODULE_PARM_DESC(ql2xenabledif, | 111 | MODULE_PARM_DESC(ql2xenabledif, |
| 112 | " Enable T10-CRC-DIF " | 112 | " Enable T10-CRC-DIF " |
| 113 | " Default is 0 - No DIF Support. 1 - Enable it"); | 113 | " Default is 0 - No DIF Support. 1 - Enable it" |
| 114 | ", 2 - Enable DIF for all types, except Type 0."); | ||
| 114 | 115 | ||
| 115 | int ql2xenablehba_err_chk; | 116 | int ql2xenablehba_err_chk = 2; |
| 116 | module_param(ql2xenablehba_err_chk, int, S_IRUGO|S_IWUSR); | 117 | module_param(ql2xenablehba_err_chk, int, S_IRUGO|S_IWUSR); |
| 117 | MODULE_PARM_DESC(ql2xenablehba_err_chk, | 118 | MODULE_PARM_DESC(ql2xenablehba_err_chk, |
| 118 | " Enable T10-CRC-DIF Error isolation by HBA" | 119 | " Enable T10-CRC-DIF Error isolation by HBA:\n" |
| 119 | " Default is 0 - Error isolation disabled, 1 - Enable it"); | 120 | " Default is 1.\n" |
| 121 | " 0 -- Error isolation disabled\n" | ||
| 122 | " 1 -- Error isolation enabled only for DIX Type 0\n" | ||
| 123 | " 2 -- Error isolation enabled for all Types\n"); | ||
| 120 | 124 | ||
| 121 | int ql2xiidmaenable=1; | 125 | int ql2xiidmaenable=1; |
| 122 | module_param(ql2xiidmaenable, int, S_IRUGO); | 126 | module_param(ql2xiidmaenable, int, S_IRUGO); |
| @@ -909,7 +913,14 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) | |||
| 909 | "Abort command mbx success.\n"); | 913 | "Abort command mbx success.\n"); |
| 910 | wait = 1; | 914 | wait = 1; |
| 911 | } | 915 | } |
| 916 | |||
| 917 | spin_lock_irqsave(&ha->hardware_lock, flags); | ||
| 912 | qla2x00_sp_compl(ha, sp); | 918 | qla2x00_sp_compl(ha, sp); |
| 919 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
| 920 | |||
| 921 | /* Did the command return during mailbox execution? */ | ||
| 922 | if (ret == FAILED && !CMD_SP(cmd)) | ||
| 923 | ret = SUCCESS; | ||
| 913 | 924 | ||
| 914 | /* Wait for the command to be returned. */ | 925 | /* Wait for the command to be returned. */ |
| 915 | if (wait) { | 926 | if (wait) { |
| @@ -2251,7 +2262,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 2251 | host->this_id = 255; | 2262 | host->this_id = 255; |
| 2252 | host->cmd_per_lun = 3; | 2263 | host->cmd_per_lun = 3; |
| 2253 | host->unique_id = host->host_no; | 2264 | host->unique_id = host->host_no; |
| 2254 | if ((IS_QLA25XX(ha) || IS_QLA81XX(ha)) && ql2xenabledif) | 2265 | if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif) |
| 2255 | host->max_cmd_len = 32; | 2266 | host->max_cmd_len = 32; |
| 2256 | else | 2267 | else |
| 2257 | host->max_cmd_len = MAX_CMDSZ; | 2268 | host->max_cmd_len = MAX_CMDSZ; |
| @@ -2378,13 +2389,16 @@ skip_dpc: | |||
| 2378 | "Detected hba at address=%p.\n", | 2389 | "Detected hba at address=%p.\n", |
| 2379 | ha); | 2390 | ha); |
| 2380 | 2391 | ||
| 2381 | if ((IS_QLA25XX(ha) || IS_QLA81XX(ha)) && ql2xenabledif) { | 2392 | if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif) { |
| 2382 | if (ha->fw_attributes & BIT_4) { | 2393 | if (ha->fw_attributes & BIT_4) { |
| 2394 | int prot = 0; | ||
| 2383 | base_vha->flags.difdix_supported = 1; | 2395 | base_vha->flags.difdix_supported = 1; |
| 2384 | ql_dbg(ql_dbg_init, base_vha, 0x00f1, | 2396 | ql_dbg(ql_dbg_init, base_vha, 0x00f1, |
| 2385 | "Registering for DIF/DIX type 1 and 3 protection.\n"); | 2397 | "Registering for DIF/DIX type 1 and 3 protection.\n"); |
| 2398 | if (ql2xenabledif == 1) | ||
| 2399 | prot = SHOST_DIX_TYPE0_PROTECTION; | ||
| 2386 | scsi_host_set_prot(host, | 2400 | scsi_host_set_prot(host, |
| 2387 | SHOST_DIF_TYPE1_PROTECTION | 2401 | prot | SHOST_DIF_TYPE1_PROTECTION |
| 2388 | | SHOST_DIF_TYPE2_PROTECTION | 2402 | | SHOST_DIF_TYPE2_PROTECTION |
| 2389 | | SHOST_DIF_TYPE3_PROTECTION | 2403 | | SHOST_DIF_TYPE3_PROTECTION |
| 2390 | | SHOST_DIX_TYPE1_PROTECTION | 2404 | | SHOST_DIX_TYPE1_PROTECTION |
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h index 062c97bf62f5..13b6357c1fa2 100644 --- a/drivers/scsi/qla2xxx/qla_version.h +++ b/drivers/scsi/qla2xxx/qla_version.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | /* | 7 | /* |
| 8 | * Driver version | 8 | * Driver version |
| 9 | */ | 9 | */ |
| 10 | #define QLA2XXX_VERSION "8.03.07.03-k" | 10 | #define QLA2XXX_VERSION "8.03.07.07-k" |
| 11 | 11 | ||
| 12 | #define QLA_DRIVER_MAJOR_VER 8 | 12 | #define QLA_DRIVER_MAJOR_VER 8 |
| 13 | #define QLA_DRIVER_MINOR_VER 3 | 13 | #define QLA_DRIVER_MINOR_VER 3 |
diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c index 497b2e718a76..5b773160200f 100644 --- a/drivers/target/iscsi/iscsi_target_parameters.c +++ b/drivers/target/iscsi/iscsi_target_parameters.c | |||
| @@ -1430,7 +1430,7 @@ static int iscsi_enforce_integrity_rules( | |||
| 1430 | u8 DataSequenceInOrder = 0; | 1430 | u8 DataSequenceInOrder = 0; |
| 1431 | u8 ErrorRecoveryLevel = 0, SessionType = 0; | 1431 | u8 ErrorRecoveryLevel = 0, SessionType = 0; |
| 1432 | u8 IFMarker = 0, OFMarker = 0; | 1432 | u8 IFMarker = 0, OFMarker = 0; |
| 1433 | u8 IFMarkInt_Reject = 0, OFMarkInt_Reject = 0; | 1433 | u8 IFMarkInt_Reject = 1, OFMarkInt_Reject = 1; |
| 1434 | u32 FirstBurstLength = 0, MaxBurstLength = 0; | 1434 | u32 FirstBurstLength = 0, MaxBurstLength = 0; |
| 1435 | struct iscsi_param *param = NULL; | 1435 | struct iscsi_param *param = NULL; |
| 1436 | 1436 | ||
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index a0d23bc0fc98..f00137f377b2 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c | |||
| @@ -875,40 +875,6 @@ void iscsit_inc_session_usage_count(struct iscsi_session *sess) | |||
| 875 | } | 875 | } |
| 876 | 876 | ||
| 877 | /* | 877 | /* |
| 878 | * Used before iscsi_do[rx,tx]_data() to determine iov and [rx,tx]_marker | ||
| 879 | * array counts needed for sync and steering. | ||
| 880 | */ | ||
| 881 | static int iscsit_determine_sync_and_steering_counts( | ||
| 882 | struct iscsi_conn *conn, | ||
| 883 | struct iscsi_data_count *count) | ||
| 884 | { | ||
| 885 | u32 length = count->data_length; | ||
| 886 | u32 marker, markint; | ||
| 887 | |||
| 888 | count->sync_and_steering = 1; | ||
| 889 | |||
| 890 | marker = (count->type == ISCSI_RX_DATA) ? | ||
| 891 | conn->of_marker : conn->if_marker; | ||
| 892 | markint = (count->type == ISCSI_RX_DATA) ? | ||
| 893 | (conn->conn_ops->OFMarkInt * 4) : | ||
| 894 | (conn->conn_ops->IFMarkInt * 4); | ||
| 895 | count->ss_iov_count = count->iov_count; | ||
| 896 | |||
| 897 | while (length > 0) { | ||
| 898 | if (length >= marker) { | ||
| 899 | count->ss_iov_count += 3; | ||
| 900 | count->ss_marker_count += 2; | ||
| 901 | |||
| 902 | length -= marker; | ||
| 903 | marker = markint; | ||
| 904 | } else | ||
| 905 | length = 0; | ||
| 906 | } | ||
| 907 | |||
| 908 | return 0; | ||
| 909 | } | ||
| 910 | |||
| 911 | /* | ||
| 912 | * Setup conn->if_marker and conn->of_marker values based upon | 878 | * Setup conn->if_marker and conn->of_marker values based upon |
| 913 | * the initial marker-less interval. (see iSCSI v19 A.2) | 879 | * the initial marker-less interval. (see iSCSI v19 A.2) |
| 914 | */ | 880 | */ |
| @@ -1290,7 +1256,7 @@ int iscsit_fe_sendpage_sg( | |||
| 1290 | struct kvec iov; | 1256 | struct kvec iov; |
| 1291 | u32 tx_hdr_size, data_len; | 1257 | u32 tx_hdr_size, data_len; |
| 1292 | u32 offset = cmd->first_data_sg_off; | 1258 | u32 offset = cmd->first_data_sg_off; |
| 1293 | int tx_sent; | 1259 | int tx_sent, iov_off; |
| 1294 | 1260 | ||
| 1295 | send_hdr: | 1261 | send_hdr: |
| 1296 | tx_hdr_size = ISCSI_HDR_LEN; | 1262 | tx_hdr_size = ISCSI_HDR_LEN; |
| @@ -1310,9 +1276,19 @@ send_hdr: | |||
| 1310 | } | 1276 | } |
| 1311 | 1277 | ||
| 1312 | data_len = cmd->tx_size - tx_hdr_size - cmd->padding; | 1278 | data_len = cmd->tx_size - tx_hdr_size - cmd->padding; |
| 1313 | if (conn->conn_ops->DataDigest) | 1279 | /* |
| 1280 | * Set iov_off used by padding and data digest tx_data() calls below | ||
| 1281 | * in order to determine proper offset into cmd->iov_data[] | ||
| 1282 | */ | ||
| 1283 | if (conn->conn_ops->DataDigest) { | ||
| 1314 | data_len -= ISCSI_CRC_LEN; | 1284 | data_len -= ISCSI_CRC_LEN; |
| 1315 | 1285 | if (cmd->padding) | |
| 1286 | iov_off = (cmd->iov_data_count - 2); | ||
| 1287 | else | ||
| 1288 | iov_off = (cmd->iov_data_count - 1); | ||
| 1289 | } else { | ||
| 1290 | iov_off = (cmd->iov_data_count - 1); | ||
| 1291 | } | ||
| 1316 | /* | 1292 | /* |
| 1317 | * Perform sendpage() for each page in the scatterlist | 1293 | * Perform sendpage() for each page in the scatterlist |
| 1318 | */ | 1294 | */ |
| @@ -1341,8 +1317,7 @@ send_pg: | |||
| 1341 | 1317 | ||
| 1342 | send_padding: | 1318 | send_padding: |
| 1343 | if (cmd->padding) { | 1319 | if (cmd->padding) { |
| 1344 | struct kvec *iov_p = | 1320 | struct kvec *iov_p = &cmd->iov_data[iov_off++]; |
| 1345 | &cmd->iov_data[cmd->iov_data_count-1]; | ||
| 1346 | 1321 | ||
| 1347 | tx_sent = tx_data(conn, iov_p, 1, cmd->padding); | 1322 | tx_sent = tx_data(conn, iov_p, 1, cmd->padding); |
| 1348 | if (cmd->padding != tx_sent) { | 1323 | if (cmd->padding != tx_sent) { |
| @@ -1356,8 +1331,7 @@ send_padding: | |||
| 1356 | 1331 | ||
| 1357 | send_datacrc: | 1332 | send_datacrc: |
| 1358 | if (conn->conn_ops->DataDigest) { | 1333 | if (conn->conn_ops->DataDigest) { |
| 1359 | struct kvec *iov_d = | 1334 | struct kvec *iov_d = &cmd->iov_data[iov_off]; |
| 1360 | &cmd->iov_data[cmd->iov_data_count]; | ||
| 1361 | 1335 | ||
| 1362 | tx_sent = tx_data(conn, iov_d, 1, ISCSI_CRC_LEN); | 1336 | tx_sent = tx_data(conn, iov_d, 1, ISCSI_CRC_LEN); |
| 1363 | if (ISCSI_CRC_LEN != tx_sent) { | 1337 | if (ISCSI_CRC_LEN != tx_sent) { |
| @@ -1431,8 +1405,7 @@ static int iscsit_do_rx_data( | |||
| 1431 | struct iscsi_data_count *count) | 1405 | struct iscsi_data_count *count) |
| 1432 | { | 1406 | { |
| 1433 | int data = count->data_length, rx_loop = 0, total_rx = 0, iov_len; | 1407 | int data = count->data_length, rx_loop = 0, total_rx = 0, iov_len; |
| 1434 | u32 rx_marker_val[count->ss_marker_count], rx_marker_iov = 0; | 1408 | struct kvec *iov_p; |
| 1435 | struct kvec iov[count->ss_iov_count], *iov_p; | ||
| 1436 | struct msghdr msg; | 1409 | struct msghdr msg; |
| 1437 | 1410 | ||
| 1438 | if (!conn || !conn->sock || !conn->conn_ops) | 1411 | if (!conn || !conn->sock || !conn->conn_ops) |
| @@ -1440,93 +1413,8 @@ static int iscsit_do_rx_data( | |||
| 1440 | 1413 | ||
| 1441 | memset(&msg, 0, sizeof(struct msghdr)); | 1414 | memset(&msg, 0, sizeof(struct msghdr)); |
| 1442 | 1415 | ||
| 1443 | if (count->sync_and_steering) { | 1416 | iov_p = count->iov; |
| 1444 | int size = 0; | 1417 | iov_len = count->iov_count; |
| 1445 | u32 i, orig_iov_count = 0; | ||
| 1446 | u32 orig_iov_len = 0, orig_iov_loc = 0; | ||
| 1447 | u32 iov_count = 0, per_iov_bytes = 0; | ||
| 1448 | u32 *rx_marker, old_rx_marker = 0; | ||
| 1449 | struct kvec *iov_record; | ||
| 1450 | |||
| 1451 | memset(&rx_marker_val, 0, | ||
| 1452 | count->ss_marker_count * sizeof(u32)); | ||
| 1453 | memset(&iov, 0, count->ss_iov_count * sizeof(struct kvec)); | ||
| 1454 | |||
| 1455 | iov_record = count->iov; | ||
| 1456 | orig_iov_count = count->iov_count; | ||
| 1457 | rx_marker = &conn->of_marker; | ||
| 1458 | |||
| 1459 | i = 0; | ||
| 1460 | size = data; | ||
| 1461 | orig_iov_len = iov_record[orig_iov_loc].iov_len; | ||
| 1462 | while (size > 0) { | ||
| 1463 | pr_debug("rx_data: #1 orig_iov_len %u," | ||
| 1464 | " orig_iov_loc %u\n", orig_iov_len, orig_iov_loc); | ||
| 1465 | pr_debug("rx_data: #2 rx_marker %u, size" | ||
| 1466 | " %u\n", *rx_marker, size); | ||
| 1467 | |||
| 1468 | if (orig_iov_len >= *rx_marker) { | ||
| 1469 | iov[iov_count].iov_len = *rx_marker; | ||
| 1470 | iov[iov_count++].iov_base = | ||
| 1471 | (iov_record[orig_iov_loc].iov_base + | ||
| 1472 | per_iov_bytes); | ||
| 1473 | |||
| 1474 | iov[iov_count].iov_len = (MARKER_SIZE / 2); | ||
| 1475 | iov[iov_count++].iov_base = | ||
| 1476 | &rx_marker_val[rx_marker_iov++]; | ||
| 1477 | iov[iov_count].iov_len = (MARKER_SIZE / 2); | ||
| 1478 | iov[iov_count++].iov_base = | ||
| 1479 | &rx_marker_val[rx_marker_iov++]; | ||
| 1480 | old_rx_marker = *rx_marker; | ||
| 1481 | |||
| 1482 | /* | ||
| 1483 | * OFMarkInt is in 32-bit words. | ||
| 1484 | */ | ||
| 1485 | *rx_marker = (conn->conn_ops->OFMarkInt * 4); | ||
| 1486 | size -= old_rx_marker; | ||
| 1487 | orig_iov_len -= old_rx_marker; | ||
| 1488 | per_iov_bytes += old_rx_marker; | ||
| 1489 | |||
| 1490 | pr_debug("rx_data: #3 new_rx_marker" | ||
| 1491 | " %u, size %u\n", *rx_marker, size); | ||
| 1492 | } else { | ||
| 1493 | iov[iov_count].iov_len = orig_iov_len; | ||
| 1494 | iov[iov_count++].iov_base = | ||
| 1495 | (iov_record[orig_iov_loc].iov_base + | ||
| 1496 | per_iov_bytes); | ||
| 1497 | |||
| 1498 | per_iov_bytes = 0; | ||
| 1499 | *rx_marker -= orig_iov_len; | ||
| 1500 | size -= orig_iov_len; | ||
| 1501 | |||
| 1502 | if (size) | ||
| 1503 | orig_iov_len = | ||
| 1504 | iov_record[++orig_iov_loc].iov_len; | ||
| 1505 | |||
| 1506 | pr_debug("rx_data: #4 new_rx_marker" | ||
| 1507 | " %u, size %u\n", *rx_marker, size); | ||
| 1508 | } | ||
| 1509 | } | ||
| 1510 | data += (rx_marker_iov * (MARKER_SIZE / 2)); | ||
| 1511 | |||
| 1512 | iov_p = &iov[0]; | ||
| 1513 | iov_len = iov_count; | ||
| 1514 | |||
| 1515 | if (iov_count > count->ss_iov_count) { | ||
| 1516 | pr_err("iov_count: %d, count->ss_iov_count:" | ||
| 1517 | " %d\n", iov_count, count->ss_iov_count); | ||
| 1518 | return -1; | ||
| 1519 | } | ||
| 1520 | if (rx_marker_iov > count->ss_marker_count) { | ||
| 1521 | pr_err("rx_marker_iov: %d, count->ss_marker" | ||
| 1522 | "_count: %d\n", rx_marker_iov, | ||
| 1523 | count->ss_marker_count); | ||
| 1524 | return -1; | ||
| 1525 | } | ||
| 1526 | } else { | ||
| 1527 | iov_p = count->iov; | ||
| 1528 | iov_len = count->iov_count; | ||
| 1529 | } | ||
| 1530 | 1418 | ||
| 1531 | while (total_rx < data) { | 1419 | while (total_rx < data) { |
| 1532 | rx_loop = kernel_recvmsg(conn->sock, &msg, iov_p, iov_len, | 1420 | rx_loop = kernel_recvmsg(conn->sock, &msg, iov_p, iov_len, |
| @@ -1541,16 +1429,6 @@ static int iscsit_do_rx_data( | |||
| 1541 | rx_loop, total_rx, data); | 1429 | rx_loop, total_rx, data); |
| 1542 | } | 1430 | } |
| 1543 | 1431 | ||
| 1544 | if (count->sync_and_steering) { | ||
| 1545 | int j; | ||
| 1546 | for (j = 0; j < rx_marker_iov; j++) { | ||
| 1547 | pr_debug("rx_data: #5 j: %d, offset: %d\n", | ||
| 1548 | j, rx_marker_val[j]); | ||
| 1549 | conn->of_marker_offset = rx_marker_val[j]; | ||
| 1550 | } | ||
| 1551 | total_rx -= (rx_marker_iov * (MARKER_SIZE / 2)); | ||
| 1552 | } | ||
| 1553 | |||
| 1554 | return total_rx; | 1432 | return total_rx; |
| 1555 | } | 1433 | } |
| 1556 | 1434 | ||
| @@ -1559,8 +1437,7 @@ static int iscsit_do_tx_data( | |||
| 1559 | struct iscsi_data_count *count) | 1437 | struct iscsi_data_count *count) |
| 1560 | { | 1438 | { |
| 1561 | int data = count->data_length, total_tx = 0, tx_loop = 0, iov_len; | 1439 | int data = count->data_length, total_tx = 0, tx_loop = 0, iov_len; |
| 1562 | u32 tx_marker_val[count->ss_marker_count], tx_marker_iov = 0; | 1440 | struct kvec *iov_p; |
| 1563 | struct kvec iov[count->ss_iov_count], *iov_p; | ||
| 1564 | struct msghdr msg; | 1441 | struct msghdr msg; |
| 1565 | 1442 | ||
| 1566 | if (!conn || !conn->sock || !conn->conn_ops) | 1443 | if (!conn || !conn->sock || !conn->conn_ops) |
| @@ -1573,98 +1450,8 @@ static int iscsit_do_tx_data( | |||
| 1573 | 1450 | ||
| 1574 | memset(&msg, 0, sizeof(struct msghdr)); | 1451 | memset(&msg, 0, sizeof(struct msghdr)); |
| 1575 | 1452 | ||
| 1576 | if (count->sync_and_steering) { | 1453 | iov_p = count->iov; |
| 1577 | int size = 0; | 1454 | iov_len = count->iov_count; |
| 1578 | u32 i, orig_iov_count = 0; | ||
| 1579 | u32 orig_iov_len = 0, orig_iov_loc = 0; | ||
| 1580 | u32 iov_count = 0, per_iov_bytes = 0; | ||
| 1581 | u32 *tx_marker, old_tx_marker = 0; | ||
| 1582 | struct kvec *iov_record; | ||
| 1583 | |||
| 1584 | memset(&tx_marker_val, 0, | ||
| 1585 | count->ss_marker_count * sizeof(u32)); | ||
| 1586 | memset(&iov, 0, count->ss_iov_count * sizeof(struct kvec)); | ||
| 1587 | |||
| 1588 | iov_record = count->iov; | ||
| 1589 | orig_iov_count = count->iov_count; | ||
| 1590 | tx_marker = &conn->if_marker; | ||
| 1591 | |||
| 1592 | i = 0; | ||
| 1593 | size = data; | ||
| 1594 | orig_iov_len = iov_record[orig_iov_loc].iov_len; | ||
| 1595 | while (size > 0) { | ||
| 1596 | pr_debug("tx_data: #1 orig_iov_len %u," | ||
| 1597 | " orig_iov_loc %u\n", orig_iov_len, orig_iov_loc); | ||
| 1598 | pr_debug("tx_data: #2 tx_marker %u, size" | ||
| 1599 | " %u\n", *tx_marker, size); | ||
| 1600 | |||
| 1601 | if (orig_iov_len >= *tx_marker) { | ||
| 1602 | iov[iov_count].iov_len = *tx_marker; | ||
| 1603 | iov[iov_count++].iov_base = | ||
| 1604 | (iov_record[orig_iov_loc].iov_base + | ||
| 1605 | per_iov_bytes); | ||
| 1606 | |||
| 1607 | tx_marker_val[tx_marker_iov] = | ||
| 1608 | (size - *tx_marker); | ||
| 1609 | iov[iov_count].iov_len = (MARKER_SIZE / 2); | ||
| 1610 | iov[iov_count++].iov_base = | ||
| 1611 | &tx_marker_val[tx_marker_iov++]; | ||
| 1612 | iov[iov_count].iov_len = (MARKER_SIZE / 2); | ||
| 1613 | iov[iov_count++].iov_base = | ||
| 1614 | &tx_marker_val[tx_marker_iov++]; | ||
| 1615 | old_tx_marker = *tx_marker; | ||
| 1616 | |||
| 1617 | /* | ||
| 1618 | * IFMarkInt is in 32-bit words. | ||
| 1619 | */ | ||
| 1620 | *tx_marker = (conn->conn_ops->IFMarkInt * 4); | ||
| 1621 | size -= old_tx_marker; | ||
| 1622 | orig_iov_len -= old_tx_marker; | ||
| 1623 | per_iov_bytes += old_tx_marker; | ||
| 1624 | |||
| 1625 | pr_debug("tx_data: #3 new_tx_marker" | ||
| 1626 | " %u, size %u\n", *tx_marker, size); | ||
| 1627 | pr_debug("tx_data: #4 offset %u\n", | ||
| 1628 | tx_marker_val[tx_marker_iov-1]); | ||
| 1629 | } else { | ||
| 1630 | iov[iov_count].iov_len = orig_iov_len; | ||
| 1631 | iov[iov_count++].iov_base | ||
| 1632 | = (iov_record[orig_iov_loc].iov_base + | ||
| 1633 | per_iov_bytes); | ||
| 1634 | |||
| 1635 | per_iov_bytes = 0; | ||
| 1636 | *tx_marker -= orig_iov_len; | ||
| 1637 | size -= orig_iov_len; | ||
| 1638 | |||
| 1639 | if (size) | ||
| 1640 | orig_iov_len = | ||
| 1641 | iov_record[++orig_iov_loc].iov_len; | ||
| 1642 | |||
| 1643 | pr_debug("tx_data: #5 new_tx_marker" | ||
| 1644 | " %u, size %u\n", *tx_marker, size); | ||
| 1645 | } | ||
| 1646 | } | ||
| 1647 | |||
| 1648 | data += (tx_marker_iov * (MARKER_SIZE / 2)); | ||
| 1649 | |||
| 1650 | iov_p = &iov[0]; | ||
| 1651 | iov_len = iov_count; | ||
| 1652 | |||
| 1653 | if (iov_count > count->ss_iov_count) { | ||
| 1654 | pr_err("iov_count: %d, count->ss_iov_count:" | ||
| 1655 | " %d\n", iov_count, count->ss_iov_count); | ||
| 1656 | return -1; | ||
| 1657 | } | ||
| 1658 | if (tx_marker_iov > count->ss_marker_count) { | ||
| 1659 | pr_err("tx_marker_iov: %d, count->ss_marker" | ||
| 1660 | "_count: %d\n", tx_marker_iov, | ||
| 1661 | count->ss_marker_count); | ||
| 1662 | return -1; | ||
| 1663 | } | ||
| 1664 | } else { | ||
| 1665 | iov_p = count->iov; | ||
| 1666 | iov_len = count->iov_count; | ||
| 1667 | } | ||
| 1668 | 1455 | ||
| 1669 | while (total_tx < data) { | 1456 | while (total_tx < data) { |
| 1670 | tx_loop = kernel_sendmsg(conn->sock, &msg, iov_p, iov_len, | 1457 | tx_loop = kernel_sendmsg(conn->sock, &msg, iov_p, iov_len, |
| @@ -1679,9 +1466,6 @@ static int iscsit_do_tx_data( | |||
| 1679 | tx_loop, total_tx, data); | 1466 | tx_loop, total_tx, data); |
| 1680 | } | 1467 | } |
| 1681 | 1468 | ||
| 1682 | if (count->sync_and_steering) | ||
| 1683 | total_tx -= (tx_marker_iov * (MARKER_SIZE / 2)); | ||
| 1684 | |||
| 1685 | return total_tx; | 1469 | return total_tx; |
| 1686 | } | 1470 | } |
| 1687 | 1471 | ||
| @@ -1702,12 +1486,6 @@ int rx_data( | |||
| 1702 | c.data_length = data; | 1486 | c.data_length = data; |
| 1703 | c.type = ISCSI_RX_DATA; | 1487 | c.type = ISCSI_RX_DATA; |
| 1704 | 1488 | ||
| 1705 | if (conn->conn_ops->OFMarker && | ||
| 1706 | (conn->conn_state >= TARG_CONN_STATE_LOGGED_IN)) { | ||
| 1707 | if (iscsit_determine_sync_and_steering_counts(conn, &c) < 0) | ||
| 1708 | return -1; | ||
| 1709 | } | ||
| 1710 | |||
| 1711 | return iscsit_do_rx_data(conn, &c); | 1489 | return iscsit_do_rx_data(conn, &c); |
| 1712 | } | 1490 | } |
| 1713 | 1491 | ||
| @@ -1728,12 +1506,6 @@ int tx_data( | |||
| 1728 | c.data_length = data; | 1506 | c.data_length = data; |
| 1729 | c.type = ISCSI_TX_DATA; | 1507 | c.type = ISCSI_TX_DATA; |
| 1730 | 1508 | ||
| 1731 | if (conn->conn_ops->IFMarker && | ||
| 1732 | (conn->conn_state >= TARG_CONN_STATE_LOGGED_IN)) { | ||
| 1733 | if (iscsit_determine_sync_and_steering_counts(conn, &c) < 0) | ||
| 1734 | return -1; | ||
| 1735 | } | ||
| 1736 | |||
| 1737 | return iscsit_do_tx_data(conn, &c); | 1509 | return iscsit_do_tx_data(conn, &c); |
| 1738 | } | 1510 | } |
| 1739 | 1511 | ||
diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c index 89ae923c5da6..f04d4ef99dca 100644 --- a/drivers/target/target_core_cdb.c +++ b/drivers/target/target_core_cdb.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | */ | 24 | */ |
| 25 | 25 | ||
| 26 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
| 27 | #include <linux/ctype.h> | ||
| 27 | #include <asm/unaligned.h> | 28 | #include <asm/unaligned.h> |
| 28 | #include <scsi/scsi.h> | 29 | #include <scsi/scsi.h> |
| 29 | 30 | ||
| @@ -154,6 +155,37 @@ target_emulate_evpd_80(struct se_cmd *cmd, unsigned char *buf) | |||
| 154 | return 0; | 155 | return 0; |
| 155 | } | 156 | } |
| 156 | 157 | ||
| 158 | static void | ||
| 159 | target_parse_naa_6h_vendor_specific(struct se_device *dev, unsigned char *buf_off) | ||
| 160 | { | ||
| 161 | unsigned char *p = &dev->se_sub_dev->t10_wwn.unit_serial[0]; | ||
| 162 | unsigned char *buf = buf_off; | ||
| 163 | int cnt = 0, next = 1; | ||
| 164 | /* | ||
| 165 | * Generate up to 36 bits of VENDOR SPECIFIC IDENTIFIER starting on | ||
| 166 | * byte 3 bit 3-0 for NAA IEEE Registered Extended DESIGNATOR field | ||
| 167 | * format, followed by 64 bits of VENDOR SPECIFIC IDENTIFIER EXTENSION | ||
| 168 | * to complete the payload. These are based from VPD=0x80 PRODUCT SERIAL | ||
| 169 | * NUMBER set via vpd_unit_serial in target_core_configfs.c to ensure | ||
| 170 | * per device uniqeness. | ||
| 171 | */ | ||
| 172 | while (*p != '\0') { | ||
| 173 | if (cnt >= 13) | ||
| 174 | break; | ||
| 175 | if (!isxdigit(*p)) { | ||
| 176 | p++; | ||
| 177 | continue; | ||
| 178 | } | ||
| 179 | if (next != 0) { | ||
| 180 | buf[cnt++] |= hex_to_bin(*p++); | ||
| 181 | next = 0; | ||
| 182 | } else { | ||
| 183 | buf[cnt] = hex_to_bin(*p++) << 4; | ||
| 184 | next = 1; | ||
| 185 | } | ||
| 186 | } | ||
| 187 | } | ||
| 188 | |||
| 157 | /* | 189 | /* |
| 158 | * Device identification VPD, for a complete list of | 190 | * Device identification VPD, for a complete list of |
| 159 | * DESIGNATOR TYPEs see spc4r17 Table 459. | 191 | * DESIGNATOR TYPEs see spc4r17 Table 459. |
| @@ -219,8 +251,7 @@ target_emulate_evpd_83(struct se_cmd *cmd, unsigned char *buf) | |||
| 219 | * VENDOR_SPECIFIC_IDENTIFIER and | 251 | * VENDOR_SPECIFIC_IDENTIFIER and |
| 220 | * VENDOR_SPECIFIC_IDENTIFIER_EXTENTION | 252 | * VENDOR_SPECIFIC_IDENTIFIER_EXTENTION |
| 221 | */ | 253 | */ |
| 222 | buf[off++] |= hex_to_bin(dev->se_sub_dev->t10_wwn.unit_serial[0]); | 254 | target_parse_naa_6h_vendor_specific(dev, &buf[off]); |
| 223 | hex2bin(&buf[off], &dev->se_sub_dev->t10_wwn.unit_serial[1], 12); | ||
| 224 | 255 | ||
| 225 | len = 20; | 256 | len = 20; |
| 226 | off = (len + 4); | 257 | off = (len + 4); |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 8d0c58ea6316..a4b0a8d27f25 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
| @@ -977,15 +977,17 @@ static void target_qf_do_work(struct work_struct *work) | |||
| 977 | { | 977 | { |
| 978 | struct se_device *dev = container_of(work, struct se_device, | 978 | struct se_device *dev = container_of(work, struct se_device, |
| 979 | qf_work_queue); | 979 | qf_work_queue); |
| 980 | LIST_HEAD(qf_cmd_list); | ||
| 980 | struct se_cmd *cmd, *cmd_tmp; | 981 | struct se_cmd *cmd, *cmd_tmp; |
| 981 | 982 | ||
| 982 | spin_lock_irq(&dev->qf_cmd_lock); | 983 | spin_lock_irq(&dev->qf_cmd_lock); |
| 983 | list_for_each_entry_safe(cmd, cmd_tmp, &dev->qf_cmd_list, se_qf_node) { | 984 | list_splice_init(&dev->qf_cmd_list, &qf_cmd_list); |
| 985 | spin_unlock_irq(&dev->qf_cmd_lock); | ||
| 984 | 986 | ||
| 987 | list_for_each_entry_safe(cmd, cmd_tmp, &qf_cmd_list, se_qf_node) { | ||
| 985 | list_del(&cmd->se_qf_node); | 988 | list_del(&cmd->se_qf_node); |
| 986 | atomic_dec(&dev->dev_qf_count); | 989 | atomic_dec(&dev->dev_qf_count); |
| 987 | smp_mb__after_atomic_dec(); | 990 | smp_mb__after_atomic_dec(); |
| 988 | spin_unlock_irq(&dev->qf_cmd_lock); | ||
| 989 | 991 | ||
| 990 | pr_debug("Processing %s cmd: %p QUEUE_FULL in work queue" | 992 | pr_debug("Processing %s cmd: %p QUEUE_FULL in work queue" |
| 991 | " context: %s\n", cmd->se_tfo->get_fabric_name(), cmd, | 993 | " context: %s\n", cmd->se_tfo->get_fabric_name(), cmd, |
| @@ -997,10 +999,7 @@ static void target_qf_do_work(struct work_struct *work) | |||
| 997 | * has been added to head of queue | 999 | * has been added to head of queue |
| 998 | */ | 1000 | */ |
| 999 | transport_add_cmd_to_queue(cmd, cmd->t_state); | 1001 | transport_add_cmd_to_queue(cmd, cmd->t_state); |
| 1000 | |||
| 1001 | spin_lock_irq(&dev->qf_cmd_lock); | ||
| 1002 | } | 1002 | } |
| 1003 | spin_unlock_irq(&dev->qf_cmd_lock); | ||
| 1004 | } | 1003 | } |
| 1005 | 1004 | ||
| 1006 | unsigned char *transport_dump_cmd_direction(struct se_cmd *cmd) | 1005 | unsigned char *transport_dump_cmd_direction(struct se_cmd *cmd) |
diff --git a/drivers/target/tcm_fc/tcm_fc.h b/drivers/target/tcm_fc/tcm_fc.h index bd4fe21a23b8..3749d8b4b423 100644 --- a/drivers/target/tcm_fc/tcm_fc.h +++ b/drivers/target/tcm_fc/tcm_fc.h | |||
| @@ -98,8 +98,7 @@ struct ft_tpg { | |||
| 98 | struct list_head list; /* linkage in ft_lport_acl tpg_list */ | 98 | struct list_head list; /* linkage in ft_lport_acl tpg_list */ |
| 99 | struct list_head lun_list; /* head of LUNs */ | 99 | struct list_head lun_list; /* head of LUNs */ |
| 100 | struct se_portal_group se_tpg; | 100 | struct se_portal_group se_tpg; |
| 101 | struct task_struct *thread; /* processing thread */ | 101 | struct workqueue_struct *workqueue; |
| 102 | struct se_queue_obj qobj; /* queue for processing thread */ | ||
| 103 | }; | 102 | }; |
| 104 | 103 | ||
| 105 | struct ft_lport_acl { | 104 | struct ft_lport_acl { |
| @@ -110,16 +109,10 @@ struct ft_lport_acl { | |||
| 110 | struct se_wwn fc_lport_wwn; | 109 | struct se_wwn fc_lport_wwn; |
| 111 | }; | 110 | }; |
| 112 | 111 | ||
| 113 | enum ft_cmd_state { | ||
| 114 | FC_CMD_ST_NEW = 0, | ||
| 115 | FC_CMD_ST_REJ | ||
| 116 | }; | ||
| 117 | |||
| 118 | /* | 112 | /* |
| 119 | * Commands | 113 | * Commands |
| 120 | */ | 114 | */ |
| 121 | struct ft_cmd { | 115 | struct ft_cmd { |
| 122 | enum ft_cmd_state state; | ||
| 123 | u32 lun; /* LUN from request */ | 116 | u32 lun; /* LUN from request */ |
| 124 | struct ft_sess *sess; /* session held for cmd */ | 117 | struct ft_sess *sess; /* session held for cmd */ |
| 125 | struct fc_seq *seq; /* sequence in exchange mgr */ | 118 | struct fc_seq *seq; /* sequence in exchange mgr */ |
| @@ -127,7 +120,7 @@ struct ft_cmd { | |||
| 127 | struct fc_frame *req_frame; | 120 | struct fc_frame *req_frame; |
| 128 | unsigned char *cdb; /* pointer to CDB inside frame */ | 121 | unsigned char *cdb; /* pointer to CDB inside frame */ |
| 129 | u32 write_data_len; /* data received on writes */ | 122 | u32 write_data_len; /* data received on writes */ |
| 130 | struct se_queue_req se_req; | 123 | struct work_struct work; |
| 131 | /* Local sense buffer */ | 124 | /* Local sense buffer */ |
| 132 | unsigned char ft_sense_buffer[TRANSPORT_SENSE_BUFFER]; | 125 | unsigned char ft_sense_buffer[TRANSPORT_SENSE_BUFFER]; |
| 133 | u32 was_ddp_setup:1; /* Set only if ddp is setup */ | 126 | u32 was_ddp_setup:1; /* Set only if ddp is setup */ |
| @@ -177,7 +170,6 @@ int ft_is_state_remove(struct se_cmd *); | |||
| 177 | /* | 170 | /* |
| 178 | * other internal functions. | 171 | * other internal functions. |
| 179 | */ | 172 | */ |
| 180 | int ft_thread(void *); | ||
| 181 | void ft_recv_req(struct ft_sess *, struct fc_frame *); | 173 | void ft_recv_req(struct ft_sess *, struct fc_frame *); |
| 182 | struct ft_tpg *ft_lport_find_tpg(struct fc_lport *); | 174 | struct ft_tpg *ft_lport_find_tpg(struct fc_lport *); |
| 183 | struct ft_node_acl *ft_acl_get(struct ft_tpg *, struct fc_rport_priv *); | 175 | struct ft_node_acl *ft_acl_get(struct ft_tpg *, struct fc_rport_priv *); |
diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index 5654dc22f7ae..80fbcde00cb6 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c | |||
| @@ -62,8 +62,8 @@ void ft_dump_cmd(struct ft_cmd *cmd, const char *caller) | |||
| 62 | int count; | 62 | int count; |
| 63 | 63 | ||
| 64 | se_cmd = &cmd->se_cmd; | 64 | se_cmd = &cmd->se_cmd; |
| 65 | pr_debug("%s: cmd %p state %d sess %p seq %p se_cmd %p\n", | 65 | pr_debug("%s: cmd %p sess %p seq %p se_cmd %p\n", |
| 66 | caller, cmd, cmd->state, cmd->sess, cmd->seq, se_cmd); | 66 | caller, cmd, cmd->sess, cmd->seq, se_cmd); |
| 67 | pr_debug("%s: cmd %p cdb %p\n", | 67 | pr_debug("%s: cmd %p cdb %p\n", |
| 68 | caller, cmd, cmd->cdb); | 68 | caller, cmd, cmd->cdb); |
| 69 | pr_debug("%s: cmd %p lun %d\n", caller, cmd, cmd->lun); | 69 | pr_debug("%s: cmd %p lun %d\n", caller, cmd, cmd->lun); |
| @@ -90,38 +90,6 @@ void ft_dump_cmd(struct ft_cmd *cmd, const char *caller) | |||
| 90 | 16, 4, cmd->cdb, MAX_COMMAND_SIZE, 0); | 90 | 16, 4, cmd->cdb, MAX_COMMAND_SIZE, 0); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | static void ft_queue_cmd(struct ft_sess *sess, struct ft_cmd *cmd) | ||
| 94 | { | ||
| 95 | struct ft_tpg *tpg = sess->tport->tpg; | ||
| 96 | struct se_queue_obj *qobj = &tpg->qobj; | ||
| 97 | unsigned long flags; | ||
| 98 | |||
| 99 | qobj = &sess->tport->tpg->qobj; | ||
| 100 | spin_lock_irqsave(&qobj->cmd_queue_lock, flags); | ||
| 101 | list_add_tail(&cmd->se_req.qr_list, &qobj->qobj_list); | ||
| 102 | atomic_inc(&qobj->queue_cnt); | ||
| 103 | spin_unlock_irqrestore(&qobj->cmd_queue_lock, flags); | ||
| 104 | |||
| 105 | wake_up_process(tpg->thread); | ||
| 106 | } | ||
| 107 | |||
| 108 | static struct ft_cmd *ft_dequeue_cmd(struct se_queue_obj *qobj) | ||
| 109 | { | ||
| 110 | unsigned long flags; | ||
| 111 | struct se_queue_req *qr; | ||
| 112 | |||
| 113 | spin_lock_irqsave(&qobj->cmd_queue_lock, flags); | ||
| 114 | if (list_empty(&qobj->qobj_list)) { | ||
| 115 | spin_unlock_irqrestore(&qobj->cmd_queue_lock, flags); | ||
| 116 | return NULL; | ||
| 117 | } | ||
| 118 | qr = list_first_entry(&qobj->qobj_list, struct se_queue_req, qr_list); | ||
| 119 | list_del(&qr->qr_list); | ||
| 120 | atomic_dec(&qobj->queue_cnt); | ||
| 121 | spin_unlock_irqrestore(&qobj->cmd_queue_lock, flags); | ||
| 122 | return container_of(qr, struct ft_cmd, se_req); | ||
| 123 | } | ||
| 124 | |||
| 125 | static void ft_free_cmd(struct ft_cmd *cmd) | 93 | static void ft_free_cmd(struct ft_cmd *cmd) |
| 126 | { | 94 | { |
| 127 | struct fc_frame *fp; | 95 | struct fc_frame *fp; |
| @@ -282,9 +250,7 @@ u32 ft_get_task_tag(struct se_cmd *se_cmd) | |||
| 282 | 250 | ||
| 283 | int ft_get_cmd_state(struct se_cmd *se_cmd) | 251 | int ft_get_cmd_state(struct se_cmd *se_cmd) |
| 284 | { | 252 | { |
| 285 | struct ft_cmd *cmd = container_of(se_cmd, struct ft_cmd, se_cmd); | 253 | return 0; |
| 286 | |||
| 287 | return cmd->state; | ||
| 288 | } | 254 | } |
| 289 | 255 | ||
| 290 | int ft_is_state_remove(struct se_cmd *se_cmd) | 256 | int ft_is_state_remove(struct se_cmd *se_cmd) |
| @@ -505,6 +471,8 @@ int ft_queue_tm_resp(struct se_cmd *se_cmd) | |||
| 505 | return 0; | 471 | return 0; |
| 506 | } | 472 | } |
| 507 | 473 | ||
| 474 | static void ft_send_work(struct work_struct *work); | ||
| 475 | |||
| 508 | /* | 476 | /* |
| 509 | * Handle incoming FCP command. | 477 | * Handle incoming FCP command. |
| 510 | */ | 478 | */ |
| @@ -523,7 +491,9 @@ static void ft_recv_cmd(struct ft_sess *sess, struct fc_frame *fp) | |||
| 523 | goto busy; | 491 | goto busy; |
| 524 | } | 492 | } |
| 525 | cmd->req_frame = fp; /* hold frame during cmd */ | 493 | cmd->req_frame = fp; /* hold frame during cmd */ |
| 526 | ft_queue_cmd(sess, cmd); | 494 | |
| 495 | INIT_WORK(&cmd->work, ft_send_work); | ||
| 496 | queue_work(sess->tport->tpg->workqueue, &cmd->work); | ||
| 527 | return; | 497 | return; |
| 528 | 498 | ||
| 529 | busy: | 499 | busy: |
| @@ -563,12 +533,13 @@ void ft_recv_req(struct ft_sess *sess, struct fc_frame *fp) | |||
| 563 | /* | 533 | /* |
| 564 | * Send new command to target. | 534 | * Send new command to target. |
| 565 | */ | 535 | */ |
| 566 | static void ft_send_cmd(struct ft_cmd *cmd) | 536 | static void ft_send_work(struct work_struct *work) |
| 567 | { | 537 | { |
| 538 | struct ft_cmd *cmd = container_of(work, struct ft_cmd, work); | ||
| 568 | struct fc_frame_header *fh = fc_frame_header_get(cmd->req_frame); | 539 | struct fc_frame_header *fh = fc_frame_header_get(cmd->req_frame); |
| 569 | struct se_cmd *se_cmd; | 540 | struct se_cmd *se_cmd; |
| 570 | struct fcp_cmnd *fcp; | 541 | struct fcp_cmnd *fcp; |
| 571 | int data_dir; | 542 | int data_dir = 0; |
| 572 | u32 data_len; | 543 | u32 data_len; |
| 573 | int task_attr; | 544 | int task_attr; |
| 574 | int ret; | 545 | int ret; |
| @@ -675,42 +646,3 @@ static void ft_send_cmd(struct ft_cmd *cmd) | |||
| 675 | err: | 646 | err: |
| 676 | ft_send_resp_code_and_free(cmd, FCP_CMND_FIELDS_INVALID); | 647 | ft_send_resp_code_and_free(cmd, FCP_CMND_FIELDS_INVALID); |
| 677 | } | 648 | } |
| 678 | |||
| 679 | /* | ||
| 680 | * Handle request in the command thread. | ||
| 681 | */ | ||
| 682 | static void ft_exec_req(struct ft_cmd *cmd) | ||
| 683 | { | ||
| 684 | pr_debug("cmd state %x\n", cmd->state); | ||
| 685 | switch (cmd->state) { | ||
| 686 | case FC_CMD_ST_NEW: | ||
| 687 | ft_send_cmd(cmd); | ||
| 688 | break; | ||
| 689 | default: | ||
| 690 | break; | ||
| 691 | } | ||
| 692 | } | ||
| 693 | |||
| 694 | /* | ||
| 695 | * Processing thread. | ||
| 696 | * Currently one thread per tpg. | ||
| 697 | */ | ||
| 698 | int ft_thread(void *arg) | ||
| 699 | { | ||
| 700 | struct ft_tpg *tpg = arg; | ||
| 701 | struct se_queue_obj *qobj = &tpg->qobj; | ||
| 702 | struct ft_cmd *cmd; | ||
| 703 | |||
| 704 | while (!kthread_should_stop()) { | ||
| 705 | schedule_timeout_interruptible(MAX_SCHEDULE_TIMEOUT); | ||
| 706 | if (kthread_should_stop()) | ||
| 707 | goto out; | ||
| 708 | |||
| 709 | cmd = ft_dequeue_cmd(qobj); | ||
| 710 | if (cmd) | ||
| 711 | ft_exec_req(cmd); | ||
| 712 | } | ||
| 713 | |||
| 714 | out: | ||
| 715 | return 0; | ||
| 716 | } | ||
diff --git a/drivers/target/tcm_fc/tfc_conf.c b/drivers/target/tcm_fc/tfc_conf.c index b15879d43e22..8fa39b74f22c 100644 --- a/drivers/target/tcm_fc/tfc_conf.c +++ b/drivers/target/tcm_fc/tfc_conf.c | |||
| @@ -327,7 +327,6 @@ static struct se_portal_group *ft_add_tpg( | |||
| 327 | tpg->index = index; | 327 | tpg->index = index; |
| 328 | tpg->lport_acl = lacl; | 328 | tpg->lport_acl = lacl; |
| 329 | INIT_LIST_HEAD(&tpg->lun_list); | 329 | INIT_LIST_HEAD(&tpg->lun_list); |
| 330 | transport_init_queue_obj(&tpg->qobj); | ||
| 331 | 330 | ||
| 332 | ret = core_tpg_register(&ft_configfs->tf_ops, wwn, &tpg->se_tpg, | 331 | ret = core_tpg_register(&ft_configfs->tf_ops, wwn, &tpg->se_tpg, |
| 333 | tpg, TRANSPORT_TPG_TYPE_NORMAL); | 332 | tpg, TRANSPORT_TPG_TYPE_NORMAL); |
| @@ -336,8 +335,8 @@ static struct se_portal_group *ft_add_tpg( | |||
| 336 | return NULL; | 335 | return NULL; |
| 337 | } | 336 | } |
| 338 | 337 | ||
| 339 | tpg->thread = kthread_run(ft_thread, tpg, "ft_tpg%lu", index); | 338 | tpg->workqueue = alloc_workqueue("tcm_fc", 0, 1); |
| 340 | if (IS_ERR(tpg->thread)) { | 339 | if (!tpg->workqueue) { |
| 341 | kfree(tpg); | 340 | kfree(tpg); |
| 342 | return NULL; | 341 | return NULL; |
| 343 | } | 342 | } |
| @@ -356,7 +355,7 @@ static void ft_del_tpg(struct se_portal_group *se_tpg) | |||
| 356 | pr_debug("del tpg %s\n", | 355 | pr_debug("del tpg %s\n", |
| 357 | config_item_name(&tpg->se_tpg.tpg_group.cg_item)); | 356 | config_item_name(&tpg->se_tpg.tpg_group.cg_item)); |
| 358 | 357 | ||
| 359 | kthread_stop(tpg->thread); | 358 | destroy_workqueue(tpg->workqueue); |
| 360 | 359 | ||
| 361 | /* Wait for sessions to be freed thru RCU, for BUG_ON below */ | 360 | /* Wait for sessions to be freed thru RCU, for BUG_ON below */ |
| 362 | synchronize_rcu(); | 361 | synchronize_rcu(); |
diff --git a/drivers/target/tcm_fc/tfc_io.c b/drivers/target/tcm_fc/tfc_io.c index c37f4cd96452..d35ea5a3d56c 100644 --- a/drivers/target/tcm_fc/tfc_io.c +++ b/drivers/target/tcm_fc/tfc_io.c | |||
| @@ -219,43 +219,41 @@ void ft_recv_write_data(struct ft_cmd *cmd, struct fc_frame *fp) | |||
| 219 | if (cmd->was_ddp_setup) { | 219 | if (cmd->was_ddp_setup) { |
| 220 | BUG_ON(!ep); | 220 | BUG_ON(!ep); |
| 221 | BUG_ON(!lport); | 221 | BUG_ON(!lport); |
| 222 | } | 222 | /* |
| 223 | 223 | * Since DDP (Large Rx offload) was setup for this request, | |
| 224 | /* | 224 | * payload is expected to be copied directly to user buffers. |
| 225 | * Doesn't expect payload if DDP is setup. Payload | 225 | */ |
| 226 | * is expected to be copied directly to user buffers | 226 | buf = fc_frame_payload_get(fp, 1); |
| 227 | * due to DDP (Large Rx offload), | 227 | if (buf) |
| 228 | */ | 228 | pr_err("%s: xid 0x%x, f_ctl 0x%x, cmd->sg %p, " |
| 229 | buf = fc_frame_payload_get(fp, 1); | ||
| 230 | if (buf) | ||
| 231 | pr_err("%s: xid 0x%x, f_ctl 0x%x, cmd->sg %p, " | ||
| 232 | "cmd->sg_cnt 0x%x. DDP was setup" | 229 | "cmd->sg_cnt 0x%x. DDP was setup" |
| 233 | " hence not expected to receive frame with " | 230 | " hence not expected to receive frame with " |
| 234 | "payload, Frame will be dropped if " | 231 | "payload, Frame will be dropped if" |
| 235 | "'Sequence Initiative' bit in f_ctl is " | 232 | "'Sequence Initiative' bit in f_ctl is" |
| 236 | "not set\n", __func__, ep->xid, f_ctl, | 233 | "not set\n", __func__, ep->xid, f_ctl, |
| 237 | cmd->sg, cmd->sg_cnt); | 234 | cmd->sg, cmd->sg_cnt); |
| 238 | /* | 235 | /* |
| 239 | * Invalidate HW DDP context if it was setup for respective | 236 | * Invalidate HW DDP context if it was setup for respective |
| 240 | * command. Invalidation of HW DDP context is requited in both | 237 | * command. Invalidation of HW DDP context is requited in both |
| 241 | * situation (success and error). | 238 | * situation (success and error). |
| 242 | */ | 239 | */ |
| 243 | ft_invl_hw_context(cmd); | 240 | ft_invl_hw_context(cmd); |
| 244 | 241 | ||
| 245 | /* | 242 | /* |
| 246 | * If "Sequence Initiative (TSI)" bit set in f_ctl, means last | 243 | * If "Sequence Initiative (TSI)" bit set in f_ctl, means last |
| 247 | * write data frame is received successfully where payload is | 244 | * write data frame is received successfully where payload is |
| 248 | * posted directly to user buffer and only the last frame's | 245 | * posted directly to user buffer and only the last frame's |
| 249 | * header is posted in receive queue. | 246 | * header is posted in receive queue. |
| 250 | * | 247 | * |
| 251 | * If "Sequence Initiative (TSI)" bit is not set, means error | 248 | * If "Sequence Initiative (TSI)" bit is not set, means error |
| 252 | * condition w.r.t. DDP, hence drop the packet and let explict | 249 | * condition w.r.t. DDP, hence drop the packet and let explict |
| 253 | * ABORTS from other end of exchange timer trigger the recovery. | 250 | * ABORTS from other end of exchange timer trigger the recovery. |
| 254 | */ | 251 | */ |
| 255 | if (f_ctl & FC_FC_SEQ_INIT) | 252 | if (f_ctl & FC_FC_SEQ_INIT) |
| 256 | goto last_frame; | 253 | goto last_frame; |
| 257 | else | 254 | else |
| 258 | goto drop; | 255 | goto drop; |
| 256 | } | ||
| 259 | 257 | ||
| 260 | rel_off = ntohl(fh->fh_parm_offset); | 258 | rel_off = ntohl(fh->fh_parm_offset); |
| 261 | frame_len = fr_len(fp); | 259 | frame_len = fr_len(fp); |
diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c index 225123b37f19..58be715913cd 100644 --- a/drivers/tty/serial/crisv10.c +++ b/drivers/tty/serial/crisv10.c | |||
| @@ -4450,7 +4450,7 @@ static int __init rs_init(void) | |||
| 4450 | 4450 | ||
| 4451 | #if defined(CONFIG_ETRAX_RS485) | 4451 | #if defined(CONFIG_ETRAX_RS485) |
| 4452 | #if defined(CONFIG_ETRAX_RS485_ON_PA) | 4452 | #if defined(CONFIG_ETRAX_RS485_ON_PA) |
| 4453 | if (cris_io_interface_allocate_pins(if_ser0, 'a', rs485_pa_bit, | 4453 | if (cris_io_interface_allocate_pins(if_serial_0, 'a', rs485_pa_bit, |
| 4454 | rs485_pa_bit)) { | 4454 | rs485_pa_bit)) { |
| 4455 | printk(KERN_CRIT "ETRAX100LX serial: Could not allocate " | 4455 | printk(KERN_CRIT "ETRAX100LX serial: Could not allocate " |
| 4456 | "RS485 pin\n"); | 4456 | "RS485 pin\n"); |
| @@ -4459,7 +4459,7 @@ static int __init rs_init(void) | |||
| 4459 | } | 4459 | } |
| 4460 | #endif | 4460 | #endif |
| 4461 | #if defined(CONFIG_ETRAX_RS485_ON_PORT_G) | 4461 | #if defined(CONFIG_ETRAX_RS485_ON_PORT_G) |
| 4462 | if (cris_io_interface_allocate_pins(if_ser0, 'g', rs485_pa_bit, | 4462 | if (cris_io_interface_allocate_pins(if_serial_0, 'g', rs485_pa_bit, |
| 4463 | rs485_port_g_bit)) { | 4463 | rs485_port_g_bit)) { |
| 4464 | printk(KERN_CRIT "ETRAX100LX serial: Could not allocate " | 4464 | printk(KERN_CRIT "ETRAX100LX serial: Could not allocate " |
| 4465 | "RS485 pin\n"); | 4465 | "RS485 pin\n"); |
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index da70f5c32eb9..7523719bf8a4 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
| @@ -54,7 +54,7 @@ | |||
| 54 | * This lock protects updates to the following mapping and reference-count | 54 | * This lock protects updates to the following mapping and reference-count |
| 55 | * arrays. The lock does not need to be acquired to read the mapping tables. | 55 | * arrays. The lock does not need to be acquired to read the mapping tables. |
| 56 | */ | 56 | */ |
| 57 | static DEFINE_SPINLOCK(irq_mapping_update_lock); | 57 | static DEFINE_MUTEX(irq_mapping_update_lock); |
| 58 | 58 | ||
| 59 | static LIST_HEAD(xen_irq_list_head); | 59 | static LIST_HEAD(xen_irq_list_head); |
| 60 | 60 | ||
| @@ -631,7 +631,7 @@ int xen_bind_pirq_gsi_to_irq(unsigned gsi, | |||
| 631 | int irq = -1; | 631 | int irq = -1; |
| 632 | struct physdev_irq irq_op; | 632 | struct physdev_irq irq_op; |
| 633 | 633 | ||
| 634 | spin_lock(&irq_mapping_update_lock); | 634 | mutex_lock(&irq_mapping_update_lock); |
| 635 | 635 | ||
| 636 | irq = find_irq_by_gsi(gsi); | 636 | irq = find_irq_by_gsi(gsi); |
| 637 | if (irq != -1) { | 637 | if (irq != -1) { |
| @@ -684,7 +684,7 @@ int xen_bind_pirq_gsi_to_irq(unsigned gsi, | |||
| 684 | handle_edge_irq, name); | 684 | handle_edge_irq, name); |
| 685 | 685 | ||
| 686 | out: | 686 | out: |
| 687 | spin_unlock(&irq_mapping_update_lock); | 687 | mutex_unlock(&irq_mapping_update_lock); |
| 688 | 688 | ||
| 689 | return irq; | 689 | return irq; |
| 690 | } | 690 | } |
| @@ -710,7 +710,7 @@ int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct msi_desc *msidesc, | |||
| 710 | { | 710 | { |
| 711 | int irq, ret; | 711 | int irq, ret; |
| 712 | 712 | ||
| 713 | spin_lock(&irq_mapping_update_lock); | 713 | mutex_lock(&irq_mapping_update_lock); |
| 714 | 714 | ||
| 715 | irq = xen_allocate_irq_dynamic(); | 715 | irq = xen_allocate_irq_dynamic(); |
| 716 | if (irq == -1) | 716 | if (irq == -1) |
| @@ -724,10 +724,10 @@ int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct msi_desc *msidesc, | |||
| 724 | if (ret < 0) | 724 | if (ret < 0) |
| 725 | goto error_irq; | 725 | goto error_irq; |
| 726 | out: | 726 | out: |
| 727 | spin_unlock(&irq_mapping_update_lock); | 727 | mutex_unlock(&irq_mapping_update_lock); |
| 728 | return irq; | 728 | return irq; |
| 729 | error_irq: | 729 | error_irq: |
| 730 | spin_unlock(&irq_mapping_update_lock); | 730 | mutex_unlock(&irq_mapping_update_lock); |
| 731 | xen_free_irq(irq); | 731 | xen_free_irq(irq); |
| 732 | return -1; | 732 | return -1; |
| 733 | } | 733 | } |
| @@ -740,7 +740,7 @@ int xen_destroy_irq(int irq) | |||
| 740 | struct irq_info *info = info_for_irq(irq); | 740 | struct irq_info *info = info_for_irq(irq); |
| 741 | int rc = -ENOENT; | 741 | int rc = -ENOENT; |
| 742 | 742 | ||
| 743 | spin_lock(&irq_mapping_update_lock); | 743 | mutex_lock(&irq_mapping_update_lock); |
| 744 | 744 | ||
| 745 | desc = irq_to_desc(irq); | 745 | desc = irq_to_desc(irq); |
| 746 | if (!desc) | 746 | if (!desc) |
| @@ -766,7 +766,7 @@ int xen_destroy_irq(int irq) | |||
| 766 | xen_free_irq(irq); | 766 | xen_free_irq(irq); |
| 767 | 767 | ||
| 768 | out: | 768 | out: |
| 769 | spin_unlock(&irq_mapping_update_lock); | 769 | mutex_unlock(&irq_mapping_update_lock); |
| 770 | return rc; | 770 | return rc; |
| 771 | } | 771 | } |
| 772 | 772 | ||
| @@ -776,7 +776,7 @@ int xen_irq_from_pirq(unsigned pirq) | |||
| 776 | 776 | ||
| 777 | struct irq_info *info; | 777 | struct irq_info *info; |
| 778 | 778 | ||
| 779 | spin_lock(&irq_mapping_update_lock); | 779 | mutex_lock(&irq_mapping_update_lock); |
| 780 | 780 | ||
| 781 | list_for_each_entry(info, &xen_irq_list_head, list) { | 781 | list_for_each_entry(info, &xen_irq_list_head, list) { |
| 782 | if (info == NULL || info->type != IRQT_PIRQ) | 782 | if (info == NULL || info->type != IRQT_PIRQ) |
| @@ -787,7 +787,7 @@ int xen_irq_from_pirq(unsigned pirq) | |||
| 787 | } | 787 | } |
| 788 | irq = -1; | 788 | irq = -1; |
| 789 | out: | 789 | out: |
| 790 | spin_unlock(&irq_mapping_update_lock); | 790 | mutex_unlock(&irq_mapping_update_lock); |
| 791 | 791 | ||
| 792 | return irq; | 792 | return irq; |
| 793 | } | 793 | } |
| @@ -802,7 +802,7 @@ int bind_evtchn_to_irq(unsigned int evtchn) | |||
| 802 | { | 802 | { |
| 803 | int irq; | 803 | int irq; |
| 804 | 804 | ||
| 805 | spin_lock(&irq_mapping_update_lock); | 805 | mutex_lock(&irq_mapping_update_lock); |
| 806 | 806 | ||
| 807 | irq = evtchn_to_irq[evtchn]; | 807 | irq = evtchn_to_irq[evtchn]; |
| 808 | 808 | ||
| @@ -818,7 +818,7 @@ int bind_evtchn_to_irq(unsigned int evtchn) | |||
| 818 | } | 818 | } |
| 819 | 819 | ||
| 820 | out: | 820 | out: |
| 821 | spin_unlock(&irq_mapping_update_lock); | 821 | mutex_unlock(&irq_mapping_update_lock); |
| 822 | 822 | ||
| 823 | return irq; | 823 | return irq; |
| 824 | } | 824 | } |
| @@ -829,7 +829,7 @@ static int bind_ipi_to_irq(unsigned int ipi, unsigned int cpu) | |||
| 829 | struct evtchn_bind_ipi bind_ipi; | 829 | struct evtchn_bind_ipi bind_ipi; |
| 830 | int evtchn, irq; | 830 | int evtchn, irq; |
| 831 | 831 | ||
| 832 | spin_lock(&irq_mapping_update_lock); | 832 | mutex_lock(&irq_mapping_update_lock); |
| 833 | 833 | ||
| 834 | irq = per_cpu(ipi_to_irq, cpu)[ipi]; | 834 | irq = per_cpu(ipi_to_irq, cpu)[ipi]; |
| 835 | 835 | ||
| @@ -853,7 +853,7 @@ static int bind_ipi_to_irq(unsigned int ipi, unsigned int cpu) | |||
| 853 | } | 853 | } |
| 854 | 854 | ||
| 855 | out: | 855 | out: |
| 856 | spin_unlock(&irq_mapping_update_lock); | 856 | mutex_unlock(&irq_mapping_update_lock); |
| 857 | return irq; | 857 | return irq; |
| 858 | } | 858 | } |
| 859 | 859 | ||
| @@ -878,7 +878,7 @@ int bind_virq_to_irq(unsigned int virq, unsigned int cpu) | |||
| 878 | struct evtchn_bind_virq bind_virq; | 878 | struct evtchn_bind_virq bind_virq; |
| 879 | int evtchn, irq; | 879 | int evtchn, irq; |
| 880 | 880 | ||
| 881 | spin_lock(&irq_mapping_update_lock); | 881 | mutex_lock(&irq_mapping_update_lock); |
| 882 | 882 | ||
| 883 | irq = per_cpu(virq_to_irq, cpu)[virq]; | 883 | irq = per_cpu(virq_to_irq, cpu)[virq]; |
| 884 | 884 | ||
| @@ -903,7 +903,7 @@ int bind_virq_to_irq(unsigned int virq, unsigned int cpu) | |||
| 903 | } | 903 | } |
| 904 | 904 | ||
| 905 | out: | 905 | out: |
| 906 | spin_unlock(&irq_mapping_update_lock); | 906 | mutex_unlock(&irq_mapping_update_lock); |
| 907 | 907 | ||
| 908 | return irq; | 908 | return irq; |
| 909 | } | 909 | } |
| @@ -913,7 +913,7 @@ static void unbind_from_irq(unsigned int irq) | |||
| 913 | struct evtchn_close close; | 913 | struct evtchn_close close; |
| 914 | int evtchn = evtchn_from_irq(irq); | 914 | int evtchn = evtchn_from_irq(irq); |
| 915 | 915 | ||
| 916 | spin_lock(&irq_mapping_update_lock); | 916 | mutex_lock(&irq_mapping_update_lock); |
| 917 | 917 | ||
| 918 | if (VALID_EVTCHN(evtchn)) { | 918 | if (VALID_EVTCHN(evtchn)) { |
| 919 | close.port = evtchn; | 919 | close.port = evtchn; |
| @@ -943,7 +943,7 @@ static void unbind_from_irq(unsigned int irq) | |||
| 943 | 943 | ||
| 944 | xen_free_irq(irq); | 944 | xen_free_irq(irq); |
| 945 | 945 | ||
| 946 | spin_unlock(&irq_mapping_update_lock); | 946 | mutex_unlock(&irq_mapping_update_lock); |
| 947 | } | 947 | } |
| 948 | 948 | ||
| 949 | int bind_evtchn_to_irqhandler(unsigned int evtchn, | 949 | int bind_evtchn_to_irqhandler(unsigned int evtchn, |
| @@ -1279,7 +1279,7 @@ void rebind_evtchn_irq(int evtchn, int irq) | |||
| 1279 | will also be masked. */ | 1279 | will also be masked. */ |
| 1280 | disable_irq(irq); | 1280 | disable_irq(irq); |
| 1281 | 1281 | ||
| 1282 | spin_lock(&irq_mapping_update_lock); | 1282 | mutex_lock(&irq_mapping_update_lock); |
| 1283 | 1283 | ||
| 1284 | /* After resume the irq<->evtchn mappings are all cleared out */ | 1284 | /* After resume the irq<->evtchn mappings are all cleared out */ |
| 1285 | BUG_ON(evtchn_to_irq[evtchn] != -1); | 1285 | BUG_ON(evtchn_to_irq[evtchn] != -1); |
| @@ -1289,7 +1289,7 @@ void rebind_evtchn_irq(int evtchn, int irq) | |||
| 1289 | 1289 | ||
| 1290 | xen_irq_info_evtchn_init(irq, evtchn); | 1290 | xen_irq_info_evtchn_init(irq, evtchn); |
| 1291 | 1291 | ||
| 1292 | spin_unlock(&irq_mapping_update_lock); | 1292 | mutex_unlock(&irq_mapping_update_lock); |
| 1293 | 1293 | ||
| 1294 | /* new event channels are always bound to cpu 0 */ | 1294 | /* new event channels are always bound to cpu 0 */ |
| 1295 | irq_set_affinity(irq, cpumask_of(0)); | 1295 | irq_set_affinity(irq, cpumask_of(0)); |
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index c106ca22e812..d24a9b666a23 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c | |||
| @@ -344,6 +344,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) | |||
| 344 | struct inode *root, *inode; | 344 | struct inode *root, *inode; |
| 345 | struct qstr str; | 345 | struct qstr str; |
| 346 | struct nls_table *nls = NULL; | 346 | struct nls_table *nls = NULL; |
| 347 | u64 last_fs_block, last_fs_page; | ||
| 347 | int err; | 348 | int err; |
| 348 | 349 | ||
| 349 | err = -EINVAL; | 350 | err = -EINVAL; |
| @@ -399,9 +400,13 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) | |||
| 399 | if (!sbi->rsrc_clump_blocks) | 400 | if (!sbi->rsrc_clump_blocks) |
| 400 | sbi->rsrc_clump_blocks = 1; | 401 | sbi->rsrc_clump_blocks = 1; |
| 401 | 402 | ||
| 402 | err = generic_check_addressable(sbi->alloc_blksz_shift, | 403 | err = -EFBIG; |
| 403 | sbi->total_blocks); | 404 | last_fs_block = sbi->total_blocks - 1; |
| 404 | if (err) { | 405 | last_fs_page = (last_fs_block << sbi->alloc_blksz_shift) >> |
| 406 | PAGE_CACHE_SHIFT; | ||
| 407 | |||
| 408 | if ((last_fs_block > (sector_t)(~0ULL) >> (sbi->alloc_blksz_shift - 9)) || | ||
| 409 | (last_fs_page > (pgoff_t)(~0ULL))) { | ||
| 405 | printk(KERN_ERR "hfs: filesystem size too large.\n"); | 410 | printk(KERN_ERR "hfs: filesystem size too large.\n"); |
| 406 | goto out_free_vhdr; | 411 | goto out_free_vhdr; |
| 407 | } | 412 | } |
| @@ -525,8 +530,8 @@ out_close_cat_tree: | |||
| 525 | out_close_ext_tree: | 530 | out_close_ext_tree: |
| 526 | hfs_btree_close(sbi->ext_tree); | 531 | hfs_btree_close(sbi->ext_tree); |
| 527 | out_free_vhdr: | 532 | out_free_vhdr: |
| 528 | kfree(sbi->s_vhdr); | 533 | kfree(sbi->s_vhdr_buf); |
| 529 | kfree(sbi->s_backup_vhdr); | 534 | kfree(sbi->s_backup_vhdr_buf); |
| 530 | out_unload_nls: | 535 | out_unload_nls: |
| 531 | unload_nls(sbi->nls); | 536 | unload_nls(sbi->nls); |
| 532 | unload_nls(nls); | 537 | unload_nls(nls); |
diff --git a/fs/hfsplus/wrapper.c b/fs/hfsplus/wrapper.c index 10e515a0d452..7daf4b852d1c 100644 --- a/fs/hfsplus/wrapper.c +++ b/fs/hfsplus/wrapper.c | |||
| @@ -272,9 +272,9 @@ reread: | |||
| 272 | return 0; | 272 | return 0; |
| 273 | 273 | ||
| 274 | out_free_backup_vhdr: | 274 | out_free_backup_vhdr: |
| 275 | kfree(sbi->s_backup_vhdr); | 275 | kfree(sbi->s_backup_vhdr_buf); |
| 276 | out_free_vhdr: | 276 | out_free_vhdr: |
| 277 | kfree(sbi->s_vhdr); | 277 | kfree(sbi->s_vhdr_buf); |
| 278 | out: | 278 | out: |
| 279 | return error; | 279 | return error; |
| 280 | } | 280 | } |
diff --git a/fs/namei.c b/fs/namei.c index b52bc685465f..f4788365ea22 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
| @@ -2616,6 +2616,7 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 2616 | if (!dir->i_op->rmdir) | 2616 | if (!dir->i_op->rmdir) |
| 2617 | return -EPERM; | 2617 | return -EPERM; |
| 2618 | 2618 | ||
| 2619 | dget(dentry); | ||
| 2619 | mutex_lock(&dentry->d_inode->i_mutex); | 2620 | mutex_lock(&dentry->d_inode->i_mutex); |
| 2620 | 2621 | ||
| 2621 | error = -EBUSY; | 2622 | error = -EBUSY; |
| @@ -2636,6 +2637,7 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 2636 | 2637 | ||
| 2637 | out: | 2638 | out: |
| 2638 | mutex_unlock(&dentry->d_inode->i_mutex); | 2639 | mutex_unlock(&dentry->d_inode->i_mutex); |
| 2640 | dput(dentry); | ||
| 2639 | if (!error) | 2641 | if (!error) |
| 2640 | d_delete(dentry); | 2642 | d_delete(dentry); |
| 2641 | return error; | 2643 | return error; |
| @@ -3025,6 +3027,7 @@ static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry, | |||
| 3025 | if (error) | 3027 | if (error) |
| 3026 | return error; | 3028 | return error; |
| 3027 | 3029 | ||
| 3030 | dget(new_dentry); | ||
| 3028 | if (target) | 3031 | if (target) |
| 3029 | mutex_lock(&target->i_mutex); | 3032 | mutex_lock(&target->i_mutex); |
| 3030 | 3033 | ||
| @@ -3045,6 +3048,7 @@ static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry, | |||
| 3045 | out: | 3048 | out: |
| 3046 | if (target) | 3049 | if (target) |
| 3047 | mutex_unlock(&target->i_mutex); | 3050 | mutex_unlock(&target->i_mutex); |
| 3051 | dput(new_dentry); | ||
| 3048 | if (!error) | 3052 | if (!error) |
| 3049 | if (!(old_dir->i_sb->s_type->fs_flags & FS_RENAME_DOES_D_MOVE)) | 3053 | if (!(old_dir->i_sb->s_type->fs_flags & FS_RENAME_DOES_D_MOVE)) |
| 3050 | d_move(old_dentry,new_dentry); | 3054 | d_move(old_dentry,new_dentry); |
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 1ec1a85fa71c..3e93e9a1bee1 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
| @@ -56,6 +56,9 @@ enum nfs4_session_state { | |||
| 56 | NFS4_SESSION_DRAINING, | 56 | NFS4_SESSION_DRAINING, |
| 57 | }; | 57 | }; |
| 58 | 58 | ||
| 59 | #define NFS4_RENEW_TIMEOUT 0x01 | ||
| 60 | #define NFS4_RENEW_DELEGATION_CB 0x02 | ||
| 61 | |||
| 59 | struct nfs4_minor_version_ops { | 62 | struct nfs4_minor_version_ops { |
| 60 | u32 minor_version; | 63 | u32 minor_version; |
| 61 | 64 | ||
| @@ -225,7 +228,7 @@ struct nfs4_state_recovery_ops { | |||
| 225 | }; | 228 | }; |
| 226 | 229 | ||
| 227 | struct nfs4_state_maintenance_ops { | 230 | struct nfs4_state_maintenance_ops { |
| 228 | int (*sched_state_renewal)(struct nfs_client *, struct rpc_cred *); | 231 | int (*sched_state_renewal)(struct nfs_client *, struct rpc_cred *, unsigned); |
| 229 | struct rpc_cred * (*get_state_renewal_cred_locked)(struct nfs_client *); | 232 | struct rpc_cred * (*get_state_renewal_cred_locked)(struct nfs_client *); |
| 230 | int (*renew_lease)(struct nfs_client *, struct rpc_cred *); | 233 | int (*renew_lease)(struct nfs_client *, struct rpc_cred *); |
| 231 | }; | 234 | }; |
| @@ -237,8 +240,6 @@ extern const struct inode_operations nfs4_dir_inode_operations; | |||
| 237 | extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, struct rpc_cred *, struct nfs4_setclientid_res *); | 240 | extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, struct rpc_cred *, struct nfs4_setclientid_res *); |
| 238 | extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct nfs4_setclientid_res *arg, struct rpc_cred *); | 241 | extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct nfs4_setclientid_res *arg, struct rpc_cred *); |
| 239 | extern int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred); | 242 | extern int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred); |
| 240 | extern int nfs4_proc_async_renew(struct nfs_client *, struct rpc_cred *); | ||
| 241 | extern int nfs4_proc_renew(struct nfs_client *, struct rpc_cred *); | ||
| 242 | extern int nfs4_init_clientid(struct nfs_client *, struct rpc_cred *); | 243 | extern int nfs4_init_clientid(struct nfs_client *, struct rpc_cred *); |
| 243 | extern int nfs41_init_clientid(struct nfs_client *, struct rpc_cred *); | 244 | extern int nfs41_init_clientid(struct nfs_client *, struct rpc_cred *); |
| 244 | extern int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait, bool roc); | 245 | extern int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait, bool roc); |
| @@ -349,6 +350,7 @@ extern void nfs4_close_sync(struct nfs4_state *, fmode_t); | |||
| 349 | extern void nfs4_state_set_mode_locked(struct nfs4_state *, fmode_t); | 350 | extern void nfs4_state_set_mode_locked(struct nfs4_state *, fmode_t); |
| 350 | extern void nfs4_schedule_lease_recovery(struct nfs_client *); | 351 | extern void nfs4_schedule_lease_recovery(struct nfs_client *); |
| 351 | extern void nfs4_schedule_state_manager(struct nfs_client *); | 352 | extern void nfs4_schedule_state_manager(struct nfs_client *); |
| 353 | extern void nfs4_schedule_path_down_recovery(struct nfs_client *clp); | ||
| 352 | extern void nfs4_schedule_stateid_recovery(const struct nfs_server *, struct nfs4_state *); | 354 | extern void nfs4_schedule_stateid_recovery(const struct nfs_server *, struct nfs4_state *); |
| 353 | extern void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags); | 355 | extern void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags); |
| 354 | extern void nfs41_handle_recall_slot(struct nfs_client *clp); | 356 | extern void nfs41_handle_recall_slot(struct nfs_client *clp); |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 8c77039e7a81..4700fae1ada0 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
| @@ -3374,9 +3374,13 @@ static void nfs4_renew_done(struct rpc_task *task, void *calldata) | |||
| 3374 | 3374 | ||
| 3375 | if (task->tk_status < 0) { | 3375 | if (task->tk_status < 0) { |
| 3376 | /* Unless we're shutting down, schedule state recovery! */ | 3376 | /* Unless we're shutting down, schedule state recovery! */ |
| 3377 | if (test_bit(NFS_CS_RENEWD, &clp->cl_res_state) != 0) | 3377 | if (test_bit(NFS_CS_RENEWD, &clp->cl_res_state) == 0) |
| 3378 | return; | ||
| 3379 | if (task->tk_status != NFS4ERR_CB_PATH_DOWN) { | ||
| 3378 | nfs4_schedule_lease_recovery(clp); | 3380 | nfs4_schedule_lease_recovery(clp); |
| 3379 | return; | 3381 | return; |
| 3382 | } | ||
| 3383 | nfs4_schedule_path_down_recovery(clp); | ||
| 3380 | } | 3384 | } |
| 3381 | do_renew_lease(clp, timestamp); | 3385 | do_renew_lease(clp, timestamp); |
| 3382 | } | 3386 | } |
| @@ -3386,7 +3390,7 @@ static const struct rpc_call_ops nfs4_renew_ops = { | |||
| 3386 | .rpc_release = nfs4_renew_release, | 3390 | .rpc_release = nfs4_renew_release, |
| 3387 | }; | 3391 | }; |
| 3388 | 3392 | ||
| 3389 | int nfs4_proc_async_renew(struct nfs_client *clp, struct rpc_cred *cred) | 3393 | static int nfs4_proc_async_renew(struct nfs_client *clp, struct rpc_cred *cred, unsigned renew_flags) |
| 3390 | { | 3394 | { |
| 3391 | struct rpc_message msg = { | 3395 | struct rpc_message msg = { |
| 3392 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENEW], | 3396 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENEW], |
| @@ -3395,9 +3399,11 @@ int nfs4_proc_async_renew(struct nfs_client *clp, struct rpc_cred *cred) | |||
| 3395 | }; | 3399 | }; |
| 3396 | struct nfs4_renewdata *data; | 3400 | struct nfs4_renewdata *data; |
| 3397 | 3401 | ||
| 3402 | if (renew_flags == 0) | ||
| 3403 | return 0; | ||
| 3398 | if (!atomic_inc_not_zero(&clp->cl_count)) | 3404 | if (!atomic_inc_not_zero(&clp->cl_count)) |
| 3399 | return -EIO; | 3405 | return -EIO; |
| 3400 | data = kmalloc(sizeof(*data), GFP_KERNEL); | 3406 | data = kmalloc(sizeof(*data), GFP_NOFS); |
| 3401 | if (data == NULL) | 3407 | if (data == NULL) |
| 3402 | return -ENOMEM; | 3408 | return -ENOMEM; |
| 3403 | data->client = clp; | 3409 | data->client = clp; |
| @@ -3406,7 +3412,7 @@ int nfs4_proc_async_renew(struct nfs_client *clp, struct rpc_cred *cred) | |||
| 3406 | &nfs4_renew_ops, data); | 3412 | &nfs4_renew_ops, data); |
| 3407 | } | 3413 | } |
| 3408 | 3414 | ||
| 3409 | int nfs4_proc_renew(struct nfs_client *clp, struct rpc_cred *cred) | 3415 | static int nfs4_proc_renew(struct nfs_client *clp, struct rpc_cred *cred) |
| 3410 | { | 3416 | { |
| 3411 | struct rpc_message msg = { | 3417 | struct rpc_message msg = { |
| 3412 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENEW], | 3418 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENEW], |
| @@ -5504,11 +5510,13 @@ static struct rpc_task *_nfs41_proc_sequence(struct nfs_client *clp, struct rpc_ | |||
| 5504 | return rpc_run_task(&task_setup_data); | 5510 | return rpc_run_task(&task_setup_data); |
| 5505 | } | 5511 | } |
| 5506 | 5512 | ||
| 5507 | static int nfs41_proc_async_sequence(struct nfs_client *clp, struct rpc_cred *cred) | 5513 | static int nfs41_proc_async_sequence(struct nfs_client *clp, struct rpc_cred *cred, unsigned renew_flags) |
| 5508 | { | 5514 | { |
| 5509 | struct rpc_task *task; | 5515 | struct rpc_task *task; |
| 5510 | int ret = 0; | 5516 | int ret = 0; |
| 5511 | 5517 | ||
| 5518 | if ((renew_flags & NFS4_RENEW_TIMEOUT) == 0) | ||
| 5519 | return 0; | ||
| 5512 | task = _nfs41_proc_sequence(clp, cred); | 5520 | task = _nfs41_proc_sequence(clp, cred); |
| 5513 | if (IS_ERR(task)) | 5521 | if (IS_ERR(task)) |
| 5514 | ret = PTR_ERR(task); | 5522 | ret = PTR_ERR(task); |
diff --git a/fs/nfs/nfs4renewd.c b/fs/nfs/nfs4renewd.c index df8e7f3ca56d..dc484c0eae7f 100644 --- a/fs/nfs/nfs4renewd.c +++ b/fs/nfs/nfs4renewd.c | |||
| @@ -60,6 +60,7 @@ nfs4_renew_state(struct work_struct *work) | |||
| 60 | struct rpc_cred *cred; | 60 | struct rpc_cred *cred; |
| 61 | long lease; | 61 | long lease; |
| 62 | unsigned long last, now; | 62 | unsigned long last, now; |
| 63 | unsigned renew_flags = 0; | ||
| 63 | 64 | ||
| 64 | ops = clp->cl_mvops->state_renewal_ops; | 65 | ops = clp->cl_mvops->state_renewal_ops; |
| 65 | dprintk("%s: start\n", __func__); | 66 | dprintk("%s: start\n", __func__); |
| @@ -72,18 +73,23 @@ nfs4_renew_state(struct work_struct *work) | |||
| 72 | last = clp->cl_last_renewal; | 73 | last = clp->cl_last_renewal; |
| 73 | now = jiffies; | 74 | now = jiffies; |
| 74 | /* Are we close to a lease timeout? */ | 75 | /* Are we close to a lease timeout? */ |
| 75 | if (time_after(now, last + lease/3)) { | 76 | if (time_after(now, last + lease/3)) |
| 77 | renew_flags |= NFS4_RENEW_TIMEOUT; | ||
| 78 | if (nfs_delegations_present(clp)) | ||
| 79 | renew_flags |= NFS4_RENEW_DELEGATION_CB; | ||
| 80 | |||
| 81 | if (renew_flags != 0) { | ||
| 76 | cred = ops->get_state_renewal_cred_locked(clp); | 82 | cred = ops->get_state_renewal_cred_locked(clp); |
| 77 | spin_unlock(&clp->cl_lock); | 83 | spin_unlock(&clp->cl_lock); |
| 78 | if (cred == NULL) { | 84 | if (cred == NULL) { |
| 79 | if (!nfs_delegations_present(clp)) { | 85 | if (!(renew_flags & NFS4_RENEW_DELEGATION_CB)) { |
| 80 | set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); | 86 | set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); |
| 81 | goto out; | 87 | goto out; |
| 82 | } | 88 | } |
| 83 | nfs_expire_all_delegations(clp); | 89 | nfs_expire_all_delegations(clp); |
| 84 | } else { | 90 | } else { |
| 85 | /* Queue an asynchronous RENEW. */ | 91 | /* Queue an asynchronous RENEW. */ |
| 86 | ops->sched_state_renewal(clp, cred); | 92 | ops->sched_state_renewal(clp, cred, renew_flags); |
| 87 | put_rpccred(cred); | 93 | put_rpccred(cred); |
| 88 | goto out_exp; | 94 | goto out_exp; |
| 89 | } | 95 | } |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 72ab97ef3d61..39914be40b03 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
| @@ -1038,6 +1038,12 @@ void nfs4_schedule_lease_recovery(struct nfs_client *clp) | |||
| 1038 | nfs4_schedule_state_manager(clp); | 1038 | nfs4_schedule_state_manager(clp); |
| 1039 | } | 1039 | } |
| 1040 | 1040 | ||
| 1041 | void nfs4_schedule_path_down_recovery(struct nfs_client *clp) | ||
| 1042 | { | ||
| 1043 | nfs_handle_cb_pathdown(clp); | ||
| 1044 | nfs4_schedule_state_manager(clp); | ||
| 1045 | } | ||
| 1046 | |||
| 1041 | static int nfs4_state_mark_reclaim_reboot(struct nfs_client *clp, struct nfs4_state *state) | 1047 | static int nfs4_state_mark_reclaim_reboot(struct nfs_client *clp, struct nfs4_state *state) |
| 1042 | { | 1048 | { |
| 1043 | 1049 | ||
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index b961ceac66b4..9b7dd7013b15 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
| @@ -2035,9 +2035,6 @@ static inline void nfs_initialise_sb(struct super_block *sb) | |||
| 2035 | sb->s_blocksize = nfs_block_bits(server->wsize, | 2035 | sb->s_blocksize = nfs_block_bits(server->wsize, |
| 2036 | &sb->s_blocksize_bits); | 2036 | &sb->s_blocksize_bits); |
| 2037 | 2037 | ||
| 2038 | if (server->flags & NFS_MOUNT_NOAC) | ||
| 2039 | sb->s_flags |= MS_SYNCHRONOUS; | ||
| 2040 | |||
| 2041 | sb->s_bdi = &server->backing_dev_info; | 2038 | sb->s_bdi = &server->backing_dev_info; |
| 2042 | 2039 | ||
| 2043 | nfs_super_set_maxbytes(sb, server->maxfilesize); | 2040 | nfs_super_set_maxbytes(sb, server->maxfilesize); |
| @@ -2249,6 +2246,10 @@ static struct dentry *nfs_fs_mount(struct file_system_type *fs_type, | |||
| 2249 | if (server->flags & NFS_MOUNT_UNSHARED) | 2246 | if (server->flags & NFS_MOUNT_UNSHARED) |
| 2250 | compare_super = NULL; | 2247 | compare_super = NULL; |
| 2251 | 2248 | ||
| 2249 | /* -o noac implies -o sync */ | ||
| 2250 | if (server->flags & NFS_MOUNT_NOAC) | ||
| 2251 | sb_mntdata.mntflags |= MS_SYNCHRONOUS; | ||
| 2252 | |||
| 2252 | /* Get a superblock - note that we may end up sharing one that already exists */ | 2253 | /* Get a superblock - note that we may end up sharing one that already exists */ |
| 2253 | s = sget(fs_type, compare_super, nfs_set_super, &sb_mntdata); | 2254 | s = sget(fs_type, compare_super, nfs_set_super, &sb_mntdata); |
| 2254 | if (IS_ERR(s)) { | 2255 | if (IS_ERR(s)) { |
| @@ -2361,6 +2362,10 @@ nfs_xdev_mount(struct file_system_type *fs_type, int flags, | |||
| 2361 | if (server->flags & NFS_MOUNT_UNSHARED) | 2362 | if (server->flags & NFS_MOUNT_UNSHARED) |
| 2362 | compare_super = NULL; | 2363 | compare_super = NULL; |
| 2363 | 2364 | ||
| 2365 | /* -o noac implies -o sync */ | ||
| 2366 | if (server->flags & NFS_MOUNT_NOAC) | ||
| 2367 | sb_mntdata.mntflags |= MS_SYNCHRONOUS; | ||
| 2368 | |||
| 2364 | /* Get a superblock - note that we may end up sharing one that already exists */ | 2369 | /* Get a superblock - note that we may end up sharing one that already exists */ |
| 2365 | s = sget(&nfs_fs_type, compare_super, nfs_set_super, &sb_mntdata); | 2370 | s = sget(&nfs_fs_type, compare_super, nfs_set_super, &sb_mntdata); |
| 2366 | if (IS_ERR(s)) { | 2371 | if (IS_ERR(s)) { |
| @@ -2628,6 +2633,10 @@ nfs4_remote_mount(struct file_system_type *fs_type, int flags, | |||
| 2628 | if (server->flags & NFS4_MOUNT_UNSHARED) | 2633 | if (server->flags & NFS4_MOUNT_UNSHARED) |
| 2629 | compare_super = NULL; | 2634 | compare_super = NULL; |
| 2630 | 2635 | ||
| 2636 | /* -o noac implies -o sync */ | ||
| 2637 | if (server->flags & NFS_MOUNT_NOAC) | ||
| 2638 | sb_mntdata.mntflags |= MS_SYNCHRONOUS; | ||
| 2639 | |||
| 2631 | /* Get a superblock - note that we may end up sharing one that already exists */ | 2640 | /* Get a superblock - note that we may end up sharing one that already exists */ |
| 2632 | s = sget(&nfs4_fs_type, compare_super, nfs_set_super, &sb_mntdata); | 2641 | s = sget(&nfs4_fs_type, compare_super, nfs_set_super, &sb_mntdata); |
| 2633 | if (IS_ERR(s)) { | 2642 | if (IS_ERR(s)) { |
| @@ -2916,6 +2925,10 @@ nfs4_xdev_mount(struct file_system_type *fs_type, int flags, | |||
| 2916 | if (server->flags & NFS4_MOUNT_UNSHARED) | 2925 | if (server->flags & NFS4_MOUNT_UNSHARED) |
| 2917 | compare_super = NULL; | 2926 | compare_super = NULL; |
| 2918 | 2927 | ||
| 2928 | /* -o noac implies -o sync */ | ||
| 2929 | if (server->flags & NFS_MOUNT_NOAC) | ||
| 2930 | sb_mntdata.mntflags |= MS_SYNCHRONOUS; | ||
| 2931 | |||
| 2919 | /* Get a superblock - note that we may end up sharing one that already exists */ | 2932 | /* Get a superblock - note that we may end up sharing one that already exists */ |
| 2920 | s = sget(&nfs4_fs_type, compare_super, nfs_set_super, &sb_mntdata); | 2933 | s = sget(&nfs4_fs_type, compare_super, nfs_set_super, &sb_mntdata); |
| 2921 | if (IS_ERR(s)) { | 2934 | if (IS_ERR(s)) { |
| @@ -3003,6 +3016,10 @@ nfs4_remote_referral_mount(struct file_system_type *fs_type, int flags, | |||
| 3003 | if (server->flags & NFS4_MOUNT_UNSHARED) | 3016 | if (server->flags & NFS4_MOUNT_UNSHARED) |
| 3004 | compare_super = NULL; | 3017 | compare_super = NULL; |
| 3005 | 3018 | ||
| 3019 | /* -o noac implies -o sync */ | ||
| 3020 | if (server->flags & NFS_MOUNT_NOAC) | ||
| 3021 | sb_mntdata.mntflags |= MS_SYNCHRONOUS; | ||
| 3022 | |||
| 3006 | /* Get a superblock - note that we may end up sharing one that already exists */ | 3023 | /* Get a superblock - note that we may end up sharing one that already exists */ |
| 3007 | s = sget(&nfs4_fs_type, compare_super, nfs_set_super, &sb_mntdata); | 3024 | s = sget(&nfs4_fs_type, compare_super, nfs_set_super, &sb_mntdata); |
| 3008 | if (IS_ERR(s)) { | 3025 | if (IS_ERR(s)) { |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index b39b37f80913..c9bd2a6b7d4b 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
| @@ -958,7 +958,7 @@ static int nfs_flush_multi(struct nfs_pageio_descriptor *desc, struct list_head | |||
| 958 | if (!data) | 958 | if (!data) |
| 959 | goto out_bad; | 959 | goto out_bad; |
| 960 | data->pagevec[0] = page; | 960 | data->pagevec[0] = page; |
| 961 | nfs_write_rpcsetup(req, data, wsize, offset, desc->pg_ioflags); | 961 | nfs_write_rpcsetup(req, data, len, offset, desc->pg_ioflags); |
| 962 | list_add(&data->list, res); | 962 | list_add(&data->list, res); |
| 963 | requests++; | 963 | requests++; |
| 964 | nbytes -= len; | 964 | nbytes -= len; |
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 63e971e2b837..8c37dde4c521 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c | |||
| @@ -1300,6 +1300,7 @@ xfs_end_io_direct_write( | |||
| 1300 | bool is_async) | 1300 | bool is_async) |
| 1301 | { | 1301 | { |
| 1302 | struct xfs_ioend *ioend = iocb->private; | 1302 | struct xfs_ioend *ioend = iocb->private; |
| 1303 | struct inode *inode = ioend->io_inode; | ||
| 1303 | 1304 | ||
| 1304 | /* | 1305 | /* |
| 1305 | * blockdev_direct_IO can return an error even after the I/O | 1306 | * blockdev_direct_IO can return an error even after the I/O |
| @@ -1331,7 +1332,7 @@ xfs_end_io_direct_write( | |||
| 1331 | } | 1332 | } |
| 1332 | 1333 | ||
| 1333 | /* XXX: probably should move into the real I/O completion handler */ | 1334 | /* XXX: probably should move into the real I/O completion handler */ |
| 1334 | inode_dio_done(ioend->io_inode); | 1335 | inode_dio_done(inode); |
| 1335 | } | 1336 | } |
| 1336 | 1337 | ||
| 1337 | STATIC ssize_t | 1338 | STATIC ssize_t |
diff --git a/include/linux/basic_mmio_gpio.h b/include/linux/basic_mmio_gpio.h index 98999cf107ce..feb912196745 100644 --- a/include/linux/basic_mmio_gpio.h +++ b/include/linux/basic_mmio_gpio.h | |||
| @@ -63,15 +63,10 @@ static inline struct bgpio_chip *to_bgpio_chip(struct gpio_chip *gc) | |||
| 63 | return container_of(gc, struct bgpio_chip, gc); | 63 | return container_of(gc, struct bgpio_chip, gc); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | int __devexit bgpio_remove(struct bgpio_chip *bgc); | 66 | int bgpio_remove(struct bgpio_chip *bgc); |
| 67 | int __devinit bgpio_init(struct bgpio_chip *bgc, | 67 | int bgpio_init(struct bgpio_chip *bgc, struct device *dev, |
| 68 | struct device *dev, | 68 | unsigned long sz, void __iomem *dat, void __iomem *set, |
| 69 | unsigned long sz, | 69 | void __iomem *clr, void __iomem *dirout, void __iomem *dirin, |
| 70 | void __iomem *dat, | 70 | bool big_endian); |
| 71 | void __iomem *set, | ||
| 72 | void __iomem *clr, | ||
| 73 | void __iomem *dirout, | ||
| 74 | void __iomem *dirin, | ||
| 75 | bool big_endian); | ||
| 76 | 71 | ||
| 77 | #endif /* __BASIC_MMIO_GPIO_H */ | 72 | #endif /* __BASIC_MMIO_GPIO_H */ |
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 3b535db00a94..343bd7661f2a 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
| @@ -39,16 +39,6 @@ extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, | |||
| 39 | struct mem_cgroup *mem_cont, | 39 | struct mem_cgroup *mem_cont, |
| 40 | int active, int file); | 40 | int active, int file); |
| 41 | 41 | ||
| 42 | struct memcg_scanrecord { | ||
| 43 | struct mem_cgroup *mem; /* scanend memory cgroup */ | ||
| 44 | struct mem_cgroup *root; /* scan target hierarchy root */ | ||
| 45 | int context; /* scanning context (see memcontrol.c) */ | ||
| 46 | unsigned long nr_scanned[2]; /* the number of scanned pages */ | ||
| 47 | unsigned long nr_rotated[2]; /* the number of rotated pages */ | ||
| 48 | unsigned long nr_freed[2]; /* the number of freed pages */ | ||
| 49 | unsigned long elapsed; /* nsec of time elapsed while scanning */ | ||
| 50 | }; | ||
| 51 | |||
| 52 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR | 42 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR |
| 53 | /* | 43 | /* |
| 54 | * All "charge" functions with gfp_mask should use GFP_KERNEL or | 44 | * All "charge" functions with gfp_mask should use GFP_KERNEL or |
| @@ -127,15 +117,6 @@ mem_cgroup_get_reclaim_stat_from_page(struct page *page); | |||
| 127 | extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, | 117 | extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, |
| 128 | struct task_struct *p); | 118 | struct task_struct *p); |
| 129 | 119 | ||
| 130 | extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, | ||
| 131 | gfp_t gfp_mask, bool noswap, | ||
| 132 | struct memcg_scanrecord *rec); | ||
| 133 | extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem, | ||
| 134 | gfp_t gfp_mask, bool noswap, | ||
| 135 | struct zone *zone, | ||
| 136 | struct memcg_scanrecord *rec, | ||
| 137 | unsigned long *nr_scanned); | ||
| 138 | |||
| 139 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP | 120 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP |
| 140 | extern int do_swap_account; | 121 | extern int do_swap_account; |
| 141 | #endif | 122 | #endif |
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h index d12f8d635a81..97cf4f27d647 100644 --- a/include/linux/mfd/wm8994/pdata.h +++ b/include/linux/mfd/wm8994/pdata.h | |||
| @@ -26,7 +26,7 @@ struct wm8994_ldo_pdata { | |||
| 26 | struct regulator_init_data *init_data; | 26 | struct regulator_init_data *init_data; |
| 27 | }; | 27 | }; |
| 28 | 28 | ||
| 29 | #define WM8994_CONFIGURE_GPIO 0x8000 | 29 | #define WM8994_CONFIGURE_GPIO 0x10000 |
| 30 | 30 | ||
| 31 | #define WM8994_DRC_REGS 5 | 31 | #define WM8994_DRC_REGS 5 |
| 32 | #define WM8994_EQ_REGS 20 | 32 | #define WM8994_EQ_REGS 20 |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 7b996ed86d5b..8bd383caa363 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -524,6 +524,7 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size, | |||
| 524 | extern bool skb_recycle_check(struct sk_buff *skb, int skb_size); | 524 | extern bool skb_recycle_check(struct sk_buff *skb, int skb_size); |
| 525 | 525 | ||
| 526 | extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); | 526 | extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); |
| 527 | extern int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask); | ||
| 527 | extern struct sk_buff *skb_clone(struct sk_buff *skb, | 528 | extern struct sk_buff *skb_clone(struct sk_buff *skb, |
| 528 | gfp_t priority); | 529 | gfp_t priority); |
| 529 | extern struct sk_buff *skb_copy(const struct sk_buff *skb, | 530 | extern struct sk_buff *skb_copy(const struct sk_buff *skb, |
diff --git a/include/linux/snmp.h b/include/linux/snmp.h index 12b2b18e50c1..e16557a357e5 100644 --- a/include/linux/snmp.h +++ b/include/linux/snmp.h | |||
| @@ -231,6 +231,8 @@ enum | |||
| 231 | LINUX_MIB_TCPDEFERACCEPTDROP, | 231 | LINUX_MIB_TCPDEFERACCEPTDROP, |
| 232 | LINUX_MIB_IPRPFILTER, /* IP Reverse Path Filter (rp_filter) */ | 232 | LINUX_MIB_IPRPFILTER, /* IP Reverse Path Filter (rp_filter) */ |
| 233 | LINUX_MIB_TCPTIMEWAITOVERFLOW, /* TCPTimeWaitOverflow */ | 233 | LINUX_MIB_TCPTIMEWAITOVERFLOW, /* TCPTimeWaitOverflow */ |
| 234 | LINUX_MIB_TCPREQQFULLDOCOOKIES, /* TCPReqQFullDoCookies */ | ||
| 235 | LINUX_MIB_TCPREQQFULLDROP, /* TCPReqQFullDrop */ | ||
| 234 | __LINUX_MIB_MAX | 236 | __LINUX_MIB_MAX |
| 235 | }; | 237 | }; |
| 236 | 238 | ||
diff --git a/include/linux/swap.h b/include/linux/swap.h index 14d62490922e..c71f84bb62ec 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
| @@ -252,6 +252,12 @@ static inline void lru_cache_add_file(struct page *page) | |||
| 252 | extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, | 252 | extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, |
| 253 | gfp_t gfp_mask, nodemask_t *mask); | 253 | gfp_t gfp_mask, nodemask_t *mask); |
| 254 | extern int __isolate_lru_page(struct page *page, int mode, int file); | 254 | extern int __isolate_lru_page(struct page *page, int mode, int file); |
| 255 | extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, | ||
| 256 | gfp_t gfp_mask, bool noswap); | ||
| 257 | extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem, | ||
| 258 | gfp_t gfp_mask, bool noswap, | ||
| 259 | struct zone *zone, | ||
| 260 | unsigned long *nr_scanned); | ||
| 255 | extern unsigned long shrink_all_memory(unsigned long nr_pages); | 261 | extern unsigned long shrink_all_memory(unsigned long nr_pages); |
| 256 | extern int vm_swappiness; | 262 | extern int vm_swappiness; |
| 257 | extern int remove_mapping(struct address_space *mapping, struct page *page); | 263 | extern int remove_mapping(struct address_space *mapping, struct page *page); |
diff --git a/include/net/flow.h b/include/net/flow.h index 78113daadd63..a09447749e2d 100644 --- a/include/net/flow.h +++ b/include/net/flow.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #ifndef _NET_FLOW_H | 7 | #ifndef _NET_FLOW_H |
| 8 | #define _NET_FLOW_H | 8 | #define _NET_FLOW_H |
| 9 | 9 | ||
| 10 | #include <linux/socket.h> | ||
| 10 | #include <linux/in6.h> | 11 | #include <linux/in6.h> |
| 11 | #include <linux/atomic.h> | 12 | #include <linux/atomic.h> |
| 12 | 13 | ||
| @@ -68,7 +69,7 @@ struct flowi4 { | |||
| 68 | #define fl4_ipsec_spi uli.spi | 69 | #define fl4_ipsec_spi uli.spi |
| 69 | #define fl4_mh_type uli.mht.type | 70 | #define fl4_mh_type uli.mht.type |
| 70 | #define fl4_gre_key uli.gre_key | 71 | #define fl4_gre_key uli.gre_key |
| 71 | }; | 72 | } __attribute__((__aligned__(BITS_PER_LONG/8))); |
| 72 | 73 | ||
| 73 | static inline void flowi4_init_output(struct flowi4 *fl4, int oif, | 74 | static inline void flowi4_init_output(struct flowi4 *fl4, int oif, |
| 74 | __u32 mark, __u8 tos, __u8 scope, | 75 | __u32 mark, __u8 tos, __u8 scope, |
| @@ -112,7 +113,7 @@ struct flowi6 { | |||
| 112 | #define fl6_ipsec_spi uli.spi | 113 | #define fl6_ipsec_spi uli.spi |
| 113 | #define fl6_mh_type uli.mht.type | 114 | #define fl6_mh_type uli.mht.type |
| 114 | #define fl6_gre_key uli.gre_key | 115 | #define fl6_gre_key uli.gre_key |
| 115 | }; | 116 | } __attribute__((__aligned__(BITS_PER_LONG/8))); |
| 116 | 117 | ||
| 117 | struct flowidn { | 118 | struct flowidn { |
| 118 | struct flowi_common __fl_common; | 119 | struct flowi_common __fl_common; |
| @@ -127,7 +128,7 @@ struct flowidn { | |||
| 127 | union flowi_uli uli; | 128 | union flowi_uli uli; |
| 128 | #define fld_sport uli.ports.sport | 129 | #define fld_sport uli.ports.sport |
| 129 | #define fld_dport uli.ports.dport | 130 | #define fld_dport uli.ports.dport |
| 130 | }; | 131 | } __attribute__((__aligned__(BITS_PER_LONG/8))); |
| 131 | 132 | ||
| 132 | struct flowi { | 133 | struct flowi { |
| 133 | union { | 134 | union { |
| @@ -161,6 +162,24 @@ static inline struct flowi *flowidn_to_flowi(struct flowidn *fldn) | |||
| 161 | return container_of(fldn, struct flowi, u.dn); | 162 | return container_of(fldn, struct flowi, u.dn); |
| 162 | } | 163 | } |
| 163 | 164 | ||
| 165 | typedef unsigned long flow_compare_t; | ||
| 166 | |||
| 167 | static inline size_t flow_key_size(u16 family) | ||
| 168 | { | ||
| 169 | switch (family) { | ||
| 170 | case AF_INET: | ||
| 171 | BUILD_BUG_ON(sizeof(struct flowi4) % sizeof(flow_compare_t)); | ||
| 172 | return sizeof(struct flowi4) / sizeof(flow_compare_t); | ||
| 173 | case AF_INET6: | ||
| 174 | BUILD_BUG_ON(sizeof(struct flowi6) % sizeof(flow_compare_t)); | ||
| 175 | return sizeof(struct flowi6) / sizeof(flow_compare_t); | ||
| 176 | case AF_DECnet: | ||
| 177 | BUILD_BUG_ON(sizeof(struct flowidn) % sizeof(flow_compare_t)); | ||
| 178 | return sizeof(struct flowidn) / sizeof(flow_compare_t); | ||
| 179 | } | ||
| 180 | return 0; | ||
| 181 | } | ||
| 182 | |||
| 164 | #define FLOW_DIR_IN 0 | 183 | #define FLOW_DIR_IN 0 |
| 165 | #define FLOW_DIR_OUT 1 | 184 | #define FLOW_DIR_OUT 1 |
| 166 | #define FLOW_DIR_FWD 2 | 185 | #define FLOW_DIR_FWD 2 |
diff --git a/include/net/request_sock.h b/include/net/request_sock.h index 99e6e19b57c2..4c0766e201e3 100644 --- a/include/net/request_sock.h +++ b/include/net/request_sock.h | |||
| @@ -96,7 +96,8 @@ extern int sysctl_max_syn_backlog; | |||
| 96 | */ | 96 | */ |
| 97 | struct listen_sock { | 97 | struct listen_sock { |
| 98 | u8 max_qlen_log; | 98 | u8 max_qlen_log; |
| 99 | /* 3 bytes hole, try to use */ | 99 | u8 synflood_warned; |
| 100 | /* 2 bytes hole, try to use */ | ||
| 100 | int qlen; | 101 | int qlen; |
| 101 | int qlen_young; | 102 | int qlen_young; |
| 102 | int clock_hand; | 103 | int clock_hand; |
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h index 6506458ccd33..712b3bebeda7 100644 --- a/include/net/sctp/command.h +++ b/include/net/sctp/command.h | |||
| @@ -109,6 +109,7 @@ typedef enum { | |||
| 109 | SCTP_CMD_SEND_MSG, /* Send the whole use message */ | 109 | SCTP_CMD_SEND_MSG, /* Send the whole use message */ |
| 110 | SCTP_CMD_SEND_NEXT_ASCONF, /* Send the next ASCONF after ACK */ | 110 | SCTP_CMD_SEND_NEXT_ASCONF, /* Send the next ASCONF after ACK */ |
| 111 | SCTP_CMD_PURGE_ASCONF_QUEUE, /* Purge all asconf queues.*/ | 111 | SCTP_CMD_PURGE_ASCONF_QUEUE, /* Purge all asconf queues.*/ |
| 112 | SCTP_CMD_SET_ASOC, /* Restore association context */ | ||
| 112 | SCTP_CMD_LAST | 113 | SCTP_CMD_LAST |
| 113 | } sctp_verb_t; | 114 | } sctp_verb_t; |
| 114 | 115 | ||
diff --git a/include/net/tcp.h b/include/net/tcp.h index 149a415d1e0a..acc620a4a45f 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
| @@ -431,17 +431,34 @@ extern int tcp_disconnect(struct sock *sk, int flags); | |||
| 431 | extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS]; | 431 | extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS]; |
| 432 | extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, | 432 | extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, |
| 433 | struct ip_options *opt); | 433 | struct ip_options *opt); |
| 434 | #ifdef CONFIG_SYN_COOKIES | ||
| 434 | extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, | 435 | extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, |
| 435 | __u16 *mss); | 436 | __u16 *mss); |
| 437 | #else | ||
| 438 | static inline __u32 cookie_v4_init_sequence(struct sock *sk, | ||
| 439 | struct sk_buff *skb, | ||
| 440 | __u16 *mss) | ||
| 441 | { | ||
| 442 | return 0; | ||
| 443 | } | ||
| 444 | #endif | ||
| 436 | 445 | ||
| 437 | extern __u32 cookie_init_timestamp(struct request_sock *req); | 446 | extern __u32 cookie_init_timestamp(struct request_sock *req); |
| 438 | extern bool cookie_check_timestamp(struct tcp_options_received *opt, bool *); | 447 | extern bool cookie_check_timestamp(struct tcp_options_received *opt, bool *); |
| 439 | 448 | ||
| 440 | /* From net/ipv6/syncookies.c */ | 449 | /* From net/ipv6/syncookies.c */ |
| 441 | extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); | 450 | extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); |
| 451 | #ifdef CONFIG_SYN_COOKIES | ||
| 442 | extern __u32 cookie_v6_init_sequence(struct sock *sk, struct sk_buff *skb, | 452 | extern __u32 cookie_v6_init_sequence(struct sock *sk, struct sk_buff *skb, |
| 443 | __u16 *mss); | 453 | __u16 *mss); |
| 444 | 454 | #else | |
| 455 | static inline __u32 cookie_v6_init_sequence(struct sock *sk, | ||
| 456 | struct sk_buff *skb, | ||
| 457 | __u16 *mss) | ||
| 458 | { | ||
| 459 | return 0; | ||
| 460 | } | ||
| 461 | #endif | ||
| 445 | /* tcp_output.c */ | 462 | /* tcp_output.c */ |
| 446 | 463 | ||
| 447 | extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, | 464 | extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, |
| @@ -460,6 +477,9 @@ extern int tcp_write_wakeup(struct sock *); | |||
| 460 | extern void tcp_send_fin(struct sock *sk); | 477 | extern void tcp_send_fin(struct sock *sk); |
| 461 | extern void tcp_send_active_reset(struct sock *sk, gfp_t priority); | 478 | extern void tcp_send_active_reset(struct sock *sk, gfp_t priority); |
| 462 | extern int tcp_send_synack(struct sock *); | 479 | extern int tcp_send_synack(struct sock *); |
| 480 | extern int tcp_syn_flood_action(struct sock *sk, | ||
| 481 | const struct sk_buff *skb, | ||
| 482 | const char *proto); | ||
| 463 | extern void tcp_push_one(struct sock *, unsigned int mss_now); | 483 | extern void tcp_push_one(struct sock *, unsigned int mss_now); |
| 464 | extern void tcp_send_ack(struct sock *sk); | 484 | extern void tcp_send_ack(struct sock *sk); |
| 465 | extern void tcp_send_delayed_ack(struct sock *sk); | 485 | extern void tcp_send_delayed_ack(struct sock *sk); |
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h index 5271a741c3a3..498433dd067d 100644 --- a/include/net/transp_v6.h +++ b/include/net/transp_v6.h | |||
| @@ -39,6 +39,7 @@ extern int datagram_recv_ctl(struct sock *sk, | |||
| 39 | struct sk_buff *skb); | 39 | struct sk_buff *skb); |
| 40 | 40 | ||
| 41 | extern int datagram_send_ctl(struct net *net, | 41 | extern int datagram_send_ctl(struct net *net, |
| 42 | struct sock *sk, | ||
| 42 | struct msghdr *msg, | 43 | struct msghdr *msg, |
| 43 | struct flowi6 *fl6, | 44 | struct flowi6 *fl6, |
| 44 | struct ipv6_txoptions *opt, | 45 | struct ipv6_txoptions *opt, |
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 25fb1b0e53fa..1783aabc6128 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
| @@ -2412,8 +2412,13 @@ reflush: | |||
| 2412 | 2412 | ||
| 2413 | for_each_cwq_cpu(cpu, wq) { | 2413 | for_each_cwq_cpu(cpu, wq) { |
| 2414 | struct cpu_workqueue_struct *cwq = get_cwq(cpu, wq); | 2414 | struct cpu_workqueue_struct *cwq = get_cwq(cpu, wq); |
| 2415 | bool drained; | ||
| 2415 | 2416 | ||
| 2416 | if (!cwq->nr_active && list_empty(&cwq->delayed_works)) | 2417 | spin_lock_irq(&cwq->gcwq->lock); |
| 2418 | drained = !cwq->nr_active && list_empty(&cwq->delayed_works); | ||
| 2419 | spin_unlock_irq(&cwq->gcwq->lock); | ||
| 2420 | |||
| 2421 | if (drained) | ||
| 2417 | continue; | 2422 | continue; |
| 2418 | 2423 | ||
| 2419 | if (++flush_cnt == 10 || | 2424 | if (++flush_cnt == 10 || |
diff --git a/mm/filemap.c b/mm/filemap.c index 645a080ba4df..7771871fa353 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
| @@ -827,13 +827,14 @@ unsigned find_get_pages(struct address_space *mapping, pgoff_t start, | |||
| 827 | { | 827 | { |
| 828 | unsigned int i; | 828 | unsigned int i; |
| 829 | unsigned int ret; | 829 | unsigned int ret; |
| 830 | unsigned int nr_found; | 830 | unsigned int nr_found, nr_skip; |
| 831 | 831 | ||
| 832 | rcu_read_lock(); | 832 | rcu_read_lock(); |
| 833 | restart: | 833 | restart: |
| 834 | nr_found = radix_tree_gang_lookup_slot(&mapping->page_tree, | 834 | nr_found = radix_tree_gang_lookup_slot(&mapping->page_tree, |
| 835 | (void ***)pages, NULL, start, nr_pages); | 835 | (void ***)pages, NULL, start, nr_pages); |
| 836 | ret = 0; | 836 | ret = 0; |
| 837 | nr_skip = 0; | ||
| 837 | for (i = 0; i < nr_found; i++) { | 838 | for (i = 0; i < nr_found; i++) { |
| 838 | struct page *page; | 839 | struct page *page; |
| 839 | repeat: | 840 | repeat: |
| @@ -856,6 +857,7 @@ repeat: | |||
| 856 | * here as an exceptional entry: so skip over it - | 857 | * here as an exceptional entry: so skip over it - |
| 857 | * we only reach this from invalidate_mapping_pages(). | 858 | * we only reach this from invalidate_mapping_pages(). |
| 858 | */ | 859 | */ |
| 860 | nr_skip++; | ||
| 859 | continue; | 861 | continue; |
| 860 | } | 862 | } |
| 861 | 863 | ||
| @@ -876,7 +878,7 @@ repeat: | |||
| 876 | * If all entries were removed before we could secure them, | 878 | * If all entries were removed before we could secure them, |
| 877 | * try again, because callers stop trying once 0 is returned. | 879 | * try again, because callers stop trying once 0 is returned. |
| 878 | */ | 880 | */ |
| 879 | if (unlikely(!ret && nr_found)) | 881 | if (unlikely(!ret && nr_found > nr_skip)) |
| 880 | goto restart; | 882 | goto restart; |
| 881 | rcu_read_unlock(); | 883 | rcu_read_unlock(); |
| 882 | return ret; | 884 | return ret; |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index ebd1e86bef1c..3508777837c7 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
| @@ -204,50 +204,6 @@ struct mem_cgroup_eventfd_list { | |||
| 204 | static void mem_cgroup_threshold(struct mem_cgroup *mem); | 204 | static void mem_cgroup_threshold(struct mem_cgroup *mem); |
| 205 | static void mem_cgroup_oom_notify(struct mem_cgroup *mem); | 205 | static void mem_cgroup_oom_notify(struct mem_cgroup *mem); |
| 206 | 206 | ||
| 207 | enum { | ||
| 208 | SCAN_BY_LIMIT, | ||
| 209 | SCAN_BY_SYSTEM, | ||
| 210 | NR_SCAN_CONTEXT, | ||
| 211 | SCAN_BY_SHRINK, /* not recorded now */ | ||
| 212 | }; | ||
| 213 | |||
| 214 | enum { | ||
| 215 | SCAN, | ||
| 216 | SCAN_ANON, | ||
| 217 | SCAN_FILE, | ||
| 218 | ROTATE, | ||
| 219 | ROTATE_ANON, | ||
| 220 | ROTATE_FILE, | ||
| 221 | FREED, | ||
| 222 | FREED_ANON, | ||
| 223 | FREED_FILE, | ||
| 224 | ELAPSED, | ||
| 225 | NR_SCANSTATS, | ||
| 226 | }; | ||
| 227 | |||
| 228 | struct scanstat { | ||
| 229 | spinlock_t lock; | ||
| 230 | unsigned long stats[NR_SCAN_CONTEXT][NR_SCANSTATS]; | ||
| 231 | unsigned long rootstats[NR_SCAN_CONTEXT][NR_SCANSTATS]; | ||
| 232 | }; | ||
| 233 | |||
| 234 | const char *scanstat_string[NR_SCANSTATS] = { | ||
| 235 | "scanned_pages", | ||
| 236 | "scanned_anon_pages", | ||
| 237 | "scanned_file_pages", | ||
| 238 | "rotated_pages", | ||
| 239 | "rotated_anon_pages", | ||
| 240 | "rotated_file_pages", | ||
| 241 | "freed_pages", | ||
| 242 | "freed_anon_pages", | ||
| 243 | "freed_file_pages", | ||
| 244 | "elapsed_ns", | ||
| 245 | }; | ||
| 246 | #define SCANSTAT_WORD_LIMIT "_by_limit" | ||
| 247 | #define SCANSTAT_WORD_SYSTEM "_by_system" | ||
| 248 | #define SCANSTAT_WORD_HIERARCHY "_under_hierarchy" | ||
| 249 | |||
| 250 | |||
| 251 | /* | 207 | /* |
| 252 | * The memory controller data structure. The memory controller controls both | 208 | * The memory controller data structure. The memory controller controls both |
| 253 | * page cache and RSS per cgroup. We would eventually like to provide | 209 | * page cache and RSS per cgroup. We would eventually like to provide |
| @@ -313,8 +269,7 @@ struct mem_cgroup { | |||
| 313 | 269 | ||
| 314 | /* For oom notifier event fd */ | 270 | /* For oom notifier event fd */ |
| 315 | struct list_head oom_notify; | 271 | struct list_head oom_notify; |
| 316 | /* For recording LRU-scan statistics */ | 272 | |
| 317 | struct scanstat scanstat; | ||
| 318 | /* | 273 | /* |
| 319 | * Should we move charges of a task when a task is moved into this | 274 | * Should we move charges of a task when a task is moved into this |
| 320 | * mem_cgroup ? And what type of charges should we move ? | 275 | * mem_cgroup ? And what type of charges should we move ? |
| @@ -1678,44 +1633,6 @@ bool mem_cgroup_reclaimable(struct mem_cgroup *mem, bool noswap) | |||
| 1678 | } | 1633 | } |
| 1679 | #endif | 1634 | #endif |
| 1680 | 1635 | ||
| 1681 | static void __mem_cgroup_record_scanstat(unsigned long *stats, | ||
| 1682 | struct memcg_scanrecord *rec) | ||
| 1683 | { | ||
| 1684 | |||
| 1685 | stats[SCAN] += rec->nr_scanned[0] + rec->nr_scanned[1]; | ||
| 1686 | stats[SCAN_ANON] += rec->nr_scanned[0]; | ||
| 1687 | stats[SCAN_FILE] += rec->nr_scanned[1]; | ||
| 1688 | |||
| 1689 | stats[ROTATE] += rec->nr_rotated[0] + rec->nr_rotated[1]; | ||
| 1690 | stats[ROTATE_ANON] += rec->nr_rotated[0]; | ||
| 1691 | stats[ROTATE_FILE] += rec->nr_rotated[1]; | ||
| 1692 | |||
| 1693 | stats[FREED] += rec->nr_freed[0] + rec->nr_freed[1]; | ||
| 1694 | stats[FREED_ANON] += rec->nr_freed[0]; | ||
| 1695 | stats[FREED_FILE] += rec->nr_freed[1]; | ||
| 1696 | |||
| 1697 | stats[ELAPSED] += rec->elapsed; | ||
| 1698 | } | ||
| 1699 | |||
| 1700 | static void mem_cgroup_record_scanstat(struct memcg_scanrecord *rec) | ||
| 1701 | { | ||
| 1702 | struct mem_cgroup *mem; | ||
| 1703 | int context = rec->context; | ||
| 1704 | |||
| 1705 | if (context >= NR_SCAN_CONTEXT) | ||
| 1706 | return; | ||
| 1707 | |||
| 1708 | mem = rec->mem; | ||
| 1709 | spin_lock(&mem->scanstat.lock); | ||
| 1710 | __mem_cgroup_record_scanstat(mem->scanstat.stats[context], rec); | ||
| 1711 | spin_unlock(&mem->scanstat.lock); | ||
| 1712 | |||
| 1713 | mem = rec->root; | ||
| 1714 | spin_lock(&mem->scanstat.lock); | ||
| 1715 | __mem_cgroup_record_scanstat(mem->scanstat.rootstats[context], rec); | ||
| 1716 | spin_unlock(&mem->scanstat.lock); | ||
| 1717 | } | ||
| 1718 | |||
| 1719 | /* | 1636 | /* |
| 1720 | * Scan the hierarchy if needed to reclaim memory. We remember the last child | 1637 | * Scan the hierarchy if needed to reclaim memory. We remember the last child |
| 1721 | * we reclaimed from, so that we don't end up penalizing one child extensively | 1638 | * we reclaimed from, so that we don't end up penalizing one child extensively |
| @@ -1740,9 +1657,8 @@ static int mem_cgroup_hierarchical_reclaim(struct mem_cgroup *root_mem, | |||
| 1740 | bool noswap = reclaim_options & MEM_CGROUP_RECLAIM_NOSWAP; | 1657 | bool noswap = reclaim_options & MEM_CGROUP_RECLAIM_NOSWAP; |
| 1741 | bool shrink = reclaim_options & MEM_CGROUP_RECLAIM_SHRINK; | 1658 | bool shrink = reclaim_options & MEM_CGROUP_RECLAIM_SHRINK; |
| 1742 | bool check_soft = reclaim_options & MEM_CGROUP_RECLAIM_SOFT; | 1659 | bool check_soft = reclaim_options & MEM_CGROUP_RECLAIM_SOFT; |
| 1743 | struct memcg_scanrecord rec; | ||
| 1744 | unsigned long excess; | 1660 | unsigned long excess; |
| 1745 | unsigned long scanned; | 1661 | unsigned long nr_scanned; |
| 1746 | 1662 | ||
| 1747 | excess = res_counter_soft_limit_excess(&root_mem->res) >> PAGE_SHIFT; | 1663 | excess = res_counter_soft_limit_excess(&root_mem->res) >> PAGE_SHIFT; |
| 1748 | 1664 | ||
| @@ -1750,15 +1666,6 @@ static int mem_cgroup_hierarchical_reclaim(struct mem_cgroup *root_mem, | |||
| 1750 | if (!check_soft && !shrink && root_mem->memsw_is_minimum) | 1666 | if (!check_soft && !shrink && root_mem->memsw_is_minimum) |
| 1751 | noswap = true; | 1667 | noswap = true; |
| 1752 | 1668 | ||
| 1753 | if (shrink) | ||
| 1754 | rec.context = SCAN_BY_SHRINK; | ||
| 1755 | else if (check_soft) | ||
| 1756 | rec.context = SCAN_BY_SYSTEM; | ||
| 1757 | else | ||
| 1758 | rec.context = SCAN_BY_LIMIT; | ||
| 1759 | |||
| 1760 | rec.root = root_mem; | ||
| 1761 | |||
| 1762 | while (1) { | 1669 | while (1) { |
| 1763 | victim = mem_cgroup_select_victim(root_mem); | 1670 | victim = mem_cgroup_select_victim(root_mem); |
| 1764 | if (victim == root_mem) { | 1671 | if (victim == root_mem) { |
| @@ -1799,23 +1706,14 @@ static int mem_cgroup_hierarchical_reclaim(struct mem_cgroup *root_mem, | |||
| 1799 | css_put(&victim->css); | 1706 | css_put(&victim->css); |
| 1800 | continue; | 1707 | continue; |
| 1801 | } | 1708 | } |
| 1802 | rec.mem = victim; | ||
| 1803 | rec.nr_scanned[0] = 0; | ||
| 1804 | rec.nr_scanned[1] = 0; | ||
| 1805 | rec.nr_rotated[0] = 0; | ||
| 1806 | rec.nr_rotated[1] = 0; | ||
| 1807 | rec.nr_freed[0] = 0; | ||
| 1808 | rec.nr_freed[1] = 0; | ||
| 1809 | rec.elapsed = 0; | ||
| 1810 | /* we use swappiness of local cgroup */ | 1709 | /* we use swappiness of local cgroup */ |
| 1811 | if (check_soft) { | 1710 | if (check_soft) { |
| 1812 | ret = mem_cgroup_shrink_node_zone(victim, gfp_mask, | 1711 | ret = mem_cgroup_shrink_node_zone(victim, gfp_mask, |
| 1813 | noswap, zone, &rec, &scanned); | 1712 | noswap, zone, &nr_scanned); |
| 1814 | *total_scanned += scanned; | 1713 | *total_scanned += nr_scanned; |
| 1815 | } else | 1714 | } else |
| 1816 | ret = try_to_free_mem_cgroup_pages(victim, gfp_mask, | 1715 | ret = try_to_free_mem_cgroup_pages(victim, gfp_mask, |
| 1817 | noswap, &rec); | 1716 | noswap); |
| 1818 | mem_cgroup_record_scanstat(&rec); | ||
| 1819 | css_put(&victim->css); | 1717 | css_put(&victim->css); |
| 1820 | /* | 1718 | /* |
| 1821 | * At shrinking usage, we can't check we should stop here or | 1719 | * At shrinking usage, we can't check we should stop here or |
| @@ -3854,18 +3752,14 @@ try_to_free: | |||
| 3854 | /* try to free all pages in this cgroup */ | 3752 | /* try to free all pages in this cgroup */ |
| 3855 | shrink = 1; | 3753 | shrink = 1; |
| 3856 | while (nr_retries && mem->res.usage > 0) { | 3754 | while (nr_retries && mem->res.usage > 0) { |
| 3857 | struct memcg_scanrecord rec; | ||
| 3858 | int progress; | 3755 | int progress; |
| 3859 | 3756 | ||
| 3860 | if (signal_pending(current)) { | 3757 | if (signal_pending(current)) { |
| 3861 | ret = -EINTR; | 3758 | ret = -EINTR; |
| 3862 | goto out; | 3759 | goto out; |
| 3863 | } | 3760 | } |
| 3864 | rec.context = SCAN_BY_SHRINK; | ||
| 3865 | rec.mem = mem; | ||
| 3866 | rec.root = mem; | ||
| 3867 | progress = try_to_free_mem_cgroup_pages(mem, GFP_KERNEL, | 3761 | progress = try_to_free_mem_cgroup_pages(mem, GFP_KERNEL, |
| 3868 | false, &rec); | 3762 | false); |
| 3869 | if (!progress) { | 3763 | if (!progress) { |
| 3870 | nr_retries--; | 3764 | nr_retries--; |
| 3871 | /* maybe some writeback is necessary */ | 3765 | /* maybe some writeback is necessary */ |
| @@ -4709,54 +4603,6 @@ static int mem_control_numa_stat_open(struct inode *unused, struct file *file) | |||
| 4709 | } | 4603 | } |
| 4710 | #endif /* CONFIG_NUMA */ | 4604 | #endif /* CONFIG_NUMA */ |
| 4711 | 4605 | ||
| 4712 | static int mem_cgroup_vmscan_stat_read(struct cgroup *cgrp, | ||
| 4713 | struct cftype *cft, | ||
| 4714 | struct cgroup_map_cb *cb) | ||
| 4715 | { | ||
| 4716 | struct mem_cgroup *mem = mem_cgroup_from_cont(cgrp); | ||
| 4717 | char string[64]; | ||
| 4718 | int i; | ||
| 4719 | |||
| 4720 | for (i = 0; i < NR_SCANSTATS; i++) { | ||
| 4721 | strcpy(string, scanstat_string[i]); | ||
| 4722 | strcat(string, SCANSTAT_WORD_LIMIT); | ||
| 4723 | cb->fill(cb, string, mem->scanstat.stats[SCAN_BY_LIMIT][i]); | ||
| 4724 | } | ||
| 4725 | |||
| 4726 | for (i = 0; i < NR_SCANSTATS; i++) { | ||
| 4727 | strcpy(string, scanstat_string[i]); | ||
| 4728 | strcat(string, SCANSTAT_WORD_SYSTEM); | ||
| 4729 | cb->fill(cb, string, mem->scanstat.stats[SCAN_BY_SYSTEM][i]); | ||
| 4730 | } | ||
| 4731 | |||
| 4732 | for (i = 0; i < NR_SCANSTATS; i++) { | ||
| 4733 | strcpy(string, scanstat_string[i]); | ||
| 4734 | strcat(string, SCANSTAT_WORD_LIMIT); | ||
| 4735 | strcat(string, SCANSTAT_WORD_HIERARCHY); | ||
| 4736 | cb->fill(cb, string, mem->scanstat.rootstats[SCAN_BY_LIMIT][i]); | ||
| 4737 | } | ||
| 4738 | for (i = 0; i < NR_SCANSTATS; i++) { | ||
| 4739 | strcpy(string, scanstat_string[i]); | ||
| 4740 | strcat(string, SCANSTAT_WORD_SYSTEM); | ||
| 4741 | strcat(string, SCANSTAT_WORD_HIERARCHY); | ||
| 4742 | cb->fill(cb, string, mem->scanstat.rootstats[SCAN_BY_SYSTEM][i]); | ||
| 4743 | } | ||
| 4744 | return 0; | ||
| 4745 | } | ||
| 4746 | |||
| 4747 | static int mem_cgroup_reset_vmscan_stat(struct cgroup *cgrp, | ||
| 4748 | unsigned int event) | ||
| 4749 | { | ||
| 4750 | struct mem_cgroup *mem = mem_cgroup_from_cont(cgrp); | ||
| 4751 | |||
| 4752 | spin_lock(&mem->scanstat.lock); | ||
| 4753 | memset(&mem->scanstat.stats, 0, sizeof(mem->scanstat.stats)); | ||
| 4754 | memset(&mem->scanstat.rootstats, 0, sizeof(mem->scanstat.rootstats)); | ||
| 4755 | spin_unlock(&mem->scanstat.lock); | ||
| 4756 | return 0; | ||
| 4757 | } | ||
| 4758 | |||
| 4759 | |||
| 4760 | static struct cftype mem_cgroup_files[] = { | 4606 | static struct cftype mem_cgroup_files[] = { |
| 4761 | { | 4607 | { |
| 4762 | .name = "usage_in_bytes", | 4608 | .name = "usage_in_bytes", |
| @@ -4827,11 +4673,6 @@ static struct cftype mem_cgroup_files[] = { | |||
| 4827 | .mode = S_IRUGO, | 4673 | .mode = S_IRUGO, |
| 4828 | }, | 4674 | }, |
| 4829 | #endif | 4675 | #endif |
| 4830 | { | ||
| 4831 | .name = "vmscan_stat", | ||
| 4832 | .read_map = mem_cgroup_vmscan_stat_read, | ||
| 4833 | .trigger = mem_cgroup_reset_vmscan_stat, | ||
| 4834 | }, | ||
| 4835 | }; | 4676 | }; |
| 4836 | 4677 | ||
| 4837 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP | 4678 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP |
| @@ -5095,7 +4936,6 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont) | |||
| 5095 | atomic_set(&mem->refcnt, 1); | 4936 | atomic_set(&mem->refcnt, 1); |
| 5096 | mem->move_charge_at_immigrate = 0; | 4937 | mem->move_charge_at_immigrate = 0; |
| 5097 | mutex_init(&mem->thresholds_lock); | 4938 | mutex_init(&mem->thresholds_lock); |
| 5098 | spin_lock_init(&mem->scanstat.lock); | ||
| 5099 | return &mem->css; | 4939 | return &mem->css; |
| 5100 | free_out: | 4940 | free_out: |
| 5101 | __mem_cgroup_free(mem); | 4941 | __mem_cgroup_free(mem); |
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 8b57173c1dd5..9c51f9f58cac 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
| @@ -636,7 +636,6 @@ static int mbind_range(struct mm_struct *mm, unsigned long start, | |||
| 636 | struct vm_area_struct *prev; | 636 | struct vm_area_struct *prev; |
| 637 | struct vm_area_struct *vma; | 637 | struct vm_area_struct *vma; |
| 638 | int err = 0; | 638 | int err = 0; |
| 639 | pgoff_t pgoff; | ||
| 640 | unsigned long vmstart; | 639 | unsigned long vmstart; |
| 641 | unsigned long vmend; | 640 | unsigned long vmend; |
| 642 | 641 | ||
| @@ -649,9 +648,9 @@ static int mbind_range(struct mm_struct *mm, unsigned long start, | |||
| 649 | vmstart = max(start, vma->vm_start); | 648 | vmstart = max(start, vma->vm_start); |
| 650 | vmend = min(end, vma->vm_end); | 649 | vmend = min(end, vma->vm_end); |
| 651 | 650 | ||
| 652 | pgoff = vma->vm_pgoff + ((start - vma->vm_start) >> PAGE_SHIFT); | ||
| 653 | prev = vma_merge(mm, prev, vmstart, vmend, vma->vm_flags, | 651 | prev = vma_merge(mm, prev, vmstart, vmend, vma->vm_flags, |
| 654 | vma->anon_vma, vma->vm_file, pgoff, new_pol); | 652 | vma->anon_vma, vma->vm_file, vma->vm_pgoff, |
| 653 | new_pol); | ||
| 655 | if (prev) { | 654 | if (prev) { |
| 656 | vma = prev; | 655 | vma = prev; |
| 657 | next = vma->vm_next; | 656 | next = vma->vm_next; |
| @@ -1412,7 +1411,9 @@ asmlinkage long compat_sys_get_mempolicy(int __user *policy, | |||
| 1412 | err = sys_get_mempolicy(policy, nm, nr_bits+1, addr, flags); | 1411 | err = sys_get_mempolicy(policy, nm, nr_bits+1, addr, flags); |
| 1413 | 1412 | ||
| 1414 | if (!err && nmask) { | 1413 | if (!err && nmask) { |
| 1415 | err = copy_from_user(bm, nm, alloc_size); | 1414 | unsigned long copy_size; |
| 1415 | copy_size = min_t(unsigned long, sizeof(bm), alloc_size); | ||
| 1416 | err = copy_from_user(bm, nm, copy_size); | ||
| 1416 | /* ensure entire bitmap is zeroed */ | 1417 | /* ensure entire bitmap is zeroed */ |
| 1417 | err |= clear_user(nmask, ALIGN(maxnode-1, 8) / 8); | 1418 | err |= clear_user(nmask, ALIGN(maxnode-1, 8) / 8); |
| 1418 | err |= compat_put_bitmap(nmask, bm, nr_bits); | 1419 | err |= compat_put_bitmap(nmask, bm, nr_bits); |
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 7ef0903058ee..5016f19e1661 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
| @@ -2140,6 +2140,14 @@ struct vm_struct *alloc_vm_area(size_t size) | |||
| 2140 | return NULL; | 2140 | return NULL; |
| 2141 | } | 2141 | } |
| 2142 | 2142 | ||
| 2143 | /* | ||
| 2144 | * If the allocated address space is passed to a hypercall | ||
| 2145 | * before being used then we cannot rely on a page fault to | ||
| 2146 | * trigger an update of the page tables. So sync all the page | ||
| 2147 | * tables here. | ||
| 2148 | */ | ||
| 2149 | vmalloc_sync_all(); | ||
| 2150 | |||
| 2143 | return area; | 2151 | return area; |
| 2144 | } | 2152 | } |
| 2145 | EXPORT_SYMBOL_GPL(alloc_vm_area); | 2153 | EXPORT_SYMBOL_GPL(alloc_vm_area); |
diff --git a/mm/vmscan.c b/mm/vmscan.c index b7719ec10dc5..b55699cd9067 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
| @@ -105,7 +105,6 @@ struct scan_control { | |||
| 105 | 105 | ||
| 106 | /* Which cgroup do we reclaim from */ | 106 | /* Which cgroup do we reclaim from */ |
| 107 | struct mem_cgroup *mem_cgroup; | 107 | struct mem_cgroup *mem_cgroup; |
| 108 | struct memcg_scanrecord *memcg_record; | ||
| 109 | 108 | ||
| 110 | /* | 109 | /* |
| 111 | * Nodemask of nodes allowed by the caller. If NULL, all nodes | 110 | * Nodemask of nodes allowed by the caller. If NULL, all nodes |
| @@ -1349,8 +1348,6 @@ putback_lru_pages(struct zone *zone, struct scan_control *sc, | |||
| 1349 | int file = is_file_lru(lru); | 1348 | int file = is_file_lru(lru); |
| 1350 | int numpages = hpage_nr_pages(page); | 1349 | int numpages = hpage_nr_pages(page); |
| 1351 | reclaim_stat->recent_rotated[file] += numpages; | 1350 | reclaim_stat->recent_rotated[file] += numpages; |
| 1352 | if (!scanning_global_lru(sc)) | ||
| 1353 | sc->memcg_record->nr_rotated[file] += numpages; | ||
| 1354 | } | 1351 | } |
| 1355 | if (!pagevec_add(&pvec, page)) { | 1352 | if (!pagevec_add(&pvec, page)) { |
| 1356 | spin_unlock_irq(&zone->lru_lock); | 1353 | spin_unlock_irq(&zone->lru_lock); |
| @@ -1394,10 +1391,6 @@ static noinline_for_stack void update_isolated_counts(struct zone *zone, | |||
| 1394 | 1391 | ||
| 1395 | reclaim_stat->recent_scanned[0] += *nr_anon; | 1392 | reclaim_stat->recent_scanned[0] += *nr_anon; |
| 1396 | reclaim_stat->recent_scanned[1] += *nr_file; | 1393 | reclaim_stat->recent_scanned[1] += *nr_file; |
| 1397 | if (!scanning_global_lru(sc)) { | ||
| 1398 | sc->memcg_record->nr_scanned[0] += *nr_anon; | ||
| 1399 | sc->memcg_record->nr_scanned[1] += *nr_file; | ||
| 1400 | } | ||
| 1401 | } | 1394 | } |
| 1402 | 1395 | ||
| 1403 | /* | 1396 | /* |
| @@ -1511,9 +1504,6 @@ shrink_inactive_list(unsigned long nr_to_scan, struct zone *zone, | |||
| 1511 | nr_reclaimed += shrink_page_list(&page_list, zone, sc); | 1504 | nr_reclaimed += shrink_page_list(&page_list, zone, sc); |
| 1512 | } | 1505 | } |
| 1513 | 1506 | ||
| 1514 | if (!scanning_global_lru(sc)) | ||
| 1515 | sc->memcg_record->nr_freed[file] += nr_reclaimed; | ||
| 1516 | |||
| 1517 | local_irq_disable(); | 1507 | local_irq_disable(); |
| 1518 | if (current_is_kswapd()) | 1508 | if (current_is_kswapd()) |
| 1519 | __count_vm_events(KSWAPD_STEAL, nr_reclaimed); | 1509 | __count_vm_events(KSWAPD_STEAL, nr_reclaimed); |
| @@ -1613,8 +1603,6 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone, | |||
| 1613 | } | 1603 | } |
| 1614 | 1604 | ||
| 1615 | reclaim_stat->recent_scanned[file] += nr_taken; | 1605 | reclaim_stat->recent_scanned[file] += nr_taken; |
| 1616 | if (!scanning_global_lru(sc)) | ||
| 1617 | sc->memcg_record->nr_scanned[file] += nr_taken; | ||
| 1618 | 1606 | ||
| 1619 | __count_zone_vm_events(PGREFILL, zone, pgscanned); | 1607 | __count_zone_vm_events(PGREFILL, zone, pgscanned); |
| 1620 | if (file) | 1608 | if (file) |
| @@ -1666,8 +1654,6 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone, | |||
| 1666 | * get_scan_ratio. | 1654 | * get_scan_ratio. |
| 1667 | */ | 1655 | */ |
| 1668 | reclaim_stat->recent_rotated[file] += nr_rotated; | 1656 | reclaim_stat->recent_rotated[file] += nr_rotated; |
| 1669 | if (!scanning_global_lru(sc)) | ||
| 1670 | sc->memcg_record->nr_rotated[file] += nr_rotated; | ||
| 1671 | 1657 | ||
| 1672 | move_active_pages_to_lru(zone, &l_active, | 1658 | move_active_pages_to_lru(zone, &l_active, |
| 1673 | LRU_ACTIVE + file * LRU_FILE); | 1659 | LRU_ACTIVE + file * LRU_FILE); |
| @@ -1808,23 +1794,15 @@ static void get_scan_count(struct zone *zone, struct scan_control *sc, | |||
| 1808 | u64 fraction[2], denominator; | 1794 | u64 fraction[2], denominator; |
| 1809 | enum lru_list l; | 1795 | enum lru_list l; |
| 1810 | int noswap = 0; | 1796 | int noswap = 0; |
| 1811 | int force_scan = 0; | 1797 | bool force_scan = false; |
| 1812 | unsigned long nr_force_scan[2]; | 1798 | unsigned long nr_force_scan[2]; |
| 1813 | 1799 | ||
| 1814 | 1800 | /* kswapd does zone balancing and needs to scan this zone */ | |
| 1815 | anon = zone_nr_lru_pages(zone, sc, LRU_ACTIVE_ANON) + | 1801 | if (scanning_global_lru(sc) && current_is_kswapd()) |
| 1816 | zone_nr_lru_pages(zone, sc, LRU_INACTIVE_ANON); | 1802 | force_scan = true; |
| 1817 | file = zone_nr_lru_pages(zone, sc, LRU_ACTIVE_FILE) + | 1803 | /* memcg may have small limit and need to avoid priority drop */ |
| 1818 | zone_nr_lru_pages(zone, sc, LRU_INACTIVE_FILE); | 1804 | if (!scanning_global_lru(sc)) |
| 1819 | 1805 | force_scan = true; | |
| 1820 | if (((anon + file) >> priority) < SWAP_CLUSTER_MAX) { | ||
| 1821 | /* kswapd does zone balancing and need to scan this zone */ | ||
| 1822 | if (scanning_global_lru(sc) && current_is_kswapd()) | ||
| 1823 | force_scan = 1; | ||
| 1824 | /* memcg may have small limit and need to avoid priority drop */ | ||
| 1825 | if (!scanning_global_lru(sc)) | ||
| 1826 | force_scan = 1; | ||
| 1827 | } | ||
| 1828 | 1806 | ||
| 1829 | /* If we have no swap space, do not bother scanning anon pages. */ | 1807 | /* If we have no swap space, do not bother scanning anon pages. */ |
| 1830 | if (!sc->may_swap || (nr_swap_pages <= 0)) { | 1808 | if (!sc->may_swap || (nr_swap_pages <= 0)) { |
| @@ -1837,6 +1815,11 @@ static void get_scan_count(struct zone *zone, struct scan_control *sc, | |||
| 1837 | goto out; | 1815 | goto out; |
| 1838 | } | 1816 | } |
| 1839 | 1817 | ||
| 1818 | anon = zone_nr_lru_pages(zone, sc, LRU_ACTIVE_ANON) + | ||
| 1819 | zone_nr_lru_pages(zone, sc, LRU_INACTIVE_ANON); | ||
| 1820 | file = zone_nr_lru_pages(zone, sc, LRU_ACTIVE_FILE) + | ||
| 1821 | zone_nr_lru_pages(zone, sc, LRU_INACTIVE_FILE); | ||
| 1822 | |||
| 1840 | if (scanning_global_lru(sc)) { | 1823 | if (scanning_global_lru(sc)) { |
| 1841 | free = zone_page_state(zone, NR_FREE_PAGES); | 1824 | free = zone_page_state(zone, NR_FREE_PAGES); |
| 1842 | /* If we have very few page cache pages, | 1825 | /* If we have very few page cache pages, |
| @@ -2268,10 +2251,9 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order, | |||
| 2268 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR | 2251 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR |
| 2269 | 2252 | ||
| 2270 | unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem, | 2253 | unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem, |
| 2271 | gfp_t gfp_mask, bool noswap, | 2254 | gfp_t gfp_mask, bool noswap, |
| 2272 | struct zone *zone, | 2255 | struct zone *zone, |
| 2273 | struct memcg_scanrecord *rec, | 2256 | unsigned long *nr_scanned) |
| 2274 | unsigned long *scanned) | ||
| 2275 | { | 2257 | { |
| 2276 | struct scan_control sc = { | 2258 | struct scan_control sc = { |
| 2277 | .nr_scanned = 0, | 2259 | .nr_scanned = 0, |
| @@ -2281,9 +2263,7 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem, | |||
| 2281 | .may_swap = !noswap, | 2263 | .may_swap = !noswap, |
| 2282 | .order = 0, | 2264 | .order = 0, |
| 2283 | .mem_cgroup = mem, | 2265 | .mem_cgroup = mem, |
| 2284 | .memcg_record = rec, | ||
| 2285 | }; | 2266 | }; |
| 2286 | ktime_t start, end; | ||
| 2287 | 2267 | ||
| 2288 | sc.gfp_mask = (gfp_mask & GFP_RECLAIM_MASK) | | 2268 | sc.gfp_mask = (gfp_mask & GFP_RECLAIM_MASK) | |
| 2289 | (GFP_HIGHUSER_MOVABLE & ~GFP_RECLAIM_MASK); | 2269 | (GFP_HIGHUSER_MOVABLE & ~GFP_RECLAIM_MASK); |
| @@ -2292,7 +2272,6 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem, | |||
| 2292 | sc.may_writepage, | 2272 | sc.may_writepage, |
| 2293 | sc.gfp_mask); | 2273 | sc.gfp_mask); |
| 2294 | 2274 | ||
| 2295 | start = ktime_get(); | ||
| 2296 | /* | 2275 | /* |
| 2297 | * NOTE: Although we can get the priority field, using it | 2276 | * NOTE: Although we can get the priority field, using it |
| 2298 | * here is not a good idea, since it limits the pages we can scan. | 2277 | * here is not a good idea, since it limits the pages we can scan. |
| @@ -2301,25 +2280,19 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem, | |||
| 2301 | * the priority and make it zero. | 2280 | * the priority and make it zero. |
| 2302 | */ | 2281 | */ |
| 2303 | shrink_zone(0, zone, &sc); | 2282 | shrink_zone(0, zone, &sc); |
| 2304 | end = ktime_get(); | ||
| 2305 | |||
| 2306 | if (rec) | ||
| 2307 | rec->elapsed += ktime_to_ns(ktime_sub(end, start)); | ||
| 2308 | *scanned = sc.nr_scanned; | ||
| 2309 | 2283 | ||
| 2310 | trace_mm_vmscan_memcg_softlimit_reclaim_end(sc.nr_reclaimed); | 2284 | trace_mm_vmscan_memcg_softlimit_reclaim_end(sc.nr_reclaimed); |
| 2311 | 2285 | ||
| 2286 | *nr_scanned = sc.nr_scanned; | ||
| 2312 | return sc.nr_reclaimed; | 2287 | return sc.nr_reclaimed; |
| 2313 | } | 2288 | } |
| 2314 | 2289 | ||
| 2315 | unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont, | 2290 | unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont, |
| 2316 | gfp_t gfp_mask, | 2291 | gfp_t gfp_mask, |
| 2317 | bool noswap, | 2292 | bool noswap) |
| 2318 | struct memcg_scanrecord *rec) | ||
| 2319 | { | 2293 | { |
| 2320 | struct zonelist *zonelist; | 2294 | struct zonelist *zonelist; |
| 2321 | unsigned long nr_reclaimed; | 2295 | unsigned long nr_reclaimed; |
| 2322 | ktime_t start, end; | ||
| 2323 | int nid; | 2296 | int nid; |
| 2324 | struct scan_control sc = { | 2297 | struct scan_control sc = { |
| 2325 | .may_writepage = !laptop_mode, | 2298 | .may_writepage = !laptop_mode, |
| @@ -2328,7 +2301,6 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont, | |||
| 2328 | .nr_to_reclaim = SWAP_CLUSTER_MAX, | 2301 | .nr_to_reclaim = SWAP_CLUSTER_MAX, |
| 2329 | .order = 0, | 2302 | .order = 0, |
| 2330 | .mem_cgroup = mem_cont, | 2303 | .mem_cgroup = mem_cont, |
| 2331 | .memcg_record = rec, | ||
| 2332 | .nodemask = NULL, /* we don't care the placement */ | 2304 | .nodemask = NULL, /* we don't care the placement */ |
| 2333 | .gfp_mask = (gfp_mask & GFP_RECLAIM_MASK) | | 2305 | .gfp_mask = (gfp_mask & GFP_RECLAIM_MASK) | |
| 2334 | (GFP_HIGHUSER_MOVABLE & ~GFP_RECLAIM_MASK), | 2306 | (GFP_HIGHUSER_MOVABLE & ~GFP_RECLAIM_MASK), |
| @@ -2337,7 +2309,6 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont, | |||
| 2337 | .gfp_mask = sc.gfp_mask, | 2309 | .gfp_mask = sc.gfp_mask, |
| 2338 | }; | 2310 | }; |
| 2339 | 2311 | ||
| 2340 | start = ktime_get(); | ||
| 2341 | /* | 2312 | /* |
| 2342 | * Unlike direct reclaim via alloc_pages(), memcg's reclaim doesn't | 2313 | * Unlike direct reclaim via alloc_pages(), memcg's reclaim doesn't |
| 2343 | * take care of from where we get pages. So the node where we start the | 2314 | * take care of from where we get pages. So the node where we start the |
| @@ -2352,9 +2323,6 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont, | |||
| 2352 | sc.gfp_mask); | 2323 | sc.gfp_mask); |
| 2353 | 2324 | ||
| 2354 | nr_reclaimed = do_try_to_free_pages(zonelist, &sc, &shrink); | 2325 | nr_reclaimed = do_try_to_free_pages(zonelist, &sc, &shrink); |
| 2355 | end = ktime_get(); | ||
| 2356 | if (rec) | ||
| 2357 | rec->elapsed += ktime_to_ns(ktime_sub(end, start)); | ||
| 2358 | 2326 | ||
| 2359 | trace_mm_vmscan_memcg_reclaim_end(nr_reclaimed); | 2327 | trace_mm_vmscan_memcg_reclaim_end(nr_reclaimed); |
| 2360 | 2328 | ||
diff --git a/mm/vmstat.c b/mm/vmstat.c index 20c18b7694b2..d52b13d28e8f 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c | |||
| @@ -659,7 +659,7 @@ static void walk_zones_in_node(struct seq_file *m, pg_data_t *pgdat, | |||
| 659 | } | 659 | } |
| 660 | #endif | 660 | #endif |
| 661 | 661 | ||
| 662 | #if defined(CONFIG_PROC_FS) || defined(CONFIG_SYSFS) | 662 | #if defined(CONFIG_PROC_FS) || defined(CONFIG_SYSFS) || defined(CONFIG_NUMA) |
| 663 | #ifdef CONFIG_ZONE_DMA | 663 | #ifdef CONFIG_ZONE_DMA |
| 664 | #define TEXT_FOR_DMA(xx) xx "_dma", | 664 | #define TEXT_FOR_DMA(xx) xx "_dma", |
| 665 | #else | 665 | #else |
| @@ -788,7 +788,7 @@ const char * const vmstat_text[] = { | |||
| 788 | 788 | ||
| 789 | #endif /* CONFIG_VM_EVENTS_COUNTERS */ | 789 | #endif /* CONFIG_VM_EVENTS_COUNTERS */ |
| 790 | }; | 790 | }; |
| 791 | #endif /* CONFIG_PROC_FS || CONFIG_SYSFS */ | 791 | #endif /* CONFIG_PROC_FS || CONFIG_SYSFS || CONFIG_NUMA */ |
| 792 | 792 | ||
| 793 | 793 | ||
| 794 | #ifdef CONFIG_PROC_FS | 794 | #ifdef CONFIG_PROC_FS |
diff --git a/net/bridge/netfilter/Kconfig b/net/bridge/netfilter/Kconfig index ba6f73eb06c6..a9aff9c7d027 100644 --- a/net/bridge/netfilter/Kconfig +++ b/net/bridge/netfilter/Kconfig | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | menuconfig BRIDGE_NF_EBTABLES | 5 | menuconfig BRIDGE_NF_EBTABLES |
| 6 | tristate "Ethernet Bridge tables (ebtables) support" | 6 | tristate "Ethernet Bridge tables (ebtables) support" |
| 7 | depends on BRIDGE && BRIDGE_NETFILTER | 7 | depends on BRIDGE && NETFILTER |
| 8 | select NETFILTER_XTABLES | 8 | select NETFILTER_XTABLES |
| 9 | help | 9 | help |
| 10 | ebtables is a general, extensible frame/packet identification | 10 | ebtables is a general, extensible frame/packet identification |
diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c index 7c2fa0a08148..7f9ac0742d19 100644 --- a/net/caif/caif_dev.c +++ b/net/caif/caif_dev.c | |||
| @@ -93,10 +93,14 @@ static struct caif_device_entry *caif_device_alloc(struct net_device *dev) | |||
| 93 | caifdevs = caif_device_list(dev_net(dev)); | 93 | caifdevs = caif_device_list(dev_net(dev)); |
| 94 | BUG_ON(!caifdevs); | 94 | BUG_ON(!caifdevs); |
| 95 | 95 | ||
| 96 | caifd = kzalloc(sizeof(*caifd), GFP_ATOMIC); | 96 | caifd = kzalloc(sizeof(*caifd), GFP_KERNEL); |
| 97 | if (!caifd) | 97 | if (!caifd) |
| 98 | return NULL; | 98 | return NULL; |
| 99 | caifd->pcpu_refcnt = alloc_percpu(int); | 99 | caifd->pcpu_refcnt = alloc_percpu(int); |
| 100 | if (!caifd->pcpu_refcnt) { | ||
| 101 | kfree(caifd); | ||
| 102 | return NULL; | ||
| 103 | } | ||
| 100 | caifd->netdev = dev; | 104 | caifd->netdev = dev; |
| 101 | dev_hold(dev); | 105 | dev_hold(dev); |
| 102 | return caifd; | 106 | return caifd; |
diff --git a/net/can/af_can.c b/net/can/af_can.c index 8ce926d3b2cb..9b0c32a2690c 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c | |||
| @@ -857,7 +857,7 @@ static __exit void can_exit(void) | |||
| 857 | struct net_device *dev; | 857 | struct net_device *dev; |
| 858 | 858 | ||
| 859 | if (stats_timer) | 859 | if (stats_timer) |
| 860 | del_timer(&can_stattimer); | 860 | del_timer_sync(&can_stattimer); |
| 861 | 861 | ||
| 862 | can_remove_proc(); | 862 | can_remove_proc(); |
| 863 | 863 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index 17d67b579beb..b10ff0a71855 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
| @@ -1515,6 +1515,14 @@ static inline bool is_skb_forwardable(struct net_device *dev, | |||
| 1515 | */ | 1515 | */ |
| 1516 | int dev_forward_skb(struct net_device *dev, struct sk_buff *skb) | 1516 | int dev_forward_skb(struct net_device *dev, struct sk_buff *skb) |
| 1517 | { | 1517 | { |
| 1518 | if (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY) { | ||
| 1519 | if (skb_copy_ubufs(skb, GFP_ATOMIC)) { | ||
| 1520 | atomic_long_inc(&dev->rx_dropped); | ||
| 1521 | kfree_skb(skb); | ||
| 1522 | return NET_RX_DROP; | ||
| 1523 | } | ||
| 1524 | } | ||
| 1525 | |||
| 1518 | skb_orphan(skb); | 1526 | skb_orphan(skb); |
| 1519 | nf_reset(skb); | 1527 | nf_reset(skb); |
| 1520 | 1528 | ||
diff --git a/net/core/flow.c b/net/core/flow.c index bf32c33cad3b..555a456efb07 100644 --- a/net/core/flow.c +++ b/net/core/flow.c | |||
| @@ -30,6 +30,7 @@ struct flow_cache_entry { | |||
| 30 | struct hlist_node hlist; | 30 | struct hlist_node hlist; |
| 31 | struct list_head gc_list; | 31 | struct list_head gc_list; |
| 32 | } u; | 32 | } u; |
| 33 | struct net *net; | ||
| 33 | u16 family; | 34 | u16 family; |
| 34 | u8 dir; | 35 | u8 dir; |
| 35 | u32 genid; | 36 | u32 genid; |
| @@ -172,29 +173,26 @@ static void flow_new_hash_rnd(struct flow_cache *fc, | |||
| 172 | 173 | ||
| 173 | static u32 flow_hash_code(struct flow_cache *fc, | 174 | static u32 flow_hash_code(struct flow_cache *fc, |
| 174 | struct flow_cache_percpu *fcp, | 175 | struct flow_cache_percpu *fcp, |
| 175 | const struct flowi *key) | 176 | const struct flowi *key, |
| 177 | size_t keysize) | ||
| 176 | { | 178 | { |
| 177 | const u32 *k = (const u32 *) key; | 179 | const u32 *k = (const u32 *) key; |
| 180 | const u32 length = keysize * sizeof(flow_compare_t) / sizeof(u32); | ||
| 178 | 181 | ||
| 179 | return jhash2(k, (sizeof(*key) / sizeof(u32)), fcp->hash_rnd) | 182 | return jhash2(k, length, fcp->hash_rnd) |
| 180 | & (flow_cache_hash_size(fc) - 1); | 183 | & (flow_cache_hash_size(fc) - 1); |
| 181 | } | 184 | } |
| 182 | 185 | ||
| 183 | typedef unsigned long flow_compare_t; | ||
| 184 | |||
| 185 | /* I hear what you're saying, use memcmp. But memcmp cannot make | 186 | /* I hear what you're saying, use memcmp. But memcmp cannot make |
| 186 | * important assumptions that we can here, such as alignment and | 187 | * important assumptions that we can here, such as alignment. |
| 187 | * constant size. | ||
| 188 | */ | 188 | */ |
| 189 | static int flow_key_compare(const struct flowi *key1, const struct flowi *key2) | 189 | static int flow_key_compare(const struct flowi *key1, const struct flowi *key2, |
| 190 | size_t keysize) | ||
| 190 | { | 191 | { |
| 191 | const flow_compare_t *k1, *k1_lim, *k2; | 192 | const flow_compare_t *k1, *k1_lim, *k2; |
| 192 | const int n_elem = sizeof(struct flowi) / sizeof(flow_compare_t); | ||
| 193 | |||
| 194 | BUILD_BUG_ON(sizeof(struct flowi) % sizeof(flow_compare_t)); | ||
| 195 | 193 | ||
| 196 | k1 = (const flow_compare_t *) key1; | 194 | k1 = (const flow_compare_t *) key1; |
| 197 | k1_lim = k1 + n_elem; | 195 | k1_lim = k1 + keysize; |
| 198 | 196 | ||
| 199 | k2 = (const flow_compare_t *) key2; | 197 | k2 = (const flow_compare_t *) key2; |
| 200 | 198 | ||
| @@ -215,6 +213,7 @@ flow_cache_lookup(struct net *net, const struct flowi *key, u16 family, u8 dir, | |||
| 215 | struct flow_cache_entry *fle, *tfle; | 213 | struct flow_cache_entry *fle, *tfle; |
| 216 | struct hlist_node *entry; | 214 | struct hlist_node *entry; |
| 217 | struct flow_cache_object *flo; | 215 | struct flow_cache_object *flo; |
| 216 | size_t keysize; | ||
| 218 | unsigned int hash; | 217 | unsigned int hash; |
| 219 | 218 | ||
| 220 | local_bh_disable(); | 219 | local_bh_disable(); |
| @@ -222,6 +221,11 @@ flow_cache_lookup(struct net *net, const struct flowi *key, u16 family, u8 dir, | |||
| 222 | 221 | ||
| 223 | fle = NULL; | 222 | fle = NULL; |
| 224 | flo = NULL; | 223 | flo = NULL; |
| 224 | |||
| 225 | keysize = flow_key_size(family); | ||
| 226 | if (!keysize) | ||
| 227 | goto nocache; | ||
| 228 | |||
| 225 | /* Packet really early in init? Making flow_cache_init a | 229 | /* Packet really early in init? Making flow_cache_init a |
| 226 | * pre-smp initcall would solve this. --RR */ | 230 | * pre-smp initcall would solve this. --RR */ |
| 227 | if (!fcp->hash_table) | 231 | if (!fcp->hash_table) |
| @@ -230,11 +234,12 @@ flow_cache_lookup(struct net *net, const struct flowi *key, u16 family, u8 dir, | |||
| 230 | if (fcp->hash_rnd_recalc) | 234 | if (fcp->hash_rnd_recalc) |
| 231 | flow_new_hash_rnd(fc, fcp); | 235 | flow_new_hash_rnd(fc, fcp); |
| 232 | 236 | ||
| 233 | hash = flow_hash_code(fc, fcp, key); | 237 | hash = flow_hash_code(fc, fcp, key, keysize); |
| 234 | hlist_for_each_entry(tfle, entry, &fcp->hash_table[hash], u.hlist) { | 238 | hlist_for_each_entry(tfle, entry, &fcp->hash_table[hash], u.hlist) { |
| 235 | if (tfle->family == family && | 239 | if (tfle->net == net && |
| 240 | tfle->family == family && | ||
| 236 | tfle->dir == dir && | 241 | tfle->dir == dir && |
| 237 | flow_key_compare(key, &tfle->key) == 0) { | 242 | flow_key_compare(key, &tfle->key, keysize) == 0) { |
| 238 | fle = tfle; | 243 | fle = tfle; |
| 239 | break; | 244 | break; |
| 240 | } | 245 | } |
| @@ -246,9 +251,10 @@ flow_cache_lookup(struct net *net, const struct flowi *key, u16 family, u8 dir, | |||
| 246 | 251 | ||
| 247 | fle = kmem_cache_alloc(flow_cachep, GFP_ATOMIC); | 252 | fle = kmem_cache_alloc(flow_cachep, GFP_ATOMIC); |
| 248 | if (fle) { | 253 | if (fle) { |
| 254 | fle->net = net; | ||
| 249 | fle->family = family; | 255 | fle->family = family; |
| 250 | fle->dir = dir; | 256 | fle->dir = dir; |
| 251 | memcpy(&fle->key, key, sizeof(*key)); | 257 | memcpy(&fle->key, key, keysize * sizeof(flow_compare_t)); |
| 252 | fle->object = NULL; | 258 | fle->object = NULL; |
| 253 | hlist_add_head(&fle->u.hlist, &fcp->hash_table[hash]); | 259 | hlist_add_head(&fle->u.hlist, &fcp->hash_table[hash]); |
| 254 | fcp->hash_count++; | 260 | fcp->hash_count++; |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 27002dffe7ed..387703f56fce 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
| @@ -611,8 +611,21 @@ struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src) | |||
| 611 | } | 611 | } |
| 612 | EXPORT_SYMBOL_GPL(skb_morph); | 612 | EXPORT_SYMBOL_GPL(skb_morph); |
| 613 | 613 | ||
| 614 | /* skb frags copy userspace buffers to kernel */ | 614 | /* skb_copy_ubufs - copy userspace skb frags buffers to kernel |
| 615 | static int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask) | 615 | * @skb: the skb to modify |
| 616 | * @gfp_mask: allocation priority | ||
| 617 | * | ||
| 618 | * This must be called on SKBTX_DEV_ZEROCOPY skb. | ||
| 619 | * It will copy all frags into kernel and drop the reference | ||
| 620 | * to userspace pages. | ||
| 621 | * | ||
| 622 | * If this function is called from an interrupt gfp_mask() must be | ||
| 623 | * %GFP_ATOMIC. | ||
| 624 | * | ||
| 625 | * Returns 0 on success or a negative error code on failure | ||
| 626 | * to allocate kernel memory to copy to. | ||
| 627 | */ | ||
| 628 | int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask) | ||
| 616 | { | 629 | { |
| 617 | int i; | 630 | int i; |
| 618 | int num_frags = skb_shinfo(skb)->nr_frags; | 631 | int num_frags = skb_shinfo(skb)->nr_frags; |
| @@ -652,6 +665,8 @@ static int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask) | |||
| 652 | skb_shinfo(skb)->frags[i - 1].page = head; | 665 | skb_shinfo(skb)->frags[i - 1].page = head; |
| 653 | head = (struct page *)head->private; | 666 | head = (struct page *)head->private; |
| 654 | } | 667 | } |
| 668 | |||
| 669 | skb_shinfo(skb)->tx_flags &= ~SKBTX_DEV_ZEROCOPY; | ||
| 655 | return 0; | 670 | return 0; |
| 656 | } | 671 | } |
| 657 | 672 | ||
| @@ -677,7 +692,6 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask) | |||
| 677 | if (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY) { | 692 | if (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY) { |
| 678 | if (skb_copy_ubufs(skb, gfp_mask)) | 693 | if (skb_copy_ubufs(skb, gfp_mask)) |
| 679 | return NULL; | 694 | return NULL; |
| 680 | skb_shinfo(skb)->tx_flags &= ~SKBTX_DEV_ZEROCOPY; | ||
| 681 | } | 695 | } |
| 682 | 696 | ||
| 683 | n = skb + 1; | 697 | n = skb + 1; |
| @@ -803,7 +817,6 @@ struct sk_buff *pskb_copy(struct sk_buff *skb, gfp_t gfp_mask) | |||
| 803 | n = NULL; | 817 | n = NULL; |
| 804 | goto out; | 818 | goto out; |
| 805 | } | 819 | } |
| 806 | skb_shinfo(skb)->tx_flags &= ~SKBTX_DEV_ZEROCOPY; | ||
| 807 | } | 820 | } |
| 808 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 821 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
| 809 | skb_shinfo(n)->frags[i] = skb_shinfo(skb)->frags[i]; | 822 | skb_shinfo(n)->frags[i] = skb_shinfo(skb)->frags[i]; |
| @@ -896,7 +909,6 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, | |||
| 896 | if (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY) { | 909 | if (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY) { |
| 897 | if (skb_copy_ubufs(skb, gfp_mask)) | 910 | if (skb_copy_ubufs(skb, gfp_mask)) |
| 898 | goto nofrags; | 911 | goto nofrags; |
| 899 | skb_shinfo(skb)->tx_flags &= ~SKBTX_DEV_ZEROCOPY; | ||
| 900 | } | 912 | } |
| 901 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) | 913 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) |
| 902 | get_page(skb_shinfo(skb)->frags[i].page); | 914 | get_page(skb_shinfo(skb)->frags[i].page); |
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index 27997d35ebd3..a2468363978e 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c | |||
| @@ -340,7 +340,7 @@ void ether_setup(struct net_device *dev) | |||
| 340 | dev->addr_len = ETH_ALEN; | 340 | dev->addr_len = ETH_ALEN; |
| 341 | dev->tx_queue_len = 1000; /* Ethernet wants good queues */ | 341 | dev->tx_queue_len = 1000; /* Ethernet wants good queues */ |
| 342 | dev->flags = IFF_BROADCAST|IFF_MULTICAST; | 342 | dev->flags = IFF_BROADCAST|IFF_MULTICAST; |
| 343 | dev->priv_flags = IFF_TX_SKB_SHARING; | 343 | dev->priv_flags |= IFF_TX_SKB_SHARING; |
| 344 | 344 | ||
| 345 | memset(dev->broadcast, 0xFF, ETH_ALEN); | 345 | memset(dev->broadcast, 0xFF, ETH_ALEN); |
| 346 | 346 | ||
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 1b745d412cf6..dd2b9478ddd1 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
| @@ -466,8 +466,13 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
| 466 | goto out; | 466 | goto out; |
| 467 | 467 | ||
| 468 | if (addr->sin_family != AF_INET) { | 468 | if (addr->sin_family != AF_INET) { |
| 469 | /* Compatibility games : accept AF_UNSPEC (mapped to AF_INET) | ||
| 470 | * only if s_addr is INADDR_ANY. | ||
| 471 | */ | ||
| 469 | err = -EAFNOSUPPORT; | 472 | err = -EAFNOSUPPORT; |
| 470 | goto out; | 473 | if (addr->sin_family != AF_UNSPEC || |
| 474 | addr->sin_addr.s_addr != htonl(INADDR_ANY)) | ||
| 475 | goto out; | ||
| 471 | } | 476 | } |
| 472 | 477 | ||
| 473 | chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr); | 478 | chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr); |
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 33e2c35b74b7..80106d89d548 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
| @@ -142,6 +142,14 @@ const struct fib_prop fib_props[RTN_MAX + 1] = { | |||
| 142 | }; | 142 | }; |
| 143 | 143 | ||
| 144 | /* Release a nexthop info record */ | 144 | /* Release a nexthop info record */ |
| 145 | static void free_fib_info_rcu(struct rcu_head *head) | ||
| 146 | { | ||
| 147 | struct fib_info *fi = container_of(head, struct fib_info, rcu); | ||
| 148 | |||
| 149 | if (fi->fib_metrics != (u32 *) dst_default_metrics) | ||
| 150 | kfree(fi->fib_metrics); | ||
| 151 | kfree(fi); | ||
| 152 | } | ||
| 145 | 153 | ||
| 146 | void free_fib_info(struct fib_info *fi) | 154 | void free_fib_info(struct fib_info *fi) |
| 147 | { | 155 | { |
| @@ -156,7 +164,7 @@ void free_fib_info(struct fib_info *fi) | |||
| 156 | } endfor_nexthops(fi); | 164 | } endfor_nexthops(fi); |
| 157 | fib_info_cnt--; | 165 | fib_info_cnt--; |
| 158 | release_net(fi->fib_net); | 166 | release_net(fi->fib_net); |
| 159 | kfree_rcu(fi, rcu); | 167 | call_rcu(&fi->rcu, free_fib_info_rcu); |
| 160 | } | 168 | } |
| 161 | 169 | ||
| 162 | void fib_release_info(struct fib_info *fi) | 170 | void fib_release_info(struct fib_info *fi) |
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c index 5c9b9d963918..e59aabd0eae4 100644 --- a/net/ipv4/netfilter/ip_queue.c +++ b/net/ipv4/netfilter/ip_queue.c | |||
| @@ -218,6 +218,7 @@ ipq_build_packet_message(struct nf_queue_entry *entry, int *errp) | |||
| 218 | return skb; | 218 | return skb; |
| 219 | 219 | ||
| 220 | nlmsg_failure: | 220 | nlmsg_failure: |
| 221 | kfree_skb(skb); | ||
| 221 | *errp = -EINVAL; | 222 | *errp = -EINVAL; |
| 222 | printk(KERN_ERR "ip_queue: error creating packet message\n"); | 223 | printk(KERN_ERR "ip_queue: error creating packet message\n"); |
| 223 | return NULL; | 224 | return NULL; |
| @@ -313,7 +314,7 @@ ipq_set_verdict(struct ipq_verdict_msg *vmsg, unsigned int len) | |||
| 313 | { | 314 | { |
| 314 | struct nf_queue_entry *entry; | 315 | struct nf_queue_entry *entry; |
| 315 | 316 | ||
| 316 | if (vmsg->value > NF_MAX_VERDICT) | 317 | if (vmsg->value > NF_MAX_VERDICT || vmsg->value == NF_STOLEN) |
| 317 | return -EINVAL; | 318 | return -EINVAL; |
| 318 | 319 | ||
| 319 | entry = ipq_find_dequeue_entry(vmsg->id); | 320 | entry = ipq_find_dequeue_entry(vmsg->id); |
| @@ -358,12 +359,9 @@ ipq_receive_peer(struct ipq_peer_msg *pmsg, | |||
| 358 | break; | 359 | break; |
| 359 | 360 | ||
| 360 | case IPQM_VERDICT: | 361 | case IPQM_VERDICT: |
| 361 | if (pmsg->msg.verdict.value > NF_MAX_VERDICT) | 362 | status = ipq_set_verdict(&pmsg->msg.verdict, |
| 362 | status = -EINVAL; | 363 | len - sizeof(*pmsg)); |
| 363 | else | 364 | break; |
| 364 | status = ipq_set_verdict(&pmsg->msg.verdict, | ||
| 365 | len - sizeof(*pmsg)); | ||
| 366 | break; | ||
| 367 | default: | 365 | default: |
| 368 | status = -EINVAL; | 366 | status = -EINVAL; |
| 369 | } | 367 | } |
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index b14ec7d03b6e..4bfad5da94f4 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c | |||
| @@ -254,6 +254,8 @@ static const struct snmp_mib snmp4_net_list[] = { | |||
| 254 | SNMP_MIB_ITEM("TCPDeferAcceptDrop", LINUX_MIB_TCPDEFERACCEPTDROP), | 254 | SNMP_MIB_ITEM("TCPDeferAcceptDrop", LINUX_MIB_TCPDEFERACCEPTDROP), |
| 255 | SNMP_MIB_ITEM("IPReversePathFilter", LINUX_MIB_IPRPFILTER), | 255 | SNMP_MIB_ITEM("IPReversePathFilter", LINUX_MIB_IPRPFILTER), |
| 256 | SNMP_MIB_ITEM("TCPTimeWaitOverflow", LINUX_MIB_TCPTIMEWAITOVERFLOW), | 256 | SNMP_MIB_ITEM("TCPTimeWaitOverflow", LINUX_MIB_TCPTIMEWAITOVERFLOW), |
| 257 | SNMP_MIB_ITEM("TCPReqQFullDoCookies", LINUX_MIB_TCPREQQFULLDOCOOKIES), | ||
| 258 | SNMP_MIB_ITEM("TCPReqQFullDrop", LINUX_MIB_TCPREQQFULLDROP), | ||
| 257 | SNMP_MIB_SENTINEL | 259 | SNMP_MIB_SENTINEL |
| 258 | }; | 260 | }; |
| 259 | 261 | ||
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index ea0d2183df4b..21fab3edb92c 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
| @@ -1124,7 +1124,7 @@ static int tcp_is_sackblock_valid(struct tcp_sock *tp, int is_dsack, | |||
| 1124 | return 0; | 1124 | return 0; |
| 1125 | 1125 | ||
| 1126 | /* ...Then it's D-SACK, and must reside below snd_una completely */ | 1126 | /* ...Then it's D-SACK, and must reside below snd_una completely */ |
| 1127 | if (!after(end_seq, tp->snd_una)) | 1127 | if (after(end_seq, tp->snd_una)) |
| 1128 | return 0; | 1128 | return 0; |
| 1129 | 1129 | ||
| 1130 | if (!before(start_seq, tp->undo_marker)) | 1130 | if (!before(start_seq, tp->undo_marker)) |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 1c12b8ec849d..c34f01513945 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
| @@ -808,20 +808,38 @@ static void tcp_v4_reqsk_destructor(struct request_sock *req) | |||
| 808 | kfree(inet_rsk(req)->opt); | 808 | kfree(inet_rsk(req)->opt); |
| 809 | } | 809 | } |
| 810 | 810 | ||
| 811 | static void syn_flood_warning(const struct sk_buff *skb) | 811 | /* |
| 812 | * Return 1 if a syncookie should be sent | ||
| 813 | */ | ||
| 814 | int tcp_syn_flood_action(struct sock *sk, | ||
| 815 | const struct sk_buff *skb, | ||
| 816 | const char *proto) | ||
| 812 | { | 817 | { |
| 813 | const char *msg; | 818 | const char *msg = "Dropping request"; |
| 819 | int want_cookie = 0; | ||
| 820 | struct listen_sock *lopt; | ||
| 821 | |||
| 822 | |||
| 814 | 823 | ||
| 815 | #ifdef CONFIG_SYN_COOKIES | 824 | #ifdef CONFIG_SYN_COOKIES |
| 816 | if (sysctl_tcp_syncookies) | 825 | if (sysctl_tcp_syncookies) { |
| 817 | msg = "Sending cookies"; | 826 | msg = "Sending cookies"; |
| 818 | else | 827 | want_cookie = 1; |
| 828 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPREQQFULLDOCOOKIES); | ||
| 829 | } else | ||
| 819 | #endif | 830 | #endif |
| 820 | msg = "Dropping request"; | 831 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPREQQFULLDROP); |
| 821 | 832 | ||
| 822 | pr_info("TCP: Possible SYN flooding on port %d. %s.\n", | 833 | lopt = inet_csk(sk)->icsk_accept_queue.listen_opt; |
| 823 | ntohs(tcp_hdr(skb)->dest), msg); | 834 | if (!lopt->synflood_warned) { |
| 835 | lopt->synflood_warned = 1; | ||
| 836 | pr_info("%s: Possible SYN flooding on port %d. %s. " | ||
| 837 | " Check SNMP counters.\n", | ||
| 838 | proto, ntohs(tcp_hdr(skb)->dest), msg); | ||
| 839 | } | ||
| 840 | return want_cookie; | ||
| 824 | } | 841 | } |
| 842 | EXPORT_SYMBOL(tcp_syn_flood_action); | ||
| 825 | 843 | ||
| 826 | /* | 844 | /* |
| 827 | * Save and compile IPv4 options into the request_sock if needed. | 845 | * Save and compile IPv4 options into the request_sock if needed. |
| @@ -1235,11 +1253,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
| 1235 | __be32 saddr = ip_hdr(skb)->saddr; | 1253 | __be32 saddr = ip_hdr(skb)->saddr; |
| 1236 | __be32 daddr = ip_hdr(skb)->daddr; | 1254 | __be32 daddr = ip_hdr(skb)->daddr; |
| 1237 | __u32 isn = TCP_SKB_CB(skb)->when; | 1255 | __u32 isn = TCP_SKB_CB(skb)->when; |
| 1238 | #ifdef CONFIG_SYN_COOKIES | ||
| 1239 | int want_cookie = 0; | 1256 | int want_cookie = 0; |
| 1240 | #else | ||
| 1241 | #define want_cookie 0 /* Argh, why doesn't gcc optimize this :( */ | ||
| 1242 | #endif | ||
| 1243 | 1257 | ||
| 1244 | /* Never answer to SYNs send to broadcast or multicast */ | 1258 | /* Never answer to SYNs send to broadcast or multicast */ |
| 1245 | if (skb_rtable(skb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) | 1259 | if (skb_rtable(skb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) |
| @@ -1250,14 +1264,9 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
| 1250 | * evidently real one. | 1264 | * evidently real one. |
| 1251 | */ | 1265 | */ |
| 1252 | if (inet_csk_reqsk_queue_is_full(sk) && !isn) { | 1266 | if (inet_csk_reqsk_queue_is_full(sk) && !isn) { |
| 1253 | if (net_ratelimit()) | 1267 | want_cookie = tcp_syn_flood_action(sk, skb, "TCP"); |
| 1254 | syn_flood_warning(skb); | 1268 | if (!want_cookie) |
| 1255 | #ifdef CONFIG_SYN_COOKIES | 1269 | goto drop; |
| 1256 | if (sysctl_tcp_syncookies) { | ||
| 1257 | want_cookie = 1; | ||
| 1258 | } else | ||
| 1259 | #endif | ||
| 1260 | goto drop; | ||
| 1261 | } | 1270 | } |
| 1262 | 1271 | ||
| 1263 | /* Accept backlog is full. If we have already queued enough | 1272 | /* Accept backlog is full. If we have already queued enough |
| @@ -1303,9 +1312,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
| 1303 | while (l-- > 0) | 1312 | while (l-- > 0) |
| 1304 | *c++ ^= *hash_location++; | 1313 | *c++ ^= *hash_location++; |
| 1305 | 1314 | ||
| 1306 | #ifdef CONFIG_SYN_COOKIES | ||
| 1307 | want_cookie = 0; /* not our kind of cookie */ | 1315 | want_cookie = 0; /* not our kind of cookie */ |
| 1308 | #endif | ||
| 1309 | tmp_ext.cookie_out_never = 0; /* false */ | 1316 | tmp_ext.cookie_out_never = 0; /* false */ |
| 1310 | tmp_ext.cookie_plus = tmp_opt.cookie_plus; | 1317 | tmp_ext.cookie_plus = tmp_opt.cookie_plus; |
| 1311 | } else if (!tp->rx_opt.cookie_in_always) { | 1318 | } else if (!tp->rx_opt.cookie_in_always) { |
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index 9ef1831746ef..b46e9f88ce37 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c | |||
| @@ -599,7 +599,7 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb) | |||
| 599 | return 0; | 599 | return 0; |
| 600 | } | 600 | } |
| 601 | 601 | ||
| 602 | int datagram_send_ctl(struct net *net, | 602 | int datagram_send_ctl(struct net *net, struct sock *sk, |
| 603 | struct msghdr *msg, struct flowi6 *fl6, | 603 | struct msghdr *msg, struct flowi6 *fl6, |
| 604 | struct ipv6_txoptions *opt, | 604 | struct ipv6_txoptions *opt, |
| 605 | int *hlimit, int *tclass, int *dontfrag) | 605 | int *hlimit, int *tclass, int *dontfrag) |
| @@ -658,7 +658,8 @@ int datagram_send_ctl(struct net *net, | |||
| 658 | 658 | ||
| 659 | if (addr_type != IPV6_ADDR_ANY) { | 659 | if (addr_type != IPV6_ADDR_ANY) { |
| 660 | int strict = __ipv6_addr_src_scope(addr_type) <= IPV6_ADDR_SCOPE_LINKLOCAL; | 660 | int strict = __ipv6_addr_src_scope(addr_type) <= IPV6_ADDR_SCOPE_LINKLOCAL; |
| 661 | if (!ipv6_chk_addr(net, &src_info->ipi6_addr, | 661 | if (!inet_sk(sk)->transparent && |
| 662 | !ipv6_chk_addr(net, &src_info->ipi6_addr, | ||
| 662 | strict ? dev : NULL, 0)) | 663 | strict ? dev : NULL, 0)) |
| 663 | err = -EINVAL; | 664 | err = -EINVAL; |
| 664 | else | 665 | else |
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index f3caf1b8d572..543039450193 100644 --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c | |||
| @@ -322,8 +322,8 @@ static int fl6_renew(struct ip6_flowlabel *fl, unsigned long linger, unsigned lo | |||
| 322 | } | 322 | } |
| 323 | 323 | ||
| 324 | static struct ip6_flowlabel * | 324 | static struct ip6_flowlabel * |
| 325 | fl_create(struct net *net, struct in6_flowlabel_req *freq, char __user *optval, | 325 | fl_create(struct net *net, struct sock *sk, struct in6_flowlabel_req *freq, |
| 326 | int optlen, int *err_p) | 326 | char __user *optval, int optlen, int *err_p) |
| 327 | { | 327 | { |
| 328 | struct ip6_flowlabel *fl = NULL; | 328 | struct ip6_flowlabel *fl = NULL; |
| 329 | int olen; | 329 | int olen; |
| @@ -360,7 +360,7 @@ fl_create(struct net *net, struct in6_flowlabel_req *freq, char __user *optval, | |||
| 360 | msg.msg_control = (void*)(fl->opt+1); | 360 | msg.msg_control = (void*)(fl->opt+1); |
| 361 | memset(&flowi6, 0, sizeof(flowi6)); | 361 | memset(&flowi6, 0, sizeof(flowi6)); |
| 362 | 362 | ||
| 363 | err = datagram_send_ctl(net, &msg, &flowi6, fl->opt, &junk, | 363 | err = datagram_send_ctl(net, sk, &msg, &flowi6, fl->opt, &junk, |
| 364 | &junk, &junk); | 364 | &junk, &junk); |
| 365 | if (err) | 365 | if (err) |
| 366 | goto done; | 366 | goto done; |
| @@ -528,7 +528,7 @@ int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen) | |||
| 528 | if (freq.flr_label & ~IPV6_FLOWLABEL_MASK) | 528 | if (freq.flr_label & ~IPV6_FLOWLABEL_MASK) |
| 529 | return -EINVAL; | 529 | return -EINVAL; |
| 530 | 530 | ||
| 531 | fl = fl_create(net, &freq, optval, optlen, &err); | 531 | fl = fl_create(net, sk, &freq, optval, optlen, &err); |
| 532 | if (fl == NULL) | 532 | if (fl == NULL) |
| 533 | return err; | 533 | return err; |
| 534 | sfl1 = kmalloc(sizeof(*sfl1), GFP_KERNEL); | 534 | sfl1 = kmalloc(sizeof(*sfl1), GFP_KERNEL); |
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index 147ede38ab48..2fbda5fc4cc4 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
| @@ -475,7 +475,7 @@ sticky_done: | |||
| 475 | msg.msg_controllen = optlen; | 475 | msg.msg_controllen = optlen; |
| 476 | msg.msg_control = (void*)(opt+1); | 476 | msg.msg_control = (void*)(opt+1); |
| 477 | 477 | ||
| 478 | retv = datagram_send_ctl(net, &msg, &fl6, opt, &junk, &junk, | 478 | retv = datagram_send_ctl(net, sk, &msg, &fl6, opt, &junk, &junk, |
| 479 | &junk); | 479 | &junk); |
| 480 | if (retv) | 480 | if (retv) |
| 481 | goto done; | 481 | goto done; |
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c index 249394863284..e63c3972a739 100644 --- a/net/ipv6/netfilter/ip6_queue.c +++ b/net/ipv6/netfilter/ip6_queue.c | |||
| @@ -218,6 +218,7 @@ ipq_build_packet_message(struct nf_queue_entry *entry, int *errp) | |||
| 218 | return skb; | 218 | return skb; |
| 219 | 219 | ||
| 220 | nlmsg_failure: | 220 | nlmsg_failure: |
| 221 | kfree_skb(skb); | ||
| 221 | *errp = -EINVAL; | 222 | *errp = -EINVAL; |
| 222 | printk(KERN_ERR "ip6_queue: error creating packet message\n"); | 223 | printk(KERN_ERR "ip6_queue: error creating packet message\n"); |
| 223 | return NULL; | 224 | return NULL; |
| @@ -313,7 +314,7 @@ ipq_set_verdict(struct ipq_verdict_msg *vmsg, unsigned int len) | |||
| 313 | { | 314 | { |
| 314 | struct nf_queue_entry *entry; | 315 | struct nf_queue_entry *entry; |
| 315 | 316 | ||
| 316 | if (vmsg->value > NF_MAX_VERDICT) | 317 | if (vmsg->value > NF_MAX_VERDICT || vmsg->value == NF_STOLEN) |
| 317 | return -EINVAL; | 318 | return -EINVAL; |
| 318 | 319 | ||
| 319 | entry = ipq_find_dequeue_entry(vmsg->id); | 320 | entry = ipq_find_dequeue_entry(vmsg->id); |
| @@ -358,12 +359,9 @@ ipq_receive_peer(struct ipq_peer_msg *pmsg, | |||
| 358 | break; | 359 | break; |
| 359 | 360 | ||
| 360 | case IPQM_VERDICT: | 361 | case IPQM_VERDICT: |
| 361 | if (pmsg->msg.verdict.value > NF_MAX_VERDICT) | 362 | status = ipq_set_verdict(&pmsg->msg.verdict, |
| 362 | status = -EINVAL; | 363 | len - sizeof(*pmsg)); |
| 363 | else | 364 | break; |
| 364 | status = ipq_set_verdict(&pmsg->msg.verdict, | ||
| 365 | len - sizeof(*pmsg)); | ||
| 366 | break; | ||
| 367 | default: | 365 | default: |
| 368 | status = -EINVAL; | 366 | status = -EINVAL; |
| 369 | } | 367 | } |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 6a79f3081bdb..343852e5c703 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
| @@ -817,8 +817,8 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
| 817 | memset(opt, 0, sizeof(struct ipv6_txoptions)); | 817 | memset(opt, 0, sizeof(struct ipv6_txoptions)); |
| 818 | opt->tot_len = sizeof(struct ipv6_txoptions); | 818 | opt->tot_len = sizeof(struct ipv6_txoptions); |
| 819 | 819 | ||
| 820 | err = datagram_send_ctl(sock_net(sk), msg, &fl6, opt, &hlimit, | 820 | err = datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt, |
| 821 | &tclass, &dontfrag); | 821 | &hlimit, &tclass, &dontfrag); |
| 822 | if (err < 0) { | 822 | if (err < 0) { |
| 823 | fl6_sock_release(flowlabel); | 823 | fl6_sock_release(flowlabel); |
| 824 | return err; | 824 | return err; |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 9e69eb0ec6dd..1250f9020670 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
| @@ -104,6 +104,9 @@ static u32 *ipv6_cow_metrics(struct dst_entry *dst, unsigned long old) | |||
| 104 | struct inet_peer *peer; | 104 | struct inet_peer *peer; |
| 105 | u32 *p = NULL; | 105 | u32 *p = NULL; |
| 106 | 106 | ||
| 107 | if (!(rt->dst.flags & DST_HOST)) | ||
| 108 | return NULL; | ||
| 109 | |||
| 107 | if (!rt->rt6i_peer) | 110 | if (!rt->rt6i_peer) |
| 108 | rt6_bind_peer(rt, 1); | 111 | rt6_bind_peer(rt, 1); |
| 109 | 112 | ||
| @@ -252,6 +255,9 @@ static void ip6_dst_destroy(struct dst_entry *dst) | |||
| 252 | struct inet6_dev *idev = rt->rt6i_idev; | 255 | struct inet6_dev *idev = rt->rt6i_idev; |
| 253 | struct inet_peer *peer = rt->rt6i_peer; | 256 | struct inet_peer *peer = rt->rt6i_peer; |
| 254 | 257 | ||
| 258 | if (!(rt->dst.flags & DST_HOST)) | ||
| 259 | dst_destroy_metrics_generic(dst); | ||
| 260 | |||
| 255 | if (idev != NULL) { | 261 | if (idev != NULL) { |
| 256 | rt->rt6i_idev = NULL; | 262 | rt->rt6i_idev = NULL; |
| 257 | in6_dev_put(idev); | 263 | in6_dev_put(idev); |
| @@ -723,9 +729,7 @@ static struct rt6_info *rt6_alloc_cow(const struct rt6_info *ort, | |||
| 723 | ipv6_addr_copy(&rt->rt6i_gateway, daddr); | 729 | ipv6_addr_copy(&rt->rt6i_gateway, daddr); |
| 724 | } | 730 | } |
| 725 | 731 | ||
| 726 | rt->rt6i_dst.plen = 128; | ||
| 727 | rt->rt6i_flags |= RTF_CACHE; | 732 | rt->rt6i_flags |= RTF_CACHE; |
| 728 | rt->dst.flags |= DST_HOST; | ||
| 729 | 733 | ||
| 730 | #ifdef CONFIG_IPV6_SUBTREES | 734 | #ifdef CONFIG_IPV6_SUBTREES |
| 731 | if (rt->rt6i_src.plen && saddr) { | 735 | if (rt->rt6i_src.plen && saddr) { |
| @@ -775,9 +779,7 @@ static struct rt6_info *rt6_alloc_clone(struct rt6_info *ort, | |||
| 775 | struct rt6_info *rt = ip6_rt_copy(ort, daddr); | 779 | struct rt6_info *rt = ip6_rt_copy(ort, daddr); |
| 776 | 780 | ||
| 777 | if (rt) { | 781 | if (rt) { |
| 778 | rt->rt6i_dst.plen = 128; | ||
| 779 | rt->rt6i_flags |= RTF_CACHE; | 782 | rt->rt6i_flags |= RTF_CACHE; |
| 780 | rt->dst.flags |= DST_HOST; | ||
| 781 | dst_set_neighbour(&rt->dst, neigh_clone(dst_get_neighbour_raw(&ort->dst))); | 783 | dst_set_neighbour(&rt->dst, neigh_clone(dst_get_neighbour_raw(&ort->dst))); |
| 782 | } | 784 | } |
| 783 | return rt; | 785 | return rt; |
| @@ -1078,12 +1080,15 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev, | |||
| 1078 | neigh = NULL; | 1080 | neigh = NULL; |
| 1079 | } | 1081 | } |
| 1080 | 1082 | ||
| 1081 | rt->rt6i_idev = idev; | 1083 | rt->dst.flags |= DST_HOST; |
| 1084 | rt->dst.output = ip6_output; | ||
| 1082 | dst_set_neighbour(&rt->dst, neigh); | 1085 | dst_set_neighbour(&rt->dst, neigh); |
| 1083 | atomic_set(&rt->dst.__refcnt, 1); | 1086 | atomic_set(&rt->dst.__refcnt, 1); |
| 1084 | ipv6_addr_copy(&rt->rt6i_dst.addr, addr); | ||
| 1085 | dst_metric_set(&rt->dst, RTAX_HOPLIMIT, 255); | 1087 | dst_metric_set(&rt->dst, RTAX_HOPLIMIT, 255); |
| 1086 | rt->dst.output = ip6_output; | 1088 | |
| 1089 | ipv6_addr_copy(&rt->rt6i_dst.addr, addr); | ||
| 1090 | rt->rt6i_dst.plen = 128; | ||
| 1091 | rt->rt6i_idev = idev; | ||
| 1087 | 1092 | ||
| 1088 | spin_lock_bh(&icmp6_dst_lock); | 1093 | spin_lock_bh(&icmp6_dst_lock); |
| 1089 | rt->dst.next = icmp6_dst_gc_list; | 1094 | rt->dst.next = icmp6_dst_gc_list; |
| @@ -1261,6 +1266,14 @@ int ip6_route_add(struct fib6_config *cfg) | |||
| 1261 | if (rt->rt6i_dst.plen == 128) | 1266 | if (rt->rt6i_dst.plen == 128) |
| 1262 | rt->dst.flags |= DST_HOST; | 1267 | rt->dst.flags |= DST_HOST; |
| 1263 | 1268 | ||
| 1269 | if (!(rt->dst.flags & DST_HOST) && cfg->fc_mx) { | ||
| 1270 | u32 *metrics = kzalloc(sizeof(u32) * RTAX_MAX, GFP_KERNEL); | ||
| 1271 | if (!metrics) { | ||
| 1272 | err = -ENOMEM; | ||
| 1273 | goto out; | ||
| 1274 | } | ||
| 1275 | dst_init_metrics(&rt->dst, metrics, 0); | ||
| 1276 | } | ||
| 1264 | #ifdef CONFIG_IPV6_SUBTREES | 1277 | #ifdef CONFIG_IPV6_SUBTREES |
| 1265 | ipv6_addr_prefix(&rt->rt6i_src.addr, &cfg->fc_src, cfg->fc_src_len); | 1278 | ipv6_addr_prefix(&rt->rt6i_src.addr, &cfg->fc_src, cfg->fc_src_len); |
| 1266 | rt->rt6i_src.plen = cfg->fc_src_len; | 1279 | rt->rt6i_src.plen = cfg->fc_src_len; |
| @@ -1607,9 +1620,6 @@ void rt6_redirect(const struct in6_addr *dest, const struct in6_addr *src, | |||
| 1607 | if (on_link) | 1620 | if (on_link) |
| 1608 | nrt->rt6i_flags &= ~RTF_GATEWAY; | 1621 | nrt->rt6i_flags &= ~RTF_GATEWAY; |
| 1609 | 1622 | ||
| 1610 | nrt->rt6i_dst.plen = 128; | ||
| 1611 | nrt->dst.flags |= DST_HOST; | ||
| 1612 | |||
| 1613 | ipv6_addr_copy(&nrt->rt6i_gateway, (struct in6_addr*)neigh->primary_key); | 1623 | ipv6_addr_copy(&nrt->rt6i_gateway, (struct in6_addr*)neigh->primary_key); |
| 1614 | dst_set_neighbour(&nrt->dst, neigh_clone(neigh)); | 1624 | dst_set_neighbour(&nrt->dst, neigh_clone(neigh)); |
| 1615 | 1625 | ||
| @@ -1754,9 +1764,10 @@ static struct rt6_info *ip6_rt_copy(const struct rt6_info *ort, | |||
| 1754 | if (rt) { | 1764 | if (rt) { |
| 1755 | rt->dst.input = ort->dst.input; | 1765 | rt->dst.input = ort->dst.input; |
| 1756 | rt->dst.output = ort->dst.output; | 1766 | rt->dst.output = ort->dst.output; |
| 1767 | rt->dst.flags |= DST_HOST; | ||
| 1757 | 1768 | ||
| 1758 | ipv6_addr_copy(&rt->rt6i_dst.addr, dest); | 1769 | ipv6_addr_copy(&rt->rt6i_dst.addr, dest); |
| 1759 | rt->rt6i_dst.plen = ort->rt6i_dst.plen; | 1770 | rt->rt6i_dst.plen = 128; |
| 1760 | dst_copy_metrics(&rt->dst, &ort->dst); | 1771 | dst_copy_metrics(&rt->dst, &ort->dst); |
| 1761 | rt->dst.error = ort->dst.error; | 1772 | rt->dst.error = ort->dst.error; |
| 1762 | rt->rt6i_idev = ort->rt6i_idev; | 1773 | rt->rt6i_idev = ort->rt6i_idev; |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index d1fb63f4aeb7..3c9fa618b69d 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
| @@ -531,20 +531,6 @@ static int tcp_v6_rtx_synack(struct sock *sk, struct request_sock *req, | |||
| 531 | return tcp_v6_send_synack(sk, req, rvp); | 531 | return tcp_v6_send_synack(sk, req, rvp); |
| 532 | } | 532 | } |
| 533 | 533 | ||
| 534 | static inline void syn_flood_warning(struct sk_buff *skb) | ||
| 535 | { | ||
| 536 | #ifdef CONFIG_SYN_COOKIES | ||
| 537 | if (sysctl_tcp_syncookies) | ||
| 538 | printk(KERN_INFO | ||
| 539 | "TCPv6: Possible SYN flooding on port %d. " | ||
| 540 | "Sending cookies.\n", ntohs(tcp_hdr(skb)->dest)); | ||
| 541 | else | ||
| 542 | #endif | ||
| 543 | printk(KERN_INFO | ||
| 544 | "TCPv6: Possible SYN flooding on port %d. " | ||
| 545 | "Dropping request.\n", ntohs(tcp_hdr(skb)->dest)); | ||
| 546 | } | ||
| 547 | |||
| 548 | static void tcp_v6_reqsk_destructor(struct request_sock *req) | 534 | static void tcp_v6_reqsk_destructor(struct request_sock *req) |
| 549 | { | 535 | { |
| 550 | kfree_skb(inet6_rsk(req)->pktopts); | 536 | kfree_skb(inet6_rsk(req)->pktopts); |
| @@ -1179,11 +1165,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
| 1179 | struct tcp_sock *tp = tcp_sk(sk); | 1165 | struct tcp_sock *tp = tcp_sk(sk); |
| 1180 | __u32 isn = TCP_SKB_CB(skb)->when; | 1166 | __u32 isn = TCP_SKB_CB(skb)->when; |
| 1181 | struct dst_entry *dst = NULL; | 1167 | struct dst_entry *dst = NULL; |
| 1182 | #ifdef CONFIG_SYN_COOKIES | ||
| 1183 | int want_cookie = 0; | 1168 | int want_cookie = 0; |
| 1184 | #else | ||
| 1185 | #define want_cookie 0 | ||
| 1186 | #endif | ||
| 1187 | 1169 | ||
| 1188 | if (skb->protocol == htons(ETH_P_IP)) | 1170 | if (skb->protocol == htons(ETH_P_IP)) |
| 1189 | return tcp_v4_conn_request(sk, skb); | 1171 | return tcp_v4_conn_request(sk, skb); |
| @@ -1192,14 +1174,9 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
| 1192 | goto drop; | 1174 | goto drop; |
| 1193 | 1175 | ||
| 1194 | if (inet_csk_reqsk_queue_is_full(sk) && !isn) { | 1176 | if (inet_csk_reqsk_queue_is_full(sk) && !isn) { |
| 1195 | if (net_ratelimit()) | 1177 | want_cookie = tcp_syn_flood_action(sk, skb, "TCPv6"); |
| 1196 | syn_flood_warning(skb); | 1178 | if (!want_cookie) |
| 1197 | #ifdef CONFIG_SYN_COOKIES | 1179 | goto drop; |
| 1198 | if (sysctl_tcp_syncookies) | ||
| 1199 | want_cookie = 1; | ||
| 1200 | else | ||
| 1201 | #endif | ||
| 1202 | goto drop; | ||
| 1203 | } | 1180 | } |
| 1204 | 1181 | ||
| 1205 | if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) | 1182 | if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) |
| @@ -1249,9 +1226,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
| 1249 | while (l-- > 0) | 1226 | while (l-- > 0) |
| 1250 | *c++ ^= *hash_location++; | 1227 | *c++ ^= *hash_location++; |
| 1251 | 1228 | ||
| 1252 | #ifdef CONFIG_SYN_COOKIES | ||
| 1253 | want_cookie = 0; /* not our kind of cookie */ | 1229 | want_cookie = 0; /* not our kind of cookie */ |
| 1254 | #endif | ||
| 1255 | tmp_ext.cookie_out_never = 0; /* false */ | 1230 | tmp_ext.cookie_out_never = 0; /* false */ |
| 1256 | tmp_ext.cookie_plus = tmp_opt.cookie_plus; | 1231 | tmp_ext.cookie_plus = tmp_opt.cookie_plus; |
| 1257 | } else if (!tp->rx_opt.cookie_in_always) { | 1232 | } else if (!tp->rx_opt.cookie_in_always) { |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 29213b51c499..bb95e8e1c6f9 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
| @@ -1090,8 +1090,8 @@ do_udp_sendmsg: | |||
| 1090 | memset(opt, 0, sizeof(struct ipv6_txoptions)); | 1090 | memset(opt, 0, sizeof(struct ipv6_txoptions)); |
| 1091 | opt->tot_len = sizeof(*opt); | 1091 | opt->tot_len = sizeof(*opt); |
| 1092 | 1092 | ||
| 1093 | err = datagram_send_ctl(sock_net(sk), msg, &fl6, opt, &hlimit, | 1093 | err = datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt, |
| 1094 | &tclass, &dontfrag); | 1094 | &hlimit, &tclass, &dontfrag); |
| 1095 | if (err < 0) { | 1095 | if (err < 0) { |
| 1096 | fl6_sock_release(flowlabel); | 1096 | fl6_sock_release(flowlabel); |
| 1097 | return err; | 1097 | return err; |
diff --git a/net/irda/irsysctl.c b/net/irda/irsysctl.c index d0b70dadf73b..2615ffc8e785 100644 --- a/net/irda/irsysctl.c +++ b/net/irda/irsysctl.c | |||
| @@ -40,9 +40,9 @@ extern int sysctl_slot_timeout; | |||
| 40 | extern int sysctl_fast_poll_increase; | 40 | extern int sysctl_fast_poll_increase; |
| 41 | extern char sysctl_devname[]; | 41 | extern char sysctl_devname[]; |
| 42 | extern int sysctl_max_baud_rate; | 42 | extern int sysctl_max_baud_rate; |
| 43 | extern int sysctl_min_tx_turn_time; | 43 | extern unsigned int sysctl_min_tx_turn_time; |
| 44 | extern int sysctl_max_tx_data_size; | 44 | extern unsigned int sysctl_max_tx_data_size; |
| 45 | extern int sysctl_max_tx_window; | 45 | extern unsigned int sysctl_max_tx_window; |
| 46 | extern int sysctl_max_noreply_time; | 46 | extern int sysctl_max_noreply_time; |
| 47 | extern int sysctl_warn_noreply_time; | 47 | extern int sysctl_warn_noreply_time; |
| 48 | extern int sysctl_lap_keepalive_time; | 48 | extern int sysctl_lap_keepalive_time; |
diff --git a/net/irda/qos.c b/net/irda/qos.c index 1b51bcf42394..4369f7f41bcb 100644 --- a/net/irda/qos.c +++ b/net/irda/qos.c | |||
| @@ -60,7 +60,7 @@ int sysctl_max_noreply_time = 12; | |||
| 60 | * Default is 10us which means using the unmodified value given by the | 60 | * Default is 10us which means using the unmodified value given by the |
| 61 | * peer except if it's 0 (0 is likely a bug in the other stack). | 61 | * peer except if it's 0 (0 is likely a bug in the other stack). |
| 62 | */ | 62 | */ |
| 63 | unsigned sysctl_min_tx_turn_time = 10; | 63 | unsigned int sysctl_min_tx_turn_time = 10; |
| 64 | /* | 64 | /* |
| 65 | * Maximum data size to be used in transmission in payload of LAP frame. | 65 | * Maximum data size to be used in transmission in payload of LAP frame. |
| 66 | * There is a bit of confusion in the IrDA spec : | 66 | * There is a bit of confusion in the IrDA spec : |
| @@ -75,13 +75,13 @@ unsigned sysctl_min_tx_turn_time = 10; | |||
| 75 | * bytes frames or all negotiated frame sizes, but you can use the sysctl | 75 | * bytes frames or all negotiated frame sizes, but you can use the sysctl |
| 76 | * to play with this value anyway. | 76 | * to play with this value anyway. |
| 77 | * Jean II */ | 77 | * Jean II */ |
| 78 | unsigned sysctl_max_tx_data_size = 2042; | 78 | unsigned int sysctl_max_tx_data_size = 2042; |
| 79 | /* | 79 | /* |
| 80 | * Maximum transmit window, i.e. number of LAP frames between turn-around. | 80 | * Maximum transmit window, i.e. number of LAP frames between turn-around. |
| 81 | * This allow to override what the peer told us. Some peers are buggy and | 81 | * This allow to override what the peer told us. Some peers are buggy and |
| 82 | * don't always support what they tell us. | 82 | * don't always support what they tell us. |
| 83 | * Jean II */ | 83 | * Jean II */ |
| 84 | unsigned sysctl_max_tx_window = 7; | 84 | unsigned int sysctl_max_tx_window = 7; |
| 85 | 85 | ||
| 86 | static int irlap_param_baud_rate(void *instance, irda_param_t *param, int get); | 86 | static int irlap_param_baud_rate(void *instance, irda_param_t *param, int get); |
| 87 | static int irlap_param_link_disconnect(void *instance, irda_param_t *parm, | 87 | static int irlap_param_link_disconnect(void *instance, irda_param_t *parm, |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 3db78b696c5c..21070e9bc8d0 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
| @@ -665,7 +665,7 @@ static int __must_check __sta_info_destroy(struct sta_info *sta) | |||
| 665 | BUG_ON(!sdata->bss); | 665 | BUG_ON(!sdata->bss); |
| 666 | 666 | ||
| 667 | atomic_dec(&sdata->bss->num_sta_ps); | 667 | atomic_dec(&sdata->bss->num_sta_ps); |
| 668 | __sta_info_clear_tim_bit(sdata->bss, sta); | 668 | sta_info_clear_tim_bit(sta); |
| 669 | } | 669 | } |
| 670 | 670 | ||
| 671 | local->num_sta--; | 671 | local->num_sta--; |
diff --git a/net/netfilter/nf_conntrack_pptp.c b/net/netfilter/nf_conntrack_pptp.c index 2fd4565144de..31d56b23b9e9 100644 --- a/net/netfilter/nf_conntrack_pptp.c +++ b/net/netfilter/nf_conntrack_pptp.c | |||
| @@ -364,6 +364,7 @@ pptp_inbound_pkt(struct sk_buff *skb, | |||
| 364 | break; | 364 | break; |
| 365 | 365 | ||
| 366 | case PPTP_WAN_ERROR_NOTIFY: | 366 | case PPTP_WAN_ERROR_NOTIFY: |
| 367 | case PPTP_SET_LINK_INFO: | ||
| 367 | case PPTP_ECHO_REQUEST: | 368 | case PPTP_ECHO_REQUEST: |
| 368 | case PPTP_ECHO_REPLY: | 369 | case PPTP_ECHO_REPLY: |
| 369 | /* I don't have to explain these ;) */ | 370 | /* I don't have to explain these ;) */ |
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c index 37bf94394be0..8235b86b4e87 100644 --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c | |||
| @@ -409,7 +409,7 @@ static void tcp_options(const struct sk_buff *skb, | |||
| 409 | if (opsize < 2) /* "silly options" */ | 409 | if (opsize < 2) /* "silly options" */ |
| 410 | return; | 410 | return; |
| 411 | if (opsize > length) | 411 | if (opsize > length) |
| 412 | break; /* don't parse partial options */ | 412 | return; /* don't parse partial options */ |
| 413 | 413 | ||
| 414 | if (opcode == TCPOPT_SACK_PERM | 414 | if (opcode == TCPOPT_SACK_PERM |
| 415 | && opsize == TCPOLEN_SACK_PERM) | 415 | && opsize == TCPOLEN_SACK_PERM) |
| @@ -447,7 +447,7 @@ static void tcp_sack(const struct sk_buff *skb, unsigned int dataoff, | |||
| 447 | BUG_ON(ptr == NULL); | 447 | BUG_ON(ptr == NULL); |
| 448 | 448 | ||
| 449 | /* Fast path for timestamp-only option */ | 449 | /* Fast path for timestamp-only option */ |
| 450 | if (length == TCPOLEN_TSTAMP_ALIGNED*4 | 450 | if (length == TCPOLEN_TSTAMP_ALIGNED |
| 451 | && *(__be32 *)ptr == htonl((TCPOPT_NOP << 24) | 451 | && *(__be32 *)ptr == htonl((TCPOPT_NOP << 24) |
| 452 | | (TCPOPT_NOP << 16) | 452 | | (TCPOPT_NOP << 16) |
| 453 | | (TCPOPT_TIMESTAMP << 8) | 453 | | (TCPOPT_TIMESTAMP << 8) |
| @@ -469,7 +469,7 @@ static void tcp_sack(const struct sk_buff *skb, unsigned int dataoff, | |||
| 469 | if (opsize < 2) /* "silly options" */ | 469 | if (opsize < 2) /* "silly options" */ |
| 470 | return; | 470 | return; |
| 471 | if (opsize > length) | 471 | if (opsize > length) |
| 472 | break; /* don't parse partial options */ | 472 | return; /* don't parse partial options */ |
| 473 | 473 | ||
| 474 | if (opcode == TCPOPT_SACK | 474 | if (opcode == TCPOPT_SACK |
| 475 | && opsize >= (TCPOLEN_SACK_BASE | 475 | && opsize >= (TCPOLEN_SACK_BASE |
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c index 00bd475eab4b..a80b0cb03f17 100644 --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c | |||
| @@ -646,8 +646,8 @@ verdicthdr_get(const struct nlattr * const nfqa[]) | |||
| 646 | return NULL; | 646 | return NULL; |
| 647 | 647 | ||
| 648 | vhdr = nla_data(nfqa[NFQA_VERDICT_HDR]); | 648 | vhdr = nla_data(nfqa[NFQA_VERDICT_HDR]); |
| 649 | verdict = ntohl(vhdr->verdict); | 649 | verdict = ntohl(vhdr->verdict) & NF_VERDICT_MASK; |
| 650 | if ((verdict & NF_VERDICT_MASK) > NF_MAX_VERDICT) | 650 | if (verdict > NF_MAX_VERDICT || verdict == NF_STOLEN) |
| 651 | return NULL; | 651 | return NULL; |
| 652 | return vhdr; | 652 | return vhdr; |
| 653 | } | 653 | } |
diff --git a/net/netfilter/xt_rateest.c b/net/netfilter/xt_rateest.c index 76a083184d8e..ed0db15ab00e 100644 --- a/net/netfilter/xt_rateest.c +++ b/net/netfilter/xt_rateest.c | |||
| @@ -78,7 +78,7 @@ static int xt_rateest_mt_checkentry(const struct xt_mtchk_param *par) | |||
| 78 | { | 78 | { |
| 79 | struct xt_rateest_match_info *info = par->matchinfo; | 79 | struct xt_rateest_match_info *info = par->matchinfo; |
| 80 | struct xt_rateest *est1, *est2; | 80 | struct xt_rateest *est1, *est2; |
| 81 | int ret = false; | 81 | int ret = -EINVAL; |
| 82 | 82 | ||
| 83 | if (hweight32(info->flags & (XT_RATEEST_MATCH_ABS | | 83 | if (hweight32(info->flags & (XT_RATEEST_MATCH_ABS | |
| 84 | XT_RATEEST_MATCH_REL)) != 1) | 84 | XT_RATEEST_MATCH_REL)) != 1) |
| @@ -101,13 +101,12 @@ static int xt_rateest_mt_checkentry(const struct xt_mtchk_param *par) | |||
| 101 | if (!est1) | 101 | if (!est1) |
| 102 | goto err1; | 102 | goto err1; |
| 103 | 103 | ||
| 104 | est2 = NULL; | ||
| 104 | if (info->flags & XT_RATEEST_MATCH_REL) { | 105 | if (info->flags & XT_RATEEST_MATCH_REL) { |
| 105 | est2 = xt_rateest_lookup(info->name2); | 106 | est2 = xt_rateest_lookup(info->name2); |
| 106 | if (!est2) | 107 | if (!est2) |
| 107 | goto err2; | 108 | goto err2; |
| 108 | } else | 109 | } |
| 109 | est2 = NULL; | ||
| 110 | |||
| 111 | 110 | ||
| 112 | info->est1 = est1; | 111 | info->est1 = est1; |
| 113 | info->est2 = est2; | 112 | info->est2 = est2; |
| @@ -116,7 +115,7 @@ static int xt_rateest_mt_checkentry(const struct xt_mtchk_param *par) | |||
| 116 | err2: | 115 | err2: |
| 117 | xt_rateest_put(est1); | 116 | xt_rateest_put(est1); |
| 118 | err1: | 117 | err1: |
| 119 | return -EINVAL; | 118 | return ret; |
| 120 | } | 119 | } |
| 121 | 120 | ||
| 122 | static void xt_rateest_mt_destroy(const struct xt_mtdtor_param *par) | 121 | static void xt_rateest_mt_destroy(const struct xt_mtdtor_param *par) |
diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h index be4505ee67a9..b01427924f81 100644 --- a/net/sched/cls_rsvp.h +++ b/net/sched/cls_rsvp.h | |||
| @@ -425,7 +425,7 @@ static int rsvp_change(struct tcf_proto *tp, unsigned long base, | |||
| 425 | struct rsvp_filter *f, **fp; | 425 | struct rsvp_filter *f, **fp; |
| 426 | struct rsvp_session *s, **sp; | 426 | struct rsvp_session *s, **sp; |
| 427 | struct tc_rsvp_pinfo *pinfo = NULL; | 427 | struct tc_rsvp_pinfo *pinfo = NULL; |
| 428 | struct nlattr *opt = tca[TCA_OPTIONS-1]; | 428 | struct nlattr *opt = tca[TCA_OPTIONS]; |
| 429 | struct nlattr *tb[TCA_RSVP_MAX + 1]; | 429 | struct nlattr *tb[TCA_RSVP_MAX + 1]; |
| 430 | struct tcf_exts e; | 430 | struct tcf_exts e; |
| 431 | unsigned int h1, h2; | 431 | unsigned int h1, h2; |
| @@ -439,7 +439,7 @@ static int rsvp_change(struct tcf_proto *tp, unsigned long base, | |||
| 439 | if (err < 0) | 439 | if (err < 0) |
| 440 | return err; | 440 | return err; |
| 441 | 441 | ||
| 442 | err = tcf_exts_validate(tp, tb, tca[TCA_RATE-1], &e, &rsvp_ext_map); | 442 | err = tcf_exts_validate(tp, tb, tca[TCA_RATE], &e, &rsvp_ext_map); |
| 443 | if (err < 0) | 443 | if (err < 0) |
| 444 | return err; | 444 | return err; |
| 445 | 445 | ||
| @@ -449,8 +449,8 @@ static int rsvp_change(struct tcf_proto *tp, unsigned long base, | |||
| 449 | 449 | ||
| 450 | if (f->handle != handle && handle) | 450 | if (f->handle != handle && handle) |
| 451 | goto errout2; | 451 | goto errout2; |
| 452 | if (tb[TCA_RSVP_CLASSID-1]) { | 452 | if (tb[TCA_RSVP_CLASSID]) { |
| 453 | f->res.classid = nla_get_u32(tb[TCA_RSVP_CLASSID-1]); | 453 | f->res.classid = nla_get_u32(tb[TCA_RSVP_CLASSID]); |
| 454 | tcf_bind_filter(tp, &f->res, base); | 454 | tcf_bind_filter(tp, &f->res, base); |
| 455 | } | 455 | } |
| 456 | 456 | ||
| @@ -462,7 +462,7 @@ static int rsvp_change(struct tcf_proto *tp, unsigned long base, | |||
| 462 | err = -EINVAL; | 462 | err = -EINVAL; |
| 463 | if (handle) | 463 | if (handle) |
| 464 | goto errout2; | 464 | goto errout2; |
| 465 | if (tb[TCA_RSVP_DST-1] == NULL) | 465 | if (tb[TCA_RSVP_DST] == NULL) |
| 466 | goto errout2; | 466 | goto errout2; |
| 467 | 467 | ||
| 468 | err = -ENOBUFS; | 468 | err = -ENOBUFS; |
| @@ -471,19 +471,19 @@ static int rsvp_change(struct tcf_proto *tp, unsigned long base, | |||
| 471 | goto errout2; | 471 | goto errout2; |
| 472 | 472 | ||
| 473 | h2 = 16; | 473 | h2 = 16; |
| 474 | if (tb[TCA_RSVP_SRC-1]) { | 474 | if (tb[TCA_RSVP_SRC]) { |
| 475 | memcpy(f->src, nla_data(tb[TCA_RSVP_SRC-1]), sizeof(f->src)); | 475 | memcpy(f->src, nla_data(tb[TCA_RSVP_SRC]), sizeof(f->src)); |
| 476 | h2 = hash_src(f->src); | 476 | h2 = hash_src(f->src); |
| 477 | } | 477 | } |
| 478 | if (tb[TCA_RSVP_PINFO-1]) { | 478 | if (tb[TCA_RSVP_PINFO]) { |
| 479 | pinfo = nla_data(tb[TCA_RSVP_PINFO-1]); | 479 | pinfo = nla_data(tb[TCA_RSVP_PINFO]); |
| 480 | f->spi = pinfo->spi; | 480 | f->spi = pinfo->spi; |
| 481 | f->tunnelhdr = pinfo->tunnelhdr; | 481 | f->tunnelhdr = pinfo->tunnelhdr; |
| 482 | } | 482 | } |
| 483 | if (tb[TCA_RSVP_CLASSID-1]) | 483 | if (tb[TCA_RSVP_CLASSID]) |
| 484 | f->res.classid = nla_get_u32(tb[TCA_RSVP_CLASSID-1]); | 484 | f->res.classid = nla_get_u32(tb[TCA_RSVP_CLASSID]); |
| 485 | 485 | ||
| 486 | dst = nla_data(tb[TCA_RSVP_DST-1]); | 486 | dst = nla_data(tb[TCA_RSVP_DST]); |
| 487 | h1 = hash_dst(dst, pinfo ? pinfo->protocol : 0, pinfo ? pinfo->tunnelid : 0); | 487 | h1 = hash_dst(dst, pinfo ? pinfo->protocol : 0, pinfo ? pinfo->tunnelid : 0); |
| 488 | 488 | ||
| 489 | err = -ENOMEM; | 489 | err = -ENOMEM; |
| @@ -642,8 +642,7 @@ nla_put_failure: | |||
| 642 | return -1; | 642 | return -1; |
| 643 | } | 643 | } |
| 644 | 644 | ||
| 645 | static struct tcf_proto_ops RSVP_OPS = { | 645 | static struct tcf_proto_ops RSVP_OPS __read_mostly = { |
| 646 | .next = NULL, | ||
| 647 | .kind = RSVP_ID, | 646 | .kind = RSVP_ID, |
| 648 | .classify = rsvp_classify, | 647 | .classify = rsvp_classify, |
| 649 | .init = rsvp_init, | 648 | .init = rsvp_init, |
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index 167c880cf8da..76388b083f28 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c | |||
| @@ -1689,6 +1689,11 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, | |||
| 1689 | case SCTP_CMD_PURGE_ASCONF_QUEUE: | 1689 | case SCTP_CMD_PURGE_ASCONF_QUEUE: |
| 1690 | sctp_asconf_queue_teardown(asoc); | 1690 | sctp_asconf_queue_teardown(asoc); |
| 1691 | break; | 1691 | break; |
| 1692 | |||
| 1693 | case SCTP_CMD_SET_ASOC: | ||
| 1694 | asoc = cmd->obj.asoc; | ||
| 1695 | break; | ||
| 1696 | |||
| 1692 | default: | 1697 | default: |
| 1693 | pr_warn("Impossible command: %u, %p\n", | 1698 | pr_warn("Impossible command: %u, %p\n", |
| 1694 | cmd->verb, cmd->obj.ptr); | 1699 | cmd->verb, cmd->obj.ptr); |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 49b847b00f99..a0f31e6c1c63 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
| @@ -2047,6 +2047,12 @@ sctp_disposition_t sctp_sf_do_5_2_4_dupcook(const struct sctp_endpoint *ep, | |||
| 2047 | sctp_add_cmd_sf(commands, SCTP_CMD_NEW_ASOC, SCTP_ASOC(new_asoc)); | 2047 | sctp_add_cmd_sf(commands, SCTP_CMD_NEW_ASOC, SCTP_ASOC(new_asoc)); |
| 2048 | sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL()); | 2048 | sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL()); |
| 2049 | 2049 | ||
| 2050 | /* Restore association pointer to provide SCTP command interpeter | ||
| 2051 | * with a valid context in case it needs to manipulate | ||
| 2052 | * the queues */ | ||
| 2053 | sctp_add_cmd_sf(commands, SCTP_CMD_SET_ASOC, | ||
| 2054 | SCTP_ASOC((struct sctp_association *)asoc)); | ||
| 2055 | |||
| 2050 | return retval; | 2056 | return retval; |
| 2051 | 2057 | ||
| 2052 | nomem: | 2058 | nomem: |
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 86d0caf91b35..62e90b862a0d 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
| @@ -1761,6 +1761,10 @@ static int wait_for_avail(struct snd_pcm_substream *substream, | |||
| 1761 | snd_pcm_uframes_t avail = 0; | 1761 | snd_pcm_uframes_t avail = 0; |
| 1762 | long wait_time, tout; | 1762 | long wait_time, tout; |
| 1763 | 1763 | ||
| 1764 | init_waitqueue_entry(&wait, current); | ||
| 1765 | set_current_state(TASK_INTERRUPTIBLE); | ||
| 1766 | add_wait_queue(&runtime->tsleep, &wait); | ||
| 1767 | |||
| 1764 | if (runtime->no_period_wakeup) | 1768 | if (runtime->no_period_wakeup) |
| 1765 | wait_time = MAX_SCHEDULE_TIMEOUT; | 1769 | wait_time = MAX_SCHEDULE_TIMEOUT; |
| 1766 | else { | 1770 | else { |
| @@ -1771,16 +1775,32 @@ static int wait_for_avail(struct snd_pcm_substream *substream, | |||
| 1771 | } | 1775 | } |
| 1772 | wait_time = msecs_to_jiffies(wait_time * 1000); | 1776 | wait_time = msecs_to_jiffies(wait_time * 1000); |
| 1773 | } | 1777 | } |
| 1774 | init_waitqueue_entry(&wait, current); | 1778 | |
| 1775 | add_wait_queue(&runtime->tsleep, &wait); | ||
| 1776 | for (;;) { | 1779 | for (;;) { |
| 1777 | if (signal_pending(current)) { | 1780 | if (signal_pending(current)) { |
| 1778 | err = -ERESTARTSYS; | 1781 | err = -ERESTARTSYS; |
| 1779 | break; | 1782 | break; |
| 1780 | } | 1783 | } |
| 1784 | |||
| 1785 | /* | ||
| 1786 | * We need to check if space became available already | ||
| 1787 | * (and thus the wakeup happened already) first to close | ||
| 1788 | * the race of space already having become available. | ||
| 1789 | * This check must happen after been added to the waitqueue | ||
| 1790 | * and having current state be INTERRUPTIBLE. | ||
| 1791 | */ | ||
| 1792 | if (is_playback) | ||
| 1793 | avail = snd_pcm_playback_avail(runtime); | ||
| 1794 | else | ||
| 1795 | avail = snd_pcm_capture_avail(runtime); | ||
| 1796 | if (avail >= runtime->twake) | ||
| 1797 | break; | ||
| 1781 | snd_pcm_stream_unlock_irq(substream); | 1798 | snd_pcm_stream_unlock_irq(substream); |
| 1782 | tout = schedule_timeout_interruptible(wait_time); | 1799 | |
| 1800 | tout = schedule_timeout(wait_time); | ||
| 1801 | |||
| 1783 | snd_pcm_stream_lock_irq(substream); | 1802 | snd_pcm_stream_lock_irq(substream); |
| 1803 | set_current_state(TASK_INTERRUPTIBLE); | ||
| 1784 | switch (runtime->status->state) { | 1804 | switch (runtime->status->state) { |
| 1785 | case SNDRV_PCM_STATE_SUSPENDED: | 1805 | case SNDRV_PCM_STATE_SUSPENDED: |
| 1786 | err = -ESTRPIPE; | 1806 | err = -ESTRPIPE; |
| @@ -1806,14 +1826,9 @@ static int wait_for_avail(struct snd_pcm_substream *substream, | |||
| 1806 | err = -EIO; | 1826 | err = -EIO; |
| 1807 | break; | 1827 | break; |
| 1808 | } | 1828 | } |
| 1809 | if (is_playback) | ||
| 1810 | avail = snd_pcm_playback_avail(runtime); | ||
| 1811 | else | ||
| 1812 | avail = snd_pcm_capture_avail(runtime); | ||
| 1813 | if (avail >= runtime->twake) | ||
| 1814 | break; | ||
| 1815 | } | 1829 | } |
| 1816 | _endloop: | 1830 | _endloop: |
| 1831 | set_current_state(TASK_RUNNING); | ||
| 1817 | remove_wait_queue(&runtime->tsleep, &wait); | 1832 | remove_wait_queue(&runtime->tsleep, &wait); |
| 1818 | *availp = avail; | 1833 | *availp = avail; |
| 1819 | return err; | 1834 | return err; |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 3e7850c238c3..f3aefef37216 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
| @@ -579,9 +579,13 @@ int snd_hda_get_conn_index(struct hda_codec *codec, hda_nid_t mux, | |||
| 579 | return -1; | 579 | return -1; |
| 580 | } | 580 | } |
| 581 | recursive++; | 581 | recursive++; |
| 582 | for (i = 0; i < nums; i++) | 582 | for (i = 0; i < nums; i++) { |
| 583 | unsigned int type = get_wcaps_type(get_wcaps(codec, conn[i])); | ||
| 584 | if (type == AC_WID_PIN || type == AC_WID_AUD_OUT) | ||
| 585 | continue; | ||
| 583 | if (snd_hda_get_conn_index(codec, conn[i], nid, recursive) >= 0) | 586 | if (snd_hda_get_conn_index(codec, conn[i], nid, recursive) >= 0) |
| 584 | return i; | 587 | return i; |
| 588 | } | ||
| 585 | return -1; | 589 | return -1; |
| 586 | } | 590 | } |
| 587 | EXPORT_SYMBOL_HDA(snd_hda_get_conn_index); | 591 | EXPORT_SYMBOL_HDA(snd_hda_get_conn_index); |
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index d6c93d92b550..c45f3e69bcf0 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c | |||
| @@ -535,7 +535,7 @@ static int add_volume(struct hda_codec *codec, const char *name, | |||
| 535 | int index, unsigned int pval, int dir, | 535 | int index, unsigned int pval, int dir, |
| 536 | struct snd_kcontrol **kctlp) | 536 | struct snd_kcontrol **kctlp) |
| 537 | { | 537 | { |
| 538 | char tmp[32]; | 538 | char tmp[44]; |
| 539 | struct snd_kcontrol_new knew = | 539 | struct snd_kcontrol_new knew = |
| 540 | HDA_CODEC_VOLUME_IDX(tmp, index, 0, 0, HDA_OUTPUT); | 540 | HDA_CODEC_VOLUME_IDX(tmp, index, 0, 0, HDA_OUTPUT); |
| 541 | knew.private_value = pval; | 541 | knew.private_value = pval; |
diff --git a/sound/soc/blackfin/bf5xx-ad193x.c b/sound/soc/blackfin/bf5xx-ad193x.c index a118a0fb9d81..5956584ea3a4 100644 --- a/sound/soc/blackfin/bf5xx-ad193x.c +++ b/sound/soc/blackfin/bf5xx-ad193x.c | |||
| @@ -103,7 +103,7 @@ static struct snd_soc_dai_link bf5xx_ad193x_dai[] = { | |||
| 103 | .cpu_dai_name = "bfin-tdm.0", | 103 | .cpu_dai_name = "bfin-tdm.0", |
| 104 | .codec_dai_name ="ad193x-hifi", | 104 | .codec_dai_name ="ad193x-hifi", |
| 105 | .platform_name = "bfin-tdm-pcm-audio", | 105 | .platform_name = "bfin-tdm-pcm-audio", |
| 106 | .codec_name = "ad193x.5", | 106 | .codec_name = "spi0.5", |
| 107 | .ops = &bf5xx_ad193x_ops, | 107 | .ops = &bf5xx_ad193x_ops, |
| 108 | }, | 108 | }, |
| 109 | { | 109 | { |
| @@ -112,7 +112,7 @@ static struct snd_soc_dai_link bf5xx_ad193x_dai[] = { | |||
| 112 | .cpu_dai_name = "bfin-tdm.1", | 112 | .cpu_dai_name = "bfin-tdm.1", |
| 113 | .codec_dai_name ="ad193x-hifi", | 113 | .codec_dai_name ="ad193x-hifi", |
| 114 | .platform_name = "bfin-tdm-pcm-audio", | 114 | .platform_name = "bfin-tdm-pcm-audio", |
| 115 | .codec_name = "ad193x.5", | 115 | .codec_name = "spi0.5", |
| 116 | .ops = &bf5xx_ad193x_ops, | 116 | .ops = &bf5xx_ad193x_ops, |
| 117 | }, | 117 | }, |
| 118 | }; | 118 | }; |
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c index fd0dc46afc34..5c6c2457386e 100644 --- a/sound/soc/fsl/mpc5200_dma.c +++ b/sound/soc/fsl/mpc5200_dma.c | |||
| @@ -369,7 +369,7 @@ static struct snd_soc_platform_driver mpc5200_audio_dma_platform = { | |||
| 369 | .pcm_free = &psc_dma_free, | 369 | .pcm_free = &psc_dma_free, |
| 370 | }; | 370 | }; |
| 371 | 371 | ||
| 372 | static int mpc5200_hpcd_probe(struct of_device *op) | 372 | static int mpc5200_hpcd_probe(struct platform_device *op) |
| 373 | { | 373 | { |
| 374 | phys_addr_t fifo; | 374 | phys_addr_t fifo; |
| 375 | struct psc_dma *psc_dma; | 375 | struct psc_dma *psc_dma; |
| @@ -487,7 +487,7 @@ out_unmap: | |||
| 487 | return ret; | 487 | return ret; |
| 488 | } | 488 | } |
| 489 | 489 | ||
| 490 | static int mpc5200_hpcd_remove(struct of_device *op) | 490 | static int mpc5200_hpcd_remove(struct platform_device *op) |
| 491 | { | 491 | { |
| 492 | struct psc_dma *psc_dma = dev_get_drvdata(&op->dev); | 492 | struct psc_dma *psc_dma = dev_get_drvdata(&op->dev); |
| 493 | 493 | ||
| @@ -519,7 +519,7 @@ MODULE_DEVICE_TABLE(of, mpc5200_hpcd_match); | |||
| 519 | static struct platform_driver mpc5200_hpcd_of_driver = { | 519 | static struct platform_driver mpc5200_hpcd_of_driver = { |
| 520 | .probe = mpc5200_hpcd_probe, | 520 | .probe = mpc5200_hpcd_probe, |
| 521 | .remove = mpc5200_hpcd_remove, | 521 | .remove = mpc5200_hpcd_remove, |
| 522 | .dev = { | 522 | .driver = { |
| 523 | .owner = THIS_MODULE, | 523 | .owner = THIS_MODULE, |
| 524 | .name = "mpc5200-pcm-audio", | 524 | .name = "mpc5200-pcm-audio", |
| 525 | .of_match_table = mpc5200_hpcd_match, | 525 | .of_match_table = mpc5200_hpcd_match, |
diff --git a/sound/soc/imx/imx-pcm-fiq.c b/sound/soc/imx/imx-pcm-fiq.c index 309c59e6fb6c..7945625e0e08 100644 --- a/sound/soc/imx/imx-pcm-fiq.c +++ b/sound/soc/imx/imx-pcm-fiq.c | |||
| @@ -240,7 +240,6 @@ static int ssi_irq = 0; | |||
| 240 | 240 | ||
| 241 | static int imx_pcm_fiq_new(struct snd_soc_pcm_runtime *rtd) | 241 | static int imx_pcm_fiq_new(struct snd_soc_pcm_runtime *rtd) |
| 242 | { | 242 | { |
| 243 | struct snd_card *card = rtd->card->snd_card; | ||
| 244 | struct snd_soc_dai *dai = rtd->cpu_dai; | 243 | struct snd_soc_dai *dai = rtd->cpu_dai; |
| 245 | struct snd_pcm *pcm = rtd->pcm; | 244 | struct snd_pcm *pcm = rtd->pcm; |
| 246 | int ret; | 245 | int ret; |
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c index 8f16cd37c2af..d0bcf3fcea01 100644 --- a/sound/soc/kirkwood/kirkwood-i2s.c +++ b/sound/soc/kirkwood/kirkwood-i2s.c | |||
| @@ -424,7 +424,7 @@ static __devinit int kirkwood_i2s_dev_probe(struct platform_device *pdev) | |||
| 424 | if (!priv->mem) { | 424 | if (!priv->mem) { |
| 425 | dev_err(&pdev->dev, "request_mem_region failed\n"); | 425 | dev_err(&pdev->dev, "request_mem_region failed\n"); |
| 426 | err = -EBUSY; | 426 | err = -EBUSY; |
| 427 | goto error_alloc; | 427 | goto err_alloc; |
| 428 | } | 428 | } |
| 429 | 429 | ||
| 430 | priv->io = ioremap(priv->mem->start, SZ_16K); | 430 | priv->io = ioremap(priv->mem->start, SZ_16K); |
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c index d9f8aded51f3..20b7f3b003a3 100644 --- a/sound/soc/soc-cache.c +++ b/sound/soc/soc-cache.c | |||
| @@ -203,14 +203,14 @@ static int snd_soc_rbtree_cache_sync(struct snd_soc_codec *codec) | |||
| 203 | rbnode = rb_entry(node, struct snd_soc_rbtree_node, node); | 203 | rbnode = rb_entry(node, struct snd_soc_rbtree_node, node); |
| 204 | for (i = 0; i < rbnode->blklen; ++i) { | 204 | for (i = 0; i < rbnode->blklen; ++i) { |
| 205 | regtmp = rbnode->base_reg + i; | 205 | regtmp = rbnode->base_reg + i; |
| 206 | WARN_ON(codec->writable_register && | ||
| 207 | codec->writable_register(codec, regtmp)); | ||
| 208 | val = snd_soc_rbtree_get_register(rbnode, i); | 206 | val = snd_soc_rbtree_get_register(rbnode, i); |
| 209 | def = snd_soc_get_cache_val(codec->reg_def_copy, i, | 207 | def = snd_soc_get_cache_val(codec->reg_def_copy, i, |
| 210 | rbnode->word_size); | 208 | rbnode->word_size); |
| 211 | if (val == def) | 209 | if (val == def) |
| 212 | continue; | 210 | continue; |
| 213 | 211 | ||
| 212 | WARN_ON(!snd_soc_codec_writable_register(codec, regtmp)); | ||
| 213 | |||
| 214 | codec->cache_bypass = 1; | 214 | codec->cache_bypass = 1; |
| 215 | ret = snd_soc_write(codec, regtmp, val); | 215 | ret = snd_soc_write(codec, regtmp, val); |
| 216 | codec->cache_bypass = 0; | 216 | codec->cache_bypass = 0; |
| @@ -563,8 +563,7 @@ static int snd_soc_lzo_cache_sync(struct snd_soc_codec *codec) | |||
| 563 | 563 | ||
| 564 | lzo_blocks = codec->reg_cache; | 564 | lzo_blocks = codec->reg_cache; |
| 565 | for_each_set_bit(i, lzo_blocks[0]->sync_bmp, lzo_blocks[0]->sync_bmp_nbits) { | 565 | for_each_set_bit(i, lzo_blocks[0]->sync_bmp, lzo_blocks[0]->sync_bmp_nbits) { |
| 566 | WARN_ON(codec->writable_register && | 566 | WARN_ON(!snd_soc_codec_writable_register(codec, i)); |
| 567 | codec->writable_register(codec, i)); | ||
| 568 | ret = snd_soc_cache_read(codec, i, &val); | 567 | ret = snd_soc_cache_read(codec, i, &val); |
| 569 | if (ret) | 568 | if (ret) |
| 570 | return ret; | 569 | return ret; |
| @@ -823,8 +822,6 @@ static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec) | |||
| 823 | 822 | ||
| 824 | codec_drv = codec->driver; | 823 | codec_drv = codec->driver; |
| 825 | for (i = 0; i < codec_drv->reg_cache_size; ++i) { | 824 | for (i = 0; i < codec_drv->reg_cache_size; ++i) { |
| 826 | WARN_ON(codec->writable_register && | ||
| 827 | codec->writable_register(codec, i)); | ||
| 828 | ret = snd_soc_cache_read(codec, i, &val); | 825 | ret = snd_soc_cache_read(codec, i, &val); |
| 829 | if (ret) | 826 | if (ret) |
| 830 | return ret; | 827 | return ret; |
| @@ -832,6 +829,9 @@ static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec) | |||
| 832 | if (snd_soc_get_cache_val(codec->reg_def_copy, | 829 | if (snd_soc_get_cache_val(codec->reg_def_copy, |
| 833 | i, codec_drv->reg_word_size) == val) | 830 | i, codec_drv->reg_word_size) == val) |
| 834 | continue; | 831 | continue; |
| 832 | |||
| 833 | WARN_ON(!snd_soc_codec_writable_register(codec, i)); | ||
| 834 | |||
| 835 | ret = snd_soc_write(codec, i, val); | 835 | ret = snd_soc_write(codec, i, val); |
| 836 | if (ret) | 836 | if (ret) |
| 837 | return ret; | 837 | return ret; |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index b085d8e87574..d2ef014af215 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
| @@ -1633,7 +1633,7 @@ int snd_soc_codec_readable_register(struct snd_soc_codec *codec, | |||
| 1633 | if (codec->readable_register) | 1633 | if (codec->readable_register) |
| 1634 | return codec->readable_register(codec, reg); | 1634 | return codec->readable_register(codec, reg); |
| 1635 | else | 1635 | else |
| 1636 | return 0; | 1636 | return 1; |
| 1637 | } | 1637 | } |
| 1638 | EXPORT_SYMBOL_GPL(snd_soc_codec_readable_register); | 1638 | EXPORT_SYMBOL_GPL(snd_soc_codec_readable_register); |
| 1639 | 1639 | ||
| @@ -1651,7 +1651,7 @@ int snd_soc_codec_writable_register(struct snd_soc_codec *codec, | |||
| 1651 | if (codec->writable_register) | 1651 | if (codec->writable_register) |
| 1652 | return codec->writable_register(codec, reg); | 1652 | return codec->writable_register(codec, reg); |
| 1653 | else | 1653 | else |
| 1654 | return 0; | 1654 | return 1; |
| 1655 | } | 1655 | } |
| 1656 | EXPORT_SYMBOL_GPL(snd_soc_codec_writable_register); | 1656 | EXPORT_SYMBOL_GPL(snd_soc_codec_writable_register); |
| 1657 | 1657 | ||
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 7e15914b3633..d67c637557a7 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
| @@ -2763,7 +2763,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_ignore_suspend); | |||
| 2763 | 2763 | ||
| 2764 | /** | 2764 | /** |
| 2765 | * snd_soc_dapm_free - free dapm resources | 2765 | * snd_soc_dapm_free - free dapm resources |
| 2766 | * @card: SoC device | 2766 | * @dapm: DAPM context |
| 2767 | * | 2767 | * |
| 2768 | * Free all dapm widgets and resources. | 2768 | * Free all dapm widgets and resources. |
| 2769 | */ | 2769 | */ |
diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c index 38b00131b2fe..fa31d9c2abd8 100644 --- a/sound/soc/soc-jack.c +++ b/sound/soc/soc-jack.c | |||
| @@ -105,7 +105,7 @@ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask) | |||
| 105 | 105 | ||
| 106 | snd_soc_dapm_sync(dapm); | 106 | snd_soc_dapm_sync(dapm); |
| 107 | 107 | ||
| 108 | snd_jack_report(jack->jack, status); | 108 | snd_jack_report(jack->jack, jack->status); |
| 109 | 109 | ||
| 110 | out: | 110 | out: |
| 111 | mutex_unlock(&codec->mutex); | 111 | mutex_unlock(&codec->mutex); |
