From patchwork Wed Aug 22 12:00:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 144824 Delivered-To: patch@linaro.org Received: by 2002:a2e:164a:0:0:0:0:0 with SMTP id 10-v6csp562316ljw; Wed, 22 Aug 2018 05:02:58 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbJ2RIXZ4ufHR9ty+yzh8mtH5+lEgEH2dEdiRyOw7siPqa0Yt2xyLCpFPvloBRdT130Kgnh X-Received: by 2002:ad4:514a:: with SMTP id g10-v6mr7917799qvq.19.1534939378504; Wed, 22 Aug 2018 05:02:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534939378; cv=none; d=google.com; s=arc-20160816; b=oyEfy7Tm+wj9BZcqE+TL3Q+YHdTuU+JZdHOtuoPfndlTsYLjwi8dQ2aE1p+SCprPSO 5EA6naBp3N5X5Bg4wJbvQwd7b0ndTe9F0GqalvW2YRRo0j1RjNHqDtsC6q+uvv+ctReb Ah+SWaVv1FCxftolyE9AWhzUQamSjGIyHokHpQrRbM4UB7ZLBpNPvX1pdjfG0hDGDWi1 08aDcOo3gV8CSIooxW/+DMVsk1hxIUICaDjUKtDIRq2icz7ZzFpTaJblzbqd/iwHltTv ohkTnsFEo3aQMaC2hF8QwW1OkM6b/0I/+ANiGdg0wRKUQHcW5ZG1LA6wrynZXocE4f2o +wEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=Gt3YDrl0g29QzgloPbQzsorSQse03v3xhPCaAO4ZPSI=; b=flOqPmUYsYqY0hPSa/SjIAyStwIdLJGow5pp8UggdmYlS8xSEEHEQH4nMGBmplDXwa 7lRi8gKWiHsvsRxLprG4c4xAvw28JgcRMRFyq8lNL/0z9XlRta05RKoceuO7eFDoears VrNq3mt1wFpzMkkQjCRpI/v6CKTH2Vu5VsmZuHCQO4KypGr87RSV4GfdidwxVlvsCfbx 5CDJtCbpjs5qKcIkRofZ3U7+7HhR9X6mNshxut2d9s6yL2Aque9F3E1yFrkcuO0kfh6M oO7gK4B1HywmRVA3X34z2DgRaLSG1+hK9wNLH2oWqTXgnylHHvkZSr6MDv9HwsJDskvf CpQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id 46-v6si719162qvg.68.2018.08.22.05.02.58; Wed, 22 Aug 2018 05:02:58 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 1BDBE607BA; Wed, 22 Aug 2018 12:02:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_LOW autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 731DE60676; Wed, 22 Aug 2018 12:02:07 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id AEF77607E8; Wed, 22 Aug 2018 12:01:51 +0000 (UTC) Received: from forward104o.mail.yandex.net (forward104o.mail.yandex.net [37.140.190.179]) by lists.linaro.org (Postfix) with ESMTPS id 283BA60676 for ; Wed, 22 Aug 2018 12:00:11 +0000 (UTC) Received: from mxback3o.mail.yandex.net (mxback3o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1d]) by forward104o.mail.yandex.net (Yandex) with ESMTP id 9407F3D83B3F for ; Wed, 22 Aug 2018 15:00:09 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback3o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id EEfYPPNkVg-09GCSp0Y; Wed, 22 Aug 2018 15:00:09 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id OqNSHHikjW-08DKr4Ca; Wed, 22 Aug 2018 15:00:08 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 22 Aug 2018 12:00:05 +0000 Message-Id: <1534939206-19985-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534939206-19985-1-git-send-email-odpbot@yandex.ru> References: <1534939206-19985-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 665 Subject: [lng-odp] [PATCH API-NEXT v3 1/2] api: schedule: add scheduler flow aware mode X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Balasubramanian Manoharan ODP scheduler configuration to support flow aware mode Signed-off-by: Balasubramanian Manoharan --- /** Email created from pull request 665 (bala-manoharan:sched_flow_aware) ** https://github.com/Linaro/odp/pull/665 ** Patch: https://github.com/Linaro/odp/pull/665.patch ** Base sha: d42ef2c5a01d29a9877e0b487694f66e40c43624 ** Merge commit sha: dcc55a30faf9b8487dc21576e88b55c0720fa78c **/ include/odp/api/spec/event.h | 39 ++++++++ include/odp/api/spec/schedule.h | 129 ++++++++++++++++++++++++++ include/odp/api/spec/schedule_types.h | 6 ++ 3 files changed, 174 insertions(+) diff --git a/include/odp/api/spec/event.h b/include/odp/api/spec/event.h index d9f7ab73d..d953fa7b2 100644 --- a/include/odp/api/spec/event.h +++ b/include/odp/api/spec/event.h @@ -209,6 +209,45 @@ void odp_event_free_multi(const odp_event_t event[], int num); */ void odp_event_free_sp(const odp_event_t event[], int num); +/** + * Event flow hash value + * + * Returns the hash value set in the event. + * Flow hash value set in the event is used by scheduler to distribute the + * event across different flows. + * + * @param event Event handle + * + * @return Hash value + * + * @note The hash algorithm and the header fields defining the flow (therefore + * used for hashing) is platform dependent. The initial event flow hash + * generated by the HW will be same for flow hash generated for packets. + + * @note The returned hash is either the platform generated (if any), or if + * odp_event_flow_hash_set() were called then the value set there. + */ +uint32_t odp_event_flow_hash(odp_event_t event); + +/** + * Set event flow hash value + * + * Store the event flow hash for the event and sets the flow hash flag. + * When scheduler is configured as flow aware, schedule queue synchronization + * will be based on flow within each queue. + * When scheduler is configured as flow unaware, event flow hash is ignored by + * the implementation. + * The value of flow hash should not be greater than the max flow count + * supported by the implementation. + * + * @param event Event handle + * @param flow_hash Hash value to set + * + * @note When scheduler is configured as flow unaware, overwriting the platform + * provided value doesn't change how the platform handles this packet after it. + */ +void odp_event_flow_hash_set(odp_event_t event, uint32_t flow_hash); + /** * @} */ diff --git a/include/odp/api/spec/schedule.h b/include/odp/api/spec/schedule.h index bbc749836..53e5c2690 100644 --- a/include/odp/api/spec/schedule.h +++ b/include/odp/api/spec/schedule.h @@ -24,6 +24,7 @@ extern "C" { #include #include #include +#include /** @defgroup odp_scheduler ODP SCHEDULER * Operations on the scheduler. @@ -45,6 +46,98 @@ extern "C" { * Maximum schedule group name length in chars including null char */ +/** + * Schedule configuration + * When schedule configuration is not called by the application, the scheduler + * behaves in flow-unaware mode and event flow hash values are ignored + */ +typedef struct odp_schedule_config_t { + + /* Number of flows per queue to be supported + * Scheduler enables flow aware mode when flow count is configured + * greater than 1. + * Flows are lightweight entities and packets can be assigned to specific + * flows by the application using odp_event_flow_hash_set() before + * enqueuing the packet into the scheduler. This value is ignored unless + * scheduler supports flow aware mode + * Depening on the implementation this number might be rounded-off to + * nearest supported value (e.g power of 2) + * This number should be less than maximum flow supported by the + * implementation. + * @see odp_schedule_capability_t + */ + uint32_t flow_count; + + /* Maximum number of schedule queues to be supported + * Application configures the maximum number of schedule queues to be + * supported by the implementation. + * @see odp_queue_capability_t + */ + uint32_t queue_count; + + /* Maximum number of events required to be stored simultaneously in + * schedule queue. This number should be less than 'max_queue_size' + * supported by the implementation. + * A value of 0 configures default queue size supported by the + * implementation. + */ + uint32_t queue_size; +} odp_schedule_config_t; + +typedef struct odp_schedule_capability_t { + + /* Maximum supported flows per queue + * Specifies the maximum number of flows per queue supported by the + * implementation. + * A value of 0 indicates flow aware mode is not supported. + */ + uint32_t max_flow_count; + + /* Maximum supported queues + * Specifies the maximum number of queues supported by the + * implementation. + */ + uint32_t max_queue_count; + + /* Maximum number of events a schedule queue can store simultaneoulsy. + * A value of 0 indicates the implementation does not restrict the + * queue size + */ + uint32_t max_queue_size; +} odp_schedule_capability_t; + +/** + * Start scheduler operation + * + * Activate scheduler module to schedule packets across different schedule + * queues. The scheduler module should be started before creating any odp + * queues. The scheduler module can be stopped usinig odp_schedule_stop(). + * + * The initialization sequeunce should be, + * odp_schedule_capability() + * odp_schedule_config_init() + * odp_schedule_config() + * odp_schedule_start() + * odp_schedule() + * + * @retval 0 on success + * @retval <0 on failure + * + * @odp_schedule_stop() + */ +int odp_schedule_start(void); + +/** + * Stop scheduler operations + * + * Stop scheduler module. The application should make sure there are no further + * events in the scheduler before calling odp_schedule_stop. + * + * @retval 0 on success + * @retval <0 on failure + */ +int odp_schedule_stop(void); + /** * Schedule wait time * @@ -187,6 +280,42 @@ void odp_schedule_prefetch(int num); */ int odp_schedule_num_prio(void); +/** + * Initialize schedule configuration options + * + * Initialize an odp_schedule_config_t to its default values. + * + * @param[out] config Pointer to schedule configuration structure + */ +void odp_schedule_config_init(odp_schedule_config_t *config); + + +/** + * Global schedule configuration + * + * Initialize and configure scheduler with global configuration options. + * + * @param config Pointer to scheduler configuration structure + * + * @retval 0 on success + * @retval <0 on failure + * + * @see odp_schedule_capability(), odp_schedule_config_init() + */ +int odp_schedule_config(const odp_schedule_config_t *config); + +/** + * Query scheduler capabilities + * + * Outputs schedule capabilities on success. + * + * @param[out] capa Pointer to capability structure for output + * + * @retval 0 on success + * @retval <0 on failure + */ +int odp_schedule_capability(odp_schedule_capability_t *capa); + /** * Schedule group create * diff --git a/include/odp/api/spec/schedule_types.h b/include/odp/api/spec/schedule_types.h index 44eb663a2..7f2179e9e 100644 --- a/include/odp/api/spec/schedule_types.h +++ b/include/odp/api/spec/schedule_types.h @@ -79,6 +79,9 @@ extern "C" { * requests another event from the scheduler, which implicitly releases the * context. User may allow the scheduler to release the context earlier than * that by calling odp_schedule_release_atomic(). + * When scheduler is enabled as flow-aware, the event flow hash value affects + * scheduling of the event and synchronization is maintained per flow within + * each queue. */ /** @@ -105,6 +108,9 @@ extern "C" { * (e.g. freed or stored) within the context are considered missing from * reordering and are skipped at this time (but can be ordered again within * another context). + * When scheduler is enabled as flow-aware, the event flow hash value affects + * scheduling of the event and synchronization is maintained per flow within + * each queue. */ /**