From: Jerin Jacob Date: Fri, 3 Mar 2017 17:27:57 +0000 (+0530) Subject: event/octeontx: support dequeue timeout tick conversion X-Git-Tag: spdx-start~3818 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=613c702771d440465c0661b600d74ff98c2e505e;p=dpdk.git event/octeontx: support dequeue timeout tick conversion SSO co-processor runs at a different frequency than core clock. Request PF to convert the ns to SSO get_work timeout period. On dequeue, If device is configured with RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT configuration then use different fast path dequeue handler to wait till requested amount of nanosecond if the event is not available. Signed-off-by: Jerin Jacob Signed-off-by: Santosh Shukla Acked-by: Gage Eads --- diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c index 364755b813..c31d259c2b 100644 --- a/drivers/event/octeontx/ssovf_evdev.c +++ b/drivers/event/octeontx/ssovf_evdev.c @@ -119,6 +119,35 @@ ssovf_mbox_priority_set(uint8_t queue, uint8_t prio) return ret; } +struct ssovf_mbox_convert_ns_getworks_iter { + uint64_t wait_ns; + uint32_t getwork_iter;/* Get_work iterations for the given wait_ns */ +}; + +static int +ssovf_mbox_timeout_ticks(uint64_t ns, uint64_t *tmo_ticks) +{ + struct octeontx_mbox_hdr hdr = {0}; + struct ssovf_mbox_convert_ns_getworks_iter ns2iter; + uint16_t len = sizeof(ns2iter); + int ret; + + hdr.coproc = SSO_COPROC; + hdr.msg = SSO_CONVERT_NS_GETWORK_ITER; + hdr.vfid = 0; + + memset(&ns2iter, 0, len); + ns2iter.wait_ns = ns; + ret = octeontx_ssovf_mbox_send(&hdr, &ns2iter, len, &ns2iter, len); + if (ret < 0 || (ret != len)) { + ssovf_log_err("Failed to get tmo ticks ns=%"PRId64"", ns); + return -EIO; + } + + *tmo_ticks = ns2iter.getwork_iter; + return 0; +} + static void ssovf_info_get(struct rte_eventdev *dev, struct rte_event_dev_info *dev_info) { @@ -300,6 +329,14 @@ ssovf_port_unlink(struct rte_eventdev *dev, void *port, uint8_t queues[], return (int)nb_unlinks; } +static int +ssovf_timeout_ticks(struct rte_eventdev *dev, uint64_t ns, uint64_t *tmo_ticks) +{ + RTE_SET_USED(dev); + + return ssovf_mbox_timeout_ticks(ns, tmo_ticks); +} + /* Initialize and register event driver with DPDK Application */ static const struct rte_eventdev_ops ssovf_ops = { .dev_infos_get = ssovf_info_get, @@ -312,6 +349,7 @@ static const struct rte_eventdev_ops ssovf_ops = { .port_release = ssovf_port_release, .port_link = ssovf_port_link, .port_unlink = ssovf_port_unlink, + .timeout_ticks = ssovf_timeout_ticks, }; static int diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h index 9a6bac53e9..16bf3d5c6c 100644 --- a/drivers/event/octeontx/ssovf_evdev.h +++ b/drivers/event/octeontx/ssovf_evdev.h @@ -117,6 +117,7 @@ #define SSO_GET_DEV_INFO 0x3 #define SSO_GET_GETWORK_WAIT 0x4 #define SSO_SET_GETWORK_WAIT 0x5 +#define SSO_CONVERT_NS_GETWORK_ITER 0x6 #define SSO_GRP_GET_PRIORITY 0x7 #define SSO_GRP_SET_PRIORITY 0x8