diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2008-09-01 07:44:59 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-09-03 09:53:42 -0400 |
commit | 60ac10658c2e234cf7bc27e0930e324c6c6fcf61 (patch) | |
tree | b16ee9efd385806755c6912492db43997c4f4b98 /drivers/net/sfc/selftest.c | |
parent | 26c086771a8ad0a1a72699674fa712fe6aeacb02 (diff) |
sfc: Use separate hardware TX queues to select checksum generation
Checksum generation is an attribute of our hardware TX queues, not TX
descriptors. We previously used a single queue and turned checksum
generation on or off as requested through ethtool. However, this can
result in regenerating checksums in raw packets that should not be
modified. We now create 2 hardware TX queues with checksum generation
on or off. They are presented to the net core as one queue since it
does not know how to select between them.
The self-test verifies that a bad checksum is unaltered on the queue
with checksum generation off.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/sfc/selftest.c')
-rw-r--r-- | drivers/net/sfc/selftest.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c index 3b2de9fe7f27..0a4778629178 100644 --- a/drivers/net/sfc/selftest.c +++ b/drivers/net/sfc/selftest.c | |||
@@ -63,6 +63,10 @@ struct efx_selftest_state { | |||
63 | int flush; | 63 | int flush; |
64 | int packet_count; | 64 | int packet_count; |
65 | struct sk_buff **skbs; | 65 | struct sk_buff **skbs; |
66 | |||
67 | /* Checksums are being offloaded */ | ||
68 | int offload_csum; | ||
69 | |||
66 | atomic_t rx_good; | 70 | atomic_t rx_good; |
67 | atomic_t rx_bad; | 71 | atomic_t rx_bad; |
68 | struct efx_loopback_payload payload; | 72 | struct efx_loopback_payload payload; |
@@ -292,8 +296,9 @@ void efx_loopback_rx_packet(struct efx_nic *efx, | |||
292 | 296 | ||
293 | received = (struct efx_loopback_payload *) buf_ptr; | 297 | received = (struct efx_loopback_payload *) buf_ptr; |
294 | received->ip.saddr = payload->ip.saddr; | 298 | received->ip.saddr = payload->ip.saddr; |
295 | received->ip.check = payload->ip.check; | 299 | if (state->offload_csum) |
296 | 300 | received->ip.check = payload->ip.check; | |
301 | |||
297 | /* Check that header exists */ | 302 | /* Check that header exists */ |
298 | if (pkt_len < sizeof(received->header)) { | 303 | if (pkt_len < sizeof(received->header)) { |
299 | EFX_ERR(efx, "saw runt RX packet (length %d) in %s loopback " | 304 | EFX_ERR(efx, "saw runt RX packet (length %d) in %s loopback " |
@@ -634,6 +639,8 @@ static int efx_test_loopbacks(struct efx_nic *efx, | |||
634 | 639 | ||
635 | /* Test every TX queue */ | 640 | /* Test every TX queue */ |
636 | efx_for_each_tx_queue(tx_queue, efx) { | 641 | efx_for_each_tx_queue(tx_queue, efx) { |
642 | state->offload_csum = (tx_queue->queue == | ||
643 | EFX_TX_QUEUE_OFFLOAD_CSUM); | ||
637 | rc |= efx_test_loopback(tx_queue, | 644 | rc |= efx_test_loopback(tx_queue, |
638 | &tests->loopback[mode]); | 645 | &tests->loopback[mode]); |
639 | if (rc) | 646 | if (rc) |