From patchwork Tue Sep 12 08:26:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 13381042 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15786E54B for ; Tue, 12 Sep 2023 08:26:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18B33C433C8; Tue, 12 Sep 2023 08:26:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694507197; bh=w6mkmT4o+VVd0a/iR68vRz/nzAF+BMxy6VTKdAws6b0=; h=From:To:Cc:Subject:Date:From; b=pQIxE33Fl4/7Aw26ULpRgTvEJQIKWqhWfeIoMUR5adsYKTa7b905cbqB00qKteXAz 42KDgskDJFywD+y6HftX2xPPG/F7ktXmxPj+/XRynZ65k2c5XZkBeNOlLkSNRb2MGu ESpdE+E3+zxpVgUXb4+tfJAk6QtWssTu101wOVJys5mGzigLV2byPK4W2bIoxXPLvI Gu/1d6sGMU/EN3TnJ2aucco4oj4Tggcado+mLTgAiBJTk6oFFOIXCpSxYQqgEJk4YE gGKkqE6mxb0w7TbXVEiERwqUWbEHMvaUJVyRAWvGD4PBVyT/3GEfEY9mTrhWCQRC+W lPDQUbHi9XAAg== From: Lorenzo Bianconi To: netdev@vger.kernel.org Cc: lorenzo.bianconi@redhat.com, nbd@nbd.name, john@phrozen.org, sean.wang@mediatek.com, Mark-MC.Lee@mediatek.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Subject: [PATCH net-next] net: ethernet: mtk_wed: do not assume offload callbacks are always set Date: Tue, 12 Sep 2023 10:26:07 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Check if wlan.offload_enable and wlan.offload_disable callbacks are set in mtk_wed_flow_add/mtk_wed_flow_remove since mt7996 will not rely on them. Signed-off-by: Lorenzo Bianconi --- drivers/net/ethernet/mediatek/mtk_wed.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c index 94376aa2b34c..d8cd59f44401 100644 --- a/drivers/net/ethernet/mediatek/mtk_wed.c +++ b/drivers/net/ethernet/mediatek/mtk_wed.c @@ -1718,6 +1718,9 @@ int mtk_wed_flow_add(int index) if (!hw || !hw->wed_dev) return -ENODEV; + if (!hw->wed_dev->wlan.offload_enable) + return 0; + if (hw->num_flows) { hw->num_flows++; return 0; @@ -1747,6 +1750,9 @@ void mtk_wed_flow_remove(int index) if (!hw) return; + if (!hw->wed_dev->wlan.offload_disable) + return; + if (--hw->num_flows) return;