From patchwork Wed Dec 13 12:05:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 121753 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5385582qgn; Wed, 13 Dec 2017 04:09:56 -0800 (PST) X-Google-Smtp-Source: ACJfBotc7KDmJQOnp4Aamxq+OYj82HLvCdapJ3CndodJXN70uqDCwSHY2uBsAHQ4cRWUKtH1uJqo X-Received: by 10.28.8.212 with SMTP id 203mr1724634wmi.8.1513166996053; Wed, 13 Dec 2017 04:09:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513166996; cv=none; d=google.com; s=arc-20160816; b=p5X4LduFZX52+Ih/5V/B1yb0+oIkGEDYQjXOaVny2dMGGm8ukJSJIp/aas7xBq8G7H gsDCX40tKPsyy+4PchVeU+SSnp/2CPco1tZwb+uA5/ejRAKo/y4dP7f4B3AKChrPUM9S ZLLzD4UN8UvgAyuRw8rjX1+EF21kkQ/KjCO4BadCHSeIsGv0MXC6WLeiyPZyISmQtLMY a2HV0uNI78v62c8wmfg1c4FisQKvDY2/GzziOrBaUB/EZI2T49f1E3Ey3oC5i7M9IKDT uy6jdXBHJRNiSStYRklZ4CgRaFbdivq2Nkchc4TCZyLKVXldVjn4cCMaEzZgaw4TAyQE GrFA== 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=W65+OEiPAuRCrXTQJjzZoTIfbQURt971xOIg2YN9PTA=; b=TOUxEHb4skV9m1flOpPteX0ZAaNThr+AhZ3KS0zKb42Hw0HxWUWWbA+6B8zJkh5IiE WWOeWEMBw9wVftti6BmXWsfb5icuhjW/l+ZzSO4y7kTfiL97HQyhkqtDVLjrxqaOfILf fsfDKyWnwJrx3mFRI+VoKBfsnvITa6lRE6GCRpmqd67xye/P+XkshTyzgtHmDrxXGDCC ft1Aiku1BpiTuhodVW6b0PrqgWF4wu5HwwOQfnAdR0ddmPMW/50rHo9rUt2VHE8btdDd XwW2ZobXmDbAIkbbAtt8ML1t8ynBOJyauKRPM6TxYNZ/FmpoEam75CqCTE1rOPxUibz5 xmdQ== 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 p17si1308220wrf.94.2017.12.13.04.09.55; Wed, 13 Dec 2017 04:09:56 -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 4AF0A1B1FD; Wed, 13 Dec 2017 13:07:30 +0100 (CET) Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0043.outbound.protection.outlook.com [104.47.33.43]) by dpdk.org (Postfix) with ESMTP id C0A5F1B1CE for ; Wed, 13 Dec 2017 13:07:25 +0100 (CET) Received: from MWHPR03CA0002.namprd03.prod.outlook.com (2603:10b6:300:117::12) by SN2PR03MB2368.namprd03.prod.outlook.com (2603:10b6:804:e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.302.9; Wed, 13 Dec 2017 12:07:24 +0000 Received: from BN1BFFO11FD020.protection.gbl (2a01:111:f400:7c10::1:135) by MWHPR03CA0002.outlook.office365.com (2603:10b6:300:117::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.302.9 via Frontend Transport; Wed, 13 Dec 2017 12:07:24 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; intel.com; dkim=none (message not signed) header.d=none; intel.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 BN1BFFO11FD020.mail.protection.outlook.com (10.58.144.83) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.282.5 via Frontend Transport; Wed, 13 Dec 2017 12:07:16 +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 vBDC6t9Z008652; Wed, 13 Dec 2017 05:07:22 -0700 From: Hemant Agrawal To: CC: Date: Wed, 13 Dec 2017 17:35:56 +0530 Message-ID: <1513166759-13466-16-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513166759-13466-1-git-send-email-hemant.agrawal@nxp.com> References: <1513166759-13466-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131576404367771606; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(336005)(376002)(39380400002)(346002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(3190300001)(189003)(199004)(498600001)(104016004)(53936002)(105606002)(356003)(2351001)(68736007)(4326008)(305945005)(106466001)(2906002)(5660300001)(97736004)(77096006)(81156014)(81166006)(8676002)(6916009)(6666003)(2950100002)(50226002)(51416003)(36756003)(76176011)(16586007)(8936002)(86362001)(316002)(50466002)(47776003)(48376002)(85426001)(59450400001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR03MB2368; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD020; 1:9ZUGMuG+905y60y+7c6eGDSlx1JJvrPpPMMfTwzboE7oLipIbVI6EOSs6jpBMAifmZhqJL+wcYsPmxxCvOGJhMEZRcdKscq+QdsXf/E9Z0toE8eu/Qyn7IiFT+G1P/o/ MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 72f51f28-a185-4e3d-07d6-08d542220da1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4628075)(201703131517081)(2017052603307); SRVR:SN2PR03MB2368; X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2368; 3:lA+xyQRQWRCniZKF81ww7CKrx2hjCVFWSkRyQsxAe+jo8kRLbvbXt29kinuJeWyymvBrhhbdZ95+ZXH1YKOpsmKCbrDBmt2j2+sl1ug5bROH0jPRHeJljPTYJxLPdFczn3bdDE9NDfVofJApj8s4noXuJja27zQKMduTu8dbk02Upi1MCWuy2uO2E1m0yb6v2m/T4obXmAzQuXYuxLwAjOPvKi9V6FjvMSvy0Sm5ku/V3GWhVT5KbkkzihRq9rFm5txiDfRbWUENcaFGEvymfJg3nIbnGaHVikYf/d7OV2ygvLqrfJmqNSjfPVxmITJPJ32ANjfpAIPbYKbA+q6AVaP2k6wdrY+zJMtVn4i09UY=; 25:ZST0F0s9omAdbqzvksJ6i2QXMUDvFbc/7ZnRmy9FpS6MPu8meGYtQJHMwTNFUV48T4FhjDqrwEPS3XuZufaSl5TSm54gE+REF9YkRVTbNX7WS5ba1DLCr+6hVF6bd3UgMtalyd1Rh0X1fRFCFm2ZVJlRc4Ado5HeLZiynaRkCCefOEKc9n5n9UFhHPHisAND3i1Cdc4Umg+HyTcgHPE9nQiB985/63+/DP5Cu0/gFE1yONJV7MIl3l/4MJWFKkRpk+Vh1PEsCt+HfHMT4OECBgrI/sBAJ2FgvEJ5TqFP31PPrNqKOxiwrRKNz6qRbGGPdlLGinVcBgc2+trV4QgU4Q== X-MS-TrafficTypeDiagnostic: SN2PR03MB2368: X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2368; 31:cNTXJcY/cYyJkgjr0kXstTpnqX1CP/EwOaXeUFrfYQmiiofbBZOH91yW+Wk4UwGv8FCA1jOMr7Sz9M73fki2OYtiJivcEdJMjFez8RZBVByuNxAiNsH4rN4A2Omefwwh0ePrzpfi2Jia+4bzINeP5xaqzd3laMC0jnuCKoxuMPGYj9czy5E2xZtyL85DyiD1PZw1e/c55psfnAAZxmvfuvRGuBY9MIAmooVwxVpJXj0=; 4:MqvFMXjzFnAJf28dbAG2KbTZQaIW+LkgQB8CfC9wn++EBFz6go3CJLgnXJkEaTZbMCSPLKTn7xHyVAbM3A5QM7CTKDhQbJS1E2BYIogVC0L3KYUVaCKKcqzpVQSq1atbqedzSQw8wxLS2URU53z6SWR3uDBMM0SC+12V7scoD9H9i+xcc9WH0Eg2Ca7TGnPUDSu9022Bseew2pJK+XygPyuvaMxsAk/ZMXU0ADTltibL5GOO0T3U+kd/tOSlO29MxqSCEWbZ2Z//DI5nlzKe8s2Qb9V+ACBrCVI1p9/tYkvaiHoPY7DPWwAUQ+Yv3fiS X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(3231023)(10201501046)(6055026)(6096035)(20161123559100)(20161123565025)(20161123561025)(20161123556025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123563025)(201708071742011); SRVR:SN2PR03MB2368; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:SN2PR03MB2368; X-Forefront-PRVS: 052017CAF1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR03MB2368; 23:xClYG4OeFcqtFvkEOdYDTWCEyx0wlv1ZluTuYhcQW?= s6DjbZYZysnEL4hb/Rvi/3dxbivlbSXxT0V3LxcFzVZxkwrJ5LFWJh3OPdQz5cp2P6miHLl/iBs8aAjqw7Kz5MQD7yQGS7eWs9D+XSZGhgNWiAemASWTPh/S/tMsnTtf/wuJmxmPZbdDiRR1Fx6XE4hTgiORu1mniXZR2Xlpe1NUZLB+OvMdmtD0AHlUjOULhX+BfPkyTZMTPYLXgQGuYui8fO3vKemH/FPivXUfPI+BWXA/YrGIFJ+fLj4u5wNcClCVcjXF57U8t46PeXviGWjoALM8EVdKIhkq+vQ22huHVJJ8Az4JBvSXk6OX5B59hR6I1V4YhL6j1X3tVWzsDx+T5V/1TPnGmqkjW/ATbOqbMdMwrZENI5TnaSI4fFwKdjdK9C7NjwRqjKrA2vMDb7tIET4vq/O8Xbi3HJQohAS4f1KdQ3obGpLZ9Mh5C2biLyuH94VB49w1+VJCgIXFb7CVlv4u8wKj8ak1c4XvACkOefqE2E630DvUkYiSCp3VdwfOwVUhceeqynjU50qglvuIvhS2aPtvfUkcp8iTYpeJo+xGI/xVyWRtBbs5Nwt0+1dTFgMww/YNhLFFq8qtGjguuFkhycBENFPLO0iLv82cC+roZja8o1otEkycTGEUM3MTlTEAyDxWlI4AcR/9x306EFMF86IVkgqYC8o3QoJuVIvaqCClONgMZ3ifWd0pV+araRhYCrxdqEPE3tYCEZKf9gdmy4Wv80GZTk3lHi10+wMKDdifJ+2UDgdb9Fa43AuU1vKuQMRT+ObNEWKfKE65qMpB+eeqQq22UF6bGiMBem1podQ+CRw4lfY8qI3NfOL44U3cQsa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KSQcjckwU6K80DKFYi6e5BRE/GlIINsf/4Dp91HU0LxzokjwWaTNifqJtP5PIn58tCa3D0/afZ+HlPCia+ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2017 12:07:16.6055 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 72f51f28-a185-4e3d-07d6-08d542220da1 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: SN2PR03MB2368 Subject: [dpdk-dev] [PATCH 15/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 | 37 +++++++++++++++++++++++++++ drivers/net/dpaa/rte_pmd_dpaa_version.map | 8 ++++++ 4 files changed, 90 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 171686e..a99d1ee 100644 --- a/drivers/net/dpaa/Makefile +++ b/drivers/net/dpaa/Makefile @@ -60,4 +60,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 53b8c87..fcba929 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -64,6 +64,7 @@ #include #include +#include #include #include @@ -110,6 +111,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) { @@ -733,6 +736,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..4464dd4 --- /dev/null +++ b/drivers/net/dpaa/rte_pmd_dpaa.h @@ -0,0 +1,37 @@ +/*- + * Copyright 2017 NXP. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#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;