Skip to content

Commit f13a4bb

Browse files
committed
Tracking internal commit 06cfc9f1be8 @ 04 Jun, 2024.
24.05 2024.06.04 New features: - Support X732Q-T, which is tof2-based platform with 32x 400G QSFP56-DD. - It's free to launch with latest sde 9.13.3. Major bugfix. - Skip poll los and health monitor for 10min if failed to read the modules, for X312P-T only - BMC new data format, to show 256V+, for X564P-T/X532P-T/X308P-T. - Fixed a issue that the length of product name is not long enough. - A new logging file in /var/asterfusion/bf_drivers_ext.log is implemented to situations which produce great amount of logs. - More detailed log for a given port, disabled by default and enabled via command 'bf-sde> [qsfp|sfp] ctrlmask-set 0x40000'. This feature helps to reduce log in bf_drivers.log.
1 parent 855337c commit f13a4bb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+5087
-4215
lines changed

bf-reference-bsp-9.13.1.manifest

Lines changed: 0 additions & 1 deletion
This file was deleted.

bf-reference-bsp-9.13.3.manifest

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bf-platforms : 9.13.3

drivers/include/bf_bd_cfg/bf_bd_cfg_bd_map.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ typedef struct bd_map_ent_t {
9696
uint32_t device_id;
9797

9898
// Serdes params for DD modules
99-
serdes_lane_tx_eq_t
100-
*tx_eq_for_qsfpdd[2]; // 0: NRZ 1:PAM4
99+
serdes_lane_tx_eq_t *tx_eq_for_qsfpdd[2]; // 0: NRZ 1:PAM4
101100
serdes_lane_tx_eq_t *tx_eq_for_internal_port[2];
102101

103102
/* tof3 related is ignored. */

drivers/include/bf_bd_cfg/bf_bd_cfg_intf.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
extern "C" {
1717
#endif
1818

19-
#define QSFP_NUM_CHN 4
19+
//#define QSFP_NUM_CHN 4
2020

2121
typedef bf_pltfm_status_t (
2222
*bf_pltfm_bd_cfg_qsfp_type_fn) (
@@ -265,6 +265,9 @@ bf_pltfm_status_t bf_bd_cfg_init();
265265
*/
266266
int bf_bd_cfg_bd_num_port_get();
267267

268+
int bf_bd_cfg_bd_port_num_nlanes_get(
269+
uint32_t conn_id);
270+
268271
#ifdef INC_PLTFM_UCLI
269272
ucli_node_t *bf_bd_cfg_ucli_node_create (
270273
ucli_node_t *m);

drivers/include/bf_pltfm_types/bf_pltfm_types.h

Lines changed: 60 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@
88
#ifndef _BF_PLTFM_TYPES_H
99
#define _BF_PLTFM_TYPES_H
1010

11+
#include <stdio.h>
1112
#include <stdbool.h>
1213
#include <stdint.h>
13-
#include <stdio.h>
1414
#include <string.h>
1515
#include <errno.h>
1616
#include <unistd.h>
1717
#include <stdlib.h>
1818
#define __USE_GNU /* See feature_test_macros(7) */
1919
#include <pthread.h>
20-
20+
#include <sys/time.h>
21+
#include <sys/stat.h>
2122
#ifndef EQ
2223
#define EQ(a, b) (!(((a) > (b)) - ((a) < (b))))
2324
#endif
@@ -27,11 +28,14 @@
2728
#ifndef LT
2829
#define LT(a, b) ((a) < (b))
2930
#endif
31+
#ifndef ARRAY_LENGTH
32+
#define ARRAY_LENGTH(a) (int)(sizeof(a)/sizeof((a)[0]))
33+
#endif
3034

31-
/* Mainline SDE version used by bsp, set 9.5.0 as default.
35+
/* Mainline SDE version used by bsp, set 9.13.0 as default.
3236
* Valid value in [891,900,910,930,950,970,990,9110,9120,9130 ...].
3337
* A sub version start from a given mainline is valid too, such as 931,952,971, etc. */
34-
#define SDE_VERSION 950
38+
#define SDE_VERSION 9130
3539
#define SDE_VERSION_EQ(key) \
3640
EQ(SDE_VERSION, (key))
3741

@@ -143,6 +147,43 @@ extern "C" {
143147
bf_sys_log_and_trace(BF_MOD_PLTFM, BF_LOG_WARN, __VA_ARGS__)
144148
#define LOG_DEBUG(...) \
145149
bf_sys_log_and_trace(BF_MOD_PLTFM, BF_LOG_DBG, __VA_ARGS__)
150+
/* Considering mounting LOG_DIR_PREFIX to ramfs or tmpfs.
151+
* by tsihang, 2022-06-02. */
152+
#define LOG_DIR_PREFIX "/var/asterfusion"
153+
#define BF_DRIVERS_LOG_EXT LOG_DIR_PREFIX"/bf_drivers_ext.log"
154+
#define AF_LOG_MSG_SIZE 512
155+
#define AF_LOG_EXT(...) \
156+
do { \
157+
if (bf_pltfm_mgr_ctx()->extended_log_hdl == NULL) { \
158+
bf_pltfm_mgr_ctx()->extended_log_hdl = fopen (BF_DRIVERS_LOG_EXT, "a+");\
159+
} \
160+
if (bf_pltfm_mgr_ctx()->extended_log_hdl) { \
161+
fflush (bf_pltfm_mgr_ctx()->extended_log_hdl); \
162+
char ____info[AF_LOG_MSG_SIZE] = {0}; \
163+
char ____tbuf[256] = {0}; \
164+
char ____ubuf[256] = {0}; \
165+
int ____size = 0; \
166+
struct tm * ____loctime; \
167+
struct timeval __tm__; \
168+
gettimeofday(&__tm__, NULL); \
169+
____loctime = localtime(&__tm__.tv_sec); \
170+
strftime(____tbuf, sizeof(____tbuf), "%a %b %d", ____loctime); \
171+
strftime(____ubuf, sizeof(____ubuf), "%T\n", ____loctime); \
172+
____ubuf[strlen(____ubuf) - 1] = 0; \
173+
____size += snprintf(____info + ____size, AF_LOG_MSG_SIZE, \
174+
"%s %s.%06d ", ____tbuf, ____ubuf, (int)__tm__.tv_usec);\
175+
____size += snprintf(____info + ____size, AF_LOG_MSG_SIZE, \
176+
" [AF_LOG_EXT] : "); \
177+
____size += snprintf(____info + ____size, AF_LOG_MSG_SIZE, \
178+
##__VA_ARGS__); \
179+
if (____size == AF_LOG_MSG_SIZE) { \
180+
____info[AF_LOG_MSG_SIZE - 1] = '\0'; \
181+
} \
182+
fprintf (bf_pltfm_mgr_ctx()->extended_log_hdl, "%s\n", ____info); \
183+
fflush (bf_pltfm_mgr_ctx()->extended_log_hdl); \
184+
} \
185+
} while (0);/*\
186+
//LOG_WARNING(__VA_ARGS__);*/
146187

147188
#define MAX_CHAN_PER_CONNECTOR 8
148189

@@ -159,40 +200,20 @@ extern "C" {
159200

160201
typedef enum {
161202
INVALID_TYPE = 0xFF,
162-
/*****************************************************/
163-
/************* Will be removed later. ****************/
164-
/*****************************************************/
165-
X564P = 1,
166-
X532P,
167-
X308P,
168-
X312P,
169-
HC,
170-
X732Q,
171-
172203
/*****************************************************
173204
* Product Name powered by Asterfusion Networks.
174205
*****************************************************/
175-
AFN_X732QT = X732Q,
176-
AFN_X564PT = X564P,
177-
AFN_X532PT = X532P,
178-
AFN_X308PT = X308P,
179-
AFN_X312PT = X312P,
180-
AFN_HC36Y24C = HC,
206+
AFN_X732QT = 1,
207+
AFN_X564PT = 2,
208+
AFN_X532PT = 3,
209+
AFN_X308PT = 4,
210+
AFN_X312PT = 7,
211+
AFN_HC36Y24C = 8,
181212
} bf_pltfm_type;
182213

183214
#define mkver(a,b) (((a) & 0x0F) << 4 | ((b) & 0x0F))
184215
typedef enum {
185216
INVALID_SUBTYPE = 0xFF,
186-
187-
/*****************************************************/
188-
/************* Will be removed later. ****************/
189-
/*****************************************************/
190-
v1dot0 = mkver (1, 0), v1dot1 = 0x11, v1dot2 = 0x12, v1dot3 = 0x13, v1dot4 = 0x14,
191-
v2dot0 = 0x20, v2dot1 = 0x21, v2dot2 = 0x22, v2dot3 = 0x23, v2dot4 = 0x24,
192-
v3dot0 = 0x30, v3dot1 = 0x31, v3dot2 = 0x32, v3dot3 = 0x33, v3dot4 = 0x34,
193-
v4dot0 = 0x40,
194-
v5dot0 = 0x50,
195-
196217
/*****************************************************
197218
* Subversion for BD.
198219
*****************************************************/
@@ -222,34 +243,6 @@ typedef enum {
222243
* Identifies the type of the board
223244
*/
224245
typedef enum bf_pltfm_board_id_e {
225-
/*****************************************************/
226-
/************* Will be removed later. ****************/
227-
/*****************************************************/
228-
BF_PLTFM_BD_ID_X564PT_V1DOT0 = 0x5640,
229-
BF_PLTFM_BD_ID_X564PT_V1DOT1 = 0x5641,
230-
BF_PLTFM_BD_ID_X564PT_V1DOT2 = 0x5642,
231-
BF_PLTFM_BD_ID_X564PT_V2DOT0 = 0x5643,
232-
BF_PLTFM_BD_ID_X532PT_V1DOT0 = 0x5320,
233-
BF_PLTFM_BD_ID_X532PT_V1DOT1 = 0x5321,
234-
BF_PLTFM_BD_ID_X532PT_V2DOT0 = 0x5322,
235-
BF_PLTFM_BD_ID_X532PT_V3DOT0 = 0x5323,
236-
BF_PLTFM_BD_ID_X308PT_V1DOT0 = 0x3080,
237-
BF_PLTFM_BD_ID_X308PT_V1DOT1 = 0x3081,
238-
BF_PLTFM_BD_ID_X308PT_V2DOT0 = BF_PLTFM_BD_ID_X308PT_V1DOT1, /* Announced as HW V2 to customer. */
239-
BF_PLTFM_BD_ID_X308PT_V3DOT0 = 0x3083, /* Announced as HW v3.0 with PTP hwcomp. */
240-
BF_PLTFM_BD_ID_X312PT_V1DOT0 = 0x3120,
241-
BF_PLTFM_BD_ID_X312PT_V1DOT1 = BF_PLTFM_BD_ID_X312PT_V1DOT0,
242-
BF_PLTFM_BD_ID_X312PT_V1DOT2 = 0x3122,
243-
BF_PLTFM_BD_ID_X312PT_V1DOT3 = 0x3123,
244-
BF_PLTFM_BD_ID_X312PT_V2DOT0 = BF_PLTFM_BD_ID_X312PT_V1DOT2,
245-
BF_PLTFM_BD_ID_X312PT_V3DOT0 = BF_PLTFM_BD_ID_X312PT_V1DOT3,
246-
BF_PLTFM_BD_ID_X312PT_V4DOT0 = 0x3124,
247-
BF_PLTFM_BD_ID_X312PT_V5DOT0 = 0x3125,
248-
BF_PLTFM_BD_ID_HC36Y24C_V1DOT0 = 0x2400,
249-
BF_PLTFM_BD_ID_HC36Y24C_V1DOT1 = 0x2401,
250-
BF_PLTFM_BD_ID_X732QT_V1DOT0 = 0x7320, /* Since Dec 2023. */
251-
252-
253246
/*****************************************************
254247
* Board ID enum powered by Asterfusion Networks.
255248
*****************************************************/
@@ -405,6 +398,12 @@ typedef struct pltfm_mgr_info_s {
405398
#define AF_PLAT_MNTR_DPU1_INSTALLED (1 << 20)
406399
#define AF_PLAT_MNTR_DPU2_INSTALLED (1 << 21)
407400
#define AF_PLAT_MNTR_PTPX_INSTALLED (1 << 22)
401+
#define AF_PLAT_CTRL_HA_MODE (1 << 23)// current for x312p-t only
402+
403+
#define AF_PLAT_CTRL_CP2112_RELAX (1 << 28) /* current for x732q-t only. */
404+
#define AF_PLAT_CTRL_I2C_RELAX (1 << 29) /* current for x312p-t only.
405+
* Temperaly relax i2c for platforms with only one i2c
406+
* but working for both modules/BMC IO. */
408407
#define AF_PLAT_CTRL_BMC_UART (1 << 30) /* Access BMC through UART, otherwise through i2c. */
409408
#define AF_PLAT_CTRL_CPLD_CP2112 (1 << 31) /* Access CPLD through CP2112, otherwise through i2c. */
410409
uint32_t flags;
@@ -423,6 +422,9 @@ typedef struct pltfm_mgr_info_s {
423422
uint32_t cpld_count;
424423
/* Maximum available DPUs, by tsihang, 2023/11/09. */
425424
uint32_t dpu_count;
425+
426+
/* For platforms and module/lane flags with any critical situations. */
427+
FILE *extended_log_hdl;
426428
} pltfm_mgr_info_t;
427429

428430
extern pltfm_mgr_info_t *bf_pltfm_mgr_ctx();

drivers/include/bf_port_mgmt/bf_port_mgmt_intf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ int bf_pm_num_qsfp_get (void);
501501

502502
char *qsfp_channel_fsm_st_get (int conn_id,
503503
int ch);
504-
void qsfp_channel_fsm_st_set (int conn_id, int ch, uint8_t state);
504+
void qsfp_channel_fsm_st_set (int conn_id, int ch, uint8_t state, bool stop);
505505
char *qsfp_module_fsm_st_get (int conn_id);
506506
void qsfp_module_fsm_st_set (int conn_id, uint8_t state);
507507

drivers/include/bf_qsfp/bf_qsfp.h

Lines changed: 51 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,39 @@ extern "C" {
2828

2929
/* After an optical transceiver plugged-in, by default the laser is off
3030
* till user performs port-enb on it. While this macro allows to turn on
31-
* laser without performing port-enb. This feature is widely used for cases
32-
* that user wants a faster linkup to remote.
31+
* laser without performing port-enb. This feature allow faster link to
32+
* remote for some kind of cases. Also, this feature can be implemented
33+
* to a transceiver as well by clearing flags BF_TRANS_CTRLMASK_LASER_OFF
34+
* in /etc/transceiver-cases.conf if you know its Vendor and PN.
35+
* .
3336
* by tsihang, 2023/09/01. */
3437
//#define DEFAULT_LASER_ON
3538

36-
/* Control word, added by tsihang for /etc/transceiver-cases.conf, 2023/05/05. */
37-
#define BF_TRANS_CTRLMASK_RX_CDR_OFF (1 << 0)
38-
#define BF_TRANS_CTRLMASK_TX_CDR_OFF (1 << 1)
39-
#define BF_TRANS_CTRLMASK_CDR_OFF (BF_TRANS_CTRLMASK_RX_CDR_OFF|BF_TRANS_CTRLMASK_TX_CDR_OFF) /* PFXONLV1-1418 with QSFP P/N TSQ885S101E1 from Teraspek. */
40-
#define BF_TRANS_CTRLMASK_LASER_OFF (1 << 2) /* Laser keeps off till user enable it. */
41-
#define BF_TRANS_CTRLMASK_OVERWRITE_DEFAULT (1 << 7)
42-
43-
/* State added by tsihang, 2023/08/31.
39+
/* Control word added by tsihang for /etc/transceiver-cases.conf, 2023/05/05. */
40+
#define BF_TRANS_CTRLMASK_RX_CDR_OFF (1 << 0)
41+
#define BF_TRANS_CTRLMASK_TX_CDR_OFF (1 << 1)
42+
#define BF_TRANS_CTRLMASK_CDR_OFF (BF_TRANS_CTRLMASK_RX_CDR_OFF|BF_TRANS_CTRLMASK_TX_CDR_OFF) /* PFXONLV1-1418 with QSFP P/N TSQ885S101E1 from Teraspek. */
43+
#define BF_TRANS_CTRLMASK_LASER_OFF (1 << 2) /* Keep laser off until user enable it. */
44+
#define BF_TRANS_CTRLMASK_OVERWRITE_DEFAULT (1 << 7)
45+
#define BF_TRANS_CTRLMASK_IGNORE_RX_LOS (1 << 16) // start here for tof2 QSFP-DD
46+
#define BF_TRANS_CTRLMASK_IGNORE_RX_LOL (1 << 17)
47+
#define BF_TRANS_CTRLMASK_FSM_LOG_ENA (1 << 18) // More detailed log for a given port, disabled by default and
48+
// enabled via command "bf-sde> [qsfp|sfp] ctrlmask-set 0x4****". This feature helps to reduce log in bf_drivers.log.
49+
// Any new logic implementation should consider of this.
50+
#define BF_TRANS_CTRLMASK_FORCELY_APPLY_DPINIT (1 << 24) // The bit starts from here should never been seen in /etc/transceiver-cases.conf.
51+
#define BF_TRANS_CTRLMASK_IGNORE_DPAPPLY_STATE (1 << 25)
52+
#define BF_TRANS_CTRLMASK_REQUIRE_HIGH_PWR_INIT (1 << 26)
53+
54+
/* Cached state for [q]sfp_info[port].trans_state.
4455
* To be clarified, the belowing runtime state will not be updated
45-
* if forcely configured via writing through its register by i2c. */
46-
#define BF_TRANS_STATE_CDR_ON (1 << 0)
47-
#define BF_TRANS_STATE_LASER_ON (1 << 1)
48-
#define BF_TRANS_STATE_DETECTED (1 << 2)
49-
#define BF_TRANS_STATE_SOFT_REMOVED (1 << 3)
50-
#define BF_TRANS_STATE_RESET (1 << 4)
56+
* if forcely configured via writing through its register by i2c.
57+
* added by tsihang, 2023/08/31 */
58+
#define BF_TRANS_STATE_RX_CDR_ON (1 << 0)
59+
#define BF_TRANS_STATE_TX_CDR_ON (1 << 1)
60+
#define BF_TRANS_STATE_LASER_ON (1 << 2)
61+
#define BF_TRANS_STATE_DETECTED (1 << 3)
62+
#define BF_TRANS_STATE_SOFT_REMOVED (1 << 4)
63+
#define BF_TRANS_STATE_RESET (1 << 5)
5164

5265
#define QSFP_RXLOS_DEBOUNCE_DFLT \
5366
0 // Can modify depending on if debouncing is required. This value can be set
@@ -404,6 +417,7 @@ int bf_qsfp_cdr_disable (int port,
404417
int channel_mask, bool disable);
405418
/* deactivate all data paths */
406419
int bf_qsfp_dp_deactivate_all (int port);
420+
int bf_qsfp_dp_activate_all (int port);
407421
/* reset or unreset a QSFP module */
408422
int bf_qsfp_reset (int port, bool reset);
409423
/* return the requested media type string */
@@ -449,7 +463,7 @@ bool bf_qsfp_is_lol_required (int port);
449463
const char *bf_qsfp_get_conn_type_string (
450464
int port);
451465
bool qsfp_needs_hi_pwr_init (int conn_id);
452-
466+
int bf_qsfp_is_fsm_logging (int port);
453467
bool bf_qsfp_is_cmis (int port);
454468
bool bf_qsfp_is_sff8636 (int port);
455469
MemMap_Format bf_qsfp_get_memmap_format (
@@ -474,10 +488,15 @@ int bf_qsfp_get_application (int port,
474488
int bf_cmis_get_datapath_state (int port,
475489
int ch,
476490
DataPath_State *datapath_state);
491+
const char* bf_cmis_get_datapath_state_str(int port,
492+
int ch,
493+
DataPath_State state);
477494
int bf_cmis_get_datapath_config_status (
478495
int port, int ch,
479496
DataPath_Config_Status *datapath_config_status);
480-
497+
const char* bf_cmis_get_datapath_config_state_str(int port,
498+
int ch,
499+
DataPath_Config_Status state);
481500
// Generic applies to all platforms
482501
void bf_qsfp_soft_removal_set (int port,
483502
bool removed);
@@ -505,16 +524,22 @@ int bf_cmis_get_Application_media_info (int port,
505524
int *media_firstLane,
506525
int *media_nLanes);
507526
int bf_cmis_get_module_state (int port,
508-
Module_State *module_state);
527+
Module_State *module_state,
528+
bool *intl_deasserted);
529+
const char* bf_cmis_get_module_state_str(int port,
530+
Module_State state);
531+
int bf_cmis_get_module_fault_cause (int port,
532+
Module_Fault_Cause *module_fault);
533+
const char *bf_cmis_get_module_fault_cause_str (int port,
534+
Module_Fault_Cause state);
535+
509536
void qsfp_fsm_force_all_lpmode();
510537
bool qsfp_fsm_query_all_lpmode();
511538
int bf_qsfp_vec_init (bf_qsfp_vec_t *vec);
512539
void bf_qsfp_get_sff_eth_extended_code_description (
513540
int port,
514541
char *ext_code_desc);
515-
/* return QSFP info */
516-
int bf_qsfp_get_info (int port, int page,
517-
uint8_t *buf);
542+
518543
/* read from cache if possible, if not - directly */
519544
bf_pltfm_status_t bf_qsfp_module_cached_read (
520545
unsigned int port,
@@ -563,7 +588,10 @@ int bf_qsfp_ctrlmask_set (int port,
563588
int bf_qsfp_ctrlmask_get (int port,
564589
uint32_t *ctrlmask);
565590
bool bf_qsfp_is_force_overwrite (int port);
566-
591+
int bf_qsfp_trans_state_set (int port,
592+
uint32_t transate);
593+
int bf_qsfp_trans_state_get (int port,
594+
uint32_t *transate);
567595
void bf_pltfm_qsfp_load_conf ();
568596
int bf_qsfp_tc_entry_add (char *vendor, char *pn, char *option,
569597
uint32_t ctrlmask);

drivers/include/bf_qsfp/bf_sfp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ void bf_sfp_print_ddm (int port, sfp_global_sensor_t *trans, sfp_channel_t *chnl
137137

138138
bool bf_sfp_is_detected (int port);
139139
void bf_sfp_set_detected (int port, bool detected);
140+
int bf_sfp_is_fsm_logging (int port);
140141

141142
#ifdef INC_PLTFM_UCLI
142143
ucli_node_t *bf_sfp_ucli_node_create (

0 commit comments

Comments
 (0)