]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
sfc: fully reset if MC_REBOOT event received without warm_boot_count increment
authorDaniel Pieczko <dpieczko@solarflare.com>
Fri, 9 Oct 2015 09:40:35 +0000 (10:40 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 12 Oct 2015 12:35:25 +0000 (05:35 -0700)
On EF10, MC_CMD_VPORT_RECONFIGURE can cause a CODE_MC_REBOOT event
to be sent to a function without incrementing the (adapter-wide)
warm_boot_count.  In this case, the reboot is not detected by the
loop on efx_mcdi_poll_reboot(), so prepare for recovery from an MC
reboot anyway.  When this codepath is run, the MC has always just
rebooted, so this recovery is valid.

The loop on efx_mcdi_poll_reboot() is still required for other MC
reboot cases, so that actions in response to an MC reboot are
performed, such as clearing locally calculated statistics.
Siena NICs are unaffected by this change as the above scenario
does not apply.

Signed-off-by: Shradha Shah <sshah@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/sfc/ef10.c
drivers/net/ethernet/sfc/mcdi.c
drivers/net/ethernet/sfc/net_driver.h

index ff649ebef637409629ffd7623d754449b8ab9f1a..78b7b7bcae37c7dc83f14830b59f80e699102eb6 100644 (file)
@@ -1604,6 +1604,22 @@ efx_ef10_mcdi_read_response(struct efx_nic *efx, efx_dword_t *outbuf,
        memcpy(outbuf, pdu + offset, outlen);
 }
 
+static void efx_ef10_mcdi_reboot_detected(struct efx_nic *efx)
+{
+       struct efx_ef10_nic_data *nic_data = efx->nic_data;
+
+       /* All our allocations have been reset */
+       efx_ef10_reset_mc_allocations(efx);
+
+       /* The datapath firmware might have been changed */
+       nic_data->must_check_datapath_caps = true;
+
+       /* MAC statistics have been cleared on the NIC; clear the local
+        * statistic that we update with efx_update_diff_stat().
+        */
+       nic_data->stats[EF10_STAT_port_rx_bad_bytes] = 0;
+}
+
 static int efx_ef10_mcdi_poll_reboot(struct efx_nic *efx)
 {
        struct efx_ef10_nic_data *nic_data = efx->nic_data;
@@ -1623,17 +1639,7 @@ static int efx_ef10_mcdi_poll_reboot(struct efx_nic *efx)
                return 0;
 
        nic_data->warm_boot_count = rc;
-
-       /* All our allocations have been reset */
-       efx_ef10_reset_mc_allocations(efx);
-
-       /* The datapath firmware might have been changed */
-       nic_data->must_check_datapath_caps = true;
-
-       /* MAC statistics have been cleared on the NIC; clear the local
-        * statistic that we update with efx_update_diff_stat().
-        */
-       nic_data->stats[EF10_STAT_port_rx_bad_bytes] = 0;
+       efx_ef10_mcdi_reboot_detected(efx);
 
        return -EIO;
 }
@@ -4670,6 +4676,7 @@ const struct efx_nic_type efx_hunt_a0_vf_nic_type = {
        .mcdi_poll_response = efx_ef10_mcdi_poll_response,
        .mcdi_read_response = efx_ef10_mcdi_read_response,
        .mcdi_poll_reboot = efx_ef10_mcdi_poll_reboot,
+       .mcdi_reboot_detected = efx_ef10_mcdi_reboot_detected,
        .irq_enable_master = efx_port_dummy_op_void,
        .irq_test_generate = efx_ef10_irq_test_generate,
        .irq_disable_non_ev = efx_port_dummy_op_void,
@@ -4774,6 +4781,7 @@ const struct efx_nic_type efx_hunt_a0_nic_type = {
        .mcdi_poll_response = efx_ef10_mcdi_poll_response,
        .mcdi_read_response = efx_ef10_mcdi_read_response,
        .mcdi_poll_reboot = efx_ef10_mcdi_poll_reboot,
+       .mcdi_reboot_detected = efx_ef10_mcdi_reboot_detected,
        .irq_enable_master = efx_port_dummy_op_void,
        .irq_test_generate = efx_ef10_irq_test_generate,
        .irq_disable_non_ev = efx_port_dummy_op_void,
index 98d172b04f71815a1105b304ea5cadfa552687a2..d3f307e5c070f8d15538d260336b08d2a251e130 100644 (file)
@@ -1028,10 +1028,21 @@ static void efx_mcdi_ev_death(struct efx_nic *efx, int rc)
 
                /* Consume the status word since efx_mcdi_rpc_finish() won't */
                for (count = 0; count < MCDI_STATUS_DELAY_COUNT; ++count) {
-                       if (efx_mcdi_poll_reboot(efx))
+                       rc = efx_mcdi_poll_reboot(efx);
+                       if (rc)
                                break;
                        udelay(MCDI_STATUS_DELAY_US);
                }
+
+               /* On EF10, a CODE_MC_REBOOT event can be received without the
+                * reboot detection in efx_mcdi_poll_reboot() being triggered.
+                * If zero was returned from the final call to
+                * efx_mcdi_poll_reboot(), the MC reboot wasn't noticed but the
+                * MC has definitely rebooted so prepare for the reset.
+                */
+               if (!rc && efx->type->mcdi_reboot_detected)
+                       efx->type->mcdi_reboot_detected(efx);
+
                mcdi->new_epoch = true;
 
                /* Nobody was waiting for an MCDI request, so trigger a reset */
index c530e1c4cb4f1ef06155b93db8a10b4c77328da0..ad56231743a648e1bacdd31778ed009729a98a20 100644 (file)
@@ -1277,6 +1277,7 @@ struct efx_nic_type {
        void (*mcdi_read_response)(struct efx_nic *efx, efx_dword_t *pdu,
                                   size_t pdu_offset, size_t pdu_len);
        int (*mcdi_poll_reboot)(struct efx_nic *efx);
+       void (*mcdi_reboot_detected)(struct efx_nic *efx);
        void (*irq_enable_master)(struct efx_nic *efx);
        void (*irq_test_generate)(struct efx_nic *efx);
        void (*irq_disable_non_ev)(struct efx_nic *efx);