From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0072.outbound.protection.outlook.com [104.47.36.72]) by dpdk.org (Postfix) with ESMTP id 300FD1B26E for ; Sun, 8 Oct 2017 14:46:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=4iDFgZ5JUxRqCsys7/Nsggxzi87enu1YXaqlFGXKA8A=; b=XXYoz8CXplwFQtQMOHL70eEjiLwW3Dq+A30L+yg0Xa2RuIDPtCsbDjY8qxbAlDEhr6NacpRxI3UJ/gBExmoOPbRH61jHN/hH3r34u6Kt7UFpBoX9040HXcvJae4E27DphK02KtCfk1MVjc06d2zqXIpHSxW8113ItDY+zNtgagU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from localhost.localdomain (14.140.2.178) by BN6PR07MB3089.namprd07.prod.outlook.com (10.172.105.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Sun, 8 Oct 2017 12:46:15 +0000 From: Santosh Shukla To: dev@dpdk.org Cc: ferruh.yigit@intel.com, jerin.jacob@caviumnetworks.com, Santosh Shukla Date: Sun, 8 Oct 2017 18:14:26 +0530 Message-Id: <20171008124430.1866-23-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171008124430.1866-1-santosh.shukla@caviumnetworks.com> References: <20170831145436.5397-1-jerin.jacob@caviumnetworks.com> <20171008124430.1866-1-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: MA1PR01CA0113.INDPRD01.PROD.OUTLOOK.COM (10.174.56.157) To BN6PR07MB3089.namprd07.prod.outlook.com (10.172.105.7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f1ead223-44b5-4b01-6c86-08d50e4a9133 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:BN6PR07MB3089; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3089; 3:cB5ifFwRXX31W8A5LP23o3ElC/u8gxKQ34oEDk38089lYJ4MTsILg15v6pE2azDwHu18QcayNG7sIagIT41+rxMuXIdJfQUZCo8+QyA4A1360cimCp7n1/VyWrb3knv/Fr0aIK2qBY+jQVGCDGT3micxZDT30vNwb5LcoaOkx6zjvPb98oNsZH9GyJ2er0AG4J38U/itNUCSyhPDBWT6tuwXAjQ0VTsqusLE4LUe9I7YqSOIXjIjF5I/5xswsAIQ; 25:HjFcobA9/0y0SmqMVR6T7Mo5+HH1iq3xd3yMSbdJ9udmLYFNGTRgBDf32TZv7e6AeXZ31X0P8OEcT9LCL+9cd75VRumkI6cz7Hr/OGofbFM0NLolsfA1qnvdptaoUaa81BUlDH6nOfRTdxG+wZBRZbb474MPgpPvnT5WP4/yfly3V5mdxPcAUmVyU/mprIZi3MEQ4LIds60WNJtKbvO6s8fOYrWVP1BrAdhcXCX+uOrCbPWitHmGmVIUj4nbPsxQ5O+HzOwE79Nl2rra31dYIEsGLpRVOf50MrCTqgLnf7RuOpYbJfNtnRmbBid8GNqxUS4LXMSlmdyGk6Qwltzm5w==; 31:HvMq4FaGw53/EQOmWAy71mRqD1XNWG2Ty4556eswitVc4iZWbxzixizepFUopLVrtv1YZmVQhETj6jFpqGMcehRiUQPTL2aXkYe2Bktugb9NkrhP8WPnUWeXOXL4QrXpx3mbw8npHhMy1/RtETn7dmu/rRhvcZRbm/QCLMvSzlxtdBI+KivqYTMrf/1u257CZzLNXlv2skvcu/hP59dEsWa/1VtT2XqWr+ORlBgPBF8= X-MS-TrafficTypeDiagnostic: BN6PR07MB3089: X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3089; 20:VzUrm61Y0bD33p4cCJJkqQk70pGh/OLkHYoUh4UrHTV84Qhk5Xmeh8Mmak0VwLV0GlZWkKbiQpqzEH02zhcRwQ5O66GZMcK4bDQl7FwheUh/8R1abOTseiBzQULklm6lCMA5WRqN5nQyW4SWvcadXlp3TsgyQQy3znaTc03LN3UZpTXGPyJyur9JK2xpSfL8d5gyBnjD74wvpZtLYYSt3O+cbRN4HEudjwGaZNGE7L1BxRNLNBRrr0NKnlGAI25Y0JWin6/aygYkokBSZoCFDkWffFV0XwLNWaymUTNYo29RpMXL1/K44F3Z5lAeC9rUUVT4AWFrNgOQX9x19p66+b+RAtPYpBuDFn4Y8RCPM8H204eVHrcbGPSny59fdCb35Wk9iCncj7JWh2F1GJQWKPSijVgvvKncYtx6ZILhVhQMpni/nzxGDQmlDrGjqgMRh0VvO1svDxSFFc6H4Gy30l8DvzSrCupNIGaJJlqnlpSUYQTvDZXppCd1SApIJI5vWwqgYcdcg12i+EPUdNNVMFRxCASlXfRkpUTjid38BKyaL/zusnJz7QKsnxjj6QK1F5xx5QAflDVepUIOHEWOXC+2hEvbEkntMM7QdiYfUF8=; 4:HMzlNVYneLQu1numrmMZjUn+hyGxSS1SAHrLHAYm7c5IFp5lFDT3xmRXTu6VAXcLrOxOhM9Se2u8Fg5XSmD8WvjmpmJqv/OQeEj1bIJwzatmS9FGV60obJbj6CZ0vqNEEuSVUs4GZxXhl3Yl2Zm1X7cOw/X3xOmZJ779Jj1SCJwVMMo3UJsirJEpkMoZzoO86hrlz6ylV9wcwSaKTThvSxvKy8a8PRY6sz7kbcVDisuv7+D/bNemqoM3OkD6TpxA X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(100000703101)(100105400095)(6041248)(20161123562025)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR07MB3089; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR07MB3089; X-Forefront-PRVS: 0454444834 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(376002)(346002)(199003)(189002)(6916009)(42882006)(81166006)(575784001)(2950100002)(81156014)(8936002)(50226002)(6486002)(16526018)(6666003)(189998001)(16586007)(316002)(6116002)(1076002)(6506006)(3846002)(7736002)(305945005)(8676002)(106356001)(105586002)(5009440100003)(53936002)(4326008)(66066001)(107886003)(47776003)(2906002)(5660300001)(6512007)(76176999)(5003940100001)(50986999)(97736004)(25786009)(101416001)(68736007)(48376002)(50466002)(478600001)(72206003)(2351001)(2361001)(33646002)(36756003)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB3089; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR07MB3089; 23:FGNoweV0EwiVp0PqCTBhffKvVDcffRl5f5Hs+jKrL?= =?us-ascii?Q?PF7WeMN76eBR40S3J15FLw/w8xoODWYzycS7kS1yHg9x9JX0yxg/x4CN+B97?= =?us-ascii?Q?K+6FzLnUM0g9UagLmVMFBs404EoaFJvsGbB9EHIA+v2CAu7BhmR50kCfwt4o?= =?us-ascii?Q?aQFKZpmmyv7JGly1P7uQPsAYmg0i9G0QNe6GkwUaxlSbr29L7klb9XEGQLe6?= =?us-ascii?Q?yCfSzhS6hXi4Q6kVn2TkWX5uot/X9u2fWeSfjY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Output: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2017 12:46:15.0002 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3089 Subject: [dpdk-dev] [PATCH v2 22/26] net/octeontx: add packet transmit burst function 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: , X-List-Received-Date: Sun, 08 Oct 2017 12:46:18 -0000 From: Jerin Jacob Signed-off-by: Jerin Jacob Co-authored-by: Santosh Shukla Signed-off-by: Santosh Shukla --- drivers/net/octeontx/Makefile | 6 ++ drivers/net/octeontx/octeontx_rxtx.c | 104 +++++++++++++++++++++++++++++++++++ drivers/net/octeontx/octeontx_rxtx.h | 46 ++++++++++++++++ 3 files changed, 156 insertions(+) create mode 100644 drivers/net/octeontx/octeontx_rxtx.c create mode 100644 drivers/net/octeontx/octeontx_rxtx.h diff --git a/drivers/net/octeontx/Makefile b/drivers/net/octeontx/Makefile index e0eaf059c..4d6c67c54 100644 --- a/drivers/net/octeontx/Makefile +++ b/drivers/net/octeontx/Makefile @@ -50,11 +50,17 @@ VPATH += $(SRCDIR)/base # # all source are stored in SRCS-y # +SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX_PMD) += octeontx_rxtx.c SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX_PMD) += octeontx_pkovf.c SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX_PMD) += octeontx_pkivf.c SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX_PMD) += octeontx_bgx.c SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX_PMD) += octeontx_ethdev.c +ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) +CFLAGS_octeontx_rxtx.o += -fno-prefetch-loop-arrays +endif +CFLAGS_octeontx_rxtx.o += -O3 -Ofast + LDLIBS += -lrte_eventdev LDLIBS += -lrte_pmd_octeontx_ssovf diff --git a/drivers/net/octeontx/octeontx_rxtx.c b/drivers/net/octeontx/octeontx_rxtx.c new file mode 100644 index 000000000..32f46ae49 --- /dev/null +++ b/drivers/net/octeontx/octeontx_rxtx.c @@ -0,0 +1,104 @@ +/* + * BSD LICENSE + * + * Copyright (C) Cavium, Inc. 2017. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Cavium, Inc nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "octeontx_ethdev.h" +#include "octeontx_rxtx.h" +#include "octeontx_logs.h" + +static __rte_always_inline uint16_t __hot +__octeontx_xmit_pkts(void *lmtline_va, void *ioreg_va, int64_t *fc_status_va, + struct rte_mbuf *tx_pkt) +{ + uint64_t cmd_buf[4]; + uint16_t gaura_id; + + if (unlikely(*((volatile int64_t *)fc_status_va) < 0)) + return -ENOSPC; + + /* Get the gaura Id */ + gaura_id = octeontx_fpa_bufpool_gpool((uintptr_t)tx_pkt->pool->pool_id); + + /* Setup PKO_SEND_HDR_S */ + cmd_buf[0] = tx_pkt->data_len & 0xffff; + cmd_buf[1] = 0x0; + + /* Set don't free bit if reference count > 1 */ + if (rte_mbuf_refcnt_read(tx_pkt) > 1) + cmd_buf[0] |= (1ULL << 58); /* SET DF */ + + /* Setup PKO_SEND_GATHER_S */ + cmd_buf[(1 << 1) | 1] = rte_mbuf_data_dma_addr(tx_pkt); + cmd_buf[(1 << 1) | 0] = PKO_SEND_GATHER_SUBDC | + PKO_SEND_GATHER_LDTYPE(0x1ull) | + PKO_SEND_GATHER_GAUAR((long)gaura_id) | + tx_pkt->data_len; + + octeontx_reg_lmtst(lmtline_va, ioreg_va, cmd_buf, PKO_CMD_SZ); + + return 0; +} + +uint16_t __hot +octeontx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) +{ + int count; + struct octeontx_txq *txq = tx_queue; + octeontx_dq_t *dq = &txq->dq; + int res; + + count = 0; + + while (count < nb_pkts) { + res = __octeontx_xmit_pkts(dq->lmtline_va, dq->ioreg_va, + dq->fc_status_va, + tx_pkts[count]); + if (res < 0) + break; + + count++; + } + + return count; /* return number of pkts transmitted */ +} diff --git a/drivers/net/octeontx/octeontx_rxtx.h b/drivers/net/octeontx/octeontx_rxtx.h new file mode 100644 index 000000000..4a49fc159 --- /dev/null +++ b/drivers/net/octeontx/octeontx_rxtx.h @@ -0,0 +1,46 @@ +/* + * BSD LICENSE + * + * Copyright (C) Cavium Inc. 2017. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Cavium networks nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __OCTEONTX_RXTX_H__ +#define __OCTEONTX_RXTX_H__ + +#include + +#ifndef __hot +#define __hot __attribute__((hot)) +#endif + +uint16_t +octeontx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); + + +#endif /* __OCTEONTX_RXTX_H__ */ -- 2.14.1