get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/116252/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 116252,
    "url": "http://patches.dpdk.org/api/patches/116252/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20220914050855.1677489-1-s.v.naga.harish.k@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20220914050855.1677489-1-s.v.naga.harish.k@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220914050855.1677489-1-s.v.naga.harish.k@intel.com",
    "date": "2022-09-14T05:08:51",
    "name": "[v5,1/4] eventdev/timer: add periodic event timer support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "079f3740d634f1e647b74bb6a05d90beeb146e66",
    "submitter": {
        "id": 2280,
        "url": "http://patches.dpdk.org/api/people/2280/?format=api",
        "name": "Naga Harish K, S V",
        "email": "s.v.naga.harish.k@intel.com"
    },
    "delegate": {
        "id": 310,
        "url": "http://patches.dpdk.org/api/users/310/?format=api",
        "username": "jerin",
        "first_name": "Jerin",
        "last_name": "Jacob",
        "email": "jerinj@marvell.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20220914050855.1677489-1-s.v.naga.harish.k@intel.com/mbox/",
    "series": [
        {
            "id": 24650,
            "url": "http://patches.dpdk.org/api/series/24650/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=24650",
            "date": "2022-09-14T05:08:51",
            "name": "[v5,1/4] eventdev/timer: add periodic event timer support",
            "version": 5,
            "mbox": "http://patches.dpdk.org/series/24650/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/116252/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/116252/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id E4AA1A0032;\n\tWed, 14 Sep 2022 07:09:01 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 8A3E04021E;\n\tWed, 14 Sep 2022 07:09:01 +0200 (CEST)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n by mails.dpdk.org (Postfix) with ESMTP id E652840151\n for <dev@dpdk.org>; Wed, 14 Sep 2022 07:08:59 +0200 (CEST)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 13 Sep 2022 22:08:59 -0700",
            "from txandevlnx322.an.intel.com ([10.123.117.44])\n by fmsmga005.fm.intel.com with ESMTP; 13 Sep 2022 22:08:57 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1663132140; x=1694668140;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=im9pwoqvbb7XdIcxYi+gNkxBpnQ1XRJFcox9mBKM7sc=;\n b=eiSGZcc2WJPxMpNui/OhhVmOe98FlvDLu2gwZlIBqaH0/Eu6tN1/uN+s\n X7IQwpQZywYGhA1OBY7dXfZScY1QQY8lnvHUHqVcGZBjWp848txrqxAZW\n yzS0gOI8dDBztOrmzF3W5PLia/qT9wtyaWhxs4tEdTeHN/P4CfEVKJTnD\n UXsGFSpbs8zdm5CFGdUXhRzJRUJ4UV3wKbrC4W5z46HPlzBGtrY1roKy6\n vukQnGh748/cYxGAbQYsNuU1MGjMm+25cmQgCvHmxCvt90LEpZZsCu57A\n sBJM+1RffjW47M2W5SHa7Bx5+yxRRMWWowqMIeYkwzNtU6mgBkFd0mZZi w==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6500,9779,10469\"; a=\"298336376\"",
            "E=Sophos;i=\"5.93,313,1654585200\"; d=\"scan'208\";a=\"298336376\"",
            "E=Sophos;i=\"5.93,313,1654585200\"; d=\"scan'208\";a=\"945368959\""
        ],
        "X-ExtLoop1": "1",
        "From": "Naga Harish K S V <s.v.naga.harish.k@intel.com>",
        "To": "jerinj@marvell.com",
        "Cc": "dev@dpdk.org, erik.g.carrillo@intel.com, pbhagavatula@marvell.com,\n sthotton@marvell.com",
        "Subject": "[PATCH v5 1/4] eventdev/timer: add periodic event timer support",
        "Date": "Wed, 14 Sep 2022 00:08:51 -0500",
        "Message-Id": "<20220914050855.1677489-1-s.v.naga.harish.k@intel.com>",
        "X-Mailer": "git-send-email 2.23.0",
        "In-Reply-To": "<20220812160714.287055-1-s.v.naga.harish.k@intel.com>",
        "References": "<20220812160714.287055-1-s.v.naga.harish.k@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "This patch adds support to configure and use periodic event\ntimers in software timer adapter.\n\nThe structure ``rte_event_timer_adapter_stats`` is extended\nby adding a new field, ``evtim_drop_count``. This stat\nrepresents the number of times an event_timer expiry event\nis dropped by the event timer adapter.\n\nupdate the software eventdev pmd timer_adapter_caps_get\ncallback function to report the support of periodic\nevent timer capability\n\nSigned-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>\n---\nv5:\n* squash first two patches and remove evtim_drop_count deprecation\nnotice\n---\n drivers/event/sw/sw_evdev.c            |   2 +-\n lib/eventdev/eventdev_pmd.h            |   3 +\n lib/eventdev/rte_event_timer_adapter.c | 106 ++++++++++++++++---------\n lib/eventdev/rte_event_timer_adapter.h |   2 +\n lib/eventdev/rte_eventdev.c            |   6 +-\n 5 files changed, 81 insertions(+), 38 deletions(-)",
    "diff": "diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c\nindex f93313b31b..6eddf8bd93 100644\n--- a/drivers/event/sw/sw_evdev.c\n+++ b/drivers/event/sw/sw_evdev.c\n@@ -564,7 +564,7 @@ sw_timer_adapter_caps_get(const struct rte_eventdev *dev, uint64_t flags,\n {\n \tRTE_SET_USED(dev);\n \tRTE_SET_USED(flags);\n-\t*caps = 0;\n+\t*caps = RTE_EVENT_TIMER_ADAPTER_SW_CAP;\n \n \t/* Use default SW ops */\n \t*ops = NULL;\ndiff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h\nindex 69402668d8..d9e71581b7 100644\n--- a/lib/eventdev/eventdev_pmd.h\n+++ b/lib/eventdev/eventdev_pmd.h\n@@ -81,6 +81,9 @@ extern \"C\" {\n  * the ethdev to eventdev use a SW service function\n  */\n \n+#define RTE_EVENT_TIMER_ADAPTER_SW_CAP \\\n+\t\tRTE_EVENT_TIMER_ADAPTER_CAP_PERIODIC\n+\n #define RTE_EVENTDEV_DETACHED  (0)\n #define RTE_EVENTDEV_ATTACHED  (1)\n \ndiff --git a/lib/eventdev/rte_event_timer_adapter.c b/lib/eventdev/rte_event_timer_adapter.c\nindex e0d978d641..d2480060c5 100644\n--- a/lib/eventdev/rte_event_timer_adapter.c\n+++ b/lib/eventdev/rte_event_timer_adapter.c\n@@ -53,6 +53,14 @@ static const struct event_timer_adapter_ops swtim_ops;\n #define EVTIM_SVC_LOG_DBG(...) (void)0\n #endif\n \n+static inline enum rte_timer_type\n+get_timer_type(const struct rte_event_timer_adapter *adapter)\n+{\n+\treturn (adapter->data->conf.flags &\n+\t\t\tRTE_EVENT_TIMER_ADAPTER_F_PERIODIC) ?\n+\t\t\tPERIODICAL : SINGLE;\n+}\n+\n static int\n default_port_conf_cb(uint16_t id, uint8_t event_dev_id, uint8_t *event_port_id,\n \t\t     void *conf_arg)\n@@ -195,13 +203,14 @@ rte_event_timer_adapter_create_ext(\n \tadapter->data->conf = *conf;  /* copy conf structure */\n \n \t/* Query eventdev PMD for timer adapter capabilities and ops */\n-\tret = dev->dev_ops->timer_adapter_caps_get(dev,\n-\t\t\t\t\t\t   adapter->data->conf.flags,\n-\t\t\t\t\t\t   &adapter->data->caps,\n-\t\t\t\t\t\t   &adapter->ops);\n-\tif (ret < 0) {\n-\t\trte_errno = -ret;\n-\t\tgoto free_memzone;\n+\tif (dev->dev_ops->timer_adapter_caps_get) {\n+\t\tret = dev->dev_ops->timer_adapter_caps_get(dev,\n+\t\t\t\tadapter->data->conf.flags,\n+\t\t\t\t&adapter->data->caps, &adapter->ops);\n+\t\tif (ret < 0) {\n+\t\t\trte_errno = -ret;\n+\t\t\tgoto free_memzone;\n+\t\t}\n \t}\n \n \tif (!(adapter->data->caps &\n@@ -348,13 +357,14 @@ rte_event_timer_adapter_lookup(uint16_t adapter_id)\n \tdev = &rte_eventdevs[adapter->data->event_dev_id];\n \n \t/* Query eventdev PMD for timer adapter capabilities and ops */\n-\tret = dev->dev_ops->timer_adapter_caps_get(dev,\n-\t\t\t\t\t\t   adapter->data->conf.flags,\n-\t\t\t\t\t\t   &adapter->data->caps,\n-\t\t\t\t\t\t   &adapter->ops);\n-\tif (ret < 0) {\n-\t\trte_errno = EINVAL;\n-\t\treturn NULL;\n+\tif (dev->dev_ops->timer_adapter_caps_get) {\n+\t\tret = dev->dev_ops->timer_adapter_caps_get(dev,\n+\t\t\t\tadapter->data->conf.flags,\n+\t\t\t\t&adapter->data->caps, &adapter->ops);\n+\t\tif (ret < 0) {\n+\t\t\trte_errno = EINVAL;\n+\t\t\treturn NULL;\n+\t\t}\n \t}\n \n \t/* If eventdev PMD did not provide ops, use default software\n@@ -612,35 +622,44 @@ swtim_callback(struct rte_timer *tim)\n \tuint64_t opaque;\n \tint ret;\n \tint n_lcores;\n+\tenum rte_timer_type type;\n \n \topaque = evtim->impl_opaque[1];\n \tadapter = (struct rte_event_timer_adapter *)(uintptr_t)opaque;\n \tsw = swtim_pmd_priv(adapter);\n+\ttype = get_timer_type(adapter);\n+\n+\tif (unlikely(sw->in_use[lcore].v == 0)) {\n+\t\tsw->in_use[lcore].v = 1;\n+\t\tn_lcores = __atomic_fetch_add(&sw->n_poll_lcores, 1,\n+\t\t\t\t\t     __ATOMIC_RELAXED);\n+\t\t__atomic_store_n(&sw->poll_lcores[n_lcores], lcore,\n+\t\t\t\t__ATOMIC_RELAXED);\n+\t}\n \n \tret = event_buffer_add(&sw->buffer, &evtim->ev);\n \tif (ret < 0) {\n-\t\t/* If event buffer is full, put timer back in list with\n-\t\t * immediate expiry value, so that we process it again on the\n-\t\t * next iteration.\n-\t\t */\n-\t\tret = rte_timer_alt_reset(sw->timer_data_id, tim, 0, SINGLE,\n-\t\t\t\t\t  lcore, NULL, evtim);\n-\t\tif (ret < 0) {\n-\t\t\tEVTIM_LOG_DBG(\"event buffer full, failed to reset \"\n-\t\t\t\t      \"timer with immediate expiry value\");\n+\t\tif (type == SINGLE) {\n+\t\t\t/* If event buffer is full, put timer back in list with\n+\t\t\t * immediate expiry value, so that we process it again\n+\t\t\t * on the next iteration.\n+\t\t\t */\n+\t\t\tret = rte_timer_alt_reset(sw->timer_data_id, tim, 0,\n+\t\t\t\t\t\tSINGLE,\tlcore, NULL, evtim);\n+\t\t\tif (ret < 0) {\n+\t\t\t\tEVTIM_LOG_DBG(\"event buffer full, failed to \"\n+\t\t\t\t\t\t\"reset timer with immediate \"\n+\t\t\t\t\t\t\"expiry value\");\n+\t\t\t} else {\n+\t\t\t\tsw->stats.evtim_retry_count++;\n+\t\t\t\tEVTIM_LOG_DBG(\"event buffer full, resetting \"\n+\t\t\t\t\t\t\"rte_timer with immediate \"\n+\t\t\t\t\t\t\"expiry value\");\n+\t\t\t}\n \t\t} else {\n-\t\t\tsw->stats.evtim_retry_count++;\n-\t\t\tEVTIM_LOG_DBG(\"event buffer full, resetting rte_timer \"\n-\t\t\t\t      \"with immediate expiry value\");\n+\t\t\tsw->stats.evtim_drop_count++;\n \t\t}\n \n-\t\tif (unlikely(sw->in_use[lcore].v == 0)) {\n-\t\t\tsw->in_use[lcore].v = 1;\n-\t\t\tn_lcores = __atomic_fetch_add(&sw->n_poll_lcores, 1,\n-\t\t\t\t\t\t     __ATOMIC_RELAXED);\n-\t\t\t__atomic_store_n(&sw->poll_lcores[n_lcores], lcore,\n-\t\t\t\t\t__ATOMIC_RELAXED);\n-\t\t}\n \t} else {\n \t\tEVTIM_BUF_LOG_DBG(\"buffered an event timer expiry event\");\n \n@@ -654,10 +673,15 @@ swtim_callback(struct rte_timer *tim)\n \t\t\tsw->n_expired_timers = 0;\n \t\t}\n \n-\t\tsw->expired_timers[sw->n_expired_timers++] = tim;\n+\t\t/* Don't free rte_timer for a periodic event timer until\n+\t\t * it is cancelled\n+\t\t */\n+\t\tif (type == SINGLE)\n+\t\t\tsw->expired_timers[sw->n_expired_timers++] = tim;\n \t\tsw->stats.evtim_exp_count++;\n \n-\t\t__atomic_store_n(&evtim->state, RTE_EVENT_TIMER_NOT_ARMED,\n+\t\tif (type == SINGLE)\n+\t\t\t__atomic_store_n(&evtim->state, RTE_EVENT_TIMER_NOT_ARMED,\n \t\t\t\t__ATOMIC_RELEASE);\n \t}\n \n@@ -947,6 +971,12 @@ swtim_uninit(struct rte_event_timer_adapter *adapter)\n \t\t\t   swtim_free_tim,\n \t\t\t   sw);\n \n+\tret = rte_timer_data_dealloc(sw->timer_data_id);\n+\tif (ret < 0) {\n+\t\tEVTIM_LOG_ERR(\"failed to deallocate timer data instance\");\n+\t\treturn ret;\n+\t}\n+\n \tret = rte_service_component_unregister(sw->service_id);\n \tif (ret < 0) {\n \t\tEVTIM_LOG_ERR(\"failed to unregister service component\");\n@@ -1053,6 +1083,7 @@ __swtim_arm_burst(const struct rte_event_timer_adapter *adapter,\n \t/* Timer list for this lcore is not in use. */\n \tuint16_t exp_state = 0;\n \tenum rte_event_timer_state n_state;\n+\tenum rte_timer_type type = SINGLE;\n \n #ifdef RTE_LIBRTE_EVENTDEV_DEBUG\n \t/* Check that the service is running. */\n@@ -1092,6 +1123,9 @@ __swtim_arm_burst(const struct rte_event_timer_adapter *adapter,\n \t\treturn 0;\n \t}\n \n+\t/* update timer type for periodic adapter */\n+\ttype = get_timer_type(adapter);\n+\n \tfor (i = 0; i < nb_evtims; i++) {\n \t\tn_state = __atomic_load_n(&evtims[i]->state, __ATOMIC_ACQUIRE);\n \t\tif (n_state == RTE_EVENT_TIMER_ARMED) {\n@@ -1135,7 +1169,7 @@ __swtim_arm_burst(const struct rte_event_timer_adapter *adapter,\n \n \t\tcycles = get_timeout_cycles(evtims[i], adapter);\n \t\tret = rte_timer_alt_reset(sw->timer_data_id, tim, cycles,\n-\t\t\t\t\t  SINGLE, lcore_id, NULL, evtims[i]);\n+\t\t\t\t\t  type, lcore_id, NULL, evtims[i]);\n \t\tif (ret < 0) {\n \t\t\t/* tim was in RUNNING or CONFIG state */\n \t\t\t__atomic_store_n(&evtims[i]->state,\ndiff --git a/lib/eventdev/rte_event_timer_adapter.h b/lib/eventdev/rte_event_timer_adapter.h\nindex eab8e59a57..cd10db19e4 100644\n--- a/lib/eventdev/rte_event_timer_adapter.h\n+++ b/lib/eventdev/rte_event_timer_adapter.h\n@@ -193,6 +193,8 @@ struct rte_event_timer_adapter_stats {\n \t/**< Event timer retry count */\n \tuint64_t adapter_tick_count;\n \t/**< Tick count for the adapter, at its resolution */\n+\tuint64_t evtim_drop_count;\n+\t/**< event timer expiries dropped */\n };\n \n struct rte_event_timer_adapter;\ndiff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c\nindex 1dc4f966be..59d8b49ef6 100644\n--- a/lib/eventdev/rte_eventdev.c\n+++ b/lib/eventdev/rte_eventdev.c\n@@ -139,7 +139,11 @@ rte_event_timer_adapter_caps_get(uint8_t dev_id, uint32_t *caps)\n \n \tif (caps == NULL)\n \t\treturn -EINVAL;\n-\t*caps = 0;\n+\n+\tif (dev->dev_ops->timer_adapter_caps_get == NULL)\n+\t\t*caps = RTE_EVENT_TIMER_ADAPTER_SW_CAP;\n+\telse\n+\t\t*caps = 0;\n \n \treturn dev->dev_ops->timer_adapter_caps_get ?\n \t\t\t\t(*dev->dev_ops->timer_adapter_caps_get)(dev,\n",
    "prefixes": [
        "v5",
        "1/4"
    ]
}