[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250204183713.5cf64e08@kernel.org>
Date: Tue, 4 Feb 2025 18:37:13 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Danielle Ratson <danieller@...dia.com>
Cc: <netdev@...r.kernel.org>, <mkubecek@...e.cz>, <matt@...verse.com.au>,
<daniel.zahka@...il.com>, <amcohen@...dia.com>,
<nbu-mlxsw@...hange.nvidia.com>
Subject: Re: [PATCH ethtool-next v3 10/16] qsfp: Add JSON output handling to
--module-info in SFF8636 modules
On Tue, 4 Feb 2025 15:39:51 +0200 Danielle Ratson wrote:
> + if (is_json_context())
> + print_string(PRINT_JSON, "description", "%s", description);
> + else
> + printf("%s %s\n", pfx, description);
> +
> if (map->page_00h[SFF8636_EXT_ID_OFFSET] & SFF8636_EXT_ID_CDR_TX_MASK)
> - printf("%s CDR present in TX,", pfx);
> + strncpy(description, "CDR present in TX,", 64);
> else
> - printf("%s No CDR in TX,", pfx);
> + strncpy(description, "No CDR in TX,", 64);
>
> if (map->page_00h[SFF8636_EXT_ID_OFFSET] & SFF8636_EXT_ID_CDR_RX_MASK)
> - printf(" CDR present in RX\n");
> + strcat(description, " CDR present in RX");
> + else
> + strcat(description, " No CDR in RX");
> +
> + if (is_json_context())
> + print_string(PRINT_JSON, "description", "%s", description);
> else
> - printf(" No CDR in RX\n");
> + printf("%s %s\n", pfx, description);
I think the description fields need to either be concatenated, or an
array. Otherwise the parser picks one:
from the commit msg:
$ cat tmp
[{
"extended_identifier": {
"value": 207,
"description": "3.5W max. Power consumption",
"description": "CDR present in TX, CDR present in RX",
"description": "5.0W max. Power consumption, High Power Class enabled"
},
}]
$ cat tmp | jq
[
{
"extended_identifier": {
"value": 207,
"description": "5.0W max. Power consumption, High Power Class enabled"
}
}
]
Powered by blists - more mailing lists