From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0068.outbound.protection.outlook.com [104.47.37.68]) by dpdk.org (Postfix) with ESMTP id 66D2FF94D for ; Tue, 17 Jan 2017 14:20:25 +0100 (CET) Received: from DM2PR03CA0052.namprd03.prod.outlook.com (10.141.96.51) by BN1PR0301MB0740.namprd03.prod.outlook.com (10.160.78.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12; Tue, 17 Jan 2017 13:20:23 +0000 Received: from BN1AFFO11FD011.protection.gbl (2a01:111:f400:7c10::123) by DM2PR03CA0052.outlook.office365.com (2a01:111:e400:2428::51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12 via Frontend Transport; Tue, 17 Jan 2017 13:20:23 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com;nxp.com; dkim=none (message not signed) header.d=none; 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 BN1AFFO11FD011.mail.protection.outlook.com (10.58.52.71) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.803.8 via Frontend Transport; Tue, 17 Jan 2017 13:20:22 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v0HDJ8mS021741; Tue, 17 Jan 2017 06:20:19 -0700 From: Hemant Agrawal To: CC: , , , , , , Hemant Agrawal Date: Wed, 18 Jan 2017 00:22:42 +0530 Message-ID: <1484679174-4174-22-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1484679174-4174-1-git-send-email-hemant.agrawal@nxp.com> References: <1482988612-6638-1-git-send-email-shreyansh.jain@nxp.com> <1484679174-4174-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131291328222608873; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(336005)(39850400002)(39450400003)(39410400002)(39840400002)(39860400002)(39380400002)(39400400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(626004)(5660300001)(104016004)(81166006)(106466001)(8936002)(81156014)(105606002)(92566002)(97736004)(5003940100001)(8676002)(76176999)(50226002)(2351001)(50986999)(68736007)(6916009)(50466002)(30001)(110136003)(2950100002)(48376002)(36756003)(85426001)(6666003)(33646002)(189998001)(356003)(2906002)(4326007)(305945005)(47776003)(77096006)(86362001)(54906002)(5890100001)(8656002)(38730400001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0301MB0740; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD011; 1:SJBtGEKas9LTf4rqR6t0BbDYmlujCRnztJntsx9lWVAbcHTsZkjQo0PSrZGs6/NfGukw/w+0vTYYO4kN2es+A5kYUDSX2vspz7LA624g7JjeS7tBwlfJwV5SK4Qk/l5mtxcDUiV+Yj6JZcVyisOQYCfdp9xuTUs6HH+XOY8VHvVN8GAYGmavjVYvSFJsgEPBAtyq3kqJGjCq/8WKpkbxxEj3S76swd82BVJHmMvL3HQnyYmFlQCjzegl6+Y71Hkrr7nDnqVx4ftMD/z9nnCyRVYEBfNgLB2XHuL1cchS/AAmqQiDObe7TYIY5ca8Hms6aQ7NEuhsGHYZ2U9OJgsfTq/xGwsUzaE45KfZW9QBZsnHu7hhjbv8unh/5367oof0ZnuqR0VWSRb2MyPUU0cG23q9ADaJveQWEZi2VYGTw0JAyZwXRJ0w40WYvVWbwA+StCfmvlPEipkIq0H2UTOiJcIvrjNtwkyqVF0U8Nth9buRZ0FdrPl0JC8z84QTBo30u8N4sp4g28uRwHuKsfTM1vTzp9wCBC74s20XtBCCF92YwZYcejNcXL5NBku80cPsRPxDLHvpQk4CaVlPcn36nHDqDN3kOD6OhYUGn2FBqSwbfPaItE5IZF6lDXJzsNU/4M3Za1Dq1GvH//+v51ydHG/HYBpxAWG0PeWD2rI84POX5zURlsH0fewFg0FSBYvX7b9+ZHxZA/oNexWbBG5I5lp+JBmjA9amD04GSvsJrkBpa/B8pMQuh5sw9WO+CtJ8 MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: deb0cf1e-b870-4d42-dc8e-08d43edb9740 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN1PR0301MB0740; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0740; 3:9MTG9wP1z0xVxC0uYKaDbCYwjQ5m7HPpsf8HA4eOn8GKSbYFVIWl/JhtUUUglZkhlw+7mW3XcJhOpXNHVR2WNDjdnaZZt3LjYNL+Q50gr/188tJuGfOYTNeVR7vq4DzNMvbbTwFUs+PvSJ+3EiwTKAQC4JhdwDvjdSBAMwShutNefL3z+Wn4UqMqlXeqOm89fHHAMmgNxfRm9DvXknwJzZOOksENfS/s7IvgjwMODovGGH0vKSoJSytsYVnSLNB/48s1569/obntxqk4jmioqChEv4y8nNhXiopz9XQgrDZnep3HEYnM4ke/XjcaSpfOVXtCiEXkmj2bhngcgVSiTkybBbHDvgZdUld+QUhCYdSqHriArJoNj4QfqMo7Ic7a X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0740; 25:pRgKkAdAdlbg/xrlC5QU6yqJ+Sa30pDnFbGXVxvbx1N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t8Mz1aF+tRIPAhRTWeJmQmLr35zrVbnnJtD/A== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13023025)(13017025)(13015025)(13024025)(13018025)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6096035)(20161123561025)(20161123559025)(20161123556025)(20161123563025)(20161123565025); SRVR:BN1PR0301MB0740; BCL:0; PCL:0; RULEID:(400006); SRVR:BN1PR0301MB0740; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0740; 4:mK6kjUNG8a4zUCPlmWxZEZ9Y/idi2NSkmstX947tlSROpl7eBtPbCLDy4iAfvQw4j3QG5Jzms7BpQGbDD8fHpMeEgvq3px9ForrYUQ6ns2fqat7WqfjJva86j7qHMj/5HeJ47iL51UmnEuBALt/jdo5HJ9sWRaJqZByIDaNx0AuGUygjiS3fsrtWuYCL3HLlHdZhANipzc9JMFF4F4sC6n5DW8KmSAfTQfl7cBYIHlpr2RDvzGASNccmrBehPlgtHqu0abAcD77pYph86XmYGiNvjDH+eqqE5SdO/vtIOJx3t8IVmbfzBczXsDLAfqvYOg20xvOW5HfUCHkjcDLyZdJ7hUrAcOTTXJz/rH5iqCBMyuqxuDRe/k4Lh1eyes/1Wv6ls3xmYeUXXi9CrJoc5Lye53ylaLZvMJeBiUTfyaZ+3U5SPC7ZDndh0FC6dj2dARmn9N3OssQ2y71R4iGM1ZR5lCbhFikHoH+CDKnzo7JvCvFyHpc34xbHeCh+zTPYev11Q7/C4ZyrseRP/GewqFJt74rUQw7QT3gxZsuULeMexopFKFUR8UUQABVcVy3qI+eQUI18WxS2bCdtrtMR2fRML6TcXqfUTUqbFUwC4C5s22C2iLcFhlPpL8hvbJ5nD+C1zqbt3A2PxsdGjj0AF1ff06qNkyrDcpb4zIVu1GT+aRsTJIwFxJCVtkDpMa37fYYk0K7RImqqL/cEmFO2a3CmWSexwXqIHlbO9BIfQRd/5StzLSCReO+Se4ZwKdzfUUwKHOEZanWJh3AXrRnNLw== X-Forefront-PRVS: 01901B3451 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN1PR0301MB0740; 23:iTPmc907Yl9m2iY/kYDsD1EcW8Fp70xOuRc2IPU?= =?us-ascii?Q?VgOglb2XRfJON5TizQ24YAiE2ma/eUYx+7urt0fJNPknak1rSlexFnDioOOo?= =?us-ascii?Q?gy32PTTB9Ij3ToYQS2N5jjhLfQrkYPiddvsCRkB5x1TlGUUlEdWx69hL0nkA?= =?us-ascii?Q?SNhtAnnAk9Kd9eZXlQVDHRYsRDxiDlfB1GBhpSHTz+451fFhlSyotPc3rQkv?= =?us-ascii?Q?q2OsdzvezFcwMPEJMaaAJOgidnMmU3MyRzEqtazKHkia10esDCIFBBD7vedJ?= =?us-ascii?Q?70PX835yyzsfLYwQIsKuW4WiVQB2ejL9h7i03tGfDS7nsn/BkLPCe7+EPXmP?= =?us-ascii?Q?0+QQAtZwHHTExoypRyWAib2v9YOLkqOnReaUKPiThfeO8FefoQp0Q8bLJNq4?= =?us-ascii?Q?8AOh50iVQdNQFMsnn+AigtJJcDCFk66a6DkVCL1LM0NN0nIPP3+nCJfiG4Xx?= =?us-ascii?Q?tQEEI3AJUY/FD+zUszljfm3iYNglX8g8E7V+dCfz2bCZvaw6wKGfvzCuhBo5?= =?us-ascii?Q?RxzaVXmYdq16MjuSMrfWlA+Yi8QNd96WtUGPIVO1QW5hyl/ABthE1a8GInJB?= =?us-ascii?Q?joJFA2bifDRRGvh0RukbNKcK7lyjl4T4xpfaSFsnJ9mQCs1bi8lEdo/BBV29?= =?us-ascii?Q?T0NfA5raGn9dh/KUo8XpAD4fOZcg1xTtAp9DjN3w2qifoLEBXjp4V2RLXk+9?= =?us-ascii?Q?2RhJyiaicequYYHVdBNsi+1w/iWLq0UH6V9hE2DL0/+ZkPVjZ8VDJsJ3S1ma?= =?us-ascii?Q?zmrEil7zsH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uwiW2yAUh1vaDb0Qm7gtQHPZE3KG4vEFoQH4hvbi2ZkXCoigkoMxj5MyXbEG7qcrLrO7sZjvDtVPg01Wx3Y4tNyBqU+acee/rP3WqwasBlBxw+EEivSnlRZjqY; 5:uPsOLzDiVGai97NlO2PekPUK8bqwozvebkAFJFG4bVUvZso3D/paILSsi/rf4oljztfEjhapxm0wsrddpOPyFiZuPmMeFmTvtcl5FgD5shZaNegkdnmly1e+of2yYhZbTvyiMqR5PEfrchItPdH/8K2UI2XytcuNcCiVPk26RarMxZa6AFqYAJQLqUGf5CG4; 24:7RJlNAoDCcBFE7Nw7/GTuAkifFTayGU69EBD9bpuPHuzxbwMoRhqR73ZgjVvMcn23fWkH1OJ+BOH1bM0wiltqRZfYCBJgAOmTnL2PTchx54= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0740; 7:UQ1KgzYCn0UU82MnY6y+AcbfGpTjw02cXFJc8DoUPzd2OllLHo1p71CNmBngIBFHYMhDKiNd8fQQOt9xPksl8WUw7v7YpOavpXDnYdMjtGm5rxiNaC4YjsDz25fd40DU09WBYlmyGJHSGKd9mXhcTmL/B/wDRcN4EjOuu+of2PvAZnZ8cZ0S32p8cqjo9n7o1OmkiwZiqdfxB0q3qu1+5a3eI23EHSjVcsKAhR5UMp80rV0gKuqUToFUHJqcFrTE1PXbMs+arvx60c/IA3YlVcS3uXgojmsGCKmq08GDzu8KNWFG4qy4r2wvpM4r3LpB3hpnk/X5OA3DSjbLgMJzOHnBNA+HWOAwcis2Wy+1aAHn+G8ycQ6WXvLAKxl4dsia1FzoaAJIAjdg68YGny2BG6t/cKatDoL+efvwdM9J/LrMxjrzw5XWa1SYS8+oKuZPK/xx4DM6C4K/434id9XMmQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2017 13:20:22.0580 (UTC) 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: BN1PR0301MB0740 Subject: [dpdk-dev] [PATCHv4 21/33] net/dpaa2: attach the buffer pool to dpni 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: Tue, 17 Jan 2017 13:20:26 -0000 This patch configures a MC-DPNI based DPAA2 PMD network port with a DPBP based buffer pool. Signed-off-by: Hemant Agrawal --- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 10 ++++++ drivers/net/dpaa2/Makefile | 3 ++ drivers/net/dpaa2/base/dpaa2_hw_dpni.c | 57 ++++++++++++++++++++++++++++++ drivers/net/dpaa2/dpaa2_ethdev.c | 62 +++++++++++++++++++++++++++++++++ drivers/net/dpaa2/dpaa2_ethdev.h | 6 ++++ 5 files changed, 138 insertions(+) diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h index 660537d..b4f243b 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h @@ -50,6 +50,16 @@ #define DPAA2_MBUF_MAX_ACQ_REL 7 #define MAX_BPID 256 +#define DPAA2_MBUF_HW_ANNOTATION 64 +#define DPAA2_FD_PTA_SIZE 64 + +#if (DPAA2_MBUF_HW_ANNOTATION + DPAA2_FD_PTA_SIZE) > RTE_PKTMBUF_HEADROOM +#error "Annotation requirement is more than RTE_PKTMBUF_HEADROOM" +#endif + +/* we will re-use the HEADROOM for annotation in RX */ +#define DPAA2_HW_BUF_RESERVE 0 +#define DPAA2_PACKET_LAYOUT_ALIGN 64 /*changing from 256 */ struct dpaa2_dpio_dev { TAILQ_ENTRY(dpaa2_dpio_dev) next; diff --git a/drivers/net/dpaa2/Makefile b/drivers/net/dpaa2/Makefile index 657ee2a..ca51402 100644 --- a/drivers/net/dpaa2/Makefile +++ b/drivers/net/dpaa2/Makefile @@ -49,6 +49,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/mc CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/portal CFLAGS += -I$(RTE_SDK)/drivers/common/dpaa2/qbman/include +CFLAGS += -I$(RTE_SDK)/drivers/pool/dpaa2 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal # versioning export map @@ -62,7 +63,9 @@ SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_ethdev.c # library dependencies DEPDIRS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += lib/librte_eal lib/librte_ether +DEPDIRS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += lib/librte_mempool lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += lib/librte_pmd_dpaa2_qbman DEPDIRS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += lib/librte_pmd_fslmcbus +DEPDIRS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += lib/librte_pmd_dpaa2_pool include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c index c95c083..08f53b3 100644 --- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c @@ -46,6 +46,7 @@ #include #include +#include #include "../dpaa2_ethdev.h" @@ -285,3 +286,59 @@ int dpaa2_remove_flow_dist( } kg_cfg->num_extracts = i; } + +int +dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, + void *blist) +{ + /* Function to attach a DPNI with a buffer pool list. Buffer pool list + * handle is passed in blist. + */ + int32_t retcode; + struct fsl_mc_io *dpni = priv->hw; + struct dpni_pools_cfg bpool_cfg; + struct dpaa2_bp_list *bp_list = (struct dpaa2_bp_list *)blist; + struct dpni_buffer_layout layout; + int tot_size; + + /* ... rx buffer layout . + * Check alignment for buffer layouts first + */ + + /* ... rx buffer layout ... */ + tot_size = DPAA2_HW_BUF_RESERVE + RTE_PKTMBUF_HEADROOM; + tot_size = RTE_ALIGN_CEIL(tot_size, + DPAA2_PACKET_LAYOUT_ALIGN); + + memset(&layout, 0, sizeof(struct dpni_buffer_layout)); + layout.options = DPNI_BUF_LAYOUT_OPT_DATA_HEAD_ROOM; + + layout.data_head_room = + tot_size - DPAA2_FD_PTA_SIZE - DPAA2_MBUF_HW_ANNOTATION; + retcode = dpni_set_buffer_layout(dpni, CMD_PRI_LOW, priv->token, + DPNI_QUEUE_RX, &layout); + if (retcode) { + PMD_INIT_LOG(ERR, "Err(%d) in setting rx buffer layout\n", + retcode); + return retcode; + } + + /*Attach buffer pool to the network interface as described by the user*/ + bpool_cfg.num_dpbp = 1; + bpool_cfg.pools[0].dpbp_id = bp_list->buf_pool.dpbp_node->dpbp_id; + bpool_cfg.pools[0].backup_pool = 0; + bpool_cfg.pools[0].buffer_size = + RTE_ALIGN_CEIL(bp_list->buf_pool.size, + 256 /*DPAA2_PACKET_LAYOUT_ALIGN*/); + + retcode = dpni_set_pools(dpni, CMD_PRI_LOW, priv->token, &bpool_cfg); + if (retcode != 0) { + PMD_INIT_LOG(ERR, "Error in attaching the buffer pool list" + " bpid = %d Error code = %d\n", + bpool_cfg.pools[0].dpbp_id, retcode); + return retcode; + } + + priv->bp_list = bp_list; + return 0; +} diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 54f4498..6bd18bc 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -48,6 +48,7 @@ #include #include #include +#include #include "dpaa2_ethdev.h" @@ -64,6 +65,8 @@ dev_info->if_index = priv->hw_id; dev_info->max_mac_addrs = priv->max_mac_filters; + dev_info->max_rx_pktlen = DPAA2_MAX_RX_PKT_LEN; + dev_info->min_rx_bufsize = DPAA2_MIN_RX_BUF_SIZE; dev_info->max_rx_queues = (uint16_t)priv->nb_rx_queues; dev_info->max_tx_queues = (uint16_t)priv->nb_tx_queues; @@ -188,6 +191,7 @@ struct dpni_queue cfg; uint8_t options = 0; uint8_t flow_id; + uint32_t bpid; int ret; PMD_INIT_FUNC_TRACE(); @@ -195,6 +199,13 @@ PMD_INIT_LOG(DEBUG, "dev =%p, queue =%d, pool = %p, conf =%p", dev, rx_queue_id, mb_pool, rx_conf); + if (!priv->bp_list || priv->bp_list->mp != mb_pool) { + bpid = mempool_to_bpid(mb_pool); + ret = dpaa2_attach_bp_list(priv, + bpid_info[bpid].bp_list); + if (ret) + return ret; + } dpaa2_q = (struct dpaa2_queue *)priv->rx_vq[rx_queue_id]; dpaa2_q->mb_pool = mb_pool; /**< mbuf pool to populate RX ring. */ @@ -389,7 +400,9 @@ struct fsl_mc_io *dpni_dev; struct dpni_attr attr; struct dpaa2_dev_priv *priv = eth_dev->data->dev_private; + struct dpni_buffer_layout layout; int i, ret, hw_id; + int tot_size; PMD_INIT_FUNC_TRACE(); @@ -478,6 +491,55 @@ return -ret; } + /* ... rx buffer layout ... */ + tot_size = DPAA2_HW_BUF_RESERVE + RTE_PKTMBUF_HEADROOM; + tot_size = RTE_ALIGN_CEIL(tot_size, + DPAA2_PACKET_LAYOUT_ALIGN); + + memset(&layout, 0, sizeof(struct dpni_buffer_layout)); + layout.options = DPNI_BUF_LAYOUT_OPT_FRAME_STATUS | + DPNI_BUF_LAYOUT_OPT_PARSER_RESULT | + DPNI_BUF_LAYOUT_OPT_DATA_HEAD_ROOM | + DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE; + + layout.pass_frame_status = 1; + layout.data_head_room = tot_size + - DPAA2_FD_PTA_SIZE - DPAA2_MBUF_HW_ANNOTATION; + layout.private_data_size = DPAA2_FD_PTA_SIZE; + layout.pass_parser_result = 1; + PMD_INIT_LOG(DEBUG, "Tot_size = %d, head room = %d, private = %d", + tot_size, layout.data_head_room, layout.private_data_size); + ret = dpni_set_buffer_layout(dpni_dev, CMD_PRI_LOW, priv->token, + DPNI_QUEUE_RX, &layout); + if (ret) { + PMD_INIT_LOG(ERR, "Err(%d) in setting rx buffer layout", ret); + return -1; + } + + /* ... tx buffer layout ... */ + memset(&layout, 0, sizeof(struct dpni_buffer_layout)); + layout.options = DPNI_BUF_LAYOUT_OPT_FRAME_STATUS; + layout.pass_frame_status = 1; + ret = dpni_set_buffer_layout(dpni_dev, CMD_PRI_LOW, priv->token, + DPNI_QUEUE_TX, &layout); + if (ret) { + PMD_INIT_LOG(ERR, "Error (%d) in setting tx buffer" + " layout", ret); + return -1; + } + + /* ... tx-conf and error buffer layout ... */ + memset(&layout, 0, sizeof(struct dpni_buffer_layout)); + layout.options = DPNI_BUF_LAYOUT_OPT_FRAME_STATUS; + layout.pass_frame_status = 1; + ret = dpni_set_buffer_layout(dpni_dev, CMD_PRI_LOW, priv->token, + DPNI_QUEUE_TX_CONFIRM, &layout); + if (ret) { + PMD_INIT_LOG(ERR, "Error (%d) in setting tx-conf buffer" + " layout", ret); + return -1; + } + eth_dev->dev_ops = &dpaa2_ethdev_ops; eth_dev->data->drv_name = drivername; diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h index 2d13137..a56b525 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.h +++ b/drivers/net/dpaa2/dpaa2_ethdev.h @@ -37,6 +37,9 @@ #include #include +#define DPAA2_MIN_RX_BUF_SIZE 512 +#define DPAA2_MAX_RX_PKT_LEN 10240 /*WRIOP support*/ + #define MAX_TCS DPNI_MAX_TC #define MAX_RX_QUEUES 16 #define MAX_TX_QUEUES 16 @@ -57,6 +60,7 @@ struct dpaa2_dev_priv { void *rx_vq[MAX_RX_QUEUES]; void *tx_vq[MAX_TX_QUEUES]; + struct dpaa2_bp_list *bp_list; /**