Skip to content

Commit 0555cb9

Browse files
peterhurleygregkh
authored andcommitted
staging/fwserial: Limit tx/rx to 1394-2008 spec maximum
Per this conversation https://lkml.org/lkml/2012/11/27/587 limit the maximum transmission to the IEEE 1394-2008 specification maximum size of 4096 bytes for asynchronous packets. Signed-off-by: Peter Hurley <[email protected]> Acked-by: Stefan Richter <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9929362 commit 0555cb9

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

drivers/staging/fwserial/TODO

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ TODOs
1212
1. This driver uses the same unregistered vendor id that the firewire core does
1313
(0xd00d1e). Perhaps this could be exposed as a define in
1414
firewire-constants.h?
15-
2. MAX_ASYNC_PAYLOAD needs to be publicly exposed by core/ohci
16-
- otherwise how will this driver know the max size of address window to
17-
open for one packet write?
1815
3. Maybe device_max_receive() and link_speed_to_max_payload() should be
1916
taken up by the firewire core?
2017
4. To avoid dropping rx data while still limiting the maximum buffering,

drivers/staging/fwserial/fwserial.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ static void dump_profile(struct seq_file *m, struct stats *stats)
179179
/* Returns the max receive packet size for the given card */
180180
static inline int device_max_receive(struct fw_device *fw_device)
181181
{
182-
return 1 << (clamp_t(int, fw_device->max_rec, 8U, 13U) + 1);
182+
return 1 << (clamp_t(int, fw_device->max_rec, 8U, 11U) + 1);
183183
}
184184

185185
static void fwtty_log_tx_error(struct fwtty_port *port, int rcode)

drivers/staging/fwserial/fwserial.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,10 @@ static inline void fwtty_bind_console(struct fwtty_port *port,
374374
*/
375375
static inline int link_speed_to_max_payload(unsigned speed)
376376
{
377-
static const int max_async[] = { 307, 614, 1229, 2458, 4916, 9832, };
378-
BUILD_BUG_ON(ARRAY_SIZE(max_async) - 1 != SCODE_3200);
377+
static const int max_async[] = { 307, 614, 1229, 2458, };
378+
BUILD_BUG_ON(ARRAY_SIZE(max_async) - 1 != SCODE_800);
379379

380-
speed = clamp(speed, (unsigned) SCODE_100, (unsigned) SCODE_3200);
380+
speed = clamp(speed, (unsigned) SCODE_100, (unsigned) SCODE_800);
381381
if (limit_bw)
382382
return max_async[speed];
383383
else

0 commit comments

Comments
 (0)