iscsi: convert acceptor timer to SPDK poller

Change-Id: I36dc81fd1d2240d925963a69f6a49fac51c50556
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-08-04 09:36:19 -07:00
parent c48df8950a
commit 268ee865ab

View File

@ -38,20 +38,16 @@
#include <sys/types.h> #include <sys/types.h>
#include <rte_config.h> #include "spdk/event.h"
#include <rte_lcore.h>
#include <rte_cycles.h>
#include <rte_timer.h>
#include "spdk/log.h" #include "spdk/log.h"
#include "spdk/net.h" #include "spdk/net.h"
#include "iscsi/acceptor.h" #include "iscsi/acceptor.h"
#include "iscsi/conn.h" #include "iscsi/conn.h"
#include "iscsi/portal_grp.h" #include "iscsi/portal_grp.h"
#define ACCEPT_TIMEOUT (rte_get_timer_hz() >> 10) /* ~1ms */ #define ACCEPT_TIMEOUT_US 1000 /* 1ms */
static struct rte_timer g_acceptor_timer; static struct spdk_poller g_acceptor_poller;
/*! \file /*! \file
@ -86,7 +82,7 @@ spdk_iscsi_portal_accept(struct spdk_iscsi_portal *portal)
} }
static void static void
spdk_acceptor(struct rte_timer *timer, void *arg) spdk_acceptor(void *arg)
{ {
struct spdk_iscsi_globals *iscsi = arg; struct spdk_iscsi_globals *iscsi = arg;
struct spdk_iscsi_portal_grp *portal_group; struct spdk_iscsi_portal_grp *portal_group;
@ -102,13 +98,13 @@ spdk_acceptor(struct rte_timer *timer, void *arg)
void void
spdk_iscsi_acceptor_start(void) spdk_iscsi_acceptor_start(void)
{ {
rte_timer_init(&g_acceptor_timer); g_acceptor_poller.fn = spdk_acceptor;
rte_timer_reset(&g_acceptor_timer, ACCEPT_TIMEOUT, PERIODICAL, g_acceptor_poller.arg = &g_spdk_iscsi;
rte_lcore_id(), spdk_acceptor, &g_spdk_iscsi); spdk_poller_register(&g_acceptor_poller, spdk_app_get_current_core(), NULL, ACCEPT_TIMEOUT_US);
} }
void void
spdk_iscsi_acceptor_stop(void) spdk_iscsi_acceptor_stop(void)
{ {
rte_timer_stop_sync(&g_acceptor_timer); spdk_poller_unregister(&g_acceptor_poller, NULL);
} }