Page MenuHomeFreeBSD

D59852.1795977522.diff
No OneTemporary

Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None

D59852.1795977522.diff

diff --git a/sys/dev/aq/aq_hw.h b/sys/dev/aq/aq_hw.h
--- a/sys/dev/aq/aq_hw.h
+++ b/sys/dev/aq/aq_hw.h
@@ -408,6 +408,8 @@
int aq_hw_err_from_flags(struct aq_hw *hw);
+int aq_hw_invalidate_descriptor_cache(struct aq_hw *hw);
+
int hw_atl_b0_hw_vlan_promisc_set(struct aq_hw *hw, bool promisc);
int hw_atl_b0_hw_vlan_set(struct aq_hw *hw,
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
@@ -58,6 +58,31 @@
return (0);
}
+int
+aq_hw_invalidate_descriptor_cache(struct aq_hw *hw)
+{
+ int error;
+
+ /* Atlantic A0 does not implement this stop workaround. */
+ if (IS_CHIP_FEATURE(hw, REVISION_A0))
+ return (0);
+
+ /*
+ * Cached Rx descriptors retain both descriptor and data addresses.
+ * Toggle the global cache invalidation only after every ring is down.
+ */
+ rdm_rx_dma_desc_cache_init_tgl(hw);
+ error = aq_hw_err_from_flags(hw);
+ if (error != 0)
+ return (error);
+
+ error = AQ_HW_WAIT_FOR(rdm_rx_dma_desc_cache_init_done_get(hw) != 0,
+ 1000, 10);
+ if (error != 0)
+ return (error);
+ return (aq_hw_err_from_flags(hw));
+}
+
inline uint32_t
aq_hw_read_reg(struct aq_hw *hw, uint32_t reg)
{
diff --git a/sys/dev/aq/aq_hw_llh.h b/sys/dev/aq/aq_hw_llh.h
--- a/sys/dev/aq/aq_hw_llh.h
+++ b/sys/dev/aq/aq_hw_llh.h
@@ -934,6 +934,9 @@
/* toggle rdm rx dma descriptor cache init */
void rdm_rx_dma_desc_cache_init_tgl(struct aq_hw *aq_hw);
+/* get rdm rx dma descriptor cache init done */
+uint32_t rdm_rx_dma_desc_cache_init_done_get(struct aq_hw *aq_hw);
+
/* set tx path pad insert enable */
void tpb_tx_path_scp_ins_en_set(struct aq_hw *aq_hw,
uint32_t tx_path_scp_ins_en);
diff --git a/sys/dev/aq/aq_hw_llh.c b/sys/dev/aq/aq_hw_llh.c
--- a/sys/dev/aq/aq_hw_llh.c
+++ b/sys/dev/aq/aq_hw_llh.c
@@ -1728,6 +1728,15 @@
);
}
+uint32_t
+rdm_rx_dma_desc_cache_init_done_get(struct aq_hw *aq_hw)
+{
+ return (AQ_READ_REG_BIT(aq_hw,
+ rdm_rx_dma_desc_cache_init_done_adr,
+ rdm_rx_dma_desc_cache_init_done_msk,
+ rdm_rx_dma_desc_cache_init_done_shift));
+}
+
void
tpb_tx_pkt_buff_size_per_tc_set(struct aq_hw *aq_hw,
uint32_t tx_pkt_buff_size_per_tc, uint32_t buffer)
diff --git a/sys/dev/aq/aq_hw_llh_internal.h b/sys/dev/aq/aq_hw_llh_internal.h
--- a/sys/dev/aq/aq_hw_llh_internal.h
+++ b/sys/dev/aq/aq_hw_llh_internal.h
@@ -395,6 +395,11 @@
/* default value of bitfield rdm_desc_init_i */
#define rdm_rx_dma_desc_cache_init_defaulT 0x0
+/* rdm_desc_init_done_i bitfield definitions */
+#define rdm_rx_dma_desc_cache_init_done_adr 0x00005a10
+#define rdm_rx_dma_desc_cache_init_done_msk 0x00000001
+#define rdm_rx_dma_desc_cache_init_done_shift 0
+
/* rx int_desc_wrb_en bitfield definitions
* preprocessor definitions for the bitfield "int_desc_wrb_en".
* port="pif_rdm_int_desc_wrb_en_i"
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
@@ -873,6 +873,10 @@
"could not stop RX ring %d\n", i);
}
+ if (aq_hw_invalidate_descriptor_cache(hw) != 0)
+ device_printf(softc->dev,
+ "could not invalidate the RX descriptor cache\n");
+
if (aq_hw_reset(&softc->hw, true) != 0)
device_printf(softc->dev, "could not reset the MAC on stop\n");
memset(&softc->last_stats, 0, sizeof(softc->last_stats));
diff --git a/sys/dev/aq/aq_ring.c b/sys/dev/aq/aq_ring.c
--- a/sys/dev/aq/aq_ring.c
+++ b/sys/dev/aq/aq_ring.c
@@ -208,10 +208,6 @@
AQ_DBG_ENTERA("[%d]", ring->index);
rdm_rx_desc_en_set(hw, 0U, ring->index);
- /* Invalidate Descriptor Cache to prevent writing to the cached
- * descriptors and to the data pointer of those descriptors
- */
- rdm_rx_dma_desc_cache_init_tgl(hw);
err = aq_hw_err_from_flags(hw);
AQ_DBG_EXIT(err);
return (err);

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 29, 6:38 PM (11 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42094451
Default Alt Text
D59852.1795977522.diff (3 KB)

Event Timeline