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 B389945EFE; Sat, 21 Dec 2024 01:33:28 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4841240156; Sat, 21 Dec 2024 01:33:28 +0100 (CET) Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by mails.dpdk.org (Postfix) with ESMTP id 2F82A4003C for ; Sat, 21 Dec 2024 01:33:27 +0100 (CET) Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-2161eb94cceso17386915ad.2 for ; Fri, 20 Dec 2024 16:33:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1734741206; x=1735346006; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=j+9wi3UNWk56hL95Ix6ol6JFFiKEI23twP1wa8dBLr4=; b=CIud10xvX1iHpSbrRzbhwV09beDmoazuAYGoB5eTFj7AzRWavbntcDuvzpe2zifaRk qqeoGUYA+p5DwrzLau88BfCzVaao7ebWQ0blk4WQKAFtmkEJ6csPaGFNzWoImRjV9inB /W4JzxFMaK4hjHLHfRmSfWjroHycW3AL0al7oXIYi/45w1raORM/KtftR+1qYeoAVXa+ OFEfx0wFeMPJlQPbBp1xxMFhhqezJMEY+1uEUkdI/i/6AoDGggT88mezppS6t7KDTs12 3C08ZJ0g2iJwC6jBwBUu7vGLytGnlZAGbA0hfTC0dHw6KnbeGtDjzgNhrkGr0+4cdFVT PLhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734741206; x=1735346006; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j+9wi3UNWk56hL95Ix6ol6JFFiKEI23twP1wa8dBLr4=; b=jnU3bbiqG7vVpcOsu+pCwS+OBHaNob81kpCBi5i9VRmiUysizY3kIHj6pDbwbpjdfx YR5aKjhKIquTGGxHMcVoTMS6Lo9ZH6vdLohSGcaxYbPrcZamlmCKR80QpJkWfAPzcjVH O5ChR3Dfte7VX0IlENFg+z6jzgJcioohOFdYO6qdSI8a974Hj6HuHsQG/xS/Oc9WBV4c QmZHxhAHnHncNtOHuciXkFRG45O/YOD4o++AjvZMZ+hio2Yltlyw6K8+QjfvhSEQcKjn QsfzRtUNUeiChfksk84Mhtwml9O3hTgrLWnz46HJmqPZmE92ofsPwjPbBVy60n7LPBHN tdUg== X-Gm-Message-State: AOJu0YyHSPHczNn9pJz9LbVDG9PKSp/RUqG31WRmPWQ2HiY55becULUj 4oaaJC1rlfc83BX5C3igMp43n3DOhdYJHdZjcmpG4pj1r7EnIabLIi7xG6aUCZ0= X-Gm-Gg: ASbGncsoJM+1HddT81W+eJFvd8tmkeMpLSzYjbGgW4RNOf7yRMZNM/vzZkuKbq+HGoC yIt6KVbZQNyGiebTVC5NI6xSGfkQbduLBEJ5r0cECDZQOi79QfSPc+x48p/j5TZ+37zSDMxXRxV jP9Abk7L+PDzpQCVshunNd6UNuNyJjG8Ba4lFz7vI24y7GOK3NM/IKGiky7sumwi+VvT3BuLBGy Yq4G0y/rsByN9ba3mM/jjfVQ6uOtdT8wSPk7WyEg91dNuq0cmbQsJnw6Gc3b4MU4cCvgT6xH+w1 rYc68kgNK1v/qIEZimClcFmX2+cWC196dQ== X-Google-Smtp-Source: AGHT+IHzD8PjkS2te6lnltRX6TxUkkKLC40V0kIH/rfOyJuFXgLa9xU9dhTnZR9Dw5akI9jLlWhE4A== X-Received: by 2002:a17:902:e746:b0:215:8847:435c with SMTP id d9443c01a7336-219e6e8c595mr65517065ad.12.1734741206119; Fri, 20 Dec 2024 16:33:26 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc96e919sm34881155ad.69.2024.12.20.16.33.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2024 16:33:25 -0800 (PST) Date: Fri, 20 Dec 2024 16:33:24 -0800 From: Stephen Hemminger To: Junlong Wang Cc: dev@dpdk.org Subject: Re: [PATCH v4 15/15] net/zxdh: mtu update ops implementations Message-ID: <20241220163324.3abb2e9b@hermes.local> In-Reply-To: <20241218092603.1218855-16-wang.junlong1@zte.com.cn> References: <20241210055333.782901-2-wang.junlong1@zte.com.cn> <20241218092603.1218855-1-wang.junlong1@zte.com.cn> <20241218092603.1218855-16-wang.junlong1@zte.com.cn> 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 Wed, 18 Dec 2024 17:26:02 +0800 Junlong Wang wrote: > +int zxdh_dev_mtu_set(struct rte_eth_dev *dev, uint16_t new_mtu) > +{ > + struct zxdh_hw *hw = dev->data->dev_private; > + struct zxdh_panel_table panel = {0}; > + struct zxdh_port_attr_table vport_att = {0}; > + uint16_t vfid = zxdh_vport_to_vfid(hw->vport); > + uint16_t max_mtu = 0; > + int ret = 0; useless initializations. > + > + max_mtu = ZXDH_MAX_RX_PKTLEN - RTE_ETHER_HDR_LEN - RTE_VLAN_HLEN - ZXDH_DL_NET_HDR_SIZE; > + if (new_mtu < ZXDH_ETHER_MIN_MTU || new_mtu > max_mtu) { > + PMD_DRV_LOG(ERR, "invalid mtu:%d, range[%d, %d]", > + new_mtu, ZXDH_ETHER_MIN_MTU, max_mtu); > + return -EINVAL; > + } These checks are redundant. See rte_ethdev.c::eth_dev_validate_mtu function. It already checks the mtu against values returned from info_get. > + > + if (dev->data->mtu == new_mtu) > + return 0; This should be done in ethdev_set_mtu but does not look like that is checked. Will look into fixing it there.