Skip to content

Commit

Permalink
Merge branch 'net-smc-add-and-delete-link-processing'
Browse files Browse the repository at this point in the history
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 <davem@davemloft.net>
  • Loading branch information
David S. Miller committed May 3, 2020
2 parents d1a2250 + 4dadd15 commit 60bcbc4
Show file tree
Hide file tree
Showing 7 changed files with 800 additions and 43 deletions.
4 changes: 2 additions & 2 deletions net/smc/af_smc.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ static int smcr_clnt_conf_first_link(struct smc_sock *smc)
return rc;
}
smc_llc_flow_qentry_clr(&link->lgr->llc_flow_lcl);
/* tbd: call smc_llc_cli_add_link(link, qentry); */
smc_llc_cli_add_link(link, qentry);
return 0;
}

Expand Down Expand Up @@ -1067,7 +1067,7 @@ static int smcr_serv_conf_first_link(struct smc_sock *smc)
smc_llc_link_active(link);

/* initial contact - try to establish second link */
/* tbd: call smc_llc_srv_add_link(link); */
smc_llc_srv_add_link(link);
return 0;
}

Expand Down
29 changes: 12 additions & 17 deletions net/smc/smc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,19 @@ static void smc_lgr_unregister_conn(struct smc_connection *conn)
void smc_lgr_cleanup_early(struct smc_connection *conn)
{
struct smc_link_group *lgr = conn->lgr;
struct list_head *lgr_list;
spinlock_t *lgr_lock;

if (!lgr)
return;

smc_conn_free(conn);
smc_lgr_forget(lgr);
lgr_list = smc_lgr_list_head(lgr, &lgr_lock);
spin_lock_bh(lgr_lock);
/* do not use this link group for new connections */
if (!list_empty(lgr_list))
list_del_init(lgr_list);
spin_unlock_bh(lgr_lock);
smc_lgr_schedule_free_work_fast(lgr);
}

Expand Down Expand Up @@ -273,8 +280,8 @@ static u8 smcr_next_link_id(struct smc_link_group *lgr)
return link_id;
}

static int smcr_link_init(struct smc_link_group *lgr, struct smc_link *lnk,
u8 link_idx, struct smc_init_info *ini)
int smcr_link_init(struct smc_link_group *lgr, struct smc_link *lnk,
u8 link_idx, struct smc_init_info *ini)
{
u8 rndvec[3];
int rc;
Expand Down Expand Up @@ -653,19 +660,6 @@ static void smc_lgr_free(struct smc_link_group *lgr)
kfree(lgr);
}

void smc_lgr_forget(struct smc_link_group *lgr)
{
struct list_head *lgr_list;
spinlock_t *lgr_lock;

lgr_list = smc_lgr_list_head(lgr, &lgr_lock);
spin_lock_bh(lgr_lock);
/* do not use this link group for new connections */
if (!list_empty(lgr_list))
list_del_init(lgr_list);
spin_unlock_bh(lgr_lock);
}

static void smcd_unregister_all_dmbs(struct smc_link_group *lgr)
{
int i;
Expand Down Expand Up @@ -889,7 +883,7 @@ static void smcr_link_up(struct smc_link_group *lgr,
link = smc_llc_usable_link(lgr);
if (!link)
return;
/* tbd: call smc_llc_srv_add_link_local(link); */
smc_llc_srv_add_link_local(link);
} else {
/* invite server to start add link processing */
u8 gid[SMC_GID_SIZE];
Expand Down Expand Up @@ -960,6 +954,7 @@ static void smcr_link_down(struct smc_link *lnk)

if (lgr->role == SMC_SERV) {
/* trigger local delete link processing */
smc_llc_srv_delete_link_local(to_lnk, del_link_id);
} else {
if (lgr->llc_flow_lcl.type != SMC_LLC_FLOW_NONE) {
/* another llc task is ongoing */
Expand Down
4 changes: 3 additions & 1 deletion net/smc/smc_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ struct smc_link_group {
struct mutex llc_conf_mutex;
/* protects lgr reconfig. */
struct work_struct llc_add_link_work;
struct work_struct llc_del_link_work;
struct work_struct llc_event_work;
/* llc event worker */
wait_queue_head_t llc_waiter;
Expand Down Expand Up @@ -343,7 +344,6 @@ struct smc_sock;
struct smc_clc_msg_accept_confirm;
struct smc_clc_msg_local;

void smc_lgr_forget(struct smc_link_group *lgr);
void smc_lgr_cleanup_early(struct smc_connection *conn);
void smc_lgr_terminate_sched(struct smc_link_group *lgr);
void smcr_port_add(struct smc_ib_device *smcibdev, u8 ibport);
Expand Down Expand Up @@ -374,6 +374,8 @@ void smc_lgr_schedule_free_work_fast(struct smc_link_group *lgr);
int smc_core_init(void);
void smc_core_exit(void);

int smcr_link_init(struct smc_link_group *lgr, struct smc_link *lnk,
u8 link_idx, struct smc_init_info *ini);
void smcr_link_clear(struct smc_link *lnk);
int smcr_buf_map_lgr(struct smc_link *lnk);
int smcr_buf_reg_lgr(struct smc_link *lnk);
Expand Down
Loading

0 comments on commit 60bcbc4

Please sign in to comment.