From patchwork Wed Jan 14 06:05:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 43090 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 69325202DD for ; Wed, 14 Jan 2015 06:10:04 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id hi2sf81594wib.3 for ; Tue, 13 Jan 2015 22:10:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=rIefFu2ZJZk1uQYDZBPGLJ0i3HdEM6vhEP8fdoP6LTQ=; b=fd56MUEgSS8khfI06EygaksyYs6GloQ8mMqwwIwlMP8D8d++54n5dW9NFBMC6wAZvz juuePJA8MHNEkei1KidnHL42pb4cjGmeHvjr2DhhLs+TvJ+mtU/jVhyqAlKktrjCo2vj HYAUfFYYntcnrgULmlu3VGGcSETZeGWGUpMDtgs8v8h4EV0VvTjDgRciyWwG2PCVvFZg 7dQBaRfsPbmdyWR+6UV5uSv/t2NI+gqzCamAupSSQUAm+1N3StqJcCUBK6WismJltb0o 0wb0ZLEe0V7XHbHlEudRe9P60GZ2JE7kiJJH31yk8zdkf2Q6OKCVZbXOe0C24pbmA+3u cPsg== X-Gm-Message-State: ALoCoQnXVrcG/ewZLwvzfKKqcBP+0C2gGM5HVRLgd+n+xyzajrfpRw51MBIQORkm4MkK8tZWvt4H X-Received: by 10.194.204.201 with SMTP id la9mr12659wjc.6.1421215803663; Tue, 13 Jan 2015 22:10:03 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.135 with SMTP id s7ls80234las.33.gmail; Tue, 13 Jan 2015 22:10:03 -0800 (PST) X-Received: by 10.113.11.12 with SMTP id ee12mr1972055lbd.79.1421215803500; Tue, 13 Jan 2015 22:10:03 -0800 (PST) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id u9si26201792lbw.113.2015.01.13.22.10.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Jan 2015 22:10:03 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by mail-la0-f49.google.com with SMTP id hs14so6400245lab.8 for ; Tue, 13 Jan 2015 22:10:03 -0800 (PST) X-Received: by 10.152.43.103 with SMTP id v7mr2047258lal.29.1421215802946; Tue, 13 Jan 2015 22:10:02 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.9.200 with SMTP id c8csp1594247lbb; Tue, 13 Jan 2015 22:10:01 -0800 (PST) X-Received: by 10.140.44.134 with SMTP id g6mr3477592qga.85.1421215801263; Tue, 13 Jan 2015 22:10:01 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id 5si23808321qcl.7.2015.01.13.22.09.59 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 13 Jan 2015 22:10:01 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YBH9Q-0004g1-TH; Wed, 14 Jan 2015 06:09:56 +0000 Received: from mail-yk0-f180.google.com ([209.85.160.180]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YBH9L-0004fw-Iq for lng-odp@lists.linaro.org; Wed, 14 Jan 2015 06:09:51 +0000 Received: by mail-yk0-f180.google.com with SMTP id 9so3348322ykp.11 for ; Tue, 13 Jan 2015 22:09:46 -0800 (PST) X-Received: by 10.236.36.43 with SMTP id v31mr960227yha.141.1421215786296; Tue, 13 Jan 2015 22:09:46 -0800 (PST) Received: from bala-PowerEdge-T110-II.caveonetworks.com ([111.93.218.67]) by mx.google.com with ESMTPSA id 46sm14169272yho.54.2015.01.13.22.09.44 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Jan 2015 22:09:45 -0800 (PST) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Wed, 14 Jan 2015 11:35:03 +0530 Message-Id: <1421215503-29105-1-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Topics: patch Subject: [lng-odp] [PATCH v1] api: Move Pktio related APIs to pktio Header file X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: bala.manoharan@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 The following APIs are setting parameters to pktio handle and are hence moved from classification header to pktio header file. odp_pktio_default_cos_set() odp_pktio_error_cos_set() odp_pktio_skip_set() odp_pktio_headroom_set() This patch also modifies the error return values in API description from -1 to non-zero value Signed-off-by: Balasubramanian Manoharan --- .../linux-generic/include/api/odp_classification.h | 92 ++++------------------ platform/linux-generic/include/api/odp_packet_io.h | 55 +++++++++++++ .../linux-generic/include/api/odp_platform_types.h | 3 + platform/linux-generic/odp_classification.c | 22 +++--- platform/linux-generic/odp_init.c | 2 +- 5 files changed, 86 insertions(+), 88 deletions(-) diff --git a/platform/linux-generic/include/api/odp_classification.h b/platform/linux-generic/include/api/odp_classification.h index 4c9674b..46189bc 100644 --- a/platform/linux-generic/include/api/odp_classification.h +++ b/platform/linux-generic/include/api/odp_classification.h @@ -22,7 +22,6 @@ extern "C" { #include #include #include -#include #include /** @defgroup odp_classification ODP CLASSIFICATION @@ -30,11 +29,6 @@ extern "C" { * @{ */ -/** - * Class of service instance type - */ -typedef uint32_t odp_cos_t; - /** * flow signature type, only used for packet metadata field. @@ -95,7 +89,7 @@ odp_cos_t odp_cos_create(const char *name); * * @param[in] cos_id class-of-service instance. * - * @return 0 on success, -1 on error. + * @return 0 on success, non-zero on error. */ int odp_cos_destroy(odp_cos_t cos_id); @@ -108,7 +102,7 @@ int odp_cos_destroy(odp_cos_t cos_id); * of this specific class of service * will be enqueued. * - * @return 0 on success, -1 on error. + * @return 0 on success, non-zero on error. */ int odp_cos_set_queue(odp_cos_t cos_id, odp_queue_t queue_id); @@ -118,67 +112,13 @@ int odp_cos_set_queue(odp_cos_t cos_id, odp_queue_t queue_id); * @param[in] cos_id class-of-service instance. * @param[in] drop_policy Desired packet drop policy for this class. * - * @return 0 on success, -1 on error. + * @return 0 on success, non-zero on error. * * @note Optional. */ int odp_cos_set_drop(odp_cos_t cos_id, odp_drop_e drop_policy); /** - * Setup per-port default class-of-service. - * - * @param[in] pktio_in Ingress port identifier. - * @param[in] default_cos Class-of-service set to all packets arriving - * at the pktio_in ingress port, - * unless overridden by subsequent - * header-based filters. - * - * @return 0 on success, -1 on error. - */ -int odp_pktio_set_default_cos(odp_pktio_t pktio_in, odp_cos_t default_cos); - -/** - * Setup per-port error class-of-service - * - * @param[in] pktio_in Ingress port identifier. - * @param[in] error_cos class-of-service set to all packets arriving - * at the pktio_in ingress port - * that contain an error. - * - * @return 0 on success, -1 on error. - * - * @note Optional. - */ -int odp_pktio_set_error_cos(odp_pktio_t pktio_in, odp_cos_t error_cos); - -/** - * Setup per-port header offset - * - * @param[in] pktio_in Ingress port identifier. - * @param[in] offset Number of bytes the classifier must skip. - * - * @return 0 on success, -1 on error. - * @note Optional. - * - */ -int odp_pktio_set_skip(odp_pktio_t pktio_in, size_t offset); - -/** - * Specify per-port buffer headroom - * - * @param[in] pktio_in Ingress port identifier. - * @param[in] headroom Number of bytes of space preceding - * packet data to reserve for use as headroom. - * Must not exceed the implementation - * defined ODP_PACKET_MAX_HEADROOM. - * - * @return 0 on success, -1 on error. - * - * @note Optional. - */ -int odp_pktio_set_headroom(odp_pktio_t pktio_in, size_t headroom); - -/** * Request to override per-port class of service * based on Layer-2 priority field if present. * @@ -187,10 +127,10 @@ int odp_pktio_set_headroom(odp_pktio_t pktio_in, size_t headroom); * @param[in] qos_table Values of the Layer-2 QoS header field. * @param[in] cos_table Class-of-service assigned to each of the * allowed Layer-2 QOS levels. - * @return 0 on success, -1 on error. + * @return 0 on success, non-zero on error. */ int odp_cos_with_l2_priority(odp_pktio_t pktio_in, - size_t num_qos, + uint8_t num_qos, uint8_t qos_table[], odp_cos_t cos_table[]); @@ -206,15 +146,15 @@ int odp_cos_with_l2_priority(odp_pktio_t pktio_in, * @param[in] l3_preference when true, Layer-3 QoS overrides * L2 QoS when present. * - * @return 0 on success, -1 on error. + * @return 0 on success, non-zero on error. * * @note Optional. */ int odp_cos_with_l3_qos(odp_pktio_t pktio_in, - size_t num_qos, + uint32_t num_qos, uint8_t qos_table[], odp_cos_t cos_table[], - bool l3_preference); + odp_bool_t l3_preference); /** @@ -284,7 +224,7 @@ typedef enum odp_pmr_term { odp_pmr_t odp_pmr_create_match(odp_pmr_term_e term, const void *val, const void *mask, - size_t val_sz); + uint32_t val_sz); /** * Create a packet match rule with value range @@ -302,13 +242,13 @@ odp_pmr_t odp_pmr_create_match(odp_pmr_term_e term, odp_pmr_t odp_pmr_create_range(odp_pmr_term_e term, const void *val1, const void *val2, - size_t val_sz); + uint32_t val_sz); /** * Invalidate a packet match rule and vacate its resources * * @param[in] pmr_id Identifier of the PMR to be destroyed * - * @return 0 on success, -1 or error. + * @return 0 on success, non-zero or error. */ int odp_pmr_destroy(odp_pmr_t pmr_id); @@ -319,7 +259,7 @@ int odp_pmr_destroy(odp_pmr_t pmr_id); * @param[in] src_pktio pktio to which this PMR is to be applied * @param[in] dst_cos CoS to be assigned by this PMR * - * @return 0 on success, -1 or error. + * @return 0 on success, non-zero or error. */ int odp_pktio_pmr_cos(odp_pmr_t pmr_id, odp_pktio_t src_pktio, odp_cos_t dst_cos); @@ -332,7 +272,7 @@ int odp_pktio_pmr_cos(odp_pmr_t pmr_id, * @param[in] dst_cos CoS to be assigned to packets filtered * from src_cos that match pmr_id. * - * @return 0 on success, -1 on error. + * @return 0 on success, non-zero on error. */ int odp_cos_pmr_cos(odp_pmr_t pmr_id, odp_cos_t src_cos, odp_cos_t dst_cos); @@ -411,7 +351,7 @@ typedef uint32_t odp_pmr_set_t; * that have been successfully mapped to the * underlying platform classification engine and * may be in the range from 1 to num_terms, - * or -1 for error. + * or non-zero for error. */ int odp_pmr_match_set_create(int num_terms, odp_pmr_match_t *terms, odp_pmr_set_t *pmr_set_id); @@ -429,7 +369,7 @@ int odp_pmr_match_set_create(int num_terms, odp_pmr_match_t *terms, * @param[in] pmr_set_id A composite rule-set handle * returned when created. * - * @return 0 on success, -1 on error. + * @return 0 on success, non-zero on error. */ int odp_pmr_match_set_destroy(odp_pmr_set_t pmr_set_id); @@ -441,7 +381,7 @@ int odp_pmr_match_set_destroy(odp_pmr_set_t pmr_set_id); * set is to be applied * @param[in] dst_cos CoS to be assigned by this PMR match set * - * @return 0 on success, -1 or error. + * @return 0 on success, non-zero or error. */ int odp_pktio_pmr_match_set_cos(odp_pmr_set_t pmr_set_id, odp_pktio_t src_pktio, odp_cos_t dst_cos); diff --git a/platform/linux-generic/include/api/odp_packet_io.h b/platform/linux-generic/include/api/odp_packet_io.h index 0c34f29..4835f4d 100644 --- a/platform/linux-generic/include/api/odp_packet_io.h +++ b/platform/linux-generic/include/api/odp_packet_io.h @@ -169,6 +169,61 @@ size_t odp_pktio_mac_addr(odp_pktio_t id, void *mac_addr, size_t addr_size); /** + * Setup per-port default class-of-service. + * + * @param[in] pktio_in Ingress port identifier. + * @param[in] default_cos Class-of-service set to all packets arriving + * at the pktio_in ingress port, + * unless overridden by subsequent + * header-based filters. + * + * @return 0 on success, non-zero on error. + */ +int odp_pktio_default_cos_set(odp_pktio_t pktio_in, odp_cos_t default_cos); + +/** + * Setup per-port error class-of-service + * + * @param[in] pktio_in Ingress port identifier. + * @param[in] error_cos class-of-service set to all packets arriving + * at the pktio_in ingress port + * that contain an error. + * + * @return 0 on success, non-zero on error. + * + * @note Optional. + */ +int odp_pktio_error_cos_set(odp_pktio_t pktio_in, odp_cos_t error_cos); + +/** + * Setup per-port header offset + * + * @param[in] pktio_in Ingress port identifier. + * @param[in] offset Number of bytes the classifier must skip. + * + * @return 0 on success, non-zero on error. + * @note Optional. + * + */ +int odp_pktio_skip_set(odp_pktio_t pktio_in, uint32_t offset); + +/** + * Specify per-port buffer headroom + * + * @param[in] pktio_in Ingress port identifier. + * @param[in] headroom Number of bytes of space preceding + * packet data to reserve for use as headroom. + * Must not exceed the implementation + * defined ODP_PACKET_MAX_HEADROOM. + * + * @return 0 on success, non-zero on error. + * + * @note Optional. + */ +int odp_pktio_headroom_set(odp_pktio_t pktio_in, uint32_t headroom); + + +/** * @} */ diff --git a/platform/linux-generic/include/api/odp_platform_types.h b/platform/linux-generic/include/api/odp_platform_types.h index 0a00219..6ed9e78 100644 --- a/platform/linux-generic/include/api/odp_platform_types.h +++ b/platform/linux-generic/include/api/odp_platform_types.h @@ -74,6 +74,9 @@ typedef uint32_t odp_shm_t; #define ODP_SHM_INVALID 0 #define ODP_SHM_NULL ODP_SHM_INVALID /**< Synonym for buffer pool use */ +/** ODP Class of service handle */ +typedef uint32_t odp_cos_t; + /** * @} */ diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c index eeb049a..7d09cce 100644 --- a/platform/linux-generic/odp_classification.c +++ b/platform/linux-generic/odp_classification.c @@ -256,7 +256,7 @@ int odp_cos_set_drop(odp_cos_t cos_id, odp_drop_e drop_policy) return 0; } -int odp_pktio_set_default_cos(odp_pktio_t pktio_in, odp_cos_t default_cos) +int odp_pktio_default_cos_set(odp_pktio_t pktio_in, odp_cos_t default_cos) { pktio_entry_t *entry; cos_t *cos; @@ -275,7 +275,7 @@ int odp_pktio_set_default_cos(odp_pktio_t pktio_in, odp_cos_t default_cos) return 0; } -int odp_pktio_set_error_cos(odp_pktio_t pktio_in, odp_cos_t error_cos) +int odp_pktio_error_cos_set(odp_pktio_t pktio_in, odp_cos_t error_cos) { pktio_entry_t *entry; cos_t *cos; @@ -296,7 +296,7 @@ int odp_pktio_set_error_cos(odp_pktio_t pktio_in, odp_cos_t error_cos) return 0; } -int odp_pktio_set_skip(odp_pktio_t pktio_in, size_t offset) +int odp_pktio_skip_set(odp_pktio_t pktio_in, uint32_t offset) { pktio_entry_t *entry = get_pktio_entry(pktio_in); if (entry == NULL) { @@ -308,7 +308,7 @@ int odp_pktio_set_skip(odp_pktio_t pktio_in, size_t offset) return 0; } -int odp_pktio_set_headroom(odp_pktio_t pktio_in, size_t headroom) +int odp_pktio_headroom_set(odp_pktio_t pktio_in, uint32_t headroom) { pktio_entry_t *entry = get_pktio_entry(pktio_in); if (entry == NULL) { @@ -320,12 +320,12 @@ int odp_pktio_set_headroom(odp_pktio_t pktio_in, size_t headroom) } int odp_cos_with_l2_priority(odp_pktio_t pktio_in, - size_t num_qos, + uint8_t num_qos, uint8_t qos_table[], odp_cos_t cos_table[]) { pmr_l2_cos_t *l2_cos; - size_t i; + uint32_t i; cos_t *cos; pktio_entry_t *entry = get_pktio_entry(pktio_in); if (entry == NULL) { @@ -348,13 +348,13 @@ int odp_cos_with_l2_priority(odp_pktio_t pktio_in, } int odp_cos_with_l3_qos(odp_pktio_t pktio_in, - size_t num_qos, + uint32_t num_qos, uint8_t qos_table[], odp_cos_t cos_table[], - bool l3_preference) + odp_bool_t l3_preference) { pmr_l3_cos_t *l3_cos; - size_t i; + uint32_t i; pktio_entry_t *entry = get_pktio_entry(pktio_in); cos_t *cos; @@ -382,7 +382,7 @@ int odp_cos_with_l3_qos(odp_pktio_t pktio_in, odp_pmr_t odp_pmr_create_match(odp_pmr_term_e term, const void *val, const void *mask, - size_t val_sz) + uint32_t val_sz) { pmr_t *pmr; odp_pmr_t id; @@ -410,7 +410,7 @@ odp_pmr_t odp_pmr_create_match(odp_pmr_term_e term, odp_pmr_t odp_pmr_create_range(odp_pmr_term_e term, const void *val1, const void *val2, - size_t val_sz) + uint32_t val_sz) { pmr_t *pmr; odp_pmr_t id; diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c index 4d0aa07..77bfd09 100644 --- a/platform/linux-generic/odp_init.c +++ b/platform/linux-generic/odp_init.c @@ -55,7 +55,7 @@ int odp_init_global(odp_init_t *params ODP_UNUSED, return -1; } if (odp_classification_init_global()) { - ODP_ERR("ODP crypto init failed.\n"); + ODP_ERR("ODP classification init failed.\n"); return -1; }