From patchwork Tue Apr 9 21:54:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13623278 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3654158A3D for ; Tue, 9 Apr 2024 21:54:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712699694; cv=none; b=RAjdDrUHM3C1vHyVLncKQy7FzKymTnruHWBmMzIyC1yzYPQteR0l5+pMQDbuSX28m+EUbkQ6nVDmTHXQrWjNWniVh3vECa5tXA3eESJs3k6WgMiZTN3cr7eE0yhBX6AcWdAAgBt5XQE67YvNerjcNIExUQx4oRZLKT2j8i2iLyI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712699694; c=relaxed/simple; bh=MEcnLix/Wd8btksbaTEI1TFpQnqkUrXYBAqaUSBtqX0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=OdwcL4MpAj3/2ses4bzO/U//j6eZHKOaFn3mZP+4IPkD/4QvA+VYfIG4bZqcOSn44QBKZy800oproXUtLVhAevQoUYozuW2+G2bk/5RpShFSYkEKBgFkePgbvWy+9yMd9VwYBzzV63ddCtuCluqUutjtGIBDtQIVB8WOreDBlDE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=JrY/TPDl; arc=none smtp.client-ip=209.85.210.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="JrY/TPDl" Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-6ed20fb620fso2528906b3a.2 for ; Tue, 09 Apr 2024 14:54:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1712699692; x=1713304492; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=PtvFd6Kd77nn+odLvoUqL485YQW3L+mJmJZAOAl7TeI=; b=JrY/TPDlHcdexSqhrXUXkFbzrhnZ4ug+IdY8rCYX/2EF9LQ9IbH5qt5H7hAVcsLJIr LgjrlsW11tmpkcp/vrJor+huuQSAgCncBKqpAZlk5hGys+Cmm71qy/vmPCyhP1iEH0v6 mdjrVS+76ZOYVqp9QXozshFsokXELQzG2AFLw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712699692; x=1713304492; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PtvFd6Kd77nn+odLvoUqL485YQW3L+mJmJZAOAl7TeI=; b=PQ8lbGH3bjzHoZjspq/o9T0zMltWhbD2DHImshVuRyWRywqFQOnHTbZaPmZY4sP2px X9HfEZpfN5DGpUdz3ncSsnevLL7JnOYUUrevFE7vKk0EA87U3A66JanWMJqHgK44+P5h pNBasaNob95yEHwwacJCVZPp2rAw8vo41sHnaGC/CKBJ/cdMp+NnCKD38WfJW9XOARzd k/tv5wyjhWDcJJYh/77qznjS3lPBU560sJkFfb44pbCUfQ1X8UpRAVGACL3aFTTUzity UFtv+nAl8k0B4ar8eqJjGXPiOJ6HHDv4MPfhMAUZWILDOxPKPPVAHPvI4YpTIpMm6Iaj o7Gw== X-Gm-Message-State: AOJu0Yw4eTWQVo2JJ0yPN1us7bBSUcKk4AWyOKACOVYPjvmae5Pap8oD 5xhlgG+QNfQhHg68T8Fi3ym2NPE9QzDbgTO5ykw30i9Z0k8NeR3UGwyhN19eJA== X-Google-Smtp-Source: AGHT+IGbbShBvkhRClt03D5IbuzG33Tnekn3MK4sRkKtU0hTDXyTdcH1Y4W52yNFHzRRjRQb3oiegw== X-Received: by 2002:a05:6a21:7894:b0:1a7:4b40:96db with SMTP id bf20-20020a056a21789400b001a74b4096dbmr1269966pzc.10.1712699691993; Tue, 09 Apr 2024 14:54:51 -0700 (PDT) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b001e3e081dea1sm6983687plb.0.2024.04.09.14.54.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2024 14:54:51 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, pavan.chebbi@broadcom.com, andrew.gospodarek@broadcom.com, Kalesh AP , Somnath Kotur Subject: [PATCH net-next 1/7] bnxt_en: Skip ethtool RSS context configuration in ifdown state Date: Tue, 9 Apr 2024 14:54:25 -0700 Message-Id: <20240409215431.41424-2-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20240409215431.41424-1-michael.chan@broadcom.com> References: <20240409215431.41424-1-michael.chan@broadcom.com> 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: Pavan Chebbi The current implementation requires the ifstate to be up when configuring the RSS contexts. It will try to fetch the RX ring IDs and will crash if it is in ifdown state. Return error if !netif_running() to prevent the crash. An improved implementation is in the works to allow RSS contexts to be changed while in ifdown state. Fixes: b3d0083caf9a ("bnxt_en: Support RSS contexts in ethtool .{get|set}_rxfh()") Reviewed-by: Kalesh AP Reviewed-by: Somnath Kotur Signed-off-by: Pavan Chebbi Signed-off-by: Michael Chan Reviewed-by: Jacob Keller --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 9c49f629d565..68444234b268 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -1876,6 +1876,11 @@ static int bnxt_set_rxfh_context(struct bnxt *bp, return -EOPNOTSUPP; } + if (!netif_running(bp->dev)) { + NL_SET_ERR_MSG_MOD(extack, "Unable to set RSS contexts when interface is down"); + return -EAGAIN; + } + if (*rss_context != ETH_RXFH_CONTEXT_ALLOC) { rss_ctx = bnxt_get_rss_ctx_from_index(bp, *rss_context); if (!rss_ctx) {