Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F162216684
D58138.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D58138.diff
View Options
diff --git a/sys/dev/aq/aq_common.h b/sys/dev/aq/aq_common.h
--- a/sys/dev/aq/aq_common.h
+++ b/sys/dev/aq/aq_common.h
@@ -42,9 +42,10 @@
#define AQ_HW_WAIT_FOR(_B_, _US_, _N_) ({ \
unsigned int _i; \
- for (_i = (_N_); !(_B_) && _i; --_i) \
+ int _b; \
+ for (_i = (_N_); !(_b = (_B_)) && _i; --_i) \
DELAY(_US_); \
- (_i == 0) ? ETIMEDOUT : 0; \
+ _b ? 0 : ETIMEDOUT; \
})
diff --git a/sys/dev/aq/aq_fw.c b/sys/dev/aq/aq_fw.c
--- a/sys/dev/aq/aq_fw.c
+++ b/sys/dev/aq/aq_fw.c
@@ -306,6 +306,10 @@
reg_glb_cpu_no_reset_scratchpad_set(hw, 0xDEAD,
NO_RESET_SCRATCHPAD_RBL_STATUS);
+ /* Clear a stale flash burst so the global reset frees the SPI bus. */
+ uint32_t spi = AQ_READ_REG(hw, 0x53c);
+ AQ_WRITE_REG(hw, 0x53c, spi | 0x10);
+
// Global software reset
rx_rx_reg_res_dis_set(hw, 0);
tx_tx_reg_res_dis_set(hw, 0);
diff --git a/sys/dev/aq/aq_hw.c b/sys/dev/aq/aq_hw.c
--- a/sys/dev/aq/aq_hw.c
+++ b/sys/dev/aq/aq_hw.c
@@ -253,6 +253,10 @@
enum aq_fw_link_speed speed = aq_fw_none;
enum aq_fw_link_fc fc;
+ *link_speed = 0;
+ fc_neg->fc_rx = false;
+ fc_neg->fc_tx = false;
+
err = hw->fw_ops->get_mode(hw, &mode, &speed, &fc);
if (err != 0) {
@@ -260,7 +264,6 @@
AQ_DBG_EXIT(err);
return (err);
}
- *link_speed = 0;
if (mode != MPI_INIT)
return (0);
@@ -376,7 +379,9 @@
goto err_exit;
}
- hw->fw_ops->reset(hw);
+ err = hw->fw_ops->reset(hw);
+ if (err != 0)
+ goto err_exit;
err = aq_hw_err_from_flags(hw);
@@ -644,8 +649,12 @@
*/
AQ_WRITE_REG(hw, AQ_HW_TX_DMA_TOTAL_REQ_LIMIT_ADR, 24);
- aq_hw_init_tx_path(hw);
- aq_hw_init_rx_path(hw);
+ err = aq_hw_init_tx_path(hw);
+ if (err != 0)
+ goto err_exit;
+ err = aq_hw_init_rx_path(hw);
+ if (err != 0)
+ goto err_exit;
aq_hw_mac_addr_set(hw, mac_addr, AQ_HW_MAC);
diff --git a/sys/dev/aq/aq_main.c b/sys/dev/aq/aq_main.c
--- a/sys/dev/aq/aq_main.c
+++ b/sys/dev/aq/aq_main.c
@@ -480,7 +480,7 @@
aq_hw_deinit(&softc->hw);
- for (i = 0; i < softc->scctx->isc_nrxqsets; i++)
+ for (i = 0; i < softc->rx_rings_count; i++)
iflib_irq_free(ctx, &softc->rx_rings[i]->irq);
iflib_irq_free(ctx, &softc->irq);
@@ -1024,7 +1024,6 @@
if (rc) {
device_printf(softc->dev, "failed to set up RX handler\n");
- i--;
goto fail;
}
@@ -1052,15 +1051,12 @@
if (rc) {
device_printf(iflib_get_dev(ctx),
"Failed to register admin handler");
- i = softc->rx_rings_count - 1;
goto fail;
}
AQ_DBG_EXIT(0);
return (0);
fail:
- for (; i >= 0; i--)
- iflib_irq_free(ctx, &softc->rx_rings[i]->irq);
AQ_DBG_EXIT(rc);
return (rc);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jul 11, 11:45 PM (4 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34979879
Default Alt Text
D58138.diff (2 KB)
Attached To
Mode
D58138: aq(4): harden the attach, detach, and reset error paths
Attached
Detach File
Event Timeline
Log In to Comment