41
41
#define PHY_PORT_CS1_LINK_STATE_SHIFT 26
42
42
43
43
#define ICM_TIMEOUT 5000 /* ms */
44
+ #define ICM_RETRIES 3
44
45
#define ICM_APPROVE_TIMEOUT 10000 /* ms */
45
46
#define ICM_MAX_LINK 4
46
47
@@ -296,10 +297,9 @@ static bool icm_copy(struct tb_cfg_request *req, const struct ctl_pkg *pkg)
296
297
297
298
static int icm_request (struct tb * tb , const void * request , size_t request_size ,
298
299
void * response , size_t response_size , size_t npackets ,
299
- unsigned int timeout_msec )
300
+ int retries , unsigned int timeout_msec )
300
301
{
301
302
struct icm * icm = tb_priv (tb );
302
- int retries = 3 ;
303
303
304
304
do {
305
305
struct tb_cfg_request * req ;
@@ -410,7 +410,7 @@ static int icm_fr_get_route(struct tb *tb, u8 link, u8 depth, u64 *route)
410
410
return - ENOMEM ;
411
411
412
412
ret = icm_request (tb , & request , sizeof (request ), switches ,
413
- sizeof (* switches ), npackets , ICM_TIMEOUT );
413
+ sizeof (* switches ), npackets , ICM_RETRIES , ICM_TIMEOUT );
414
414
if (ret )
415
415
goto err_free ;
416
416
@@ -463,7 +463,7 @@ icm_fr_driver_ready(struct tb *tb, enum tb_security_level *security_level,
463
463
464
464
memset (& reply , 0 , sizeof (reply ));
465
465
ret = icm_request (tb , & request , sizeof (request ), & reply , sizeof (reply ),
466
- 1 , ICM_TIMEOUT );
466
+ 1 , ICM_RETRIES , ICM_TIMEOUT );
467
467
if (ret )
468
468
return ret ;
469
469
@@ -488,7 +488,7 @@ static int icm_fr_approve_switch(struct tb *tb, struct tb_switch *sw)
488
488
memset (& reply , 0 , sizeof (reply ));
489
489
/* Use larger timeout as establishing tunnels can take some time */
490
490
ret = icm_request (tb , & request , sizeof (request ), & reply , sizeof (reply ),
491
- 1 , ICM_APPROVE_TIMEOUT );
491
+ 1 , ICM_RETRIES , ICM_APPROVE_TIMEOUT );
492
492
if (ret )
493
493
return ret ;
494
494
@@ -515,7 +515,7 @@ static int icm_fr_add_switch_key(struct tb *tb, struct tb_switch *sw)
515
515
516
516
memset (& reply , 0 , sizeof (reply ));
517
517
ret = icm_request (tb , & request , sizeof (request ), & reply , sizeof (reply ),
518
- 1 , ICM_TIMEOUT );
518
+ 1 , ICM_RETRIES , ICM_TIMEOUT );
519
519
if (ret )
520
520
return ret ;
521
521
@@ -543,7 +543,7 @@ static int icm_fr_challenge_switch_key(struct tb *tb, struct tb_switch *sw,
543
543
544
544
memset (& reply , 0 , sizeof (reply ));
545
545
ret = icm_request (tb , & request , sizeof (request ), & reply , sizeof (reply ),
546
- 1 , ICM_TIMEOUT );
546
+ 1 , ICM_RETRIES , ICM_TIMEOUT );
547
547
if (ret )
548
548
return ret ;
549
549
@@ -577,7 +577,7 @@ static int icm_fr_approve_xdomain_paths(struct tb *tb, struct tb_xdomain *xd,
577
577
578
578
memset (& reply , 0 , sizeof (reply ));
579
579
ret = icm_request (tb , & request , sizeof (request ), & reply , sizeof (reply ),
580
- 1 , ICM_TIMEOUT );
580
+ 1 , ICM_RETRIES , ICM_TIMEOUT );
581
581
if (ret )
582
582
return ret ;
583
583
@@ -1020,7 +1020,7 @@ icm_tr_driver_ready(struct tb *tb, enum tb_security_level *security_level,
1020
1020
1021
1021
memset (& reply , 0 , sizeof (reply ));
1022
1022
ret = icm_request (tb , & request , sizeof (request ), & reply , sizeof (reply ),
1023
- 1 , 20000 );
1023
+ 1 , 10 , 2000 );
1024
1024
if (ret )
1025
1025
return ret ;
1026
1026
@@ -1053,7 +1053,7 @@ static int icm_tr_approve_switch(struct tb *tb, struct tb_switch *sw)
1053
1053
1054
1054
memset (& reply , 0 , sizeof (reply ));
1055
1055
ret = icm_request (tb , & request , sizeof (request ), & reply , sizeof (reply ),
1056
- 1 , ICM_APPROVE_TIMEOUT );
1056
+ 1 , ICM_RETRIES , ICM_APPROVE_TIMEOUT );
1057
1057
if (ret )
1058
1058
return ret ;
1059
1059
@@ -1081,7 +1081,7 @@ static int icm_tr_add_switch_key(struct tb *tb, struct tb_switch *sw)
1081
1081
1082
1082
memset (& reply , 0 , sizeof (reply ));
1083
1083
ret = icm_request (tb , & request , sizeof (request ), & reply , sizeof (reply ),
1084
- 1 , ICM_TIMEOUT );
1084
+ 1 , ICM_RETRIES , ICM_TIMEOUT );
1085
1085
if (ret )
1086
1086
return ret ;
1087
1087
@@ -1110,7 +1110,7 @@ static int icm_tr_challenge_switch_key(struct tb *tb, struct tb_switch *sw,
1110
1110
1111
1111
memset (& reply , 0 , sizeof (reply ));
1112
1112
ret = icm_request (tb , & request , sizeof (request ), & reply , sizeof (reply ),
1113
- 1 , ICM_TIMEOUT );
1113
+ 1 , ICM_RETRIES , ICM_TIMEOUT );
1114
1114
if (ret )
1115
1115
return ret ;
1116
1116
@@ -1144,7 +1144,7 @@ static int icm_tr_approve_xdomain_paths(struct tb *tb, struct tb_xdomain *xd,
1144
1144
1145
1145
memset (& reply , 0 , sizeof (reply ));
1146
1146
ret = icm_request (tb , & request , sizeof (request ), & reply , sizeof (reply ),
1147
- 1 , ICM_TIMEOUT );
1147
+ 1 , ICM_RETRIES , ICM_TIMEOUT );
1148
1148
if (ret )
1149
1149
return ret ;
1150
1150
@@ -1170,7 +1170,7 @@ static int icm_tr_xdomain_tear_down(struct tb *tb, struct tb_xdomain *xd,
1170
1170
1171
1171
memset (& reply , 0 , sizeof (reply ));
1172
1172
ret = icm_request (tb , & request , sizeof (request ), & reply , sizeof (reply ),
1173
- 1 , ICM_TIMEOUT );
1173
+ 1 , ICM_RETRIES , ICM_TIMEOUT );
1174
1174
if (ret )
1175
1175
return ret ;
1176
1176
@@ -1496,7 +1496,7 @@ icm_ar_driver_ready(struct tb *tb, enum tb_security_level *security_level,
1496
1496
1497
1497
memset (& reply , 0 , sizeof (reply ));
1498
1498
ret = icm_request (tb , & request , sizeof (request ), & reply , sizeof (reply ),
1499
- 1 , ICM_TIMEOUT );
1499
+ 1 , ICM_RETRIES , ICM_TIMEOUT );
1500
1500
if (ret )
1501
1501
return ret ;
1502
1502
@@ -1522,7 +1522,7 @@ static int icm_ar_get_route(struct tb *tb, u8 link, u8 depth, u64 *route)
1522
1522
1523
1523
memset (& reply , 0 , sizeof (reply ));
1524
1524
ret = icm_request (tb , & request , sizeof (request ), & reply , sizeof (reply ),
1525
- 1 , ICM_TIMEOUT );
1525
+ 1 , ICM_RETRIES , ICM_TIMEOUT );
1526
1526
if (ret )
1527
1527
return ret ;
1528
1528
@@ -1543,7 +1543,7 @@ static int icm_ar_get_boot_acl(struct tb *tb, uuid_t *uuids, size_t nuuids)
1543
1543
1544
1544
memset (& reply , 0 , sizeof (reply ));
1545
1545
ret = icm_request (tb , & request , sizeof (request ), & reply , sizeof (reply ),
1546
- 1 , ICM_TIMEOUT );
1546
+ 1 , ICM_RETRIES , ICM_TIMEOUT );
1547
1547
if (ret )
1548
1548
return ret ;
1549
1549
@@ -1604,7 +1604,7 @@ static int icm_ar_set_boot_acl(struct tb *tb, const uuid_t *uuids,
1604
1604
1605
1605
memset (& reply , 0 , sizeof (reply ));
1606
1606
ret = icm_request (tb , & request , sizeof (request ), & reply , sizeof (reply ),
1607
- 1 , ICM_TIMEOUT );
1607
+ 1 , ICM_RETRIES , ICM_TIMEOUT );
1608
1608
if (ret )
1609
1609
return ret ;
1610
1610
@@ -1626,7 +1626,7 @@ icm_icl_driver_ready(struct tb *tb, enum tb_security_level *security_level,
1626
1626
1627
1627
memset (& reply , 0 , sizeof (reply ));
1628
1628
ret = icm_request (tb , & request , sizeof (request ), & reply , sizeof (reply ),
1629
- 1 , 20000 );
1629
+ 1 , ICM_RETRIES , 20000 );
1630
1630
if (ret )
1631
1631
return ret ;
1632
1632
@@ -2298,7 +2298,7 @@ static int icm_usb4_switch_op(struct tb_switch *sw, u16 opcode, u32 *metadata,
2298
2298
2299
2299
memset (& reply , 0 , sizeof (reply ));
2300
2300
ret = icm_request (tb , & request , sizeof (request ), & reply , sizeof (reply ),
2301
- 1 , ICM_TIMEOUT );
2301
+ 1 , ICM_RETRIES , ICM_TIMEOUT );
2302
2302
if (ret )
2303
2303
return ret ;
2304
2304
0 commit comments