Skip to content

Commit 6511aad

Browse files
Hans Wippeldavem330
authored andcommitted
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: Hans Wippel <hwippel@linux.ibm.com> Signed-off-by: Ursula Braun <ubraun@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 8437bda commit 6511aad

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

net/smc/smc_core.c

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ static struct smc_lgr_list smc_lgr_list = { /* established link groups */
3636
.num = 0,
3737
};
3838

39-
static void smc_buf_free(struct smc_buf_desc *buf_desc, struct smc_link *lnk,
40-
bool is_rmb);
39+
static void smc_buf_free(struct smc_link_group *lgr, bool is_rmb,
40+
struct smc_buf_desc *buf_desc);
4141

4242
static void smc_lgr_schedule_free_work(struct smc_link_group *lgr)
4343
{
@@ -249,14 +249,12 @@ static void smc_buf_unuse(struct smc_connection *conn)
249249
} else {
250250
/* buf registration failed, reuse not possible */
251251
struct smc_link_group *lgr = conn->lgr;
252-
struct smc_link *lnk;
253252

254253
write_lock_bh(&lgr->rmbs_lock);
255254
list_del(&conn->rmb_desc->list);
256255
write_unlock_bh(&lgr->rmbs_lock);
257256

258-
lnk = &lgr->lnk[SMC_SINGLE_LINK];
259-
smc_buf_free(conn->rmb_desc, lnk, true);
257+
smc_buf_free(lgr, true, conn->rmb_desc);
260258
}
261259
}
262260
}
@@ -282,9 +280,11 @@ static void smc_link_clear(struct smc_link *lnk)
282280
smc_wr_free_link_mem(lnk);
283281
}
284282

285-
static void smc_buf_free(struct smc_buf_desc *buf_desc, struct smc_link *lnk,
286-
bool is_rmb)
283+
static void smc_buf_free(struct smc_link_group *lgr, bool is_rmb,
284+
struct smc_buf_desc *buf_desc)
287285
{
286+
struct smc_link *lnk = &lgr->lnk[SMC_SINGLE_LINK];
287+
288288
if (is_rmb) {
289289
if (buf_desc->mr_rx[SMC_SINGLE_LINK])
290290
smc_ib_put_memory_region(
@@ -303,7 +303,6 @@ static void smc_buf_free(struct smc_buf_desc *buf_desc, struct smc_link *lnk,
303303

304304
static void __smc_lgr_free_bufs(struct smc_link_group *lgr, bool is_rmb)
305305
{
306-
struct smc_link *lnk = &lgr->lnk[SMC_SINGLE_LINK];
307306
struct smc_buf_desc *buf_desc, *bf_desc;
308307
struct list_head *buf_list;
309308
int i;
@@ -316,7 +315,7 @@ static void __smc_lgr_free_bufs(struct smc_link_group *lgr, bool is_rmb)
316315
list_for_each_entry_safe(buf_desc, bf_desc, buf_list,
317316
list) {
318317
list_del(&buf_desc->list);
319-
smc_buf_free(buf_desc, lnk, is_rmb);
318+
smc_buf_free(lgr, is_rmb, buf_desc);
320319
}
321320
}
322321
}
@@ -627,7 +626,7 @@ static struct smc_buf_desc *smc_new_buf_create(struct smc_link_group *lgr,
627626
rc = sg_alloc_table(&buf_desc->sgt[SMC_SINGLE_LINK], 1,
628627
GFP_KERNEL);
629628
if (rc) {
630-
smc_buf_free(buf_desc, lnk, is_rmb);
629+
smc_buf_free(lgr, is_rmb, buf_desc);
631630
return ERR_PTR(rc);
632631
}
633632
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,
638637
is_rmb ? DMA_FROM_DEVICE : DMA_TO_DEVICE);
639638
/* SMC protocol depends on mapping to one DMA address only */
640639
if (rc != 1) {
641-
smc_buf_free(buf_desc, lnk, is_rmb);
640+
smc_buf_free(lgr, is_rmb, buf_desc);
642641
return ERR_PTR(-EAGAIN);
643642
}
644643

@@ -649,7 +648,7 @@ static struct smc_buf_desc *smc_new_buf_create(struct smc_link_group *lgr,
649648
IB_ACCESS_LOCAL_WRITE,
650649
buf_desc);
651650
if (rc) {
652-
smc_buf_free(buf_desc, lnk, is_rmb);
651+
smc_buf_free(lgr, is_rmb, buf_desc);
653652
return ERR_PTR(rc);
654653
}
655654
}
@@ -775,8 +774,7 @@ int smc_buf_create(struct smc_sock *smc)
775774
/* create rmb */
776775
rc = __smc_buf_create(smc, true);
777776
if (rc)
778-
smc_buf_free(smc->conn.sndbuf_desc,
779-
&smc->conn.lgr->lnk[SMC_SINGLE_LINK], false);
777+
smc_buf_free(smc->conn.lgr, false, smc->conn.sndbuf_desc);
780778
return rc;
781779
}
782780

0 commit comments

Comments
 (0)