net/smc: increase device refcount for added link group
SMCD link groups belong to certain ISM-devices and SMCR link group links belong to certain IB-devices. Increase the refcount for these devices, as long as corresponding link groups exist. Signed-off-by: Ursula Braun <ubraun@linux.ibm.com> Signed-off-by: Karsten Graul <kgraul@linux.ibm.com> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
This commit is contained in:
Родитель
a0a62ee15a
Коммит
b3cb53c05f
|
@ -248,12 +248,14 @@ static int smc_lgr_create(struct smc_sock *smc, struct smc_init_info *ini)
|
|||
lgr->conns_all = RB_ROOT;
|
||||
if (ini->is_smcd) {
|
||||
/* SMC-D specific settings */
|
||||
get_device(&ini->ism_dev->dev);
|
||||
lgr->peer_gid = ini->ism_gid;
|
||||
lgr->smcd = ini->ism_dev;
|
||||
lgr_list = &ini->ism_dev->lgr_list;
|
||||
lgr_lock = &lgr->smcd->lgr_lock;
|
||||
} else {
|
||||
/* SMC-R specific settings */
|
||||
get_device(&ini->ib_dev->ibdev->dev);
|
||||
lgr->role = smc->listen_smc ? SMC_SERV : SMC_CLNT;
|
||||
memcpy(lgr->peer_systemid, ini->ib_lcl->id_for_peer,
|
||||
SMC_SYSTEMID_LEN);
|
||||
|
@ -451,10 +453,13 @@ static void smc_lgr_free_bufs(struct smc_link_group *lgr)
|
|||
static void smc_lgr_free(struct smc_link_group *lgr)
|
||||
{
|
||||
smc_lgr_free_bufs(lgr);
|
||||
if (lgr->is_smcd)
|
||||
if (lgr->is_smcd) {
|
||||
smc_ism_put_vlan(lgr->smcd, lgr->vlan_id);
|
||||
else
|
||||
put_device(&lgr->smcd->dev);
|
||||
} else {
|
||||
smc_link_clear(&lgr->lnk[SMC_SINGLE_LINK]);
|
||||
put_device(&lgr->lnk[SMC_SINGLE_LINK].smcibdev->ibdev->dev);
|
||||
}
|
||||
kfree(lgr);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче