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 46FE2A0C50; Wed, 21 Jul 2021 14:27:25 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C07CA4014D; Wed, 21 Jul 2021 14:27:24 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 8920D40143 for ; Wed, 21 Jul 2021 14:27:23 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10051"; a="198628369" X-IronPort-AV: E=Sophos;i="5.84,258,1620716400"; d="scan'208";a="198628369" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2021 05:27:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,258,1620716400"; d="scan'208";a="432584383" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga007.fm.intel.com with ESMTP; 21 Jul 2021 05:27:20 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Wed, 21 Jul 2021 05:27:19 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Wed, 21 Jul 2021 05:27:19 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Wed, 21 Jul 2021 05:27:19 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.106) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Wed, 21 Jul 2021 05:27:19 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Po6mo5XpzYw4eKb/150hvwLiyXtB1IX8MDZDtcNp2hsdS0FUCgB3HwRO2syUbCxAgBk5EgSQPxarkN2uLmGOdOzomU3RznHBrynXzD9uc05lb3kAPh/bgBbWS3Z+4hh7YSQUCkzBD665xK5f+t7FqZpNEgY33/2aC4H6oufpraVg/qPz8czKgXDVVGoyNii8FwnExoUmT2G/UYoU//ixR7qJljOScWHCSIzL+vscgXnpzr5hgUegar1r2ZRHaMXxpe9/0gj81GztY9hl1pw3iZa7RDSNsNo0uOaSnWpU5PTH33mPmAdqyVuFUhysildwx8ut+bjWLe9za3KbqmVGXA== 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-SenderADCheck; bh=jVI94yjkh5qCAltsUCX5E1LYetrSy6OKkyOLP/MWj+s=; b=MzA/5pIBaQbpT2ynWCvauYMAeMJRS5N+yp3P4xqV6l98x9yczMeAmTb29GqDnluzFCFIsxONZzahsxXUnNMwazJz8Y/UdEM7cFYOl5Am0Dxl6B3DWSNrPYfrPjfq5Zdq9verx3rWatfLbAhv8uB1klvs5CXwWcGnmTHgoGs/LEMPfZRChY0fi7WccE7wC6sMhmwNqF2kXigJnl73ilgd6y0Q19h7SxQbxPzQKbbhUXtx6oK/YGartwfb2OTDuoRvGKSmSejl0i1NvN3uC7Pve/h2AIEE5MMcJO27opCuN/z8xH+NDFJgw2esN4PB/SS/7BedT7UcMi/lZTpzxvAO6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jVI94yjkh5qCAltsUCX5E1LYetrSy6OKkyOLP/MWj+s=; b=LkxreB6dODk10WR0ZambbPxkaS5LVurpqfhnyMzY2jZ/o2rWkXqGRFkKT+ajJ8U4+tU/oQL9hw+L1oaBtClECwt7uasirI7XR+fbrNWPjWYEImroFAnTe3twO6cbmfzYzbuLrt4fh7+rx9rRx4N+ajx3lmJeRLV3u1Urx1MjFxA= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=intel.com; Received: from SJ0PR11MB5005.namprd11.prod.outlook.com (2603:10b6:a03:2d3::21) by BYAPR11MB3447.namprd11.prod.outlook.com (2603:10b6:a03:1d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.25; Wed, 21 Jul 2021 12:27:16 +0000 Received: from SJ0PR11MB5005.namprd11.prod.outlook.com ([fe80::a018:c8bc:f54e:514c]) by SJ0PR11MB5005.namprd11.prod.outlook.com ([fe80::a018:c8bc:f54e:514c%7]) with mapi id 15.20.4331.034; Wed, 21 Jul 2021 12:27:16 +0000 To: Andrew Rybchenko , Somalapuram Amaranath , Ajit Khaparde , Somnath Kotur , Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Rahul Lakkireddy , Hemant Agrawal , Sachin Saxena , Haiyue Wang , Gagandeep Singh , Ziyang Xuan , Xiaoyun Wang , Guoyang Zhou , "Min Hu (Connor)" , Yisen Zhuang , Lijun Ou , Beilei Xing , Jingjing Wu , Qiming Yang , Qi Zhang , Rosen Xu , Shijith Thotton , Srisivasubramanian Srinivasan , Heinrich Kuhn , Harman Kalra , Jerin Jacob , "Rasesh Mody" , Devendra Singh Rawat , Igor Russkikh , Maciej Czekaj , Jiawen Wu , Jian Wang , Thomas Monjalon CC: References: <20210709172923.3369846-1-ferruh.yigit@intel.com> <20210709172923.3369846-2-ferruh.yigit@intel.com> <8399aaa2-22e8-c2cd-a5ca-9da7bd8990d7@oktetlabs.ru> From: Ferruh Yigit X-User: ferruhy Message-ID: <79517887-8f31-2e34-55c0-617965550c89@intel.com> Date: Wed, 21 Jul 2021 13:26:48 +0100 In-Reply-To: <8399aaa2-22e8-c2cd-a5ca-9da7bd8990d7@oktetlabs.ru> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-ClientProxiedBy: AM3PR07CA0097.eurprd07.prod.outlook.com (2603:10a6:207:6::31) To SJ0PR11MB5005.namprd11.prod.outlook.com (2603:10b6:a03:2d3::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.0.206] (37.228.236.146) by AM3PR07CA0097.eurprd07.prod.outlook.com (2603:10a6:207:6::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.10 via Frontend Transport; Wed, 21 Jul 2021 12:26:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 29701b02-42e8-4c7a-8ea3-08d94c42e03d X-MS-TrafficTypeDiagnostic: BYAPR11MB3447: X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: L6oPaUnkf1cpeSoVYO7GPiS8Yrgk77oGzbRExU4jzfmV3k70v0zJH++YvK4qA/V1XGQ8f1o7pJCTZp9j0r9D6IQ459HtVunrCWdRBPKgNfPLC7YpcEOW0UlJTMensN9EYFGQ+D5v6KJgZm8SHcToBz/ETcBFddmFq65AmdYpSbyIyW9I+oDeOZxYUuedGUKoTYWuEDQ3ZuKJCP11p/okq3qiHnqE1LElV5Em5GBuQfVVCb+vFACFJYCkdT5GPETEQqixMEeR/pP9bhJ+xnWnhchw+sSzK/0NZmPhKl0VlNy58W9BG5jChNym9DrYE8VFO1Ah34SMYEeFXDCZ4IhYJlIq9DVywfOpdo/1YBaO480QnbiDBET/8M58l1DBHfgfrShszubhjIlETt4JH47uKVND462nGs5nkUq9wxGKSAplcmJw56Ovb7GmZ07tFqnYBzd0kKRFjbU0k9rDub1IxPMykzehMArVkYW8ASxUE6FSbSSRddY+DtZh3ND3X/7++5pwWwLp/dY0PbJWEnsLe6UEGlTTfTMwu7PaUmBdvjLwNhVyPj5r8ug9PMXoU1R8egJnNhe6bTvx8PWZ1d4DW1deu/dtRU48ycB0rmN9idOYqQiBUkAScWukH0rKQCnw2FRlI0rSbmzpxNpvx9DyKUaEazqkVihnqxbNlAPUuHux5g79E3lWz4k6JYuSooce/EZFm7yb+pA5ow2Yq7CyIp84pJ5XYmN1DLUHzVpA4h4= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR11MB5005.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(136003)(346002)(396003)(39860400002)(376002)(7416002)(26005)(6666004)(83380400001)(2616005)(956004)(53546011)(66476007)(31686004)(66556008)(478600001)(110136005)(66946007)(4326008)(316002)(2906002)(921005)(8936002)(7406005)(5660300002)(44832011)(186003)(36756003)(38100700002)(31696002)(86362001)(8676002)(16576012)(6486002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange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?iLGKb5OkrxFtS74eyRWQp8rMrdcK8XzC2Q4V88H?= X-MS-Exchange-CrossTenant-Network-Message-Id: 29701b02-42e8-4c7a-8ea3-08d94c42e03d X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5005.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2021 12:27:16.6136 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: k7f15boefGO0o+06+vxJj8d95eCoJcm4p2JcOEuOdNujWyEEuUuhuIdkMt8BzqDZAKr/TmZhh7l0ykXIuSiGTA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3447 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH 2/4] ethdev: move jumbo frame offload check to library 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 Sender: "dev" On 7/13/2021 2:48 PM, Andrew Rybchenko wrote: > On 7/9/21 8:29 PM, Ferruh Yigit wrote: >> Setting MTU bigger than RTE_ETHER_MTU requires the jumbo frame support, >> and application should enable the jumbo frame offload support for it. >> >> When jumbo frame offload is not enabled by application, but MTU bigger >> than RTE_ETHER_MTU is requested there are two options, either fail or >> enable jumbo frame offload implicitly. >> >> Enabling jumbo frame offload implicitly is selected by many drivers >> since setting a big MTU value already implies it, and this increases >> usability. >> >> This patch moves this logic from drivers to the library, both to reduce >> the duplicated code in the drivers and to make behaviour more visible. >> >> Signed-off-by: Ferruh Yigit > > Very good cleanup, many thanks. > > Reviewed-by: Andrew Rybchenko > > [snip] > >> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c >> index 3451125639f9..d649a5dd69a9 100644 >> --- a/lib/ethdev/rte_ethdev.c >> +++ b/lib/ethdev/rte_ethdev.c >> @@ -3625,6 +3625,7 @@ rte_eth_dev_set_mtu(uint16_t port_id, uint16_t mtu) >> int ret; >> struct rte_eth_dev_info dev_info; >> struct rte_eth_dev *dev; >> + int is_jumbo_frame_capable = 0; >> >> RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); >> dev = &rte_eth_devices[port_id]; >> @@ -3643,12 +3644,27 @@ rte_eth_dev_set_mtu(uint16_t port_id, uint16_t mtu) >> >> if (mtu < dev_info.min_mtu || mtu > dev_info.max_mtu) >> return -EINVAL; >> + >> + if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_JUMBO_FRAME) >> + is_jumbo_frame_capable = 1; >> } >> >> + if (mtu > RTE_ETHER_MTU && is_jumbo_frame_capable == 0) >> + return -EINVAL; >> + >> ret = (*dev->dev_ops->mtu_set)(dev, mtu); >> - if (!ret) >> + if (!ret) { > > Since line it updated anyway, may I ask to use explicit > comparison vs 0 as coding style says. > ack, will fix all occurrences >> dev->data->mtu = mtu; >> >> + /* switch to jumbo mode if needed */ >> + if (mtu > RTE_ETHER_MTU) >> + dev->data->dev_conf.rxmode.offloads |= >> + DEV_RX_OFFLOAD_JUMBO_FRAME; >> + else >> + dev->data->dev_conf.rxmode.offloads &= >> + ~DEV_RX_OFFLOAD_JUMBO_FRAME; >> + } >> + >> return eth_err(port_id, ret); >> } >> >> >