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 CF0B390F8 for ; Thu, 31 Aug 2017 16:56:15 +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=O65fvIpmBWGa6Af/4DmXy62D8CieUDQu9eShteS50Hs=; b=VKLlMxmBjeziqOrLPQLgG9Wb/fNl1hvNb0ZDDbo1KcdVTknviFcg4YGTv/cW03feOMFKh503LoLmwMdnqUurb9c9YAMG6+i0tChO27pwcrIWv3yOIvhsZy66GPRpb82Py4gMiOks81THDCosDrl+ESPe/+lexMKvV3eHNLx4tEs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; Received: from jerin.domain.name (171.76.126.71) by SN2PR07MB2526.namprd07.prod.outlook.com (2603:10b6:804:6::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.10; Thu, 31 Aug 2017 14:56:12 +0000 From: Jerin Jacob To: dev@dpdk.org Cc: ferruh.yigit@intel.com, santosh.shukla@caviumnetworks.com, Jerin Jacob Date: Thu, 31 Aug 2017 20:24:32 +0530 Message-Id: <20170831145436.5397-23-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170831145436.5397-1-jerin.jacob@caviumnetworks.com> References: <20170831145436.5397-1-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [171.76.126.71] X-ClientProxiedBy: MA1PR01CA0109.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::25) To SN2PR07MB2526.namprd07.prod.outlook.com (2603:10b6:804:6::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1d94e9f8-bf39-4ce7-6783-08d4f0806d1f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:SN2PR07MB2526; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2526; 3:XEXbZ9lS6TefgZEy7d/Ov1NTLOTF3wpwuUxpnofAhtsPWCVCsgUY3OgrswSM1OAz4a56838y8NLc2VlqEfSdmi37WVqPgrPNMG0o1BEb/7GRjGIykYxEUqTda38mcOqpHqo9lLeEQmulE8nR61auoduJOjF/gB6gz+APbz+3VWZtTCqPYxqzwyuepGSjFJ7UQp3NlwrMr7gvrQOsXBijXC8mkQajmhvxEM1SlWt4UnrtjQq58mB90sWxfAtVlF4J; 25:q++U3XfT8CIkKM3GKi+V7eyJskbPUBRh0fVbwEQW1+JOptuDXpiILKdv45xrG26dwYRQQZEZGcka6rSqyZ41h5mD5Jt6FvWfB+yDb4DE9B63sqz1i+3ppSW1B53kd7JL5YZlWIJK5njROLY9MP+7Np/tZEPm8RXl5RtKAl1lhyNEOtO/8A9U53dvHZ9symM4gTipqVbSZhEqw+ENmnbkqEr2xbpX1dr/6ptnOPDyk+/COhNCJmQmCM56+O0vJfXimhzEPxdwqAV/eKKCd4E/Qex7/pLy8ZvSAllSzyNbgR5u+y0BYWK3l3h9gkdwMub41UTaRCPNHz2uuUgQunDdXw==; 31:fw7puU27reU7OxGw5051jbp2q1r8i+Xl7I4pIILWtgncAC3SeMKMR2teEiB7TycfpGqxQpZGD3pOdznv9dw8AP55g/MhXaXosK0VUXIe/WuaL+Tyw91OKpnbySDtmFh2CqeV1KNxQdlNyWuplT2ly4jjZ0CMT1vX9xwhvXUwFHNTKm+ROc/OnPy8tjH0uUAFHuaSXILoPO+RMXXfGQbnX28JKOPgdnqkielWWKCUZJo= X-MS-TrafficTypeDiagnostic: SN2PR07MB2526: X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2526; 20:Y2eHi4s9R54Wo295lnZeAGZIYze/DBiU5kg1r6cJfrYi1Rp3hbxY4jeeJF379tAo9QyiVib/tBu+bkrMtqQ7W+O7CdEYuLpchtZBREvFjnkqnm+tpWWOqgvggHtkQcBStrjfOwQzLJZYMsIsX3YzvM+4yTh30VefF46t+x+Fgn6z34mwdYGPMtnvpQyTPXcG7zsE14UKwMRd7pjp08XieTMtaSdDVke2g68cBuDkWRECMn0ZwH+8SSxPxeDWqcT/2y32iUSoXEfPO8+kp5bPzAON6yaPXL7Jght3L4TuwD3O8Jm0kOstp6OTlCMu9NCBq/xxz+EeHDHHdEP/VEvAbXMujRLFATnCVGj3wWOmHHNRNs/NSUpfdEB5WpSnzpgwxRcklVz9i83Bf+hPSkct/qjOqV6DwMZ68tXQcufPAREWypM8gCFdvW9rXeqWYJkpp+q+3qRAuW/GiqZnpEHJupS63TLj4QIFJtmF5CVqVkNAF3VbIwipWBufxvI2RMJBRjED+trlOt1MYzFwDnUj0ytjxuUH0WlZmPU/7UTqDkCyHEIiBUH3TrK5UHZbOpDgV0qmshg524lQD4Ea0WTkKPZ36qpm1eiIT8zGTTECJDk=; 4:TNV3lbb97jgjU/bgYCeAO4cB1Qoq3ZfM7pP13i2c1pwLADwCSeC2T+eDSIXrfZZeHU9IwvsLny2xXe1tJCarc6bfHivdQSYfbDEEgf9EBq1/SPXNU+Zy4a6VS3hnGAewpE1ShVVbWDXqAjexB4/xvy94wd9cu+xG+MdyQoy92K4j7RiX6qClcBWT5Qt4z+eQ8NHQasdnBTouvE0PDnS8vurQeb408BxX76IHn/HjQZBhXnthEuoCoASyHcY/2py6 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)(601004)(2401047)(5005006)(8121501046)(93006095)(100000703101)(100105400095)(10201501046)(3002001)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123564025)(20161123562025)(20161123560025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:SN2PR07MB2526; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:SN2PR07MB2526; X-Forefront-PRVS: 04163EF38A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(199003)(189002)(25786009)(1076002)(53936002)(3846002)(6116002)(575784001)(478600001)(110136004)(72206003)(7736002)(6666003)(107886003)(6512007)(305945005)(6506006)(36756003)(6486002)(68736007)(5003940100001)(189998001)(50986999)(42882006)(106356001)(101416001)(76176999)(2950100002)(6916009)(5660300001)(2361001)(33646002)(2351001)(2906002)(4326008)(97736004)(105586002)(48376002)(50466002)(81166006)(66066001)(69596002)(8936002)(47776003)(53416004)(8676002)(50226002)(81156014)(42186005); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR07MB2526; H:jerin.domain.name; 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; SN2PR07MB2526; 23:D48GHtr0K/yQzB1YO85qGXE7gTjo0whupfR+HU6PE?= =?us-ascii?Q?5QcUOIFMZrlzwzmtdVkxcXnxqPq1R9JBAi9ObNviSpyBN7u6UCzbe7LeHufi?= =?us-ascii?Q?AhzRHECTYG5d7I9HZCVClxzFFpCoOJ/x+weaMkc1Qr5+GYZq5qj3cbgFDoIv?= =?us-ascii?Q?kgrWY5tm8iLlV9gU55oEKeBU0YuXjpPPfvzVaRxZevP9N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: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2017 14:56:12.6305 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2526 Subject: [dpdk-dev] [PATCH 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: Thu, 31 Aug 2017 14:56:16 -0000 Signed-off-by: Jerin Jacob Co-authored-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