From patchwork Fri Nov 6 00:12:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 319754 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 91C7DC4742C for ; Fri, 6 Nov 2020 00:12:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 329B420786 for ; Fri, 6 Nov 2020 00:12:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="rrBqewTb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732560AbgKFAMd (ORCPT ); Thu, 5 Nov 2020 19:12:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732297AbgKFAMd (ORCPT ); Thu, 5 Nov 2020 19:12:33 -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 E869CC0613CF for ; Thu, 5 Nov 2020 16:12:31 -0800 (PST) Received: by mail-pg1-x543.google.com with SMTP id z24so2545251pgk.3 for ; Thu, 05 Nov 2020 16:12:31 -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=rrBqewTbbfqlC/E5syt/9ob8WMyDRhwxGpLYggCRgwM9wRdtFQKUdgdGaQlunLccoL 2aQOCfMqDIbT8Gzy808wIPhUygWfqRKSAOvt0Bg1PFmKjSVv6oY/inluNeSplwxCa5OM J6Ihcbv0bh8Igr/bu570UaOj3CTqCCBcVGOJBXSDSS1jvjZ9zD6uoZ2mAVCHDXkOYaIm m0SVbBv76ZcYe+tuwF25KS7BYpy8GA5ZNfa8L+/vdZhsRwPjpiP55rME/yJj3zgmKMwV w/hKqYI3DOeUjAK+knXGCZg+abNW2tfKexcIV5zNQQgoabOat62EvDd01k4QTEV8hq0L iFCQ== 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=A+vV3lJZDHVCAyEj7NxBsOWN5rrMzZY7+1oTXZm1U0xJs29FQq4zjvIF8vi/4GXovk enBUKVlxo4JMQ91cKbRFQGiWt1FbD8xJqUHSdiMl+i2ge8D5jxS6LHV/DVwIHmJrI2OM TcpemieoOmF/QeS3wFwnJHeiCaHvCFtNC64kprrxx27LDPhoBHn4N/ig5pEizzhy6NB1 P5TbaJTeP5e17UIUk3ckkTmTzZjwJye1osEJfOgtvEKjvSP21J3RtoU0ugYU7z7wMW9O 27HmoF9Upsipru7agUmrLTyjj8NlYGok0zOew1xkqrwDNq52BfDwCe/dBQqjojESCNaS 9JWw== X-Gm-Message-State: AOAM531jVoiqlOOk5s9Je4oNwoltNZ5/U37XGM3z2HNUVZjvQ3+TZuqa N1ZBrOv3Uxqx5bKpnnnf4AnwR9QUkuKlcA== X-Google-Smtp-Source: ABdhPJysc8RPAv+mFUTx6Tna1os6cT2boik9TlSs+X5/csKP2C8GTEHoCym4kbdmiB2Tm+Pql4tf4Q== X-Received: by 2002:a05:6a00:1744:b029:18b:a1cc:536a with SMTP id j4-20020a056a001744b029018ba1cc536amr1485318pfc.74.1604621551141; Thu, 05 Nov 2020 16:12:31 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id 22sm3236009pjb.40.2020.11.05.16.12.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Nov 2020 16:12:30 -0800 (PST) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: Shannon Nelson Subject: [PATCH v2 net-next 1/8] ionic: start queues before announcing link up Date: Thu, 5 Nov 2020 16:12:13 -0800 Message-Id: <20201106001220.68130-2-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201106001220.68130-1-snelson@pensando.io> References: <20201106001220.68130-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 Fri Nov 6 00:12:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 322245 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 47CD9C388F7 for ; Fri, 6 Nov 2020 00:12:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D80F220782 for ; Fri, 6 Nov 2020 00:12:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="j9VGIlz6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732662AbgKFAMe (ORCPT ); Thu, 5 Nov 2020 19:12:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729162AbgKFAMd (ORCPT ); Thu, 5 Nov 2020 19:12:33 -0500 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB68FC0613D2 for ; Thu, 5 Nov 2020 16:12:32 -0800 (PST) Received: by mail-pf1-x443.google.com with SMTP id v12so2650709pfm.13 for ; Thu, 05 Nov 2020 16:12:32 -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=RzMJ5I54EBNjTKdQhYz0zoJbUVPD0Jjli8LFYU8UorI=; b=j9VGIlz6kxk5ynOxCJdEf0yuZcp8D9wsgHB/c2XkRvAHmEdAvY9Jqz2jsFaOytNfG3 iT9n5p0uaAZFgsHvc5Id+RaPWmizI5mYBPew8tlLpcDfz2NsTNhUpLyIQVK5Di5wV8aE VdZ8XMHkQ7ezdHYgclPrPpobUcTgySHurlqx9BLjtKua+pd1TxWCl700bGGqbXv8uJ9r VMGKC1oc+5RD6FjsVtyNlXPzl0wOcjr/k4paNMb48I3q6VObnc8YyKRvULfllq9sRDGr fW1r8RejTzA1Gg4nTOnoeXwvRKGGdEiZLp3S3Cs66FSmKQ3RnDGHzsvxf6HqY1H2+UJz oKZw== 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=RzMJ5I54EBNjTKdQhYz0zoJbUVPD0Jjli8LFYU8UorI=; b=Y/0Num1jV9rQbWJF91knDA8+d1RV68ZzhszYoztXBcJJROCPP9khiygJiw6dWhfoBA OwrfHNJVhHWjFnSd8pQu/UqejaXS2YIgqfcqwzolgi84OP2McF4Lc3N+yDAB97tk/WX+ fxuaiINgyKIiGzKloOKVuCaA3u4ot4SVJfQ3C4QphM1QOmOHhrToHCGk3jfWGtZblz1y cIrWgHnAwlPZQ/cVom8i39fOLgjSQhOpWs1eWggCMfDc2CvyuGyr2KVf9YOBxeNu2/oT 9n/DbAB94HCP/qQsxTJ5NEfJFE0MaIo8qizn6E4eRaeQiJ5FuWoMkReaE84gLgWm42HP rnoA== X-Gm-Message-State: AOAM530EkQ4woH4oZ+Bm1jReFD3/wDIIKmbKmQ7c79MbALYQcLipGZOb G8nMQEHewjSBCCl37kGkUmvq+Vbs2vr0hQ== X-Google-Smtp-Source: ABdhPJwEPHxh39/0PjO1rZygNffylevCu/o97s/X4N4K4bAZG+6YJ7PD+wbhez9iYvWNn6vZtiVMgw== X-Received: by 2002:a17:90a:c381:: with SMTP id h1mr77998pjt.2.1604621552240; Thu, 05 Nov 2020 16:12:32 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id 22sm3236009pjb.40.2020.11.05.16.12.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Nov 2020 16:12:31 -0800 (PST) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: Shannon Nelson Subject: [PATCH v2 net-next 2/8] ionic: check for link after netdev registration Date: Thu, 5 Nov 2020 16:12:14 -0800 Message-Id: <20201106001220.68130-3-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201106001220.68130-1-snelson@pensando.io> References: <20201106001220.68130-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.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 --- 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 Fri Nov 6 00:12:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 319755 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 436B3C4742C for ; Fri, 6 Nov 2020 00:12:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E3A4420782 for ; Fri, 6 Nov 2020 00:12:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="31zQo4w/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732684AbgKFAMf (ORCPT ); Thu, 5 Nov 2020 19:12:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732660AbgKFAMe (ORCPT ); Thu, 5 Nov 2020 19:12:34 -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 2721EC0613CF for ; Thu, 5 Nov 2020 16:12:34 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id v12so2650733pfm.13 for ; Thu, 05 Nov 2020 16:12:34 -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=H4nDhqegF0EjT05ul4Hwr7UIDTMUmNY72Ijv6z2hAS0=; b=31zQo4w/qe1ztrYsbSVkHOm7mv6ghuMskhV8VvFg22P3ZVhJ9TD/lxJsHuZ21XtEvi WjXdHqmFxkQHrvDJ393p0/xaix54uXaEbEBeTjWpFMWLb6Rggqhxj9YquT0Vc6AOCDXu l2FJAV6EzJwS+zpl9B4jtRO5eRXOwLzK0xDJh9gh6dQ0f9yXU/dOTdOdLDUKCn5EeW/n FYJc3lmZhVPV1yrei9tvpJvOUzaaJ7u9hD1jD4e4eckJUuBx4sllPqz4KUaB4o87XgQj kbG9xBYtUGyLT5k61CSm+h3K1b6XBnwBikKM+yRhHjBEGqZPXCTKXRT3Sy0s4foZfm98 Lf/g== 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=H4nDhqegF0EjT05ul4Hwr7UIDTMUmNY72Ijv6z2hAS0=; b=IQgP07V2gtRdG9v970RNCKh78DxvyLrytfNE5oDiuNplkn9qe9qRXNPx3Qp/H36sKZ v+/ZxXafn2keJNFE95NuLRsISd3cbzwe9Q9qqCTVb37inz6hktPCStD3D2PQhjyYuGrE tlN9S4X0XmB38tU6JjoISibL5sTub1cqSuUUhLcGRhu0ro0j5T7XdPLlUR2/kcWjwzbA LjODtVAdVQjimJ2en5SeP3AtU8oD/OXn/MAgddiGUdslX1b/BXr2RYIU9B0y6IHKOn+3 SiWN8MFSp9yKBhbLSa4+L7Yh6w7cZwZg087j/cBToeeC7Rn5G1gHt3EuiD7NEscle8/p LJiQ== X-Gm-Message-State: AOAM533O62DyrdXPASBTQRH/gNzoxl5uojQebQUCCu0A1AvJwib+S5qM uFXhfR9FJYUtxCRExG11H3rfCdudTPMV2w== X-Google-Smtp-Source: ABdhPJxtuGsCbR8nHf5g+pPfXJsJZrcwODxPvINWMu/Bf8lE92Dw3jiKi4xTd/WVnW2CA40bmIJePw== X-Received: by 2002:a62:8f8b:0:b029:164:9e98:c0e with SMTP id n133-20020a628f8b0000b02901649e980c0emr4981323pfd.80.1604621553290; Thu, 05 Nov 2020 16:12:33 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id 22sm3236009pjb.40.2020.11.05.16.12.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Nov 2020 16:12:32 -0800 (PST) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: Shannon Nelson Subject: [PATCH v2 net-next 3/8] ionic: add lif quiesce Date: Thu, 5 Nov 2020 16:12:15 -0800 Message-Id: <20201106001220.68130-4-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201106001220.68130-1-snelson@pensando.io> References: <20201106001220.68130-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.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 --- .../net/ethernet/pensando/ionic/ionic_lif.c | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 519d544821af..990bd9ce93c2 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -1625,6 +1625,28 @@ static void ionic_lif_rss_deinit(struct ionic_lif *lif) ionic_lif_rss_config(lif, 0x0, NULL, NULL); } +static int 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); + return err; + } + + return 0; +} + static void ionic_txrx_disable(struct ionic_lif *lif) { unsigned int i; @@ -1639,6 +1661,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)); } + + (void)ionic_lif_quiesce(lif); } static void ionic_txrx_deinit(struct ionic_lif *lif) From patchwork Fri Nov 6 00:12:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 322244 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 EB674C55178 for ; Fri, 6 Nov 2020 00:12:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8C51320786 for ; Fri, 6 Nov 2020 00:12:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="WitwLI8U" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732723AbgKFAMi (ORCPT ); Thu, 5 Nov 2020 19:12:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732660AbgKFAMg (ORCPT ); Thu, 5 Nov 2020 19:12:36 -0500 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9AF1C0613CF for ; Thu, 5 Nov 2020 16:12:35 -0800 (PST) Received: by mail-pf1-x42b.google.com with SMTP id g7so2388531pfc.2 for ; Thu, 05 Nov 2020 16:12:35 -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=ZTTdvHFepw40UzyfBUYLlofllO40qi0wrEoklyhrPBg=; b=WitwLI8UcsLXlRmUrzeq4d9h9ADr5appgpqGPoir5ROBq/8DghMoENFeiQvb1VyNSO UTfuzLedFuDoI4L2RGQQ+yvzc9TGyBfey8N7SOAPhQiayXj3aTFb4bP0524mMHhNHxut b13tsuuAqCkyKfKX3wYr8udCb5Dfnc7AOPDhw4QV94xMiIbll7qcPHgA2enD+4S/Ady2 gDQ1TU5S9bLGnZ7aMRkSN7ArHL+jMGOP1IQfs0UysBBiO/blx18jXAwWJLrV2l4icMI/ eDwvR/BuPXMfYqFS7tzOr/dgL+cLzoYiVy5S/uqSxxDo6tYykNByFL2YZ82Zk5rnuTGi XSeg== 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=ZTTdvHFepw40UzyfBUYLlofllO40qi0wrEoklyhrPBg=; b=MgyqTKi6U1IxKbbBZTlm6cBdc4DeokKyNkaIENq0ersHFufUYuxY1EAxqMwh/QCrCd 4bRNvhUZK3UhXBNsAygfUdlEBCBusQTYDCLYlh/sivzXq6L+j0uj9HBDzFGJdo0jmQ4g EDWP6i8viI3qkrqqVJ31oJKvHVPgIGxOQ82Jm3DJXJvKEg1L53jcecTHF4kZpD49zOV1 Li8OSrrfroJvKiOWo1lEJHDtlpeJhV9FWcuF0TObUnA4K8XxA2q7mo25Opdr70yZ7bC8 t7hlSaHaKH47Xmwn0bBF7Jf19oFx+KHYNY1wksXgZGBYEsxa3P29E3L3udwVCO7LXmCK rf9A== X-Gm-Message-State: AOAM533diTIVfpF4H4pNrNbZD5ljZl2HcVabkGJY9U8+c4lPxCthfx3M nXT81zqMwXPAaaesieuLBAjuzr6GPr6Uxw== X-Google-Smtp-Source: ABdhPJzt0zcfc0dy0aUp+BNiNeKOXgj0oSzBZrcBchlnO+0dYILFg3+6XYvE0cvv1gdRXkGJLGaJuw== X-Received: by 2002:a17:90b:942:: with SMTP id dw2mr4714450pjb.14.1604621554594; Thu, 05 Nov 2020 16:12:34 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id 22sm3236009pjb.40.2020.11.05.16.12.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Nov 2020 16:12:34 -0800 (PST) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: Shannon Nelson Subject: [PATCH v2 net-next 4/8] ionic: batch rx buffer refilling Date: Thu, 5 Nov 2020 16:12:16 -0800 Message-Id: <20201106001220.68130-5-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201106001220.68130-1-snelson@pensando.io> References: <20201106001220.68130-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..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 Fri Nov 6 00:12:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 322243 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 BC8EDC5517A for ; Fri, 6 Nov 2020 00:12:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 654EF20786 for ; Fri, 6 Nov 2020 00:12:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="l/yh2Ywd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732741AbgKFAMk (ORCPT ); Thu, 5 Nov 2020 19:12:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732706AbgKFAMi (ORCPT ); Thu, 5 Nov 2020 19:12:38 -0500 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34BD7C0613D2 for ; Thu, 5 Nov 2020 16:12:38 -0800 (PST) Received: by mail-pf1-x443.google.com with SMTP id 72so2669302pfv.7 for ; Thu, 05 Nov 2020 16:12:38 -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=qmSzPynWQ2lf/qf6sQOjE82uEc89pldFlSfrmsF90B8=; b=l/yh2Ywdo1CMf1jQshawgOIlG5+faGJ7cHRkma72EVWFwKPc4noO/SUhb9/fyojyRx q3sQsTq9N3zH9iLE/nd20qd+saykGn5rIBHRNM985tKHehyLeXVSwwHw9dW5pW11n9+s Db7ILGaeBUvx32bBUkre+6P7A3TkH0ldt5oN5Xjcj/YlOYamthVMaruY/8LlSO3fVIEE 7Vz2l8bg+Xbq/0S1PNQ44/tk0+xeYxOJxWpO65morHQm95eugGVA8/Pqk2iJHwHl/gNd 9ShvxCiH31X5tnUneyogzI1eiGVO2Mv3DM8xSA0Tsj5uTvje9DjHrd4P53l7ItVdpiwT AGGg== 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=qmSzPynWQ2lf/qf6sQOjE82uEc89pldFlSfrmsF90B8=; b=m0K3Jjilp4TFSLbtBghLFnW0cnpu/BOWSEoFu7t62trrPfVaTg2IRy73JS7rmn5JxM tDW7BKwk1IoHQP4DaQ2vrG+gr4hkqZ2G69eGem4lDK/rNmUNyEYCYv9HynUdw+XTVEHv CJwTGFGNTuRLxC7XMxTV+jTagYJRcEtB4+yX5ZLs2Zi+2awnaXmyEd70E2O52hxf4CGY O7ktWmjG/757vmGOkhzhuHAoPC0oJE1QCvxQZIXiSmLHvrhmUo4WZL3CQdyt8l/M5eP4 NRKCNuV+cdtHEA7KHM4WPnIEu3dAJ1skoKwyRrUWRDbNIA1ov+5Xv/zmh05f15Hb4rPm hjAQ== X-Gm-Message-State: AOAM531W8JoqQOjKHzxTkMpGuHt0o97vhkXBnFubLownuZ6aX/XLWfgv 7QQH3GPu1Xe7ZDFaOx2vMV99bpeKz79+YQ== X-Google-Smtp-Source: ABdhPJyOH8TvsHHxlt3h90dASAUELZQGQMBC1q74WsgU9mkGyjAmIQmZVW9Zv+8INMkkIrSsC67JuQ== X-Received: by 2002:a17:90a:7e0a:: with SMTP id i10mr4990923pjl.89.1604621557158; Thu, 05 Nov 2020 16:12:37 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id 22sm3236009pjb.40.2020.11.05.16.12.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Nov 2020 16:12:35 -0800 (PST) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: Shannon Nelson Subject: [PATCH v2 net-next 5/8] ionic: use mc sync for multicast filters Date: Thu, 5 Nov 2020 16:12:17 -0800 Message-Id: <20201106001220.68130-6-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201106001220.68130-1-snelson@pensando.io> References: <20201106001220.68130-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.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 --- .../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 990bd9ce93c2..a0d26fe4cbc3 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 Fri Nov 6 00:12:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 319753 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 11E7FC4742C for ; Fri, 6 Nov 2020 00:12:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A05DE2075A for ; Fri, 6 Nov 2020 00:12:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="l1F18gen" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732766AbgKFAMn (ORCPT ); Thu, 5 Nov 2020 19:12:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732727AbgKFAMj (ORCPT ); Thu, 5 Nov 2020 19:12:39 -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 966DDC0613D2 for ; Thu, 5 Nov 2020 16:12:39 -0800 (PST) Received: by mail-pg1-x543.google.com with SMTP id t14so2551650pgg.1 for ; Thu, 05 Nov 2020 16:12:39 -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=vtqZ54Xnh7Hf162UYOKk1fQAxTBQbfeuc5lOS2wJEnc=; b=l1F18genOzu5ESIlpYkQRjLTpiN09IZ+mMRcTkpRSeBl0titZWnVHN/ohIzeCWfV5/ wESTR8E128NTRW2Um4aF7qC8s+DVKltn8e9irN1zZi34xg8RvtczYfADJTWe0phsNPFU OyXLz9LbjR5c8FeiYnCxG5b8tPwykTxvP+BJNIWJzXEYRQQFzuVi3nIEGZxQGbP1fUcT 97nl91pKr/3pZY4IquQoMPurqVTQAfy/EC//InzwLBikXtY4sjOEurSGGD7k0h2cjT1J At1eBuI74f5UUdSCCKSnsMDPDYoosbUoNQq1Muy/tCx44Awak9B03uqocf2N9vH4OOhg bP4g== 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=vtqZ54Xnh7Hf162UYOKk1fQAxTBQbfeuc5lOS2wJEnc=; b=jgMVcg/6rbs1MatdYUzTLHZVes1D8EtRRCvVFGadu8PTdioqgK4Oa/93K5gxjCBPef 4YrKuciCj9nsk5rTJh+nIxBKLproFel9fdDflMyjynMhXcjCxFLdldGPdot5mebh3Mr4 RQO5SV6jXEo+aLogS3Z/NfU2x0YE0GGxxM1uloO1txfH2z4FcpobK4nPvDlPxFgBbFKE FLVuBZDLEbGnYuZ48hGtErawpfUgIX16o1XCj+Axu4ko61ZV8EZLq9LdC6LrKFJCnRgy WuRDsBFANkwR8nYO1/+F7zC6W5EedU2vKyfGsYdzUHK68K/n6qrr8Tt6jOSy0f0x2fgd vELA== X-Gm-Message-State: AOAM532PmryjJjhaGWwT+3qxSeBTreZWnFHQFTmFWvPcMlLYw6VaK6RU Ard6e9KX2/Zg2ZuRhFCmyu7dE1pkQm4b1A== X-Google-Smtp-Source: ABdhPJzvstcLbWO3MZLp2y5XzrdwLxM4j2HMHhKBKzYYp/f147hscWDbq6eIFhSGYQcrHgKOi5XGUQ== X-Received: by 2002:a17:90b:ecf:: with SMTP id gz15mr344705pjb.152.1604621558914; Thu, 05 Nov 2020 16:12:38 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id 22sm3236009pjb.40.2020.11.05.16.12.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Nov 2020 16:12:38 -0800 (PST) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: Shannon Nelson Subject: [PATCH v2 net-next 6/8] ionic: flatten calls to ionic_lif_rx_mode Date: Thu, 5 Nov 2020 16:12:18 -0800 Message-Id: <20201106001220.68130-7-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201106001220.68130-1-snelson@pensando.io> References: <20201106001220.68130-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.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 --- .../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 a0d26fe4cbc3..ef092ee33e59 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 Fri Nov 6 00:12:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 322242 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 F1F6CC388F7 for ; Fri, 6 Nov 2020 00:12:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 99FD02075A for ; Fri, 6 Nov 2020 00:12:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="3bONby1R" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732754AbgKFAMm (ORCPT ); Thu, 5 Nov 2020 19:12:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732660AbgKFAMk (ORCPT ); Thu, 5 Nov 2020 19:12:40 -0500 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5D46C0613CF for ; Thu, 5 Nov 2020 16:12:40 -0800 (PST) Received: by mail-pf1-x442.google.com with SMTP id g7so2388662pfc.2 for ; Thu, 05 Nov 2020 16:12:40 -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=/0IvibNh+Smy/hpRKjeRGPoP2tQSMPHmeatAkYSGNXs=; b=3bONby1RmEzVqrGbkmdv3fnHqbbwEGASe8U5LusdH69XBomq9Fo+h6Cjj3Qedh4Gkn 1WO3PdZmza2Ywpz+65AgULCyv87O75RGMYjKAVYd0MglztRv296DA068SS5HaCORFAk/ TzUPZXR1pvVHIFiGNgmW43AyQz9dfITbpJCi9LsiuX3Fs27QeTtkYhVINcCutYZiqjjW TAMav4cUJw48y4z5LsMRV2uptMTP0uDqCdPqnM6ZcLrpZ0qnKtedudI/MA0wZtUhJxFH s5GQy41hRO8dNlXP4DhSIUfIiPAIjbufq2WD1Hu7JLE4UE2J4jubIn+d5i/ZAwruh+JS xuLg== 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=/0IvibNh+Smy/hpRKjeRGPoP2tQSMPHmeatAkYSGNXs=; b=fkzIXpBNYQ43cGvP94AWlRuLhyPRLsOT2coKQB5Hv+NfbK1kDpo5viduocmzOLLJvs NYVNny2pRDE8tvjfU/gFZbob9GUs3WArq6i/HeDNqTpNxfBt+f1PmsNAnTw2TRzLf4xv wVYtdtb8e0aQFraq4DCrLDfPgAGExuuiaivSYlRseHvMMHosAbWl2+acsIF6r3fX4VWY kC7IM1bRnWK/6w+dXtkYz7/Sxgp4gxRGCwU05KLR2f6/SKUj1BpCNoo79VnbX1h5I/rk mVl/cqFJpJ+w79mjJPU3VxSIW46WIez+444rQ8yjAfl7iSViJ0eXNdMERrnGadVB2W39 Yn6A== X-Gm-Message-State: AOAM5329MMeCiv3TJ6CreMhmJvE+ezGOknLbukRVHYsNKk2TlpAS9Xls ebwjfXZ5ebTpXov4JIx73r0kP57qt5Yn2g== X-Google-Smtp-Source: ABdhPJz7dxVKmia3qnwElovjX5bHJwXrlNAsvf/NIxpkNGCZQNDb3krzUrQKo6VLbBddAu4R4J2NNg== X-Received: by 2002:a63:4546:: with SMTP id u6mr4727488pgk.311.1604621559998; Thu, 05 Nov 2020 16:12:39 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id 22sm3236009pjb.40.2020.11.05.16.12.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Nov 2020 16:12:39 -0800 (PST) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: Shannon Nelson Subject: [PATCH v2 net-next 7/8] ionic: change set_rx_mode from_ndo to can_sleep Date: Thu, 5 Nov 2020 16:12:19 -0800 Message-Id: <20201106001220.68130-8-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201106001220.68130-1-snelson@pensando.io> References: <20201106001220.68130-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.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 --- .../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 ef092ee33e59..7e4ea4ecc912 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) @@ -1788,7 +1788,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 Fri Nov 6 00:12:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 319752 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 38C17C55178 for ; Fri, 6 Nov 2020 00:12:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C74382075A for ; Fri, 6 Nov 2020 00:12:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="Ys5FNiZL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732778AbgKFAMp (ORCPT ); Thu, 5 Nov 2020 19:12:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732750AbgKFAMm (ORCPT ); Thu, 5 Nov 2020 19:12:42 -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 B7E65C0613CF for ; Thu, 5 Nov 2020 16:12:41 -0800 (PST) Received: by mail-pg1-x544.google.com with SMTP id t14so2551717pgg.1 for ; Thu, 05 Nov 2020 16:12:41 -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=IkpA71KX129Kn+dj86QAGM5+X4reANdRCWspxwQExj8=; b=Ys5FNiZLFdU3jxjs8FEoRQ7WNij3+2HjIkYCTLujbUq3jy5f4ZHKGvnbhe3yxqf20z J1Zca479OKW+VyweOlXPLJeQQq+OIhN98zqbshyj04wMpJOMieiasQLr5F4JmosscMOp q5KlJKaxMaTvB0x7yXmtWwDSFWeXCArRZaR74Ph640I6v3nEf0/LLKFwSMwteN9QZXD4 8IaoHcIDnJjCPwiayCzdaoiedJtqr/IOLgwwOPumGfXI7IfkGPBUucwAg5UV91QIeNF0 5VQhlBgryY0kBUDZpi2sfYPGWi7MbJdtaDNgCzQVgwPrN+qLpc7+ou1FXHgQjkynMYTa hzmQ== 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=IkpA71KX129Kn+dj86QAGM5+X4reANdRCWspxwQExj8=; b=tC8fXp+1POa+OnR9MeFPOWuqUIxm5Yr4ySOy/s1MNnganCkYfbi2K3zIz9qhO9xUsI ExnBTChwPdT1gGH+IfPMJU7Mv0Qphhl34wvc6ieXbPnXOrnmEIxrRMT1OrGCLjctIUBv sWAZHYeeOEml4pNrgtCqvVpaeNEGtNBJsL/pL52lKuUkztdwrXSf2rimWtEZzle1SfPD NZUwW9hvTHUOD+ABAgM6zz5zkaXdiGq4Ev8Hpb7BuNNImWlHW6qU7ZEFYcJ36LWJexc9 1RZnzCPop0X9d8M/V530RU6zrwImcooqqZxhyFQI6JhYokqSDd7xcKf6qx1DKEi8lIY9 h5CA== X-Gm-Message-State: AOAM531qHNZSoaXSrJw2dhtdJY6/zN8fpg2N5TAGtf7BhZAv0R2nomXD IPsmoPzMitLOzlsmnO0ApzEBjCVcgXTxNw== X-Google-Smtp-Source: ABdhPJy8pEb/X0SXAk9rvwxKLDNGrIaJ2U/Pi/eIg7gfAjIqqpLcn/TE1bAW+1gZq37Z0VW4JamsYQ== X-Received: by 2002:a17:90a:db48:: with SMTP id u8mr4837664pjx.93.1604621560977; Thu, 05 Nov 2020 16:12:40 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id 22sm3236009pjb.40.2020.11.05.16.12.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Nov 2020 16:12:40 -0800 (PST) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: Shannon Nelson Subject: [PATCH v2 net-next 8/8] ionic: useful names for booleans Date: Thu, 5 Nov 2020 16:12:20 -0800 Message-Id: <20201106001220.68130-9-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201106001220.68130-1-snelson@pensando.io> References: <20201106001220.68130-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_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 7e4ea4ecc912..9dde9d50c866 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) @@ -1788,7 +1788,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; @@ -2796,7 +2796,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); @@ -2813,7 +2813,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