Skip to content

Commit 4dadd15

Browse files
karstengrdavem330
authored andcommitted
net/smc: enqueue local LLC messages
As SMC server, when a second link was deleted, trigger the setup of an asymmetric link. Do this by enqueueing a local ADD_LINK message which is processed by the LLC layer as if it were received from peer. Do the same when a new IB port became active and a new link could be created. smc_llc_srv_add_link_local() enqueues a local ADD_LINK message. And smc_llc_srv_delete_link_local() is used the same way to enqueue a local DELETE_LINK message. This is used when an IB port is no longer active. Signed-off-by: Karsten Graul <[email protected]> Reviewed-by: Ursula Braun <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 08ae27d commit 4dadd15

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

net/smc/smc_core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ static void smcr_link_up(struct smc_link_group *lgr,
883883
link = smc_llc_usable_link(lgr);
884884
if (!link)
885885
return;
886-
/* tbd: call smc_llc_srv_add_link_local(link); */
886+
smc_llc_srv_add_link_local(link);
887887
} else {
888888
/* invite server to start add link processing */
889889
u8 gid[SMC_GID_SIZE];
@@ -954,6 +954,7 @@ static void smcr_link_down(struct smc_link *lnk)
954954

955955
if (lgr->role == SMC_SERV) {
956956
/* trigger local delete link processing */
957+
smc_llc_srv_delete_link_local(to_lnk, del_link_id);
957958
} else {
958959
if (lgr->llc_flow_lcl.type != SMC_LLC_FLOW_NONE) {
959960
/* another llc task is ongoing */

net/smc/smc_llc.c

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ struct smc_llc_qentry {
159159
union smc_llc_msg msg;
160160
};
161161

162+
static void smc_llc_enqueue(struct smc_link *link, union smc_llc_msg *llc);
163+
162164
struct smc_llc_qentry *smc_llc_flow_qentry_clr(struct smc_llc_flow *flow)
163165
{
164166
struct smc_llc_qentry *qentry = flow->qentry;
@@ -1110,6 +1112,17 @@ static void smc_llc_process_srv_add_link(struct smc_link_group *lgr)
11101112
mutex_unlock(&lgr->llc_conf_mutex);
11111113
}
11121114

1115+
/* enqueue a local add_link req to trigger a new add_link flow, only as SERV */
1116+
void smc_llc_srv_add_link_local(struct smc_link *link)
1117+
{
1118+
struct smc_llc_msg_add_link add_llc = {0};
1119+
1120+
add_llc.hd.length = sizeof(add_llc);
1121+
add_llc.hd.common.type = SMC_LLC_ADD_LINK;
1122+
/* no dev and port needed, we as server ignore client data anyway */
1123+
smc_llc_enqueue(link, (union smc_llc_msg *)&add_llc);
1124+
}
1125+
11131126
/* worker to process an add link message */
11141127
static void smc_llc_add_link_work(struct work_struct *work)
11151128
{
@@ -1130,6 +1143,21 @@ static void smc_llc_add_link_work(struct work_struct *work)
11301143
smc_llc_flow_stop(lgr, &lgr->llc_flow_lcl);
11311144
}
11321145

1146+
/* enqueue a local del_link msg to trigger a new del_link flow,
1147+
* called only for role SMC_SERV
1148+
*/
1149+
void smc_llc_srv_delete_link_local(struct smc_link *link, u8 del_link_id)
1150+
{
1151+
struct smc_llc_msg_del_link del_llc = {0};
1152+
1153+
del_llc.hd.length = sizeof(del_llc);
1154+
del_llc.hd.common.type = SMC_LLC_DELETE_LINK;
1155+
del_llc.link_num = del_link_id;
1156+
del_llc.reason = htonl(SMC_LLC_DEL_LOST_PATH);
1157+
del_llc.hd.flags |= SMC_LLC_FLAG_DEL_LINK_ORDERLY;
1158+
smc_llc_enqueue(link, (union smc_llc_msg *)&del_llc);
1159+
}
1160+
11331161
static void smc_llc_process_cli_delete_link(struct smc_link_group *lgr)
11341162
{
11351163
struct smc_link *lnk_del = NULL, *lnk_asym, *lnk;
@@ -1250,7 +1278,7 @@ static void smc_llc_process_srv_delete_link(struct smc_link_group *lgr)
12501278

12511279
if (lgr->type == SMC_LGR_SINGLE && !list_empty(&lgr->list)) {
12521280
/* trigger setup of asymm alt link */
1253-
/* tbd: call smc_llc_srv_add_link_local(lnk); */
1281+
smc_llc_srv_add_link_local(lnk);
12541282
}
12551283
out:
12561284
mutex_unlock(&lgr->llc_conf_mutex);

net/smc/smc_llc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ int smc_llc_send_add_link(struct smc_link *link, u8 mac[], u8 gid[],
6969
int smc_llc_send_delete_link(struct smc_link *link, u8 link_del_id,
7070
enum smc_llc_reqresp reqresp, bool orderly,
7171
u32 reason);
72+
void smc_llc_srv_delete_link_local(struct smc_link *link, u8 del_link_id);
7273
void smc_llc_lgr_init(struct smc_link_group *lgr, struct smc_sock *smc);
7374
void smc_llc_lgr_clear(struct smc_link_group *lgr);
7475
int smc_llc_link_init(struct smc_link *link);
@@ -90,6 +91,7 @@ struct smc_llc_qentry *smc_llc_flow_qentry_clr(struct smc_llc_flow *flow);
9091
void smc_llc_flow_qentry_del(struct smc_llc_flow *flow);
9192
int smc_llc_cli_add_link(struct smc_link *link, struct smc_llc_qentry *qentry);
9293
int smc_llc_srv_add_link(struct smc_link *link);
94+
void smc_llc_srv_add_link_local(struct smc_link *link);
9395
int smc_llc_init(void) __init;
9496

9597
#endif /* SMC_LLC_H */

0 commit comments

Comments
 (0)