From patchwork Thu Nov 12 18:22:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 11900989 X-Patchwork-Delegate: kuba@kernel.org 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 EBCEBC55ABD for ; Thu, 12 Nov 2020 18:22:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 971B221D91 for ; Thu, 12 Nov 2020 18:22:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="zl90gMj8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726547AbgKLSWU (ORCPT ); Thu, 12 Nov 2020 13:22:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726477AbgKLSWS (ORCPT ); Thu, 12 Nov 2020 13:22:18 -0500 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AD42C0613D1 for ; Thu, 12 Nov 2020 10:22:18 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id b63so1696192pfg.12 for ; Thu, 12 Nov 2020 10:22:18 -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=0uFKKPP21W4f38gGzSvB1Dje7yKdzrgayh7PC7t67mk=; b=zl90gMj8S76LJMqIM5zXWFlHGPpQ4FPKnPyHPlSAxOsBZAuzEZXqurXWEXrN0ER/xD 8FusUTUzhlD3aZ1xy9JGZjIyGpS9ElUtkNlD66+dkYUaNqWf5gygsg5HgEkDFXJI/cGU 9rKkrHUc6+X3UbIRY2sM5doWgaw6mFlXrkha52KjsnFSHgvqOmZsUBMCiq99eNFFf3Mf P36tniXYb0teJg96jtiOGQa6tc0ZJRdetrSe7Kv+oz8Yn/uftGnzND5hNeHdvxJp5k5l ENxcG22NN3+42dg/b+b9Wwn9kKDcq5lOdVrua1/0fDXJxZy7sr+6U6MGWpF7sYEhnX4P WxXw== 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=0uFKKPP21W4f38gGzSvB1Dje7yKdzrgayh7PC7t67mk=; b=Ya8qgqAo8Y6J6ggj+CV9heU03t6fvj4mpBMS015RGpiqF84RNCxFLXagkzPaoAGJJz Sua4QVx0HLEtvr2lVUQ9tqU5ivj49By2zQ1H/LUs8wBCJk0Zvl/UiUPv3rKKjHq+zyWX 4PEhffJ/4/ZYtZlZyNlmomMORcaVrHICy3OtIY1YALgXZ1900vhkipUy5eqDCmGZw8Tv +ooRxDStO/Avav+UU4OEiMRJnTrNrhCnsfjpRAjgqgtF6wkXELaU4SeDHIT5Go5rOGmR wN8ld8LUrT517LfGAImw7ZgczO0AnA4nS6f7sREdj8o6p76XzspeKIGO3TQLQYL928bW 7fng== X-Gm-Message-State: AOAM531I4YmLkCCuBKal81bsXxTmqYFBHjVaGi1tibMbIT7IZjMAj4eV MjYHAEjyGIS7rGC5VIZ4tsTNLwA1nsqmxw== X-Google-Smtp-Source: ABdhPJxVFgs0DoUweQfwV4OidhYjxjZIvqBNTlhsM3we2iA3qkY0cY7fyNWX9XhGYOqstAiwUJC+3A== X-Received: by 2002:a62:f94d:0:b029:15c:f1a3:cd47 with SMTP id g13-20020a62f94d0000b029015cf1a3cd47mr657160pfm.81.1605205337462; Thu, 12 Nov 2020 10:22:17 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id m6sm7152292pfa.61.2020.11.12.10.22.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Nov 2020 10:22:17 -0800 (PST) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: Shannon Nelson Subject: [PATCH v3 net-next 1/8] ionic: start queues before announcing link up Date: Thu, 12 Nov 2020 10:22:01 -0800 Message-Id: <20201112182208.46770-2-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201112182208.46770-1-snelson@pensando.io> References: <20201112182208.46770-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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 Reviewed-by: Saeed Mahameed --- 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 Thu Nov 12 18:22:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 11900987 X-Patchwork-Delegate: kuba@kernel.org 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 74489C5519F for ; Thu, 12 Nov 2020 18:22:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1AADF22201 for ; Thu, 12 Nov 2020 18:22:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="nZrkxE3i" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726300AbgKLSWV (ORCPT ); Thu, 12 Nov 2020 13:22:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726478AbgKLSWT (ORCPT ); Thu, 12 Nov 2020 13:22:19 -0500 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 388E6C0613D1 for ; Thu, 12 Nov 2020 10:22:19 -0800 (PST) Received: by mail-pg1-x544.google.com with SMTP id f18so4874383pgi.8 for ; Thu, 12 Nov 2020 10:22:19 -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=CeSP90eT2JE1bNP53L/Gh+KbyGKotvj69qXfEA8YCFQ=; b=nZrkxE3iSZ4VdI1F8ot81coz1JGoT2Ak4hZaGad0EV23V4Dv/K9QCshyhgtdkRiTGX IR/GmD5Pb80BSJDyD7cFgcG6lR+maj9RxD/RH7ZBG/4r5XqbQw2VSBRGzbdpuhT27OoA WMhagai8Rx+9bVAemHMREr7jf3YjygnnKlwr6Pjdr7sR/2U9pZCTiLG/XGD7/J5u+Zh/ obs22LIqdi2Bwfl4lis61nNJ9TBZ9sRtTbgofUAOUl6W2gzGByIbeTnQ1hRh5u+pJQ8I f2KN4lbg+Oyw4YHpkI0l26BuJVdKfwerKshvKCqoim678iNPC2iS+NLDaHyaJh0mN3Jb UpKA== 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=CeSP90eT2JE1bNP53L/Gh+KbyGKotvj69qXfEA8YCFQ=; b=eZvlpRu40NPTcqGfnwTZ6fT1Rezl9xvQ6PCyj7bMIVv5nZWo+pTBMoMt6mTbyhuMUZ IyO/bQ43775LGNP/17IK0it5pXUTKRWPDcZJZGig9LRo+CxFTTrCqV6h0yyCRVpjij+x sODLjSazGMKW4Rav9sUxvMxR0xOuJe5jProsvGyTCOffB4kHWU4XuQi52ocXyp5qv3tb VYfbL94fHH5Yx0bHTmGGbU73JEqtmHWVp/qDtiUT8X+xMaG2G/035YACxomFv6cuwvz4 EessZSD24M1e86MhurZxggROGu43pqE8lISyrIUvQHw+APQ4aE18CKJj9w0+N3pUuGT8 uYGw== X-Gm-Message-State: AOAM530SOnVMlZ13oyYllYkxtKtOTmje/kyVZop7jrPHrjybTQlP9Zcm FMyOwPvUGYeyo45r6AL9bFSX0i4tsb2qQA== X-Google-Smtp-Source: ABdhPJx260zRvT7QTbY7Jxo8JuVOlyFlrc6cvbEaTDZSFOCTqQyHfaVA+RHGEUunqcdwcyfHQ2eZHQ== X-Received: by 2002:a63:4247:: with SMTP id p68mr641936pga.338.1605205338549; Thu, 12 Nov 2020 10:22:18 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id m6sm7152292pfa.61.2020.11.12.10.22.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Nov 2020 10:22:18 -0800 (PST) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: Shannon Nelson Subject: [PATCH v3 net-next 2/8] ionic: check for link after netdev registration Date: Thu, 12 Nov 2020 10:22:02 -0800 Message-Id: <20201112182208.46770-3-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201112182208.46770-1-snelson@pensando.io> References: <20201112182208.46770-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Request a link check as soon as the netdev is registered rather than waiting for the watchdog to go off in order to get the interface operational a little more quickly. Signed-off-by: Shannon Nelson Reviewed-by: Saeed Mahameed --- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 5457fb5d69ed..519d544821af 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -2959,6 +2959,8 @@ int ionic_lif_register(struct ionic_lif *lif) dev_err(lif->ionic->dev, "Cannot register net device, aborting\n"); return err; } + + ionic_link_status_check_request(lif, true); lif->registered = true; ionic_lif_set_netdev_info(lif); From patchwork Thu Nov 12 18:22:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 11900973 X-Patchwork-Delegate: kuba@kernel.org 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 20568C5519F for ; Thu, 12 Nov 2020 18:22:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD8582223C for ; Thu, 12 Nov 2020 18:22:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="PXQH0flD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726578AbgKLSWV (ORCPT ); Thu, 12 Nov 2020 13:22:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726554AbgKLSWU (ORCPT ); Thu, 12 Nov 2020 13:22:20 -0500 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF778C0613D1 for ; Thu, 12 Nov 2020 10:22:20 -0800 (PST) Received: by mail-pg1-x543.google.com with SMTP id f18so4874447pgi.8 for ; Thu, 12 Nov 2020 10:22:20 -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=SIWQj6ZMSR+KKITnxdKuhNmX5pr7EdvD4xOgq62BLCI=; b=PXQH0flDoNeSUtOvSGz0mnYsTuSnUymCDkhWGJRiwzcBbcNhufX5ehWhrLD3w+iXrb uK7vp7Px9l8vHBxIltyo+y7nYcS79izyKFSjMPiCYg/9DrC/AQ9uhmlPn5mZIhoGT568 NYjqEsKSN26b4Wtr4W5i5RV54xLq9+W2PqhrZ3LSOaPrlC0dFQwzI3zoILyd9590R+fa qUw7J/0HtP9yqU3o6hFSeEBtQ6X7uZWnQ26FhP4I2fX9CQukog+EsQNE6MDPfBbVH8+X 6Pc0P5VEsiaLS1OyECmGwI1z5kg6AB/0aE+W49SgvMb31FTqiWbs3IQSZXv7N+ac+sjS 6lcw== 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=SIWQj6ZMSR+KKITnxdKuhNmX5pr7EdvD4xOgq62BLCI=; b=siIqE9H5u8zSqy4J0rXIjuEmQc04KlYDiOstFTSRD4gr8d5EASBWf437xsXajOJDWy 1BeLJnlpYLGYcWHh217rPe2VlKz97QfNF8zezxLyxaAwGIgY0BWyG5+Tpabc1HnF7W+T zuHGjw7rk1ls83u6ld9bumuJVbLKlM4NYR3bCsZeFnlkuD3GVmu+T7dkrbUmDErXYawN op6MZNUGez6AzZj6FgBlPc6zBWy9DyewFW+RP0Nsz4xH7fV0W1b7/nyMq17MFWJgCnyU 9OmbquS+lHgCXeHJh1XsqzLiVF4v9dN6M59Hk+bWm/DwbJNLQyEm+WJPBWw9y3ufYYOO Px5w== X-Gm-Message-State: AOAM532b5Od82ZOu55PtsU7asITrhciZqwrCcgtQDueMbHNeQlwJFzGO 8M39gXxQ10zls4wgbjnSezpA8iTY8ihDvg== X-Google-Smtp-Source: ABdhPJxZ/YP30UxCNrVpVtlp7GV01WMuxxHZJpaKR7Ixf1VQqjnf3OICtbcvF/bNsTK1bslM1a4lyA== X-Received: by 2002:a62:254:0:b029:18b:fcea:8b7c with SMTP id 81-20020a6202540000b029018bfcea8b7cmr663319pfc.69.1605205340009; Thu, 12 Nov 2020 10:22:20 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id m6sm7152292pfa.61.2020.11.12.10.22.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Nov 2020 10:22:19 -0800 (PST) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: Shannon Nelson Subject: [PATCH v3 net-next 3/8] ionic: add lif quiesce Date: Thu, 12 Nov 2020 10:22:03 -0800 Message-Id: <20201112182208.46770-4-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201112182208.46770-1-snelson@pensando.io> References: <20201112182208.46770-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org After the queues are stopped, expressly quiesce the lif. This assures that even if the queues were in an odd state, the firmware will close up everything cleanly. Signed-off-by: Shannon Nelson Reviewed-by: Saeed Mahameed --- .../net/ethernet/pensando/ionic/ionic_lif.c | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 519d544821af..e5ed8231317a 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -1625,6 +1625,24 @@ static void ionic_lif_rss_deinit(struct ionic_lif *lif) ionic_lif_rss_config(lif, 0x0, NULL, NULL); } +static void ionic_lif_quiesce(struct ionic_lif *lif) +{ + struct ionic_admin_ctx ctx = { + .work = COMPLETION_INITIALIZER_ONSTACK(ctx.work), + .cmd.lif_setattr = { + .opcode = IONIC_CMD_LIF_SETATTR, + .index = cpu_to_le16(lif->index), + .attr = IONIC_LIF_ATTR_STATE, + .state = IONIC_LIF_QUIESCE, + }, + }; + int err; + + err = ionic_adminq_post_wait(lif, &ctx); + if (err) + netdev_err(lif->netdev, "lif quiesce failed %d\n", err); +} + static void ionic_txrx_disable(struct ionic_lif *lif) { unsigned int i; @@ -1639,6 +1657,8 @@ static void ionic_txrx_disable(struct ionic_lif *lif) for (i = 0; i < lif->nxqs; i++) err = ionic_qcq_disable(lif->rxqcqs[i], (err != -ETIMEDOUT)); } + + ionic_lif_quiesce(lif); } static void ionic_txrx_deinit(struct ionic_lif *lif) From patchwork Thu Nov 12 18:22:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 11900975 X-Patchwork-Delegate: kuba@kernel.org 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 2FEFFC2D0E4 for ; Thu, 12 Nov 2020 18:22:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C7D8D2222F for ; Thu, 12 Nov 2020 18:22:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="o3pzVPKW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726584AbgKLSWZ (ORCPT ); Thu, 12 Nov 2020 13:22:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726573AbgKLSWV (ORCPT ); Thu, 12 Nov 2020 13:22:21 -0500 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8C6DC0613D1 for ; Thu, 12 Nov 2020 10:22:21 -0800 (PST) Received: by mail-pf1-x42c.google.com with SMTP id y7so5280687pfq.11 for ; Thu, 12 Nov 2020 10:22:21 -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=hr6aj6JtxGducKoxvMPXrY7OCt+4LEbjDkNLR4EhT44=; b=o3pzVPKWpsml5L5vhv35FBu2gb87nep/gJOBHOmE2c+KlITQzAhRKF+mizncCcdYkd z2fj55AV4XwM695Ch9E6XGPPRZkrJfC6g/npagzUyyDehgEYToX80Jg0phfuansxprJO GGr6dIdopVhAh2MYDZTUY3h4ndy5D9zC2rQyimgyf+0c7qjsKdlQevNFCk2sYMafZUrV VBY2l3R2Hs10FA/j9VNqSrJWujtx45D+RNfQPdaLZ0mF/mtcmB2Zoo7teRpPb7Tu1X5o PIM36LU+XgDA94wEi+r2S/S6UDs9RcJQSPYTwwexsrlePvDt9obKH63u10xjAlPkU6S+ ZBMg== 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=hr6aj6JtxGducKoxvMPXrY7OCt+4LEbjDkNLR4EhT44=; b=WTEi0akPY+C7PFKL/6dnu1ur+8pQIYz5yMLTTTWobSaUrvGKSV7L7TKg/IVUwYEXXO 5JMHkxB4HSVg2xmOmd1e3oAgirlDnmYDI/f+1jtOneGOzZU7sJZtRrGLHnvDNXnw+j9P ArUQYiXsXLDzknueRe59QUQav3cGk5oyppcD44xhPC33Botd/omzuWEj72YUlwiYkGv6 4KFjpU1ij+l00BrAxv727qzDs4zuGGiV97rVHSUaI1TIJaEeGxY7wkwV0S7dVsAW3vyi Xpq25oZb+CGdtONlHlQRTKn9lKggO6WaxAd7mrpPV9PcE+iRFhFtgTBx6jEj5BkQuade G4tg== X-Gm-Message-State: AOAM533WzRDZJGDY/bHgFH59ybqSHGzPCjmuXj+F2YrvDhjkqTjDLFbK /kCooEqc2DbvTtXc70F3u8SvAEZx5OoYDQ== X-Google-Smtp-Source: ABdhPJxa5h+8z9qX1Ccq6CoaiI+jr2rpxuFPk5itrb1oC2ptB69duV1U9yIVIX4bPj9BcttXMgJDVw== X-Received: by 2002:a62:804d:0:b029:18b:9bf:2979 with SMTP id j74-20020a62804d0000b029018b09bf2979mr534793pfd.11.1605205341110; Thu, 12 Nov 2020 10:22:21 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id m6sm7152292pfa.61.2020.11.12.10.22.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Nov 2020 10:22:20 -0800 (PST) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: Shannon Nelson Subject: [PATCH v3 net-next 4/8] ionic: batch rx buffer refilling Date: Thu, 12 Nov 2020 10:22:04 -0800 Message-Id: <20201112182208.46770-5-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201112182208.46770-1-snelson@pensando.io> References: <20201112182208.46770-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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 Reviewed-by: Saeed Mahameed --- .../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..690768ff0143 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 16 +#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 Thu Nov 12 18:22:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 11900981 X-Patchwork-Delegate: kuba@kernel.org 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 A0788C5519F for ; Thu, 12 Nov 2020 18:22:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4A4D022201 for ; Thu, 12 Nov 2020 18:22:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="WYs16sjE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726612AbgKLSW0 (ORCPT ); Thu, 12 Nov 2020 13:22:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726554AbgKLSWW (ORCPT ); Thu, 12 Nov 2020 13:22:22 -0500 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8E9AC0613D1 for ; Thu, 12 Nov 2020 10:22:22 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id w6so5338455pfu.1 for ; Thu, 12 Nov 2020 10:22:22 -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=ThuSp1nWjUdZnFZrlwwu4dXM5FADWV5pVgbm5tfIdyk=; b=WYs16sjEE4omgATI/7uob/4Y20BE4qbGZQhvqkGtLoUtMKTI8z3CTa8HwGZ6dRO0VP S2tSp3k4J5LLm8oj1V7QYfZbmMQk2jJbFR7SrH6ZILLgMIbcf9L6/IfF285xk8bmiZ9h JRDlmIWoZzVnGD1RIXsCHUTAShj81E/08yn+VDKjGjmAm1u3AGgDVOsEiFamH2HyAr6z LCndHneLOcCcLJAu8byHxi3SRg9m4c8H/TIBcR/XQVvTlRfGkWCeECx16ls2xK21FBUI bhIrNq+KBXjmkPoy8+wozThCDBlq9xQnAfcujGhmwolRs9DTInrG2Vyx9f6s6zLknXFU 6Gew== 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=ThuSp1nWjUdZnFZrlwwu4dXM5FADWV5pVgbm5tfIdyk=; b=sib9zkAPiVx9I53yvf1eA/JY9AarWLVlu/9++gAZGoqrCkMIef2W3jtqos3B8xzVC/ fF6UraF4JW7vWefy+RSSLiMCi27SLWmyFqtZb4P6gCe6JbPTzUVQvsDFiPp6Ve3YC8Ql kCo0aXYQ7rMFDihZDHHyQ5RPc6+8YVl/8PAqrTWuhcai1b2R2OAUF96cuSos87HLvdYr +V+nmv6cOhxq3EBtaI1p9CsMHs6ysJbLrfyFFE86CpFavvPy+m8v/JgNYTUeao9WA3MA C6zVR9GkxggA31bdp0I65OyEzBIO+Sy1VYzwMwYjHOo4kyNYmmSgnOPjOo2dHva3Fcia IvKg== X-Gm-Message-State: AOAM530n2xehD3EryDnOSiOERb2yFEY7F4WGPfPYOwscVXqn6JrWs8ja FB+kLpCasgjxHgDLqCMtIUxRSooNAu3urw== X-Google-Smtp-Source: ABdhPJxwZwZEsvXZFr0r4k484CEAnPxhgYYSBiODiNM/04wDyosQkL+cQgcAF2HIgbcgSZjG8I59OA== X-Received: by 2002:a65:4b8e:: with SMTP id t14mr591830pgq.99.1605205342139; Thu, 12 Nov 2020 10:22:22 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id m6sm7152292pfa.61.2020.11.12.10.22.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Nov 2020 10:22:21 -0800 (PST) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: Shannon Nelson Subject: [PATCH v3 net-next 5/8] ionic: use mc sync for multicast filters Date: Thu, 12 Nov 2020 10:22:05 -0800 Message-Id: <20201112182208.46770-6-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201112182208.46770-1-snelson@pensando.io> References: <20201112182208.46770-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org We should be using the multicast sync routines for the multicast filters. Also, let's just flatten the logic a bit and pull the small unicast routine back into ionic_set_rx_mode(). Fixes: 1800eee16676 ("net: ionic: Replace in_interrupt() usage.") Signed-off-by: Shannon Nelson Reviewed-by: Saeed Mahameed --- .../net/ethernet/pensando/ionic/ionic_lif.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index e5ed8231317a..13c7ac904611 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -1149,15 +1149,6 @@ static void _ionic_lif_rx_mode(struct ionic_lif *lif, unsigned int rx_mode, } } -static void ionic_dev_uc_sync(struct net_device *netdev, bool from_ndo) -{ - if (from_ndo) - __dev_uc_sync(netdev, ionic_ndo_addr_add, ionic_ndo_addr_del); - else - __dev_uc_sync(netdev, ionic_addr_add, ionic_addr_del); - -} - static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo) { struct ionic_lif *lif = netdev_priv(netdev); @@ -1177,7 +1168,10 @@ static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo) * we remove our overflow flag and check the netdev flags * to see if we can disable NIC PROMISC */ - ionic_dev_uc_sync(netdev, from_ndo); + if (from_ndo) + __dev_uc_sync(netdev, ionic_ndo_addr_add, ionic_ndo_addr_del); + else + __dev_uc_sync(netdev, ionic_addr_add, ionic_addr_del); nfilters = le32_to_cpu(lif->identity->eth.max_ucast_filters); if (netdev_uc_count(netdev) + 1 > nfilters) { rx_mode |= IONIC_RX_MODE_F_PROMISC; @@ -1189,7 +1183,10 @@ static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo) } /* same for multicast */ - ionic_dev_uc_sync(netdev, from_ndo); + if (from_ndo) + __dev_mc_sync(netdev, ionic_ndo_addr_add, ionic_ndo_addr_del); + else + __dev_mc_sync(netdev, ionic_addr_add, ionic_addr_del); nfilters = le32_to_cpu(lif->identity->eth.max_mcast_filters); if (netdev_mc_count(netdev) > nfilters) { rx_mode |= IONIC_RX_MODE_F_ALLMULTI; From patchwork Thu Nov 12 18:22:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 11900983 X-Patchwork-Delegate: kuba@kernel.org 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 93A93C2D0E4 for ; Thu, 12 Nov 2020 18:22:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 37E6522201 for ; Thu, 12 Nov 2020 18:22:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="aWG4VCwv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726514AbgKLSWc (ORCPT ); Thu, 12 Nov 2020 13:22:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726583AbgKLSWY (ORCPT ); Thu, 12 Nov 2020 13:22:24 -0500 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D362CC0613D6 for ; Thu, 12 Nov 2020 10:22:23 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id a18so5318276pfl.3 for ; Thu, 12 Nov 2020 10:22:23 -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=MeBoxtiy7UQQAtKqXbJb0p281xYuzD0efEauVvi9iEw=; b=aWG4VCwv/7lKtHb3lkplRHzJ8e3uISL+ESOfryNjBVlgAcHsSrnxFjxpwWgiDJugor /UZB1wjcgCDmMANGJKb6VKaaFUg8nkeF0KBRMPa8WnM7e9Ny0UGJMVOhrrPeE0L+SGsK IyDqXcMbOCs1/uo1tfR/AvmFpLXWPlX2ahdRE++jbaAgTyW0VDNg733lu6mQdhwKBMd7 7ZNqEJxZJxnXfhmEX1nrWAiNZ7krdG9BA8SSZVj6RuFS+avC2QNLw4pdG6rbiHGrtSQs 0NpVEmH7UMpH803q76LKoEzv092kQvlFOK31GSt51o3EkQRuTqklJZQSvIOrxccO6t4G /88Q== 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=MeBoxtiy7UQQAtKqXbJb0p281xYuzD0efEauVvi9iEw=; b=GU2BzRc/KOTb0h1DA/xXn8BjeX5p4Tp7bYjAhZwsY0XtfZN4WAsg1sLOFn+1gW+uS0 tTGsc3I3Dj7XkwA6A2TjoaLyDEYOYHT0X6/hk9wLwdC+D4vmBPG7+rKfRMK3OLmWsTwp 0FWbjb1+N70utdJKakVJXxTzhD1WA8sA6Bj9zukp7qeMMRFNQOcWx2KhEtGbNXoWmpiz R9Eyq5SEHaKHHwRf2GgV17yhBMCR+HI6eNI0BL00v/QrLq/6tUshSiCZaM9L2JVAve/e uL41AzUuQ2CbGR0KGbq7THHHW7kmbqhkFLIF50M4JIYG7OfAXFJ/7kzhwTpMTP+0yqUk 2bVA== X-Gm-Message-State: AOAM531HaHrW5uFXJ1ADGBBvaYHsin8pefiELMpzF0S68e/GbCTx5OVN ZE0cL/pOnAKcSl25k7mkn6ne6w5ET4QlDA== X-Google-Smtp-Source: ABdhPJwGUETmeBtKzzmtr7vYU3lEouyxrgFbMbem/+EdrQbCEPciNl/mfhLVF+IqCki9BhAMU/lUHg== X-Received: by 2002:a63:4f26:: with SMTP id d38mr671738pgb.220.1605205343187; Thu, 12 Nov 2020 10:22:23 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id m6sm7152292pfa.61.2020.11.12.10.22.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Nov 2020 10:22:22 -0800 (PST) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: Shannon Nelson Subject: [PATCH v3 net-next 6/8] ionic: flatten calls to ionic_lif_rx_mode Date: Thu, 12 Nov 2020 10:22:06 -0800 Message-Id: <20201112182208.46770-7-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201112182208.46770-1-snelson@pensando.io> References: <20201112182208.46770-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The _ionic_lif_rx_mode() is only used once and really doesn't need to be broken out. Signed-off-by: Shannon Nelson Reviewed-by: Saeed Mahameed --- .../net/ethernet/pensando/ionic/ionic_lif.c | 38 ++++++++----------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 13c7ac904611..58bf6e9314bb 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -1129,29 +1129,10 @@ static void ionic_lif_rx_mode(struct ionic_lif *lif, unsigned int rx_mode) lif->rx_mode = rx_mode; } -static void _ionic_lif_rx_mode(struct ionic_lif *lif, unsigned int rx_mode, - bool from_ndo) -{ - struct ionic_deferred_work *work; - - if (from_ndo) { - work = kzalloc(sizeof(*work), GFP_ATOMIC); - if (!work) { - netdev_err(lif->netdev, "%s OOM\n", __func__); - return; - } - work->type = IONIC_DW_TYPE_RX_MODE; - work->rx_mode = rx_mode; - netdev_dbg(lif->netdev, "deferred: rx_mode\n"); - ionic_lif_deferred_enqueue(&lif->deferred, work); - } else { - ionic_lif_rx_mode(lif, rx_mode); - } -} - static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo) { struct ionic_lif *lif = netdev_priv(netdev); + struct ionic_deferred_work *work; unsigned int nfilters; unsigned int rx_mode; @@ -1197,8 +1178,21 @@ static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo) rx_mode &= ~IONIC_RX_MODE_F_ALLMULTI; } - if (lif->rx_mode != rx_mode) - _ionic_lif_rx_mode(lif, rx_mode, from_ndo); + if (lif->rx_mode != rx_mode) { + if (from_ndo) { + work = kzalloc(sizeof(*work), GFP_ATOMIC); + if (!work) { + netdev_err(lif->netdev, "%s OOM\n", __func__); + return; + } + work->type = IONIC_DW_TYPE_RX_MODE; + work->rx_mode = rx_mode; + netdev_dbg(lif->netdev, "deferred: rx_mode\n"); + ionic_lif_deferred_enqueue(&lif->deferred, work); + } else { + ionic_lif_rx_mode(lif, rx_mode); + } + } } static void ionic_ndo_set_rx_mode(struct net_device *netdev) From patchwork Thu Nov 12 18:22:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 11900979 X-Patchwork-Delegate: kuba@kernel.org 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 4C6F8C55ABD for ; Thu, 12 Nov 2020 18:22:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DF8BD22201 for ; Thu, 12 Nov 2020 18:22:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="k+kV09aO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726630AbgKLSWa (ORCPT ); Thu, 12 Nov 2020 13:22:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726591AbgKLSWZ (ORCPT ); Thu, 12 Nov 2020 13:22:25 -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 0A8B0C0617A6 for ; Thu, 12 Nov 2020 10:22:25 -0800 (PST) Received: by mail-pg1-x542.google.com with SMTP id f18so4874609pgi.8 for ; Thu, 12 Nov 2020 10:22:25 -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=PgdpGctimavYrhF92nrivoknxvlhXI55Yp4SkioIsfI=; b=k+kV09aOIJxhuGB1YRl3YhX982LI6kOnp+WyOCwbt42hxk4neEsIdUk7GN0SjPBlrI U5whd2QU/9pWwi5LtTsYmte/l8xL9K13tS8hreFP1nVYLylAGIwRQ6/zYD3YJopA7w9U WFG4moZKi25etht/lb1+HlrJyNV0ll0VrEWMz3FTCoMogYvhX2Is+0iIpaDvSTKptPR3 GmCmDsMsOD8Rf1s/Tu5+qdYJ/+e7luqFePcLCY+I9SkyXfJeS66ii+4J47YbsJpbMYhL X6qxmonm6RZ7AgWD6Xgn2g9NLl84C4IpvrsBuoX1kU3Fxv1NzfXkICLNboZ4SbEqJlPs b+5w== 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=PgdpGctimavYrhF92nrivoknxvlhXI55Yp4SkioIsfI=; b=FyDk/lvf9qEpUTUm2rA510OH7kwM7QKGnijH8Z6i3Jqii+mX8S5NJaaW/7FCWEmHBc HA/BZif7xu3hYaPxSUQcbijx9hngEmK/jJeEIz2fhJL7ynzs82W2aGbeH28Yt+l0wJIh bWsXe7PXC7LImfxMlXiCkCothOAQPIqUmLcyWk9LqfB+Hv/+D1rRUhRUYlrUKULVuzk0 Sc/ibjnDvd4o97KY/7+pJ0C1RINdrRCEBHXucSbKa+d6USJG2uMjOc2eWX3bWaBqG3A3 fEeKNA3eUToZdeTO0LdeQgA6hkQ2RVcLCM0GkWHmY4k1MeJS4fhyhdCEvzKoYXIu1j0y S3HA== X-Gm-Message-State: AOAM532YdTP/b7v29SS6aaK0Q1RCdOaMAxgi3mMR3DuSyYdjY+DUve58 wtMqVOa6LZdQgngr3TlxEIJONvyaXHur7g== X-Google-Smtp-Source: ABdhPJwpQzpZ6whPeh+VhrUMEVxWxg1hbQuxwfhCquoaWejKOnU2mFZkDGgNTF+hFSSHtvT41dIHhw== X-Received: by 2002:a17:90a:550d:: with SMTP id b13mr426505pji.133.1605205344366; Thu, 12 Nov 2020 10:22:24 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id m6sm7152292pfa.61.2020.11.12.10.22.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Nov 2020 10:22:23 -0800 (PST) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: Shannon Nelson Subject: [PATCH v3 net-next 7/8] ionic: change set_rx_mode from_ndo to can_sleep Date: Thu, 12 Nov 2020 10:22:07 -0800 Message-Id: <20201112182208.46770-8-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201112182208.46770-1-snelson@pensando.io> References: <20201112182208.46770-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Instead of having two different ways of expressing the same sleepability concept, using opposite logic, we can rework the from_ndo to can_sleep for a more consistent usage. Fixes: 1800eee16676 ("net: ionic: Replace in_interrupt() usage.") Signed-off-by: Shannon Nelson Reviewed-by: Saeed Mahameed --- .../net/ethernet/pensando/ionic/ionic_lif.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 58bf6e9314bb..7408755bac17 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -1129,7 +1129,7 @@ static void ionic_lif_rx_mode(struct ionic_lif *lif, unsigned int rx_mode) lif->rx_mode = rx_mode; } -static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo) +static void ionic_set_rx_mode(struct net_device *netdev, bool can_sleep) { struct ionic_lif *lif = netdev_priv(netdev); struct ionic_deferred_work *work; @@ -1149,10 +1149,10 @@ static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo) * we remove our overflow flag and check the netdev flags * to see if we can disable NIC PROMISC */ - if (from_ndo) - __dev_uc_sync(netdev, ionic_ndo_addr_add, ionic_ndo_addr_del); - else + if (can_sleep) __dev_uc_sync(netdev, ionic_addr_add, ionic_addr_del); + else + __dev_uc_sync(netdev, ionic_ndo_addr_add, ionic_ndo_addr_del); nfilters = le32_to_cpu(lif->identity->eth.max_ucast_filters); if (netdev_uc_count(netdev) + 1 > nfilters) { rx_mode |= IONIC_RX_MODE_F_PROMISC; @@ -1164,10 +1164,10 @@ static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo) } /* same for multicast */ - if (from_ndo) - __dev_mc_sync(netdev, ionic_ndo_addr_add, ionic_ndo_addr_del); - else + if (can_sleep) __dev_mc_sync(netdev, ionic_addr_add, ionic_addr_del); + else + __dev_mc_sync(netdev, ionic_ndo_addr_add, ionic_ndo_addr_del); nfilters = le32_to_cpu(lif->identity->eth.max_mcast_filters); if (netdev_mc_count(netdev) > nfilters) { rx_mode |= IONIC_RX_MODE_F_ALLMULTI; @@ -1179,7 +1179,7 @@ static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo) } if (lif->rx_mode != rx_mode) { - if (from_ndo) { + if (!can_sleep) { work = kzalloc(sizeof(*work), GFP_ATOMIC); if (!work) { netdev_err(lif->netdev, "%s OOM\n", __func__); @@ -1197,7 +1197,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, false); } static __le64 ionic_netdev_features_to_nic(netdev_features_t features) @@ -1784,7 +1784,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, true); return 0; From patchwork Thu Nov 12 18:22:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 11900985 X-Patchwork-Delegate: kuba@kernel.org 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 82AD2C5519F for ; Thu, 12 Nov 2020 18:22:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 20DBA22201 for ; Thu, 12 Nov 2020 18:22:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="fLE6hK4d" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726627AbgKLSWe (ORCPT ); Thu, 12 Nov 2020 13:22:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726597AbgKLSW0 (ORCPT ); Thu, 12 Nov 2020 13:22:26 -0500 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58935C0613D1 for ; Thu, 12 Nov 2020 10:22:26 -0800 (PST) Received: by mail-pf1-x444.google.com with SMTP id b63so1696527pfg.12 for ; Thu, 12 Nov 2020 10:22:26 -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=nYyiBvwXnhoNpusYUXNGEBo8iKVCfwhxeCA6lYkUDiw=; b=fLE6hK4d9AwikahZF7no8WcWQJN37qlYN7PPEHki1htjpOK1qOhxCTalQNSLwrBh83 rOOEubq1RECocf/2ttQOOYDjl1rv5HHp1yk4E3m8ZZ46VE4Zrdwz7AiI6EneyYPlwIA9 idDrx5g3QA4LLxZL2qLMgIBGZUndWqAFLxnu3AsvrxjP+NFWraQF9Msr6Vd1EitgoSLg 9AMM36iinn/8zDh3LgJGJBaYgYbHPA6yVmF4eu7axR4Tob18B6/XA1G58DH2h+/bBEr/ POS133H/T6BPQy5rVFwP/O+g5l6eLEn1k0Og5gHm4dbX5OJHuP8XOvSHCzxcnxw7nbyA OXZQ== 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=nYyiBvwXnhoNpusYUXNGEBo8iKVCfwhxeCA6lYkUDiw=; b=mTN1bwzaH9oMpVJcQAPpOKzJmawxmrQFCY1e9DlRsrKNY7pogwFxoVLxScU4LZvL/6 nDm7sy67MaY1MZNCabnmAQp0wQ1Rtj56jwI3x2+x/5zsUpMbGCF4fFvS+cKnngteLMxR 2A8h/5EOO2QIuUL2HC132ny7KNG9kmMjFztsIRPeU4UUTZsU3o37sgQrjptbV7xYrNxF Anah8nd07liwuff+C8d4Bv1oYsLsY+qL+pEbNgDSjHF59FVgz5EoXGf5g4t9xRcUDTz5 3g76876e99t7NBBVolAfMtjkqDXdCT59BpmrSkEFYm4MXdO+qr/yt8Kyypckn5K1ZbAP 9wsg== X-Gm-Message-State: AOAM531Vci8deHCqDn2GbcE2eDYLhMUJQeKyNZr90BRuzJKfM73u+p8G sik2u9IrlGKDJPR6p1T3Wnq3dguvrUVn6g== X-Google-Smtp-Source: ABdhPJyMUxgSvpqQcR/xonwhDSoOptTI1O4xCnNq0faXvRYg+l1C6MFaKY07uq3EG/SALzsTyRL8wQ== X-Received: by 2002:a17:90a:f68e:: with SMTP id cl14mr432219pjb.193.1605205345460; Thu, 12 Nov 2020 10:22:25 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id m6sm7152292pfa.61.2020.11.12.10.22.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Nov 2020 10:22:24 -0800 (PST) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: Shannon Nelson Subject: [PATCH v3 net-next 8/8] ionic: useful names for booleans Date: Thu, 12 Nov 2020 10:22:08 -0800 Message-Id: <20201112182208.46770-9-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201112182208.46770-1-snelson@pensando.io> References: <20201112182208.46770-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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 Reviewed-by: Saeed Mahameed --- drivers/net/ethernet/pensando/ionic/ionic_dev.c | 2 +- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 16 ++++++++-------- drivers/net/ethernet/pensando/ionic/ionic_lif.h | 6 ++++++ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.c b/drivers/net/ethernet/pensando/ionic/ionic_dev.c index dc5fbc2704f3..318db5f77fdb 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.c @@ -25,7 +25,7 @@ static void ionic_watchdog_cb(struct timer_list *t) hb = ionic_heartbeat_check(ionic); if (hb >= 0) - ionic_link_status_check_request(ionic->lif, false); + ionic_link_status_check_request(ionic->lif, CAN_NOT_SLEEP); } void ionic_init_devinfo(struct ionic *ionic) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 7408755bac17..deabd813e3fe 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) @@ -1197,7 +1197,7 @@ static void ionic_set_rx_mode(struct net_device *netdev, bool can_sleep) static void ionic_ndo_set_rx_mode(struct net_device *netdev) { - ionic_set_rx_mode(netdev, false); + ionic_set_rx_mode(netdev, CAN_NOT_SLEEP); } static __le64 ionic_netdev_features_to_nic(netdev_features_t features) @@ -1784,7 +1784,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, true); + ionic_set_rx_mode(lif->netdev, CAN_SLEEP); return 0; @@ -2792,7 +2792,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); @@ -2809,7 +2809,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..9bed42719ae5 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.h @@ -13,6 +13,12 @@ #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 IONIC_RX_COPYBREAK_DEFAULT 256 #define IONIC_TX_BUDGET_DEFAULT 256