CFLAGS += -Wno-format-nonliteral
endif
+# Depends on rte_ring_elem_*()
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+
LDLIBS += -lrte_eal
LDLIBS += -lrte_mbuf
LDLIBS += -lrte_mempool
#include <rte_eventdev_pmd.h>
#include <rte_eventdev_pmd_vdev.h>
#include <rte_random.h>
+#include <rte_ring_elem.h>
#include "dsw_evdev.h"
snprintf(ring_name, sizeof(ring_name), "dswctl%d_p%u",
dev->data->dev_id, port_id);
- ctl_in_ring = rte_ring_create(ring_name, DSW_CTL_IN_RING_SIZE,
- dev->data->socket_id,
- RING_F_SC_DEQ|RING_F_EXACT_SZ);
+ ctl_in_ring = rte_ring_create_elem(ring_name,
+ sizeof(struct dsw_ctl_msg),
+ DSW_CTL_IN_RING_SIZE,
+ dev->data->socket_id,
+ RING_F_SC_DEQ|RING_F_EXACT_SZ);
if (ctl_in_ring == NULL) {
rte_event_ring_free(in_ring);
#define DSW_PMD_NAME RTE_STR(event_dsw)
-/* Code changes are required to allow more ports. */
#define DSW_MAX_PORTS (64)
#define DSW_MAX_PORT_DEQUEUE_DEPTH (128)
#define DSW_MAX_PORT_ENQUEUE_DEPTH (128)
#define DSW_CTL_UNPAUS_REQ (1)
#define DSW_CTL_CFM (2)
-/* sizeof(struct dsw_ctl_msg) must be equal or less than
- * sizeof(void *), to fit on the control ring.
- */
struct dsw_ctl_msg {
- uint8_t type:2;
- uint8_t originating_port_id:6;
+ uint8_t type;
+ uint8_t originating_port_id;
uint8_t queue_id;
uint16_t flow_hash;
-} __rte_packed;
+} __rte_aligned(4);
uint16_t dsw_event_enqueue(void *port, const struct rte_event *event);
uint16_t dsw_event_enqueue_burst(void *port,
static void
dsw_port_ctl_enqueue(struct dsw_port *port, struct dsw_ctl_msg *msg)
{
- void *raw_msg;
-
- memcpy(&raw_msg, msg, sizeof(*msg));
-
/* there's always room on the ring */
- while (rte_ring_enqueue(port->ctl_in_ring, raw_msg) != 0)
+ while (rte_ring_enqueue_elem(port->ctl_in_ring, msg, sizeof(*msg)) != 0)
rte_pause();
}
static int
dsw_port_ctl_dequeue(struct dsw_port *port, struct dsw_ctl_msg *msg)
{
- void *raw_msg;
- int rc;
-
- rc = rte_ring_dequeue(port->ctl_in_ring, &raw_msg);
-
- if (rc == 0)
- memcpy(msg, &raw_msg, sizeof(*msg));
-
- return rc;
+ return rte_ring_dequeue_elem(port->ctl_in_ring, msg, sizeof(*msg));
}
static void
cflags += '-Wno-format-nonliteral'
endif
sources = files('dsw_evdev.c', 'dsw_event.c', 'dsw_xstats.c')
+
+# Depends on rte_ring_elem_*()
+allow_experimental_apis = true