From patchwork Sat Jul 16 18:45:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 12920235 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9E1FBC433EF for ; Sat, 16 Jul 2022 18:49:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=NSoPRFvqMQNZpcBjMU44cNrvq3E4OC77ebmPR36FTng=; b=jU6M7AKhHkkwH8 76yH5KBPwb5kb7DiGShsHM7gCOn/GnMGMvb1dC+YNBiMqeQTq5F6EOUdwo03oZRV5WUtojNmbf244 SZY4tGcKvmYDigER+XUlbDFa3A9skUMYTZu7xEHEB61GjmHCmy+Y2Ua9ngO29di8cp88z3zLg9n8c 5Uk9P1hkt3LyDGWv16fMsGaN4++ZmEsszrq1ASiQ39BfIfVjUjrHCLZa5Uj/2mGSNfp+a4kx5LEI2 ccUdTjgNHrzcAHnbCxkPhA0M4kGR6aT3o/RXi0tXgMlDEo7NQAamfxC/q4lEh5ITlkT+NQWlKB8oK QydJqbY+BWhWBVBSnSlw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCmpc-0004b9-MM; Sat, 16 Jul 2022 18:48:00 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCmpZ-0004Xa-M0 for linux-arm-kernel@lists.infradead.org; Sat, 16 Jul 2022 18:47:59 +0000 Received: by mail-wr1-x432.google.com with SMTP id bk26so11117577wrb.11 for ; Sat, 16 Jul 2022 11:47:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=c0H4SZGJGUqTZkEbdcEov2Q3qqoTqkSn+ntdBtnS/KM=; b=WTP+PwRdz3/NeNA3azbbdQYgZuEHW+wCcX2zlJdgKdgCavP8KQVX7cgpbz8xbvg9dT CVCAjaCCKXsI51eH04MoxFh9pYCNiprUc+6DB/upF+ts+HmJYWsJ8/n4jL6prVfsPgwC UJkJQY9TJWWP+85XiJJIV6loYx1w9jSI/8wYw1KIUuZKQMNTMyJO9lVC4e2fA/tMW/Dk z6K7wkAKoSw9NJuSGNCJUZdiuzNcYV4WCuuXaJCnotrTC1qX4PsXAtefwndQM9RQNutl 2iZwuMppDNyTDakxaANhHlHz/33xeYlZtmWYmHPA7uIBBL4cHP1XBjMATBLmrFNX3x19 4fEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=c0H4SZGJGUqTZkEbdcEov2Q3qqoTqkSn+ntdBtnS/KM=; b=xCQE/gWR4jvWf6637cAjNIsZTx7YGrlxoMjd1NNoa/PclK+8oVefiJ57fD2skG/ahn AS6AvWNRlabyDGgB0ZVdzvn6jDwISnUMezR5aYtr1dPpajvUR3Huv2H3t4qg4Tn/HGio 1WG8N+RcUBzwjyo8fInHZOJ3LWCOqwL7IvtAZsKGLDO5bcbVPR8H2ZMksW2LyAsf53KF 8IfIoJ1hNWPAyTLq958Y+1X58mIcgnICUW+8DD9QzL9uPlJuDlwiStcVign31p5bkIzs Jg8XB5tJW0cdS9tBxm6BH0PM7Ey7e0JNK25lxeRZeSkWbcvaXfsM8Jhk1PpiYmzzGzXE A3fQ== X-Gm-Message-State: AJIora8qdzJqtmGNJ7Z5iRy0n0SYyBwH8C0IeByjUL9Nr8IDtjJsEHRJ NrlR+nOzpNySzVmNsMz/R7I= X-Google-Smtp-Source: AGRyM1vxWmXVZdIyvKjsfCiLfQST70cTYy6Zs18aWyI1GzP13g44mwZBjouRPWLAxAgn0Di1wM0E3g== X-Received: by 2002:adf:e604:0:b0:21d:6ddb:d0ec with SMTP id p4-20020adfe604000000b0021d6ddbd0ecmr17520358wrm.177.1657997274381; Sat, 16 Jul 2022 11:47:54 -0700 (PDT) Received: from localhost.localdomain (93-42-70-190.ip85.fastwebnet.it. [93.42.70.190]) by smtp.googlemail.com with ESMTPSA id u18-20020a05600c19d200b003973c54bd69sm13649961wmq.1.2022.07.16.11.47.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Jul 2022 11:47:54 -0700 (PDT) From: Christian Marangi To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Russell King , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [net-next PATCH v2 0/5] Add MTU change with stmmac interface running Date: Sat, 16 Jul 2022 20:45:28 +0200 Message-Id: <20220716184533.2962-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220716_114757_763466_3D3461F9 X-CRM114-Status: GOOD ( 16.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This series is to permit MTU change while the interface is running. Major rework are needed to permit to allocate a new dma conf based on the new MTU before applying it. This is to make sure there is enough space to allocate all the DMA queue before releasing the stmmac driver. This was tested with a simple way to stress the network while the interface is running. 2 ssh connection to the device: - One generating simple traffic with while true; do free; done - The other making the mtu change with a delay of 1 second The connection is correctly stopped and recovered after the MTU is changed. The first 2 patch of this series are minor fixup that fix problems presented while testing this. One fix a problem when we renable a queue while we are generating a new dma conf. The other is a corner case that was notice while stressing the driver and turning down the interface while there was some traffic. (this is a follow-up of a simpler patch that wanted to add the same feature. It was suggested to first try to check if it was possible to apply the new configuration. Posting as RFC as it does major rework for the new concept of DMA conf) v2: - Put it out of RFC Christian Marangi (5): net: ethernet: stmicro: stmmac: move queue reset to dedicated functions net: ethernet: stmicro: stmmac: first disable all queues in release net: ethernet: stmicro: stmmac: move dma conf to dedicated struct net: ethernet: stmicro: stmmac: generate stmmac dma conf before open net: ethernet: stmicro: stmmac: permit MTU change with interface up .../net/ethernet/stmicro/stmmac/chain_mode.c | 6 +- .../net/ethernet/stmicro/stmmac/ring_mode.c | 4 +- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 21 +- .../ethernet/stmicro/stmmac/stmmac_ethtool.c | 4 +- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 722 +++++++++++------- 5 files changed, 450 insertions(+), 307 deletions(-)