aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-08-05 13:03:06 -0400
committerLen Brown <len.brown@intel.com>2005-08-05 13:03:06 -0400
commite872d4cace8681838e8d18d52c92f4870e980a08 (patch)
tree082b75cc52935efae68f9f744bc3f8807f7176c6
parent1f3a730117ceda2a7c917d687921fe3c82283968 (diff)
parent403fe5ae57c831968c3dbbaba291ae825a1c5aaa (diff)
Merge ../from-linus
-rw-r--r--Documentation/usb/usbmon.txt2
-rw-r--r--arch/alpha/kernel/pci.c16
-rw-r--r--arch/arm/kernel/bios32.c17
-rw-r--r--arch/ppc/kernel/pci.c15
-rw-r--r--arch/ppc64/kernel/pci.c20
-rw-r--r--arch/sparc64/kernel/pci.c6
-rw-r--r--drivers/char/rtc.c7
-rw-r--r--drivers/pci/pci.c59
-rw-r--r--drivers/pci/setup-res.c2
-rw-r--r--drivers/pcmcia/yenta_socket.c15
-rw-r--r--drivers/usb/host/ehci-dbg.c2
-rw-r--r--drivers/usb/host/ehci-q.c5
-rw-r--r--drivers/usb/host/ehci-sched.c13
-rw-r--r--drivers/usb/host/ehci.h5
-rw-r--r--drivers/usb/host/isp116x-hcd.c4
-rw-r--r--drivers/usb/mon/Kconfig9
-rw-r--r--drivers/usb/mon/Makefile1
-rw-r--r--fs/namei.c9
-rw-r--r--include/asm-alpha/pci.h3
-rw-r--r--include/asm-arm/pci.h4
-rw-r--r--include/asm-generic/pci.h8
-rw-r--r--include/asm-parisc/pci.h4
-rw-r--r--include/asm-ppc/pci.h4
-rw-r--r--include/asm-ppc64/pci.h4
-rw-r--r--include/linux/fsnotify.h4
-rw-r--r--include/linux/pci.h3
-rw-r--r--mm/mmap.c6
-rw-r--r--mm/nommu.c6
-rw-r--r--net/ipv4/tcp_output.c86
29 files changed, 244 insertions, 95 deletions
diff --git a/Documentation/usb/usbmon.txt b/Documentation/usb/usbmon.txt
index f1896ee3bb2a..63cb7edd177e 100644
--- a/Documentation/usb/usbmon.txt
+++ b/Documentation/usb/usbmon.txt
@@ -102,7 +102,7 @@ Here is the list of words, from left to right:
102- URB Status. This field makes no sense for submissions, but is present 102- URB Status. This field makes no sense for submissions, but is present
103 to help scripts with parsing. In error case, it contains the error code. 103 to help scripts with parsing. In error case, it contains the error code.
104 In case of a setup packet, it contains a Setup Tag. If scripts read a number 104 In case of a setup packet, it contains a Setup Tag. If scripts read a number
105 in this field, the proceed to read Data Length. Otherwise, they read 105 in this field, they proceed to read Data Length. Otherwise, they read
106 the setup packet before reading the Data Length. 106 the setup packet before reading the Data Length.
107- Setup packet, if present, consists of 5 words: one of each for bmRequestType, 107- Setup packet, if present, consists of 5 words: one of each for bmRequestType,
108 bRequest, wValue, wIndex, wLength, as specified by the USB Specification 2.0. 108 bRequest, wValue, wIndex, wLength, as specified by the USB Specification 2.0.
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 1f36bbd0ed5d..2a8b364c822e 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -350,8 +350,24 @@ pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
350 region->end = res->end - offset; 350 region->end = res->end - offset;
351} 351}
352 352
353void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
354 struct pci_bus_region *region)
355{
356 struct pci_controller *hose = (struct pci_controller *)dev->sysdata;
357 unsigned long offset = 0;
358
359 if (res->flags & IORESOURCE_IO)
360 offset = hose->io_space->start;
361 else if (res->flags & IORESOURCE_MEM)
362 offset = hose->mem_space->start;
363
364 res->start = region->start + offset;
365 res->end = region->end + offset;
366}
367
353#ifdef CONFIG_HOTPLUG 368#ifdef CONFIG_HOTPLUG
354EXPORT_SYMBOL(pcibios_resource_to_bus); 369EXPORT_SYMBOL(pcibios_resource_to_bus);
370EXPORT_SYMBOL(pcibios_bus_to_resource);
355#endif 371#endif
356 372
357int 373int
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index ad26e98f1e62..c4923fac8dff 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -447,9 +447,26 @@ pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
447 region->end = res->end - offset; 447 region->end = res->end - offset;
448} 448}
449 449
450void __devinit
451pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
452 struct pci_bus_region *region)
453{
454 struct pci_sys_data *root = dev->sysdata;
455 unsigned long offset = 0;
456
457 if (res->flags & IORESOURCE_IO)
458 offset = root->io_offset;
459 if (res->flags & IORESOURCE_MEM)
460 offset = root->mem_offset;
461
462 res->start = region->start + offset;
463 res->end = region->end + offset;
464}
465
450#ifdef CONFIG_HOTPLUG 466#ifdef CONFIG_HOTPLUG
451EXPORT_SYMBOL(pcibios_fixup_bus); 467EXPORT_SYMBOL(pcibios_fixup_bus);
452EXPORT_SYMBOL(pcibios_resource_to_bus); 468EXPORT_SYMBOL(pcibios_resource_to_bus);
469EXPORT_SYMBOL(pcibios_bus_to_resource);
453#endif 470#endif
454 471
455/* 472/*
diff --git a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c
index 70cfb6ffd877..7b3586a3bf30 100644
--- a/arch/ppc/kernel/pci.c
+++ b/arch/ppc/kernel/pci.c
@@ -160,6 +160,21 @@ void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
160} 160}
161EXPORT_SYMBOL(pcibios_resource_to_bus); 161EXPORT_SYMBOL(pcibios_resource_to_bus);
162 162
163void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
164 struct pci_bus_region *region)
165{
166 unsigned long offset = 0;
167 struct pci_controller *hose = dev->sysdata;
168
169 if (hose && res->flags & IORESOURCE_IO)
170 offset = (unsigned long)hose->io_base_virt - isa_io_base;
171 else if (hose && res->flags & IORESOURCE_MEM)
172 offset = hose->pci_mem_offset;
173 res->start = region->start + offset;
174 res->end = region->end + offset;
175}
176EXPORT_SYMBOL(pcibios_bus_to_resource);
177
163/* 178/*
164 * We need to avoid collisions with `mirrored' VGA ports 179 * We need to avoid collisions with `mirrored' VGA ports
165 * and other strange ISA hardware, so we always want the 180 * and other strange ISA hardware, so we always want the
diff --git a/arch/ppc64/kernel/pci.c b/arch/ppc64/kernel/pci.c
index ae6f579d3fa0..d0d55c7908ef 100644
--- a/arch/ppc64/kernel/pci.c
+++ b/arch/ppc64/kernel/pci.c
@@ -108,8 +108,28 @@ void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region
108 region->end = res->end - offset; 108 region->end = res->end - offset;
109} 109}
110 110
111void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
112 struct pci_bus_region *region)
113{
114 unsigned long offset = 0;
115 struct pci_controller *hose = pci_bus_to_host(dev->bus);
116
117 if (!hose)
118 return;
119
120 if (res->flags & IORESOURCE_IO)
121 offset = (unsigned long)hose->io_base_virt - pci_io_base;
122
123 if (res->flags & IORESOURCE_MEM)
124 offset = hose->pci_mem_offset;
125
126 res->start = region->start + offset;
127 res->end = region->end + offset;
128}
129
111#ifdef CONFIG_HOTPLUG 130#ifdef CONFIG_HOTPLUG
112EXPORT_SYMBOL(pcibios_resource_to_bus); 131EXPORT_SYMBOL(pcibios_resource_to_bus);
132EXPORT_SYMBOL(pcibios_bus_to_resource);
113#endif 133#endif
114 134
115/* 135/*
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
index bba140d98b1b..914e125d3971 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -413,6 +413,12 @@ static int pci_assign_bus_resource(const struct pci_bus *bus,
413 return -EBUSY; 413 return -EBUSY;
414} 414}
415 415
416void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
417{
418 /* Not implemented for sparc64... */
419 BUG();
420}
421
416int pci_assign_resource(struct pci_dev *pdev, int resource) 422int pci_assign_resource(struct pci_dev *pdev, int resource)
417{ 423{
418 struct pcidev_cookie *pcp = pdev->sysdata; 424 struct pcidev_cookie *pcp = pdev->sysdata;
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index d8f9e94ae475..cd4fe8b1709f 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -1209,6 +1209,7 @@ static int rtc_proc_open(struct inode *inode, struct file *file)
1209 1209
1210void rtc_get_rtc_time(struct rtc_time *rtc_tm) 1210void rtc_get_rtc_time(struct rtc_time *rtc_tm)
1211{ 1211{
1212 unsigned long uip_watchdog = jiffies;
1212 unsigned char ctrl; 1213 unsigned char ctrl;
1213#ifdef CONFIG_MACH_DECSTATION 1214#ifdef CONFIG_MACH_DECSTATION
1214 unsigned int real_year; 1215 unsigned int real_year;
@@ -1224,8 +1225,10 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm)
1224 * Once the read clears, read the RTC time (again via ioctl). Easy. 1225 * Once the read clears, read the RTC time (again via ioctl). Easy.
1225 */ 1226 */
1226 1227
1227 if (rtc_is_updating() != 0) 1228 while (rtc_is_updating() != 0 && jiffies - uip_watchdog < 2*HZ/100) {
1228 msleep(20); 1229 barrier();
1230 cpu_relax();
1231 }
1229 1232
1230 /* 1233 /*
1231 * Only the values that we read from the RTC are set. We leave 1234 * Only the values that we read from the RTC are set. We leave
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 1b34fc56067e..65ea7d25f691 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -222,6 +222,37 @@ pci_find_parent_resource(const struct pci_dev *dev, struct resource *res)
222} 222}
223 223
224/** 224/**
225 * pci_restore_bars - restore a devices BAR values (e.g. after wake-up)
226 * @dev: PCI device to have its BARs restored
227 *
228 * Restore the BAR values for a given device, so as to make it
229 * accessible by its driver.
230 */
231void
232pci_restore_bars(struct pci_dev *dev)
233{
234 int i, numres;
235
236 switch (dev->hdr_type) {
237 case PCI_HEADER_TYPE_NORMAL:
238 numres = 6;
239 break;
240 case PCI_HEADER_TYPE_BRIDGE:
241 numres = 2;
242 break;
243 case PCI_HEADER_TYPE_CARDBUS:
244 numres = 1;
245 break;
246 default:
247 /* Should never get here, but just in case... */
248 return;
249 }
250
251 for (i = 0; i < numres; i ++)
252 pci_update_resource(dev, &dev->resource[i], i);
253}
254
255/**
225 * pci_set_power_state - Set the power state of a PCI device 256 * pci_set_power_state - Set the power state of a PCI device
226 * @dev: PCI device to be suspended 257 * @dev: PCI device to be suspended
227 * @state: PCI power state (D0, D1, D2, D3hot, D3cold) we're entering 258 * @state: PCI power state (D0, D1, D2, D3hot, D3cold) we're entering
@@ -239,7 +270,7 @@ int (*platform_pci_set_power_state)(struct pci_dev *dev, pci_power_t t);
239int 270int
240pci_set_power_state(struct pci_dev *dev, pci_power_t state) 271pci_set_power_state(struct pci_dev *dev, pci_power_t state)
241{ 272{
242 int pm; 273 int pm, need_restore = 0;
243 u16 pmcsr, pmc; 274 u16 pmcsr, pmc;
244 275
245 /* bound the state we're entering */ 276 /* bound the state we're entering */
@@ -278,14 +309,17 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state)
278 return -EIO; 309 return -EIO;
279 } 310 }
280 311
312 pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr);
313
281 /* If we're in D3, force entire word to 0. 314 /* If we're in D3, force entire word to 0.
282 * This doesn't affect PME_Status, disables PME_En, and 315 * This doesn't affect PME_Status, disables PME_En, and
283 * sets PowerState to 0. 316 * sets PowerState to 0.
284 */ 317 */
285 if (dev->current_state >= PCI_D3hot) 318 if (dev->current_state >= PCI_D3hot) {
319 if (!(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET))
320 need_restore = 1;
286 pmcsr = 0; 321 pmcsr = 0;
287 else { 322 } else {
288 pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr);
289 pmcsr &= ~PCI_PM_CTRL_STATE_MASK; 323 pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
290 pmcsr |= state; 324 pmcsr |= state;
291 } 325 }
@@ -308,6 +342,22 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state)
308 platform_pci_set_power_state(dev, state); 342 platform_pci_set_power_state(dev, state);
309 343
310 dev->current_state = state; 344 dev->current_state = state;
345
346 /* According to section 5.4.1 of the "PCI BUS POWER MANAGEMENT
347 * INTERFACE SPECIFICATION, REV. 1.2", a device transitioning
348 * from D3hot to D0 _may_ perform an internal reset, thereby
349 * going to "D0 Uninitialized" rather than "D0 Initialized".
350 * For example, at least some versions of the 3c905B and the
351 * 3c556B exhibit this behaviour.
352 *
353 * At least some laptop BIOSen (e.g. the Thinkpad T21) leave
354 * devices in a D3hot state at boot. Consequently, we need to
355 * restore at least the BARs so that the device will be
356 * accessible to its driver.
357 */
358 if (need_restore)
359 pci_restore_bars(dev);
360
311 return 0; 361 return 0;
312} 362}
313 363
@@ -805,6 +855,7 @@ struct pci_dev *isa_bridge;
805EXPORT_SYMBOL(isa_bridge); 855EXPORT_SYMBOL(isa_bridge);
806#endif 856#endif
807 857
858EXPORT_SYMBOL_GPL(pci_restore_bars);
808EXPORT_SYMBOL(pci_enable_device_bars); 859EXPORT_SYMBOL(pci_enable_device_bars);
809EXPORT_SYMBOL(pci_enable_device); 860EXPORT_SYMBOL(pci_enable_device);
810EXPORT_SYMBOL(pci_disable_device); 861EXPORT_SYMBOL(pci_disable_device);
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 1ca21d2ba11c..878fd0a65c02 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -26,7 +26,7 @@
26#include "pci.h" 26#include "pci.h"
27 27
28 28
29static void 29void
30pci_update_resource(struct pci_dev *dev, struct resource *res, int resno) 30pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
31{ 31{
32 struct pci_bus_region region; 32 struct pci_bus_region region;
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 91e7457d5b04..62fd705203fb 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -605,9 +605,8 @@ static int yenta_search_res(struct yenta_socket *socket, struct resource *res,
605 605
606static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type, int addr_start, int addr_end) 606static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type, int addr_start, int addr_end)
607{ 607{
608 struct pci_bus *bus;
609 struct resource *root, *res; 608 struct resource *root, *res;
610 u32 start, end; 609 struct pci_bus_region region;
611 unsigned mask; 610 unsigned mask;
612 611
613 res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr; 612 res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr;
@@ -620,15 +619,13 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ
620 if (type & IORESOURCE_IO) 619 if (type & IORESOURCE_IO)
621 mask = ~3; 620 mask = ~3;
622 621
623 bus = socket->dev->subordinate; 622 res->name = socket->dev->subordinate->name;
624 res->name = bus->name;
625 res->flags = type; 623 res->flags = type;
626 624
627 start = config_readl(socket, addr_start) & mask; 625 region.start = config_readl(socket, addr_start) & mask;
628 end = config_readl(socket, addr_end) | ~mask; 626 region.end = config_readl(socket, addr_end) | ~mask;
629 if (start && end > start && !override_bios) { 627 if (region.start && region.end > region.start && !override_bios) {
630 res->start = start; 628 pcibios_bus_to_resource(socket->dev, res, &region);
631 res->end = end;
632 root = pci_find_parent_resource(socket->dev, res); 629 root = pci_find_parent_resource(socket->dev, res);
633 if (root && (request_resource(root, res) == 0)) 630 if (root && (request_resource(root, res) == 0))
634 return; 631 return;
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 50cb01831075..b01efb6b36f6 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -527,7 +527,7 @@ show_periodic (struct class_device *class_dev, char *buf)
527 p.qh->period, 527 p.qh->period,
528 le32_to_cpup (&p.qh->hw_info2) 528 le32_to_cpup (&p.qh->hw_info2)
529 /* uframe masks */ 529 /* uframe masks */
530 & 0xffff, 530 & (QH_CMASK | QH_SMASK),
531 p.qh); 531 p.qh);
532 size -= temp; 532 size -= temp;
533 next += temp; 533 next += temp;
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index 4f97a4ad1ed3..20df01a79b2e 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -222,7 +222,7 @@ __acquires(ehci->lock)
222 struct ehci_qh *qh = (struct ehci_qh *) urb->hcpriv; 222 struct ehci_qh *qh = (struct ehci_qh *) urb->hcpriv;
223 223
224 /* S-mask in a QH means it's an interrupt urb */ 224 /* S-mask in a QH means it's an interrupt urb */
225 if ((qh->hw_info2 & __constant_cpu_to_le32 (0x00ff)) != 0) { 225 if ((qh->hw_info2 & __constant_cpu_to_le32 (QH_SMASK)) != 0) {
226 226
227 /* ... update hc-wide periodic stats (for usbfs) */ 227 /* ... update hc-wide periodic stats (for usbfs) */
228 ehci_to_hcd(ehci)->self.bandwidth_int_reqs--; 228 ehci_to_hcd(ehci)->self.bandwidth_int_reqs--;
@@ -428,7 +428,8 @@ halt:
428 /* should be rare for periodic transfers, 428 /* should be rare for periodic transfers,
429 * except maybe high bandwidth ... 429 * except maybe high bandwidth ...
430 */ 430 */
431 if (qh->period) { 431 if ((__constant_cpu_to_le32 (QH_SMASK)
432 & qh->hw_info2) != 0) {
432 intr_deschedule (ehci, qh); 433 intr_deschedule (ehci, qh);
433 (void) qh_schedule (ehci, qh); 434 (void) qh_schedule (ehci, qh);
434 } else 435 } else
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 9af4f64532a9..b56f25864ed6 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -301,7 +301,7 @@ static int qh_link_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh)
301 301
302 dev_dbg (&qh->dev->dev, 302 dev_dbg (&qh->dev->dev,
303 "link qh%d-%04x/%p start %d [%d/%d us]\n", 303 "link qh%d-%04x/%p start %d [%d/%d us]\n",
304 period, le32_to_cpup (&qh->hw_info2) & 0xffff, 304 period, le32_to_cpup (&qh->hw_info2) & (QH_CMASK | QH_SMASK),
305 qh, qh->start, qh->usecs, qh->c_usecs); 305 qh, qh->start, qh->usecs, qh->c_usecs);
306 306
307 /* high bandwidth, or otherwise every microframe */ 307 /* high bandwidth, or otherwise every microframe */
@@ -385,7 +385,8 @@ static void qh_unlink_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh)
385 385
386 dev_dbg (&qh->dev->dev, 386 dev_dbg (&qh->dev->dev,
387 "unlink qh%d-%04x/%p start %d [%d/%d us]\n", 387 "unlink qh%d-%04x/%p start %d [%d/%d us]\n",
388 qh->period, le32_to_cpup (&qh->hw_info2) & 0xffff, 388 qh->period,
389 le32_to_cpup (&qh->hw_info2) & (QH_CMASK | QH_SMASK),
389 qh, qh->start, qh->usecs, qh->c_usecs); 390 qh, qh->start, qh->usecs, qh->c_usecs);
390 391
391 /* qh->qh_next still "live" to HC */ 392 /* qh->qh_next still "live" to HC */
@@ -411,7 +412,7 @@ static void intr_deschedule (struct ehci_hcd *ehci, struct ehci_qh *qh)
411 * active high speed queues may need bigger delays... 412 * active high speed queues may need bigger delays...
412 */ 413 */
413 if (list_empty (&qh->qtd_list) 414 if (list_empty (&qh->qtd_list)
414 || (__constant_cpu_to_le32 (0x0ff << 8) 415 || (__constant_cpu_to_le32 (QH_CMASK)
415 & qh->hw_info2) != 0) 416 & qh->hw_info2) != 0)
416 wait = 2; 417 wait = 2;
417 else 418 else
@@ -533,7 +534,7 @@ static int qh_schedule (struct ehci_hcd *ehci, struct ehci_qh *qh)
533 534
534 /* reuse the previous schedule slots, if we can */ 535 /* reuse the previous schedule slots, if we can */
535 if (frame < qh->period) { 536 if (frame < qh->period) {
536 uframe = ffs (le32_to_cpup (&qh->hw_info2) & 0x00ff); 537 uframe = ffs (le32_to_cpup (&qh->hw_info2) & QH_SMASK);
537 status = check_intr_schedule (ehci, frame, --uframe, 538 status = check_intr_schedule (ehci, frame, --uframe,
538 qh, &c_mask); 539 qh, &c_mask);
539 } else { 540 } else {
@@ -569,10 +570,10 @@ static int qh_schedule (struct ehci_hcd *ehci, struct ehci_qh *qh)
569 qh->start = frame; 570 qh->start = frame;
570 571
571 /* reset S-frame and (maybe) C-frame masks */ 572 /* reset S-frame and (maybe) C-frame masks */
572 qh->hw_info2 &= __constant_cpu_to_le32 (~0xffff); 573 qh->hw_info2 &= __constant_cpu_to_le32(~(QH_CMASK | QH_SMASK));
573 qh->hw_info2 |= qh->period 574 qh->hw_info2 |= qh->period
574 ? cpu_to_le32 (1 << uframe) 575 ? cpu_to_le32 (1 << uframe)
575 : __constant_cpu_to_le32 (0xff); 576 : __constant_cpu_to_le32 (QH_SMASK);
576 qh->hw_info2 |= c_mask; 577 qh->hw_info2 |= c_mask;
577 } else 578 } else
578 ehci_dbg (ehci, "reused qh %p schedule\n", qh); 579 ehci_dbg (ehci, "reused qh %p schedule\n", qh);
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 4df498231752..a7542157534c 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -385,6 +385,11 @@ struct ehci_qh {
385 __le32 hw_info1; /* see EHCI 3.6.2 */ 385 __le32 hw_info1; /* see EHCI 3.6.2 */
386#define QH_HEAD 0x00008000 386#define QH_HEAD 0x00008000
387 __le32 hw_info2; /* see EHCI 3.6.2 */ 387 __le32 hw_info2; /* see EHCI 3.6.2 */
388#define QH_SMASK 0x000000ff
389#define QH_CMASK 0x0000ff00
390#define QH_HUBADDR 0x007f0000
391#define QH_HUBPORT 0x3f800000
392#define QH_MULT 0xc0000000
388 __le32 hw_current; /* qtd list - see EHCI 3.6.4 */ 393 __le32 hw_current; /* qtd list - see EHCI 3.6.4 */
389 394
390 /* qtd overlay (hardware parts of a struct ehci_qtd) */ 395 /* qtd overlay (hardware parts of a struct ehci_qtd) */
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index 50b1970fe6b6..76cb496c5836 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -229,9 +229,11 @@ static void preproc_atl_queue(struct isp116x *isp116x)
229 struct isp116x_ep *ep; 229 struct isp116x_ep *ep;
230 struct urb *urb; 230 struct urb *urb;
231 struct ptd *ptd; 231 struct ptd *ptd;
232 u16 toggle = 0, dir = PTD_DIR_SETUP, len; 232 u16 len;
233 233
234 for (ep = isp116x->atl_active; ep; ep = ep->active) { 234 for (ep = isp116x->atl_active; ep; ep = ep->active) {
235 u16 toggle = 0, dir = PTD_DIR_SETUP;
236
235 BUG_ON(list_empty(&ep->hep->urb_list)); 237 BUG_ON(list_empty(&ep->hep->urb_list));
236 urb = container_of(ep->hep->urb_list.next, 238 urb = container_of(ep->hep->urb_list.next,
237 struct urb, urb_list); 239 struct urb, urb_list);
diff --git a/drivers/usb/mon/Kconfig b/drivers/usb/mon/Kconfig
index 777642e26b9a..deb9ddffa402 100644
--- a/drivers/usb/mon/Kconfig
+++ b/drivers/usb/mon/Kconfig
@@ -9,9 +9,8 @@ config USB_MON
9 help 9 help
10 If you say Y here, a component which captures the USB traffic 10 If you say Y here, a component which captures the USB traffic
11 between peripheral-specific drivers and HC drivers will be built. 11 between peripheral-specific drivers and HC drivers will be built.
12 The USB_MON is similar in spirit and may be compatible with Dave 12 For more information, see <file:Documentation/usb/usbmon.txt>.
13 Harding's USBMon.
14 13
15 This is somewhat experimental at this time, but it should be safe, 14 This is somewhat experimental at this time, but it should be safe.
16 as long as you aren't using modular USB and try to remove this 15
17 module. 16 If unsure, say Y.
diff --git a/drivers/usb/mon/Makefile b/drivers/usb/mon/Makefile
index f18d10ce91f9..b0015b8a1d1f 100644
--- a/drivers/usb/mon/Makefile
+++ b/drivers/usb/mon/Makefile
@@ -4,4 +4,5 @@
4 4
5usbmon-objs := mon_main.o mon_stat.o mon_text.o 5usbmon-objs := mon_main.o mon_stat.o mon_text.o
6 6
7# This does not use CONFIG_USB_MON because we want this to use a tristate.
7obj-$(CONFIG_USB) += usbmon.o 8obj-$(CONFIG_USB) += usbmon.o
diff --git a/fs/namei.c b/fs/namei.c
index 83559dce4286..32accb6a672f 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1874,14 +1874,9 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry)
1874 1874
1875 /* We don't d_delete() NFS sillyrenamed files--they still exist. */ 1875 /* We don't d_delete() NFS sillyrenamed files--they still exist. */
1876 if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) { 1876 if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) {
1877#if defined(CONFIG_INOTIFY) || defined(CONFIG_DNOTIFY) 1877 struct inode *inode = dentry->d_inode;
1878 dget(dentry);
1879 d_delete(dentry); 1878 d_delete(dentry);
1880 fsnotify_unlink(dentry, dir); 1879 fsnotify_unlink(dentry, inode, dir);
1881 dput(dentry);
1882#else
1883 d_delete(dentry);
1884#endif
1885 } 1880 }
1886 1881
1887 return error; 1882 return error;
diff --git a/include/asm-alpha/pci.h b/include/asm-alpha/pci.h
index 28957697e59c..f681e675b823 100644
--- a/include/asm-alpha/pci.h
+++ b/include/asm-alpha/pci.h
@@ -251,6 +251,9 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
251extern void pcibios_resource_to_bus(struct pci_dev *, struct pci_bus_region *, 251extern void pcibios_resource_to_bus(struct pci_dev *, struct pci_bus_region *,
252 struct resource *); 252 struct resource *);
253 253
254extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
255 struct pci_bus_region *region);
256
254#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index 257#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
255 258
256static inline int pci_proc_domain(struct pci_bus *bus) 259static inline int pci_proc_domain(struct pci_bus *bus)
diff --git a/include/asm-arm/pci.h b/include/asm-arm/pci.h
index b28f1c95dd62..38ea5899a580 100644
--- a/include/asm-arm/pci.h
+++ b/include/asm-arm/pci.h
@@ -60,6 +60,10 @@ extern void
60pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, 60pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
61 struct resource *res); 61 struct resource *res);
62 62
63extern void
64pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
65 struct pci_bus_region *region);
66
63static inline void pcibios_add_platform_entries(struct pci_dev *dev) 67static inline void pcibios_add_platform_entries(struct pci_dev *dev)
64{ 68{
65} 69}
diff --git a/include/asm-generic/pci.h b/include/asm-generic/pci.h
index 9d4cc47bde39..ee1d8b5d8168 100644
--- a/include/asm-generic/pci.h
+++ b/include/asm-generic/pci.h
@@ -22,6 +22,14 @@ pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
22 region->end = res->end; 22 region->end = res->end;
23} 23}
24 24
25static inline void
26pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
27 struct pci_bus_region *region)
28{
29 res->start = region->start;
30 res->end = region->end;
31}
32
25#define pcibios_scan_all_fns(a, b) 0 33#define pcibios_scan_all_fns(a, b) 0
26 34
27#ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ 35#ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
diff --git a/include/asm-parisc/pci.h b/include/asm-parisc/pci.h
index ee741c150176..98d79a3d54fa 100644
--- a/include/asm-parisc/pci.h
+++ b/include/asm-parisc/pci.h
@@ -253,6 +253,10 @@ extern void
253pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, 253pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
254 struct resource *res); 254 struct resource *res);
255 255
256extern void
257pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
258 struct pci_bus_region *region);
259
256static inline void pcibios_add_platform_entries(struct pci_dev *dev) 260static inline void pcibios_add_platform_entries(struct pci_dev *dev)
257{ 261{
258} 262}
diff --git a/include/asm-ppc/pci.h b/include/asm-ppc/pci.h
index a13d55870e62..a811e440c978 100644
--- a/include/asm-ppc/pci.h
+++ b/include/asm-ppc/pci.h
@@ -105,6 +105,10 @@ extern void
105pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, 105pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
106 struct resource *res); 106 struct resource *res);
107 107
108extern void
109pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
110 struct pci_bus_region *region);
111
108extern void pcibios_add_platform_entries(struct pci_dev *dev); 112extern void pcibios_add_platform_entries(struct pci_dev *dev);
109 113
110struct file; 114struct file;
diff --git a/include/asm-ppc64/pci.h b/include/asm-ppc64/pci.h
index faa772223075..4d057452f59b 100644
--- a/include/asm-ppc64/pci.h
+++ b/include/asm-ppc64/pci.h
@@ -134,6 +134,10 @@ extern void
134pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, 134pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
135 struct resource *res); 135 struct resource *res);
136 136
137extern void
138pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
139 struct pci_bus_region *region);
140
137extern int 141extern int
138unmap_bus_range(struct pci_bus *bus); 142unmap_bus_range(struct pci_bus *bus);
139 143
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index e96a4306ab3b..1cb4935348d8 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -46,10 +46,8 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
46/* 46/*
47 * fsnotify_unlink - file was unlinked 47 * fsnotify_unlink - file was unlinked
48 */ 48 */
49static inline void fsnotify_unlink(struct dentry *dentry, struct inode *dir) 49static inline void fsnotify_unlink(struct dentry *dentry, struct inode *inode, struct inode *dir)
50{ 50{
51 struct inode *inode = dentry->d_inode;
52
53 inode_dir_notify(dir, DN_DELETE); 51 inode_dir_notify(dir, DN_DELETE);
54 inotify_inode_queue_event(dir, IN_DELETE, 0, dentry->d_name.name); 52 inotify_inode_queue_event(dir, IN_DELETE, 0, dentry->d_name.name);
55 inotify_inode_queue_event(inode, IN_DELETE_SELF, 0, NULL); 53 inotify_inode_queue_event(inode, IN_DELETE_SELF, 0, NULL);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 8621cf42b46f..98bdd95fcee9 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -225,6 +225,7 @@
225#define PCI_PM_CAP_PME_D3cold 0x8000 /* PME# from D3 (cold) */ 225#define PCI_PM_CAP_PME_D3cold 0x8000 /* PME# from D3 (cold) */
226#define PCI_PM_CTRL 4 /* PM control and status register */ 226#define PCI_PM_CTRL 4 /* PM control and status register */
227#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */ 227#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */
228#define PCI_PM_CTRL_NO_SOFT_RESET 0x0004 /* No reset for D3hot->D0 */
228#define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */ 229#define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */
229#define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */ 230#define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */
230#define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */ 231#define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */
@@ -816,7 +817,9 @@ int pci_set_mwi(struct pci_dev *dev);
816void pci_clear_mwi(struct pci_dev *dev); 817void pci_clear_mwi(struct pci_dev *dev);
817int pci_set_dma_mask(struct pci_dev *dev, u64 mask); 818int pci_set_dma_mask(struct pci_dev *dev, u64 mask);
818int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); 819int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask);
820void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno);
819int pci_assign_resource(struct pci_dev *dev, int i); 821int pci_assign_resource(struct pci_dev *dev, int i);
822void pci_restore_bars(struct pci_dev *dev);
820 823
821/* ROM control related routines */ 824/* ROM control related routines */
822void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size); 825void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size);
diff --git a/mm/mmap.c b/mm/mmap.c
index da3fa90a0aae..404319477e71 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -143,7 +143,11 @@ int __vm_enough_memory(long pages, int cap_sys_admin)
143 leave 3% of the size of this process for other processes */ 143 leave 3% of the size of this process for other processes */
144 allowed -= current->mm->total_vm / 32; 144 allowed -= current->mm->total_vm / 32;
145 145
146 if (atomic_read(&vm_committed_space) < allowed) 146 /*
147 * cast `allowed' as a signed long because vm_committed_space
148 * sometimes has a negative value
149 */
150 if (atomic_read(&vm_committed_space) < (long)allowed)
147 return 0; 151 return 0;
148 152
149 vm_unacct_memory(pages); 153 vm_unacct_memory(pages);
diff --git a/mm/nommu.c b/mm/nommu.c
index ce74452c02d9..fd4e8df0f02d 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1167,7 +1167,11 @@ int __vm_enough_memory(long pages, int cap_sys_admin)
1167 leave 3% of the size of this process for other processes */ 1167 leave 3% of the size of this process for other processes */
1168 allowed -= current->mm->total_vm / 32; 1168 allowed -= current->mm->total_vm / 32;
1169 1169
1170 if (atomic_read(&vm_committed_space) < allowed) 1170 /*
1171 * cast `allowed' as a signed long because vm_committed_space
1172 * sometimes has a negative value
1173 */
1174 if (atomic_read(&vm_committed_space) < (long)allowed)
1171 return 0; 1175 return 0;
1172 1176
1173 vm_unacct_memory(pages); 1177 vm_unacct_memory(pages);
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index e3f8ea1bfa9c..7d076f0db100 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -403,11 +403,9 @@ static void tcp_queue_skb(struct sock *sk, struct sk_buff *skb)
403 sk->sk_send_head = skb; 403 sk->sk_send_head = skb;
404} 404}
405 405
406static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb) 406static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb, unsigned int mss_now)
407{ 407{
408 struct tcp_sock *tp = tcp_sk(sk); 408 if (skb->len <= mss_now ||
409
410 if (skb->len <= tp->mss_cache ||
411 !(sk->sk_route_caps & NETIF_F_TSO)) { 409 !(sk->sk_route_caps & NETIF_F_TSO)) {
412 /* Avoid the costly divide in the normal 410 /* Avoid the costly divide in the normal
413 * non-TSO case. 411 * non-TSO case.
@@ -417,10 +415,10 @@ static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb)
417 } else { 415 } else {
418 unsigned int factor; 416 unsigned int factor;
419 417
420 factor = skb->len + (tp->mss_cache - 1); 418 factor = skb->len + (mss_now - 1);
421 factor /= tp->mss_cache; 419 factor /= mss_now;
422 skb_shinfo(skb)->tso_segs = factor; 420 skb_shinfo(skb)->tso_segs = factor;
423 skb_shinfo(skb)->tso_size = tp->mss_cache; 421 skb_shinfo(skb)->tso_size = mss_now;
424 } 422 }
425} 423}
426 424
@@ -429,7 +427,7 @@ static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb)
429 * packet to the list. This won't be called frequently, I hope. 427 * packet to the list. This won't be called frequently, I hope.
430 * Remember, these are still headerless SKBs at this point. 428 * Remember, these are still headerless SKBs at this point.
431 */ 429 */
432static int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len) 430static int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss_now)
433{ 431{
434 struct tcp_sock *tp = tcp_sk(sk); 432 struct tcp_sock *tp = tcp_sk(sk);
435 struct sk_buff *buff; 433 struct sk_buff *buff;
@@ -492,8 +490,8 @@ static int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len)
492 } 490 }
493 491
494 /* Fix up tso_factor for both original and new SKB. */ 492 /* Fix up tso_factor for both original and new SKB. */
495 tcp_set_skb_tso_segs(sk, skb); 493 tcp_set_skb_tso_segs(sk, skb, mss_now);
496 tcp_set_skb_tso_segs(sk, buff); 494 tcp_set_skb_tso_segs(sk, buff, mss_now);
497 495
498 if (TCP_SKB_CB(skb)->sacked & TCPCB_LOST) { 496 if (TCP_SKB_CB(skb)->sacked & TCPCB_LOST) {
499 tp->lost_out += tcp_skb_pcount(skb); 497 tp->lost_out += tcp_skb_pcount(skb);
@@ -569,7 +567,7 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len)
569 * factor and mss. 567 * factor and mss.
570 */ 568 */
571 if (tcp_skb_pcount(skb) > 1) 569 if (tcp_skb_pcount(skb) > 1)
572 tcp_set_skb_tso_segs(sk, skb); 570 tcp_set_skb_tso_segs(sk, skb, tcp_current_mss(sk, 1));
573 571
574 return 0; 572 return 0;
575} 573}
@@ -734,12 +732,14 @@ static inline unsigned int tcp_cwnd_test(struct tcp_sock *tp, struct sk_buff *sk
734/* This must be invoked the first time we consider transmitting 732/* This must be invoked the first time we consider transmitting
735 * SKB onto the wire. 733 * SKB onto the wire.
736 */ 734 */
737static inline int tcp_init_tso_segs(struct sock *sk, struct sk_buff *skb) 735static inline int tcp_init_tso_segs(struct sock *sk, struct sk_buff *skb, unsigned int mss_now)
738{ 736{
739 int tso_segs = tcp_skb_pcount(skb); 737 int tso_segs = tcp_skb_pcount(skb);
740 738
741 if (!tso_segs) { 739 if (!tso_segs ||
742 tcp_set_skb_tso_segs(sk, skb); 740 (tso_segs > 1 &&
741 skb_shinfo(skb)->tso_size != mss_now)) {
742 tcp_set_skb_tso_segs(sk, skb, mss_now);
743 tso_segs = tcp_skb_pcount(skb); 743 tso_segs = tcp_skb_pcount(skb);
744 } 744 }
745 return tso_segs; 745 return tso_segs;
@@ -817,7 +817,7 @@ static unsigned int tcp_snd_test(struct sock *sk, struct sk_buff *skb,
817 struct tcp_sock *tp = tcp_sk(sk); 817 struct tcp_sock *tp = tcp_sk(sk);
818 unsigned int cwnd_quota; 818 unsigned int cwnd_quota;
819 819
820 tcp_init_tso_segs(sk, skb); 820 tcp_init_tso_segs(sk, skb, cur_mss);
821 821
822 if (!tcp_nagle_test(tp, skb, cur_mss, nonagle)) 822 if (!tcp_nagle_test(tp, skb, cur_mss, nonagle))
823 return 0; 823 return 0;
@@ -854,7 +854,7 @@ int tcp_may_send_now(struct sock *sk, struct tcp_sock *tp)
854 * know that all the data is in scatter-gather pages, and that the 854 * know that all the data is in scatter-gather pages, and that the
855 * packet has never been sent out before (and thus is not cloned). 855 * packet has never been sent out before (and thus is not cloned).
856 */ 856 */
857static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len) 857static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len, unsigned int mss_now)
858{ 858{
859 struct sk_buff *buff; 859 struct sk_buff *buff;
860 int nlen = skb->len - len; 860 int nlen = skb->len - len;
@@ -887,8 +887,8 @@ static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len)
887 skb_split(skb, buff, len); 887 skb_split(skb, buff, len);
888 888
889 /* Fix up tso_factor for both original and new SKB. */ 889 /* Fix up tso_factor for both original and new SKB. */
890 tcp_set_skb_tso_segs(sk, skb); 890 tcp_set_skb_tso_segs(sk, skb, mss_now);
891 tcp_set_skb_tso_segs(sk, buff); 891 tcp_set_skb_tso_segs(sk, buff, mss_now);
892 892
893 /* Link BUFF into the send queue. */ 893 /* Link BUFF into the send queue. */
894 skb_header_release(buff); 894 skb_header_release(buff);
@@ -972,19 +972,18 @@ static int tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle)
972 if (unlikely(sk->sk_state == TCP_CLOSE)) 972 if (unlikely(sk->sk_state == TCP_CLOSE))
973 return 0; 973 return 0;
974 974
975 skb = sk->sk_send_head;
976 if (unlikely(!skb))
977 return 0;
978
979 tso_segs = tcp_init_tso_segs(sk, skb);
980 cwnd_quota = tcp_cwnd_test(tp, skb);
981 if (unlikely(!cwnd_quota))
982 goto out;
983
984 sent_pkts = 0; 975 sent_pkts = 0;
985 while (likely(tcp_snd_wnd_test(tp, skb, mss_now))) { 976 while ((skb = sk->sk_send_head)) {
977 tso_segs = tcp_init_tso_segs(sk, skb, mss_now);
986 BUG_ON(!tso_segs); 978 BUG_ON(!tso_segs);
987 979
980 cwnd_quota = tcp_cwnd_test(tp, skb);
981 if (!cwnd_quota)
982 break;
983
984 if (unlikely(!tcp_snd_wnd_test(tp, skb, mss_now)))
985 break;
986
988 if (tso_segs == 1) { 987 if (tso_segs == 1) {
989 if (unlikely(!tcp_nagle_test(tp, skb, mss_now, 988 if (unlikely(!tcp_nagle_test(tp, skb, mss_now,
990 (tcp_skb_is_last(sk, skb) ? 989 (tcp_skb_is_last(sk, skb) ?
@@ -1006,11 +1005,11 @@ static int tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle)
1006 limit = skb->len - trim; 1005 limit = skb->len - trim;
1007 } 1006 }
1008 if (skb->len > limit) { 1007 if (skb->len > limit) {
1009 if (tso_fragment(sk, skb, limit)) 1008 if (tso_fragment(sk, skb, limit, mss_now))
1010 break; 1009 break;
1011 } 1010 }
1012 } else if (unlikely(skb->len > mss_now)) { 1011 } else if (unlikely(skb->len > mss_now)) {
1013 if (unlikely(tcp_fragment(sk, skb, mss_now))) 1012 if (unlikely(tcp_fragment(sk, skb, mss_now, mss_now)))
1014 break; 1013 break;
1015 } 1014 }
1016 1015
@@ -1026,27 +1025,12 @@ static int tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle)
1026 1025
1027 tcp_minshall_update(tp, mss_now, skb); 1026 tcp_minshall_update(tp, mss_now, skb);
1028 sent_pkts++; 1027 sent_pkts++;
1029
1030 /* Do not optimize this to use tso_segs. If we chopped up
1031 * the packet above, tso_segs will no longer be valid.
1032 */
1033 cwnd_quota -= tcp_skb_pcount(skb);
1034
1035 BUG_ON(cwnd_quota < 0);
1036 if (!cwnd_quota)
1037 break;
1038
1039 skb = sk->sk_send_head;
1040 if (!skb)
1041 break;
1042 tso_segs = tcp_init_tso_segs(sk, skb);
1043 } 1028 }
1044 1029
1045 if (likely(sent_pkts)) { 1030 if (likely(sent_pkts)) {
1046 tcp_cwnd_validate(sk, tp); 1031 tcp_cwnd_validate(sk, tp);
1047 return 0; 1032 return 0;
1048 } 1033 }
1049out:
1050 return !tp->packets_out && sk->sk_send_head; 1034 return !tp->packets_out && sk->sk_send_head;
1051} 1035}
1052 1036
@@ -1076,7 +1060,7 @@ void tcp_push_one(struct sock *sk, unsigned int mss_now)
1076 1060
1077 BUG_ON(!skb || skb->len < mss_now); 1061 BUG_ON(!skb || skb->len < mss_now);
1078 1062
1079 tso_segs = tcp_init_tso_segs(sk, skb); 1063 tso_segs = tcp_init_tso_segs(sk, skb, mss_now);
1080 cwnd_quota = tcp_snd_test(sk, skb, mss_now, TCP_NAGLE_PUSH); 1064 cwnd_quota = tcp_snd_test(sk, skb, mss_now, TCP_NAGLE_PUSH);
1081 1065
1082 if (likely(cwnd_quota)) { 1066 if (likely(cwnd_quota)) {
@@ -1093,11 +1077,11 @@ void tcp_push_one(struct sock *sk, unsigned int mss_now)
1093 limit = skb->len - trim; 1077 limit = skb->len - trim;
1094 } 1078 }
1095 if (skb->len > limit) { 1079 if (skb->len > limit) {
1096 if (unlikely(tso_fragment(sk, skb, limit))) 1080 if (unlikely(tso_fragment(sk, skb, limit, mss_now)))
1097 return; 1081 return;
1098 } 1082 }
1099 } else if (unlikely(skb->len > mss_now)) { 1083 } else if (unlikely(skb->len > mss_now)) {
1100 if (unlikely(tcp_fragment(sk, skb, mss_now))) 1084 if (unlikely(tcp_fragment(sk, skb, mss_now, mss_now)))
1101 return; 1085 return;
1102 } 1086 }
1103 1087
@@ -1388,7 +1372,7 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
1388 int old_factor = tcp_skb_pcount(skb); 1372 int old_factor = tcp_skb_pcount(skb);
1389 int new_factor; 1373 int new_factor;
1390 1374
1391 if (tcp_fragment(sk, skb, cur_mss)) 1375 if (tcp_fragment(sk, skb, cur_mss, cur_mss))
1392 return -ENOMEM; /* We'll try again later. */ 1376 return -ENOMEM; /* We'll try again later. */
1393 1377
1394 /* New SKB created, account for it. */ 1378 /* New SKB created, account for it. */
@@ -1991,7 +1975,7 @@ int tcp_write_wakeup(struct sock *sk)
1991 skb->len > mss) { 1975 skb->len > mss) {
1992 seg_size = min(seg_size, mss); 1976 seg_size = min(seg_size, mss);
1993 TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH; 1977 TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH;
1994 if (tcp_fragment(sk, skb, seg_size)) 1978 if (tcp_fragment(sk, skb, seg_size, mss))
1995 return -1; 1979 return -1;
1996 /* SWS override triggered forced fragmentation. 1980 /* SWS override triggered forced fragmentation.
1997 * Disable TSO, the connection is too sick. */ 1981 * Disable TSO, the connection is too sick. */
@@ -2000,7 +1984,7 @@ int tcp_write_wakeup(struct sock *sk)
2000 sk->sk_route_caps &= ~NETIF_F_TSO; 1984 sk->sk_route_caps &= ~NETIF_F_TSO;
2001 } 1985 }
2002 } else if (!tcp_skb_pcount(skb)) 1986 } else if (!tcp_skb_pcount(skb))
2003 tcp_set_skb_tso_segs(sk, skb); 1987 tcp_set_skb_tso_segs(sk, skb, mss);
2004 1988
2005 TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH; 1989 TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH;
2006 TCP_SKB_CB(skb)->when = tcp_time_stamp; 1990 TCP_SKB_CB(skb)->when = tcp_time_stamp;