firewire: core: don't update Broadcast_Channel if RFC 2734 conditions aren't met

This extra check will avoid Broadcast_Channel register related traffic
to many IIDC, SBP-2, and AV/C devices which aren't IRMC or have a
max_rec < 8 (i.e. support < 512 bytes async payload). This avoids a
little bit of traffic after bus reset and is even more careful with
devices which don't implement this CSR.

The assumption is that no other protocol than IP over 1394 uses the
broadcast channel for streams.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>

+19 -1
+17 -1
drivers/firewire/core-device.c
··· 580 581 kfree(old_rom); 582 ret = 0; 583 - device->cmc = rom[2] >> 30 & 1; 584 out: 585 kfree(rom); 586 ··· 843 if (!card->broadcast_channel_allocated) 844 return; 845 846 if (device->bc_implemented == BC_UNKNOWN) { 847 rcode = fw_run_transaction(card, TCODE_READ_QUADLET_REQUEST, 848 device->node_id, generation, device->max_speed,
··· 580 581 kfree(old_rom); 582 ret = 0; 583 + device->max_rec = rom[2] >> 12 & 0xf; 584 + device->cmc = rom[2] >> 30 & 1; 585 + device->irmc = rom[2] >> 31 & 1; 586 out: 587 kfree(rom); 588 ··· 841 if (!card->broadcast_channel_allocated) 842 return; 843 844 + /* 845 + * The Broadcast_Channel Valid bit is required by nodes which want to 846 + * transmit on this channel. Such transmissions are practically 847 + * exclusive to IP over 1394 (RFC 2734). IP capable nodes are required 848 + * to be IRM capable and have a max_rec of 8 or more. We use this fact 849 + * to narrow down to which nodes we send Broadcast_Channel updates. 850 + */ 851 + if (!device->irmc || device->max_rec < 8) 852 + return; 853 + 854 + /* 855 + * Some 1394-1995 nodes crash if this 1394a-2000 register is written. 856 + * Perform a read test first. 857 + */ 858 if (device->bc_implemented == BC_UNKNOWN) { 859 rcode = fw_run_transaction(card, TCODE_READ_QUADLET_REQUEST, 860 device->node_id, generation, device->max_speed,
+2
include/linux/firewire.h
··· 191 size_t config_rom_length; 192 int config_rom_retries; 193 unsigned is_local:1; 194 unsigned cmc:1; 195 unsigned bc_implemented:2; 196 197 struct delayed_work work;
··· 191 size_t config_rom_length; 192 int config_rom_retries; 193 unsigned is_local:1; 194 + unsigned max_rec:4; 195 unsigned cmc:1; 196 + unsigned irmc:1; 197 unsigned bc_implemented:2; 198 199 struct delayed_work work;