Page MenuHomeFreeBSD

D58436.id182609.diff
No OneTemporary

D58436.id182609.diff

diff --git a/sys/dev/aq/aq_dbg.h b/sys/dev/aq/aq_dbg.h
--- a/sys/dev/aq/aq_dbg.h
+++ b/sys/dev/aq/aq_dbg.h
@@ -150,11 +150,17 @@
#define trace_detail(_hw, _cat, _fmt, args...) \
aq_trace_base(_hw, lvl_detail, _cat, _fmt, ##args)
+#if AQ_CFG_DEBUG_LVL > 2
void trace_aq_tx_descr(struct aq_hw *hw, int ring_idx, unsigned int pointer,
volatile uint64_t descr[2]);
void trace_aq_rx_descr(struct aq_hw *hw, int ring_idx, unsigned int pointer,
volatile uint64_t descr[2]);
void trace_aq_tx_context_descr(struct aq_hw *hw, int ring_idx,
unsigned int pointer, volatile uint64_t descr[2]);
+#else
+#define trace_aq_tx_descr(...) ((void)0)
+#define trace_aq_rx_descr(...) ((void)0)
+#define trace_aq_tx_context_descr(...) ((void)0)
+#endif
#endif // AQ_DBG_H
diff --git a/sys/dev/aq/aq_dbg.c b/sys/dev/aq/aq_dbg.c
--- a/sys/dev/aq/aq_dbg.c
+++ b/sys/dev/aq/aq_dbg.c
@@ -50,6 +50,8 @@
(BIT(BIT_BEGIN - BIT_END + 1) -1))
#define __field(TYPE, VAR) TYPE VAR;
+
+#if AQ_CFG_DEBUG_LVL > 2
void
trace_aq_tx_descr(struct aq_hw *hw, int ring_idx, unsigned int pointer,
volatile uint64_t descr[2])
@@ -192,3 +194,4 @@
__entry->des_typ);
#endif
}
+#endif
diff --git a/sys/dev/aq/aq_device.h b/sys/dev/aq/aq_device.h
--- a/sys/dev/aq/aq_device.h
+++ b/sys/dev/aq/aq_device.h
@@ -92,24 +92,6 @@
uint64_t bbtc;
};
-enum aq_dev_state {
- AQ_DEV_STATE_UNLOAD,
- AQ_DEV_STATE_PCI_STOP,
- AQ_DEV_STATE_DOWN,
- AQ_DEV_STATE_UP,
-};
-
-struct aq_rx_filters {
- unsigned int rule_cnt;
- struct aq_rx_filter_vlan vlan_filters[AQ_HW_VLAN_MAX_FILTERS];
- struct aq_rx_filter_l2 etype_filters[AQ_HW_ETYPE_MAX_FILTERS];
-};
-
-struct aq_vlan_tag {
- SLIST_ENTRY(aq_vlan_tag) next;
- uint16_t tag;
-};
-
struct aq_dev {
device_t dev;
if_ctx_t ctx;
diff --git a/sys/dev/aq/aq_fw2x.c b/sys/dev/aq/aq_fw2x.c
--- a/sys/dev/aq/aq_fw2x.c
+++ b/sys/dev/aq/aq_fw2x.c
@@ -586,10 +586,7 @@
return (0);
}
-/*
- * Discover the PHY's MDIO port address (Clause-45 PRTAD) by scanning, as the
- * reference driver does; the address is strap-selectable and not fixed at 0.
- */
+/* Discover the PHY's MDIO port address; it is strap-selectable, not fixed at 0. */
static bool
aq_fw2x_init_phy_id(struct aq_hw* hw)
{
@@ -606,13 +603,7 @@
return (false);
}
-/*
- * A thermal shutdown latches inside the discrete PHY's own firmware
- * (1E.C850 == 0x8007) and a MAC reset alone cannot clear it. A PHY hard reset
- * (1E.2681.0, "equivalent to an external reset") returns the PHY to its boot
- * state; done while the MAC firmware is running, the MAC then reloads the PHY
- * firmware from flash and a subsequent interface cycle re-establishes the link.
- */
+/* PHY hard reset (1E.2681.0): clears a latched thermal shutdown a MAC reset cannot. */
static int
aq_fw2x_phy_reset(struct aq_hw* hw)
{
@@ -623,11 +614,7 @@
return (0);
}
-/*
- * The discrete PHY ships with autonomous thermal shutdown disabled
- * (1E.C478.A == 0); a PHY reset returns it to that default, so this is
- * re-run on every interface init.
- */
+/* Arm autonomous thermal shutdown (1E.C478.A), cleared by any PHY reset. */
static int
aq_fw2x_thermal_arm(struct aq_hw* hw)
{
diff --git a/sys/dev/aq/aq_irq.c b/sys/dev/aq/aq_irq.c
--- a/sys/dev/aq/aq_irq.c
+++ b/sys/dev/aq/aq_irq.c
@@ -118,10 +118,7 @@
#define AQ_THERMAL_RECOVER_MC 90000 /* fallback when the limit is unreadable */
#define AQ_THERMAL_SETTLE_POLLS 5 /* ~5 s for the PHY reset to settle */
-/*
- * The PHY is already dropping to low power by the time the fault is read, so
- * this temperature is post-trip; report it next to the configured limit.
- */
+/* Temperature here is post-trip; the PHY is already dropping to low power. */
static void
aq_thermal_report_shutdown(struct aq_dev *aq_dev)
{
@@ -138,25 +135,19 @@
limit_mc - AQ_THERMAL_HYSTERESIS_MC : AQ_THERMAL_RECOVER_MC;
if (have_temp && have_limit)
- device_printf(aq_dev->dev, "atlantic: PHY thermal shutdown; "
+ device_printf(aq_dev->dev, "PHY thermal shutdown; "
"limit %d C, temp %d C; holding link down until it cools\n",
limit_mc / 1000, temp_mc / 1000);
else if (have_temp)
- device_printf(aq_dev->dev, "atlantic: PHY thermal shutdown; "
+ device_printf(aq_dev->dev, "PHY thermal shutdown; "
"temp %d C; holding link down until it cools\n",
temp_mc / 1000);
else
- device_printf(aq_dev->dev, "atlantic: PHY thermal shutdown; "
+ device_printf(aq_dev->dev, "PHY thermal shutdown; "
"holding link down until it cools\n");
}
-/*
- * Firmware autonomous thermal shutdown latches the PHY (fault 0x8007) and drops
- * the link. Recovery is held off until the PHY has cooled: A1 then needs a PHY
- * reset (while the MAC firmware runs) followed by a full re-init to reload the
- * PHY firmware; A2 recovers on the re-init alone. iflib_request_reset() drives
- * that stop/init cycle on the next admin pass.
- */
+/* Recover after cooldown: A1 needs a PHY reset then re-init, A2 re-inits alone. */
static void
aq_thermal_poll(struct aq_dev *aq_dev)
{
@@ -174,7 +165,7 @@
aq_dev->phy_fault_seen = true;
if (fault != AQ_PHY_FAULT_THERMAL_SHUTDOWN) {
device_printf(aq_dev->dev,
- "atlantic: PHY fault 0x%04x\n", fault);
+ "PHY fault 0x%04x\n", fault);
return;
}
aq_thermal_report_shutdown(aq_dev);
@@ -201,7 +192,7 @@
break;
}
- device_printf(aq_dev->dev, "atlantic: PHY cooled to %d C; restoring "
+ device_printf(aq_dev->dev, "PHY cooled to %d C; restoring "
"link\n", aq_dev->thermal_temp_mc / 1000);
aq_dev->thermal_state = AQ_THERMAL_NORMAL;
iflib_request_reset(aq_dev->ctx);
@@ -219,7 +210,7 @@
struct aq_hw_fc_info fc_neg;
aq_hw_get_link_state(hw, &link_speed, &fc_neg);
if (link_speed && !aq_dev->linkup) { /* link was DOWN */
- device_printf(aq_dev->dev, "atlantic: link UP: speed=%d\n", link_speed);
+ device_printf(aq_dev->dev, "link UP: speed=%d\n", link_speed);
aq_dev->linkup = 1;
aq_dev->phy_fault_seen = false;
@@ -234,7 +225,7 @@
/* update ITR settings according new link speed */
aq_hw_interrupt_moderation_set(hw);
} else if (link_speed == 0U && aq_dev->linkup) { /* link was UP */
- device_printf(aq_dev->dev, "atlantic: link DOWN\n");
+ device_printf(aq_dev->dev, "link DOWN\n");
aq_dev->linkup = 0;
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
@@ -627,7 +627,7 @@
M_AQ, M_NOWAIT | M_ZERO);
if (!ring){
rc = ENOMEM;
- device_printf(softc->dev, "atlantic: tx_ring malloc fail\n");
+ device_printf(softc->dev, "tx_ring malloc fail\n");
goto fail;
}
ring->tx_descs = (volatile struct aq_tx_desc*)vaddrs[i];
@@ -642,7 +642,7 @@
rc = aq_ring_stats_alloc(ring);
if (rc != 0) {
device_printf(softc->dev,
- "atlantic: tx_ring stats alloc fail\n");
+ "tx_ring stats alloc fail\n");
goto fail;
}
}
@@ -673,7 +673,7 @@
if (!ring){
rc = ENOMEM;
device_printf(softc->dev,
- "atlantic: rx_ring malloc fail\n");
+ "rx_ring malloc fail\n");
goto fail;
}
@@ -688,7 +688,7 @@
rc = aq_ring_stats_alloc(ring);
if (rc != 0) {
device_printf(softc->dev,
- "atlantic: rx_ring stats alloc fail\n");
+ "rx_ring stats alloc fail\n");
goto fail;
}
}
@@ -754,7 +754,7 @@
err = aq_hw_init(&softc->hw, softc->hw.mac_addr, softc->msix,
softc->scctx->isc_intr == IFLIB_INTR_MSIX);
if (err != 0) {
- device_printf(softc->dev, "atlantic: aq_hw_init: %d\n", err);
+ device_printf(softc->dev, "aq_hw_init: %d\n", err);
AQ_DBG_EXIT(err);
return;
}
@@ -772,12 +772,12 @@
err = aq_ring_tx_init(&softc->hw, ring);
if (err) {
device_printf(softc->dev,
- "atlantic: aq_ring_tx_init: %d\n", err);
+ "aq_ring_tx_init: %d\n", err);
}
err = aq_ring_tx_start(hw, ring);
if (err != 0) {
device_printf(softc->dev,
- "atlantic: aq_ring_tx_start: %d\n", err);
+ "aq_ring_tx_start: %d\n", err);
}
}
for (i = 0; i < softc->rx_rings_count; i++) {
@@ -786,12 +786,12 @@
err = aq_ring_rx_init(&softc->hw, ring);
if (err) {
device_printf(softc->dev,
- "atlantic: aq_ring_rx_init: %d\n", err);
+ "aq_ring_rx_init: %d\n", err);
}
err = aq_ring_rx_start(hw, ring);
if (err != 0) {
device_printf(softc->dev,
- "atlantic: aq_ring_rx_start: %d\n", err);
+ "aq_ring_rx_start: %d\n", err);
}
aq_if_rx_queue_intr_enable(ctx, i);
}
@@ -1318,80 +1318,38 @@
return (0);
}
-static int
-aq_sysctl_print_tx_head(SYSCTL_HANDLER_ARGS)
-{
- struct aq_ring *ring = arg1;
- int error = 0;
- unsigned int val;
-
- if (!ring)
- return (0);
-
- val = tdm_tx_desc_head_ptr_get(&ring->dev->hw, ring->index);
-
- error = sysctl_handle_int(oidp, &val, 0, req);
- if (error || !req->newptr)
- return (error);
-
- return (0);
-}
-
-static int
-aq_sysctl_print_tx_tail(SYSCTL_HANDLER_ARGS)
-{
- struct aq_ring *ring = arg1;
- int error = 0;
- unsigned int val;
-
- if (!ring)
- return (0);
-
- val = reg_tx_dma_desc_tail_ptr_get(&ring->dev->hw, ring->index);
-
- error = sysctl_handle_int(oidp, &val, 0, req);
- if (error || !req->newptr)
- return (error);
-
- return (0);
-}
-
-static int
-aq_sysctl_print_rx_head(SYSCTL_HANDLER_ARGS)
-{
- struct aq_ring *ring = arg1;
- int error = 0;
- unsigned int val;
-
- if (!ring)
- return (0);
-
- val = rdm_rx_desc_head_ptr_get(&ring->dev->hw, ring->index);
-
- error = sysctl_handle_int(oidp, &val, 0, req);
- if (error || !req->newptr)
- return (error);
-
- return (0);
-}
+enum aq_ring_ptr {
+ AQ_RING_TX_HEAD,
+ AQ_RING_TX_TAIL,
+ AQ_RING_RX_HEAD,
+ AQ_RING_RX_TAIL,
+};
static int
-aq_sysctl_print_rx_tail(SYSCTL_HANDLER_ARGS)
+aq_sysctl_print_ring_ptr(SYSCTL_HANDLER_ARGS)
{
- struct aq_ring *ring = arg1;
- int error = 0;
- unsigned int val;
+ struct aq_ring *ring = arg1;
+ unsigned int val;
- if (!ring)
+ if (ring == NULL)
return (0);
- val = reg_rx_dma_desc_tail_ptr_get(&ring->dev->hw, ring->index);
-
- error = sysctl_handle_int(oidp, &val, 0, req);
- if (error || !req->newptr)
- return (error);
+ switch (arg2) {
+ case AQ_RING_TX_HEAD:
+ val = tdm_tx_desc_head_ptr_get(&ring->dev->hw, ring->index);
+ break;
+ case AQ_RING_TX_TAIL:
+ val = reg_tx_dma_desc_tail_ptr_get(&ring->dev->hw, ring->index);
+ break;
+ case AQ_RING_RX_HEAD:
+ val = rdm_rx_desc_head_ptr_get(&ring->dev->hw, ring->index);
+ break;
+ default: /* AQ_RING_RX_TAIL */
+ val = reg_rx_dma_desc_tail_ptr_get(&ring->dev->hw, ring->index);
+ break;
+ }
- return (0);
+ return (sysctl_handle_int(oidp, &val, 0, req));
}
static int
@@ -1461,11 +1419,11 @@
SYSCTL_ADD_COUNTER_U64(ctx, queue_list, OID_AUTO, "tx_bytes",
CTLFLAG_RD, &(ring->stats.tx_bytes), "TX Octets");
SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "tx_head",
- CTLTYPE_UINT | CTLFLAG_RD, ring, 0,
- aq_sysctl_print_tx_head, "IU", "ring head pointer");
+ CTLTYPE_UINT | CTLFLAG_RD, ring, AQ_RING_TX_HEAD,
+ aq_sysctl_print_ring_ptr, "IU", "ring head pointer");
SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "tx_tail",
- CTLTYPE_UINT | CTLFLAG_RD, ring, 0,
- aq_sysctl_print_tx_tail, "IU", "ring tail pointer");
+ CTLTYPE_UINT | CTLFLAG_RD, ring, AQ_RING_TX_TAIL,
+ aq_sysctl_print_ring_ptr, "IU", "ring tail pointer");
}
for (int i = 0; i < softc->rx_rings_count; i++) {
@@ -1484,11 +1442,11 @@
SYSCTL_ADD_COUNTER_U64(ctx, queue_list, OID_AUTO, "irq",
CTLFLAG_RD, &(ring->stats.irq), "RX interrupts");
SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rx_head",
- CTLTYPE_UINT | CTLFLAG_RD, ring, 0,
- aq_sysctl_print_rx_head, "IU", "ring head pointer");
+ CTLTYPE_UINT | CTLFLAG_RD, ring, AQ_RING_RX_HEAD,
+ aq_sysctl_print_ring_ptr, "IU", "ring head pointer");
SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rx_tail",
- CTLTYPE_UINT | CTLFLAG_RD, ring, 0,
- aq_sysctl_print_rx_tail, "IU", " ring tail pointer");
+ CTLTYPE_UINT | CTLFLAG_RD, ring, AQ_RING_RX_TAIL,
+ aq_sysctl_print_ring_ptr, "IU", "ring tail pointer");
}
stat_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "mac",

File Metadata

Mime Type
text/plain
Expires
Mon, Aug 31, 12:05 PM (9 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37684326
Default Alt Text
D58436.id182609.diff (11 KB)

Event Timeline