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 4308942C54; Wed, 7 Jun 2023 22:52:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C41D341611; Wed, 7 Jun 2023 22:52:12 +0200 (CEST) Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) by mails.dpdk.org (Postfix) with ESMTP id 0B4A942C4D; Wed, 7 Jun 2023 18:54:39 +0200 (CEST) Received: by mail-qk1-f195.google.com with SMTP id af79cd13be357-75d4094f9baso445270785a.1; Wed, 07 Jun 2023 09:54:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686156878; x=1688748878; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0zjeQP9ec289jvSBl45VU8mh2VGRWMZozmLf/0rhgI4=; b=IlXeCj5fwTJmsYcryo56WqnaQW+1BOR/VXrd7AWtd5y2cMFnHUVTZT5JXAfZku+Iba 2J42oMa8wBQ6rVpW7ijQQsUyeruLezSccHZwcMqds8RbX9ZhO7YjFrqyzAOnQI8wdycH n1Mj4W9aMrRgf8yMunveMA10grJcuysTmmBwMDoC4FuOM9of3U2w+j5HnLiNCbSeSO6o OqGN4hcYxcdXPOBjqNLnMlMxkjp/rIh0sdY7U5tpPjnM3t5OYkliLQO10jqei4v1ojax cl/aNZx72QnmLGjqCKRFi2kLc4GMug6vMGEXc/K7qJViHuSiRG0/ceLtWhHTWwgfMUXr oPqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686156878; x=1688748878; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0zjeQP9ec289jvSBl45VU8mh2VGRWMZozmLf/0rhgI4=; b=Kfp93/gsJzuACpiGLJ5WhlWKxZ47ka56jxhHazqCeZe7CXvG8fd4W24J03T6EfVZzx jOnCrFLooaLuaPMlxtYm7sZNHo/fiTSe23iMnZ0mLesY4ibENcF1xJtqLKFqLYaPig0l dlCMi9VtHPywksOh1BSiRICe+WnAIRMUw13QaYN78NlChX28IZtkhOGSwvJQy1hhUWIk Oy/qdcX83+PCbPjGUWFrqDloKFsEccSZ3eQXQMJPUBG24SNSCyek3SEdpdUaRerUsjfX EcbbYRR/G1pFfciTwBefupSm19FFknISNFX2CMvcFhMCttPsw+UH+DPm4KUeSkqzN/2C FWmQ== X-Gm-Message-State: AC+VfDxgLojZ5NSDDsohFnZtmPHg2ZUttfDvzxc5w5Ja5TTdHmpAhnTv HsixP+lVVztrSZLnxpDPwLDdBb38s9f6xE1rsQvMoQ== X-Google-Smtp-Source: ACHHUZ7mTTOrV8u0z7FhwZoQr8Iq0CfEGAQgV57mlCb4wEdmuzzDEM4xop8K4+QJSEAtEO0ih3dGCg== X-Received: by 2002:a05:620a:4096:b0:75b:23a1:3671 with SMTP id f22-20020a05620a409600b0075b23a13671mr3435903qko.50.1686156878339; Wed, 07 Jun 2023 09:54:38 -0700 (PDT) Received: from localhost ([2001:19f0:5:3fd8:5400:3ff:fe7e:6d40]) by smtp.gmail.com with ESMTPSA id d13-20020a05620a140d00b0075cc95eb30asm52804qkj.8.2023.06.07.09.54.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 09:54:37 -0700 (PDT) From: Kaijun Zeng To: dev@dpdk.org Cc: Ferruh Yigit , Kaijun Zeng , stable@dpdk.org, Jochen Behrens , Bruce Richardson Subject: [PATCH] net/vmxnet3: fix return code in initializing Date: Wed, 7 Jun 2023 12:54:10 -0400 Message-Id: <20230607165410.13711-1-corezeng@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230528143734.145326-1-user@sklga> References: <20230528143734.145326-1-user@sklga> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Wed, 07 Jun 2023 22:52:11 +0200 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 Improve error handling and code style Bugzilla ID: 1239 Fixes: dfaff37fc46d ("vmxnet3: import new vmxnet3 poll mode driver implementation") Cc: stable@dpdk.org Signed-off-by: Kaijun Zeng --- drivers/net/vmxnet3/vmxnet3_rxtx.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index a875ffec07..e6e36dca93 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -1311,11 +1311,18 @@ vmxnet3_dev_rxtx_init(struct rte_eth_dev *dev) for (j = 0; j < VMXNET3_RX_CMDRING_SIZE; j++) { /* Passing 0 as alloc_num will allocate full ring */ ret = vmxnet3_post_rx_bufs(rxq, j); - if (ret <= 0) { + + /* Zero number of descriptors in the configuration of the RX queue */ + if (ret == 0) { PMD_INIT_LOG(ERR, - "ERROR: Posting Rxq: %d buffers ring: %d", - i, j); - return -ret; + "Invalid configuration in Rx queue: %d, buffers ring: %d\n", + i, j); + return -EINVAL; + } + /* Return the error number */ + if (ret < 0) { + PMD_INIT_LOG(ERR, "Posting Rxq: %d buffers ring: %d", i, j); + return ret; } /* * Updating device with the index:next2fill to fill the -- 2.30.2