Skip to content

Commit fa44268

Browse files
committed
25.12-rc2
1 parent 513c08d commit fa44268

File tree

8 files changed

+136
-79
lines changed

8 files changed

+136
-79
lines changed

drivers/include/bf_qsfp/bf_qsfp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ extern "C" {
5353
#define BF_TRANS_CTRLMASK_IGNORE_RX_LOS (1 << 16) // start here for tof2 QSFP-DD
5454
#define BF_TRANS_CTRLMASK_IGNORE_RX_LOL (1 << 17)
5555
#define BF_TRANS_CTRLMASK_FSM_LOG_ENA (1 << 18) // More detailed log for a given port, disabled by default and
56+
#define BF_TRANS_CTRLMASK_TRY_DOM (1 << 19)
5657
// enabled via command "bf-sde> [qsfp|sfp] ctrlmask-set 0x4****". This feature helps to reduce log in bf_drivers.log.
5758
// Any new logic implementation should consider of this.
5859
#define BF_TRANS_CTRLMASK_FORCELY_APPLY_DPINIT (1 << 24) // The bit starts from here should never been seen in /etc/transceiver-cases.conf.

drivers/src/bf_qsfp/bf_qsfp_cli.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3322,6 +3322,10 @@ bf_pltfm_ucli_ucli__qsfp_type_show (
33223322

33233323
for (port = first_port; port <= last_port;
33243324
port++) {
3325+
if (!bf_qsfp_is_present (port)) {
3326+
continue;
3327+
}
3328+
33253329
if (bf_qsfp_type_get (port, &qsfp_type) != 0) {
33263330
qsfp_type = BF_PLTFM_QSFP_UNKNOWN;
33273331
}

drivers/src/bf_qsfp/bf_qsfp_comm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8748,6 +8748,8 @@ void bf_pltfm_qsfp_load_conf ()
87488748
fwrite (entry, 1, length, fp);
87498749
length = sprintf (entry, "%-16s %-16s %-8x\n", "OEM", "TSQD13L052D4D1", 0x08000000);
87508750
fwrite (entry, 1, length, fp);
8751+
length = sprintf (entry, "%-16s %-16s %-8x\n", "Asterfusion", "TSST1000H1", 0x80000);
8752+
fwrite (entry, 1, length, fp);
87518753
fflush(fp);
87528754
}
87538755

drivers/src/bf_qsfp/bf_sfp_comm.c

Lines changed: 61 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,27 @@ int bf_sfp_get_cable_length_copper (int port, uint8_t* cable_len)
168168

169169
bool bf_sfp_get_dom_support (int port)
170170
{
171+
bool yes = false;
172+
171173
if (port > bf_plt_max_sfp) {
172-
return false;
174+
goto finish;
175+
}
176+
177+
// idprom indicates ?
178+
if(SFF8472_DOM_SUPPORTED (bf_sfp_info_arr[port].idprom)) {
179+
yes = true;
180+
goto finish;
181+
}
182+
183+
// further check for special cases if idprom doesn't indicate it.
184+
// It seems DOM isn't indicated in A0h[92], but the DOM may be supported
185+
if(bf_sfp_info_arr[port].ctrlmask & BF_TRANS_CTRLMASK_TRY_DOM) {
186+
yes = true;
187+
goto finish;
173188
}
174189

175-
return SFF8472_DOM_SUPPORTED (bf_sfp_info_arr[port].idprom);
190+
finish:
191+
return yes;
176192
}
177193

178194
/** return sfp presence information
@@ -372,13 +388,9 @@ int bf_sfp_module_write (
372388
/* Quite important. by tsihang. */
373389
static int bf_sfp_set_idprom (int port)
374390
{
375-
sff_eeprom_t *se;
376391
uint8_t id;
377392
int rc = -1;
378393

379-
if (port > bf_plt_max_sfp) {
380-
return -1;
381-
}
382394
if (!bf_sfp_info_arr[port].present) {
383395
LOG_ERROR (" SFP %02d: IDProm set failed as SFP is not present",
384396
port);
@@ -392,21 +404,6 @@ static int bf_sfp_set_idprom (int port)
392404
return rc;
393405
}
394406

395-
se = &bf_sfp_sff_eeprom[port];
396-
memset (se, 0, sizeof (sff_eeprom_t));
397-
rc = sff_eeprom_parse (se,
398-
bf_sfp_info_arr[port].idprom);
399-
/* sff_eeprom_parse is quite an importand API for most sfp.
400-
* but it is still not ready for all kind of sfps.
401-
* so override the failure here and keep tracking.
402-
* by tsihang, 2022-06-17. */
403-
#if 0
404-
if (!se->identified) {
405-
LOG_ERROR (" SFP %02d: IDProm set failed as SFP is not decodable <rc=%d>",
406-
port, rc);
407-
return rc;
408-
}
409-
#endif
410407
id = bf_sfp_info_arr[port].idprom[0];
411408
if ((id == SFP) || (id == SFP_PLUS) ||
412409
(id == SFP_28)) {
@@ -415,6 +412,37 @@ static int bf_sfp_set_idprom (int port)
415412
MMFORMAT_SFF8472;
416413
}
417414

415+
416+
sff_eeprom_t *se = &bf_sfp_sff_eeprom[port];
417+
sff_info_t *sff = &se->info;
418+
memset (se, 0, sizeof (sff_eeprom_t));
419+
rc = sff_eeprom_parse (se, bf_sfp_info_arr[port].idprom);
420+
/* sff_eeprom_parse is quite an importand API for most sfp.
421+
* but it is still not ready for all kind of sfps.
422+
* so override the failure here and keep tracking.
423+
* by tsihang, 2022-06-17. */
424+
//if (!se->identified) {
425+
// LOG_ERROR (" SFP %02d: IDProm set failed as SFP is not decodable <rc=%d>",
426+
// port, rc);
427+
// return rc;
428+
//}
429+
430+
/* load from /etc/transceiver-cases.conf. */
431+
uint32_t ctrlmask = 0, ctrlmask0 = 0;
432+
if (bf_qsfp_tc_entry_find ((char *)sff->vendor,
433+
(char *)sff->model, NULL, &ctrlmask, false) == 0) {
434+
bf_sfp_ctrlmask_get(port, &ctrlmask0);
435+
ctrlmask |= ctrlmask0;
436+
bf_sfp_ctrlmask_set(port, ctrlmask);
437+
}
438+
439+
//if(!strncmp(sff->vendor, "Asterfusion", 5) &&
440+
// !strncmp(sff->model, "TSST1000H1", 9)) {
441+
// bf_sfp_info_arr[port].ctrlmask |= BF_TRANS_CTRLMASK_TRY_DOM;
442+
//}
443+
444+
bf_sfp_sff_info_show (port, sff);
445+
418446
// change dirty
419447
bf_sfp_info_arr[port].cache_dirty = false;
420448

@@ -516,9 +544,12 @@ void bf_sfp_debug_clear_all_presence_bits (void)
516544
*/
517545
int bf_sfp_update_cache (int port)
518546
{
547+
int rc = 0;
548+
519549
if (port > bf_plt_max_sfp) {
520550
return -1;
521551
}
552+
522553
bf_sfp_idprom_clr (port);
523554

524555
if (!bf_sfp_info_arr[port].present) {
@@ -557,18 +588,11 @@ int bf_sfp_update_cache (int port)
557588
bf_sfp_info_arr[port].passive_cu = false;
558589
}
559590

560-
sff_dom_info_t sdi;
561-
sff_eeprom_t *se;
562-
sff_info_t *sff;
563-
se = &bf_sfp_sff_eeprom[port];
564-
sff = &se->info;
565-
566591
// now that we know the memory map format, we can selectively read the
567592
// locations that are static into our cache.
568593
/* How to check whether there's A2h or not ?
569594
* by tsihang, 2021-07-29. */
570-
if (SFF8472_DOM_SUPPORTED (
571-
bf_sfp_info_arr[port].idprom)) {
595+
if (bf_sfp_get_dom_support(port)) {
572596
if (bf_pltfm_sfp_read_module (port,
573597
MAX_SFP_PAGE_SIZE, MAX_SFP_PAGE_SIZE,
574598
bf_sfp_info_arr[port].a2h)) {
@@ -578,19 +602,14 @@ int bf_sfp_update_cache (int port)
578602
}
579603
}
580604

581-
sff_dom_info_get (&sdi, sff,
582-
bf_sfp_info_arr[port].idprom,
583-
bf_sfp_info_arr[port].a2h);
584605
LOG_DEBUG (
585-
" SFP %2d : Spec %s : %s : %s : %s", port,
606+
" SFP %2d : Spec %s : %s : %s : %s <rc=%d>", port,
586607
bf_sfp_is_sff8472 (port) ? "SFF-8472" : "Unknown",
587608
bf_sfp_is_passive_cu (port) ? "Passive copper" : "Active/Optical",
588609
bf_sfp_is_flat_mem (port) ? "Flat" : "Paged",
589-
"Update cache complete");
590-
bf_sfp_sff_info_show (port, sff);
610+
"Update cache complete", rc);
591611

592612
return 0;
593-
594613
}
595614

596615
/** get sfp info ptr
@@ -687,7 +706,7 @@ bool bf_sfp_get_chan_temp (int port,
687706
}
688707

689708
/* A2h, what should we do if there's no A2h ? */
690-
if (!SFF8472_DOM_SUPPORTED (bf_sfp_info_arr[port].idprom)) {
709+
if (! bf_sfp_get_dom_support(port)) {
691710
return -1;
692711
}
693712

@@ -725,7 +744,7 @@ bool bf_sfp_get_chan_volt (int port,
725744
}
726745

727746
/* A2h, what should we do if there's no A2h ? */
728-
if (!SFF8472_DOM_SUPPORTED (bf_sfp_info_arr[port].idprom)) {
747+
if (! bf_sfp_get_dom_support(port)) {
729748
return -1;
730749
}
731750

@@ -763,7 +782,7 @@ bool bf_sfp_get_chan_tx_bias (int port,
763782
}
764783

765784
/* A2h, what should we do if there's no A2h ? */
766-
if (!SFF8472_DOM_SUPPORTED (bf_sfp_info_arr[port].idprom)) {
785+
if (! bf_sfp_get_dom_support(port)) {
767786
return -1;
768787
}
769788

@@ -796,7 +815,7 @@ bool bf_sfp_get_chan_tx_pwr (int port,
796815
}
797816

798817
/* A2h, what should we do if there's no A2h ? */
799-
if (!SFF8472_DOM_SUPPORTED (bf_sfp_info_arr[port].idprom)) {
818+
if (! bf_sfp_get_dom_support(port)) {
800819
return -1;
801820
}
802821

@@ -829,7 +848,7 @@ bool bf_sfp_get_chan_rx_pwr (int port,
829848
}
830849

831850
/* A2h, what should we do if there's no A2h ? */
832-
if (!SFF8472_DOM_SUPPORTED (bf_sfp_info_arr[port].idprom)) {
851+
if (! bf_sfp_get_dom_support(port)) {
833852
return -1;
834853
}
835854

@@ -860,7 +879,7 @@ bool bf_sfp_update_optional_status (int port)
860879
}
861880

862881
/* A2h, what should we do if there's no A2h ? */
863-
if (!SFF8472_DOM_SUPPORTED (bf_sfp_info_arr[port].idprom)) {
882+
if (! bf_sfp_get_dom_support(port)) {
864883
return -1;
865884
}
866885

drivers/src/bf_qsfp/bf_sfp_ucli.c

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static char *bf_sfp_ctrlmask_str[] = {
6666
"BF_TRANS_CTRLMASK_IGNORE_RX_LOS ",//(1 << 16)
6767
"BF_TRANS_CTRLMASK_IGNORE_RX_LOL ",//(1 << 17)
6868
"BF_TRANS_CTRLMASK_FSM_LOG_ENA ",//(1 << 18)
69-
" ",
69+
"BF_TRANS_CTRLMASK_TRY_DOM ",//(1 << 19)
7070
" ",
7171
" ",
7272
" ",
@@ -157,10 +157,6 @@ bool bf_sfp_get_spec_rev_str (uint8_t *idprom,
157157
char *rev_str)
158158
{
159159
uint8_t rev = idprom[94];
160-
if (!SFF8472_DOM_SUPPORTED (idprom)) {
161-
/* Not SFF-8472 ? */
162-
return false;
163-
}
164160

165161
switch (rev) {
166162
case 0x0:
@@ -206,13 +202,11 @@ bf_sfp_dump_info (ucli_context_t
206202
*uc, int port, uint8_t *idprom)
207203
{
208204
uint8_t *a0h, *a2h;
209-
sff_info_t *sff;
210-
sff_eeprom_t *se, eeprom;
205+
sff_eeprom_t sff_eeprom, *se = &sff_eeprom;
206+
sff_info_t *sff = &se->info;
211207
sff_dom_info_t sdi;
212208
int rc;
213209

214-
se = &eeprom;
215-
sff = &se->info;
216210
memset (se, 0, sizeof (sff_eeprom_t));
217211
rc = sff_eeprom_parse (se, idprom);
218212
if (!se->identified) {
@@ -267,7 +261,7 @@ bf_sfp_dump_info (ucli_context_t
267261

268262
aim_printf (&uc->pvs, "%-30s = ",
269263
"Memory map format");
270-
if (sdi.spec == SFF_DOM_SPEC_SFF8472) {
264+
if(bf_sfp_is_sff8472(port)) {
271265
aim_printf (&uc->pvs, "SFF-8472\n");
272266
} else {
273267
aim_printf (&uc->pvs, "Unknown\n");
@@ -631,8 +625,8 @@ bf_pltfm_ucli_ucli__sfp_dump_info (ucli_context_t
631625
}
632626

633627
/* A2h, what should we do if there's no A2h ? */
634-
if (SFF8472_DOM_SUPPORTED (
635-
idprom)) {
628+
//if (SFF8472_DOM_SUPPORTED(idprom))
629+
{
636630
rc = bf_pltfm_sfp_read_module (port,
637631
MAX_SFP_PAGE_SIZE, MAX_SFP_PAGE_SIZE,
638632
idprom + MAX_SFP_PAGE_SIZE);
@@ -701,16 +695,18 @@ bf_pltfm_ucli_ucli__sfp_show_module (
701695
return 0;
702696
}
703697

704-
/* A2h */
705-
rc = bf_sfp_get_cached_info (port, 1,
706-
idprom + MAX_SFP_PAGE_SIZE);
707-
if (rc) {
708-
aim_printf (&uc->pvs,
709-
"Unknown module : %2d\n",
710-
port);
711-
return 0;
698+
/* A2h, what should we do if there's no A2h ? */
699+
//if (SFF8472_DOM_SUPPORTED(idprom))
700+
{
701+
rc = bf_sfp_get_cached_info (port, 1,
702+
idprom + MAX_SFP_PAGE_SIZE);
703+
if (rc) {
704+
aim_printf (&uc->pvs,
705+
"Unknown module : %2d\n",
706+
port);
707+
return 0;
708+
}
712709
}
713-
714710
return bf_sfp_dump_info (uc, port, idprom);
715711
}
716712

@@ -721,9 +717,8 @@ bf_pltfm_ucli_ucli__sfp_summary (ucli_context_t
721717
int port;
722718
int rc;
723719
uint8_t *a0h, *a2h;
724-
sff_info_t *sff;
725-
sff_eeprom_t *se, eeprom;
726-
sff_dom_info_t sdi;
720+
sff_eeprom_t sff_eeprom, *se = &sff_eeprom;
721+
sff_info_t *sff = &se->info;
727722
uint8_t idprom[MAX_SFP_PAGE_SIZE * 2 + 1] = {0};
728723

729724
UCLI_COMMAND_INFO (uc, "info", 0, "info");
@@ -768,8 +763,6 @@ bf_pltfm_ucli_ucli__sfp_summary (ucli_context_t
768763
return 0;
769764
}
770765

771-
se = &eeprom;
772-
sff = &se->info;
773766
memset (se, 0, sizeof (sff_eeprom_t));
774767
rc = sff_eeprom_parse (se, idprom);
775768
if (!se->identified) {
@@ -785,7 +778,7 @@ bf_pltfm_ucli_ucli__sfp_summary (ucli_context_t
785778

786779
a0h = idprom;
787780
a2h = idprom + MAX_SFP_PAGE_SIZE;
788-
sff_dom_info_get (&sdi, sff, a0h, a2h);
781+
(void)a2h;
789782

790783
/* print lower page data */
791784
aim_printf (&uc->pvs, " %2d: ", port);
@@ -1009,6 +1002,10 @@ bf_pltfm_ucli_ucli__sfp_type_show (
10091002

10101003
for (port = first_port; port <= last_port;
10111004
port++) {
1005+
if (!bf_sfp_is_present (port)) {
1006+
continue;
1007+
}
1008+
10121009
if (bf_sfp_type_get (port, &sfp_type) != 0) {
10131010
sfp_type = BF_PLTFM_QSFP_UNKNOWN;
10141011
}

0 commit comments

Comments
 (0)