Skip to content
Snippets Groups Projects
Commit 52686ef4 authored by Adam Wujek's avatar Adam Wujek
Browse files

[FEATURE: #356] userspace/tools/wrs_sfp_dump: print database entry id of matched SFP


Signed-off-by: default avatarAdam Wujek <dev_public@wujek.eu>
parent 0258c0cd
Branches
Tags
No related merge requests found
......@@ -782,6 +782,7 @@ int shw_sfp_read_db(void *(*sfp_db_alloc)(size_t alloc_size))
continue; /* Skip empty entries */
sfp = sfp_db_alloc(sizeof(*sfp));
sfp->db_entry = index;
strncpy(sfp->part_num, s, sizeof(sfp->part_num));
error = libwr_cfg_convert2("SFP%02i_PARAMS", "rev",
......@@ -885,10 +886,11 @@ static struct shw_sfp_caldata *shw_sfp_match_db(int *txWaveLength,
t->match_flags & SFP_MATCH_FLAG_VS ? "Vendor Serial, " : "",
t->match_flags & SFP_MATCH_FLAG_VR ? "Vendor Revision, " : ""
);
pr_info("With database entry: vendor_name(%s), "
pr_info("With database entry %d: vendor_name(%s), "
"part_num(%s), vendor_serial(%s), "
"vendor_revision(%s), TX wavelength(%d), "
"RX wavelength(%d)\n",
t->db_entry,
t->vendor_name, t->part_num, t->vendor_serial,
t->vendor_revision, t->tx_wl, t->rx_wl);
return t;
......
......@@ -178,7 +178,7 @@ struct hal_temp_sensors {
};
/* This is the overall structure stored in shared memory */
#define HAL_SHMEM_VERSION 17 /* Add revision for SFPs */
#define HAL_SHMEM_VERSION 18 /* Add entry_db for SFPs */
typedef enum {
HAL_SHMEM_STATE_NOT_INITITALIZED=0,
......
......@@ -48,6 +48,7 @@
#define VENDOR_REV_LEN 4
struct shw_sfp_caldata {
int32_t db_entry;
uint32_t flags;
/*
* Part number used to identify it. Serial number because we
......
......@@ -599,6 +599,7 @@ struct dump_info hal_port_info [] = {
/* Another internal structure, with a final pointer */
DUMP_FIELD(int, calib.sfp.db_entry),
DUMP_FIELD(sfp_flags, calib.sfp.flags),
DUMP_FIELD_SIZE(char, calib.sfp.vendor_name, 16),
DUMP_FIELD_SIZE(char, calib.sfp.part_num, 16),
......
......@@ -324,14 +324,13 @@ void hal_init_shm(void)
static void dump_sfp_database_from_hal(void)
{
int i = 1;
struct shw_sfp_caldata *sfp_db_entry = shw_sfp_cal_list_local;
printf(" # | Vendor Name | Part Number | Rev | Vendor Serial | TX WL | RX WL | Delta TX | Delta RX\n");
printf("---+------------------+------------------+------+------------------+-------+-------+----------+---------\n");
while (sfp_db_entry) {
printf("%2d", i);
printf("%2d", sfp_db_entry->db_entry);
printf(" | %16.16s", sfp_db_entry->vendor_name);
printf(" | %16.16s", sfp_db_entry->part_num);
printf(" | %4.4s", sfp_db_entry->vendor_revision);
......@@ -343,7 +342,6 @@ static void dump_sfp_database_from_hal(void)
printf("\n");
sfp_db_entry = wrs_shm_follow(hal_head, sfp_db_entry->next);
i++;
};
}
......@@ -351,11 +349,12 @@ static void dump_sfp_database_match_reason_from_hal(int dump_port, int nports, s
{
int i = 0;
printf(" # | Vendor Name | Part Number | Rev | Vendor Serial | TX WL | RX WL | delta TX | delta RX | alpha\n");
printf("------+---------------------+---------------------+---------+---------------------+----------+-------+----------+----------+----------------\n");
printf(" Port | DB# | Vendor Name | Part Number | Rev | Vendor Serial | TX WL | RX WL | delta TX | delta RX | alpha\n");
printf("------+-----+---------------------+---------------------+---------+---------------------+----------+-------+----------+----------+----------------\n");
for (i = dump_port; i <= nports; i++) {
printf("%2d%3s", i, hal_sfp_calib_lc[i - 1].sfp.match_flags ? "(+)" : "");
printf(" | %3d", hal_sfp_calib_lc[i - 1].sfp.db_entry);
printf(" | %16.16s%3s", hal_sfp_calib_lc[i - 1].sfp.vendor_name,
hal_sfp_calib_lc[i - 1].sfp.match_flags & SFP_MATCH_FLAG_VN ? "(+)" : "");
printf(" | %16.16s%3s", hal_sfp_calib_lc[i - 1].sfp.part_num,
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment