]> git.openfabrics.org - ~emulex/infiniband.git/commit
net: fec: quiesce packet processing before changing features
authorRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 8 Jul 2014 11:40:33 +0000 (12:40 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Jul 2014 03:02:59 +0000 (20:02 -0700)
commit8506fa1d8eb36fbf96ab5e2a7e4b87826853f1be
tree2b3af7fd76f0ecf576552742ac272cd683adf415
parent9a7ba4381af4defa7834c73c8a015532c06f4e8e
net: fec: quiesce packet processing before changing features

Changing the features (receive checksumming) requires the hardware to be
reprogrammed, and also changes the checks in the receive packet
processing.

The current implementation has a race - fec_set_features() changes the
flags which alter the receive packet processing while the adapter is
active, and potentially receiving frames.  Only after we've modified
the software flag do we shutdown and reconfigure the hardware.

This can lead to packets being received and marked with a valid checksum
(via CHECKSUM_UNNECESSARY) when the hardware checksum validation has not
yet been enabled.

We must quiesce the device, then change the software configuration for
this feature, and then resume the device if it was previously running.

The resulting code structure also allows us to add other configuration
features in this path without having to quiesce and resume the network
interface and device.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/fec_main.c