Skip to content

Commit 60bcbc4

Browse files
committed
Merge branch 'net-smc-add-and-delete-link-processing'
Karsten Graul says: ==================== net/smc: add and delete link processing These patches add the 'add link' and 'delete link' processing as SMC server and client. This processing allows to establish and remove links of a link group dynamically. v2: Fix mess up with unused static functions. Merge patch 8 into patch 4. Postpone patch 13 to next series. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents d1a2250 + 4dadd15 commit 60bcbc4

File tree

7 files changed

+800
-43
lines changed

7 files changed

+800
-43
lines changed

net/smc/af_smc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ static int smcr_clnt_conf_first_link(struct smc_sock *smc)
427427
return rc;
428428
}
429429
smc_llc_flow_qentry_clr(&link->lgr->llc_flow_lcl);
430-
/* tbd: call smc_llc_cli_add_link(link, qentry); */
430+
smc_llc_cli_add_link(link, qentry);
431431
return 0;
432432
}
433433

@@ -1067,7 +1067,7 @@ static int smcr_serv_conf_first_link(struct smc_sock *smc)
10671067
smc_llc_link_active(link);
10681068

10691069
/* initial contact - try to establish second link */
1070-
/* tbd: call smc_llc_srv_add_link(link); */
1070+
smc_llc_srv_add_link(link);
10711071
return 0;
10721072
}
10731073

net/smc/smc_core.c

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,19 @@ static void smc_lgr_unregister_conn(struct smc_connection *conn)
193193
void smc_lgr_cleanup_early(struct smc_connection *conn)
194194
{
195195
struct smc_link_group *lgr = conn->lgr;
196+
struct list_head *lgr_list;
197+
spinlock_t *lgr_lock;
196198

197199
if (!lgr)
198200
return;
199201

200202
smc_conn_free(conn);
201-
smc_lgr_forget(lgr);
203+
lgr_list = smc_lgr_list_head(lgr, &lgr_lock);
204+
spin_lock_bh(lgr_lock);
205+
/* do not use this link group for new connections */
206+
if (!list_empty(lgr_list))
207+
list_del_init(lgr_list);
208+
spin_unlock_bh(lgr_lock);
202209
smc_lgr_schedule_free_work_fast(lgr);
203210
}
204211

@@ -273,8 +280,8 @@ static u8 smcr_next_link_id(struct smc_link_group *lgr)
273280
return link_id;
274281
}
275282

276-
static int smcr_link_init(struct smc_link_group *lgr, struct smc_link *lnk,
277-
u8 link_idx, struct smc_init_info *ini)
283+
int smcr_link_init(struct smc_link_group *lgr, struct smc_link *lnk,
284+
u8 link_idx, struct smc_init_info *ini)
278285
{
279286
u8 rndvec[3];
280287
int rc;
@@ -653,19 +660,6 @@ static void smc_lgr_free(struct smc_link_group *lgr)
653660
kfree(lgr);
654661
}
655662

656-
void smc_lgr_forget(struct smc_link_group *lgr)
657-
{
658-
struct list_head *lgr_list;
659-
spinlock_t *lgr_lock;
660-
661-
lgr_list = smc_lgr_list_head(lgr, &lgr_lock);
662-
spin_lock_bh(lgr_lock);
663-
/* do not use this link group for new connections */
664-
if (!list_empty(lgr_list))
665-
list_del_init(lgr_list);
666-
spin_unlock_bh(lgr_lock);
667-
}
668-
669663
static void smcd_unregister_all_dmbs(struct smc_link_group *lgr)
670664
{
671665
int i;
@@ -889,7 +883,7 @@ static void smcr_link_up(struct smc_link_group *lgr,
889883
link = smc_llc_usable_link(lgr);
890884
if (!link)
891885
return;
892-
/* tbd: call smc_llc_srv_add_link_local(link); */
886+
smc_llc_srv_add_link_local(link);
893887
} else {
894888
/* invite server to start add link processing */
895889
u8 gid[SMC_GID_SIZE];
@@ -960,6 +954,7 @@ static void smcr_link_down(struct smc_link *lnk)
960954

961955
if (lgr->role == SMC_SERV) {
962956
/* trigger local delete link processing */
957+
smc_llc_srv_delete_link_local(to_lnk, del_link_id);
963958
} else {
964959
if (lgr->llc_flow_lcl.type != SMC_LLC_FLOW_NONE) {
965960
/* another llc task is ongoing */

net/smc/smc_core.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ struct smc_link_group {
254254
struct mutex llc_conf_mutex;
255255
/* protects lgr reconfig. */
256256
struct work_struct llc_add_link_work;
257+
struct work_struct llc_del_link_work;
257258
struct work_struct llc_event_work;
258259
/* llc event worker */
259260
wait_queue_head_t llc_waiter;
@@ -343,7 +344,6 @@ struct smc_sock;
343344
struct smc_clc_msg_accept_confirm;
344345
struct smc_clc_msg_local;
345346

346-
void smc_lgr_forget(struct smc_link_group *lgr);
347347
void smc_lgr_cleanup_early(struct smc_connection *conn);
348348
void smc_lgr_terminate_sched(struct smc_link_group *lgr);
349349
void smcr_port_add(struct smc_ib_device *smcibdev, u8 ibport);
@@ -374,6 +374,8 @@ void smc_lgr_schedule_free_work_fast(struct smc_link_group *lgr);
374374
int smc_core_init(void);
375375
void smc_core_exit(void);
376376

377+
int smcr_link_init(struct smc_link_group *lgr, struct smc_link *lnk,
378+
u8 link_idx, struct smc_init_info *ini);
377379
void smcr_link_clear(struct smc_link *lnk);
378380
int smcr_buf_map_lgr(struct smc_link *lnk);
379381
int smcr_buf_reg_lgr(struct smc_link *lnk);

0 commit comments

Comments
 (0)