From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.127.231.35 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796117109; b=zkkkZ8wg6i2WwKEY0I7UNKS56NTfIjK6LsM0Z4O1CN6PaxKYWy0fJdP1h4DEgeHDwLgH +zFwvHr+G25BATq023XGr2EfRifoPns83UECSPj6tiYJ1exlD/iYQITbs19tfPhKjmbkN /R+7adx/Mz8wrrBCM3wmrfQ9usCJceRZftZWK3gjkQ2ehrMoozS6+iKoxihESoziEHSUO TdsRtl6I+TVadBLuDCAlDaFkpZrtJoa5FYXl+95WyhU+hXUwlbfxIdQZCXXCC+56c68dx FSCSGDCJEEv3N+E65QeVgg1HsyGG/LZWhmuQhw8EwxYs3YJ+6FfSVeymPD9VJmfmw0A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796117109; h=DMARC-Filter:DKIM-Signature:To:Received:Cc:From:Subject:References: Content-Type:In-Reply-To:Date:Message-Id:User-Agent:X-Original-From: X-Lms-Return-Path:Content-Transfer-Encoding:Mime-Version; bh=Jy5ex3zi47ymjcdNf1gs/PbG7sYdkjdospEkPJVbeeM=; b=LGcPkYks9VD0TpnN4/VUSbblvEdNjKm20bK/hpKLxhJj1XTXzpOn7XlAPxeBVeOwDeJi tD/Eo7XIG8ee1w3aZPKyIjOdjDsSKBEZNgJ/Tmzjt4qnLxAZMvVIoF3o6aT+p538sUz04 7ddeF1bOlWZeYNrvpOL1R38/0AKmnSvXAaHgDEPf8IP/Lz8b2F0+CafXnnAX+MfP/EYwU YNLlzVOoQUB4sIlQWnMgXHzQ5sOSJOFvF3X9mBO9MRiS02H7lfpWBPSHSiaMaLbgiyCF3 zN2/UHVqM/Vu1w4ba2ceobG449n5N4x2gGrUvgr6yBSeakcQ7tLeIkQd4FEYk+I90oA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=yunsilicon.com; spf=pass smtp.mailfrom=yunsilicon.com; dkim=pass header.d=yunsilicon.com header.i=@yunsilicon.com header.a=rsa-sha256 header.s=feishu2403070942 header.b=IWnQarPu; arc=none smtp.remote-ip=209.127.231.35 Received: from va-2-35.ptr.blmpb.com (va-2-35.ptr.blmpb.com [209.127.231.35]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E9E9606A680 for ; Tue, 1 Dec 2026 09:25:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6E9E9606A680 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=yunsilicon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=yunsilicon.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=yunsilicon.com header.i=@yunsilicon.com header.a=rsa-sha256 header.s=feishu2403070942 header.b=IWnQarPu DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=feishu2403070942; d=yunsilicon.com; t=1796117102; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=Jy5ex3zi47ymjcdNf1gs/PbG7sYdkjdospEkPJVbeeM=; b=IWnQarPuPKMn+tV9TFQP3ItFtEo0U0grczK0p0ZPptNHgoosrLGxjsbfedqXF8H1yE5Kz0 0uhZfK/AP4eOIzaIA6razCiR0z2xmd4mlPt0P8BAFr148WXIkAJwS6tae0FF5K/wdlkp74 pg8IvmFrqrzzXrw4AhkYq0qaf7+wG8nmvfR12H9J+HegFf05eGYpK+uEfiVw7egn3UAjNl lRjmI5Ia0vr+FeAvDgSNznWvJJ0qkeuEa8Vvke6kn8wYXeGdsowEYo7J6dCM6uXQD8p3S4 Q8PZiW63WEMTH8aOWobDwaHL0HNAeWjHEkleBgkA1Hm6lWcLMsZblw9ffGrhag== To: "Jason Xing" Received: from [127.0.0.1] ([183.193.56.176]) by smtp.feishu.cn with ESMTPS; Tue, 01 Dec 2026 17:24:59 +0800 Cc: "Andrew Lunn" , "David S. Miller" , "Eric Dumazet" , "Jakub Kicinski" , "Paolo Abeni" , "Jason Gunthorpe" , "Leon Romanovsky" , "Junxian Huang" , , , , From: "Xin Tian" Subject: Re: [PATCH v2 04/11] net/xsc: query HCA capabilities and reset function References: <20261126145711.70868-1-tianx@yunsilicon.com> <20261126145721.70868-5-tianx@yunsilicon.com> Content-Type: text/plain; charset=UTF-8 In-Reply-To: Date: Tue, 1 Dec 2026 17:24:58 +0800 Message-Id: <132cbf05-a194-4e2e-bc36-6dc27d70a6c2@yunsilicon.com> User-Agent: Mozilla Thunderbird X-Original-From: Xin Tian X-Lms-Return-Path: Content-Transfer-Encoding: quoted-printable X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 On 11/29/2026 3:48 PM, Jason Xing wrote: > On Thu, Nov 26, 2026 at 10:57=E2=80=AFPM Xin Tian = wrote: >> resources > Please say more than one word :) > > I just saw you CC'd the kernel mailing list. Please trim it in the > next revision. =C2=A0 I'll reword the subject into a complete sentence and drop the =C2=A0 linux-kernel CC. The split subject you saw was a send-side folding = bug =C2=A0 in our SMTP script (not git send-email); already fixed on that side= . >> Query the firmware HCA capabilities needed by the ethernet driver and >> reset the function resources during probe. >> >> Signed-off-by: Xin Tian >> --- >> .../ethernet/yunsilicon/xsc/common/xsc_core.h | 18 +++++ >> .../net/ethernet/yunsilicon/xsc/pci/main.c | 70 +++++++++++++++++++ >> 2 files changed, 88 insertions(+) >> >> diff --git a/drivers/net/ethernet/yunsilicon/xsc/common/xsc_core.h b/dri= vers/net/ethernet/yunsilicon/xsc/common/xsc_core.h >> index a6f0149ed..1ffbc2daa 100644 >> --- a/drivers/net/ethernet/yunsilicon/xsc/common/xsc_core.h >> +++ b/drivers/net/ethernet/yunsilicon/xsc/common/xsc_core.h >> @@ -24,6 +24,18 @@ >> #define XSC_PAGE_SHIFT_4K 12 >> #define XSC_PAGE_SIZE_4K (_AC(1, UL) << XSC_PAGE_SHIFT_4= K) >> >> +struct xsc_caps { >> + u32 max_cqes; >> + u32 send_ds_num; >> + u32 recv_ds_num; >> + u8 log_max_qp_depth; >> + u16 msix_base; >> + u16 msix_num; >> + u32 nic_caps; >> +}; >> + >> +#define XSC_CAP_MAC_PORT_MASK GENMASK(15, 8) >> + >> struct xsc_cmd; >> >> struct xsc_core_device { >> @@ -33,6 +45,12 @@ struct xsc_core_device { >> void __iomem *bar; >> int bar_num; >> >> + u8 mac_port; >> + u8 pcie_no; >> + u8 pf_id; >> + u16 glb_func_id; >> + >> + struct xsc_caps caps; >> struct xsc_cmd *cmd; >> }; >> >> diff --git a/drivers/net/ethernet/yunsilicon/xsc/pci/main.c b/drivers/ne= t/ethernet/yunsilicon/xsc/pci/main.c >> index 9b08580f5..42c5a1bae 100644 >> --- a/drivers/net/ethernet/yunsilicon/xsc/pci/main.c >> +++ b/drivers/net/ethernet/yunsilicon/xsc/pci/main.c >> @@ -29,6 +29,63 @@ static int xsc_set_dma_caps(struct pci_dev *pdev) >> return err; >> } >> >> +static int xsc_cmd_query_hca_cap(struct xsc_core_device *xdev, >> + struct xsc_caps *caps) >> +{ >> + struct xsc_cmd_query_hca_cap_mbox_out *out; >> + struct xsc_cmd_query_hca_cap_mbox_in in; >> + int err; >> + >> + out =3D kzalloc_obj(*out, GFP_KERNEL); >> + if (!out) >> + return -ENOMEM; >> + >> + memset(&in, 0, sizeof(in)); >> + in.hdr.opcode =3D cpu_to_be16(XSC_CMD_OP_QUERY_HCA_CAP); >> + in.cpu_num =3D cpu_to_be16(num_online_cpus()); >> + >> + err =3D xsc_cmd_exec(xdev, &in, sizeof(in), out, sizeof(*out)); >> + if (err) >> + goto err_free; >> + >> + xdev->glb_func_id =3D be32_to_cpu(out->hca_cap.glb_func_id); >> + >> + caps->max_cqes =3D 1 << out->hca_cap.log_max_cq_sz; >> + caps->send_ds_num =3D out->hca_cap.send_seg_num; >> + caps->recv_ds_num =3D out->hca_cap.recv_seg_num; >> + >> + caps->nic_caps =3D (caps->nic_caps & ~XSC_CAP_MAC_PORT_MASK) | > xdev/caps is allocated via kzalloc, so caps is already zeroed. > >> + FIELD_PREP(XSC_CAP_MAC_PORT_MASK, >> + out->hca_cap.mac_port & 0xff); > mac_port is an u8 field. 0xff should be dead code here? > > Then 'xdev->mac_port =3D out->hca_cap.mac_port;' is fine. > > Thanks, > Jason Right, I will just assign mac_port directly and drop the dead mask/field. Thanks, Xin