diff options
Diffstat (limited to 'drivers/net/sfc/nic.c')
-rw-r--r-- | drivers/net/sfc/nic.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/drivers/net/sfc/nic.c b/drivers/net/sfc/nic.c index e8396614daf3..9b29a8d7c449 100644 --- a/drivers/net/sfc/nic.c +++ b/drivers/net/sfc/nic.c | |||
@@ -84,7 +84,8 @@ static inline void efx_write_buf_tbl(struct efx_nic *efx, efx_qword_t *value, | |||
84 | static inline efx_qword_t *efx_event(struct efx_channel *channel, | 84 | static inline efx_qword_t *efx_event(struct efx_channel *channel, |
85 | unsigned int index) | 85 | unsigned int index) |
86 | { | 86 | { |
87 | return ((efx_qword_t *) (channel->eventq.addr)) + index; | 87 | return ((efx_qword_t *) (channel->eventq.addr)) + |
88 | (index & channel->eventq_mask); | ||
88 | } | 89 | } |
89 | 90 | ||
90 | /* See if an event is present | 91 | /* See if an event is present |
@@ -673,7 +674,8 @@ void efx_nic_eventq_read_ack(struct efx_channel *channel) | |||
673 | efx_dword_t reg; | 674 | efx_dword_t reg; |
674 | struct efx_nic *efx = channel->efx; | 675 | struct efx_nic *efx = channel->efx; |
675 | 676 | ||
676 | EFX_POPULATE_DWORD_1(reg, FRF_AZ_EVQ_RPTR, channel->eventq_read_ptr); | 677 | EFX_POPULATE_DWORD_1(reg, FRF_AZ_EVQ_RPTR, |
678 | channel->eventq_read_ptr & channel->eventq_mask); | ||
677 | efx_writed_table(efx, ®, efx->type->evq_rptr_tbl_base, | 679 | efx_writed_table(efx, ®, efx->type->evq_rptr_tbl_base, |
678 | channel->channel); | 680 | channel->channel); |
679 | } | 681 | } |
@@ -908,7 +910,7 @@ efx_handle_generated_event(struct efx_channel *channel, efx_qword_t *event) | |||
908 | 910 | ||
909 | code = EFX_QWORD_FIELD(*event, FSF_AZ_DRV_GEN_EV_MAGIC); | 911 | code = EFX_QWORD_FIELD(*event, FSF_AZ_DRV_GEN_EV_MAGIC); |
910 | if (code == EFX_CHANNEL_MAGIC_TEST(channel)) | 912 | if (code == EFX_CHANNEL_MAGIC_TEST(channel)) |
911 | ++channel->magic_count; | 913 | ; /* ignore */ |
912 | else if (code == EFX_CHANNEL_MAGIC_FILL(channel)) | 914 | else if (code == EFX_CHANNEL_MAGIC_FILL(channel)) |
913 | /* The queue must be empty, so we won't receive any rx | 915 | /* The queue must be empty, so we won't receive any rx |
914 | * events, so efx_process_channel() won't refill the | 916 | * events, so efx_process_channel() won't refill the |
@@ -1015,8 +1017,7 @@ int efx_nic_process_eventq(struct efx_channel *channel, int budget) | |||
1015 | /* Clear this event by marking it all ones */ | 1017 | /* Clear this event by marking it all ones */ |
1016 | EFX_SET_QWORD(*p_event); | 1018 | EFX_SET_QWORD(*p_event); |
1017 | 1019 | ||
1018 | /* Increment read pointer */ | 1020 | ++read_ptr; |
1019 | read_ptr = (read_ptr + 1) & channel->eventq_mask; | ||
1020 | 1021 | ||
1021 | ev_code = EFX_QWORD_FIELD(event, FSF_AZ_EV_CODE); | 1022 | ev_code = EFX_QWORD_FIELD(event, FSF_AZ_EV_CODE); |
1022 | 1023 | ||
@@ -1060,6 +1061,13 @@ out: | |||
1060 | return spent; | 1061 | return spent; |
1061 | } | 1062 | } |
1062 | 1063 | ||
1064 | /* Check whether an event is present in the eventq at the current | ||
1065 | * read pointer. Only useful for self-test. | ||
1066 | */ | ||
1067 | bool efx_nic_event_present(struct efx_channel *channel) | ||
1068 | { | ||
1069 | return efx_event_present(efx_event(channel, channel->eventq_read_ptr)); | ||
1070 | } | ||
1063 | 1071 | ||
1064 | /* Allocate buffer table entries for event queue */ | 1072 | /* Allocate buffer table entries for event queue */ |
1065 | int efx_nic_probe_eventq(struct efx_channel *channel) | 1073 | int efx_nic_probe_eventq(struct efx_channel *channel) |
@@ -1165,7 +1173,7 @@ static void efx_poll_flush_events(struct efx_nic *efx) | |||
1165 | struct efx_tx_queue *tx_queue; | 1173 | struct efx_tx_queue *tx_queue; |
1166 | struct efx_rx_queue *rx_queue; | 1174 | struct efx_rx_queue *rx_queue; |
1167 | unsigned int read_ptr = channel->eventq_read_ptr; | 1175 | unsigned int read_ptr = channel->eventq_read_ptr; |
1168 | unsigned int end_ptr = (read_ptr - 1) & channel->eventq_mask; | 1176 | unsigned int end_ptr = read_ptr + channel->eventq_mask - 1; |
1169 | 1177 | ||
1170 | do { | 1178 | do { |
1171 | efx_qword_t *event = efx_event(channel, read_ptr); | 1179 | efx_qword_t *event = efx_event(channel, read_ptr); |
@@ -1205,7 +1213,7 @@ static void efx_poll_flush_events(struct efx_nic *efx) | |||
1205 | * it's ok to throw away every non-flush event */ | 1213 | * it's ok to throw away every non-flush event */ |
1206 | EFX_SET_QWORD(*event); | 1214 | EFX_SET_QWORD(*event); |
1207 | 1215 | ||
1208 | read_ptr = (read_ptr + 1) & channel->eventq_mask; | 1216 | ++read_ptr; |
1209 | } while (read_ptr != end_ptr); | 1217 | } while (read_ptr != end_ptr); |
1210 | 1218 | ||
1211 | channel->eventq_read_ptr = read_ptr; | 1219 | channel->eventq_read_ptr = read_ptr; |
@@ -1929,6 +1937,13 @@ void efx_nic_get_regs(struct efx_nic *efx, void *buf) | |||
1929 | 1937 | ||
1930 | size = min_t(size_t, table->step, 16); | 1938 | size = min_t(size_t, table->step, 16); |
1931 | 1939 | ||
1940 | if (table->offset >= efx->type->mem_map_size) { | ||
1941 | /* No longer mapped; return dummy data */ | ||
1942 | memcpy(buf, "\xde\xc0\xad\xde", 4); | ||
1943 | buf += table->rows * size; | ||
1944 | continue; | ||
1945 | } | ||
1946 | |||
1932 | for (i = 0; i < table->rows; i++) { | 1947 | for (i = 0; i < table->rows; i++) { |
1933 | switch (table->step) { | 1948 | switch (table->step) { |
1934 | case 4: /* 32-bit register or SRAM */ | 1949 | case 4: /* 32-bit register or SRAM */ |