From patchwork Fri Nov 22 22:45:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13883665 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (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 19C0B18991A for ; Fri, 22 Nov 2024 22:46:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732315593; cv=none; b=jglw9TzwbXDoZl3hRj+hQpZs8HlR1fqD1LdYQbnxFb7/r5dxr3oxhbqLet+EZhfQAZNnEGBfPniFaoEunCxabb1qGXxF0rTU/CuEVIF1GBffFTnSTCSrTQ4fANgclHtRSs5nL9p+0aRUOuoWEwItfW7OltW6SIkeW7s3CCg/+7I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732315593; c=relaxed/simple; bh=2zPxNQex4AKqcSVV1nxttXW8N9gGvK1zQkkPuaAxxmU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Oc42hC7qOKFDRC6L8hKCFIr693oZAqr5YUz1ooQqlFAzzi6lbVGy5XbKdYFdXGDA2v+NC0no9bwZDBTgy5aVqCAGwjfPXq17oWQaB7hW1GkrhlJ8RnBM/UO21YiQNkkLXUWddaXrH++jM6OqCOMBxTJ4948Jv99YQ4LJXhSk/jE= 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=EtkH+zNw; arc=none smtp.client-ip=209.85.222.174 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="EtkH+zNw" Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-7b152a923a3so151486485a.3 for ; Fri, 22 Nov 2024 14:46:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1732315591; x=1732920391; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=W9MEvLA3ulCq6qcBXHH/InNCpijjlgWwIu7JInjaPpA=; b=EtkH+zNw9PtytYi/Za/WCaanUrU1CRxH+RqD8n7bLnbvm97sHDH2toO+4MTI6gR9z4 2prx1dZbYtU3KZXy02zC+RTG9em63oN46zkcLlJDIV4eJnE7qbrbxYmpnknOz4tk64yL DLPHifiabNRVIXgl8hMk8c1Cc8hEcK4w9mbNs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732315591; x=1732920391; h=content-transfer-encoding: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=W9MEvLA3ulCq6qcBXHH/InNCpijjlgWwIu7JInjaPpA=; b=DNBWmPji3AfRtjEzNMscwQRSkyIHpEbOKHkUKPqXGQcisIrQNhmACcRQSqeignwlUu d/pRaiuavjjQYIzyDneC1zeQOFL8w6BpWYBYeS4bFg2jkX7hq0vWj5SMbxw8h6cyGGGQ 4BlMDrn8cZICB3uZ8BT/jyZRGarsStoJvXlPtgEj4AeT9qwZKvQydFu2kK69FoPDgCz2 Ay+NyDw0rcubuX+h/B3JJnB0hbZ4fYYQkyERUvFqgEUO8+Mc/hlzIXRYOisgFVfEQ8Zr 9gQ8yQ+VNFsbZWwUs2vk02zIynDDyB5Ip1Lpfrv0jodnYlDC760jat/G0DqeBnJKjwyu NPVg== X-Gm-Message-State: AOJu0Ywkubcl4j5X695DN0SIgHTNTbLrRvkVN/YgJl8f0BYpdUdfezX8 wysOTsjMwZ/Vi1az1LlcWjBX5iV0Qfcl9BwpTyJwMEnEt6dLacCMMv8QaV5WeQ== X-Gm-Gg: ASbGncvvoJ1YvHnOgUdBkPq35NDY2beMqwAAAOx4LfmODGV0II605ogtjxysiREkC7h i++RqgTnPFftCDZJWZhxVyehEy6aIrcamCtjprxcQW8r8XPsUJVfdrBAD0r2ZZZG3HkRAoGr+fC d+fkMgQ/FQJSysxejaOrSbSYZXbdWHcAyXmyKAw1IENwvmy9LoK3fSS14BGG6Jwy0W+ZmTlUY5f /fLTkM2CU0YRrcKWgBaxdM44FF0ukX4HvHiV6xB3w0mVtZIWEiTPPZpK631VP2mGgIE7SgqRo5r kon2I9xEMOnTb+piiBuvmlgc2Q== X-Google-Smtp-Source: AGHT+IG/X4WBszWRBBcYSyNKhhBlhVTVHGAKvGREF7bkd1SHgwoxYy53345iuqtYjeaaxyG/aJCPHw== X-Received: by 2002:a05:620a:4710:b0:7b1:5311:1379 with SMTP id af79cd13be357-7b514517ef7mr592922185a.16.1732315590907; Fri, 22 Nov 2024 14:46:30 -0800 (PST) Received: from lvnvda3289.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b51415286esm131270485a.101.2024.11.22.14.46.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 14:46:29 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch, pavan.chebbi@broadcom.com, andrew.gospodarek@broadcom.com, Saravanan Vajravel , Somnath Kotur , Kashyap Desai Subject: [PATCH net 1/6] bnxt_en: Reserve rings after PCIe AER recovery if NIC interface is down Date: Fri, 22 Nov 2024 14:45:41 -0800 Message-ID: <20241122224547.984808-2-michael.chan@broadcom.com> X-Mailer: git-send-email 2.43.4 In-Reply-To: <20241122224547.984808-1-michael.chan@broadcom.com> References: <20241122224547.984808-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: Saravanan Vajravel After successful PCIe AER recovery, FW will reset all resource reservations. If it is IF_UP, the driver will call bnxt_open() and all resources will be reserved again. It it is IF_DOWN, we should call bnxt_reserve_rings() so that we can reserve resources including RoCE resources to allow RoCE to resume after AER. Without this patch, RoCE fails to resume in this IF_DOWN scenario. Later, if it becomes IF_UP, bnxt_open() will see that resources have been reserved and will not reserve again. Fixes: fb1e6e562b37 ("bnxt_en: Fix AER recovery.") Reviewed-by: Somnath Kotur Reviewed-by: Pavan Chebbi Reviewed-by: Kashyap Desai Signed-off-by: Saravanan Vajravel Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 5f7bdafcf05d..3eeaceb3ff38 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -16478,8 +16478,12 @@ static void bnxt_io_resume(struct pci_dev *pdev) rtnl_lock(); err = bnxt_hwrm_func_qcaps(bp); - if (!err && netif_running(netdev)) - err = bnxt_open(netdev); + if (!err) { + if (netif_running(netdev)) + err = bnxt_open(netdev); + else + err = bnxt_reserve_rings(bp, true); + } if (!err) netif_device_attach(netdev); From patchwork Fri Nov 22 22:45:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13883666 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) (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 4970119C555 for ; Fri, 22 Nov 2024 22:46:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732315595; cv=none; b=TtkD2e75+BTeDNWj3UWvugHycsqL8UCAjfk0DJBHHWHqlQz+FVUmxMtDvW22RIwxUrP2HGw6QVI+P+Qa4c0AUCsKnBfr7xnAhu2G3KQYlwAxh72kmIpj+on6xeaq+2vp5usMkJBZybWPvoJlO6ieFJKZBj4fmahAeTlxmz16yxA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732315595; c=relaxed/simple; bh=nCua10wF1ZXqxHXsRz26RyX+YXrfgDCsc9r73aRBxKw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Lc7eham54gY93gPk6xftgLEDpC96TgBVYTo0Fiuh+6JCQk5pxtuhYVf+7b8mynFTB//qibxypC5VPkPtKqJwVcPJEmmUkPIdveqmMF3w4TDZ8gXVFIcIMYl4Ar+LAOd3yfy99I7Ytj+r+TQx/QYyXdtPzXIhfsLwqTCwzU5y07A= 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=IrvIh9sw; arc=none smtp.client-ip=209.85.160.180 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="IrvIh9sw" Received: by mail-qt1-f180.google.com with SMTP id d75a77b69052e-460c1ba306bso17739261cf.2 for ; Fri, 22 Nov 2024 14:46:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1732315593; x=1732920393; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=33RedGfU2fSAWyojYapp2Fsg/JW26ZMcQC36AGNOBXE=; b=IrvIh9sw4TrKV7R6gXt/s+fvDf4cxifopdmvXWdlE6vhIaiOppqJK7VE1E4zq164j+ ZbanfLd79fXxg/DvLkoL2k7T/d37ZmCaQmv7JxVkwqB2wtKuxJZ8BzEGDrbPBOWQNIwj a4PL9UTfJBh75u/2IN28DO49/9Cmcrv1FFOPo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732315593; x=1732920393; h=content-transfer-encoding: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=33RedGfU2fSAWyojYapp2Fsg/JW26ZMcQC36AGNOBXE=; b=hRrS5J2UZgy9D2Q3jVuEDlhJA2I1lou0tYTawTQptMNR5VpyAdbJ0yjB6SO1S0LlN6 AlHZIRn7oFa/0NHmDWx2VfBh3Sqp+0OTlr3+gVrGyBcoy1kkGDFn9vDoHKQv059KARi6 iu9MOAa/wpk04MBLhj5owa3MkZvjR8QleB7/vChPKvQXhBb99fQ6URuhJyCzlQOBBu7I vdwxmUOAm8gTsqzx3kWDmjbpYPPuxYbnbV5hyYf3aJ1sQ68bAh1bkUZ7n4Qx+MCNJWH9 DvoXmipHnkYjT6Q0as/d8AuRpUEGJ/bqh8Vacox0ob16UC8lGr9yp2hAoFfCEoahQYoT g0DQ== X-Gm-Message-State: AOJu0YzLDSgt+RCB7oAMTVMGS+WjSoCpTpY5+rTGmEErBPxRgbZp7tUa ogDpOuJ8JH0sIkeMJy7O7IEY7682y2tOnMsxIYx5li+5LBmVz1NBFzBHDYXVog== X-Gm-Gg: ASbGnctZat0TrBR1DODeqRab/H/U+xtHH+9oYWHLRXp31I3J/WssZ6LeB4OfBLsUePX UwJDwwNSyXkVHGKntSxZPopZhmUzdHONpCBJ9VNiOjVw6sbmvvbbWFe3TxN2ZScNlK33n30eZwb D4ujv3iWXlfJrYmcNysw77PQ/MDb03s1+6RIqlwSA/hAKODqajdct62byBhKIuhIx+1USwiRFkq 6JwMqdsVDpdB3ZV4AXBo1U8vi1rujFYzQsbGlIHUw9B12Zdvdp1qEr6Sy4SdEcB0mil0H9JhQML ZxAyAU0y/ENJ6pCGg9QjD4kWyg== X-Google-Smtp-Source: AGHT+IGgAXT6rkQ67a3+v5xcNTM6JlnY7lURzSKKxB7P+hqNlOJkddhaBL6EVYquDKzRZh9f9FsMaQ== X-Received: by 2002:ac8:5fcc:0:b0:460:961e:9996 with SMTP id d75a77b69052e-4653d5222bbmr67313861cf.7.1732315593122; Fri, 22 Nov 2024 14:46:33 -0800 (PST) Received: from lvnvda3289.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b51415286esm131270485a.101.2024.11.22.14.46.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 14:46:32 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch, pavan.chebbi@broadcom.com, andrew.gospodarek@broadcom.com, Shravya KN , Somnath Kotur Subject: [PATCH net 2/6] bnxt_en: Set backplane link modes correctly for ethtool Date: Fri, 22 Nov 2024 14:45:42 -0800 Message-ID: <20241122224547.984808-3-michael.chan@broadcom.com> X-Mailer: git-send-email 2.43.4 In-Reply-To: <20241122224547.984808-1-michael.chan@broadcom.com> References: <20241122224547.984808-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: Shravya KN Use the return value from bnxt_get_media() to determine the port and link modes. bnxt_get_media() returns the proper BNXT_MEDIA_KR when the PHY is backplane. This will correct the ethtool settings for backplane devices. Fixes: 5d4e1bf60664 ("bnxt_en: extend media types to supported and autoneg modes") Reviewed-by: Somnath Kotur Signed-off-by: Shravya KN Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 2f4987ec7464..f1f6bb328a55 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -2837,19 +2837,24 @@ static int bnxt_get_link_ksettings(struct net_device *dev, } base->port = PORT_NONE; - if (link_info->media_type == PORT_PHY_QCFG_RESP_MEDIA_TYPE_TP) { + if (media == BNXT_MEDIA_TP) { base->port = PORT_TP; linkmode_set_bit(ETHTOOL_LINK_MODE_TP_BIT, lk_ksettings->link_modes.supported); linkmode_set_bit(ETHTOOL_LINK_MODE_TP_BIT, lk_ksettings->link_modes.advertising); + } else if (media == BNXT_MEDIA_KR) { + linkmode_set_bit(ETHTOOL_LINK_MODE_Backplane_BIT, + lk_ksettings->link_modes.supported); + linkmode_set_bit(ETHTOOL_LINK_MODE_Backplane_BIT, + lk_ksettings->link_modes.advertising); } else { linkmode_set_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, lk_ksettings->link_modes.supported); linkmode_set_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, lk_ksettings->link_modes.advertising); - if (link_info->media_type == PORT_PHY_QCFG_RESP_MEDIA_TYPE_DAC) + if (media == BNXT_MEDIA_CR) base->port = PORT_DA; else base->port = PORT_FIBRE; From patchwork Fri Nov 22 22:45:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13883667 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (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 5E1E219C555 for ; Fri, 22 Nov 2024 22:46:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732315598; cv=none; b=KTamoXwc+CG7W/vPyBRzmVjNR6WV+fYkODXabVsV95Fa8knCjQY3OZf1r4rPKv9H3hOjIS9uukbmr6KoiOkpeAoHD8XlswPaQzhpoeJbKwC3K23H0YRd9nVc8XoMHrphefnohoMX6bWitbqMBIhq3/NbuOeY3TiR4vZ2yokXqew= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732315598; c=relaxed/simple; bh=gK99FJSKcrUNP7J/Y0KefNeorx8IYmUiKjnMCCaUCqE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AFeTbdAligb38laULfeoGITSl/B7s6iA+mBWNSnWXPws/NoA9rC0GyJPvJjsD012oKdYrw52nr1TTGOE+1OTB7cJHNSnlZpHpMNeKDzhycRBvpOrJNJpKtNzEldSsfgh4+gOsI+uMsjnrDu3dWutHmzypgRHaXl+Gw9HyHF4cSU= 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=Lf5LcwO2; arc=none smtp.client-ip=209.85.222.175 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="Lf5LcwO2" Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-7b14df8f821so191671185a.2 for ; Fri, 22 Nov 2024 14:46:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1732315596; x=1732920396; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Kd2TbHC3KR6JxQsGWET9eP39oCusBe1UWk8/8R8NPco=; b=Lf5LcwO2Dn0ES/EX8v4h7EDJMHJhZJv7Nm9De7gjrPCKsLKbrVashwtZKkmYXnXQJH JXrHlzS1zS2iEdp+cg/7knObqaLY+lO4J/D2Kci3m2t6bUCacuBytCGSQRYcuxjy/cjN Bw8bvEp8K4qJAH1k+QjLF0QbU3+L4IfcZ/5zU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732315596; x=1732920396; h=content-transfer-encoding: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=Kd2TbHC3KR6JxQsGWET9eP39oCusBe1UWk8/8R8NPco=; b=phhzKtaghhUhuIDvHFNcQiIh9vC0E8KLbNL5mkNxZfjwe1EmVJ0OV4y5/gOeG8nsQu p9/0ixyjckaUMjFuNkOd+ZAezXGS+im9d/TBRGwcos4KJ8ArLIjskQz09vPUJj06eS0h CKYPogeTF0KuaYd1bDsBqgv5N2CUEjP0ylQauTIhaHcEz25jVC6pu6UkIGQt3Y0AZj18 qNNc17WwNvEXZy6pdX6yJTK/ym+pdMsgTmSvnba1LEdhUuHQJkvUvR7m0FXkPs/J7dUW FjPN2r2FjNE3kNAJYglUWILpf3XOQ/ahBRnY0+hgsSGmoXYfA8EFamDUNzkMd+tW+gAa WZeA== X-Gm-Message-State: AOJu0YyaxW7uq/8a5Fh0L5hOhkx2b0IugNsL359FrOejMn1EYsLNpHPf FX7h23uktsunhobgk8cpgBND14tyhUk3SBvomX7AkTBg9kpbgThj7XyIgbQ0Ug== X-Gm-Gg: ASbGnct7f7JOA8drudetIup8mY+O4JJf5q8zXbH0ebz/muuFttrBkZX03TBxnre5r+B iLIgh9hTWpNB/6sw7MG2hVzNWW7v0kmoI8jitqX/gFzW80Ht3AL63bA9T/7tkBVLAk3jGfoL9Ap k4NOcGfhsgT1dC/N3aJ4E5FosvAwFdHrtLSRSDtLk87pY78VtOgbiIZxkiiD2RCwNtVQm4BWQ/s ahH8YuS5eCUdD3MB4vzem1Mt5Ik41vqDYb78xYwrauM2dJVHl7PNmmAhQuuJCLkjEZiv1rAGxUc 8kQHV7TThHNKs/GIcN3ivS3aKQ== X-Google-Smtp-Source: AGHT+IGNFBPdurPdlzfNvnYZ/c2/XGIV54bFpwCTGj/7wbhhchMtbmjePciWDmwcyCyQnxsxr3TJZg== X-Received: by 2002:a05:620a:2982:b0:7b1:35a8:774 with SMTP id af79cd13be357-7b51459a49bmr647945785a.52.1732315596106; Fri, 22 Nov 2024 14:46:36 -0800 (PST) Received: from lvnvda3289.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b51415286esm131270485a.101.2024.11.22.14.46.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 14:46:35 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch, pavan.chebbi@broadcom.com, andrew.gospodarek@broadcom.com, Somnath Kotur , David Wei , Kalesh AP Subject: [PATCH net 3/6] bnxt_en: Fix queue start to update vnic RSS table Date: Fri, 22 Nov 2024 14:45:43 -0800 Message-ID: <20241122224547.984808-4-michael.chan@broadcom.com> X-Mailer: git-send-email 2.43.4 In-Reply-To: <20241122224547.984808-1-michael.chan@broadcom.com> References: <20241122224547.984808-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: Somnath Kotur HWRM_RING_FREE followed by a HWRM_RING_ALLOC is not guaranteed to have the same FW ring ID as before. So we must reinitialize the RSS table with the correct ring IDs. Otherwise, traffic may not resume properly if the restarted ring ID is stale. Since this feature is only supported on P5_PLUS chips, we call bnxt_vnic_set_rss_p5() to update the HW RSS table. Fixes: 2d694c27d32e ("bnxt_en: implement netdev_queue_mgmt_ops") Cc: David Wei Reviewed-by: Kalesh AP Reviewed-by: Andy Gospodarek Signed-off-by: Somnath Kotur Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 3eeaceb3ff38..3bee485b50f0 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -15477,6 +15477,13 @@ static int bnxt_queue_start(struct net_device *dev, void *qmem, int idx) for (i = 0; i <= BNXT_VNIC_NTUPLE; i++) { vnic = &bp->vnic_info[i]; + + rc = bnxt_hwrm_vnic_set_rss_p5(bp, vnic, true); + if (rc) { + netdev_err(bp->dev, "hwrm vnic %d set rss failure rc: %d\n", + vnic->vnic_id, rc); + return rc; + } vnic->mru = bp->dev->mtu + ETH_HLEN + VLAN_HLEN; bnxt_hwrm_vnic_update(bp, vnic, VNIC_UPDATE_REQ_ENABLES_MRU_VALID); From patchwork Fri Nov 22 22:45:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13883669 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-vk1-f181.google.com (mail-vk1-f181.google.com [209.85.221.181]) (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 755B018E04C for ; Fri, 22 Nov 2024 22:46:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732315604; cv=none; b=qkNL9p6/X/Y96Ppf9ZdKEzZqJZhPxYjBicpxbS8gzDGpTBwP9wdG10ckiGNCxEQvdx7BRQENhbXzLeTuA3OaH38aEquanx/+0SsGPDoZsFdt/VTLHaBRYYGbVP7s6Mevjq/5DGmFJQ18LPXWhwKxP25C+FnkBGvFSpwpzPZHQas= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732315604; c=relaxed/simple; bh=aKmccEP2i2MAD8yXIiNgPC0TiTRaBByPYLOdBuIetcM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gdOeQ5FJvVbYS/mMQUcG65NUJL2v2XGMg5F2fx2VfzTt5k/pbUDmKNITjCIE6yxA1p1HAJmSXV1WG3Y1VCrLhZQ5piCIl5tVN9aK2wWJ88LH51VpeOSP4xXkfRRXrUdAbq2UTndGvlXqIBuzdOhyX6+c7VP1Xv3OGjSBRFMqrno= 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=JPJ7RabL; arc=none smtp.client-ip=209.85.221.181 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="JPJ7RabL" Received: by mail-vk1-f181.google.com with SMTP id 71dfb90a1353d-514c3c8f150so937312e0c.1 for ; Fri, 22 Nov 2024 14:46:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1732315599; x=1732920399; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fa9bUMYaa23CTuS4iLDGF4dwcnY5Wd7sqofJOGstvYo=; b=JPJ7RabLqS4ETsulChc017IFAUZeMsqbUEUAdAu8j0MsGhvX7LkMHWqerkFvx6wG/L Zz+NbCrfaVp8s9j+0iNOxCBzsvt0pYe3WU4C7Ii60OvLpo5kebnZ06+moPaTp30oYHPu VvfyFqjupq07oqURK8XQZZdN0lZO1E2dsFH+c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732315599; x=1732920399; h=content-transfer-encoding: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=fa9bUMYaa23CTuS4iLDGF4dwcnY5Wd7sqofJOGstvYo=; b=P7CLQQkTSulO65qT6acoFSVddovjHgZKpJ9xl87g/PjIywiT4KMI548vh4gaBgBvQ6 6CZARMqhmobUkZw395lMCHjSqHp2FRVmQpdndu5FJBK93tgVY8NR4QTMEyw/orkfGpwd SjZkWosiQbxItmr/SsZ4h5buRsqpfXx1CI/0zDcGcH4Ct1VFVSoij3802bj2238sHaQP 7C+602XOOhuqTzQD3qdnAd507CdzJGYNHUAaiajjPKb6sQA/UQN+8Ds2DDWg1QiXEs5w /WtAxzWuhZxOJENKLtsO8D/7kHEiwJ/BVLl6/Averf46tsRHLk/CMx8mgt8FnlfXjplb LRcA== X-Gm-Message-State: AOJu0YwEutmyeRkDIEGYvhJAAIlUy7G8/uk8XQLmS2mTbQl2OXzh8Y8N 79V8sQHWuKw23q7XsfBp1A1bHUPAp69U9UczXaMZDDokH5iUkRD4joA55MK/RA== X-Gm-Gg: ASbGncsZq15EAew2ZpJ/5w0XHM9X0vX+yEZuIjDC1k4yALBqklz5tNbZE1kOi0zrAV0 SdhOHVeNShpaVKenpF/z1t1Ippf2CEbqx43AFeK9eAMg0qHzIQZy7ZvMvsmfT7JNJCLu+rZGBKN mZNY3QYeps5K8U8ozECu25Qh9poXw/yrMuVSqTZZCwZ46tNaKIxyB9/IsxPSHK2MDSYyPG7U4WZ cKuNlvJaoHGQWRG9WO1iFCq319/U/5I5DxemdKSWWibHggO6pOS8jMidhtDhn/6SFK2B5wVSH1d JmB7uiHpNp6vB5bYd68zR5NIiw== X-Google-Smtp-Source: AGHT+IEavv1aBG9yv+3JuZfUDuGAm/UUnNZnW1gm1+XQd+T3/RXHR9wO8zKh6DdNZ8aeVJOKhOsfHw== X-Received: by 2002:a05:6122:46a4:b0:50d:4aa2:fa16 with SMTP id 71dfb90a1353d-515009ad36bmr5769941e0c.12.1732315598989; Fri, 22 Nov 2024 14:46:38 -0800 (PST) Received: from lvnvda3289.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b51415286esm131270485a.101.2024.11.22.14.46.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 14:46:38 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch, pavan.chebbi@broadcom.com, andrew.gospodarek@broadcom.com, Shravya KN , Somnath Kotur Subject: [PATCH net 4/6] bnxt_en: Fix receive ring space parameters when XDP is active Date: Fri, 22 Nov 2024 14:45:44 -0800 Message-ID: <20241122224547.984808-5-michael.chan@broadcom.com> X-Mailer: git-send-email 2.43.4 In-Reply-To: <20241122224547.984808-1-michael.chan@broadcom.com> References: <20241122224547.984808-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: Shravya KN The MTU setting at the time an XDP multi-buffer is attached determines whether the aggregation ring will be used and the rx_skb_func handler. This is done in bnxt_set_rx_skb_mode(). If the MTU is later changed, the aggregation ring setting may need to be changed and it may become out-of-sync with the settings initially done in bnxt_set_rx_skb_mode(). This may result in random memory corruption and crashes as the HW may DMA data larger than the allocated buffer size, such as: BUG: kernel NULL pointer dereference, address: 00000000000003c0 PGD 0 P4D 0 Oops: 0000 [#1] PREEMPT SMP NOPTI CPU: 17 PID: 0 Comm: swapper/17 Kdump: loaded Tainted: G S OE 6.1.0-226bf9805506 #1 Hardware name: Wiwynn Delta Lake PVT BZA.02601.0150/Delta Lake-Class1, BIOS F0E_3A12 08/26/2021 RIP: 0010:bnxt_rx_pkt+0xe97/0x1ae0 [bnxt_en] Code: 8b 95 70 ff ff ff 4c 8b 9d 48 ff ff ff 66 41 89 87 b4 00 00 00 e9 0b f7 ff ff 0f b7 43 0a 49 8b 95 a8 04 00 00 25 ff 0f 00 00 <0f> b7 14 42 48 c1 e2 06 49 03 95 a0 04 00 00 0f b6 42 33f RSP: 0018:ffffa19f40cc0d18 EFLAGS: 00010202 RAX: 00000000000001e0 RBX: ffff8e2c805c6100 RCX: 00000000000007ff RDX: 0000000000000000 RSI: ffff8e2c271ab990 RDI: ffff8e2c84f12380 RBP: ffffa19f40cc0e48 R08: 000000000001000d R09: 974ea2fcddfa4cbf R10: 0000000000000000 R11: ffffa19f40cc0ff8 R12: ffff8e2c94b58980 R13: ffff8e2c952d6600 R14: 0000000000000016 R15: ffff8e2c271ab990 FS: 0000000000000000(0000) GS:ffff8e3b3f840000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000000003c0 CR3: 0000000e8580a004 CR4: 00000000007706e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: __bnxt_poll_work+0x1c2/0x3e0 [bnxt_en] To address the issue, we now call bnxt_set_rx_skb_mode() within bnxt_change_mtu() to properly set the AGG rings configuration and update rx_skb_func based on the new MTU value. Additionally, BNXT_FLAG_NO_AGG_RINGS is cleared at the beginning of bnxt_set_rx_skb_mode() to make sure it gets set or cleared based on the current MTU. Fixes: 08450ea98ae9 ("bnxt_en: Fix max_mtu setting for multi-buf XDP") Co-developed-by: Somnath Kotur Signed-off-by: Somnath Kotur Signed-off-by: Shravya KN Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 3bee485b50f0..b7541156fe46 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -4661,7 +4661,7 @@ int bnxt_set_rx_skb_mode(struct bnxt *bp, bool page_mode) struct net_device *dev = bp->dev; if (page_mode) { - bp->flags &= ~BNXT_FLAG_AGG_RINGS; + bp->flags &= ~(BNXT_FLAG_AGG_RINGS | BNXT_FLAG_NO_AGG_RINGS); bp->flags |= BNXT_FLAG_RX_PAGE_MODE; if (bp->xdp_prog->aux->xdp_has_frags) @@ -14740,6 +14740,14 @@ static int bnxt_change_mtu(struct net_device *dev, int new_mtu) bnxt_close_nic(bp, true, false); WRITE_ONCE(dev->mtu, new_mtu); + + /* MTU change may change the AGG ring settings if an XDP multi-buffer + * program is attached. We need to set the AGG rings settings and + * rx_skb_func accordingly. + */ + if (READ_ONCE(bp->xdp_prog)) + bnxt_set_rx_skb_mode(bp, true); + bnxt_set_ring_params(bp); if (netif_running(dev)) From patchwork Fri Nov 22 22:45:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13883668 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) (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 6C89218CC01 for ; Fri, 22 Nov 2024 22:46:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732315604; cv=none; b=nxyX8Ua+N2jy4r2LbjXauNOic1EvGuI9UFy8MkV1CV6K1GZ0JUxXP06pt0SuP1vDWiIb6nQaacCD9zlapeQMgkGjY6IGdnwh1vV4kuAaO2e+ulBja87nORAsm/Bec+iIc1OLVwxmNvHM7/iFHBdqQIhCaAsgW9ej8BqRxet1NLg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732315604; c=relaxed/simple; bh=tpDB/KjwXA76ztECG35BWNye1OarOFtto7jb4FKHLZo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AWpdt7Ufa8vgglrtikP9tUvprpUavzBXNPXTjVcD6VYon4+n5mu3T8A3Wo8MDNd8cvZyQYpXPuonnokHuJhNcUwdSnJi9iEZkQ+/hggudx9DT0zOWY2+HcL/RGNYu43oMRSYMCwmqmkmO9BTEmnb2LsXXkUaMlujZ6jTl5WKgII= 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=FEhjdTjv; arc=none smtp.client-ip=209.85.222.176 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="FEhjdTjv" Received: by mail-qk1-f176.google.com with SMTP id af79cd13be357-7b1488fde46so168496285a.2 for ; Fri, 22 Nov 2024 14:46:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1732315601; x=1732920401; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mgwBv+z+X5JHvhiLz4pnaKO3DgsfjRU+fNdFaB0544g=; b=FEhjdTjvg5xi5jttHKjim/0b1yOK8GzSDh6QdRah758+OM8nvtpkJne8uKjy9/gxTj 2Sd2P4HLRgLDTEH32h0NdhexqAJs3qCYXfztLP+Y6P5RkkYniEzeoBnURqxAR5d3fnuX /uHRiKTbFgtwbtRxHK7BBjSaQi147v2Yysc9k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732315601; x=1732920401; h=content-transfer-encoding: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=mgwBv+z+X5JHvhiLz4pnaKO3DgsfjRU+fNdFaB0544g=; b=ikCCUH8uks6IzSILqcfRTIXVtIWtHeeuJawhzFzT3jE+iLCDnsxke+psLZb7nXlfEK 0PbbnZstvB/S4fUA8ZyxDr5AEuGX7bcyBA3TS+zbdd9n8igQj7cSZN5RRnHED1lu/QF1 BcD1el7+T3N81LrYy0dgaw+pi9Cf0JYFeFKPWcFfys8moyMQ1oXC2AzqSc0tuzwQ88f7 JJOp0R77W+wmPphw/9qZAl+Zm8Q8OyPVPr8ghe3DnOQNuKvBDNpddPlqGWsWvLPVGaAX JP76GkJ9DgI6i15AHy3H84VyOo51w12KMtxjkEWRrEcUI38Gc3sTSJ+8H/hym0GWlZJE UiVQ== X-Gm-Message-State: AOJu0YwlvkV/ZlRMOs598+lzQTEbJBvHgeJ+OC/RZDXEN6pgSzk/lMbk 05bm6+9YgiWWiz3zMtZ2Snc8ANEh63Mx05IhrwjRXnY2zWrPKHzMf10P7OSlzQ== X-Gm-Gg: ASbGnctMztMhvXPbvXo4RpHHWxFF+Wd1sizvw+742bfo2lKxgG8+lXsg51h20cuebqr kBfQjVa8qqJI2gzhUFpyxgTb+iZSqZFQCeACtFlndvpieNPxm7TYdPvbK4Z4Ihr22OV51RjlBMp cT914rYEycaK9D8X5wbNkvMTvMYpubrrTB4wPy9upA24djYeRbgaWFx9gl/JlC2QUXrnF3VbnTP hKUufP8w+CdEChmD3S+OdGKizHtWvel9WcxgolNj/nqUQJA99fzO3NYTJ4Wtr6+y/jl7h+HCQ+W 8jg1NRM1ArNBXJ38RYSbl7bkuw== X-Google-Smtp-Source: AGHT+IHaxk0crG0vc0RCYHbNvUcnG8kFVlWMyKR8uUN6MouTs53sNGNEl2P/AbIafHwLo0GTr5De9g== X-Received: by 2002:a05:620a:24d6:b0:7ac:b197:3004 with SMTP id af79cd13be357-7b514516442mr566788785a.29.1732315601219; Fri, 22 Nov 2024 14:46:41 -0800 (PST) Received: from lvnvda3289.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b51415286esm131270485a.101.2024.11.22.14.46.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 14:46:40 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch, pavan.chebbi@broadcom.com, andrew.gospodarek@broadcom.com, Somnath Kotur , Kalesh AP Subject: [PATCH net 5/6] bnxt_en: Refactor bnxt_ptp_init() Date: Fri, 22 Nov 2024 14:45:45 -0800 Message-ID: <20241122224547.984808-6-michael.chan@broadcom.com> X-Mailer: git-send-email 2.43.4 In-Reply-To: <20241122224547.984808-1-michael.chan@broadcom.com> References: <20241122224547.984808-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 Instead of passing the 2nd parameter phc_cfg to bnxt_ptp_init(). Store it in bp->ptp_cfg so that the caller doesn't need to know what the value should be. In the next patch, we'll need to call bnxt_ptp_init() in bnxt_resume() and this will make it easier. Reviewed-by: Somnath Kotur Reviewed-by: Pavan Chebbi Reviewed-by: Kalesh AP Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 +++--- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 4 ++-- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index b7541156fe46..9c4b8ea22bf9 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -9296,7 +9296,6 @@ static int __bnxt_hwrm_ptp_qcfg(struct bnxt *bp) struct hwrm_port_mac_ptp_qcfg_output *resp; struct hwrm_port_mac_ptp_qcfg_input *req; struct bnxt_ptp_cfg *ptp = bp->ptp_cfg; - bool phc_cfg; u8 flags; int rc; @@ -9343,8 +9342,9 @@ static int __bnxt_hwrm_ptp_qcfg(struct bnxt *bp) rc = -ENODEV; goto exit; } - phc_cfg = (flags & PORT_MAC_PTP_QCFG_RESP_FLAGS_RTC_CONFIGURED) != 0; - rc = bnxt_ptp_init(bp, phc_cfg); + ptp->rtc_configured = + (flags & PORT_MAC_PTP_QCFG_RESP_FLAGS_RTC_CONFIGURED) != 0; + rc = bnxt_ptp_init(bp); if (rc) netdev_warn(bp->dev, "PTP initialization failed.\n"); exit: diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c index 075ccd589845..2d4e19b96ee7 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c @@ -1038,7 +1038,7 @@ static void bnxt_ptp_free(struct bnxt *bp) } } -int bnxt_ptp_init(struct bnxt *bp, bool phc_cfg) +int bnxt_ptp_init(struct bnxt *bp) { struct bnxt_ptp_cfg *ptp = bp->ptp_cfg; int rc; @@ -1061,7 +1061,7 @@ int bnxt_ptp_init(struct bnxt *bp, bool phc_cfg) if (BNXT_PTP_USE_RTC(bp)) { bnxt_ptp_timecounter_init(bp, false); - rc = bnxt_ptp_init_rtc(bp, phc_cfg); + rc = bnxt_ptp_init_rtc(bp, ptp->rtc_configured); if (rc) goto out; } else { diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h index c7851f8c971c..a95f05e9c579 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h @@ -135,6 +135,7 @@ struct bnxt_ptp_cfg { BNXT_PTP_MSG_PDELAY_REQ | \ BNXT_PTP_MSG_PDELAY_RESP) u8 tx_tstamp_en:1; + u8 rtc_configured:1; int rx_filter; u32 tstamp_filters; @@ -168,7 +169,7 @@ void bnxt_tx_ts_cmp(struct bnxt *bp, struct bnxt_napi *bnapi, struct tx_ts_cmp *tscmp); void bnxt_ptp_rtc_timecounter_init(struct bnxt_ptp_cfg *ptp, u64 ns); int bnxt_ptp_init_rtc(struct bnxt *bp, bool phc_cfg); -int bnxt_ptp_init(struct bnxt *bp, bool phc_cfg); +int bnxt_ptp_init(struct bnxt *bp); void bnxt_ptp_clear(struct bnxt *bp); static inline u64 bnxt_timecounter_cyc2time(struct bnxt_ptp_cfg *ptp, u64 ts) { From patchwork Fri Nov 22 22:45:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13883670 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (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 807971C82E2 for ; Fri, 22 Nov 2024 22:46:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732315607; cv=none; b=vGu3qXYCA1ptUhjAEj5s6DhuY71FzsbukmCovKDp2cUtha3Y4t5y0u+Pdi0MJU22a9S+8cZx4eto7hUhn3PthOcdy4x/kdyCUGDgThVyJVtuLSiuIBujLlbqQ7CALsF12PTbuj6WqsAnhcyn2V1tF1yKabGIaDKQb8PeX4x2nOA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732315607; c=relaxed/simple; bh=1q5zLrnZJW56EyQTUXvvpBXyQYjs2OSOzVe5FaV/f2M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G83I3+CbXchEmp8Q9PNuLgSV3ISrR5fhwXC2o798ihRm+e2arYgaGxZUyEoA9LhpaqtMf9QEhs7P2zPRN6VORh/0A/XVLxWp/9ZeheBB5joUzrqu6T4a4QWNxa5JTzge6doWmspJW+W2FQKgv9RHPNuRNmfwBkgOjEQyx3PDl5g= 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=hMuQo6Wy; arc=none smtp.client-ip=209.85.222.178 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="hMuQo6Wy" Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-7b15eadee87so161194385a.2 for ; Fri, 22 Nov 2024 14:46:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1732315604; x=1732920404; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qiui2rhF5hwfw95QrNuMUjSYZHJH7nfqV7xul9WK8TE=; b=hMuQo6Wyzlm5doscM4SUb/Xd8OTWDbZbZdHFxQ34cmBuaqBcAaw4yUiSWvwm7snIA6 8DObx26WFn7hygO7hz3rQP5afexpAcsos6y7WVa9Bexq3VvoUG+WWJ9CbeEPp8o4/gtL 3gcYJgl4Bq+q3uwFURfKobl8fhfd9+jz6HQxE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732315604; x=1732920404; h=content-transfer-encoding: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=qiui2rhF5hwfw95QrNuMUjSYZHJH7nfqV7xul9WK8TE=; b=q23NdFP+oypvBkeYkM1we5T4lkGULwOm2zhT9Rs1cfoQmTZaANd/hAkI9zWtP16udy yMEYnCy8Rf+BBD8WO7+G0zot3An3CSamL805hqFfLrkLZgtrR4Yu40XTULbagmk8gEU7 nxwHjBE3Y9FlI2NCManGjUDItLjVDk85Ceo3nz/WFVntcndu9j4SlCoxdnUj73JNw+JX /le89/Lsl8jem+eebsRL9js7uAsC4mwmubEnDK/E6OhrIBpOmxPjG76E36so//HisZ6y yHvtj4QDTla3H6JkxtmN/nhxdhOyWUSHM4VLTHEi7lNbk9iFuX1HCGFGe/awGMeep69G txjg== X-Gm-Message-State: AOJu0YxngOWZl4s0nUWXHknAJtA4I/9wdRCA9rDppzThb0Vmb46XNcsk WDr0ns5a0uuwWGJIFEK8vAc0rVKYfLgtkCPl1NiELV3gJKMlV5yMxZ6B3RmF1g== X-Gm-Gg: ASbGnctiJZ4DazujYMi8Gdnt8dFB+D39jWEaAhHvXsekMXoTZtyyvpGif+kgXp8zhI1 SS7XFXIqW0ygg4uiPyYtHK7L/4TNvKDt2h1InidmdtMcNcUgoOvZ5KwemFVCo9Lcq7u9Px7O11Q bdT3yYA42lIb/W0PSDgBlsMEu8hs6SWG5dFcmzslKrC9nkl10ior33xqmRW3BoUwJJ4uU2PvFTd JxRl9F79oPufSdFfzgQxdzZ+1nxu3YILhkhtsUIeW6RLPLVQGCBbrniQTXcWpHGDq8m5xRTx+rf 3KrHlL9m72y15y/d9xKOIE/FpQ== X-Google-Smtp-Source: AGHT+IHhaGFFLD32oZ7w3xXSJEIU1ksA4ISgD6HIjDnEB6L2mqYvtJBQue7UdF6fGy/M+2G/rEd8Fg== X-Received: by 2002:a05:620a:2416:b0:7b1:11ac:627a with SMTP id af79cd13be357-7b514513d9dmr728992885a.25.1732315604211; Fri, 22 Nov 2024 14:46:44 -0800 (PST) Received: from lvnvda3289.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b51415286esm131270485a.101.2024.11.22.14.46.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 14:46:43 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch, pavan.chebbi@broadcom.com, andrew.gospodarek@broadcom.com, Richard Cochran , Somnath Kotur , Kalesh AP Subject: [PATCH net 6/6] bnxt_en: Unregister PTP during PCI shutdown and suspend Date: Fri, 22 Nov 2024 14:45:46 -0800 Message-ID: <20241122224547.984808-7-michael.chan@broadcom.com> X-Mailer: git-send-email 2.43.4 In-Reply-To: <20241122224547.984808-1-michael.chan@broadcom.com> References: <20241122224547.984808-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 If we go through the PCI shutdown or suspend path, we shutdown the NIC but PTP remains registered. If the kernel continues to run for a little bit, the periodic PTP .do_aux_work() function may be called and it will read the PHC from the BAR register. Since the device has already been disabled, it will cause a PCIe completion timeout. Fix it by calling bnxt_ptp_clear() in the PCI shutdown/suspend handlers. bnxt_ptp_clear() will unregister from PTP and .do_aux_work() will be canceled. In bnxt_resume(), we need to re-initialize PTP. Fixes: a521c8a01d26 ("bnxt_en: Move bnxt_ptp_init() from bnxt_open() back to bnxt_init_one()") Cc: Richard Cochran Reviewed-by: Somnath Kotur Reviewed-by: Pavan Chebbi Reviewed-by: Kalesh AP Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 9c4b8ea22bf9..57e69c0552ab 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -16245,6 +16245,7 @@ static void bnxt_shutdown(struct pci_dev *pdev) if (netif_running(dev)) dev_close(dev); + bnxt_ptp_clear(bp); bnxt_clear_int_mode(bp); pci_disable_device(pdev); @@ -16272,6 +16273,7 @@ static int bnxt_suspend(struct device *device) rc = bnxt_close(dev); } bnxt_hwrm_func_drv_unrgtr(bp); + bnxt_ptp_clear(bp); pci_disable_device(bp->pdev); bnxt_free_ctx_mem(bp, false); rtnl_unlock(); @@ -16315,6 +16317,10 @@ static int bnxt_resume(struct device *device) if (bp->fw_crash_mem) bnxt_hwrm_crash_dump_mem_cfg(bp); + if (bnxt_ptp_init(bp)) { + kfree(bp->ptp_cfg); + bp->ptp_cfg = NULL; + } bnxt_get_wol_settings(bp); if (netif_running(dev)) { rc = bnxt_open(dev);