From patchwork Tue Jan 9 13:23:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 123953 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4021436qgn; Tue, 9 Jan 2018 05:27:15 -0800 (PST) X-Google-Smtp-Source: ACJfBosFH1kqclRf509gwCkA9yJ3IcY/E3dRgxRVQW31MnzygccklWh+VhjVDXH/BKjN9k9n+s0H X-Received: by 10.223.157.6 with SMTP id k6mr13221806wre.124.1515504435049; Tue, 09 Jan 2018 05:27:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515504435; cv=none; d=google.com; s=arc-20160816; b=0foOp87zXaNhDp4dfdRlfc/SJ0JBRheu7rYcOSIyCq8nMXt/m+us93dlCPAH2GKe81 9utL/dQkTmSQeMbXgqhbiBTUbMFmcYdstKkkwp3D73dms0lwCOGk+w0LcACRZaSSiCBO c6qdFnm2diav7OD9rrNJJ0eAdFpOTur0pgh3W8t3fqfrR5O8dyEU6yg56A7MM/54EsWV 3Phwv5RfcNfsM6I5JXbevbwgsLzU2pAf3WvlQDt53xMXNuHzItxzaaSgjp5yRnOLqf97 vJscHkzgAUdnEy0i4OryM8X9TlvNChkfgSSAPUd9XSxg2Yv0yTohaMskq1zNzbnyVEvi gquw== 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:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:cc:to:from:arc-authentication-results; bh=uOJUZAgTQ7lEga7wJ093JqLFRwA7C89gequ3ozzvheY=; b=j4Dj5FMzQX9Qocj9r6RAuOLDZFq1wQ6+vq/ylwk6C23ordNWZELFMH1cw8z2zKK7pC WZ12JXqvT8C7RIuot7JnuXksJBjZYPGZ82iGv1w0oH1FQ1SDDCNlLz4P+ZWhBZErbRRB C/lQSX7IEi42eCLS/wq4hpe8h4+sgCN5DJaaGL/w8it82eEE8HELIG8kBd9AOPfj6Z01 hWKf9phTeWX+kAlCRJdBMgoDsuojI8u/VcGAc3MUTKu0kldFn5T0q43cHWqsSE0XMEM5 yOQVK8tPMXLwAhDCBIr9Ejdo+kCYeLwT+83hfOUpZbPwyMr8hFmV3DPaSxmuz3GLZm0M xpTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id 91si10726712wra.41.2018.01.09.05.27.14; Tue, 09 Jan 2018 05:27:15 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3445D1B230; Tue, 9 Jan 2018 14:24:50 +0100 (CET) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0050.outbound.protection.outlook.com [104.47.37.50]) by dpdk.org (Postfix) with ESMTP id 97E101B1D5 for ; Tue, 9 Jan 2018 14:24:47 +0100 (CET) Received: from BN6PR03CA0060.namprd03.prod.outlook.com (10.173.137.22) by CY1PR03MB2362.namprd03.prod.outlook.com (10.166.207.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.8; Tue, 9 Jan 2018 13:24:46 +0000 Received: from BY2FFO11OLC006.protection.gbl (2a01:111:f400:7c0c::190) by BN6PR03CA0060.outlook.office365.com (2603:10b6:404:4c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.386.5 via Frontend Transport; Tue, 9 Jan 2018 13:24:46 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; NXP1.onmicrosoft.com; dkim=none (message not signed) header.d=none;NXP1.onmicrosoft.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11OLC006.mail.protection.outlook.com (10.1.14.199) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Tue, 9 Jan 2018 13:24:14 +0000 Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id w09DOAVw017638; Tue, 9 Jan 2018 06:24:42 -0700 From: Hemant Agrawal To: CC: , Date: Tue, 9 Jan 2018 18:53:02 +0530 Message-ID: <1515504186-13587-15-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515504186-13587-1-git-send-email-hemant.agrawal@nxp.com> References: <1513166759-13466-1-git-send-email-hemant.agrawal@nxp.com> <1515504186-13587-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131599778551374957; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(376002)(39380400002)(396003)(346002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(316002)(296002)(77096006)(104016004)(6666003)(86362001)(2351001)(5660300001)(2950100002)(6916009)(106466001)(48376002)(50466002)(97736004)(105606002)(50226002)(8936002)(305945005)(54906003)(356003)(68736007)(47776003)(16586007)(8676002)(81166006)(36756003)(81156014)(4326008)(8656006)(2906002)(51416003)(53936002)(59450400001)(498600001)(85426001)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR03MB2362; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC006; 1:q/IpoOHrHoHeTzymGXV3LFKrcesQH6/b2wmE/84L4oj/IMAGv3s95f5MxFcdtQwveQN65LOTcuOG/B67xwR46aviWHZbEqIdn+ndg34oDhUquR+cEYvzwVAt37Tb/DRo MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e29a0798-baec-4177-c312-08d557644787 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307); SRVR:CY1PR03MB2362; X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2362; 3:CNzywSxRL1uoB15yG5vXgEJWa7ijWoCxoM+JZZIwiwg9LFkkbTHvuSLeOV9DEyhiSww+qbxhci/NY7pHftH/9Ggn8IFpRv0sORR/h4LNHb++cpKfmO1g47qvbcuYIzK0ZSssNrQTRVR/4hpnhg77woRwDPdcR3TPoYKh6ynND7tj7hi10Xug/XLWCSQQYC16lQ728Dzbn4Ve1cKQlWotS8mFJKG8cVbpQ9gI2nHxi1ea7Ayjgx6Gqpg5FUD4GOTTzz4UPtQZJEM/hdFpJmi8fGX5fNkokuhqxQ6sPv28U2ERfx/UDtMbV1jMk5e63RwSARSKKUoAKZXM3gzkgbh8uv4r5VIUMgh6kCTRfHTXncE=; 25:sUYkpet3QO+JaF2RbQBoM1XFG09tWKiR0087Yp6FCAF1SSteESWzRg/eNSQ5NiKeeub3CFtwdx2OdjPlcFl07MPFuJcyVsJczg6RcBGnYtYT9rYTMpdKX5hO0YdJFslQrmtXXNRlcXqeZZpLjobnoKQ8iUT4pXC4T//S4TOuRJshzs5PamNnWOQECnswt9tCVilczZnpCYmoMVfd0S3gEYmO6AMtGWzYN7WbcuRZuY6wmYTZYZeU8D2LJNMP3mMEnaxv80u4GsW89FMH6mKTCPOwFhaHMsjtMpjMBUy2kgAowC9YBsvgKiv93LKx1gfBFeadLkPKAxugzS+OI1+28Q== X-MS-TrafficTypeDiagnostic: CY1PR03MB2362: X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2362; 31:/SkcKgR0fssAXBohEAw5niOlgT7K2gGHYg22YJdQfhmXx5CBY9GtACghLke6CGeqHjyGT/DpEx/0YAXyC6TwOXQCo51eMaeN9AyolqfGI91pXMYVED43SUG///iRRKSWWQNXyRgkjUB+2ywmGopkdYyM4nSoUJabAhVDsrF9dq1ZeuQgU0scfjAG0RO4PR+lzEOq4ZQg6qV7atpmWSgPmfzA3S9bdbPQ6nSMXxk/XwI=; 4:I1jtsxxPTZxVw36slYvWJ6Kpa0+WRWTXYoZJ8DLhszFLJKMMctOEf25I9NROMMxceEspzWRkAApWd1rLh+mNTbHOg2mqg306B9hg2My04tGbOVRQD/yRhpvvarf2dYmB+xMDNqurxgY32tazZ4ZU58x/Ci36DxF1L5iT2hD5AXQs4lDqH7YCpHdohijIgZOe9s8cCpbGRE0Bd0p21SofX6asxhjqDQjqHZWlc4iYzVB5N0mqqWCtmFGgKqU0tKoZshg4poFuqaJ0/5E5s86XweOVF/2g74xTJsjGTAnzqPv2w4dFq/xJjsehsGfN8k7x X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231023)(944510075)(944921075)(946801075)(946901075)(6055026)(6096035)(20161123561025)(201703131430075)(201703131520075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123563025)(20161123559100)(20161123556025)(20161123565025)(201708071742011); SRVR:CY1PR03MB2362; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:CY1PR03MB2362; X-Forefront-PRVS: 0547116B72 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR03MB2362; 23:GIKtPXi9UXTAgSRx5JlSF/No0iP9b/sSB7vScjNCb?= d0l0HSC/jLvRP322pBo5/eRnDVUbE9KXNaAb9rcE3ufvSkgTdF7ZSH0ojSMMk3jX5+xoowRxwk3lOfqiJiPcUq9V4+j5W7ESdFEu9S+xxHZmyoMmSmOtGco8lal3iX5CzEe6p0nyt3eHlyIEVbEaeeYgKBGLMwMVEvotGnSlZ2uHX2x1nAVBNb5Z60ehoQibiMN0redqhe2MHbs4196fBHhxC/kBeaizXALa2G1g4rCEIJV3vqNhu79c3HEoqh5Nx68tBDIelhLvTYJ47YSmsKoJBBnKaORHig91hXEg2fV7O50aEPrQ2QVbUPyfEvRS/MdR0eseKqo2Rj0qGEBV+Vzsj/nGb3J2IQSffejkV8OQNmOL0YQ4123zUeWGeYvqYcMOMdm2AsF1afg+m5N7SCDNhmwMG7KXzETk4a6ekqACSaKNDE4vXdjccnxyG6XSJYSbLIqakp88ecMT9sIDgIbbx6aAsV/dDr1tg3k3i5m15NhJGMHXYG/lh/Dye0FbvAb+eatyq7mXOMz5GXMZJgqiNOUYDASJoPGb+hV8WD1a46xipxlk6uCiBUJfvwXgpNSSDvIsKSAe96wqXed4uardtw9z8rdA444HjfFwunAH/G1YdkxQfcAsgB/ygDhHNYRf/YcGIBZs6V46bnHPk6cUwE412uMNhIB/QMtAZNACEOgFiZ1hDpmluM0sqjMInIXZY2S7Uyk1R0cwqGD1KWQ7u7NVC6WaDoQa1VWrvTbGWFRtXPwZTAiSuupxxv8YdSVO4O4926lT6O0dMsSaUgBsiiuC9tqgcN1Phq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cF/Xp8MPt2B9fQlR0MozlB7UvHebp4Mx6JSOuOpc+UbmtFTaUFE4GGGuTAfIEzbaqNr/Z+IhKg4NunwV6+y26QzZmqLlxX4MoUW3CMmpz3XwNLuPP0n0Z9Xhr+SY1MYXU30YiBUwQ7KyWKBrzrlevu/A SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2018 13:24:14.9347 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e29a0798-baec-4177-c312-08d557644787 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR03MB2362 Subject: [dpdk-dev] [PATCH v2 14/18] net/dpaa: add support for loopback API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Signed-off-by: Hemant Agrawal --- drivers/net/dpaa/Makefile | 3 +++ drivers/net/dpaa/dpaa_ethdev.c | 42 +++++++++++++++++++++++++++++++ drivers/net/dpaa/rte_pmd_dpaa.h | 35 ++++++++++++++++++++++++++ drivers/net/dpaa/rte_pmd_dpaa_version.map | 8 ++++++ 4 files changed, 88 insertions(+) create mode 100644 drivers/net/dpaa/rte_pmd_dpaa.h -- 2.7.4 diff --git a/drivers/net/dpaa/Makefile b/drivers/net/dpaa/Makefile index e5f662f..b1fc5a0 100644 --- a/drivers/net/dpaa/Makefile +++ b/drivers/net/dpaa/Makefile @@ -34,4 +34,7 @@ LDLIBS += -lrte_mempool_dpaa LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs +# install this header file +SYMLINK-$(CONFIG_RTE_LIBRTE_DPAA_PMD)-include := rte_pmd_dpaa.h + include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index de016ab..85ccea4 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -38,6 +38,7 @@ #include #include +#include #include #include @@ -84,6 +85,8 @@ static const struct rte_dpaa_xstats_name_off dpaa_xstats_strings[] = { offsetof(struct dpaa_if_stats, tund)}, }; +static struct rte_dpaa_driver rte_dpaa_pmd; + static int dpaa_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { @@ -707,6 +710,45 @@ static struct eth_dev_ops dpaa_devops = { .fw_version_get = dpaa_fw_version_get, }; +static bool +is_device_supported(struct rte_eth_dev *dev, struct rte_dpaa_driver *drv) +{ + if (strcmp(dev->device->driver->name, + drv->driver.name)) + return false; + + return true; +} + +static bool +is_dpaa_supported(struct rte_eth_dev *dev) +{ + return is_device_supported(dev, &rte_dpaa_pmd); +} + +int +rte_pmd_dpaa_set_tx_loopback(uint8_t port, uint8_t on) +{ + struct rte_eth_dev *dev; + struct dpaa_if *dpaa_intf; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); + + dev = &rte_eth_devices[port]; + + if (!is_dpaa_supported(dev)) + return -ENOTSUP; + + dpaa_intf = dev->data->dev_private; + + if (on) + fman_if_loopback_enable(dpaa_intf->fif); + else + fman_if_loopback_disable(dpaa_intf->fif); + + return 0; +} + static int dpaa_fc_set_default(struct dpaa_if *dpaa_intf) { struct rte_eth_fc_conf *fc_conf; diff --git a/drivers/net/dpaa/rte_pmd_dpaa.h b/drivers/net/dpaa/rte_pmd_dpaa.h new file mode 100644 index 0000000..04955a4 --- /dev/null +++ b/drivers/net/dpaa/rte_pmd_dpaa.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2017 NXP. + */ + +#ifndef _PMD_DPAA_H_ +#define _PMD_DPAA_H_ + +/** + * @file rte_pmd_dpaa.h + * + * dpaa PMD specific functions. + * + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice + * + */ + +#include + +/** + * Enable/Disable TX loopback + * + * @param port + * The port identifier of the Ethernet device. + * @param on + * 1 - Enable TX loopback. + * 0 - Disable TX loopback. + * @return + * - (0) if successful. + * - (-ENODEV) if *port* invalid. + * - (-EINVAL) if bad parameter. + */ +int rte_pmd_dpaa_set_tx_loopback(uint8_t port, + uint8_t on); + +#endif /* _PMD_DPAA_H_ */ diff --git a/drivers/net/dpaa/rte_pmd_dpaa_version.map b/drivers/net/dpaa/rte_pmd_dpaa_version.map index a70bd19..d76acbd 100644 --- a/drivers/net/dpaa/rte_pmd_dpaa_version.map +++ b/drivers/net/dpaa/rte_pmd_dpaa_version.map @@ -2,3 +2,11 @@ DPDK_17.11 { local: *; }; + +DPDK_18.02 { + global: + + rte_pmd_dpaa_set_tx_loopback; + + local: *; +} DPDK_17.11;