From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 640BDA04DB; Thu, 10 Dec 2020 04:00:32 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 31CEBC9E8; Thu, 10 Dec 2020 03:58:03 +0100 (CET) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by dpdk.org (Postfix) with ESMTP id B6DD0C9E0 for ; Thu, 10 Dec 2020 03:58:01 +0100 (CET) Received: by mail-pg1-f196.google.com with SMTP id w4so2805508pgg.13 for ; Wed, 09 Dec 2020 18:58:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=1ZVvyBY//njtsop6M5/B5l7qhDW/0nU0BIKMVUqdFBE=; b=YhEJIMak+lDg0TYmgxVRRatEiLVstLwK8gCz0hE5fBaAMSqI7EGiiyEc3HjSalnCVH zg5l7mwgXnXHfBVlFD7lXo1rcYnWIXHuG+R3obMUZDxHi+/vJB3VzkN2Kbvs5x5z6vpV R/4g2WTX146hO96orLGCXuuPPV/OwD3ZvB4Wn86MJIk8ZHVSp9CaIwiXi10eTkIxMGoX ap45NaB8DTBt21PkROeh3l/RStn5CcntuvsUgJsI3v2jec8yEb61/SqboPC3xZPlG63V 0lvi16dQDtJffYSIB6g8nNgydOIPYNvm8uRyCd19gnZ5kLW4WAJNorCpKF4k7KV3m94u dvQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=1ZVvyBY//njtsop6M5/B5l7qhDW/0nU0BIKMVUqdFBE=; b=R3ZFifzOwL32gmIglKfDnGTrL1K2UadOKbYjMGbgDrbhVET0Ede3qeetyxZyVhlMnZ 7/lLGgikPDYmq4OsoJgmH3ZQpFbtI6+mYlpgs8ko2CUjW7Nz3PBrdq8B5yl6jNmJ1cfT LtBp97rhjDHw/5d1Tqj/pMQKRliiRCk8snQvJkWYDOW3UW82xuDXuHyahSEIiF79wNYG 401FpfBJovmGjeo5Dv2/8K4hTC0v5BBiDVCbYViijnlInpyyyXZRQg/vJtSge4Xn80oC 2T6eAuAfvatCXIXj6QEmfU6IxrFyExsVfnhxCzY4nfH762ro42+PEUemAi0dunteGy9F h1Tg== X-Gm-Message-State: AOAM533UEWjaEOUpAeZWgd4EgOvDjGtGAR90hvAEACmU+SOadJSWopf3 sdFTDWoHGmfedrL104ZguRS7nOx84u/CTA== X-Google-Smtp-Source: ABdhPJw74Hazk+He8wQSvbuGcOfHF5ckiD3rC/eX4Y0W7ykqSqS658VBZZEOGv+9/+WrXUDxTmkf5w== X-Received: by 2002:a05:6a00:84a:b029:19e:4cc:dc6f with SMTP id q10-20020a056a00084ab029019e04ccdc6fmr4922892pfk.33.1607569079519; Wed, 09 Dec 2020 18:57:59 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id h16sm3942469pgd.62.2020.12.09.18.57.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Dec 2020 18:57:59 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Wed, 9 Dec 2020 18:57:36 -0800 Message-Id: <20201210025737.1057-9-aboyer@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201210025737.1057-1-aboyer@pensando.io> References: <20201210025737.1057-1-aboyer@pensando.io> In-Reply-To: <20201210020743.68927-1-aboyer@pensando.io> References: <20201210020743.68927-1-aboyer@pensando.io> Subject: [dpdk-dev] [PATCH v5 8/9] net/ionic: minor refactorings and helper variables X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" This makes the code clearer and conserves resources. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_lif.c | 15 ++++++++++----- drivers/net/ionic/ionic_main.c | 18 +++++++----------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index 2e33fb8d9..722a89565 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -77,11 +77,14 @@ void ionic_lif_reset(struct ionic_lif *lif) { struct ionic_dev *idev = &lif->adapter->idev; + int err; IONIC_PRINT_CALL(); ionic_dev_cmd_lif_reset(idev, lif->index); - ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT); + err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT); + if (err) + IONIC_PRINT(WARNING, "Failed to reset lif"); } static void @@ -305,10 +308,11 @@ ionic_dev_add_mac(struct rte_eth_dev *eth_dev, } void -ionic_dev_remove_mac(struct rte_eth_dev *eth_dev, uint32_t index __rte_unused) +ionic_dev_remove_mac(struct rte_eth_dev *eth_dev, uint32_t index) { struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev); struct ionic_adapter *adapter = lif->adapter; + struct rte_ether_addr *mac_addr; IONIC_PRINT_CALL(); @@ -319,11 +323,12 @@ ionic_dev_remove_mac(struct rte_eth_dev *eth_dev, uint32_t index __rte_unused) return; } - if (!rte_is_valid_assigned_ether_addr(ð_dev->data->mac_addrs[index])) + mac_addr = ð_dev->data->mac_addrs[index]; + + if (!rte_is_valid_assigned_ether_addr(mac_addr)) return; - ionic_lif_addr_del(lif, (const uint8_t *) - ð_dev->data->mac_addrs[index]); + ionic_lif_addr_del(lif, (const uint8_t *)mac_addr); } int diff --git a/drivers/net/ionic/ionic_main.c b/drivers/net/ionic/ionic_main.c index f77bddaa4..92cf0f398 100644 --- a/drivers/net/ionic/ionic_main.c +++ b/drivers/net/ionic/ionic_main.c @@ -188,8 +188,7 @@ ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) done = ionic_wait_ctx_for_completion(lif, qcq, ctx, IONIC_DEVCMD_TIMEOUT); - err = ionic_adminq_check_err(ctx, !done /* timed out */); - return err; + return ionic_adminq_check_err(ctx, !done /* timed out */); } static int @@ -241,10 +240,11 @@ ionic_dev_cmd_wait_check(struct ionic_dev *idev, unsigned long max_wait) int err; err = ionic_dev_cmd_wait(idev, max_wait); - if (err) - return err; - return ionic_dev_cmd_check_error(idev); + if (!err) + err = ionic_dev_cmd_check_error(idev); + + return err; } int @@ -299,22 +299,18 @@ int ionic_init(struct ionic_adapter *adapter) { struct ionic_dev *idev = &adapter->idev; - int err; ionic_dev_cmd_init(idev); - err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT); - return err; + return ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT); } int ionic_reset(struct ionic_adapter *adapter) { struct ionic_dev *idev = &adapter->idev; - int err; ionic_dev_cmd_reset(idev); - err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT); - return err; + return ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT); } int -- 2.17.1