Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp123097lqo; Thu, 9 May 2024 14:51:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV7V3XcntY0JZBdLax2s/ptPZz1TAX51hsgJpoGLYutOKVosL0Ts/I0MSbjdn8S2d5ke99rc/p9RS7zrqinhetjt3Sjp1Zd8RPIF5pjTw== X-Google-Smtp-Source: AGHT+IEnyIWA/dCNPIG+tiUz+1bhiwI76sy8Ml7RkGL0aWMl+z6+pPPxHafsUHCm9OkFJdPANDpf X-Received: by 2002:a17:902:b18b:b0:1e7:8d21:7fd7 with SMTP id d9443c01a7336-1ef43e37b35mr9432415ad.28.1715291470691; Thu, 09 May 2024 14:51:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715291470; cv=pass; d=google.com; s=arc-20160816; b=M72XU+VVo3KS9+aYAEEzAITjHIf35o1A5FsKJhcjBILbZ6qmCJHZKqK8Q5gi4cQOkR mkIUF6NygDCNL72DYPUr4I7JsJrQnXUizaWnBFLS/3sPk2IEU1Bdb9UaAjH81UQUrHjy +IiuHk8Ha1UJz8R9REmdI9n7oiDw7sYvj/0n7puF1F/yAAgmByk99Ii/U9l64INhqCu3 hUpo0Xar/r6Eh9gyeR+96uPOqedRsRwqr6iv14EvNTgxjN6Bor4ZsCPHPZtRIg3SAzN/ tbF4WiweHKagHSEJtZ5Coj3DuHwJjmHxJJjbzyM6hP5qg21s9k0ipTsXgocqmTfHKsqe SrIA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature:message-id; bh=x7hxte+yN2kBW0kbRz2/Qi+5X2Kn+BAGAuWpBF10X3k=; fh=0kGOI4AYKruHg/AIIXLiBX2o88oLjVa8Sxbb5EIAatI=; b=hg1lLLmIv9Ggk0HGaOXRpb85oG2F63eFnhqZ80fcZoCHTXdlAj4uXasv7dr3MFSObh K0gBe3Pr8GY+g782gSY9f4vsvhb1uRFdn3jEYMLKA/QxExD1rc1CoY3oPEcc2gGBxTkO JnqDP1kPg/jRLpsHtTkmq197qidUarFgsnvXFjTJjpwb6hrF/E/uC3lXlOU70xyBeQ8Q 9MtVBszHhwrSlX8HjGwCK6PDfohXk4U8VNyUKWZefT/1T7hxS2ZmxFMZRqOwvlpYpLNw ayIY42OxZxIol8MM+hwUxy8Pxr2P3KEB2vkjhJY/n2YOlMXGl6Bbk1rjV3QNZ3sThPsq luZw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=DKjs52i4; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-175012-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175012-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0c138755si22925555ad.451.2024.05.09.14.51.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 14:51:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-175012-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=DKjs52i4; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-175012-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175012-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id ACC61B21E46 for ; Thu, 9 May 2024 21:51:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D114E1292F2; Thu, 9 May 2024 21:50:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="DKjs52i4" Received: from out-189.mta1.migadu.com (out-189.mta1.migadu.com [95.215.58.189]) (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 DFC4282871 for ; Thu, 9 May 2024 21:50:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715291458; cv=none; b=I/xDxnpbjJwQRaLj/2JPB9mFPnQQXTILTSalNtjY1fu8vKs+JPZDfSA068HIJasQVQqgfLBxKW4IlJ+7BbTUo2zU43TSVFM8gE7EfZMP7APlWdIPEKwAIqc0fsTqJ3WHzoTe94GYYQRjxTHc+PsBDpDLe/gWoo0oXPsM4EhdTBg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715291458; c=relaxed/simple; bh=bb0dF2CqfEI2bRgZH2VWNgit4IJI5S1YcgCig5aMvZY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=n7S9Yte83VeCLcGtDDQG+uk3N7l+4/cYTbLslFf+6v3FkgeGRkgGSeLC+4RuXj4Czgm3o0c4UvAjGfVK5BJMPu5gjnXdQ14RQywrwfheDwcF4I57Yy6QefgPEZ4wAcxsR4sQrkQKM+94CekmcWtl71eTrMmKXR3JTYoVB90CRjc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=DKjs52i4; arc=none smtp.client-ip=95.215.58.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: <868a4758-2873-4ede-83e5-65f42cb12b81@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1715291453; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x7hxte+yN2kBW0kbRz2/Qi+5X2Kn+BAGAuWpBF10X3k=; b=DKjs52i4jmyGtfwbwo/aDOO4scg7otP0xU9TesqQGHy3gR0RiG3HaMz+xQsYejHm8aO2/B jFwXbjrXnl34x8jZp8VRWC+NcXZVXpB4MYP7+cT1ef15sDfmcRZyz5XFX6PTxNDb/3sYz1 pJrwqVEcTl3s5FjsazqJS9FAcaRN7Ow= Date: Thu, 9 May 2024 22:50:46 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH V1 8/9] bnxt_en: Add TPH support in BNXT driver To: Wei Huang , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, netdev@vger.kernel.org Cc: bhelgaas@google.com, corbet@lwn.net, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, alex.williamson@redhat.com, gospo@broadcom.com, michael.chan@broadcom.com, ajit.khaparde@broadcom.com, manoj.panicker2@amd.com, Eric.VanTassell@amd.com References: <20240509162741.1937586-1-wei.huang2@amd.com> <20240509162741.1937586-9-wei.huang2@amd.com> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Vadim Fedorenko In-Reply-To: <20240509162741.1937586-9-wei.huang2@amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 09/05/2024 17:27, Wei Huang wrote: > From: Manoj Panicker > > As a usage example, this patch implements TPH support in Broadcom BNXT > device driver by invoking pcie_tph_set_st() function when interrupt > affinity is changed. > > Reviewed-by: Ajit Khaparde > Reviewed-by: Andy Gospodarek > Reviewed-by: Wei Huang > Signed-off-by: Manoj Panicker > --- > drivers/net/ethernet/broadcom/bnxt/bnxt.c | 51 +++++++++++++++++++++++ > drivers/net/ethernet/broadcom/bnxt/bnxt.h | 4 ++ > 2 files changed, 55 insertions(+) > > diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c > index 2c2ee79c4d77..be9c17566fb4 100644 > --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c > +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c > @@ -55,6 +55,7 @@ > #include > #include > #include > +#include > > #include "bnxt_hsi.h" > #include "bnxt.h" > @@ -10491,6 +10492,7 @@ static void bnxt_free_irq(struct bnxt *bp) > free_cpumask_var(irq->cpu_mask); > irq->have_cpumask = 0; > } > + irq_set_affinity_notifier(irq->vector, NULL); > free_irq(irq->vector, bp->bnapi[i]); > } > > @@ -10498,6 +10500,45 @@ static void bnxt_free_irq(struct bnxt *bp) > } > } > > +static void bnxt_rtnl_lock_sp(struct bnxt *bp); > +static void bnxt_rtnl_unlock_sp(struct bnxt *bp); > +static void bnxt_irq_affinity_notify(struct irq_affinity_notify *notify, > + const cpumask_t *mask) > +{ > + struct bnxt_irq *irq; > + > + irq = container_of(notify, struct bnxt_irq, affinity_notify); > + cpumask_copy(irq->cpu_mask, mask); > + > + if (!pcie_tph_set_st(irq->bp->pdev, irq->msix_nr, > + cpumask_first(irq->cpu_mask), > + TPH_MEM_TYPE_VM, PCI_TPH_REQ_TPH_ONLY)) > + pr_err("error in configuring steering tag\n"); > + > + if (netif_running(irq->bp->dev)) { > + rtnl_lock(); > + bnxt_close_nic(irq->bp, false, false); > + bnxt_open_nic(irq->bp, false, false); > + rtnl_unlock(); > + } Is it really needed? It will cause link flap and pause in the traffic service for the device. Why the device needs full restart in this case? > +} > + > +static void bnxt_irq_affinity_release(struct kref __always_unused *ref) > +{ > +} > + > +static inline void __bnxt_register_notify_irqchanges(struct bnxt_irq *irq) No inlines in .c files, please. Let compiler decide what to inline. > +{ > + struct irq_affinity_notify *notify; > + > + notify = &irq->affinity_notify; > + notify->irq = irq->vector; > + notify->notify = bnxt_irq_affinity_notify; > + notify->release = bnxt_irq_affinity_release; > + > + irq_set_affinity_notifier(irq->vector, notify); > +} > + > static int bnxt_request_irq(struct bnxt *bp) > { > int i, j, rc = 0; > @@ -10543,6 +10584,7 @@ static int bnxt_request_irq(struct bnxt *bp) > int numa_node = dev_to_node(&bp->pdev->dev); > > irq->have_cpumask = 1; > + irq->msix_nr = map_idx; > cpumask_set_cpu(cpumask_local_spread(i, numa_node), > irq->cpu_mask); > rc = irq_set_affinity_hint(irq->vector, irq->cpu_mask); > @@ -10552,6 +10594,15 @@ static int bnxt_request_irq(struct bnxt *bp) > irq->vector); > break; > } > + > + if (!pcie_tph_set_st(bp->pdev, i, > + cpumask_first(irq->cpu_mask), > + TPH_MEM_TYPE_VM, PCI_TPH_REQ_TPH_ONLY)) { > + netdev_err(bp->dev, "error in setting steering tag\n"); > + } else { > + irq->bp = bp; > + __bnxt_register_notify_irqchanges(irq); > + } > } > } > return rc; > diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h > index dd849e715c9b..0d3442590bb4 100644 > --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h > +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h > @@ -1195,6 +1195,10 @@ struct bnxt_irq { > u8 have_cpumask:1; > char name[IFNAMSIZ + 2]; > cpumask_var_t cpu_mask; > + > + int msix_nr; > + struct bnxt *bp; > + struct irq_affinity_notify affinity_notify; > }; > > #define HWRM_RING_ALLOC_TX 0x1