Commit 6511aad3 authored by Hans Wippel's avatar Hans Wippel Committed by David S. Miller

net/smc: change smc_buf_free function parameters

This patch changes the function smc_buf_free to use the SMC link group
instead of the link as function parameter. Also, it changes the order of
the other two parameters.
Signed-off-by: default avatarHans Wippel <hwippel@linux.ibm.com>
Signed-off-by: default avatarUrsula Braun <ubraun@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8437bda0
...@@ -36,8 +36,8 @@ static struct smc_lgr_list smc_lgr_list = { /* established link groups */ ...@@ -36,8 +36,8 @@ static struct smc_lgr_list smc_lgr_list = { /* established link groups */
.num = 0, .num = 0,
}; };
static void smc_buf_free(struct smc_buf_desc *buf_desc, struct smc_link *lnk, static void smc_buf_free(struct smc_link_group *lgr, bool is_rmb,
bool is_rmb); struct smc_buf_desc *buf_desc);
static void smc_lgr_schedule_free_work(struct smc_link_group *lgr) static void smc_lgr_schedule_free_work(struct smc_link_group *lgr)
{ {
...@@ -249,14 +249,12 @@ static void smc_buf_unuse(struct smc_connection *conn) ...@@ -249,14 +249,12 @@ static void smc_buf_unuse(struct smc_connection *conn)
} else { } else {
/* buf registration failed, reuse not possible */ /* buf registration failed, reuse not possible */
struct smc_link_group *lgr = conn->lgr; struct smc_link_group *lgr = conn->lgr;
struct smc_link *lnk;
write_lock_bh(&lgr->rmbs_lock); write_lock_bh(&lgr->rmbs_lock);
list_del(&conn->rmb_desc->list); list_del(&conn->rmb_desc->list);
write_unlock_bh(&lgr->rmbs_lock); write_unlock_bh(&lgr->rmbs_lock);
lnk = &lgr->lnk[SMC_SINGLE_LINK]; smc_buf_free(lgr, true, conn->rmb_desc);
smc_buf_free(conn->rmb_desc, lnk, true);
} }
} }
} }
...@@ -282,9 +280,11 @@ static void smc_link_clear(struct smc_link *lnk) ...@@ -282,9 +280,11 @@ static void smc_link_clear(struct smc_link *lnk)
smc_wr_free_link_mem(lnk); smc_wr_free_link_mem(lnk);
} }
static void smc_buf_free(struct smc_buf_desc *buf_desc, struct smc_link *lnk, static void smc_buf_free(struct smc_link_group *lgr, bool is_rmb,
bool is_rmb) struct smc_buf_desc *buf_desc)
{ {
struct smc_link *lnk = &lgr->lnk[SMC_SINGLE_LINK];
if (is_rmb) { if (is_rmb) {
if (buf_desc->mr_rx[SMC_SINGLE_LINK]) if (buf_desc->mr_rx[SMC_SINGLE_LINK])
smc_ib_put_memory_region( smc_ib_put_memory_region(
...@@ -303,7 +303,6 @@ static void smc_buf_free(struct smc_buf_desc *buf_desc, struct smc_link *lnk, ...@@ -303,7 +303,6 @@ static void smc_buf_free(struct smc_buf_desc *buf_desc, struct smc_link *lnk,
static void __smc_lgr_free_bufs(struct smc_link_group *lgr, bool is_rmb) static void __smc_lgr_free_bufs(struct smc_link_group *lgr, bool is_rmb)
{ {
struct smc_link *lnk = &lgr->lnk[SMC_SINGLE_LINK];
struct smc_buf_desc *buf_desc, *bf_desc; struct smc_buf_desc *buf_desc, *bf_desc;
struct list_head *buf_list; struct list_head *buf_list;
int i; int i;
...@@ -316,7 +315,7 @@ static void __smc_lgr_free_bufs(struct smc_link_group *lgr, bool is_rmb) ...@@ -316,7 +315,7 @@ static void __smc_lgr_free_bufs(struct smc_link_group *lgr, bool is_rmb)
list_for_each_entry_safe(buf_desc, bf_desc, buf_list, list_for_each_entry_safe(buf_desc, bf_desc, buf_list,
list) { list) {
list_del(&buf_desc->list); list_del(&buf_desc->list);
smc_buf_free(buf_desc, lnk, is_rmb); smc_buf_free(lgr, is_rmb, buf_desc);
} }
} }
} }
...@@ -627,7 +626,7 @@ static struct smc_buf_desc *smc_new_buf_create(struct smc_link_group *lgr, ...@@ -627,7 +626,7 @@ static struct smc_buf_desc *smc_new_buf_create(struct smc_link_group *lgr,
rc = sg_alloc_table(&buf_desc->sgt[SMC_SINGLE_LINK], 1, rc = sg_alloc_table(&buf_desc->sgt[SMC_SINGLE_LINK], 1,
GFP_KERNEL); GFP_KERNEL);
if (rc) { if (rc) {
smc_buf_free(buf_desc, lnk, is_rmb); smc_buf_free(lgr, is_rmb, buf_desc);
return ERR_PTR(rc); return ERR_PTR(rc);
} }
sg_set_buf(buf_desc->sgt[SMC_SINGLE_LINK].sgl, sg_set_buf(buf_desc->sgt[SMC_SINGLE_LINK].sgl,
...@@ -638,7 +637,7 @@ static struct smc_buf_desc *smc_new_buf_create(struct smc_link_group *lgr, ...@@ -638,7 +637,7 @@ static struct smc_buf_desc *smc_new_buf_create(struct smc_link_group *lgr,
is_rmb ? DMA_FROM_DEVICE : DMA_TO_DEVICE); is_rmb ? DMA_FROM_DEVICE : DMA_TO_DEVICE);
/* SMC protocol depends on mapping to one DMA address only */ /* SMC protocol depends on mapping to one DMA address only */
if (rc != 1) { if (rc != 1) {
smc_buf_free(buf_desc, lnk, is_rmb); smc_buf_free(lgr, is_rmb, buf_desc);
return ERR_PTR(-EAGAIN); return ERR_PTR(-EAGAIN);
} }
...@@ -649,7 +648,7 @@ static struct smc_buf_desc *smc_new_buf_create(struct smc_link_group *lgr, ...@@ -649,7 +648,7 @@ static struct smc_buf_desc *smc_new_buf_create(struct smc_link_group *lgr,
IB_ACCESS_LOCAL_WRITE, IB_ACCESS_LOCAL_WRITE,
buf_desc); buf_desc);
if (rc) { if (rc) {
smc_buf_free(buf_desc, lnk, is_rmb); smc_buf_free(lgr, is_rmb, buf_desc);
return ERR_PTR(rc); return ERR_PTR(rc);
} }
} }
...@@ -775,8 +774,7 @@ int smc_buf_create(struct smc_sock *smc) ...@@ -775,8 +774,7 @@ int smc_buf_create(struct smc_sock *smc)
/* create rmb */ /* create rmb */
rc = __smc_buf_create(smc, true); rc = __smc_buf_create(smc, true);
if (rc) if (rc)
smc_buf_free(smc->conn.sndbuf_desc, smc_buf_free(smc->conn.lgr, false, smc->conn.sndbuf_desc);
&smc->conn.lgr->lnk[SMC_SINGLE_LINK], false);
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment