aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/nic.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-04-19 03:21:33 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-19 03:21:33 -0400
commite1943424e43974f85b82bb31eaf832823bf49ce7 (patch)
tree00a2dda7454ba186c0be4bfb8d08b7f74c3cd98c /drivers/net/sfc/nic.c
parent88230fd586b4ccc5ffe6d6c2df8cdc495e89ad83 (diff)
parent0553c891fabd287726b41076cfd03fe7e5ab596f (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/bnx2x/bnx2x_ethtool.c
Diffstat (limited to 'drivers/net/sfc/nic.c')
-rw-r--r--drivers/net/sfc/nic.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/net/sfc/nic.c b/drivers/net/sfc/nic.c
index 2594f39c3ba..5ac9fa2cd3b 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,
84static inline efx_qword_t *efx_event(struct efx_channel *channel, 84static 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, &reg, efx->type->evq_rptr_tbl_base, 679 efx_writed_table(efx, &reg, efx->type->evq_rptr_tbl_base,
678 channel->channel); 680 channel->channel);
679} 681}
@@ -906,7 +908,7 @@ efx_handle_generated_event(struct efx_channel *channel, efx_qword_t *event)
906 908
907 code = EFX_QWORD_FIELD(*event, FSF_AZ_DRV_GEN_EV_MAGIC); 909 code = EFX_QWORD_FIELD(*event, FSF_AZ_DRV_GEN_EV_MAGIC);
908 if (code == EFX_CHANNEL_MAGIC_TEST(channel)) 910 if (code == EFX_CHANNEL_MAGIC_TEST(channel))
909 ++channel->magic_count; 911 ; /* ignore */
910 else if (code == EFX_CHANNEL_MAGIC_FILL(channel)) 912 else if (code == EFX_CHANNEL_MAGIC_FILL(channel))
911 /* The queue must be empty, so we won't receive any rx 913 /* The queue must be empty, so we won't receive any rx
912 * events, so efx_process_channel() won't refill the 914 * events, so efx_process_channel() won't refill the
@@ -1013,8 +1015,7 @@ int efx_nic_process_eventq(struct efx_channel *channel, int budget)
1013 /* Clear this event by marking it all ones */ 1015 /* Clear this event by marking it all ones */
1014 EFX_SET_QWORD(*p_event); 1016 EFX_SET_QWORD(*p_event);
1015 1017
1016 /* Increment read pointer */ 1018 ++read_ptr;
1017 read_ptr = (read_ptr + 1) & channel->eventq_mask;
1018 1019
1019 ev_code = EFX_QWORD_FIELD(event, FSF_AZ_EV_CODE); 1020 ev_code = EFX_QWORD_FIELD(event, FSF_AZ_EV_CODE);
1020 1021
@@ -1058,6 +1059,13 @@ out:
1058 return spent; 1059 return spent;
1059} 1060}
1060 1061
1062/* Check whether an event is present in the eventq at the current
1063 * read pointer. Only useful for self-test.
1064 */
1065bool efx_nic_event_present(struct efx_channel *channel)
1066{
1067 return efx_event_present(efx_event(channel, channel->eventq_read_ptr));
1068}
1061 1069
1062/* Allocate buffer table entries for event queue */ 1070/* Allocate buffer table entries for event queue */
1063int efx_nic_probe_eventq(struct efx_channel *channel) 1071int efx_nic_probe_eventq(struct efx_channel *channel)
@@ -1163,7 +1171,7 @@ static void efx_poll_flush_events(struct efx_nic *efx)
1163 struct efx_tx_queue *tx_queue; 1171 struct efx_tx_queue *tx_queue;
1164 struct efx_rx_queue *rx_queue; 1172 struct efx_rx_queue *rx_queue;
1165 unsigned int read_ptr = channel->eventq_read_ptr; 1173 unsigned int read_ptr = channel->eventq_read_ptr;
1166 unsigned int end_ptr = (read_ptr - 1) & channel->eventq_mask; 1174 unsigned int end_ptr = read_ptr + channel->eventq_mask - 1;
1167 1175
1168 do { 1176 do {
1169 efx_qword_t *event = efx_event(channel, read_ptr); 1177 efx_qword_t *event = efx_event(channel, read_ptr);
@@ -1203,7 +1211,7 @@ static void efx_poll_flush_events(struct efx_nic *efx)
1203 * it's ok to throw away every non-flush event */ 1211 * it's ok to throw away every non-flush event */
1204 EFX_SET_QWORD(*event); 1212 EFX_SET_QWORD(*event);
1205 1213
1206 read_ptr = (read_ptr + 1) & channel->eventq_mask; 1214 ++read_ptr;
1207 } while (read_ptr != end_ptr); 1215 } while (read_ptr != end_ptr);
1208 1216
1209 channel->eventq_read_ptr = read_ptr; 1217 channel->eventq_read_ptr = read_ptr;