Skip to content

Commit 95040e5

Browse files
committed
Update LED color from red to light green in 400G link.
1 parent 251423b commit 95040e5

File tree

4 files changed

+79
-6
lines changed

4 files changed

+79
-6
lines changed

drivers/include/bf_pltfm_types/bf_pltfm_types.h

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <pthread.h>
2222
#include <sys/time.h>
2323
#include <sys/stat.h>
24+
#include <dirent.h>
2425
#ifndef EQ
2526
#define EQ(a, b) (!(((a) > (b)) - ((a) < (b))))
2627
#endif
@@ -158,6 +159,8 @@ extern "C" {
158159
* by tsihang, 2022-06-02. */
159160
#define LOG_DIR_PREFIX "/var/asterfusion"
160161
#define BF_DRIVERS_LOG_EXT LOG_DIR_PREFIX"/bf_drivers_ext.log"
162+
#define AF_LOG_MAX_NUM 50
163+
#define AF_LOG_MAX_SIZE 9 * 1024 * 1024
161164
#define AF_LOG_MSG_SIZE 512
162165
#define AF_LOG_EXT(...) \
163166
do { \
@@ -198,6 +201,59 @@ extern "C" {
198201
} \
199202
fprintf (bf_pltfm_mgr_ctx()->extended_log_hdl, "%s\n", ____info); \
200203
fflush (bf_pltfm_mgr_ctx()->extended_log_hdl); \
204+
struct stat file_stat; \
205+
stat (BF_DRIVERS_LOG_EXT, &file_stat); \
206+
if (file_stat.st_size > AF_LOG_MAX_SIZE) { \
207+
char rfile[512] = {0}; \
208+
time_t tmpcal_ptr; \
209+
time(&tmpcal_ptr); \
210+
fclose (bf_pltfm_mgr_ctx()->extended_log_hdl); \
211+
bf_pltfm_mgr_ctx()->extended_log_hdl = NULL; \
212+
sprintf (rfile, "%s.%lu", BF_DRIVERS_LOG_EXT, tmpcal_ptr); \
213+
rename (BF_DRIVERS_LOG_EXT, rfile); \
214+
DIR *dir; \
215+
struct dirent *ptr; \
216+
if ((dir = opendir (LOG_DIR_PREFIX)) == NULL) { \
217+
LOG_ERROR ("Open /var/asterfusion failed!"); \
218+
break; \
219+
} \
220+
int i, j, file_num = 0; \
221+
long int tmp, tmpcal[AF_LOG_MAX_NUM + 5]; \
222+
while ((ptr = readdir (dir)) != NULL) { \
223+
if ((strcmp (ptr->d_name, ".") == 0) || \
224+
(strcmp (ptr->d_name, "..") == 0)) { \
225+
continue; \
226+
} else if (ptr->d_type == 8) { \
227+
if ((ptr->d_name != NULL) && \
228+
(strstr(ptr->d_name, "bf_drivers_ext") != NULL)) { \
229+
sprintf (rfile, "%s/%s", \
230+
LOG_DIR_PREFIX, ptr->d_name); \
231+
stat (rfile, &file_stat); \
232+
tmpcal[file_num++] = file_stat.st_ctime; \
233+
if (file_num >= AF_LOG_MAX_NUM + 5) { \
234+
break; \
235+
} \
236+
} \
237+
} \
238+
} \
239+
closedir(dir); \
240+
if (file_num > AF_LOG_MAX_NUM) { \
241+
for (i = 0; i < file_num - 1; ++i) { \
242+
for (j = 0; j < file_num - 1 - i; ++j) { \
243+
if (tmpcal[j] < tmpcal[j + 1]) { \
244+
tmp = tmpcal[j]; \
245+
tmpcal[j] = tmpcal[j + 1]; \
246+
tmpcal[j + 1] = tmp; \
247+
} \
248+
} \
249+
} \
250+
for (i = AF_LOG_MAX_NUM; i < file_num; i++) { \
251+
sprintf (rfile, "%s.%lu", \
252+
BF_DRIVERS_LOG_EXT, tmpcal[i]); \
253+
remove (rfile); \
254+
} \
255+
} \
256+
} \
201257
} \
202258
} while (0);
203259

drivers/src/bf_port_mgmt/bf_pm_qsfp_mgmt.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3911,7 +3911,12 @@ static void qsfp_channel_fsm_run2(bf_dev_id_t dev_id, int conn_id, int ch) {
39113911
// CMIS hardware init - nothing to do
39123912
next_substate++; // fall through
39133913
case 1: // Step 1 - wait for initialization to complete
3914-
if (memmap_format == MMFORMAT_SFF8636) {
3914+
if (memmap_format == MMFORMAT_SFF8472) {
3915+
delay_ms = 0;
3916+
next_st = QSFP_CH_FSM_ST_ENA_OPTICAL_TX;
3917+
next_substate = 0;
3918+
break;
3919+
} else if (memmap_format == MMFORMAT_SFF8636) {
39153920
if (bf_pm_intf_is_device_family_tofino(dev_id)) {
39163921
// for some reason, need to read twice to clear latched faults
39173922
// Tofino 1 flag handling method only
@@ -4058,7 +4063,11 @@ static void qsfp_channel_fsm_run2(bf_dev_id_t dev_id, int conn_id, int ch) {
40584063
}
40594064
break;
40604065
case 1: // step 1 - wait for the transmitters to be enabled
4061-
if ((memmap_format == MMFORMAT_SFF8636) ||
4066+
if (memmap_format == MMFORMAT_SFF8472) {
4067+
next_st = QSFP_CH_FSM_ST_NOTIFY_ENABLED;
4068+
next_substate = 0;
4069+
break;
4070+
} else if ((memmap_format == MMFORMAT_SFF8636) ||
40624071
(memmap_format == MMFORMAT_CMIS3P0)) {
40634072
// CMIS state machine did not comprehend optics readiness until
40644073
// CMIS4.0. Calculate the delay needed for the optics to stabilize

drivers/src/bf_qsfp/bf_qsfp_comm.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4151,8 +4151,13 @@ static int set_qsfp_idprom (int port)
41514151
}
41524152
return -1;
41534153
}
4154-
if ((id == QSFP) || (id == QSFP_PLUS) ||
4155-
(id == QSFP_28)) {
4154+
if ((id == SFP) || (id == SFP_PLUS) ||
4155+
(id == SFP_28)) {
4156+
bf_qsfp_info_arr[port].memmap_format =
4157+
MMFORMAT_SFF8472;
4158+
bf_qsfp_info_arr[port].num_ch = 1;
4159+
} else if ((id == QSFP) || (id == QSFP_PLUS) ||
4160+
(id == QSFP_28)) {
41564161
bf_qsfp_info_arr[port].memmap_format =
41574162
MMFORMAT_SFF8636;
41584163
bf_qsfp_info_arr[port].num_ch = 4;

platforms/asterfusion-bf/src/bf_pltfm_led/bf_pltfm_mav_led_x732q.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,11 @@ static void led_cond_convert_to_color_x732q (bf_led_condition_t led_cond,
128128
break;
129129

130130
case BF_LED_PORT_LINKUP_400G:
131-
/* Red at 400G */
132-
led_col = BF_MAV_PORT_LED_RED;
131+
/* By SunZheng, 2024.12.26
132+
200G & 400G share the same color - Light Green */
133+
/* Light Green at 400G */
134+
led_col = BF_MAV_PORT_LED_BLUE |
135+
BF_MAV_PORT_LED_GREEN;
133136
break;
134137

135138
/* Test only */

0 commit comments

Comments
 (0)