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 3350CA034C; Thu, 17 Mar 2022 19:30:00 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 07FCA407FF; Thu, 17 Mar 2022 19:30:00 +0100 (CET) Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by mails.dpdk.org (Postfix) with ESMTP id 992EA40040 for ; Thu, 17 Mar 2022 19:29:58 +0100 (CET) Received: by mail-pg1-f177.google.com with SMTP id t14so3295365pgr.3 for ; Thu, 17 Mar 2022 11:29:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fDvQ7YDVodSDFcbAUjwJ7v7XwsPHkCLzuKYdGqJRJHM=; b=XcTWoS3cpB7Z/HRO6PGUhEL7uEKHSdlmc84+TEWSiGGHPDIFSkVip5+bNKX2DgzI2S DykcRNk0iOyZdEubJF2PP7zW6Cigruna3nvn3vpgglg2BBli3XliVeR3S7kDpGCTiW4X 3VCLuxEumtfOdb9hCE4CMgFlJPOPAZxQ5hM0kaRkLPEc3YzOdeJFw6a9agUEPTZk9AHB ES5IeZOJ5Xdwp+cKyAudr9pee0Pg5Ik4nap+T0xwTMqmZlyuIALdd9K6+1nx6bbhAOdz +G7sJToWzQMyto0jJ23RXgJP8o4XR0bU9Tpr0nLuUCiSPJaobqorfqubiek6UUB/Ot7I XeKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fDvQ7YDVodSDFcbAUjwJ7v7XwsPHkCLzuKYdGqJRJHM=; b=LWaJfIsXnVcUr8trWQcfu6pbdJEvVZE9zjxMRj0kU/bqQr6Vbao/39iNgbO2B2rRM1 TGOx3Dfo+H10VgvKN2VXJe2xU+GZ42AW5KjmtgY0xGb8Em3+4oC5B8eQY8kAPDNlUNzy gtpe8WN3K3iNaJ4f5qan4W7FiH9xKLCJ7y6CF0rPTuZEBl4hJfXl0H2rCbdFqY9n/tRo Lj6a6f9vxLnRiJLslPZP1nnWaNzZ27CcdTw71jk1T22k9sbxHLoUW70jFKzOCeCpVPSM M21AttfhHnwYa3RouP9b3U3BjBAqZZlMrHhHAoYYO9STFtz/1bGokoITYG5o4dkCZ+rq Ol4Q== X-Gm-Message-State: AOAM531LXLQkv5yfehvmRcEL3adZqEfh05ZUzeh8mDgwIGmox9wizyF2 0qZ/6D0Mvvgg1xEReJZAw9yOGg== X-Google-Smtp-Source: ABdhPJxd2WB5BmCr4bYiBv3I+4JyfQuQOcEfXbaqA4VWoFXd+3+B8OXWPRzTE8FnmRCwgIzlrXYA7w== X-Received: by 2002:a05:6a00:190c:b0:4f7:e318:1a3f with SMTP id y12-20020a056a00190c00b004f7e3181a3fmr6340567pfi.43.1647541797759; Thu, 17 Mar 2022 11:29:57 -0700 (PDT) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id n3-20020a056a0007c300b004fa3e9f59cdsm2640141pfu.39.2022.03.17.11.29.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 11:29:57 -0700 (PDT) Date: Thu, 17 Mar 2022 11:29:54 -0700 From: Stephen Hemminger To: Peng Zhang Cc: dev@dpdk.org, heinrich.kuhn@corigine.com, Chaoyong He , Louis Peens Subject: Re: [PATCH] net/nfp: add the restrict of setting the mtu Message-ID: <20220317112954.7ead20af@hermes.local> In-Reply-To: <20220317143917.499138-1-peng.zhang@corigine.com> References: <20220317143917.499138-1-peng.zhang@corigine.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 Thu, 17 Mar 2022 16:39:17 +0200 Peng Zhang wrote: > + /* the setting mtu is in the range */ > + if (mtu < 68 || mtu > hw->max_mtu) { > + PMD_DRV_LOG(ERR, "the setting mtu cannot be less than 68 or more than %d", > + hw->max_mtu); > + return -ERANGE; > + } > + > + /* the setting mtu is lower than flbufsz */ > + if (mtu > hw->flbufsz) { > + PMD_DRV_LOG(ERR, "the setting mtu must be lower than current mbufsize of %d", > + hw->flbufsz); > + return -ERANGE; The ethdev layer already has min/max mtu checks, why is it needed inside common code? It looks like nfp_net_infos_get() does not set these values. Please fix it there instead. PS: 68 is RTE_ETHER_MIN_MTU so please use that.