From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6E078A00BE; Tue, 3 May 2022 21:04:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 61BD141156; Tue, 3 May 2022 21:04:56 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2078.outbound.protection.outlook.com [40.107.244.78]) by mails.dpdk.org (Postfix) with ESMTP id 31D6C40C35 for ; Tue, 3 May 2022 21:04:55 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gLd5CM4z/xC+0rbjiv15I5n8tJf1d8RV6Y2Hlr13ahYA2N72UsHqarmUOknEo1Bd+1+Lijo6s/VM75JPKsaAi+uW6GukFMNskE5jdgSKcYICIMYK3AF6SsYyAYRnLpHs6ySznozyNemR/A4lv1ZahlmEcq7WTy3D71HtfnLfgshlUH7ExvMGFpipIdJSFKqNZsE9eNZPPvLBRz5tuCnOgDLLkXJkCJDhDfFxFtRWnztGLZSmYG3ShA3U97E7M9h4EbobpjzAg49+IG5Wh6dhi9qAhsR/RXHXkYX3B1niU7QZFSblbP5WCnakXD51HWned8c+GaibOu4QLZXi8I1bTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pzRBF0PsW3GCYRfG54C1Wnzh+OqmEnYf696/aE0lyNE=; b=OH4q+8/thx9cr50DGQZhLKqgUAX3PYTP+W9d0ZQ1MLToqIdnhI5WJ+hS3coMva3kAEpuxmRovPyNOeKdlq1rfF2+xyaDu9Td0YQlkddq9yO37dgqVZfoMGVBsiNJyOWXKnl9177fCKX0KsFKI/Os+6pLHN6x9eosur4zqa2ZnaOj/P+dZs/W2JhAKTaQYbb2+7s4kSqPOXy789XTtdMBMRH2EgYtubJ5zN98f5LfuG2GHFZabeALvlclOAVfyzvr8pZjlJW0NQKj/SCzE+z7vfZkpSxOPwa0ALMHZjfvrJ1NAHmttKVpp/H+O16sgSotVELeGly2IQARciVPf/0CtA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.80.198) smtp.rcpttodomain=corigine.com smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pzRBF0PsW3GCYRfG54C1Wnzh+OqmEnYf696/aE0lyNE=; b=UW3tn2dOICVse9jRedds2YysVqMhVKUCTfIYeyBWMwArmrt8HjGa9UARFTAHW34eEyuMnfDeUJYs5D3eY/bHk+CqEAgjigmAgH81gf8vM9hm8p138SDffj24H5GxU/dnTUG9Yl8Y8uksfFUnXxENe4giMiXtY80ASTp+uysoKlU= Received: from BN9PR03CA0627.namprd03.prod.outlook.com (2603:10b6:408:106::32) by DM6PR02MB6619.namprd02.prod.outlook.com (2603:10b6:5:217::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.14; Tue, 3 May 2022 19:04:52 +0000 Received: from BN1NAM02FT050.eop-nam02.prod.protection.outlook.com (2603:10b6:408:106:cafe::1e) by BN9PR03CA0627.outlook.office365.com (2603:10b6:408:106::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.13 via Frontend Transport; Tue, 3 May 2022 19:04:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.80.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.80.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.80.198; helo=xir-pvapexch02.xlnx.xilinx.com; Received: from xir-pvapexch02.xlnx.xilinx.com (149.199.80.198) by BN1NAM02FT050.mail.protection.outlook.com (10.13.2.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5227.15 via Frontend Transport; Tue, 3 May 2022 19:04:50 +0000 Received: from xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) by xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Tue, 3 May 2022 20:04:50 +0100 Received: from smtp.xilinx.com (172.21.105.198) by xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Tue, 3 May 2022 20:04:50 +0100 Envelope-to: walter.heymans@corigine.com, dev@dpdk.org, niklas.soderlund@corigine.com, louis.peens@corigine.com, chaoyong.he@corigine.com, richard.donkin@corigine.com Received: from [10.71.119.91] (port=55928) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nlxpJ-0000ys-Jb; Tue, 03 May 2022 20:04:50 +0100 Message-ID: Date: Tue, 3 May 2022 20:04:48 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH v2] net/nfp: update how MAX MTU is read Content-Language: en-US To: Walter Heymans , CC: =?UTF-8?Q?Niklas_S=c3=b6derlund?= , Louis Peens , Chaoyong He , Richard Donkin References: <20220420134638.24010-1-walter.heymans@corigine.com> From: Ferruh Yigit In-Reply-To: <20220420134638.24010-1-walter.heymans@corigine.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ca785da4-941e-48c0-2a07-08da2d37ccf2 X-MS-TrafficTypeDiagnostic: DM6PR02MB6619:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Wldaa/MdMry6GPo7Adi+or8F0Mxx3GDwJg1/e9OrQDW+NpmFzVGd+vzRfiza9qtFCKMqWgzpNDu3OmxH0ZmwEuji2SleIj7QIyyTELEjt2FkMi/WFpBQAoPGcwh7fXQy/oWC3JwjbuiKv2JPHx8ErFn5vDLzM3d2e6jsla5ebMtIjgX6A3YKTVw44MSI7LPcW4pkanfvHHR7yTlLz2a9WGro9Omiq05ed0TZ2Zb+cc6jinbENn86Y9nLd+Ih2upGwbrwkqCJro5oumdPM+yVJu9KgBL0KkNuxLKg2RnDrV/gDzgjvFBVdpBKbj/RkXS1miqr2XXTdLiRAbXCYihzvB2p5+gRaWhATvyFpvHjyIFRviE+yU96lPmNWIQt0msA3bJDUhGJbwQIdIN4eQojCoiWljCUxa6Qf5vy2KTwynyVhE55tTLRCF6JWPTT6ujvV9UenWYPHUnWF/4fvSgAjkxbSNu7fmK6/q+Ov++04/QtBe38mtoRVCdF7XRPDTAqoK5W3d6BkgF5wHawr4+AeyQFlBPa9k+TWuHiFlMWJcaFPcuNGctOh+IBW6LCqUXmD9AZXWPWzEJaofdhPIecIrZRfo4DXTRs9TFMa2J0AjroczCEuf7bFbIYbjA4/He/BtLf8KpF77kPoSvbtQKID6/KTEBU/SBShXK9DJbXxVfhtL5ixvd/wuCblc4x5weRTGLcvXI9mWmMrAACxPXJOQ8tDQl3Zy9al6Mwpn5XFLo= X-Forefront-Antispam-Report: CIP:149.199.80.198; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:xir-pvapexch02.xlnx.xilinx.com; PTR:unknown-80-198.xilinx.com; CAT:NONE; SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(53546011)(31696002)(9786002)(15650500001)(508600001)(5660300002)(44832011)(8936002)(2906002)(7636003)(83380400001)(356005)(26005)(2616005)(36860700001)(66574015)(40460700003)(336012)(426003)(47076005)(186003)(8676002)(110136005)(54906003)(4326008)(82310400005)(70206006)(36756003)(70586007)(316002)(31686004)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2022 19:04:50.9501 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ca785da4-941e-48c0-2a07-08da2d37ccf2 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.80.198]; Helo=[xir-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: BN1NAM02FT050.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB6619 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 4/20/2022 2:46 PM, Walter Heymans wrote: > The 'max_rx_pktlen' value was previously read from hardware, which was > set by the running firmware. This caused confusion due to different > meanings of 'MAX_MTU'. This patch updates the 'max_rx_pktlen' to the > maximum value that the NFP NIC can support. The 'max_mtu' value that is > read from hardware, is assigned to the 'dev_info->max_mtu' variable. > > If more layer 2 metadata must be used, the firmware can be updated to > report a smaller 'max_mtu' value. > > The constant defined for NFP_FRAME_SIZE_MAX is derived for the maximum > supported buffer size of 10240, minus 136 bytes that is reserved by the > hardware and another 56 bytes reserved for expansion in firmware. This > results in a usable maximum packet length of 10048 bytes. > > Signed-off-by: Walter Heymans > Signed-off-by: Niklas Söderlund > Reviewed-by: Louis Peens > Reviewed-by: Chaoyong He > Reviewed-by: Richard Donkin > --- > drivers/net/nfp/nfp_common.c | 11 ++++++++++- > drivers/net/nfp/nfp_common.h | 3 +++ > 2 files changed, 13 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c > index b26770dbfb..52fbda1a79 100644 > --- a/drivers/net/nfp/nfp_common.c > +++ b/drivers/net/nfp/nfp_common.c > @@ -692,7 +692,16 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) > dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues; > dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues; > dev_info->min_rx_bufsize = RTE_ETHER_MIN_MTU; > - dev_info->max_rx_pktlen = hw->max_mtu; > + /* > + * The maximum rx packet length (max_rx_pktlen) is set to the > + * maximum supported frame size that the NFP can handle. This > + * includes layer 2 headers, CRC and other metadata that can > + * optionally be used. > + * The maximum layer 3 MTU (max_mtu) is read from hardware, > + * which was set by the firmware loaded onto the card. > + */ > + dev_info->max_rx_pktlen = NFP_FRAME_SIZE_MAX; > + dev_info->max_mtu = hw->max_mtu; Hi Walter, ethdev uses 'max_mtu' and 'max_rx_pktlen' to calculate the frame overhead, like: 'overhead_len = max_rx_pktlen - max_mtu;' In above change 'max_rx_pktlen' is hardcoded but 'max_mtu' is 'hw' depended, can you confirm 'hw->max_mtu' will always have the frame overhead as according above calculation? > /* Next should change when PF support is implemented */ > dev_info->max_mac_addrs = 1; > > diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h > index 8b35fa119c..8db5ec23f8 100644 > --- a/drivers/net/nfp/nfp_common.h > +++ b/drivers/net/nfp/nfp_common.h > @@ -98,6 +98,9 @@ struct nfp_net_adapter; > /* Number of supported physical ports */ > #define NFP_MAX_PHYPORTS 12 > > +/* Maximum supported NFP frame size (MTU + layer 2 headers) */ > +#define NFP_FRAME_SIZE_MAX 10048 > + > #include > #include >