From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0058.outbound.protection.outlook.com [104.47.41.58]) by dpdk.org (Postfix) with ESMTP id DA54AF961 for ; Fri, 3 Mar 2017 08:14:28 +0100 (CET) Received: from BN6PR03CA0013.namprd03.prod.outlook.com (10.168.230.151) by BN6PR03MB2947.namprd03.prod.outlook.com (10.175.126.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Fri, 3 Mar 2017 07:14:27 +0000 Received: from BY2FFO11FD017.protection.gbl (2a01:111:f400:7c0c::133) by BN6PR03CA0013.outlook.office365.com (2603:10b6:404:23::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12 via Frontend Transport; Fri, 3 Mar 2017 07:14:27 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; caviumnetworks.com; dkim=none (message not signed) header.d=none; caviumnetworks.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 BY2FFO11FD017.mail.protection.outlook.com (10.1.14.105) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.933.11 via Frontend Transport; Fri, 3 Mar 2017 07:14:27 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v237D50T005035; Fri, 3 Mar 2017 00:14:24 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Fri, 3 Mar 2017 18:16:43 +0530 Message-ID: <1488545223-25739-27-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1488545223-25739-1-git-send-email-hemant.agrawal@nxp.com> References: <1487205586-6785-1-git-send-email-hemant.agrawal@nxp.com> <1488545223-25739-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131329988672938722; (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)(39410400002)(39850400002)(39860400002)(39400400002)(39380400002)(39840400002)(39450400003)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(9170700003)(110136004)(2906002)(38730400002)(4326008)(53936002)(5003940100001)(50466002)(48376002)(106466001)(2351001)(105606002)(54906002)(6916009)(8656002)(2950100002)(6666003)(5660300001)(104016004)(77096006)(5890100001)(50226002)(626004)(189998001)(356003)(8676002)(305945005)(92566002)(81166006)(50986999)(8936002)(76176999)(47776003)(33646002)(85426001)(86362001)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2947; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; A:1; MX:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD017; 1:nVCSxPwsK8g2lnOS5IIkNHqbPrmF6R2IYCR+I8ktkif4mc3mzMx2/MuK3jiG27Sgi2rYQbpMIG6x4XTVjq6V8KbiCJTwfqIQFr3Ehu7mLWdKlbL5OeSDtHQ7zVFNwjwEykgQim07sCd+ogoWmdtt8K3H8DME8bnaWO/6fIHJrFjSv1q85yq6ca1SfBKq45epHLl0eioIiQzUMlxGMuhn4C4cheHA+Cm9gl8BrmznUrSTX1fLw+QLGH5KW5FJOF5Brv0mUDW7QhWgA5weVMYjb5GoPJEoJDGmFY6l/MfqN3umJOoJ5vRqfM2w2zHCKbnUnaK8oFe41y3DcxYqg+LnUdtHxZkTRS2FtMfGM5aZPOXCfazg/wyXyAboaEd/k9RqTyIsoyP6+5izrCzZvqwOpxrQAzQrAFcUxwe50oZF5l1OkYUL7/hEQg3xDdnbLxDIcJtcxLKPQwKpQpA9y75dKu45+ILrQ+zVJpDkYau+0IOShGhgKSgpixhF70DAYXWKF3BEY25xlDucW2ycFEVc4qCtKJ/n4IAcOxOApRE9O7v2ZqgNlieAmdXq5CUCy4Hwllg/osOR2J9Na/OUblyvAfIhzcGzAuTB4YK6Vn2j6yJpkIOJG7ciOqQ3pWqoCTeHaGL8oJzxsklPL6nTksTE8A== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 379ebc4b-4f89-40e8-8181-08d46204eda9 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BN6PR03MB2947; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2947; 3:DSJAFwn3iIsgFvwsvuX+gF+kYV4rUXlKSo8zTbY0x7t7OLXRd9GLeITPEn6V6p0ZEEUNQqKDemehLJuey/P5sKRERJfwNrZvVLzoWYl0tb/mSZjIIqyHiEeufdbVvqrjIvREv0ff2ATWFeOS94cUEdt2vLgGQMS+lcBdTAeN65zsJRb01CmMOMRF7sqWGxSYiycJlloZbTJP/eFk7XzsaIfMLZdjCKHFCG7rnXaaIvUU7niXNuJwt76XIcLZl0FWSLRBbTLuKF+6RFiWlRJWwavnMdNqdKaAU83xkZu1l1s1wP0p/Y2X38Uo63eUogk1cWZPQ+IqEVfJWIRRxmtbewGm8OfcczlmN58/fWaQUJvKbC2ATJsK+bwTNDdxgLny; 25:1VCKcuTa/sSGmLZlBsNQWVcLnpdox3ybV8cwoyIhoXb2i/M5amlf40UELGd1mDmAOVvuLk3Ba6p++qyzUCXXB0qDzyeJyYFYZnRsJOpjVgqWN1+W3NZauywmEZb2a4BqHeymHhOoH6NOWOEJJ/M5kk7nGOY1k1fx5txNoTOPOzgKBBkO1gFpWhdhiayJt076iqciF5Ddyej+ybFp8J49aGUd+01jBmn2rnshXyWnQKOxiP4lHmPn7GNEctstzIwqcnyxwDMvRZWNcclkLiNxqvQ37RCb9ZA+Gq85NM33mK9Q7VWmvSMvu04yC+dqZJtHpr20f8LZUUBlVjcwyiysx5sC1Gbo7LdodsgvGwVaq4WccCmTQ+77PHhc6/5Tri8gGSnZW1uFXBRZPp/FunUHnLzS1yFPoIzGVfDlCPER50wWw6XQYwsGBUxt/JsWf2LPl479Fjqgg5XdCcx1uaDMaA== X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2947; 31:UcAkR+YkJjaN8lIQgpm9Vk8hhphxaqBKEy9zyZh9qejv02oFoy3zz80wqKBWRKQPZf9iGMGGCmNR09GX5AxAQqWGlD1XUc+Gld+FX1lkODmfzkvkQdsIf7UCdMD6mGNzGQKrB9hM+WZ6bRvJBCb7KJiViOvud03XoTd/OslI2eTmsilOYq+sxrKfT/DgsaeuHn8TnGELmL8DcURvsmbhZd3fCfu9bWQNk9WjDRqG1lFjdAQvVy+2WJlvKIcRydVRTf9VNhNuJrP2nifpEZRe7A== 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)(8121501046)(5005006)(13017025)(13015025)(13024025)(13018025)(13023025)(10201501046)(3002001)(6055026)(6096035)(20161123561025)(20161123559025)(20161123556025)(20161123565025)(20161123563025); SRVR:BN6PR03MB2947; BCL:0; PCL:0; RULEID:(400006); SRVR:BN6PR03MB2947; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2947; 4:qFf6PcRqhxf1g448/dYcTy7UWSybIbT8ocyUlIODXgVnP7UoIEkIbldfCyy4IkJHyt4rwA3lSindGDTOtOYMhdGw0TuMCa1gKRT3LQUMbZQzJFtXtVG/IKLgHRo8/m380XEt6cxyHYPZIv8ViWdoozULccyqvQTb4viuHY8zhRgb5FyXtjbpf1uj4U4I/2Pgf4+Or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gjv4ermMQIhG1DBxN4fNDBrwKIjWC7zH?= =?us-ascii?Q?+/uxYow8IfITYZ7MRzyKtzP2eT0uyigl7MNxxLwZCkCBfe+90Y1v8Z02cTo+?= =?us-ascii?B?UT09?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2947; 6:8EFaT2NZsscQVaOrPQad8MvB6uWcFIBrbPc0F3ChLZWTEheUxGWyX2wLA1Er6NizQkqsYUUBI7IAcYcd2O9k2+MFBiVfAFnAqYAwTekECETnktusZk9UgsTn7eYk972aAlNgf9cU36gNCUgjsYg+NmowMoN6T/ZLacKJvsmXVxKeh5aMVh1DsdYnNXucWQ80HnbBr0XmC8vOJedFuqjENOPF75OI6ynvkJQo46f8yJTR57X2XyzX0XQ/4Nl7DTXqCM7CPsHFRTUniNURX2aNELVoQfcK5mY2mf0H1mVdfu+XKgYxGa6X6skuz+AOVERj32g9uq2hSIvfMEDiJ2QK7nes8reqTVyU2hSd8+cjLceC8ODtbPRSxTusi4mKThytcRe6CmNl9QFreo2hE3GwIIjKM6OKWAqWp+RXxtSTtvI=; 5:Q+HagOcU4CXVgREO86GuexKnjs2u3qDBA+i83HvFbfTUjiySmkvsQ8s19Us9YyQ5WxA10OOFupQMujzmq5L0vPyPOIt43ldenx/crlAdUGnYdrAsYVVtT7jErHfFPLMRPDZlr8vG4Po76hYGjn8MmcCkkvGgLZdf4WYUvHNmY023LCXLx+o9fWtiNsIYfiRF; 24:fVY9cD9FknDOnMw7mbyaIvvpt1h9JJ1BwGQv4rSZTlnP2ibBeeR+D3jMfKxWUNG+W9HPHL6hO4qhzYJrcTScxOisP6sc0QImm9g8/DyKxbY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2947; 7:hH5MYGpi3x+ftXpte/5Ce++2JmMZi1IzCVEtoxLh/LU0zKcPgWIH2Cva0qhT96Cwv7Pnbwm1BXotZml2dw570u7oL+lxma8KfapzxIXv0VuHjRlg/UqGdtUeHpA8bFsD7SA7rNdNnKxUWO7bCvnhCsoRDKNtLHE0OZXgVhWxq/N7LqNni8SZti4+8AP8ijzfyEGNmLwWVvvXbFOxi06F9D8KwkiqZd6+thp5WUxK1T2wcRoTzINT703FILFQzrR4ef1Yq3UzQHo+CLEYnFeqbniPOrsJYUVTUNYKRxADOhVb/x1bzYqt7EajxM+Wbd4AUfGhC7qKW+XPYI5WNusNBA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2017 07:14:27.0910 (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: BN6PR03MB2947 Subject: [dpdk-dev] [PATCHv8 26/46] 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: Fri, 03 Mar 2017 07:14:29 -0000 This patch configures a MC-DPNI based DPAA2 PMD network port with a DPBP based buffer pool. Signed-off-by: Hemant Agrawal --- drivers/net/dpaa2/Makefile | 4 +++ drivers/net/dpaa2/base/dpaa2_hw_dpni.c | 57 +++++++++++++++++++++++++++++++ drivers/net/dpaa2/dpaa2_ethdev.c | 62 ++++++++++++++++++++++++++++++++++ drivers/net/dpaa2/dpaa2_ethdev.h | 6 ++++ 4 files changed, 129 insertions(+) diff --git a/drivers/net/dpaa2/Makefile b/drivers/net/dpaa2/Makefile index b5f3ebb..086c76e 100644 --- a/drivers/net/dpaa2/Makefile +++ b/drivers/net/dpaa2/Makefile @@ -51,6 +51,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/qbman/include CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/mc CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/portal +CFLAGS += -I$(RTE_SDK)/drivers/pool/dpaa2 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal # versioning export map @@ -65,8 +66,11 @@ SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpni.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) += drivers/bus/fslmc +DEPDIRS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += drivers/pool/dpaa2 LDLIBS += -lrte_bus_fslmc +LDLIBS += -lrte_pool_dpaa2 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 ab9dfe6..906a4d9 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" @@ -63,6 +64,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; @@ -187,6 +190,7 @@ struct dpni_queue cfg; uint8_t options = 0; uint8_t flow_id; + uint32_t bpid; int ret; PMD_INIT_FUNC_TRACE(); @@ -194,6 +198,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, + rte_dpaa2_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. */ @@ -388,7 +399,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(); @@ -475,6 +488,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 = rte_dpaa2_pmd.driver.name; 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; /**