···328 * processing to finish, then directly poll (and ack ) the eventq.329 * Finally reenable NAPI and interrupts.330 *331- * Since we are touching interrupts the caller should hold the suspend lock0332 */333void efx_process_channel_now(struct efx_channel *channel)334{···337338 BUG_ON(channel->channel >= efx->n_channels);339 BUG_ON(!channel->enabled);0340341 /* Disable interrupts and wait for ISRs to complete */342 efx_nic_disable_interrupts(efx);···1438 * restart the transmit interface early so the watchdog timer stops */1439 efx_start_port(efx);14401441- if (efx_dev_registered(efx))1442 netif_tx_wake_all_queues(efx->net_dev);14431444 efx_for_each_channel(channel, efx)
···328 * processing to finish, then directly poll (and ack ) the eventq.329 * Finally reenable NAPI and interrupts.330 *331+ * This is for use only during a loopback self-test. It must not332+ * deliver any packets up the stack as this can result in deadlock.333 */334void efx_process_channel_now(struct efx_channel *channel)335{···336337 BUG_ON(channel->channel >= efx->n_channels);338 BUG_ON(!channel->enabled);339+ BUG_ON(!efx->loopback_selftest);340341 /* Disable interrupts and wait for ISRs to complete */342 efx_nic_disable_interrupts(efx);···1436 * restart the transmit interface early so the watchdog timer stops */1437 efx_start_port(efx);14381439+ if (efx_dev_registered(efx) && !efx->port_inhibited)1440 netif_tx_wake_all_queues(efx->net_dev);14411442 efx_for_each_channel(channel, efx)
···330 * @eventq_mask: Event queue pointer mask331 * @eventq_read_ptr: Event queue read pointer332 * @last_eventq_read_ptr: Last event queue read pointer value.333- * @magic_count: Event queue test event count334 * @irq_count: Number of IRQs since last adaptive moderation decision335 * @irq_mod_score: IRQ moderation score336 * @rx_alloc_level: Watermark based heuristic counter for pushing descriptors···359 unsigned int eventq_mask;360 unsigned int eventq_read_ptr;361 unsigned int last_eventq_read_ptr;362- unsigned int magic_count;363364 unsigned int irq_count;365 unsigned int irq_mod_score;
···330 * @eventq_mask: Event queue pointer mask331 * @eventq_read_ptr: Event queue read pointer332 * @last_eventq_read_ptr: Last event queue read pointer value.0333 * @irq_count: Number of IRQs since last adaptive moderation decision334 * @irq_mod_score: IRQ moderation score335 * @rx_alloc_level: Watermark based heuristic counter for pushing descriptors···360 unsigned int eventq_mask;361 unsigned int eventq_read_ptr;362 unsigned int last_eventq_read_ptr;0363364 unsigned int irq_count;365 unsigned int irq_mod_score;
+15-7
drivers/net/sfc/nic.c
···84static inline efx_qword_t *efx_event(struct efx_channel *channel,85 unsigned int index)86{87- return ((efx_qword_t *) (channel->eventq.addr)) + index;088}8990/* See if an event is present···674 efx_dword_t reg;675 struct efx_nic *efx = channel->efx;676677- EFX_POPULATE_DWORD_1(reg, FRF_AZ_EVQ_RPTR, channel->eventq_read_ptr);0678 efx_writed_table(efx, ®, efx->type->evq_rptr_tbl_base,679 channel->channel);680}···910911 code = EFX_QWORD_FIELD(*event, FSF_AZ_DRV_GEN_EV_MAGIC);912 if (code == EFX_CHANNEL_MAGIC_TEST(channel))913- ++channel->magic_count;914 else if (code == EFX_CHANNEL_MAGIC_FILL(channel))915 /* The queue must be empty, so we won't receive any rx916 * events, so efx_process_channel() won't refill the···1017 /* Clear this event by marking it all ones */1018 EFX_SET_QWORD(*p_event);10191020- /* Increment read pointer */1021- read_ptr = (read_ptr + 1) & channel->eventq_mask;10221023 ev_code = EFX_QWORD_FIELD(event, FSF_AZ_EV_CODE);1024···1061 return spent;1062}1063000000010641065/* Allocate buffer table entries for event queue */1066int efx_nic_probe_eventq(struct efx_channel *channel)···1173 struct efx_tx_queue *tx_queue;1174 struct efx_rx_queue *rx_queue;1175 unsigned int read_ptr = channel->eventq_read_ptr;1176- unsigned int end_ptr = (read_ptr - 1) & channel->eventq_mask;11771178 do {1179 efx_qword_t *event = efx_event(channel, read_ptr);···1213 * it's ok to throw away every non-flush event */1214 EFX_SET_QWORD(*event);12151216- read_ptr = (read_ptr + 1) & channel->eventq_mask;1217 } while (read_ptr != end_ptr);12181219 channel->eventq_read_ptr = read_ptr;
···84static inline efx_qword_t *efx_event(struct efx_channel *channel,85 unsigned int index)86{87+ return ((efx_qword_t *) (channel->eventq.addr)) +88+ (index & channel->eventq_mask);89}9091/* See if an event is present···673 efx_dword_t reg;674 struct efx_nic *efx = channel->efx;675676+ EFX_POPULATE_DWORD_1(reg, FRF_AZ_EVQ_RPTR,677+ channel->eventq_read_ptr & channel->eventq_mask);678 efx_writed_table(efx, ®, efx->type->evq_rptr_tbl_base,679 channel->channel);680}···908909 code = EFX_QWORD_FIELD(*event, FSF_AZ_DRV_GEN_EV_MAGIC);910 if (code == EFX_CHANNEL_MAGIC_TEST(channel))911+ ; /* ignore */912 else if (code == EFX_CHANNEL_MAGIC_FILL(channel))913 /* The queue must be empty, so we won't receive any rx914 * events, so efx_process_channel() won't refill the···1015 /* Clear this event by marking it all ones */1016 EFX_SET_QWORD(*p_event);10171018+ ++read_ptr;010191020 ev_code = EFX_QWORD_FIELD(event, FSF_AZ_EV_CODE);1021···1060 return spent;1061}10621063+/* Check whether an event is present in the eventq at the current1064+ * read pointer. Only useful for self-test.1065+ */1066+bool efx_nic_event_present(struct efx_channel *channel)1067+{1068+ return efx_event_present(efx_event(channel, channel->eventq_read_ptr));1069+}10701071/* Allocate buffer table entries for event queue */1072int efx_nic_probe_eventq(struct efx_channel *channel)···1165 struct efx_tx_queue *tx_queue;1166 struct efx_rx_queue *rx_queue;1167 unsigned int read_ptr = channel->eventq_read_ptr;1168+ unsigned int end_ptr = read_ptr + channel->eventq_mask - 1;11691170 do {1171 efx_qword_t *event = efx_event(channel, read_ptr);···1205 * it's ok to throw away every non-flush event */1206 EFX_SET_QWORD(*event);12071208+ ++read_ptr;1209 } while (read_ptr != end_ptr);12101211 channel->eventq_read_ptr = read_ptr;