From patchwork Wed Nov 4 22:33:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 318447 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D9C2C388F7 for ; Wed, 4 Nov 2020 22:34:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29A802080D for ; Wed, 4 Nov 2020 22:34:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="zN25aHG8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732120AbgKDWeF (ORCPT ); Wed, 4 Nov 2020 17:34:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726777AbgKDWeE (ORCPT ); Wed, 4 Nov 2020 17:34:04 -0500 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 401A7C0613CF for ; Wed, 4 Nov 2020 14:34:04 -0800 (PST) Received: by mail-pg1-x542.google.com with SMTP id 62so46494pgg.12 for ; Wed, 04 Nov 2020 14:34:04 -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; bh=2aWkMqo1r20Pi2OEYli1mBai8fEL99UyV8cr7SGRY3c=; b=zN25aHG8qzPSs09dSEr9A7pFvBy5+CmvGFlDUD63Qlk+qZ3VvZ/JYNh7uuL+5p8sqn AiOztMvWh+6wybyfoLfxfDGbtoqmNXwGTW1ZFV32F2A1u1vKa9Gbnsd3pihRcKsPx8YA BM5UZ/sKRedMGj6xEVOitw5vTy2ISmXOuikQZWMLtggts0tek3Eotz46uA2w4G2B2qVu 0fkerOZo6LTB0parWWtUdue3veQNj+zAkFAxx9ipHHlSWf/i6Sd9NsldTkCql/MUNqvG IaI7Cq34xMK2d9E+l2xNUOVb+274mZXOn2v72+QZpy3WJMtewi7pmV0IJH++Dri1MnXm PyBw== 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; bh=2aWkMqo1r20Pi2OEYli1mBai8fEL99UyV8cr7SGRY3c=; b=FOxDMKq6sJL5iWm2bUF0/WRHfWQKvhKTrjJZoQZ+7RcNe6d9SqE0ewBSEvsZd2M9Mb tTLKwxRgPR5HT7wnceItHs64+E1YHvkmVVNiTcQuVbED1vdPQQWVEOsbnj3Glgcn9S1G ea80v+CK8DyhiK6flAUma/EsiGVD8YomZYBslm2iSPCY7bcFIgkfLtgE8uCAf0BTyoes ITnbF1e313V04addQv5S/BbmhlvuwEq0m6HY8KjT6g99nB7E0xiILf6pRHL1ua0O+Bwe lzg/pCFctNAGB989WCCJMggsPqU5NUyR8WQdEyGnAmZXZusni5mxE4GF6NaGtvE8GLo2 RbAg== X-Gm-Message-State: AOAM532vnQjmR4H5ETJH4HrbcVXX28hJknDlEPeTVhEeY9sSRda0SOSn S6f9VKjO7982a9e+wCSn91ClUbbzbX05cA== X-Google-Smtp-Source: ABdhPJwIi4Y4TVDsWiQmKBcEDrDuKDwKyaOlHLJTU6vKmxStBL5goBbGkw1OaZJqukxZtJLHDYJ+uA== X-Received: by 2002:a63:9d8d:: with SMTP id i135mr150846pgd.213.1604529243603; Wed, 04 Nov 2020 14:34:03 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id z10sm3284559pff.218.2020.11.04.14.34.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Nov 2020 14:34:03 -0800 (PST) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: Shannon Nelson Subject: [PATCH net-next 1/6] ionic: start queues before announcing link up Date: Wed, 4 Nov 2020 14:33:49 -0800 Message-Id: <20201104223354.63856-2-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201104223354.63856-1-snelson@pensando.io> References: <20201104223354.63856-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Change the order of operations in the link_up handling to be sure that the queues are up and ready before we announce that the link is up. Signed-off-by: Shannon Nelson --- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index a12df3946a07..5457fb5d69ed 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -123,6 +123,12 @@ static void ionic_link_status_check(struct ionic_lif *lif) link_up = link_status == IONIC_PORT_OPER_STATUS_UP; if (link_up) { + if (lif->netdev->flags & IFF_UP && netif_running(lif->netdev)) { + mutex_lock(&lif->queue_lock); + ionic_start_queues(lif); + mutex_unlock(&lif->queue_lock); + } + if (!netif_carrier_ok(netdev)) { u32 link_speed; @@ -132,12 +138,6 @@ static void ionic_link_status_check(struct ionic_lif *lif) link_speed / 1000); netif_carrier_on(netdev); } - - if (lif->netdev->flags & IFF_UP && netif_running(lif->netdev)) { - mutex_lock(&lif->queue_lock); - ionic_start_queues(lif); - mutex_unlock(&lif->queue_lock); - } } else { if (netif_carrier_ok(netdev)) { netdev_info(netdev, "Link down\n"); From patchwork Wed Nov 4 22:33:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 318446 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA1A3C388F7 for ; Wed, 4 Nov 2020 22:34:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 910372080D for ; Wed, 4 Nov 2020 22:34:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="neISJ2EC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732297AbgKDWeK (ORCPT ); Wed, 4 Nov 2020 17:34:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732162AbgKDWeH (ORCPT ); Wed, 4 Nov 2020 17:34:07 -0500 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65991C0613CF for ; Wed, 4 Nov 2020 14:34:07 -0800 (PST) Received: by mail-pf1-x429.google.com with SMTP id c20so18519503pfr.8 for ; Wed, 04 Nov 2020 14:34:07 -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; bh=T4Y3nDGLzMHA66yGPJNoaME43oRNIcZvy5J8hI+97Ds=; b=neISJ2ECmPxvt58psg1thJFFYJjoRLJojqw4u7m/OOkZndVJhwAVySxXoZ1DXnVqM9 0Cf+GQ75cRRmxBKbD0GEFPrA35oey/gW75voTaW9Dyy2utd1C69n6ak14UQQYKwGkVVx a5O8xvPdDwfEM2iE6idQeNyD2d3T+x+xLUg8jlI74KyW37yMDJ35ZElZYHE3OR+lFIMW 6IbWf3lZSOtYqBbxvoTITUP5yAi3l19aZAk+Krsi/E1rZDJABJOkBy2RdEi0FOIW5iLy Qvni+LOfEr1QD4OrcTxhIY4qK6vQe6ZRI9yU9fsdAcY+45b6DTNB2droPuRrbX0HJe6+ T+XA== 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; bh=T4Y3nDGLzMHA66yGPJNoaME43oRNIcZvy5J8hI+97Ds=; b=Lb5CtoQruvnENUisuvuAaOxo3qJuUwUswAKh1X1Ah14VT4+MDxuUkOw1yRq/296BCT pgiJvltIzFtOl6SWMR4FQiyvjcibCZHuGKOw/OEHw+CsNUO0z8VkXn1psFrcWgBevT0E gLQBR9uBK+KBXuSWi8Au+t19kyY0ZudltnotMSNkrDQCrZH5WzPUG4Eq9pOMAqENV0cb o9Afej5xvNwQIJVjc7jvwNrce9bgD26x5pApIR1VAIbkqX9+ILf66suJ0sB2Bq9KiBgC M4ibM0teWxCVdUKGbMduZPOj3KBGEkE6+hioJQj8r8uqasEv1LV2c4PNZ7d/MmeAmeoI bkKQ== X-Gm-Message-State: AOAM5332BQt+xUzRt1LKZ7/xZYaP1xl68bZ4cMY/dqO7BwnInWcBM8Pf vzRts46L4wSZ5hIrffUN9SHXtSgpmTXwsA== X-Google-Smtp-Source: ABdhPJzokIcjzJ2zSGjoPbLj3aDG4ktxvYauqdx3D7KVYf6Ma3rrP22KirJj8hYr/SoF0rUCF3fWbw== X-Received: by 2002:aa7:9f90:0:b029:164:bcf:de16 with SMTP id z16-20020aa79f900000b02901640bcfde16mr17605pfr.3.1604529246715; Wed, 04 Nov 2020 14:34:06 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id z10sm3284559pff.218.2020.11.04.14.34.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Nov 2020 14:34:06 -0800 (PST) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: Shannon Nelson Subject: [PATCH net-next 4/6] ionic: batch rx buffer refilling Date: Wed, 4 Nov 2020 14:33:52 -0800 Message-Id: <20201104223354.63856-5-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201104223354.63856-1-snelson@pensando.io> References: <20201104223354.63856-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We don't need to refill the rx descriptors on every napi if only a few were handled. Waiting until we can batch up a few together will save us a few Rx cycles. Signed-off-by: Shannon Nelson --- .../net/ethernet/pensando/ionic/ionic_dev.h | 4 +++- .../net/ethernet/pensando/ionic/ionic_txrx.c | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.h b/drivers/net/ethernet/pensando/ionic/ionic_dev.h index 6c243b17312c..9064222a087a 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.h @@ -12,8 +12,10 @@ #define IONIC_MAX_TX_DESC 8192 #define IONIC_MAX_RX_DESC 16384 -#define IONIC_MIN_TXRX_DESC 16 +#define IONIC_MIN_TXRX_DESC 64 #define IONIC_DEF_TXRX_DESC 4096 +#define IONIC_RX_FILL_THRESHOLD 64 +#define IONIC_RX_FILL_DIV 8 #define IONIC_LIFS_MAX 1024 #define IONIC_WATCHDOG_SECS 5 #define IONIC_ITR_COAL_USEC_DEFAULT 64 diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c index b3d2250c77d0..9156c9825a16 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c @@ -392,11 +392,6 @@ void ionic_rx_fill(struct ionic_queue *q) q->dbval | q->head_idx); } -static void ionic_rx_fill_cb(void *arg) -{ - ionic_rx_fill(arg); -} - void ionic_rx_empty(struct ionic_queue *q) { struct ionic_desc_info *desc_info; @@ -480,6 +475,7 @@ int ionic_rx_napi(struct napi_struct *napi, int budget) struct ionic_cq *cq = napi_to_cq(napi); struct ionic_dev *idev; struct ionic_lif *lif; + u16 rx_fill_threshold; u32 work_done = 0; u32 flags = 0; @@ -489,7 +485,9 @@ int ionic_rx_napi(struct napi_struct *napi, int budget) work_done = ionic_cq_service(cq, budget, ionic_rx_service, NULL, NULL); - if (work_done) + rx_fill_threshold = min_t(u16, IONIC_RX_FILL_THRESHOLD, + cq->num_descs / IONIC_RX_FILL_DIV); + if (work_done && ionic_q_space_avail(cq->bound_q) >= rx_fill_threshold) ionic_rx_fill(cq->bound_q); if (work_done < budget && napi_complete_done(napi, work_done)) { @@ -518,6 +516,7 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget) struct ionic_dev *idev; struct ionic_lif *lif; struct ionic_cq *txcq; + u16 rx_fill_threshold; u32 rx_work_done = 0; u32 tx_work_done = 0; u32 flags = 0; @@ -531,8 +530,11 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget) rx_work_done = ionic_cq_service(rxcq, budget, ionic_rx_service, NULL, NULL); - if (rx_work_done) - ionic_rx_fill_cb(rxcq->bound_q); + + rx_fill_threshold = min_t(u16, IONIC_RX_FILL_THRESHOLD, + rxcq->num_descs / IONIC_RX_FILL_DIV); + if (rx_work_done && ionic_q_space_avail(rxcq->bound_q) >= rx_fill_threshold) + ionic_rx_fill(rxcq->bound_q); if (rx_work_done < budget && napi_complete_done(napi, rx_work_done)) { ionic_dim_update(qcq); From patchwork Wed Nov 4 22:33:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 318445 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 017CFC4741F for ; Wed, 4 Nov 2020 22:34:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A713E2080D for ; Wed, 4 Nov 2020 22:34:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="fVSxzvQf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732449AbgKDWeO (ORCPT ); Wed, 4 Nov 2020 17:34:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732250AbgKDWeK (ORCPT ); Wed, 4 Nov 2020 17:34:10 -0500 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0241AC0613CF for ; Wed, 4 Nov 2020 14:34:10 -0800 (PST) Received: by mail-pg1-x52e.google.com with SMTP id t14so88235pgg.1 for ; Wed, 04 Nov 2020 14:34:09 -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; bh=nGSoe4Dy6+c/A+ugpSKq4ECZ+0Rs3hgJNVkOfrFbJs8=; b=fVSxzvQf4JQWN49jxW1tYgeqKxrJZDrwhHs0vzdOauWzj69O9e7X+BYAHaQ8YGWg7d y6tKlApCW3eIbeBYd8Tq+duIrVK8z7FUgb8S/ChxdjewNStXMHXf+ZItyvWvYXW9STu8 PyL3uPcYntjFpD9NImPAk5E6uU9DLsx7pljihuBpmiD5ygVK94A4Ttf4qzyFJ4t/M5BM 1zEvpW0H/gn6WJBG/7qlHoQY9pjy2m/JMSMLYui+P/o5GstFO6QuSMkamx7MFv/LyvFn tL+7HJfMNilhlaWI0P/IrksFRQuSZ8QPGUVvfWnuZWSvmdBsq6IRX9Q8fFjnJvJELH0c pxog== 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; bh=nGSoe4Dy6+c/A+ugpSKq4ECZ+0Rs3hgJNVkOfrFbJs8=; b=uGZPpG20qZvUY8MfvxamdqqI1nf6ixi63wWr0mnZBYAZUCvrr4Aszv1hGxQqM2OJ+x mwh7xae2MYYeaol0q6WGHLxSJVUo8fHvlZpbeYqAg8cEX4S0ahPfKSvrhmtPBS99eAG0 JFs2PQo/Eh+JDhGasqQSm8jo59rCnanyuohE5Aa2ulG6UM8q7NmhLhNKJyYZSgrvRRnN LryPgJJ0XkujMATbJ4wEu6IQRjw3x3E1M7K9h6s1QNmaF4fp+Kf2+qkwpTAvEU376ZfZ NsyFFGP5+U89T7A/GUzTCCswOOe8akO8gZB5960/67JvFH1b6B+sr/wZhQHPI/s483mP A1Tw== X-Gm-Message-State: AOAM530PF9SDwFEA/3nzKG/Q5IXsEco2bp0VWdV4F8MKOjZAJuT0G1we 47cEYLIawDsP/7DOjQG791QcPPF7qpr+zA== X-Google-Smtp-Source: ABdhPJzkjznxtnBPi37fFauLfe7YVTZTE/UdRgJYEsb6B/JLscIZgkh1Ly9ATBAXPDerVz73rNac5Q== X-Received: by 2002:a17:90a:8b93:: with SMTP id z19mr75142pjn.123.1604529249341; Wed, 04 Nov 2020 14:34:09 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id z10sm3284559pff.218.2020.11.04.14.34.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Nov 2020 14:34:08 -0800 (PST) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: Shannon Nelson Subject: [PATCH net-next 6/6] ionic: useful names for booleans Date: Wed, 4 Nov 2020 14:33:54 -0800 Message-Id: <20201104223354.63856-7-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201104223354.63856-1-snelson@pensando.io> References: <20201104223354.63856-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org With a few more uses of true and false in function calls, we need to give them some useful names so we can tell from the calling point what we're doing. Signed-off-by: Shannon Nelson --- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 16 ++++++++-------- drivers/net/ethernet/pensando/ionic/ionic_lif.h | 8 ++++++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index a58bb572b23b..a0d2989a0d8d 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -1074,22 +1074,22 @@ static int ionic_lif_addr(struct ionic_lif *lif, const u8 *addr, bool add, static int ionic_addr_add(struct net_device *netdev, const u8 *addr) { - return ionic_lif_addr(netdev_priv(netdev), addr, true, true); + return ionic_lif_addr(netdev_priv(netdev), addr, ADD_ADDR, CAN_SLEEP); } static int ionic_ndo_addr_add(struct net_device *netdev, const u8 *addr) { - return ionic_lif_addr(netdev_priv(netdev), addr, true, false); + return ionic_lif_addr(netdev_priv(netdev), addr, ADD_ADDR, CAN_NOT_SLEEP); } static int ionic_addr_del(struct net_device *netdev, const u8 *addr) { - return ionic_lif_addr(netdev_priv(netdev), addr, false, true); + return ionic_lif_addr(netdev_priv(netdev), addr, DEL_ADDR, CAN_SLEEP); } static int ionic_ndo_addr_del(struct net_device *netdev, const u8 *addr) { - return ionic_lif_addr(netdev_priv(netdev), addr, false, false); + return ionic_lif_addr(netdev_priv(netdev), addr, DEL_ADDR, CAN_NOT_SLEEP); } static void ionic_lif_rx_mode(struct ionic_lif *lif, unsigned int rx_mode) @@ -1214,7 +1214,7 @@ static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo) static void ionic_ndo_set_rx_mode(struct net_device *netdev) { - ionic_set_rx_mode(netdev, true); + ionic_set_rx_mode(netdev, FROM_NDO); } static __le64 ionic_netdev_features_to_nic(netdev_features_t features) @@ -1805,7 +1805,7 @@ static int ionic_txrx_init(struct ionic_lif *lif) if (lif->netdev->features & NETIF_F_RXHASH) ionic_lif_rss_init(lif); - ionic_set_rx_mode(lif->netdev, false); + ionic_set_rx_mode(lif->netdev, NOT_FROM_NDO); return 0; @@ -2813,7 +2813,7 @@ static int ionic_station_set(struct ionic_lif *lif) */ if (!ether_addr_equal(ctx.comp.lif_getattr.mac, netdev->dev_addr)) - ionic_lif_addr(lif, netdev->dev_addr, true, true); + ionic_lif_addr(lif, netdev->dev_addr, ADD_ADDR, CAN_SLEEP); } else { /* Update the netdev mac with the device's mac */ memcpy(addr.sa_data, ctx.comp.lif_getattr.mac, netdev->addr_len); @@ -2830,7 +2830,7 @@ static int ionic_station_set(struct ionic_lif *lif) netdev_dbg(lif->netdev, "adding station MAC addr %pM\n", netdev->dev_addr); - ionic_lif_addr(lif, netdev->dev_addr, true, true); + ionic_lif_addr(lif, netdev->dev_addr, ADD_ADDR, CAN_SLEEP); return 0; } diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.h b/drivers/net/ethernet/pensando/ionic/ionic_lif.h index 0224dfd24b8a..493de679b498 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.h @@ -13,6 +13,14 @@ #define IONIC_MAX_NUM_NAPI_CNTR (NAPI_POLL_WEIGHT + 1) #define IONIC_MAX_NUM_SG_CNTR (IONIC_TX_MAX_SG_ELEMS + 1) + +#define ADD_ADDR true +#define DEL_ADDR false +#define CAN_SLEEP true +#define CAN_NOT_SLEEP false +#define FROM_NDO true +#define NOT_FROM_NDO false + #define IONIC_RX_COPYBREAK_DEFAULT 256 #define IONIC_TX_BUDGET_DEFAULT 256