From 2e8b855586c4d2246d7f63c3146c9779323d0e87 Mon Sep 17 00:00:00 2001 From: Vincent Jardin Date: Fri, 19 Jun 2026 02:39:04 +0200 Subject: [PATCH 1/4] mepa_demo: visibibilty on JSON parser's error json_req.buf carries the generated parser's topics; without it a bad conf file fails with a bare "Error in the json configuration" and is undebuggable. Signed-off-by: Vincent Jardin --- misc information: pushed to: https://github.com/microchip-ung/sw-mepa/pull/10 https://github.com/microchip-ung/mesa/pull/16 --- mesa/demo/mepa_apps/phy_port_config.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mesa/demo/mepa_apps/phy_port_config.c b/mesa/demo/mepa_apps/phy_port_config.c index 2071862b0..813e20394 100644 --- a/mesa/demo/mepa_apps/phy_port_config.c +++ b/mesa/demo/mepa_apps/phy_port_config.c @@ -240,6 +240,8 @@ static void cli_cmd_phy_conf(cli_req_t *req) } if (json_rpc_get_mepa_conf_t(&json_req, json_req.params, &conf) != MESA_RC_OK) { T_E("Error in the json configuration"); + /* json_req.buf carries the parser's precise complaint */ + cli_printf("json parse error: %s\n", json_req.buf); goto file_close; } if (mepa_conf_set(dev, &conf) != MESA_RC_OK) { From 793e9ca9103828e4f7dc0a849ca5ad065b7c4eb4 Mon Sep 17 00:00:00 2001 From: Vincent Jardin Date: Wed, 8 Jul 2026 00:32:51 +0200 Subject: [PATCH 2/4] mesa-demo: PHY failures visible on the CLI From mepa-cmd a failed command was indistinguishable from a successful one (rc 0, no output). Signed-off-by: Vincent Jardin --- mesa/demo/mepa_apps/phy25g_diagnostics.c | 6 ++++++ mesa/demo/mepa_apps/phy_port_config.c | 13 ++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/mesa/demo/mepa_apps/phy25g_diagnostics.c b/mesa/demo/mepa_apps/phy25g_diagnostics.c index 77679a3c8..6e83cd947 100644 --- a/mesa/demo/mepa_apps/phy25g_diagnostics.c +++ b/mesa/demo/mepa_apps/phy25g_diagnostics.c @@ -495,12 +495,18 @@ static void cli_cmd_eye_diag(cli_req_t *req) req->port_no, mreq->is_line, mreq->scan)) != MEPA_RC_OK) { T_E("\n Error in Configuring Eye Diagram on port : %d \n", (req->port_no + 1)); + cli_printf("Error: eye-scan conf failed on port %u (%s side, rc %d): " + "no signal/clock on the scanned lane? See trace log.\n", + (req->port_no + 1), mreq->is_line ? "line" : "host", rc); return; } if ((rc = lan80xx_rx_eye_scan_status_get(meba_phy_diag_instance->phy_devices[req->port_no], req->port_no, mreq->scan, &status)) != MEPA_RC_OK) { T_E("\n Error in Getting the Eye Height and Eye Diagram on port : %d \n", (req->port_no + 1)); + cli_printf("Error: eye-scan status read failed on port %u (%s side, rc %d)" + " -- see trace log.\n", + (req->port_no + 1), mreq->is_line ? "line" : "host", rc); return; } if ((rc = lan80xx_phy_tx_rx_equalization_status_get(meba_phy_diag_instance diff --git a/mesa/demo/mepa_apps/phy_port_config.c b/mesa/demo/mepa_apps/phy_port_config.c index 813e20394..5c5b14945 100644 --- a/mesa/demo/mepa_apps/phy_port_config.c +++ b/mesa/demo/mepa_apps/phy_port_config.c @@ -76,6 +76,10 @@ static int mepa_drv_create(const mepa_port_no_t port_no) if (meba_phy_inst->phy_devices[port_no]) { T_E("Device Already existing on %d", port_no); + cli_printf("Error: device already exists on port %u (created at board init).\n" + "Run 'PHY Dev Del %u' first so Create re-probes and " + "runs the PRE/DEFAULT/POST reset sequence.\n", + iport2uport(port_no), iport2uport(port_no)); return MESA_RC_ERROR; } @@ -203,6 +207,7 @@ static void cli_cmd_phy_conf(cli_req_t *req) struct json_object *jobj; json_rpc_req_t json_req = {}; json_req.ptr = json_req.buf; + mepa_rc rc; mepa_device_t *dev; int size; char port_config_file[100]; @@ -244,8 +249,14 @@ static void cli_cmd_phy_conf(cli_req_t *req) cli_printf("json parse error: %s\n", json_req.buf); goto file_close; } - if (mepa_conf_set(dev, &conf) != MESA_RC_OK) { + if ((rc = mepa_conf_set(dev, &conf)) != MESA_RC_OK) { T_E("Error in Configuring the PHY"); + cli_printf("Error: mepa_conf_set failed on port %u (rc %d): " + "port is NOT configured; see the mesa-demo trace " + "log for the driver reason\n", + iport2uport(req->port_no), rc); + } else { + cli_printf("conf applied on port %u\n", iport2uport(req->port_no)); } file_close: free(buffer); From 8fbd674f52a232a93c81bc4e110f3f483c9462cb Mon Sep 17 00:00:00 2001 From: Vincent Jardin Date: Wed, 8 Jul 2026 00:32:51 +0200 Subject: [PATCH 3/4] lan80xx: identify the lane in the eye-scan ISCAN_DONE timeout trace Eye-scan polls report "Timed out after N ms - bailing out" which cannot be mapped to a port or side when several scans run in sequence. Signed-off-by: Vincent Jardin --- mepa/microchip/lan80xx/src/lan80xx_private.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mepa/microchip/lan80xx/src/lan80xx_private.c b/mepa/microchip/lan80xx/src/lan80xx_private.c index 01b904ce8..257622247 100644 --- a/mepa/microchip/lan80xx/src/lan80xx_private.c +++ b/mepa/microchip/lan80xx/src/lan80xx_private.c @@ -3919,7 +3919,11 @@ mepa_rc lan80xx_rx_eye_scan_conf_set_priv (const mepa_device_t *dev, cnt++; } if (!(value & LAN80XX_M_LINE_PMA_8BIT_LANE_DD_LN_ISCAN_DONE)) { - T_E(MEPA_TRACE_GRP_GEN, "Timed out after %d ms - bailing out", cnt); + T_E(MEPA_TRACE_GRP_GEN, + "port %u %s fast ISCAN_DONE poll timed out after %d ms " + "(PMA_8BIT_LANE_DD=0x%x) - bailing out (no signal/clock on " + "the scanned lane?)", + port_no, is_line ? "LINE" : "HOST", cnt, value); MEPA_RC(lan80xx_rx_eye_scan_disable(dev, port_no, is_line)); return MEPA_RC_ERROR; } @@ -3946,7 +3950,11 @@ mepa_rc lan80xx_rx_eye_scan_conf_set_priv (const mepa_device_t *dev, cnt++; } if (!(value & LAN80XX_M_LINE_PMA_8BIT_LANE_DD_LN_ISCAN_DONE)) { - T_E(MEPA_TRACE_GRP_GEN, "Timed out after %d ms - bailing out", cnt); + T_E(MEPA_TRACE_GRP_GEN, + "port %u %s normal ISCAN_DONE poll timed out after %d ms " + "(PMA_8BIT_LANE_DD=0x%x) - bailing out (no signal/clock on " + "the scanned lane?)", + port_no, is_line ? "LINE" : "HOST", cnt, value); MEPA_RC(lan80xx_rx_eye_scan_disable(dev, port_no, is_line)); return MEPA_RC_ERROR; } From a0b2a6b8e1d1291e892578e1d7a5c060b3624db7 Mon Sep 17 00:00:00 2001 From: Vincent Jardin Date: Fri, 10 Jul 2026 01:54:15 +0200 Subject: [PATCH 4/4] mesa-demo: dev_attach: pass the missing rc argument to the failure traces The failure traces have a "%d" that has no matching argument ! The printed number is a stack leftover ("failed 22" for my case) that misleads whoever reads the log. Capture the return code and print it. Signed-off-by: Vincent Jardin --- mesa/demo/mepa_apps/phy_port_config.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mesa/demo/mepa_apps/phy_port_config.c b/mesa/demo/mepa_apps/phy_port_config.c index 5c5b14945..7b8c01a81 100644 --- a/mesa/demo/mepa_apps/phy_port_config.c +++ b/mesa/demo/mepa_apps/phy_port_config.c @@ -168,6 +168,7 @@ static void cli_cmd_dev_attach(cli_req_t *req) { mesa_port_conf_t conf; port_cli_req_t *mreq = req->module_req; + mesa_rc rc; mepa_device_t *dev; dev = meba_phy_inst->phy_devices[req->port_no]; if (mesa_port_conf_get(NULL, req->port_no, &conf) != MESA_RC_OK) { @@ -177,14 +178,14 @@ static void cli_cmd_dev_attach(cli_req_t *req) req->rc = 0; } conf.if_type = mreq->interface; - if (mesa_port_conf_set(NULL, req->port_no, &conf) != MESA_RC_OK) { + if ((rc = mesa_port_conf_set(NULL, req->port_no, &conf)) != MESA_RC_OK) { req->rc = -1; - T_E("mesa_port_conf_set(%u) failed %d\n", req->port_no); + T_E("mesa_port_conf_set(%u) failed %d\n", req->port_no, rc); } else { req->rc = 0; } - if (mepa_if_set(dev, mreq->interface) != MESA_RC_OK) { - T_E("mepa_if_set(%u) failed %d\n", req->port_no); + if ((rc = mepa_if_set(dev, mreq->interface)) != MESA_RC_OK) { + T_E("mepa_if_set(%u) failed %d\n", req->port_no, rc); } else { req->rc = 0; }