Commit ab7269b7 authored by Krzysztof Goreczny's avatar Krzysztof Goreczny Committed by Tomasz Zawadzki
Browse files

util: Add API that allows to select interrupt event type



New API call spdk_fd_group_add_for_events() - variant of
spdk_fd_group_add() with additional event type argument.

It's needed to use interrupt mode also on events other than the
SPDK_INTERRUPT_EVENT_IN.

Change-Id: I2b6a85bcfe2637a38bdc30f6de69f3ef16aa9cde
Signed-off-by: default avatarKrzysztof Goreczny <krzysztof.goreczny@dell.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/22745


Reviewed-by: default avatarBoris Glimcher <Boris.Glimcher@emc.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarAbhineet Pandey <abhineet.pandey@nutanix.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
parent fa2efdfb
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2,6 +2,12 @@

## v24.09: (Upcoming Release)

### util

New function `spdk_fd_group_add_for_events()` was added alongside the existing `spdk_fd_group_add()`.
Difference is that new API allows for specifying a set of events to be monitored instead of default
SPDK_INTERRUPT_EVENT_IN.

### nvmf

Added public API 'spdk_nvmf_subsystem_set_cntlid_range' to set controller ID
+21 −1
Original line number Diff line number Diff line
@@ -100,7 +100,9 @@ int spdk_fd_group_nest(struct spdk_fd_group *parent, struct spdk_fd_group *child
int spdk_fd_group_unnest(struct spdk_fd_group *parent, struct spdk_fd_group *child);

/**
 * Register one event source to specified fgrp.
 * Register SPDK_INTERRUPT_EVENT_IN event source to specified fgrp.
 *
 * Use spdk_fd_group_add_for_events() for other event types.
 *
 * \param fgrp The fgrp registered to.
 * \param efd File descriptor of the event source.
@@ -113,6 +115,24 @@ int spdk_fd_group_unnest(struct spdk_fd_group *parent, struct spdk_fd_group *chi
int spdk_fd_group_add(struct spdk_fd_group *fgrp, int efd,
		      spdk_fd_fn fn, void *arg, const char *name);

/**
 * Register one event source to specified fgrp with specific event types.
 *
 * Event types argument is a bit mask composed by ORing together
 * enum spdk_interrupt_event_types values.
 *
 * \param fgrp The fgrp registered to.
 * \param efd File descriptor of the event source.
 * \param events Event notification types.
 * \param fn Called each time there are events in event source.
 * \param arg Function argument for fn.
 * \param name Name of the event source.
 *
 * \return 0 if success or -errno if failed
 */
int spdk_fd_group_add_for_events(struct spdk_fd_group *fgrp, int efd, uint32_t events,
				 spdk_fd_fn fn, void *arg,  const char *name);

/*
 * \brief Register an event source with the name set to the string of the
 * callback function.
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk

SO_VER := 9
SO_MINOR := 0
SO_MINOR := 1

C_SRCS = base64.c bit_array.c cpuset.c crc16.c crc32.c crc32c.c crc32_ieee.c crc64.c \
	 dif.c fd.c file.c hexlify.c iov.c math.c pipe.c strerror_tls.c string.c uuid.c \
+15 −1
Original line number Diff line number Diff line
@@ -227,6 +227,13 @@ spdk_fd_group_nest(struct spdk_fd_group *parent, struct spdk_fd_group *child)
int
spdk_fd_group_add(struct spdk_fd_group *fgrp, int efd, spdk_fd_fn fn,
		  void *arg, const char *name)
{
	return spdk_fd_group_add_for_events(fgrp, efd, EPOLLIN, fn, arg, name);
}

int
spdk_fd_group_add_for_events(struct spdk_fd_group *fgrp, int efd, uint32_t events,
			     spdk_fd_fn fn, void *arg, const char *name)
{
	struct event_handler *ehdlr = NULL;
	struct epoll_event epevent = {0};
@@ -255,7 +262,7 @@ spdk_fd_group_add(struct spdk_fd_group *fgrp, int efd, spdk_fd_fn fn,
	ehdlr->fn = fn;
	ehdlr->fn_arg = arg;
	ehdlr->state = EVENT_HANDLER_STATE_WAITING;
	ehdlr->events = EPOLLIN;
	ehdlr->events = events;
	snprintf(ehdlr->name, sizeof(ehdlr->name), "%s", name);

	if (fgrp->parent) {
@@ -506,6 +513,13 @@ spdk_fd_group_add(struct spdk_fd_group *fgrp, int efd, spdk_fd_fn fn,
	return -ENOTSUP;
}

int
spdk_fd_group_add_for_events(struct spdk_fd_group *fgrp, int efd, uint32_t events, spdk_fd_fn fn,
			     void *arg, const char *name)
{
	return -ENOTSUP;
}

void
spdk_fd_group_remove(struct spdk_fd_group *fgrp, int efd)
{
+1 −0
Original line number Diff line number Diff line
@@ -174,6 +174,7 @@
	spdk_fd_group_get_epoll_event;
	spdk_fd_group_wait;
	spdk_fd_group_add;
	spdk_fd_group_add_for_events;
	spdk_fd_group_remove;
	spdk_fd_group_event_modify;
	spdk_fd_group_get_fd;