File tree Expand file tree Collapse file tree 4 files changed +30
-2
lines changed Expand file tree Collapse file tree 4 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -878,8 +878,11 @@ static void smc_lgr_cleanup(struct smc_link_group *lgr)
878
878
smc_ism_put_vlan (lgr -> smcd , lgr -> vlan_id );
879
879
put_device (& lgr -> smcd -> dev );
880
880
} else {
881
- smc_llc_send_link_delete_all (lgr , false,
882
- SMC_LLC_DEL_OP_INIT_TERM );
881
+ u32 rsn = lgr -> llc_termination_rsn ;
882
+
883
+ if (!rsn )
884
+ rsn = SMC_LLC_DEL_PROG_INIT_TERM ;
885
+ smc_llc_send_link_delete_all (lgr , false, rsn );
883
886
for (i = 0 ; i < SMC_LINKS_PER_LGR_MAX ; i ++ ) {
884
887
struct smc_link * lnk = & lgr -> lnk [i ];
885
888
@@ -1018,6 +1021,7 @@ void smc_smcr_terminate_all(struct smc_ib_device *smcibdev)
1018
1021
1019
1022
list_for_each_entry_safe (lgr , lg , & lgr_free_list , list ) {
1020
1023
list_del_init (& lgr -> list );
1024
+ smc_llc_set_termination_rsn (lgr , SMC_LLC_DEL_OP_INIT_TERM );
1021
1025
__smc_lgr_terminate (lgr , false);
1022
1026
}
1023
1027
Original file line number Diff line number Diff line change @@ -271,6 +271,8 @@ struct smc_link_group {
271
271
/* protects llc flow */
272
272
int llc_testlink_time ;
273
273
/* link keep alive time */
274
+ u32 llc_termination_rsn ;
275
+ /* rsn code for termination */
274
276
};
275
277
struct { /* SMC-D */
276
278
u64 peer_gid ;
Original file line number Diff line number Diff line change @@ -1420,6 +1420,14 @@ static void smc_llc_rmt_delete_rkey(struct smc_link_group *lgr)
1420
1420
smc_llc_flow_qentry_del (& lgr -> llc_flow_rmt );
1421
1421
}
1422
1422
1423
+ static void smc_llc_protocol_violation (struct smc_link_group * lgr , u8 type )
1424
+ {
1425
+ pr_warn_ratelimited ("smc: SMC-R lg %*phN LLC protocol violation: "
1426
+ "llc_type %d\n" , SMC_LGR_ID_SIZE , & lgr -> id , type );
1427
+ smc_llc_set_termination_rsn (lgr , SMC_LLC_DEL_PROT_VIOL );
1428
+ smc_lgr_terminate_sched (lgr );
1429
+ }
1430
+
1423
1431
/* flush the llc event queue */
1424
1432
static void smc_llc_event_flush (struct smc_link_group * lgr )
1425
1433
{
@@ -1520,6 +1528,9 @@ static void smc_llc_event_handler(struct smc_llc_qentry *qentry)
1520
1528
smc_llc_flow_stop (lgr , & lgr -> llc_flow_rmt );
1521
1529
}
1522
1530
return ;
1531
+ default :
1532
+ smc_llc_protocol_violation (lgr , llc -> raw .hdr .common .type );
1533
+ break ;
1523
1534
}
1524
1535
out :
1525
1536
kfree (qentry );
@@ -1579,6 +1590,9 @@ static void smc_llc_rx_response(struct smc_link *link,
1579
1590
case SMC_LLC_CONFIRM_RKEY_CONT :
1580
1591
/* not used because max links is 3 */
1581
1592
break ;
1593
+ default :
1594
+ smc_llc_protocol_violation (link -> lgr , llc_type );
1595
+ break ;
1582
1596
}
1583
1597
kfree (qentry );
1584
1598
}
Original file line number Diff line number Diff line change @@ -60,6 +60,14 @@ static inline struct smc_link *smc_llc_usable_link(struct smc_link_group *lgr)
60
60
return NULL ;
61
61
}
62
62
63
+ /* set the termination reason code for the link group */
64
+ static inline void smc_llc_set_termination_rsn (struct smc_link_group * lgr ,
65
+ u32 rsn )
66
+ {
67
+ if (!lgr -> llc_termination_rsn )
68
+ lgr -> llc_termination_rsn = rsn ;
69
+ }
70
+
63
71
/* transmit */
64
72
int smc_llc_send_confirm_link (struct smc_link * lnk ,
65
73
enum smc_llc_reqresp reqresp );
You can’t perform that action at this time.
0 commit comments