From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0080.outbound.protection.outlook.com [104.47.38.80]) by dpdk.org (Postfix) with ESMTP id 5F2174CA5 for ; Mon, 26 Feb 2018 06:16:55 +0100 (CET) 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=yDA1HKkHRNTq3elxY3O0S2Qk1eIbXoIvC0e4lDfW30Y=; b=nRjRu0ugFwvh/UaViEYpGSPzjEcZnTd3s3dlzbJyvY7u+3izmxPbKpCJ3v2krALzJA4uV6JLmd5I54E5m5u7Nq4EUvNzfRaqK6DAJY5vJDIV3HymJvZM4pYrrFOQlzdwmmWhGROhhh2lnKBgpgbZtV7YEihPAQQYKgpYk7aqebg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Rasesh.Mody@cavium.com; Received: from cavium.com (198.186.0.2) by CY4PR0701MB3666.namprd07.prod.outlook.com (2603:10b6:910:93::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.527.15; Mon, 26 Feb 2018 05:16:53 +0000 From: Rasesh Mody To: stable@dpdk.org Cc: Rasesh Mody , Harish Patil Date: Sun, 25 Feb 2018 21:16:12 -0800 Message-Id: <1519622173-14087-1-git-send-email-rasesh.mody@cavium.com> X-Mailer: git-send-email 1.7.10.3 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [198.186.0.2] X-ClientProxiedBy: CY4PR15CA0024.namprd15.prod.outlook.com (2603:10b6:910:14::34) To CY4PR0701MB3666.namprd07.prod.outlook.com (2603:10b6:910:93::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 11ed2bff-5b84-4cfe-9ed2-08d57cd82657 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:CY4PR0701MB3666; X-Microsoft-Exchange-Diagnostics: 1; CY4PR0701MB3666; 3:Xk0/mWIO50qsFhzT99fcvdxSJ+y5B31an/aggOqObL/GdbGxLVvaaLPUMe5rQm2ZCegxcoEnfZ9uUCBIsVA+hl4c7kpvOck/5TcDMz6Afl5tafbYZXe4FWy1NvPDaxmdiJFUJYQWq0wxktIujExv1y/a/c/SblVKstYot1swXwQyZWPlXyxOgd/I9uQWx1ZkwdGS3vMZvr1j3q0tz7DyDqRO3+kZ7NUERdOkaSBOdFbWpjtjKeWv99VXbwA03R0m; 25:47RvJS0STMqpZ1slE1/SXFaHwKOEeIhjQTZ7Ohv8mxdeyhHkdYlzCkQwVQ70OJpsziSziRXkPjmMgmIvLD295NG6UtTSFNup1JnYS1h87YabFexv3GQEHjbZKPyOM2wYqBrwlNGQLfzbH3aOJ0j78CllUHP3X+TmaJOBv901ihVR2zmUpq1/G2vFDzy0UMC+8ezMTTVMWVvjBZRVsOQWygFvKvDl7VupRxleRRoChGZl86t648RZWhkKiThftKbIPaHaoTl0019C/L0IKQRPJJnyWhxs5VjhdA7DXpfNYw9y1ATct68+7fqRVuly4D5AFdqaU2W2hmPTyZW+tLqmuQ==; 31:2wbCe31/vNFNPG7FucAPhgkRxfbF47pIMGnEHeiatmQN32erxsiby8TRFe5qg8w80j+Q7UmUADMK/ente+j82fQfaaQzRgw47S8LkB/MXphkRfZIQBv/b7j/NDnrxyt+E627M1S5+HSdV3H0jgBx39+iVTA0KE3yCxOxRf8HsK24FbOelGF/dSVTUdRdroguzuXbYnUfg6Qbm0Zb/A5dRZiOvehfHj28wq/BXOYFMr4= X-MS-TrafficTypeDiagnostic: CY4PR0701MB3666: X-Microsoft-Exchange-Diagnostics: 1; CY4PR0701MB3666; 20:g+lptUHt1/P/7FfCuoSvFTbvp0m/7ZFPdbA2tAJctRPRMNYFVGMN2nMP7miwpterRv7FVoXFTTCximdronY2mpihmFZnb8yV3riIrRmeXAkyiGKcTDBXCT4+1unfCK+yPimLS5HKzmRPnsoskJqd7M3EWbAVsz2MxeZ8zLyOpN+em+6PtnmFJZrcGTaSkxwu+q5P+uIYKPqMvP+R1qEsERtTGRkX230yj3O9MiMcX4xwP+Duuh/zcDlkTzncMmBYQjirogOf7um3ykH0Ym3cvmCTy2SWENZ11n7yViDZSCG246AwiM9vu3MKZgRQ3R3Sz4kLXgU2bLOHjBxlwlu3xm//JPNV3rHNpEG2bApRdDWOaXbNyDocqZIyQ+D/fJ53xzBgSisgnBCA7/5oFxTfTpkYWfRwTTGaUTvJugmptmv3Z/WP8BJhsUyU06IG78XakwnWRU/jkRVqbQT9Mj7AosWOJgnVKmMqqJcpapg9epjJoumGmVo0KVdo2CBzjJQb; 4:EYqVMSubggpat6t1AUjIeG5MA9PV3ISbub5uEgvZlRYEfWJosmkF+fB/MPJBQrmgGlWJ+jtpKYLgwBkdOkL0sNB3JdPJmQg1wqJvqOqwXl8k/r+KZ5POaH0hHMjQiIN4Ctb9TY4+iIRMCQaYhGIOpNgRtFbkofeSZyrn8BABCYyRgevK/6SgY4wHiNO+mT+bPlHdQ+FGz7pBguxlWI6v+k4wqfW1WGuUPiu4Cm/LV1gH5bBAwEHHq2oFdxvcrypgHHaBWZwHIN2C5v/J21jiGJVk4GUzU/XzKh/ueiPp434ljlzVkbw0hrzBui+rpD2E X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040501)(2401047)(8121501046)(5005006)(3002001)(3231220)(944501161)(52105095)(10201501046)(93006095)(93001095)(6041288)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(6072148)(201708071742011); SRVR:CY4PR0701MB3666; BCL:0; PCL:0; RULEID:; SRVR:CY4PR0701MB3666; X-Forefront-PRVS: 05954A7C45 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39850400004)(346002)(366004)(396003)(376002)(39380400002)(189003)(199004)(316002)(36756003)(86362001)(16586007)(575784001)(6666003)(6916009)(2906002)(72206003)(4720700003)(478600001)(97736004)(7736002)(6116002)(3846002)(386003)(59450400001)(26005)(16526019)(186003)(305945005)(5660300001)(81156014)(81166006)(25786009)(50226002)(8936002)(4326008)(8676002)(21086003)(55016002)(68736007)(107886003)(53936002)(105586002)(2351001)(106356001)(2361001)(69596002)(51416003)(47776003)(66066001)(7696005)(52116002)(50466002)(48376002)(54906003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR0701MB3666; H:cavium.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; CY4PR0701MB3666; 23:StsQI/IMJEC0P9i+PqQPkWWxVhbPvg7UaouV32x?= =?us-ascii?Q?x5ghmaCcZHNZAI8er/Xi5LduUu4eOwnqNyt1HYCZ+ss2173T43SSIKutNpiu?= =?us-ascii?Q?dHlQfxln5wMFM6xp3SWFPc5MbevX+Gnxts7k49JbyQGCEqDHzFtA9G5IazT6?= =?us-ascii?Q?a7PavYPd4+GhojnPJw0/Ke4PkzUiQOiPOAmnXgLNQzcGIWzsaTNb/NVdmXVb?= =?us-ascii?Q?xelUZn5wpkbAagPOQArHVQ5NWuXHfuM3F8K4KHTM7Gk3D+T2o2Hrn0beOMVg?= =?us-ascii?Q?JBGcqXdDffHkPgn+K2vkIG80U+uPrG3kwAx5LKu0De03V0oLHnSwY3bE9seP?= =?us-ascii?Q?hM2bjxAAi/KFJldY1Pkm9ypQuLdfhzGmhlaIunxn9ts3p7PKL5I52KR79TJ8?= =?us-ascii?Q?DHhH1uVZK+f+MSh2Fe74SxRtFQBaza1AId5nG0mMHNzKRJB7qNASlCXVZTck?= =?us-ascii?Q?EDUdRa23dMivYkbA6o0h2LYaFzI6guTRLA9k+OBmb8rlnct7kNcMCwfUAKr+?= =?us-ascii?Q?kg4oRnMWEEH2Wg36pvQv9Ed8nywt0U26JlYp9VfFdTewtpvJOor3Cvjg4dOv?= =?us-ascii?Q?meTNEaNPCYEDrnZIiu3sz4tU5M8p5ozAk1tcum/c9lX7FzHv65HaOTN2gI+z?= =?us-ascii?Q?RY9LrFoBcGwOgEQTDXfxDJcgab/G/QZ4jOP7fadhQPA6OoE5U0EfpzkvEres?= =?us-ascii?Q?fcDGq9oF58/QExtrnj/uLUjaYGVH2clIWWaCw4BJmejhS6t6cZvd7lhLPol/?= =?us-ascii?Q?N82kYewrSjfMlf5dXQFi9f4kG8OzJblIWyX3adl2jeBzSSwosq4Ya9ZDzPyx?= =?us-ascii?Q?ZUbiaF6+v/UzlnLwdXLyknNiWJNzuxnkCUy8vqe8F7nfoNR8FcZhwkKN1wl7?= =?us-ascii?Q?dD7V12OM15Gc/onligwCZgpdB1z0zWE0hcSytDbnnTX84loMVJ6nIQTLsDjQ?= =?us-ascii?Q?WXpGl7Ti2XvAznrjZZpWv7zqax/0IuR+30qfwPojxqHLJwvEMwRx4xtS8M0u?= =?us-ascii?Q?vL9akBxKUSBr3/lcx6EjPmccF3RCnAlWT+v3W6vGx00VZvcvtNUyKKL/asEc?= =?us-ascii?Q?SPRROEDu4P+x5NhGqCze/BV9SZK6LFhDlomLzDG7GuLyhngOsXWtBdURamsV?= =?us-ascii?Q?bNoTVhJ8marXBK/F6V97Krri3mH5QkOUwCk0XP6lYfobsj5+WiisvvnjW8LR?= =?us-ascii?Q?5UAk8zy25MUhZh3VauPdCGoaze/Vl6IBSjlCgAJPUIUr5vKKdyHDrTFqd4F1?= =?us-ascii?Q?KGgRhWTIcpTe3BiUemNCdKbGTaYqT/EfKQ8X/Ua9M?= X-Microsoft-Exchange-Diagnostics: 1; CY4PR0701MB3666; 6:JOtip7VPCaf699fKn90g310vgRqu1ZgB6tznlpQ3qxDZBZjFXRJAQKNB15qENJ9UwaE7gX+6yitikornR8lck+V9c+J8hVyGB/wj7r/KoA4nXAUqTquaCcQ5CLhhoRlZ3eINAbX8ylnz6mKUy/GeVbHMIemPmXKAvzX89oIBzEGyBGa51rwQz7YDDOEpeD3Mfsm68135D7ydNlMC+QeSVEsr2gmxdoOI6ODEQ45Pw02EvMlQ5eHBEOwZFUWqkjk/4L3ZI9KwA6q4ovJhNizTbH6hH2qMpWhgBTLxRv6Vs1p614+mZrcFaFN3W4ox6t6TtdQ2EThOHJOOMDfJdhbmAS4TfNYqv+Tae0WcV+HLS7c=; 5:Eijl2fdbG3drVDpFiqmok9iAHHEFFyNGRahE8x1tM4TE/rNYNx3HvPCj3uqtWLG6/JEfPQjXuW1xHX1ImSflw2lcrAM4kKqIcG3aOJdSX/VtzWy8fOI1r7prHD1+Uy6Lc3YSXHcQOTBzZMrk6/gS7GNn8bJ0PTQ+e50LPCK9b8E=; 24:G2mUVvcip4ga72vSTEKhMzWmh8BlJQ7FMbUuC/Mnz+UGLTabuyyVK5lDdMEz69xSnUnMnFMWWW1REMCGfwSOYQerEJ7d7Fvl2Ctn15CJclQ=; 7:7VZ39pOtc3S8BZb67jeb65ODE5/sE8tzZSTYE8svSRAnUjmcpXwv7sjYetrlz5YxT6JP9vha91LcOPwrBUnnFo1CSBIqh1qHTHStgGGcZV063EFh3JqR0P52yBNlaRRn8aVMt5UOR5aflKMXcsM4un6Zn7exsQI/+b2hMCAYlff+no2dq+xYD++xWpZWUty3m2cvzWIlxVRb0Y1d5Ywn7OtM9JG4CgtDCs4i7IjTWrduB7Kj+GNKOebiT7FD5wzi SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2018 05:16:53.8818 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 11ed2bff-5b84-4cfe-9ed2-08d57cd82657 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR0701MB3666 Subject: [dpdk-stable] [PATCH 1/2] net/qede: fix MTU set and max Rx pkt len usage X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Feb 2018 05:16:55 -0000 [ backported from upstream commit 9e334305178fd3715c17088632544bf58e5836a9 ] [ backported from upstream commit 1ef4c3a5c1f76b810620b76d82a31ce33a83d3fe ] [ backported from upstream commit f6033f2497e7d01d8c6f0d691e2f86937597aa35 ] This patch fixes issues related to MTU set and max_rx_pkt_len usage. - Adjust MTU during device configuration when jumbo is enabled - In qede_set_mtu(): Return not supported for VF as currently we do not support it. Add check for RXQ allocation before calculating RX buffer size if not allocated defer RX buffer size calculation till RXQ setup. Add check for before performing device start/stop. - Use max_rx_pkt_len appropriately - Change QEDE_ETH_OVERHEAD macro to adjust driver specifics - The driver can handle dynamic MTU change without needing the port to be stopped explicitly by the application. However, there is currently no check to prevent I/Os from happening on a different thread while the port is going thru' reset internally. This patch fixes this issue by assigning RX/TX burst functions to a dummy function and also reconfigure RX bufsize for each rx queue based on the new MTU value. - Fix minimum RX buffer size to 1024B - Force enable scatter/gather mode if given RX buf size is lesser than MTU - Adjust RX buffer size to cache-line size with overhead included Fixes: bec0228816c0 ("net/qede: support scatter gather") Fixes: 2ea6f76aff40 ("qede: add core driver") Signed-off-by: Harish Patil Signed-off-by: Rasesh Mody --- drivers/net/qede/qede_ethdev.c | 89 +++++++++++++++++++++++++++++++--------- drivers/net/qede/qede_rxtx.c | 55 +++++++++++++------------ drivers/net/qede/qede_rxtx.h | 15 ++++++- 3 files changed, 111 insertions(+), 48 deletions(-) diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 8fdff14..d1b89ea 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -629,7 +629,7 @@ static int qede_init_vport(struct qede_dev *qdev) start.remove_inner_vlan = 1; start.gro_enable = 0; - start.mtu = ETHER_MTU + QEDE_ETH_OVERHEAD; + start.mtu = qdev->mtu; start.vport_id = 0; start.drop_ttl0 = false; start.clear_stats = 1; @@ -717,6 +717,14 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev) if (rc != 0) return rc; + /* If jumbo enabled adjust MTU */ + if (eth_dev->data->dev_conf.rxmode.jumbo_frame) + eth_dev->data->mtu = + eth_dev->data->dev_conf.rxmode.max_rx_pkt_len - + ETHER_HDR_LEN - ETHER_CRC_LEN; + + qdev->mtu = eth_dev->data->mtu; + /* Issue VPORT-START with default config values to allow * other port configurations early on. */ @@ -764,8 +772,7 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev) PMD_INIT_FUNC_TRACE(edev); - dev_info->min_rx_bufsize = (uint32_t)(ETHER_MIN_MTU + - QEDE_ETH_OVERHEAD); + dev_info->min_rx_bufsize = (uint32_t)QEDE_MIN_RX_BUFF_SIZE; dev_info->max_rx_pktlen = (uint32_t)ETH_TX_MAX_NON_LSO_PKT_LEN; dev_info->rx_desc_lim = qede_rx_desc_lim; dev_info->tx_desc_lim = qede_tx_desc_lim; @@ -1403,32 +1410,76 @@ int qede_rss_reta_query(struct rte_eth_dev *eth_dev, int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) { - uint32_t frame_size; - struct qede_dev *qdev = dev->data->dev_private; + struct qede_dev *qdev = QEDE_INIT_QDEV(dev); + struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); struct rte_eth_dev_info dev_info = {0}; + struct qede_fastpath *fp; + uint32_t max_rx_pkt_len; + uint32_t frame_size; + uint16_t rx_buf_size; + uint16_t bufsz; + bool restart = false; + int i; + PMD_INIT_FUNC_TRACE(edev); + if (IS_VF(edev)) + return -ENOTSUP; qede_dev_info_get(dev, &dev_info); - - /* VLAN_TAG = 4 */ - frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + 4; - - if ((mtu < ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) + max_rx_pkt_len = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + frame_size = max_rx_pkt_len + QEDE_ETH_OVERHEAD; + if ((mtu < ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) { + DP_ERR(edev, "MTU %u out of range, %u is maximum allowable\n", + mtu, dev_info.max_rx_pktlen - ETHER_HDR_LEN - + ETHER_CRC_LEN - QEDE_ETH_OVERHEAD); return -EINVAL; - + } if (!dev->data->scattered_rx && - frame_size > dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM) + frame_size > dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM) { + DP_INFO(edev, "MTU greater than minimum RX buffer size of %u\n", + dev->data->min_rx_buf_size); return -EINVAL; - - if (frame_size > ETHER_MAX_LEN) + } + /* Temporarily replace I/O functions with dummy ones. It cannot + * be set to NULL because rte_eth_rx_burst() doesn't check for NULL. + */ + dev->rx_pkt_burst = qede_rxtx_pkts_dummy; + dev->tx_pkt_burst = qede_rxtx_pkts_dummy; + if (dev->data->dev_started) { + dev->data->dev_started = 0; + qede_dev_stop(dev); + restart = true; + } + rte_delay_ms(1000); + qdev->mtu = mtu; + /* Fix up RX buf size for all queues of the port */ + for_each_queue(i) { + fp = &qdev->fp_array[i]; + if ((fp->type & QEDE_FASTPATH_RX) && (fp->rxq != NULL)) { + bufsz = (uint16_t)rte_pktmbuf_data_room_size( + fp->rxq->mb_pool) - RTE_PKTMBUF_HEADROOM; + if (dev->data->scattered_rx) + rx_buf_size = bufsz + ETHER_HDR_LEN + + ETHER_CRC_LEN + QEDE_ETH_OVERHEAD; + else + rx_buf_size = frame_size; + rx_buf_size = QEDE_CEIL_TO_CACHE_LINE_SIZE(rx_buf_size); + fp->rxq->rx_buf_size = rx_buf_size; + DP_INFO(edev, "buf_size adjusted to %u\n", rx_buf_size); + } + } + if (max_rx_pkt_len > ETHER_MAX_LEN) dev->data->dev_conf.rxmode.jumbo_frame = 1; else dev->data->dev_conf.rxmode.jumbo_frame = 0; - + if (!dev->data->dev_started && restart) { + qede_dev_start(dev); + dev->data->dev_started = 1; + } /* update max frame size */ - dev->data->dev_conf.rxmode.max_rx_pkt_len = frame_size; - qdev->mtu = mtu; - qede_dev_stop(dev); - qede_dev_start(dev); + dev->data->dev_conf.rxmode.max_rx_pkt_len = max_rx_pkt_len; + /* Reassign back */ + dev->rx_pkt_burst = qede_recv_pkts; + dev->tx_pkt_burst = qede_xmit_pkts; return 0; } diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index 9948d2e..e586dc7 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -89,11 +89,11 @@ static void qede_tx_queue_release_mbufs(struct qede_tx_queue *txq) { struct qede_dev *qdev = dev->data->dev_private; struct ecore_dev *edev = &qdev->edev; - struct rte_eth_dev_data *eth_data = dev->data; + struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode; struct qede_rx_queue *rxq; - uint16_t pkt_len = (uint16_t)dev->data->dev_conf.rxmode.max_rx_pkt_len; + uint16_t max_rx_pkt_len; + uint16_t bufsz; size_t size; - uint16_t data_size; int rc; int i; @@ -127,34 +127,27 @@ static void qede_tx_queue_release_mbufs(struct qede_tx_queue *txq) rxq->nb_rx_desc = nb_desc; rxq->queue_id = queue_idx; rxq->port_id = dev->data->port_id; - - /* Sanity check */ - data_size = (uint16_t)rte_pktmbuf_data_room_size(mp) - - RTE_PKTMBUF_HEADROOM; - - if (pkt_len > data_size && !dev->data->scattered_rx) { - DP_ERR(edev, "MTU %u should not exceed dataroom %u\n", - pkt_len, data_size); - rte_free(rxq); - return -EINVAL; + max_rx_pkt_len = (uint16_t)rxmode->max_rx_pkt_len; + + /* Fix up RX buffer size */ + bufsz = (uint16_t)rte_pktmbuf_data_room_size(mp) - RTE_PKTMBUF_HEADROOM; + if ((rxmode->enable_scatter) || + (max_rx_pkt_len + QEDE_ETH_OVERHEAD) > bufsz) { + if (!dev->data->scattered_rx) { + DP_INFO(edev, "Forcing scatter-gather mode\n"); + dev->data->scattered_rx = 1; + } } - if (dev->data->scattered_rx) - rxq->rx_buf_size = data_size; + rxq->rx_buf_size = bufsz + ETHER_HDR_LEN + + ETHER_CRC_LEN + QEDE_ETH_OVERHEAD; else - rxq->rx_buf_size = pkt_len + QEDE_ETH_OVERHEAD; + rxq->rx_buf_size = max_rx_pkt_len + QEDE_ETH_OVERHEAD; + /* Align to cache-line size if needed */ + rxq->rx_buf_size = QEDE_CEIL_TO_CACHE_LINE_SIZE(rxq->rx_buf_size); - qdev->mtu = pkt_len; - - DP_INFO(edev, "MTU = %u ; RX buffer = %u\n", - qdev->mtu, rxq->rx_buf_size); - - if (pkt_len > ETHER_MAX_LEN) { - dev->data->dev_conf.rxmode.jumbo_frame = 1; - DP_NOTICE(edev, false, "jumbo frame enabled\n"); - } else { - dev->data->dev_conf.rxmode.jumbo_frame = 0; - } + DP_INFO(edev, "mtu %u mbufsz %u bd_max_bytes %u scatter_mode %d\n", + qdev->mtu, bufsz, rxq->rx_buf_size, dev->data->scattered_rx); /* Allocate the parallel driver ring for Rx buffers */ size = sizeof(*rxq->sw_rx_ring) * rxq->nb_rx_desc; @@ -1541,3 +1534,11 @@ void qede_dev_stop(struct rte_eth_dev *eth_dev) DP_INFO(edev, "dev_state is QEDE_DEV_STOP\n"); } + +uint16_t +qede_rxtx_pkts_dummy(__rte_unused void *p_rxq, + __rte_unused struct rte_mbuf **pkts, + __rte_unused uint16_t nb_pkts) +{ + return 0; +} diff --git a/drivers/net/qede/qede_rxtx.h b/drivers/net/qede/qede_rxtx.h index ed9a529..d1f3e99 100644 --- a/drivers/net/qede/qede_rxtx.h +++ b/drivers/net/qede/qede_rxtx.h @@ -55,14 +55,21 @@ ((flags) & (PARSING_AND_ERR_FLAGS_TUNNEL8021QTAGEXIST_MASK \ << PARSING_AND_ERR_FLAGS_TUNNEL8021QTAGEXIST_SHIFT)) +#define QEDE_MIN_RX_BUFF_SIZE (1024) +#define QEDE_VLAN_TAG_SIZE (4) +#define QEDE_LLC_SNAP_HDR_LEN (8) + /* Max supported alignment is 256 (8 shift) * minimal alignment shift 6 is optimal for 57xxx HW performance */ #define QEDE_L1_CACHE_SHIFT 6 #define QEDE_RX_ALIGN_SHIFT (RTE_MAX(6, RTE_MIN(8, QEDE_L1_CACHE_SHIFT))) #define QEDE_FW_RX_ALIGN_END (1UL << QEDE_RX_ALIGN_SHIFT) - -#define QEDE_ETH_OVERHEAD (ETHER_HDR_LEN + 8 + 8 + QEDE_FW_RX_ALIGN_END) +#define QEDE_CEIL_TO_CACHE_LINE_SIZE(n) (((n) + (QEDE_FW_RX_ALIGN_END - 1)) & \ + ~(QEDE_FW_RX_ALIGN_END - 1)) +/* Note: QEDE_LLC_SNAP_HDR_LEN is optional */ +#define QEDE_ETH_OVERHEAD (((2 * QEDE_VLAN_TAG_SIZE)) - (ETHER_CRC_LEN) \ + + (QEDE_LLC_SNAP_HDR_LEN)) /* TBD: Excluding IPV6 */ #define QEDE_RSS_OFFLOAD_ALL (ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP | \ @@ -180,6 +187,10 @@ uint16_t qede_xmit_pkts(void *p_txq, struct rte_mbuf **tx_pkts, uint16_t qede_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts); +uint16_t qede_rxtx_pkts_dummy(__rte_unused void *p_rxq, + __rte_unused struct rte_mbuf **pkts, + __rte_unused uint16_t nb_pkts); + /* Fastpath resource alloc/dealloc helpers */ int qede_alloc_fp_resc(struct qede_dev *qdev); -- 1.7.10.3