Skip to content

Commit 43c3df0

Browse files
ecree-solarflaredavem330
authored andcommitted
sfc_ef100: functions for selftests
Self-tests for event and interrupt reception and NVRAM. Signed-off-by: Edward Cree <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b593b6f commit 43c3df0

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

drivers/net/ethernet/sfc/ef100_nic.c

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,50 @@ static int efx_ef100_get_phys_port_id(struct efx_nic *efx,
632632
return 0;
633633
}
634634

635+
static int efx_ef100_irq_test_generate(struct efx_nic *efx)
636+
{
637+
MCDI_DECLARE_BUF(inbuf, MC_CMD_TRIGGER_INTERRUPT_IN_LEN);
638+
639+
BUILD_BUG_ON(MC_CMD_TRIGGER_INTERRUPT_OUT_LEN != 0);
640+
641+
MCDI_SET_DWORD(inbuf, TRIGGER_INTERRUPT_IN_INTR_LEVEL, efx->irq_level);
642+
return efx_mcdi_rpc_quiet(efx, MC_CMD_TRIGGER_INTERRUPT,
643+
inbuf, sizeof(inbuf), NULL, 0, NULL);
644+
}
645+
646+
#define EFX_EF100_TEST 1
647+
648+
static void efx_ef100_ev_test_generate(struct efx_channel *channel)
649+
{
650+
MCDI_DECLARE_BUF(inbuf, MC_CMD_DRIVER_EVENT_IN_LEN);
651+
struct efx_nic *efx = channel->efx;
652+
efx_qword_t event;
653+
int rc;
654+
655+
EFX_POPULATE_QWORD_2(event,
656+
ESF_GZ_E_TYPE, ESE_GZ_EF100_EV_DRIVER,
657+
ESF_GZ_DRIVER_DATA, EFX_EF100_TEST);
658+
659+
MCDI_SET_DWORD(inbuf, DRIVER_EVENT_IN_EVQ, channel->channel);
660+
661+
/* MCDI_SET_QWORD is not appropriate here since EFX_POPULATE_* has
662+
* already swapped the data to little-endian order.
663+
*/
664+
memcpy(MCDI_PTR(inbuf, DRIVER_EVENT_IN_DATA), &event.u64[0],
665+
sizeof(efx_qword_t));
666+
667+
rc = efx_mcdi_rpc(efx, MC_CMD_DRIVER_EVENT, inbuf, sizeof(inbuf),
668+
NULL, 0, NULL);
669+
if (rc && (rc != -ENETDOWN))
670+
goto fail;
671+
672+
return;
673+
674+
fail:
675+
WARN_ON(true);
676+
netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
677+
}
678+
635679
static unsigned int ef100_check_caps(const struct efx_nic *efx,
636680
u8 flag, u32 offset)
637681
{
@@ -668,6 +712,7 @@ const struct efx_nic_type ef100_pf_nic_type = {
668712
.mcdi_poll_reboot = ef100_mcdi_poll_reboot,
669713
.mcdi_reboot_detected = ef100_mcdi_reboot_detected,
670714
.irq_enable_master = efx_port_dummy_op_void,
715+
.irq_test_generate = efx_ef100_irq_test_generate,
671716
.irq_disable_non_ev = efx_port_dummy_op_void,
672717
.push_irq_moderation = efx_channel_dummy_op_void,
673718
.min_interrupt_mode = EFX_INT_MODE_MSIX,
@@ -684,6 +729,7 @@ const struct efx_nic_type ef100_pf_nic_type = {
684729
.irq_handle_msi = ef100_msi_interrupt,
685730
.ev_process = ef100_ev_process,
686731
.ev_read_ack = ef100_ev_read_ack,
732+
.ev_test_generate = efx_ef100_ev_test_generate,
687733
.tx_probe = ef100_tx_probe,
688734
.tx_init = ef100_tx_init,
689735
.tx_write = ef100_tx_write,
@@ -722,6 +768,7 @@ const struct efx_nic_type ef100_pf_nic_type = {
722768
.rx_restore_rss_contexts = efx_mcdi_rx_restore_rss_contexts,
723769

724770
.reconfigure_mac = ef100_reconfigure_mac,
771+
.test_nvram = efx_new_mcdi_nvram_test_all,
725772
.describe_stats = ef100_describe_stats,
726773
.start_stats = efx_mcdi_mac_start_stats,
727774
.update_stats = ef100_update_stats,

0 commit comments

Comments
 (0)