From patchwork Mon Sep 9 19:44:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 13797504 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 0FF05189903 for ; Mon, 9 Sep 2024 19:45:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725911136; cv=none; b=nZKQ0IhiXADCQk6/tTJYI21xlfT/qdMN5jz7kHPxDy246b4zUmwjKFwA6+g56JsKXkZVoK9o7yo/N6Nlf830Ggk6hpQtC3IOMyYfM1I2yfkiw6VMczK2rppmKQxjsZn5tLQsQeeGnt1oKwRpzyKlGFQRG8T20qRxFhwO3daVYY0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725911136; c=relaxed/simple; bh=940Ke2OEcilTBElrUVpc2V2sdch3evVqcaAppj1rznc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UftwOAzrO1QH3C/pP1m3OKjgO90Jd8pC2RDcjdOI1tvUzD3ym6NufBN/GXp8BQ5a6qoGJ/ByUsxyFf22ej05EjelVeazEagoR2Ivs6sav3LWdROM1/eTeTzqg8sINCXPJbm1yFOPbQbgvcBuyY41fDgjIdkztTDOHWTt2QFravA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cZTAc49N; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cZTAc49N" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9FA4C4CEC8; Mon, 9 Sep 2024 19:45:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725911135; bh=940Ke2OEcilTBElrUVpc2V2sdch3evVqcaAppj1rznc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cZTAc49Np1OodPlJDc5crcdRLJK2LLVoc4IpX08nObB9WLOGf0PlhznPVNaLwnzUt YMoT0ffaQ4Lk5Nx0T1sD4mhk+WuPahS6HKZRmzxCIgSEYQnjGD/RzX6hsou/tgnUMG 7kULc7KEA25f14OUOcqiNh6mOdWgv53KMTVjhx6GDt5TSbET6toUkvhW6zi/HaN6hA MaoohoHf2hqDxBuTbYbz3S/jTnih/05njHEmfT6JnOC1UGzovEQah2HNr3Hhigba5q 6P4pTjExSFvMCfkky2Hhnpy4On+akTIFXXbmHsvUyRYl2QJNflV7yB4UUyNl1ROsvz Xe7CMdy2q8K1w== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Gal Pressman , Leon Romanovsky , Maher Sanalla Subject: [net 1/7] net/mlx5: Update the list of the PCI supported devices Date: Mon, 9 Sep 2024 12:44:59 -0700 Message-ID: <20240909194505.69715-2-saeed@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240909194505.69715-1-saeed@kernel.org> References: <20240909194505.69715-1-saeed@kernel.org> 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 From: Maher Sanalla Add the upcoming ConnectX-9 device ID to the table of supported PCI device IDs. Fixes: f908a35b2218 ("net/mlx5: Update the list of the PCI supported devices") Signed-off-by: Maher Sanalla Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index 5b7e6f4b5c7e..2ec33c4a2a3a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c @@ -2217,6 +2217,7 @@ static const struct pci_device_id mlx5_core_pci_table[] = { { PCI_VDEVICE(MELLANOX, 0x101f) }, /* ConnectX-6 LX */ { PCI_VDEVICE(MELLANOX, 0x1021) }, /* ConnectX-7 */ { PCI_VDEVICE(MELLANOX, 0x1023) }, /* ConnectX-8 */ + { PCI_VDEVICE(MELLANOX, 0x1025) }, /* ConnectX-9 */ { PCI_VDEVICE(MELLANOX, 0xa2d2) }, /* BlueField integrated ConnectX-5 network controller */ { PCI_VDEVICE(MELLANOX, 0xa2d3), MLX5_PCI_DEV_IS_VF}, /* BlueField integrated ConnectX-5 network controller VF */ { PCI_VDEVICE(MELLANOX, 0xa2d6) }, /* BlueField-2 integrated ConnectX-6 Dx network controller */ From patchwork Mon Sep 9 19:45:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 13797505 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 1556E18C31 for ; Mon, 9 Sep 2024 19:45:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725911137; cv=none; b=B9hjOFUUAMJEssVXJpT9tf/g2UktF5obR61VhQwiIGygHtMymkUZ5Ycfi/wEJDqt1rNtdLDGNJg/nQg46itFGy/YD9xpLN5LHs0bnbbC68dHKGSGmtBQEZrvNk5zGS880x7bbAxuvR02JItT1FJTTDxliO/fagRtrG18ng2AS5Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725911137; c=relaxed/simple; bh=NpWMhXoohQBqcM5rp0Pae/MyHvphNhUOhhnaTOZdLyg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DKxfsFSKbq66qwG03xtZMy2M/1mYKIpzq3XklprS5QRL99YTu5XB8ml/JJYjan3zBWc0NxwadHLh2R0qujzxkOvQXdRYI7c4BONQCB3W/gHmgMONYU6aw+hipuajtfLXnrUvTyjGzJtyAZa/a4VtHnLqhmcGbhsB2qqJuhys9Zw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=h2wx5Hip; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="h2wx5Hip" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9ADACC4CECD; Mon, 9 Sep 2024 19:45:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725911136; bh=NpWMhXoohQBqcM5rp0Pae/MyHvphNhUOhhnaTOZdLyg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h2wx5Hip3o4P/y/8CM9R8sgRlr4OZpjH1rV3KFrAFWPemfI3tTXFRg80/QR1ahva6 fxLZONoexX79j1UwD1r6+uvNUW4WdAzN2koZwoV6XfuR81Yipt6troXgVnUKcYkIqM u24Fy2aEQgDGqSnZu2cfhDfXi8abfZ4WS1jTtrvWm+t+vM7Ey4borLmTZ2yFjFvec5 IoDqOHMKUeknGE1zo3O0eGnE8uPTa2ilbIxTe1F8F3ia/ALc0KBkwUSr/Vf47tElZn 8GNIiIenLr9ihqQF2Z7oaLC36FidZaXZ0QbyeV0NCW3+DgER0ZzD0P2qjO16dnZKq+ 0u+KqkdopAxhg== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Gal Pressman , Leon Romanovsky , Shahar Shitrit , Carolina Jubran Subject: [net 2/7] net/mlx5e: Add missing link modes to ptys2ethtool_map Date: Mon, 9 Sep 2024 12:45:00 -0700 Message-ID: <20240909194505.69715-3-saeed@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240909194505.69715-1-saeed@kernel.org> References: <20240909194505.69715-1-saeed@kernel.org> 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 From: Shahar Shitrit Add MLX5E_1000BASE_T and MLX5E_100BASE_TX to the legacy modes in ptys2legacy_ethtool_table, since they were missing. Fixes: 665bc53969d7 ("net/mlx5e: Use new ethtool get/set link ksettings API") Signed-off-by: Shahar Shitrit Reviewed-by: Tariq Toukan Reviewed-by: Carolina Jubran Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index 36845872ae94..1e829b97eaac 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -139,6 +139,10 @@ void mlx5e_build_ptys2ethtool_map(void) ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT); MLX5_BUILD_PTYS2ETHTOOL_CONFIG(MLX5E_100GBASE_LR4, legacy, ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT); + MLX5_BUILD_PTYS2ETHTOOL_CONFIG(MLX5E_100BASE_TX, legacy, + ETHTOOL_LINK_MODE_100baseT_Full_BIT); + MLX5_BUILD_PTYS2ETHTOOL_CONFIG(MLX5E_1000BASE_T, legacy, + ETHTOOL_LINK_MODE_1000baseT_Full_BIT); MLX5_BUILD_PTYS2ETHTOOL_CONFIG(MLX5E_10GBASE_T, legacy, ETHTOOL_LINK_MODE_10000baseT_Full_BIT); MLX5_BUILD_PTYS2ETHTOOL_CONFIG(MLX5E_25GBASE_CR, legacy, From patchwork Mon Sep 9 19:45:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 13797506 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 0494518A6AF for ; Mon, 9 Sep 2024 19:45:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725911138; cv=none; b=GWnyUEDtY9gC9RQGXyLi/qmb8Az/AIehdtQA0+6CuQwN93YbJp8WobJIpKsrZ+ldZpcJVvzI179YZ9JX+LqFUMDiCWfqBQzGH69DhQSjFHPVRjS32F34Q13j/WpKiTFXusRa454GWHFEPS528vRXWhVd/v2Zo0BmMfRX3+Zd2Yk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725911138; c=relaxed/simple; bh=KHMt23UizMB8OooRYadoZ1U9pt5L9vT/aPMWkUPJyOM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rdD2f+1sH3CsQy5l3UIO9QZukIMikBmoacDSs+fW9JrwdK9ORnrXUe3BpQzydO1jzDjED5voFoLRo3DfYsQAQHSzyQzJCcJzjSKuxa3VuIqTFROXr3NaQDyGWxdiz2M1cpgiRQ3++JRwnd5ojmqm/4Go02NH+RQqhkyPTCpvCDs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hwcqleAE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hwcqleAE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71246C4CEC5; Mon, 9 Sep 2024 19:45:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725911137; bh=KHMt23UizMB8OooRYadoZ1U9pt5L9vT/aPMWkUPJyOM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hwcqleAE+KQTbXYifckdMmAdbqg7HL8Ytl2g3nSYmTZqmslFNR37we2iq5bcO3hMM os01sq/9MKe8oHroSTq/dIbcjCYqB8HnMPkfWr5ystm/jQgrd+TN/ahoEbMDSnTraf GWiHdWDD436yK56h4VBFwckLtUszHcXWtsUXe8vLaASm86/q3P0aFL72/CL0/fJJES FMo1WTaLXNZ2zyN1ObcE6LQG23IOykUsHrMYhyaPy9PiJBYIgmCBFhxBeJP6MvNHAF PDDgPSQqc9Y7x25ynTNGZciRDDc5OBdqRJgOw3+wI1aPWrVXVNswbraE/SgfmW/TdA JBLlU7Gy0dTWg== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Gal Pressman , Leon Romanovsky , Shahar Shitrit , Carolina Jubran Subject: [net 3/7] net/mlx5e: Add missing link mode to ptys2ext_ethtool_map Date: Mon, 9 Sep 2024 12:45:01 -0700 Message-ID: <20240909194505.69715-4-saeed@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240909194505.69715-1-saeed@kernel.org> References: <20240909194505.69715-1-saeed@kernel.org> 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 From: Shahar Shitrit Add MLX5E_400GAUI_8_400GBASE_CR8 to the extended modes in ptys2ext_ethtool_table, since it was missing. Fixes: 6a897372417e ("net/mlx5: ethtool, Add ethtool support for 50Gbps per lane link modes") Signed-off-by: Shahar Shitrit Reviewed-by: Tariq Toukan Reviewed-by: Carolina Jubran Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index 1e829b97eaac..1cf3c54d343e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -208,6 +208,12 @@ void mlx5e_build_ptys2ethtool_map(void) ETHTOOL_LINK_MODE_200000baseLR4_ER4_FR4_Full_BIT, ETHTOOL_LINK_MODE_200000baseDR4_Full_BIT, ETHTOOL_LINK_MODE_200000baseCR4_Full_BIT); + MLX5_BUILD_PTYS2ETHTOOL_CONFIG(MLX5E_400GAUI_8_400GBASE_CR8, ext, + ETHTOOL_LINK_MODE_400000baseKR8_Full_BIT, + ETHTOOL_LINK_MODE_400000baseSR8_Full_BIT, + ETHTOOL_LINK_MODE_400000baseLR8_ER8_FR8_Full_BIT, + ETHTOOL_LINK_MODE_400000baseDR8_Full_BIT, + ETHTOOL_LINK_MODE_400000baseCR8_Full_BIT); MLX5_BUILD_PTYS2ETHTOOL_CONFIG(MLX5E_100GAUI_1_100GBASE_CR_KR, ext, ETHTOOL_LINK_MODE_100000baseKR_Full_BIT, ETHTOOL_LINK_MODE_100000baseSR_Full_BIT, From patchwork Mon Sep 9 19:45:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 13797507 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 155C318A6C9 for ; Mon, 9 Sep 2024 19:45:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725911139; cv=none; b=hfs+WIKtXmUBzay1oRoph84xES1MIkVJk5+TCWVFRtcEs5BQATvQPwXh/j2pYnAIJXH7eJNLayP/NNkm1gcvqdLghHOgyp6VGs5IufeIEZ2OM/xPZpTC//mGJp1Z4Ba4zjPZ8KOMshqICoedFJsywUXcIS15oCxl8QYGwRh/bWY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725911139; c=relaxed/simple; bh=xRhxaGEsT0RO6AqnJjP9ypWip4eZkoZGBzQQmfgCvm0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PpEgeWxMzQV1gvUBaXbJJvq5nB1CLcuQQxi4UaLeO9DsQwTt+BuuCiOIT2OElWc/gRBDiLjuYukvIrlncNeWLH4QuuSf6MU3W32hRyWl3qzxG33r3GqN7VgiWb/xSdNFk2RM5seP3zr/bLHrvqH6cCXWJ/xjtPun96WBNw8CVvo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CZxNELuY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CZxNELuY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78995C4CECB; Mon, 9 Sep 2024 19:45:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725911138; bh=xRhxaGEsT0RO6AqnJjP9ypWip4eZkoZGBzQQmfgCvm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CZxNELuYDnisMqBxPLpajHFK6CEFoKJ+58IZ9kqMhtkTHZd6sRR6A6fwzSh/RcEKC y6I/bcU819ih9I/Hc0zAxUjdtw968upgNf32c9tYynm41gt3EWuE6BNCV7jcM287R0 vryUhZY9TH5jQlfmXrrFyVO8+6KqApR4ydEQ9I8bSfT6vojcrSNAdT57e7qsdqtVKA JEoLb8FBF9Tu5Ap7iH30BMiaplux3zN0Z7wfgo3jerNM8UBgYQYS+yOIJFOnYIigzo dpQmjFAb20nLRzYUpGIs9DotcLZOqVmrAh6xXVsvCIQ6MAw7PeJewArOhThrH5ju8S nx5Msh/7dnT1Q== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Gal Pressman , Leon Romanovsky , Carolina Jubran , Cosmin Ratiu Subject: [net 4/7] net/mlx5: Explicitly set scheduling element and TSAR type Date: Mon, 9 Sep 2024 12:45:02 -0700 Message-ID: <20240909194505.69715-5-saeed@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240909194505.69715-1-saeed@kernel.org> References: <20240909194505.69715-1-saeed@kernel.org> 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 From: Carolina Jubran Ensure the scheduling element type and TSAR type are explicitly initialized in the QoS rate group creation. This prevents potential issues due to default values. Fixes: 1ae258f8b343 ("net/mlx5: E-switch, Introduce rate limiting groups API") Signed-off-by: Carolina Jubran Reviewed-by: Cosmin Ratiu Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c index 20146a2dc7f4..997c412a81af 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c @@ -421,6 +421,7 @@ __esw_qos_create_rate_group(struct mlx5_eswitch *esw, struct netlink_ext_ack *ex { u32 tsar_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {}; struct mlx5_esw_rate_group *group; + __be32 *attr; u32 divider; int err; @@ -428,6 +429,12 @@ __esw_qos_create_rate_group(struct mlx5_eswitch *esw, struct netlink_ext_ack *ex if (!group) return ERR_PTR(-ENOMEM); + MLX5_SET(scheduling_context, tsar_ctx, element_type, + SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR); + + attr = MLX5_ADDR_OF(scheduling_context, tsar_ctx, element_attributes); + *attr = cpu_to_be32(TSAR_ELEMENT_TSAR_TYPE_DWRR << 16); + MLX5_SET(scheduling_context, tsar_ctx, parent_element_id, esw->qos.root_tsar_ix); err = mlx5_create_scheduling_element_cmd(esw->dev, From patchwork Mon Sep 9 19:45:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 13797508 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 C3FA418A924 for ; Mon, 9 Sep 2024 19:45:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725911139; cv=none; b=ZPxoKcv32cS/n3QUiJUyZ4+0dEWtyapJkm8H9X6O/ES/X5I5E6YbQn9REzIqorLjs4/Ylk7irySHgPaZQHTo+xugbuviO7PkrX7nKG6h8ZYmvKMBa9OAxVHFHyjip59h0GdEufrebrm7N2tfY9CxrLeM6zsrMLiYmHahsd7SuJI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725911139; c=relaxed/simple; bh=z/kz6ImD5lMZhncFogsHXy5qjojhj2FCkhIb9vJiMEo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bLY+Gniy345B4xEal93j3Ge2kKNP9OEI5OKkOJwG/+gxMh7oCVs+8E10YvFPo3wdmcdUpnbQ5Jm4NkGGzedJqZmm548gdfgf6RrtSfe0JKgIXBvOb4zOJkFcuKqGhdzArAuJckHRDaJljNZBOrehO39Kpt+E5FQn3N75oVfzc9M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EYyaP0Ri; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EYyaP0Ri" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 510DAC4CEC5; Mon, 9 Sep 2024 19:45:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725911139; bh=z/kz6ImD5lMZhncFogsHXy5qjojhj2FCkhIb9vJiMEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EYyaP0RizrAz4nw4VrteTqvZyBQNkXRJuf9omQW33v5gNvS3xnVe8LJjYhYUiPjCp wuYV11wiMHGJEukCUPxOlUCVXgVxSTVS6+/QQgzEiWidN6d7mLtGh6TcjwES8nRA61 zh2cqcv8W7HPfngexex1lWiEUI7z8BTcBnyOsLdyk9U1AMSLisTkTClv/UwBsRSLZh 71nySy/wDCvmewt+8AWQ0hz5Wk05iWEwMh/jMcB2nrbK17TjRW2lITCHsmfZA3VOh3 Pk8r/JakLBtxWAgOja+Tu6idLlCBegv9hDFp9ex0h01ekHd4a2iYm1A4OASREhE/sm bzQR+rZjzr4ug== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Gal Pressman , Leon Romanovsky , Carolina Jubran , Cosmin Ratiu Subject: [net 5/7] net/mlx5: Add missing masks and QoS bit masks for scheduling elements Date: Mon, 9 Sep 2024 12:45:03 -0700 Message-ID: <20240909194505.69715-6-saeed@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240909194505.69715-1-saeed@kernel.org> References: <20240909194505.69715-1-saeed@kernel.org> 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 From: Carolina Jubran Add the missing masks for supported element types and Transmit Scheduling Arbiter (TSAR) types in scheduling elements. Also, add the corresponding bit masks for these types in the QoS capabilities of a NIC scheduler. Fixes: 214baf22870c ("net/mlx5e: Support HTB offload") Signed-off-by: Carolina Jubran Reviewed-by: Cosmin Ratiu Signed-off-by: Saeed Mahameed --- include/linux/mlx5/mlx5_ifc.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index cab228cf51c6..cfdf984a95a8 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h @@ -1027,7 +1027,8 @@ struct mlx5_ifc_qos_cap_bits { u8 max_tsar_bw_share[0x20]; - u8 reserved_at_100[0x20]; + u8 nic_element_type[0x10]; + u8 nic_tsar_type[0x10]; u8 reserved_at_120[0x3]; u8 log_meter_aso_granularity[0x5]; @@ -3966,6 +3967,7 @@ enum { ELEMENT_TYPE_CAP_MASK_VPORT = 1 << 1, ELEMENT_TYPE_CAP_MASK_VPORT_TC = 1 << 2, ELEMENT_TYPE_CAP_MASK_PARA_VPORT_TC = 1 << 3, + ELEMENT_TYPE_CAP_MASK_QUEUE_GROUP = 1 << 4, }; struct mlx5_ifc_scheduling_context_bits { @@ -4675,6 +4677,12 @@ enum { TSAR_ELEMENT_TSAR_TYPE_ETS = 0x2, }; +enum { + TSAR_TYPE_CAP_MASK_DWRR = 1 << 0, + TSAR_TYPE_CAP_MASK_ROUND_ROBIN = 1 << 1, + TSAR_TYPE_CAP_MASK_ETS = 1 << 2, +}; + struct mlx5_ifc_tsar_element_bits { u8 reserved_at_0[0x8]; u8 tsar_type[0x8]; From patchwork Mon Sep 9 19:45:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 13797509 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 9E30118A6C9 for ; Mon, 9 Sep 2024 19:45:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725911140; cv=none; b=uJD8YRM6wan/grgln76kC5bLaWFoStqhJxLl3yQzuqV867glumJoHMqPztDjIsItu7gOPhsk91iR6n/nLWilrEnS5V0KXpAyH5teMm0bUEDiu5Jn0ZQoUBqCc4PvjEkvDvt5P9ygil2wYQRgzkchJQ/ZHYQ0jmV4RcHMD32AoGc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725911140; c=relaxed/simple; bh=237xFwtgNoWlHrM2Sbqh54nCHY/Xh2KbJPYEq122E7Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HPjgHQQP4Da2QRiQJ2Tz0fe9vSUvpdECuCqDbmShykoREFnd0E0ninsA3OLaftTWCOhS8Zue+CLUXNVTGS08bJeD7ptI//DUzFmv9AOOdDLAGH2ML5Px8y5gb4kLtpnvmrupH8h0lZ4Z9l1DVv0TsFongP+TnW2RoHEnfUJG6dg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CWqcxXB4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CWqcxXB4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A950C4CEC8; Mon, 9 Sep 2024 19:45:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725911140; bh=237xFwtgNoWlHrM2Sbqh54nCHY/Xh2KbJPYEq122E7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CWqcxXB4oZZk0zm8oB9SmMNPhZXFfNL+x1tVQ1/Z7Ub4csH+T8e471bmHl9WAFWDR KesW8zax+Ay3Wcvw6xtLIhNQuTCP1jEJHnc9tHiuYVUeDTIUbOj54vS1BTXJ4sEBxv /jE+fLAEncjKZM9bfZGmH3VEXo1BAbtyhG3f2CcVnoeVObXn7N0b/+7JQBgp89W5tf d2CkRvhBXFtUKoIdxSLKtBSr/LL4JFhpcTR7UmVfqguH6WJZyiYeAJzBQxY1Ks6kxD 4Gr6H/B88/padJ3lflCH5Xfv25XeQAGA/ZAOFcnkiGGWxEmcFcgvBFwCGLZqb425Ro 9KUWp71BBYdRw== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Gal Pressman , Leon Romanovsky , Carolina Jubran , Cosmin Ratiu Subject: [net 6/7] net/mlx5: Verify support for scheduling element and TSAR type Date: Mon, 9 Sep 2024 12:45:04 -0700 Message-ID: <20240909194505.69715-7-saeed@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240909194505.69715-1-saeed@kernel.org> References: <20240909194505.69715-1-saeed@kernel.org> 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 From: Carolina Jubran Before creating a scheduling element in a NIC or E-Switch scheduler, ensure that the requested element type is supported. If the element is of type Transmit Scheduling Arbiter (TSAR), also verify that the specific TSAR type is supported. Fixes: 214baf22870c ("net/mlx5e: Support HTB offload") Fixes: 85c5f7c9200e ("net/mlx5: E-switch, Create QoS on demand") Fixes: 0fe132eac38c ("net/mlx5: E-switch, Allow to add vports to rate groups") Signed-off-by: Carolina Jubran Reviewed-by: Cosmin Ratiu Signed-off-by: Saeed Mahameed --- .../net/ethernet/mellanox/mlx5/core/esw/qos.c | 44 ++++++++++--------- drivers/net/ethernet/mellanox/mlx5/core/qos.c | 7 +++ 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c index 997c412a81af..02a3563f51ad 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c @@ -312,6 +312,25 @@ static int esw_qos_set_group_max_rate(struct mlx5_eswitch *esw, return err; } +static bool esw_qos_element_type_supported(struct mlx5_core_dev *dev, int type) +{ + switch (type) { + case SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR: + return MLX5_CAP_QOS(dev, esw_element_type) & + ELEMENT_TYPE_CAP_MASK_TSAR; + case SCHEDULING_CONTEXT_ELEMENT_TYPE_VPORT: + return MLX5_CAP_QOS(dev, esw_element_type) & + ELEMENT_TYPE_CAP_MASK_VPORT; + case SCHEDULING_CONTEXT_ELEMENT_TYPE_VPORT_TC: + return MLX5_CAP_QOS(dev, esw_element_type) & + ELEMENT_TYPE_CAP_MASK_VPORT_TC; + case SCHEDULING_CONTEXT_ELEMENT_TYPE_PARA_VPORT_TC: + return MLX5_CAP_QOS(dev, esw_element_type) & + ELEMENT_TYPE_CAP_MASK_PARA_VPORT_TC; + } + return false; +} + static int esw_qos_vport_create_sched_element(struct mlx5_eswitch *esw, struct mlx5_vport *vport, u32 max_rate, u32 bw_share) @@ -323,6 +342,9 @@ static int esw_qos_vport_create_sched_element(struct mlx5_eswitch *esw, void *vport_elem; int err; + if (!esw_qos_element_type_supported(dev, SCHEDULING_CONTEXT_ELEMENT_TYPE_VPORT)) + return -EOPNOTSUPP; + parent_tsar_ix = group ? group->tsar_ix : esw->qos.root_tsar_ix; MLX5_SET(scheduling_context, sched_ctx, element_type, SCHEDULING_CONTEXT_ELEMENT_TYPE_VPORT); @@ -533,25 +555,6 @@ static int esw_qos_destroy_rate_group(struct mlx5_eswitch *esw, return err; } -static bool esw_qos_element_type_supported(struct mlx5_core_dev *dev, int type) -{ - switch (type) { - case SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR: - return MLX5_CAP_QOS(dev, esw_element_type) & - ELEMENT_TYPE_CAP_MASK_TSAR; - case SCHEDULING_CONTEXT_ELEMENT_TYPE_VPORT: - return MLX5_CAP_QOS(dev, esw_element_type) & - ELEMENT_TYPE_CAP_MASK_VPORT; - case SCHEDULING_CONTEXT_ELEMENT_TYPE_VPORT_TC: - return MLX5_CAP_QOS(dev, esw_element_type) & - ELEMENT_TYPE_CAP_MASK_VPORT_TC; - case SCHEDULING_CONTEXT_ELEMENT_TYPE_PARA_VPORT_TC: - return MLX5_CAP_QOS(dev, esw_element_type) & - ELEMENT_TYPE_CAP_MASK_PARA_VPORT_TC; - } - return false; -} - static int esw_qos_create(struct mlx5_eswitch *esw, struct netlink_ext_ack *extack) { u32 tsar_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {}; @@ -562,7 +565,8 @@ static int esw_qos_create(struct mlx5_eswitch *esw, struct netlink_ext_ack *exta if (!MLX5_CAP_GEN(dev, qos) || !MLX5_CAP_QOS(dev, esw_scheduling)) return -EOPNOTSUPP; - if (!esw_qos_element_type_supported(dev, SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR)) + if (!esw_qos_element_type_supported(dev, SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR) || + !(MLX5_CAP_QOS(dev, esw_tsar_type) & TSAR_TYPE_CAP_MASK_DWRR)) return -EOPNOTSUPP; MLX5_SET(scheduling_context, tsar_ctx, element_type, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/qos.c index 8bce730b5c5b..db2bd3ad63ba 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/qos.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/qos.c @@ -28,6 +28,9 @@ int mlx5_qos_create_leaf_node(struct mlx5_core_dev *mdev, u32 parent_id, { u32 sched_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {0}; + if (!(MLX5_CAP_QOS(mdev, nic_element_type) & ELEMENT_TYPE_CAP_MASK_QUEUE_GROUP)) + return -EOPNOTSUPP; + MLX5_SET(scheduling_context, sched_ctx, parent_element_id, parent_id); MLX5_SET(scheduling_context, sched_ctx, element_type, SCHEDULING_CONTEXT_ELEMENT_TYPE_QUEUE_GROUP); @@ -44,6 +47,10 @@ int mlx5_qos_create_inner_node(struct mlx5_core_dev *mdev, u32 parent_id, u32 sched_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {0}; void *attr; + if (!(MLX5_CAP_QOS(mdev, nic_element_type) & ELEMENT_TYPE_CAP_MASK_TSAR) || + !(MLX5_CAP_QOS(mdev, nic_tsar_type) & TSAR_TYPE_CAP_MASK_DWRR)) + return -EOPNOTSUPP; + MLX5_SET(scheduling_context, sched_ctx, parent_element_id, parent_id); MLX5_SET(scheduling_context, sched_ctx, element_type, SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR); From patchwork Mon Sep 9 19:45:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 13797510 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 2610F18A948 for ; Mon, 9 Sep 2024 19:45:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725911141; cv=none; b=O9So1kyZma661JMww3fAx/uvvJ76aOhATolqB8VRToMxbK0aF6Hmu86EpQlWNBIo5KxJ8NxOPCJWKervCIp4z+mpwP5E1a8J/Znx8pWF4z1KOdMtfCUDgnSv3kYVZbqZtFmxf0KP5Iyp32Fa8tcHTASi8hzfZjdXm0ijeyfylDE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725911141; c=relaxed/simple; bh=GSLIhyyd+sXZp4rqGdbHtsj57hpJIoOuUyxQaFtgsnI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h1kOlTnywQ31EYEyAoTLACkOfzQrg8OjNqKBv3KprhDCIl2XefgBDq69mnqBStIDezO0Kc9sVUVV5IbamKwhgP5uoMlyZestvHKiRXw1M6mX2zG3VGe31UBF1B55vFoDiBSmHh3b7dSOQWx4oM6K/w8ywTsPB50T+HVxSkcvWYI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FftFEW7K; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FftFEW7K" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFE44C4CEC5; Mon, 9 Sep 2024 19:45:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725911141; bh=GSLIhyyd+sXZp4rqGdbHtsj57hpJIoOuUyxQaFtgsnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FftFEW7KFB/oGaQz4NMKW3TIONKIH40/x8f1jY3mRoS29c0D0QUlgH+/Ed/qKxQTn Q7nY1FYl0OMI9sZ04ceyMaMB+OdSeSIuE973QWtPxzEjS0tkWLMIVJrlEp92OOQ6sK P1ATxtyk0elM9t2O/uhmoeDhawIj31SwdCGGUp4XaIsZzRxv+aNd0Ami2moGxdN+FO g20WBTaXyzIY8XGG173pIeLDBrpMif4VISVetVhsgD9K6p1YqxH4OWW6U/Xf/ilNUe +oCvQhjCGhVYfh2qYf2QoISaLHtsrKzOc8+H5F61OOGAE9TZEpAJtThPHkHWgCJKg1 kwgaIKJ4qfcoA== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Gal Pressman , Leon Romanovsky , Benjamin Poirier , Cosmin Ratiu Subject: [net 7/7] net/mlx5: Fix bridge mode operations when there are no VFs Date: Mon, 9 Sep 2024 12:45:05 -0700 Message-ID: <20240909194505.69715-8-saeed@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240909194505.69715-1-saeed@kernel.org> References: <20240909194505.69715-1-saeed@kernel.org> 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 From: Benjamin Poirier Currently, trying to set the bridge mode attribute when numvfs=0 leads to a crash: bridge link set dev eth2 hwmode vepa [ 168.967392] BUG: kernel NULL pointer dereference, address: 0000000000000030 [...] [ 168.969989] RIP: 0010:mlx5_add_flow_rules+0x1f/0x300 [mlx5_core] [...] [ 168.976037] Call Trace: [ 168.976188] [ 168.978620] _mlx5_eswitch_set_vepa_locked+0x113/0x230 [mlx5_core] [ 168.979074] mlx5_eswitch_set_vepa+0x7f/0xa0 [mlx5_core] [ 168.979471] rtnl_bridge_setlink+0xe9/0x1f0 [ 168.979714] rtnetlink_rcv_msg+0x159/0x400 [ 168.980451] netlink_rcv_skb+0x54/0x100 [ 168.980675] netlink_unicast+0x241/0x360 [ 168.980918] netlink_sendmsg+0x1f6/0x430 [ 168.981162] ____sys_sendmsg+0x3bb/0x3f0 [ 168.982155] ___sys_sendmsg+0x88/0xd0 [ 168.985036] __sys_sendmsg+0x59/0xa0 [ 168.985477] do_syscall_64+0x79/0x150 [ 168.987273] entry_SYSCALL_64_after_hwframe+0x76/0x7e [ 168.987773] RIP: 0033:0x7f8f7950f917 (esw->fdb_table.legacy.vepa_fdb is null) The bridge mode is only relevant when there are multiple functions per port. Therefore, prevent setting and getting this setting when there are no VFs. Note that after this change, there are no settings to change on the PF interface using `bridge link` when there are no VFs, so the interface no longer appears in the `bridge link` output. Fixes: 4b89251de024 ("net/mlx5: Support ndo bridge_setlink and getlink") Signed-off-by: Benjamin Poirier Reviewed-by: Cosmin Ratiu Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c index 255bc8b749f9..8587cd572da5 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c @@ -319,7 +319,7 @@ int mlx5_eswitch_set_vepa(struct mlx5_eswitch *esw, u8 setting) return -EPERM; mutex_lock(&esw->state_lock); - if (esw->mode != MLX5_ESWITCH_LEGACY) { + if (esw->mode != MLX5_ESWITCH_LEGACY || !mlx5_esw_is_fdb_created(esw)) { err = -EOPNOTSUPP; goto out; } @@ -339,7 +339,7 @@ int mlx5_eswitch_get_vepa(struct mlx5_eswitch *esw, u8 *setting) if (!mlx5_esw_allowed(esw)) return -EPERM; - if (esw->mode != MLX5_ESWITCH_LEGACY) + if (esw->mode != MLX5_ESWITCH_LEGACY || !mlx5_esw_is_fdb_created(esw)) return -EOPNOTSUPP; *setting = esw->fdb_table.legacy.vepa_uplink_rule ? 1 : 0;