From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0062.outbound.protection.outlook.com [104.47.42.62]) by dpdk.org (Postfix) with ESMTP id BB778D1A2 for ; Tue, 11 Apr 2017 15:50:20 +0200 (CEST) Received: from BN6PR03CA0090.namprd03.prod.outlook.com (10.164.122.156) by BN1PR03MB251.namprd03.prod.outlook.com (10.255.200.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1019.17; Tue, 11 Apr 2017 13:50:19 +0000 Received: from BL2FFO11FD051.protection.gbl (2a01:111:f400:7c09::185) by BN6PR03CA0090.outlook.office365.com (2603:10b6:405:6f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.10 via Frontend Transport; Tue, 11 Apr 2017 13:50:18 +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 BL2FFO11FD051.mail.protection.outlook.com (10.173.161.213) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1019.14 via Frontend Transport; Tue, 11 Apr 2017 13:50:18 +0000 Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v3BDnjFw000706; Tue, 11 Apr 2017 06:50:15 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Tue, 11 Apr 2017 19:19:25 +0530 Message-ID: <1491918578-4902-10-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1491918578-4902-1-git-send-email-hemant.agrawal@nxp.com> References: <1491725483-6619-1-git-send-email-hemant.agrawal@nxp.com> <1491918578-4902-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131363922189036605; (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)(336005)(39850400002)(39860400002)(39410400002)(39380400002)(39400400002)(39450400003)(39840400002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(9170700003)(53936002)(2950100002)(305945005)(50466002)(76176999)(5890100001)(6666003)(38730400002)(8936002)(8676002)(8656002)(81166006)(6916009)(5660300001)(575784001)(33646002)(104016004)(50986999)(50226002)(48376002)(86362001)(356003)(105606002)(4326008)(54906002)(110136004)(97736004)(85426001)(77096006)(106466001)(2351001)(36756003)(2906002)(5003940100001)(189998001)(47776003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR03MB251; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD051; 1:/BJmDuv0VFmb4MeKbER6FtBqgy+j/VkRVRnzJablP50S41tJBsSykxq/TaLfFwAtvY3pbMQEyT+eLOia8kseeXFRnz8DsgmozhZ9tI6o+Kh6mHPNBrYN+DlFpjOvFXd8wC4tzPrD1YZer6Ikz8AQ4U/A0YEpB3PRu2gPbL/jT/eRv/BcM0orrC2jhlhx+PAioheYhgLMKS5orX3/NkVu9Qbr6GPJE5OLEOIf/Gn0wDK+AHJwS0rhnYdeTsdR5/Vj4IZLDSvh1mY7VZjmLAV/eEZ09Pn30nSnDc7cbjPawzX5eUfNWN3GyAVfH9adc5mSSTss0rh48tK1QLSkih7Ob0k4FBFA4ov3pfLZVWDw3stl823FiN5GmNqvy57hEMdTRGg9XVDv2XWXSr8BGb4m6YblEJDc/RzOxces2nj6WLCOa+cVG1sGy7ZD/si87xO2EpmclWOC+omu32l/x5JP41hdzuBY+5B8ZmKv8svgMWmPAjoZekR6u4bQJ+J4zDS6zMsh4QT7N405N10VkxxvR2062JD2yLVkOSYjD1FUSsa0yQeQN8+a6shQLJ7b3Qwf4+tcN2tbhCvHg+W5JIFa+x6bfdm037kg5fpTmzIwpICFGVmtSsZZV6gxgbDrymCHd1wAUxTU/vM/atVyWYIuY74CZ4RdK2y8EEzrCD5b5lU= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 9fcc6edc-7daf-44e8-2c3d-08d480e1b0d8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030255120)(201703131430075)(201703131517081); SRVR:BN1PR03MB251; X-Microsoft-Exchange-Diagnostics: 1; BN1PR03MB251; 3:nSx8oDlufmUJwRrLI0Yjk4XJ39ZOHbps2Z6ApsdHO+3FEt8WqcS+bDlxqS3WUAAfiVMKBJBMloW6joay+xgDzcc3aBmB/hZbNdriYrm24wXqM0gAupsrJeFygH//YBKZgIrtkZolpP0UqH0kMoWr+6vex3zOcqU0xCKKJGsEuMKlFZan6HkrK+X6jrE2qz1N2J0xOTFCXmGNmNE6I/9KTXHk6YGXnoW9cchMQBWztwU0KNBFnZr27swRwL1/mnUlWqfA7gynk3OnIvWOMgvIyoLjRfgUgBq4AsXDkkMY1ulZkqaM33uO1HoJdoPpaHhCqI18rjvncnaMe9Kq3buttvkQjDB520ORUKHpHfScf+kGSIRjuH3vAuMcR/J0zy3fpXnJ9cg+L/czuMfLiMrzgacRBA6TAlK+Xvk06WC3MbdMImWhOk8nu6BOCmFkQ+9nOZ7DWtSSBddN96mKICy8/g==; 25:4C/unumrJ33b2eAu1/4yc6DNiZOF/POqHtFY7zZRAGwaxmG+f9T78LDERL1Z/Rw1AodNpruDZT8lipsDzCDZ5qP1ej6F9vOIWKR+TduygpnoW/p8r9R2eMRxaeU5ZyTloaZSfrObXdzljSsKgwooRF5mkdyWGmHQXku4Q5v0HnOAW8y30cLCQysQs5t+m8ZXnR0PhYrlQtmtKz04gDD2qrgd7ue9FXJ86tZdqV6iKdFITdpXmFYfY7Zoy1OT/n/3Rag/0lBAnf/gpF4zw4cUyMINUInMwcNassfnxb61Ts8nY9qysoigZFZ9ppXSNVSSsxn5XQS5SJVJHSldKq0mRhMyx4r3S1MIUuKwIdfpI0be0u4ETEj2NcfJAUpOdjeAU+9rcPgbmjBk0vjw8evA6LzBNhYSKScWDgrWHWKPAPN81CsH5Z7tu6f6pW3yfrXDpe8atEJRLUGTjm8WiIQNow== X-Microsoft-Exchange-Diagnostics: 1; BN1PR03MB251; 31:msWa9fxtj/GmdHIU3LWx6JbNpx1RQyOoZe+9PHYBp1TuvjY/1juMx0o2nDJXiKQfMSYR3Is+/EqqDBWa+atuXo2HaqP0MveFFTiSY9MAa4xbj5nxnbaELnAm7/SGNNWnFwuY0+PCiaQF9VCCxrZtLrrpg0V4wkkFmebnZHeNS3ac7fDU8YEF5fJmbe4Nc3za/bGD/wEETrvE0Eot3lUeGMOlJS1h7Odjtf7lIcekDo2U4f6sle3j9cYBnSFH6uvn4bNt9FYMyWHqoAfjmpGX+7720M/54SoAQyhzq6ItZT4= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(601004)(2401047)(13015025)(8121501046)(5005006)(13017025)(13018025)(13024025)(13023025)(3002001)(93006095)(93001095)(10201501046)(6055026)(6096035)(20161123561025)(20161123565025)(201703131430075)(201703131448075)(201703131433075)(201703161259075)(20161123563025)(20161123556025); SRVR:BN1PR03MB251; BCL:0; PCL:0; RULEID:(400006); SRVR:BN1PR03MB251; X-Microsoft-Exchange-Diagnostics: 1; BN1PR03MB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lvhUtf3STfBsCjm+BWCT98hg2l4ZnOyVApfKDNDIgHCKurd5X6HpLpC6qhxcXvn2ELMj1JIajGfxgEFFxFFfZBu9EmXoC4YGKlSfXnR7Mb0JIB0n7Qy; 24:2U8agWhi7Pz6ylc9nWznD5+vrbvMgji1H3LHomRb0iBaUcuVZjb6t23dhW9v/T6cU6OfoGCy8e4ySeKMnHwdGO6iXd9odBE8rRu79E4tM4k= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN1PR03MB251; 7:bl5DfcFa6jlw+EOqq64haQi9d8NYhCTrGQSv3x7Mrp7t3Y2Pfn8PIHbFnT5Ttkp9zQhHUjomjDz3283PLaxgTZh2ltU6+5YR1600m8xduJx9CHuNrkFZkLNtSDf3gkajcFrkYMJ2P7X/a+P9HuFRLcILOd+Sbftl1o+zXhhioGW2EZ6NcSc/CwXHdIl/gPx6xh+EYC+5Kh5ALB8p2ocof/epgNjcNTRS6TXvM4KamTHSWA4UJSRZZXT5lNcsFP3wOWYnivRIGL8rh7JZUC/YkA5spJqthTQwSeYuUF8TmVzGLn8odWt/OeWSEP8SUufdG268ANe8yKWBn+CZ0Ip/JQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2017 13:50:18.7320 (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: BN1PR03MB251 Subject: [dpdk-dev] [PATCH v12 09/22] 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, 11 Apr 2017 13:50:22 -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 | 2 ++ 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, 127 insertions(+) diff --git a/drivers/net/dpaa2/Makefile b/drivers/net/dpaa2/Makefile index 7f88e9b..1f66c0b 100644 --- a/drivers/net/dpaa2/Makefile +++ b/drivers/net/dpaa2/Makefile @@ -50,6 +50,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/mempool/dpaa2 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal # versioning export map @@ -63,5 +64,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_ethdev.c SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpni.c LDLIBS += -lrte_bus_fslmc +LDLIBS += -lrte_mempool_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 21848ef..c816076 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; /**