event/octeontx: add configure function
authorJerin Jacob <jerin.jacob@caviumnetworks.com>
Fri, 3 Mar 2017 17:27:53 +0000 (22:57 +0530)
committerJerin Jacob <jerin.jacob@caviumnetworks.com>
Tue, 4 Apr 2017 17:19:52 +0000 (19:19 +0200)
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 ec591e9..768078e 100644 (file)
@@ -65,6 +65,30 @@ ssovf_mbox_dev_info(struct ssovf_mbox_dev_info *info)
        return octeontx_ssovf_mbox_send(&hdr, NULL, 0, info, len);
 }
 
+struct ssovf_mbox_getwork_wait {
+       uint64_t wait_ns;
+};
+
+static int
+ssovf_mbox_getwork_tmo_set(uint32_t timeout_ns)
+{
+       struct octeontx_mbox_hdr hdr = {0};
+       struct ssovf_mbox_getwork_wait tmo_set;
+       uint16_t len = sizeof(struct ssovf_mbox_getwork_wait);
+       int ret;
+
+       hdr.coproc = SSO_COPROC;
+       hdr.msg = SSO_SET_GETWORK_WAIT;
+       hdr.vfid = 0;
+
+       tmo_set.wait_ns = timeout_ns;
+       ret = octeontx_ssovf_mbox_send(&hdr, &tmo_set, len, NULL, 0);
+       if (ret)
+               ssovf_log_err("Failed to set getwork timeout(%d)", ret);
+
+       return ret;
+}
+
 static void
 ssovf_info_get(struct rte_eventdev *dev, struct rte_event_dev_info *dev_info)
 {
@@ -85,10 +109,30 @@ ssovf_info_get(struct rte_eventdev *dev, struct rte_event_dev_info *dev_info)
                                        RTE_EVENT_DEV_CAP_QUEUE_ALL_TYPES;
 }
 
+static int
+ssovf_configure(const struct rte_eventdev *dev)
+{
+       struct rte_event_dev_config *conf = &dev->data->dev_conf;
+       struct ssovf_evdev *edev = ssovf_pmd_priv(dev);
+       uint64_t deq_tmo_ns;
+
+       ssovf_func_trace();
+       deq_tmo_ns = conf->dequeue_timeout_ns;
+
+       if (conf->event_dev_cfg & RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT) {
+               edev->is_timeout_deq = 1;
+               deq_tmo_ns = edev->min_deq_timeout_ns;
+       }
+       edev->nb_event_queues = conf->nb_event_queues;
+       edev->nb_event_ports = conf->nb_event_ports;
+
+       return ssovf_mbox_getwork_tmo_set(deq_tmo_ns);
+}
 
 /* Initialize and register event driver with DPDK Application */
 static const struct rte_eventdev_ops ssovf_ops = {
        .dev_infos_get    = ssovf_info_get,
+       .dev_configure    = ssovf_configure,
 };
 
 static int
index b8b89a7..1c36923 100644 (file)
 #define SSO_GETDOMAINCFG                  0x1
 #define SSO_IDENTIFY                      0x2
 #define SSO_GET_DEV_INFO                  0x3
+#define SSO_GET_GETWORK_WAIT              0x4
+#define SSO_SET_GETWORK_WAIT              0x5
 
 struct ssovf_evdev {
        uint8_t max_event_queues;
        uint8_t max_event_ports;
        uint8_t is_timeout_deq;
+       uint8_t nb_event_queues;
+       uint8_t nb_event_ports;
        uint32_t min_deq_timeout_ns;
        uint32_t max_deq_timeout_ns;
        int32_t max_num_events;