event/octeontx: support dequeue timeout tick conversion
authorJerin Jacob <jerin.jacob@caviumnetworks.com>
Fri, 3 Mar 2017 17:27:57 +0000 (22:57 +0530)
committerJerin Jacob <jerin.jacob@caviumnetworks.com>
Tue, 4 Apr 2017 17:19:52 +0000 (19:19 +0200)
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 <jerin.jacob@caviumnetworks.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Gage Eads <gage.eads@intel.com>
drivers/event/octeontx/ssovf_evdev.c
drivers/event/octeontx/ssovf_evdev.h

index 364755b..c31d259 100644 (file)
@@ -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
index 9a6bac5..16bf3d5 100644 (file)
 #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