From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0070.outbound.protection.outlook.com [104.47.32.70]) by dpdk.org (Postfix) with ESMTP id 35310FAB6 for ; Mon, 19 Dec 2016 16:21:50 +0100 (CET) Received: from BN3PR0301CA0044.namprd03.prod.outlook.com (10.160.152.140) by BN6PR03MB2467.namprd03.prod.outlook.com (10.168.223.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.789.14; Mon, 19 Dec 2016 15:21:48 +0000 Received: from BL2FFO11FD056.protection.gbl (2a01:111:f400:7c09::194) by BN3PR0301CA0044.outlook.office365.com (2a01:111:e400:401e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.789.14 via Frontend Transport; Mon, 19 Dec 2016 15:21:48 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) 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.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BL2FFO11FD056.mail.protection.outlook.com (10.173.161.184) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.789.10 via Frontend Transport; Mon, 19 Dec 2016 15:21:48 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id uBJFKMhl029110; Mon, 19 Dec 2016 08:21:44 -0700 From: Hemant Agrawal To: CC: , , , , , , Hemant Agrawal Date: Tue, 20 Dec 2016 02:24:01 +0530 Message-ID: <1482180853-18823-23-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1482180853-18823-1-git-send-email-hemant.agrawal@nxp.com> References: <1480875447-23680-1-git-send-email-hemant.agrawal@nxp.com> <1482180853-18823-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131266345084821792; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(979002)(6009001)(336005)(7916002)(39450400003)(39840400002)(39850400002)(39380400002)(39400400002)(39410400002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(305945005)(50226002)(77096006)(8676002)(36756003)(5890100001)(626004)(189998001)(85426001)(38730400001)(5003940100001)(76176999)(104016004)(92566002)(8936002)(50986999)(81166006)(81156014)(8666005)(86362001)(356003)(106466001)(33646002)(97736004)(68736007)(2351001)(2906002)(48376002)(69596002)(50466002)(6666003)(105606002)(2950100002)(6916009)(110136003)(47776003)(4326007)(5660300001)(7059030)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2467; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD056; 1:bhtYUYs/wPp080/4lT2Z2mjB/sXyvUBO27NM70iQ4BEctmYhuHK+uufSWfosMFNnkidKBFL6oOenmFvOO3dg6OUel3Q+Knk0Xj9CJjOGq+E0G6YKg61WpGUIHOs5cfdXAaBgM5yJK670wYJilIjArg12Vpwsc1tM86dCxkpKg/swte6kwr2RQYld8PAzxcOLf/g6pMYKXUHybUlWpnrqEcgb8ymyI6DQRdszUeXM3p9xNcmZEciKxODo+Zl9G9kDa5bwbUWlO1SuzziNIfpQuctjlzdDhOeR2XywtLUwPeymaq2DKQmuIkIhmqAaFAyuTQA2HtCHRwWgV24AxVuDa1gFED5YutcCs7bewKbHewqCGRNo/rgU649SRtr9FaJymG5vO3p4OeitPpkZFNCuf1vCHQawiwSKviq2kYlD0i6WzAxdD6fgRtKYLnI8Y4kWain63f30nngvlw7TSbv5JVDcKcN6u37O5x3C9SE2Ukq56E/KHGTs/b8KZpLuegL2ExkMuDrp+x0W2Yg4jQNSZHWfE4NsMLov3w71cX6m7kT6zi1m88M1f7uat4U/67fBDTrLUPztYMfs16BZyOF+LBzRY+AfsSYcc2QUAZMuGjaoWPSeFeUqVmx9QaeKPr/9e2FbApl3Am2m7SdW7KiM1wqpu/oW303aCbfinYkZMXaKPSqHQiFE29L3omtmhnZBTERbsA9RYCQfmPH1R0NAHMywE1z6VkCoV/WAWTXPtK+Mfzyp18n18ldBlZyoV8yUETZMZ8IFhJgCuyHfOJnZAQ== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 74e3cdbd-aef5-4d4e-3fe1-08d42822c033 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BN6PR03MB2467; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2467; 3:EAbkvcrXFksS0Wl7re8HNWG2jj0kjwZ9uI6y5I/BqyOzEI/F0EQTbcX/KSBBBY+NGRIcNdG1A1T3iuZS4dRb9lIuhaOOLY2R3H372iF8o1kJjNPJ0oTFDsNGv0z0y2BOyc2vtcDPgy+Z5t5Hl6kZT5Rv08gJ/72ixMcu0SMpy5dY5iaQME6KaoRdBkSncL//KfihMoJK0NHbZ3JsAZPzj+7kjFlvmwSGuiM/rjsKCVqvQeetZ8fEMWWL4m5gMlJc23hUpNikZXa681vVXVATh2IxAF5xysn5pEfPIB4meXv+u3qVRBB8K99zLyvzQ5CsF3aLKGZ2h9RrwwKGQ0lEG35+M+kTmfEO+KvImASxBDf5TtIuNFitZSlSVhMNjhKw; 25:9a6lTYEYmCijui756JRRF2wNd7ay2YNHuqMuTKYmTMIzrz5MUAVVWrmfue4zM6AMK07KG+V13hNniAy1S6FRVR8aayxo3N0eSvhkTNFtwM3ylLe2SO6Fmc32N/oeAYzVhw2/AG63xnZuzFZsCYiEeTHsCoZJT+TdALrRo3tmyxB5nOdoT0N5NZQ++7lRAwrjMoTaHcOBmsFM3kuiC2kEo/fq/c509vosiuBrj8j1F3xH3OVsoYC68WsmpLNRwx2VYfknJWTmtWtTjv3gR4QAAPm6iZstblIctYEr6pfFruo3+d5iwfYdCnwOrw4C3WKJ5rcTIVgvqiAzkDK1fPVzmAIgbeT99W6g2Aa/NvQhUs8sNg2Ii7OmsOYZUHy0C5YxdfRs0y9Rk1Dt3KUEZo/QSv7m6jFiSWuQXsFXhZBPkSAZ2N7puhK80vUBrxlAoNx+1JRW7UOK0BiQYwhDYxFZKQ== X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2467; 31:CsPTKMLOprpNOs2DO/IJO/FRE65HXbpCRa911bdv/ls4AXYOCNFN/tn/q3HHtRy4DtuOZhZOd1z6cF0tft3PIhuL03S8l8a+ciEvleytsNeaOxquniOVbfPvqdsipnO6Dv7gSXhfW5rmNZ1FCYoU5V7SCPivXDc3guSg1MTp1WdvVf+4zLg2xJ6tpXBC1iJwSNCihNdM5gP0U0BKaasZW8lyJC+k/lJ83K6h4WFyXbIsrlLGuw3uRMk8y+GZrMd0PupmF0iwf/v9eDtdNnS88Q== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(8121501046)(5005006)(13015025)(13023025)(13024025)(13017025)(13018025)(10201501046)(3002001)(6055026)(6096035)(20161123559025)(20161123565025)(20161123563025)(20161123556025)(20161123561025); SRVR:BN6PR03MB2467; BCL:0; PCL:0; RULEID:(400006); SRVR:BN6PR03MB2467; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2467; 4:6LAAiTXWGZuHUDeFXlhUDUO2GRUUhsb/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AkpervpFkD+hyzt0y77; 24:lNOhn+RLgadQkIGD/E+NzqLeEtoOEfX1dr3uRT09TKNstfAhm1dKVy1cQAqJa295SenO09d5EEfrd7UFFxVBBUeT+OLxEP400ZX+HZDNH+M= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2467; 7:7EJ42IyV8YnVJtjYEf/1TQABNqdpodvxvPTn6u3iB3mqavxR8PuLbvGYNkd0kN5ENTh3Qp2FEo2ON7gBq39/KhhFbnNnoUnhEoUqh4YO9k6mf7fRnR/L69woE0CosUS+ZSNDwajhzswaHZDQS3f2PAAgX5rUq07vsNHEWg1BrOySeA0JcLnzW7ariltekQy+aLuzBfSwLqyZl+QK6zLr7EuJhACgjTRtTe1vQJppQHWYoim/lHHjpUoDQQ8Pcj7Wa+aB5JF0/sHCP1bt53Aya/0wemweKzFc5rRZftPXfKch3/vMfjvn5SJvdQwalBsNpwAU6arj2XCH1WuVa8mVFqjGisO00HgsoRyQ/Z7uFYye0/CLYwFQHplLyxXdCpIPtHyrgfT8TOa616oH1RSrffSV8Z+Q9c5l5jHaaVT4ExTX4rSgRDUzlyKsqpNjPeGfKhBWoJEEL3OTcC8++hKqqg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2016 15:21:48.2482 (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.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR03MB2467 Subject: [dpdk-dev] [PATCHv2 22/34] 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: Mon, 19 Dec 2016 15:21:51 -0000 This patch configures a MC-DPNI based DPAA2 PMD network port with a DPBP based buffer pool. Signed-off-by: Hemant Agrawal --- drivers/common/dpaa2/dpio/dpaa2_hw_pvt.h | 10 ++++++ drivers/net/dpaa2/Makefile | 2 ++ 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, 137 insertions(+) diff --git a/drivers/common/dpaa2/dpio/dpaa2_hw_pvt.h b/drivers/common/dpaa2/dpio/dpaa2_hw_pvt.h index 08be96c..2c1ab7f 100644 --- a/drivers/common/dpaa2/dpio/dpaa2_hw_pvt.h +++ b/drivers/common/dpaa2/dpio/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 c331270..0e8095a 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/common/dpaa2/qbman/include CFLAGS += -I$(RTE_SDK)/drivers/common/dpaa2/dpio +CFLAGS += -I$(RTE_SDK)/drivers/pool/dpaa2 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal # versioning export map @@ -62,5 +63,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_ethdev.c # library dependencies DEPDIRS-y += lib/librte_eal +DEPDIRS-y += lib/librte_mempool 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 ccd2c2a..ae04cc3 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; /**