From 355806b5d518403077766584eeda8633e510d06c Mon Sep 17 00:00:00 2001 From: Alexey Marchuk Date: Fri, 14 Jan 2022 14:46:56 +0300 Subject: [PATCH] nvmf: Use acceptor_poll_rate value from func args Acceptor poller is registered using rate value from transport opts structure, but this structure is initialized on generic transport layer when create() function completes, so at this time acceptor poll rate is 0. Signed-off-by: Alexey Marchuk Change-Id: I2138825f3ff9dd3cc0ccaa65e8d5c23aab338ad4 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11095 Tested-by: SPDK CI Jenkins Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Reviewed-by: Jim Harris Reviewed-by: Anil Veerabhadrappa Reviewed-by: Ben Walker --- lib/nvmf/fc.c | 3 ++- lib/nvmf/rdma.c | 4 ++-- lib/nvmf/tcp.c | 4 +++- lib/nvmf/vfio_user.c | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/nvmf/fc.c b/lib/nvmf/fc.c index 8aff65e84..9f42662eb 100644 --- a/lib/nvmf/fc.c +++ b/lib/nvmf/fc.c @@ -3,6 +3,7 @@ * * Copyright (c) 2018-2019 Broadcom. All Rights Reserved. * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. + * Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -2010,7 +2011,7 @@ nvmf_fc_create(struct spdk_nvmf_transport_opts *opts) } g_nvmf_ftransport->accept_poller = SPDK_POLLER_REGISTER(nvmf_fc_accept, - &g_nvmf_ftransport->transport, g_nvmf_ftransport->transport.opts.acceptor_poll_rate); + &g_nvmf_ftransport->transport, opts->acceptor_poll_rate); if (!g_nvmf_ftransport->accept_poller) { free(g_nvmf_ftransport); g_nvmf_ftransport = NULL; diff --git a/lib/nvmf/rdma.c b/lib/nvmf/rdma.c index b6eae7100..c20c9e0da 100644 --- a/lib/nvmf/rdma.c +++ b/lib/nvmf/rdma.c @@ -3,7 +3,7 @@ * * Copyright (c) Intel Corporation. All rights reserved. * Copyright (c) 2019-2021 Mellanox Technologies LTD. All rights reserved. - * Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2021, 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -2460,7 +2460,7 @@ nvmf_rdma_create(struct spdk_nvmf_transport_opts *opts) } rtransport->accept_poller = SPDK_POLLER_REGISTER(nvmf_rdma_accept, &rtransport->transport, - rtransport->transport.opts.acceptor_poll_rate); + opts->acceptor_poll_rate); if (!rtransport->accept_poller) { nvmf_rdma_destroy(&rtransport->transport, NULL, NULL); return NULL; diff --git a/lib/nvmf/tcp.c b/lib/nvmf/tcp.c index e09d058b0..ebf47ba59 100644 --- a/lib/nvmf/tcp.c +++ b/lib/nvmf/tcp.c @@ -3,6 +3,7 @@ * * Copyright (c) Intel Corporation. All rights reserved. * Copyright (c) 2019, 2020 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -675,8 +676,9 @@ nvmf_tcp_create(struct spdk_nvmf_transport_opts *opts) pthread_mutex_init(&ttransport->lock, NULL); ttransport->accept_poller = SPDK_POLLER_REGISTER(nvmf_tcp_accept, &ttransport->transport, - ttransport->transport.opts.acceptor_poll_rate); + opts->acceptor_poll_rate); if (!ttransport->accept_poller) { + pthread_mutex_destroy(&ttransport->lock); free(ttransport); return NULL; } diff --git a/lib/nvmf/vfio_user.c b/lib/nvmf/vfio_user.c index b96a3312d..d3dd3e7fc 100644 --- a/lib/nvmf/vfio_user.c +++ b/lib/nvmf/vfio_user.c @@ -2,6 +2,7 @@ * BSD LICENSE * Copyright (c) Intel Corporation. All rights reserved. * Copyright (c) 2019, Nutanix Inc. All rights reserved. + * Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -612,7 +613,7 @@ nvmf_vfio_user_create(struct spdk_nvmf_transport_opts *opts) } vu_transport->accept_poller = SPDK_POLLER_REGISTER(nvmf_vfio_user_accept, &vu_transport->transport, - vu_transport->transport.opts.acceptor_poll_rate); + opts->acceptor_poll_rate); if (!vu_transport->accept_poller) { free(vu_transport); return NULL;