| .. | .. |
|---|
| 28 | 28 | enum smc_llc_msg_type { |
|---|
| 29 | 29 | SMC_LLC_CONFIRM_LINK = 0x01, |
|---|
| 30 | 30 | SMC_LLC_ADD_LINK = 0x02, |
|---|
| 31 | + SMC_LLC_ADD_LINK_CONT = 0x03, |
|---|
| 31 | 32 | SMC_LLC_DELETE_LINK = 0x04, |
|---|
| 32 | 33 | SMC_LLC_CONFIRM_RKEY = 0x06, |
|---|
| 33 | 34 | SMC_LLC_TEST_LINK = 0x07, |
|---|
| .. | .. |
|---|
| 35 | 36 | SMC_LLC_DELETE_RKEY = 0x09, |
|---|
| 36 | 37 | }; |
|---|
| 37 | 38 | |
|---|
| 39 | +#define smc_link_downing(state) \ |
|---|
| 40 | + (cmpxchg(state, SMC_LNK_ACTIVE, SMC_LNK_INACTIVE) == SMC_LNK_ACTIVE) |
|---|
| 41 | + |
|---|
| 42 | +/* LLC DELETE LINK Request Reason Codes */ |
|---|
| 43 | +#define SMC_LLC_DEL_LOST_PATH 0x00010000 |
|---|
| 44 | +#define SMC_LLC_DEL_OP_INIT_TERM 0x00020000 |
|---|
| 45 | +#define SMC_LLC_DEL_PROG_INIT_TERM 0x00030000 |
|---|
| 46 | +#define SMC_LLC_DEL_PROT_VIOL 0x00040000 |
|---|
| 47 | +#define SMC_LLC_DEL_NO_ASYM_NEEDED 0x00050000 |
|---|
| 48 | +/* LLC DELETE LINK Response Reason Codes */ |
|---|
| 49 | +#define SMC_LLC_DEL_NOLNK 0x00100000 /* Unknown Link ID (no link) */ |
|---|
| 50 | +#define SMC_LLC_DEL_NOLGR 0x00200000 /* Unknown Link Group */ |
|---|
| 51 | + |
|---|
| 52 | +/* returns a usable link of the link group, or NULL */ |
|---|
| 53 | +static inline struct smc_link *smc_llc_usable_link(struct smc_link_group *lgr) |
|---|
| 54 | +{ |
|---|
| 55 | + int i; |
|---|
| 56 | + |
|---|
| 57 | + for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) |
|---|
| 58 | + if (smc_link_usable(&lgr->lnk[i])) |
|---|
| 59 | + return &lgr->lnk[i]; |
|---|
| 60 | + return NULL; |
|---|
| 61 | +} |
|---|
| 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 | + |
|---|
| 38 | 71 | /* transmit */ |
|---|
| 39 | 72 | int smc_llc_send_confirm_link(struct smc_link *lnk, |
|---|
| 40 | 73 | enum smc_llc_reqresp reqresp); |
|---|
| 41 | 74 | int smc_llc_send_add_link(struct smc_link *link, u8 mac[], u8 gid[], |
|---|
| 75 | + struct smc_link *link_new, |
|---|
| 42 | 76 | enum smc_llc_reqresp reqresp); |
|---|
| 43 | | -int smc_llc_send_delete_link(struct smc_link *link, |
|---|
| 44 | | - enum smc_llc_reqresp reqresp, bool orderly); |
|---|
| 77 | +int smc_llc_send_delete_link(struct smc_link *link, u8 link_del_id, |
|---|
| 78 | + enum smc_llc_reqresp reqresp, bool orderly, |
|---|
| 79 | + u32 reason); |
|---|
| 80 | +void smc_llc_srv_delete_link_local(struct smc_link *link, u8 del_link_id); |
|---|
| 81 | +void smc_llc_lgr_init(struct smc_link_group *lgr, struct smc_sock *smc); |
|---|
| 82 | +void smc_llc_lgr_clear(struct smc_link_group *lgr); |
|---|
| 45 | 83 | int smc_llc_link_init(struct smc_link *link); |
|---|
| 46 | | -void smc_llc_link_active(struct smc_link *link, int testlink_time); |
|---|
| 47 | | -void smc_llc_link_deleting(struct smc_link *link); |
|---|
| 48 | | -void smc_llc_link_inactive(struct smc_link *link); |
|---|
| 49 | | -void smc_llc_link_clear(struct smc_link *link); |
|---|
| 50 | | -int smc_llc_do_confirm_rkey(struct smc_link *link, |
|---|
| 84 | +void smc_llc_link_active(struct smc_link *link); |
|---|
| 85 | +void smc_llc_link_clear(struct smc_link *link, bool log); |
|---|
| 86 | +int smc_llc_do_confirm_rkey(struct smc_link *send_link, |
|---|
| 51 | 87 | struct smc_buf_desc *rmb_desc); |
|---|
| 88 | +int smc_llc_do_delete_rkey(struct smc_link_group *lgr, |
|---|
| 89 | + struct smc_buf_desc *rmb_desc); |
|---|
| 90 | +int smc_llc_flow_initiate(struct smc_link_group *lgr, |
|---|
| 91 | + enum smc_llc_flowtype type); |
|---|
| 92 | +void smc_llc_flow_stop(struct smc_link_group *lgr, struct smc_llc_flow *flow); |
|---|
| 93 | +int smc_llc_eval_conf_link(struct smc_llc_qentry *qentry, |
|---|
| 94 | + enum smc_llc_reqresp type); |
|---|
| 95 | +void smc_llc_link_set_uid(struct smc_link *link); |
|---|
| 96 | +void smc_llc_save_peer_uid(struct smc_llc_qentry *qentry); |
|---|
| 97 | +struct smc_llc_qentry *smc_llc_wait(struct smc_link_group *lgr, |
|---|
| 98 | + struct smc_link *lnk, |
|---|
| 99 | + int time_out, u8 exp_msg); |
|---|
| 100 | +struct smc_llc_qentry *smc_llc_flow_qentry_clr(struct smc_llc_flow *flow); |
|---|
| 101 | +void smc_llc_flow_qentry_del(struct smc_llc_flow *flow); |
|---|
| 102 | +void smc_llc_send_link_delete_all(struct smc_link_group *lgr, bool ord, |
|---|
| 103 | + u32 rsn); |
|---|
| 104 | +int smc_llc_cli_add_link(struct smc_link *link, struct smc_llc_qentry *qentry); |
|---|
| 105 | +int smc_llc_srv_add_link(struct smc_link *link); |
|---|
| 106 | +void smc_llc_add_link_local(struct smc_link *link); |
|---|
| 52 | 107 | int smc_llc_init(void) __init; |
|---|
| 53 | 108 | |
|---|
| 54 | 109 | #endif /* SMC_LLC_H */ |
|---|