diff mbox series

[net,1/5] eth: bnxt: reject unsupported hash functions

Message ID 20240725222353.2993687-2-kuba@kernel.org (mailing list archive)
State Accepted
Commit daefd348a5938d2256d304b57a9e787a83bb58d9
Delegated to: Netdev Maintainers
Headers show
Series ethtool: more RSS fixes | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 42 this patch: 42
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 43 this patch: 43
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 44 this patch: 44
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 30 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-07-26--15-00 (tests: 707)

Commit Message

Jakub Kicinski July 25, 2024, 10:23 p.m. UTC
In commit under Fixes I split the bnxt_set_rxfh_context() function,
and attached the appropriate chunks to new ops. I missed that
bnxt_set_rxfh_context() gets called after some initial checks
in bnxt_set_rxfh(), namely that the hash function is Toeplitz.

Fixes: 5c466b4d4e75 ("eth: bnxt: move from .set_rxfh to .create_rxfh_context and friends")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Pavan Chebbi July 26, 2024, 6:16 a.m. UTC | #1
On Fri, Jul 26, 2024 at 3:54 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> In commit under Fixes I split the bnxt_set_rxfh_context() function,
> and attached the appropriate chunks to new ops. I missed that
> bnxt_set_rxfh_context() gets called after some initial checks
> in bnxt_set_rxfh(), namely that the hash function is Toeplitz.
>
> Fixes: 5c466b4d4e75 ("eth: bnxt: move from .set_rxfh to .create_rxfh_context and friends")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
>  drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
> index d00ef0063820..0425a54eca98 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
> @@ -1863,8 +1863,14 @@ static void bnxt_modify_rss(struct bnxt *bp, struct ethtool_rxfh_context *ctx,
>  }
>
>  static int bnxt_rxfh_context_check(struct bnxt *bp,
> +                                  const struct ethtool_rxfh_param *rxfh,
>                                    struct netlink_ext_ack *extack)
>  {
> +       if (rxfh->hfunc && rxfh->hfunc != ETH_RSS_HASH_TOP) {
> +               NL_SET_ERR_MSG_MOD(extack, "RSS hash function not supported");
> +               return -EOPNOTSUPP;
> +       }
> +
>         if (!BNXT_SUPPORTS_MULTI_RSS_CTX(bp)) {
>                 NL_SET_ERR_MSG_MOD(extack, "RSS contexts not supported");
>                 return -EOPNOTSUPP;
> @@ -1888,7 +1894,7 @@ static int bnxt_create_rxfh_context(struct net_device *dev,
>         struct bnxt_vnic_info *vnic;
>         int rc;
>
> -       rc = bnxt_rxfh_context_check(bp, extack);
> +       rc = bnxt_rxfh_context_check(bp, rxfh, extack);
>         if (rc)
>                 return rc;
>
> @@ -1953,7 +1959,7 @@ static int bnxt_modify_rxfh_context(struct net_device *dev,
>         struct bnxt_rss_ctx *rss_ctx;
>         int rc;
>
> -       rc = bnxt_rxfh_context_check(bp, extack);
> +       rc = bnxt_rxfh_context_check(bp, rxfh, extack);
>         if (rc)
>                 return rc;
>
> --
> 2.45.2
>
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>

Thank you.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
index d00ef0063820..0425a54eca98 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
@@ -1863,8 +1863,14 @@  static void bnxt_modify_rss(struct bnxt *bp, struct ethtool_rxfh_context *ctx,
 }
 
 static int bnxt_rxfh_context_check(struct bnxt *bp,
+				   const struct ethtool_rxfh_param *rxfh,
 				   struct netlink_ext_ack *extack)
 {
+	if (rxfh->hfunc && rxfh->hfunc != ETH_RSS_HASH_TOP) {
+		NL_SET_ERR_MSG_MOD(extack, "RSS hash function not supported");
+		return -EOPNOTSUPP;
+	}
+
 	if (!BNXT_SUPPORTS_MULTI_RSS_CTX(bp)) {
 		NL_SET_ERR_MSG_MOD(extack, "RSS contexts not supported");
 		return -EOPNOTSUPP;
@@ -1888,7 +1894,7 @@  static int bnxt_create_rxfh_context(struct net_device *dev,
 	struct bnxt_vnic_info *vnic;
 	int rc;
 
-	rc = bnxt_rxfh_context_check(bp, extack);
+	rc = bnxt_rxfh_context_check(bp, rxfh, extack);
 	if (rc)
 		return rc;
 
@@ -1953,7 +1959,7 @@  static int bnxt_modify_rxfh_context(struct net_device *dev,
 	struct bnxt_rss_ctx *rss_ctx;
 	int rc;
 
-	rc = bnxt_rxfh_context_check(bp, extack);
+	rc = bnxt_rxfh_context_check(bp, rxfh, extack);
 	if (rc)
 		return rc;