From patchwork Thu Nov 16 15:00:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 119051 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5697508qgn; Thu, 16 Nov 2017 07:06:35 -0800 (PST) X-Google-Smtp-Source: AGs4zMbWxAmuYCbyGnlELKzs7GOGq1Yn3iWgtBCUCzE/C+mdVZm5v8xaspXoJcVpd04t0I3qyYRj X-Received: by 10.55.188.6 with SMTP id m6mr2941604qkf.312.1510844795581; Thu, 16 Nov 2017 07:06:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510844795; cv=none; d=google.com; s=arc-20160816; b=AWl6wU0oS9tBpXBNf4z2298nolyrl6iGNNxEUYA0m2UizK46pxlfNXz/Ta0v728IDV WIB1WsweQ0qE+qqM/b8MpGhPJbtJvpzGwqIBiLoPcc1q2J8nvf1fIsDN2hk5ygd2/MaL K+qV1pO6lY3x3G/MGteTsASuTBMVtrCjEZm5npHObZHdw6sx44d5NWNvEhnGKDbL29YA to9/RTtk1l3TqhwEy6aGne1bR8krbuOqO+Rsw/MbIqX0TpZSfY6+vIS6buke8ZiQpn53 bhVkstV4H+r+6uTCJFyim+6RvcUz17Kronn4oA96Vjy296KXWlVkNP2TqwGRQKRKVZkL kMFA== 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=KYi1A9G7TbZNBHBJ3JQGHk/kreNuRfevUJQuK0Vt/24=; b=n9DTiMcRZ7Ms5nlkSYuKwGJVmcMiRxWOjT46BF3XMEV80tJWoWFQ/NjoJ5X4MSqBHu GwYrzh7OoZ07UthuxptsfQs5cUTF+7aiLxrhqBmFR+Rt+T3HyMosqX3+m3ssZRrm0Wv3 PVwS2o+YsJDjrG0PyMPzKgt/8iU8q+L3Ppm7WP24YUXZqCqUeb/LRwE0/+Ux3gzT7vrx 7axKWNxa8YNrjoFYDfG8o4LNsl6q2mNxR9Lz50HGNZa5nD0CfGqxoIHteU0pMt0r5UHz CF4QCr0o+jKe08gC6KxNoNKonRPRLN9SYGDIdt1jUAtXYa0tbbNz6sm/iUCC3kL30eiQ j5pw== 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 47si1219354qtr.200.2017.11.16.07.06.35; Thu, 16 Nov 2017 07:06:35 -0800 (PST) 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 1F15B6087B; Thu, 16 Nov 2017 15:06:35 +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=-5.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED 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 82C5160810; Thu, 16 Nov 2017 15:00:53 +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 93568607A9; Thu, 16 Nov 2017 15:00:30 +0000 (UTC) Received: from forward100p.mail.yandex.net (forward100p.mail.yandex.net [77.88.28.100]) by lists.linaro.org (Postfix) with ESMTPS id 67114606A8 for ; Thu, 16 Nov 2017 15:00:18 +0000 (UTC) Received: from mxback2o.mail.yandex.net (mxback2o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1c]) by forward100p.mail.yandex.net (Yandex) with ESMTP id 14FE751036D1 for ; Thu, 16 Nov 2017 18:00:15 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback2o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id x2YpFMvdgL-0F2epYit; Thu, 16 Nov 2017 18:00:15 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id H8kylhnNlg-0E3i1lWU; Thu, 16 Nov 2017 18:00:14 +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: Thu, 16 Nov 2017 18:00:09 +0300 Message-Id: <1510844412-21931-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510844412-21931-1-git-send-email-odpbot@yandex.ru> References: <1510844412-21931-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 298 Subject: [lng-odp] [PATCH API-NEXT v1 3/6] api: pktio: deprecate odp_pktio_mtu 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: Petri Savolainen MTU is not a well defined term for link layer maximum receive and transmit frame sizes. Use odp_pktin_maxlen() and odp_pktout_maxlen() instead. Signed-off-by: Petri Savolainen --- /** Email created from pull request 298 (psavol:next-frame-len) ** https://github.com/Linaro/odp/pull/298 ** Patch: https://github.com/Linaro/odp/pull/298.patch ** Base sha: d4b364849c4abb4c71e0c5260e1a793ebb8dc97d ** Merge commit sha: f65f2a6ea63917fca4366f41eeac436d31acec9f **/ include/odp/api/spec/packet_io.h | 12 ++++++--- platform/linux-generic/odp_packet_io.c | 2 +- test/validation/api/pktio/pktio.c | 49 +++++++++++++++++++--------------- 3 files changed, 36 insertions(+), 27 deletions(-) diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h index b09c9cfcb..a9a39a641 100644 --- a/include/odp/api/spec/packet_io.h +++ b/include/odp/api/spec/packet_io.h @@ -30,7 +30,7 @@ extern "C" { * * Packet IO is the Ingress and Egress interface to ODP processing. It * allows manipulation of the interface for setting such attributes as - * the mtu, mac etc. + * number of queues, MAC address etc. * Pktio is usually followed by the classifier and a default class COS * can be set so that the scheduler may distribute flows. The interface * may be used directly in polled mode with odp_pktin_recv() and @@ -938,14 +938,18 @@ int odp_pktout_send(odp_pktout_queue_t queue, const odp_packet_t packets[], int num); /** - * Return the currently configured MTU value of a packet IO interface. + * MTU value of a packet IO interface * - * @param[in] pktio Packet IO handle. + * @deprecated Use odp_pktin_maxlen() and odp_pktout_maxlen() instead. MTU was + * not well defined. There may be difference between MTU and maximum frame + * length values. + * + * @param pktio Packet IO handle. * * @return MTU value on success * @retval 0 on failure */ -uint32_t odp_pktio_mtu(odp_pktio_t pktio); +uint32_t ODP_DEPRECATE(odp_pktio_mtu)(odp_pktio_t pktio); /** * Enable/Disable promiscuous mode on a packet IO interface. diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index cf65e7235..aa6cdb068 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -803,7 +803,7 @@ static inline uint32_t pktio_mtu(odp_pktio_t hdl) return ret; } -uint32_t odp_pktio_mtu(odp_pktio_t pktio) +uint32_t ODP_DEPRECATE(odp_pktio_mtu)(odp_pktio_t pktio) { return pktio_mtu(pktio); } diff --git a/test/validation/api/pktio/pktio.c b/test/validation/api/pktio/pktio.c index 004379cd8..39451de3b 100644 --- a/test/validation/api/pktio/pktio.c +++ b/test/validation/api/pktio/pktio.c @@ -617,13 +617,13 @@ static void pktio_txrx_multi(pktio_info_t *pktio_a, pktio_info_t *pktio_b, if (packet_len == USE_MTU) { odp_pool_capability_t pool_capa; - uint32_t mtu; + uint32_t maxlen; - mtu = odp_pktio_mtu(pktio_a->id); - if (odp_pktio_mtu(pktio_b->id) < mtu) - mtu = odp_pktio_mtu(pktio_b->id); - CU_ASSERT_FATAL(mtu > 0); - packet_len = mtu; + maxlen = odp_pktout_maxlen(pktio_a->id); + if (odp_pktout_maxlen(pktio_b->id) < maxlen) + maxlen = odp_pktout_maxlen(pktio_b->id); + CU_ASSERT_FATAL(maxlen > 0); + packet_len = maxlen; if (packet_len > PKT_LEN_MAX) packet_len = PKT_LEN_MAX; @@ -1026,16 +1026,21 @@ void pktio_test_recv_mtu(void) void pktio_test_mtu(void) { int ret; - uint32_t mtu; + uint32_t maxlen; odp_pktio_t pktio = create_pktio(0, ODP_PKTIN_MODE_SCHED, ODP_PKTOUT_MODE_DIRECT); CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); - mtu = odp_pktio_mtu(pktio); - CU_ASSERT(mtu > 0); + maxlen = odp_pktout_maxlen(pktio); + CU_ASSERT(maxlen > 0); - printf(" %" PRIu32 " ", mtu); + printf(" %" PRIu32 " ", maxlen); + + maxlen = odp_pktin_maxlen(pktio); + CU_ASSERT(maxlen > 0); + + printf(" %" PRIu32 " ", maxlen); ret = odp_pktio_close(pktio); CU_ASSERT(ret == 0); @@ -1706,14 +1711,14 @@ void pktio_test_start_stop(void) /* * This is a pre-condition check that the pktio_test_send_failure() - * test case can be run. If the TX interface MTU is larger that the + * test case can be run. If the TX interface max frame len is larger that the * biggest packet we can allocate then the test won't be able to - * attempt to send packets larger than the MTU, so skip the test. + * attempt to send packets larger than the max len, so skip the test. */ int pktio_check_send_failure(void) { odp_pktio_t pktio_tx; - uint32_t mtu; + uint32_t maxlen; odp_pktio_param_t pktio_param; int iface_idx = 0; const char *iface = iface_name[iface_idx]; @@ -1734,14 +1739,14 @@ int pktio_check_send_failure(void) return ODP_TEST_INACTIVE; } - /* read the MTU from the transmit interface */ - mtu = odp_pktio_mtu(pktio_tx); + /* read the maxlen from the transmit interface */ + maxlen = odp_pktout_maxlen(pktio_tx); odp_pktio_close(pktio_tx); /* Failure test supports only single segment */ if (pool_capa.pkt.max_seg_len && - pool_capa.pkt.max_seg_len < mtu + 32) + pool_capa.pkt.max_seg_len < maxlen + 32) return ODP_TEST_INACTIVE; return ODP_TEST_ACTIVE; @@ -1753,7 +1758,7 @@ void pktio_test_send_failure(void) odp_packet_t pkt_tbl[TX_BATCH_LEN]; uint32_t pkt_seq[TX_BATCH_LEN]; int ret, i, alloc_pkts; - uint32_t mtu; + uint32_t maxlen; odp_pool_param_t pool_params; odp_pool_t pkt_pool; int long_pkt_idx = TX_BATCH_LEN / 2; @@ -1770,8 +1775,8 @@ void pktio_test_send_failure(void) CU_ASSERT_FATAL(odp_pktout_queue(pktio_tx, &pktout, 1) == 1); - /* read the MTU from the transmit interface */ - mtu = odp_pktio_mtu(pktio_tx); + /* read maxlen from the transmit interface */ + maxlen = odp_pktout_maxlen(pktio_tx); ret = odp_pktio_start(pktio_tx); CU_ASSERT_FATAL(ret == 0); @@ -1781,15 +1786,15 @@ void pktio_test_send_failure(void) CU_ASSERT_FATAL(odp_pool_capability(&pool_capa) == 0); if (pool_capa.pkt.max_seg_len && - pool_capa.pkt.max_seg_len < mtu + 32) { + pool_capa.pkt.max_seg_len < maxlen + 32) { CU_FAIL("Max packet seg length is too small."); return; } /* configure the pool so that we can generate test packets larger - * than the interface MTU */ + * than the interface max transmit length */ odp_pool_param_init(&pool_params); - pool_params.pkt.len = mtu + 32; + pool_params.pkt.len = maxlen + 32; pool_params.pkt.seg_len = pool_params.pkt.len; pool_params.pkt.num = TX_BATCH_LEN + 1; pool_params.type = ODP_POOL_PACKET;