From: "Xin Tian" <tianx@yunsilicon.com>
To: "Jason Xing" <kerneljasonxing@gmail.com>
Cc: "Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Jason Gunthorpe" <jgg@ziepe.ca>,
"Leon Romanovsky" <leon@kernel.org>,
"Junxian Huang" <huangjunxian6@hisilicon.com>,
<weihg@yunsilicon.com>, <linux-kernel@vger.kernel.org>,
<netdev@vger.kernel.org>, <linux-rdma@vger.kernel.org>
Subject: Re: [PATCH v2 04/11] net/xsc: query HCA capabilities and reset function
Date: Tue, 1 Dec 2026 17:24:58 +0800 [thread overview]
Message-ID: <132cbf05-a194-4e2e-bc36-6dc27d70a6c2@yunsilicon.com> (raw)
In-Reply-To: <CAL+tcoAZrQsDOtDwb7LT6jBi8-ZeMM+5Fr8qhw5+j9QE4cwN3w@mail.gmail.com>
On 11/29/2026 3:48 PM, Jason Xing wrote:
> On Thu, Nov 26, 2026 at 10:57 PM Xin Tian <tianx@yunsilicon.com> 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.
I'll reword the subject into a complete sentence and drop the
linux-kernel CC. The split subject you saw was a send-side folding bug
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 <tianx@yunsilicon.com>
>> ---
>> .../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/drivers/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_4K)
>>
>> +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/net/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 = kzalloc_obj(*out, GFP_KERNEL);
>> + if (!out)
>> + return -ENOMEM;
>> +
>> + memset(&in, 0, sizeof(in));
>> + in.hdr.opcode = cpu_to_be16(XSC_CMD_OP_QUERY_HCA_CAP);
>> + in.cpu_num = cpu_to_be16(num_online_cpus());
>> +
>> + err = xsc_cmd_exec(xdev, &in, sizeof(in), out, sizeof(*out));
>> + if (err)
>> + goto err_free;
>> +
>> + xdev->glb_func_id = be32_to_cpu(out->hca_cap.glb_func_id);
>> +
>> + caps->max_cqes = 1 << out->hca_cap.log_max_cq_sz;
>> + caps->send_ds_num = out->hca_cap.send_seg_num;
>> + caps->recv_ds_num = out->hca_cap.recv_seg_num;
>> +
>> + caps->nic_caps = (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 = 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
next prev parent reply other threads:[~2026-12-01 9:25 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 14:57 [PATCH v2 00/11] net/xsc: add the Yunsilicon XSC ethernet driver Xin Tian
2026-11-26 14:57 ` [PATCH v2 01/11] net/xsc: add Yunsilicon XSC ethernet PCI driver Xin Tian
2026-11-27 15:57 ` netdev-bot+sashiko
2026-11-28 17:32 ` Andrew Lunn
2026-12-01 9:48 ` Xin Tian
2026-11-29 2:53 ` Jason Xing
2026-11-26 14:57 ` [PATCH v2 02/11] net/xsc: add doorbell and cmdq MMIO accessors Xin Tian
2026-11-27 15:57 ` netdev-bot+sashiko
2026-11-29 5:47 ` Jason Xing
2026-12-01 9:16 ` Xin Tian
2026-11-26 14:57 ` [PATCH v2 03/11] net/xsc: add the command queue Xin Tian
2026-11-27 15:57 ` netdev-bot+sashiko
2026-11-29 7:30 ` Jason Xing
2026-12-01 9:22 ` Xin Tian
2026-11-26 14:57 ` [PATCH v2 04/11] net/xsc: query HCA capabilities and reset function Xin Tian
2026-11-27 15:57 ` netdev-bot+sashiko
2026-11-29 7:48 ` Jason Xing
2026-12-01 9:24 ` Xin Tian [this message]
2026-11-26 14:57 ` [PATCH v2 05/11] net/xsc: add event queues and MSI-X Xin Tian
2026-11-27 15:57 ` netdev-bot+sashiko
2026-11-26 14:57 ` [PATCH v2 06/11] net/xsc: add CQ and QP helpers Xin Tian
2026-11-27 15:57 ` netdev-bot+sashiko
2026-11-26 14:57 ` [PATCH v2 07/11] net/xsc: add the ethernet netdev Xin Tian
2026-11-27 15:57 ` netdev-bot+sashiko
2026-11-28 17:49 ` Andrew Lunn
2026-11-26 14:57 ` [PATCH v2 08/11] net/xsc: add the single TX/RX channel Xin Tian
2026-11-27 15:58 ` netdev-bot+sashiko
2026-11-26 14:57 ` [PATCH v2 09/11] net/xsc: report link state changes Xin Tian
2026-11-27 15:58 ` netdev-bot+sashiko
2026-11-26 14:57 ` [PATCH v2 10/11] net/xsc: add the transmit path Xin Tian
2026-11-27 15:58 ` netdev-bot+sashiko
2026-11-26 14:57 ` [PATCH v2 11/11] net/xsc: add the receive path Xin Tian
2026-11-27 15:58 ` netdev-bot+sashiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=132cbf05-a194-4e2e-bc36-6dc27d70a6c2@yunsilicon.com \
--to=tianx@yunsilicon.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=huangjunxian6@hisilicon.com \
--cc=jgg@ziepe.ca \
--cc=kerneljasonxing@gmail.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=weihg@yunsilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®