Article View: linux.kernel.netdev
Article #25127Re: [PATCH v2 03/11] net/xsc: add the command queue
From: "Xin Tian"
Date: Tue, 01 Dec 2026 09:22
Date: Tue, 01 Dec 2026 09:22
1155 lines
49051 bytes
49051 bytes
On 11/29/2026 3:30 PM, Jason Xing wrote:
> On Thu, Nov 26, 2026 at 10:57 PM Xin Tian <tianx@yunsilicon.com> wrote:
>> Provide the mailbox-based firmware command interface: a single polling
>> thread, the command exec path with status-to-errno mapping, and the
>> firmware version check. Event-driven mode is deferred.
> Out of curiosity, what is the reason why the event-driven is deferred?
> Polling mode is a bit less efficient.
>> Signed-off-by: Xin Tian <tianx@yunsilicon.com>
>> ---
>> .../ethernet/yunsilicon/xsc/common/xsc_cmd.h | 560 ++++++++++++++
>> .../ethernet/yunsilicon/xsc/common/xsc_core.h | 4 +
>> .../net/ethernet/yunsilicon/xsc/pci/Makefile | 2 +-
>> drivers/net/ethernet/yunsilicon/xsc/pci/cmd.c | 708 ++++++++++++++++++
>> drivers/net/ethernet/yunsilicon/xsc/pci/cmd.h | 87 +++
>> .../net/ethernet/yunsilicon/xsc/pci/main.c | 18 +
>> 6 files changed, 1378 insertions(+), 1 deletion(-)
>> create mode 100644 drivers/net/ethernet/yunsilicon/xsc/common/xsc_cmd.h
>> create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/cmd.c
>> create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/cmd.h
>>
>> diff --git a/drivers/net/ethernet/yunsilicon/xsc/common/xsc_cmd.h b/drivers/net/ethernet/yunsilicon/xsc/common/xsc_cmd.h
>> new file mode 100644
>> index 000000000..4dc650f83
>> --- /dev/null
>> +++ b/drivers/net/ethernet/yunsilicon/xsc/common/xsc_cmd.h
>> @@ -0,0 +1,560 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +/* Copyright (C) 2021-2026, Shanghai Yunsilicon Technology Co., Ltd.
>> + * All rights reserved.
>> + */
>> +
>> +#ifndef __XSC_CMD_H
>> +#define __XSC_CMD_H
>> +
>> +#include <linux/if_ether.h>
>> +#include <linux/types.h>
>> +
>> +struct xsc_core_device;
>> +
>> +#define XSC_CMDQ_VERSION 0x32
>> +
>> +#define XSC_BOARD_SN_LEN 32
>> +#define XSC_MAX_NUM_PCIE_INTF 2
>> +#define XSC_MAX_PF_NUM_PER_PCIE 8
>> +
>> +/* hca_cap mbox version */
>> +#define XSC_CMD_QUERY_HCA_CAP_V1 1
>> +
>> +enum {
>> + XSC_CMD_STAT_OK = 0x0,
>> + XSC_CMD_STAT_BAD_OP_ERR = 0x2,
>> + XSC_CMD_STAT_BAD_PARAM_ERR = 0x3,
>> + XSC_CMD_STAT_RES_BUSY = 0x6,
>> + XSC_CMD_STAT_IX_ERR = 0xa,
>> + XSC_CMD_STAT_QP_FLUSH_BUSY = 0x4b,
>> + XSC_CMD_STAT_QP_FLUSH_PENDING = 0x4c,
>> + XSC_CMD_STAT_INVAL_FUNC = 0x41,
>> +};
>> +
>> +enum {
>> + XSC_CMD_OP_QUERY_HCA_CAP = 0x100,
>> + XSC_CMD_OP_QUERY_CMDQ_VERSION = 0x10a,
>> + XSC_CMD_OP_FUNCTION_RESET = 0x10c,
>> +
>> + XSC_CMD_OP_CREATE_EQ = 0x301,
>> + XSC_CMD_OP_DESTROY_EQ = 0x302,
>> +
>> + XSC_CMD_OP_CREATE_CQ = 0x400,
>> + XSC_CMD_OP_DESTROY_CQ = 0x401,
>> +
>> + XSC_CMD_OP_CREATE_QP = 0x500,
>> + XSC_CMD_OP_DESTROY_QP = 0x501,
>> + XSC_CMD_OP_2RST_QP = 0x50a,
>> + XSC_CMD_OP_RTR2RTS_QP = 0x504,
>> +
>> + XSC_CMD_OP_ENABLE_NIC_HCA = 0x810,
>> + XSC_CMD_OP_DISABLE_NIC_HCA = 0x811,
>> + XSC_CMD_OP_MODIFY_RAW_QP = 0x81f,
>> +
>> + XSC_CMD_OP_QUERY_VPORT_STATE = 0x822,
>> + XSC_CMD_OP_QUERY_EVENT_TYPE = 0x831,
>> +
>> + XSC_CMD_OP_ENABLE_MSIX = 0x850,
>> +
>> + XSC_CMD_OP_SET_MTU = 0x1100,
>> + XSC_CMD_OP_QUERY_ETH_MAC = 0x1101,
>> +
>> + XSC_CMD_OP_SET_PORT_ADMIN_STATUS = 0x1801,
>> +};
>> +
>> +enum xsc_dma_direct {
>> + XSC_DMA_DIR_TO_MAC,
>> +};
>> +
>> +enum {
>> + XSC_TBM_CAP_HASH_PPH = 0,
>> + XSC_TBM_CAP_RSS,
>> + XSC_TBM_CAP_PCT_DROP_CONFIG,
>> +};
>> +
>> +struct xsc_inbox_hdr {
>> + __be16 opcode;
>> + u8 rsvd[4];
>> + __be16 ver;
>> +};
>> +
>> +struct xsc_outbox_hdr {
>> + u8 status;
>> + u8 rsvd[5];
>> + __be16 ver;
>> +};
>> +
>> +/* CQ mbox */
>> +struct xsc_cq_context {
>> + __be16 eqn;
>> + __be16 pa_num;
>> + __be16 glb_func_id;
>> + u8 log_cq_sz;
>> + u8 cq_type;
>> +};
>> +
>> +struct xsc_create_cq_mbox_in {
>> + struct xsc_inbox_hdr hdr;
>> + struct xsc_cq_context ctx;
>> + __be64 pas[];
>> +};
>> +
>> +struct xsc_create_cq_mbox_out {
>> + struct xsc_outbox_hdr hdr;
>> + __be32 cqn;
>> + u8 rsvd[4];
>> +};
>> +
>> +struct xsc_destroy_cq_mbox_in {
>> + struct xsc_inbox_hdr hdr;
>> + __be32 cqn;
>> + u8 rsvd[4];
>> +};
>> +
>> +struct xsc_destroy_cq_mbox_out {
>> + struct xsc_outbox_hdr hdr;
>> + u8 rsvd[8];
>> +};
>> +
>> +/* QP mbox */
>> +struct __packed xsc_create_qp_request {
>> + __be16 input_qpn;
>> + __be16 pa_num;
>> + u8 qp_type;
>> + u8 log_sq_sz;
>> + u8 log_rq_sz;
>> + u8 dma_direct;
>> + __be32 pdn;
>> + __be16 cqn_send;
>> + __be16 cqn_recv;
>> + __be16 glb_funcid;
>> + u8 page_shift;
>> + u8 rsvd[5];
>> + __be64 pas[];
>> +};
>> +
>> +struct xsc_create_qp_mbox_in {
>> + struct xsc_inbox_hdr hdr;
>> + struct xsc_create_qp_request req;
>> +};
>> +
>> +struct xsc_create_qp_mbox_out {
>> + struct xsc_outbox_hdr hdr;
>> + __be32 qpn;
>> + u8 rsvd[4];
>> +};
>> +
>> +struct xsc_destroy_qp_mbox_in {
>> + struct xsc_inbox_hdr hdr;
>> + __be32 qpn;
>> + u8 rsvd[4];
>> +};
>> +
>> +struct xsc_destroy_qp_mbox_out {
>> + struct xsc_outbox_hdr hdr;
>> + u8 rsvd[8];
>> +};
>> +
>> +struct xsc_qp_context {
>> + __be32 remote_qpn;
>> + __be32 cqn_send;
>> + __be32 cqn_recv;
>> + __be32 next_send_psn;
>> + __be32 next_recv_psn;
>> + __be32 pdn;
>> + __be16 src_udp_port;
>> + __be16 path_id;
>> + u8 mtu_mode;
>> + u8 lag_sel;
>> + u8 lag_sel_en;
>> + u8 retry_cnt;
>> + u8 rnr_retry;
>> + u8 dscp;
>> + u8 state;
>> + u8 hop_limit;
>> + u8 dmac[6];
>> + u8 smac[6];
>> + __be32 dip[4];
>> + __be32 sip[4];
>> + __be16 ip_type;
>> + __be16 grp_id;
>> + u8 vlan_valid;
>> + u8 dci_cfi_prio_sl;
>> + __be16 vlan_id;
>> + u8 qp_out_port;
>> + u8 pcie_no;
>> + __be16 lag_id;
>> + __be16 func_id;
>> + u8 max_sra;
>> + u8 max_rra;
>> + u8 no_need_wait;
>> + u8 swith_qp_type;
>> + u8 rsvd0[2];
>> + __be32 qp_access_flags;
>> +};
>> +
>> +struct xsc_modify_qp_mbox_in {
>> + struct xsc_inbox_hdr hdr;
>> + __be32 qpn;
>> + struct xsc_qp_context ctx;
>> + u8 no_need_wait;
>> +};
>> +
>> +struct xsc_modify_qp_mbox_out {
>> + struct xsc_outbox_hdr hdr;
>> + u8 rsvd[8];
>> +};
>> +
>> +struct xsc_modify_raw_qp_request {
>> + __be16 qpn;
>> + __be16 lag_id;
>> + __be16 func_id;
>> + u8 dma_direct;
>> + u8 prio;
>> + u8 qp_out_port;
>> + u8 rsvd[7];
>> +};
>> +
>> +struct xsc_modify_raw_qp_mbox_in {
>> + struct xsc_inbox_hdr hdr;
>> + u8 pcie_no;
>> + u8 rsvd[7];
>> + struct xsc_modify_raw_qp_request req;
>> +};
>> +
>> +struct xsc_modify_raw_qp_mbox_out {
>> + struct xsc_outbox_hdr hdr;
>> + u8 rsvd[8];
>> +};
>> +
>> +/* MSIX TABLE mbox */
>> +struct xsc_msix_table_info_mbox_in {
>> + struct xsc_inbox_hdr hdr;
>> + __be16 index;
>> + u8 rsvd[6];
>> +};
>> +
>> +struct xsc_msix_table_info_mbox_out {
>> + struct xsc_outbox_hdr hdr;
>> + __be32 addr_lo;
>> + __be32 addr_hi;
>> + __be32 data;
>> +};
>> +
>> +/* EQ mbox */
>> +struct xsc_eq_context {
>> + __be16 vecidx;
>> + __be16 pa_num;
>> + u8 log_eq_sz;
>> + u8 rsvd1;
>> + __be16 glb_func_id;
>> + u8 is_async_eq;
>> + u8 rsvd;
>> +};
>> +
>> +struct xsc_create_eq_mbox_in {
>> + struct xsc_inbox_hdr hdr;
>> + struct xsc_eq_context ctx;
>> + u8 rsvd[6];
>> + __be64 pas[];
>> +};
>> +
>> +struct xsc_create_eq_mbox_out {
>> + struct xsc_outbox_hdr hdr;
>> + __be32 eqn;
>> + u8 rsvd[4];
>> +};
>> +
>> +struct xsc_destroy_eq_mbox_in {
>> + struct xsc_inbox_hdr hdr;
>> + __be32 eqn;
>> + u8 rsvd[4];
>> +};
>> +
>> +struct xsc_destroy_eq_mbox_out {
>> + struct xsc_outbox_hdr hdr;
>> + u8 rsvd[8];
>> +};
>> +
>> +struct xsc_cmd_query_cmdq_ver_mbox_in {
>> + struct xsc_inbox_hdr hdr;
>> + u8 rsvd[8];
>> +};
>> +
>> +struct xsc_cmd_query_cmdq_ver_mbox_out {
>> + struct xsc_outbox_hdr hdr;
>> + __be16 cmdq_ver;
>> + u8 rsvd[6];
>> +};
>> +
>> +/* fw mailbox layout, do not change */
>> +struct xsc_fw_version {
>> + u8 rsvd[16];
>> +};
>> +
>> +struct __packed xsc_hca_cap {
>> + u8 rsvd1[12];
>> + u8 send_seg_num;
>> + u8 send_wqe_shift;
>> + u8 recv_seg_num;
>> + u8 recv_wqe_shift;
>> + u8 log_max_srq_sz;
>> + u8 log_max_qp_sz;
>> + u8 log_max_mtt;
>> + u8 log_max_qp;
>> + u8 log_max_strq_sz;
>> + u8 log_max_srqs;
>> + u8 rsvd4[2];
>> + u8 log_max_tso;
>> + u8 log_max_cq_sz;
>> + u8 rsvd6;
>> + u8 log_max_cq;
>> + u8 log_max_eq_sz;
>> + u8 log_max_mkey;
>> + u8 log_max_msix;
>> + u8 log_max_eq;
>> + u8 max_indirection;
>> + u8 log_max_mrw_sz;
>> + u8 log_max_bsf_list_sz;
>> + u8 log_max_klm_list_sz;
>> + u8 rsvd_8_0;
>> + u8 log_max_ra_req_dc;
>> + u8 rsvd_8_1;
>> + u8 log_max_ra_res_dc;
>> + u8 rsvd9;
>> + u8 log_max_ra_req_qp;
>> + u8 log_max_qp_depth;
>> + u8 log_max_ra_res_qp;
>> + __be16 max_vfs;
>> + __be16 raweth_qp_id_end;
>> + __be16 raw_tpe_qp_num;
>> + __be16 max_qp_count;
>> + __be16 raweth_qp_id_base;
>> + u8 rsvd13;
>> + u8 local_ca_ack_delay;
>> + u8 max_num_eqs;
>> + u8 num_ports;
>> + u8 log_max_msg;
>> + u8 mac_port;
>> + __be16 raweth_rss_qp_id_base;
>> + __be16 stat_rate_support;
>> + u8 rsvd16[8];
>> + __be64 flags;
>> + u8 rsvd17;
>> + u8 uar_sz;
>> + u8 rsvd18;
>> + u8 log_pg_sz;
>> + __be16 bf_log_bf_reg_size;
>> + __be16 msix_base;
>> + __be16 msix_num;
>> + __be16 max_desc_sz_sq;
>> + u8 rsvd20[2];
>> + __be16 max_desc_sz_rq;
>> + u8 rsvd21[2];
>> + __be16 max_desc_sz_sq_dc;
>> + u8 rsvd22[4];
>> + __be16 max_qp_mcg;
>> + u8 rsvd23;
>> + u8 log_max_mcg;
>> + u8 rsvd24;
>> + u8 log_max_pd;
>> + u8 rsvd25;
>> + u8 log_max_xrcd;
>> + u8 rsvd26[40];
>> + __be32 uar_page_sz;
>> + u8 rsvd27[8];
>> + __be32 hw_feature_flag;
>> + __be16 pf0_vf_funcid_base;
>> + __be16 pf0_vf_funcid_top;
>> + __be16 pf1_vf_funcid_base;
>> + __be16 pf1_vf_funcid_top;
>> + __be16 pcie0_pf_funcid_base;
>> + __be16 pcie0_pf_funcid_top;
>> + __be16 pcie1_pf_funcid_base;
>> + __be16 pcie1_pf_funcid_top;
>> + u8 log_msx_atomic_size_qp;
>> + u8 pcie_host;
>> + u8 rsvd28;
>> + u8 log_msx_atomic_size_dc;
>> + u8 board_sn[XSC_BOARD_SN_LEN];
>> + u8 max_tc;
>> + u8 mac_bit;
>> + __be16 funcid_to_logic_port;
>> + u8 rsvd29[6];
>> + u8 nif_port_num;
>> + u8 reg_mr_via_cmdq;
>> + __be32 hca_core_clock;
>> + __be32 max_rwq_indirection_tables;
>> + __be32 max_rwq_indirection_table_size;
>> + __be32 chip_ver_h;
>> + __be32 chip_ver_m;
>> + __be32 chip_ver_l;
>> + __be32 hotfix_num;
>> + __be32 feature_flag;
>> + __be32 rx_pkt_len_max;
>> + __be32 glb_func_id;
>> + __be64 tx_db;
>> + __be64 rx_db;
>> + __be64 complete_db;
>> + __be64 complete_reg;
>> + __be64 event_db;
>> + __be32 qp_rate_limit_min;
>> + __be32 qp_rate_limit_max;
>> + struct xsc_fw_version fw_ver;
>> + u8 lag_logic_port_ofst;
>> + u8 rsvd32[7];
>> + /* V1 */
>> + __be64 max_mr_size;
>> + __be16 max_cmd_in_len;
>> + __be16 max_cmd_out_len;
>> + u8 rsvd_v2_v3[36];
>> + /* V4 */
>> + __be16 vf_funcid_base[XSC_MAX_NUM_PCIE_INTF][XSC_MAX_PF_NUM_PER_PCIE];
>> + __be16 vf_funcid_top[XSC_MAX_NUM_PCIE_INTF][XSC_MAX_PF_NUM_PER_PCIE];
>> + __be16 pf_funcid_base[XSC_MAX_NUM_PCIE_INTF];
>> + __be16 pf_funcid_top[XSC_MAX_NUM_PCIE_INTF];
>> + u8 pcie_no;
>> + u8 pf_id;
>> + __be16 vf_id;
>> + u8 pcie_host_num;
>> + u8 pf_num_per_pcie;
>> + u8 rsvd_v6[46];
>> +};
>> +
>> +struct xsc_cmd_query_hca_cap_mbox_in {
>> + struct xsc_inbox_hdr hdr;
>> + __be16 cpu_num;
>> + u8 rsvd[6];
>> +};
>> +
>> +struct xsc_cmd_query_hca_cap_mbox_out {
>> + struct xsc_outbox_hdr hdr;
>> + u8 rsvd0[8];
>> + struct xsc_hca_cap hca_cap;
>> +};
>> +
>> +struct xsc_query_vport_state_out {
>> + struct xsc_outbox_hdr hdr;
>> + u8 state;
>> +#define XSC_QUERY_VPORT_ADMIN_STATE_MASK GENMASK(3, 0)
>> +#define XSC_QUERY_VPORT_STATE_MASK GENMASK(7, 4)
>> +};
>> +
>> +struct xsc_query_vport_state_in {
>> + struct xsc_inbox_hdr hdr;
>> + __be32 data0;
>> +#define XSC_QUERY_VPORT_OTHER_VPORT BIT(0)
>> +#define XSC_QUERY_VPORT_VPORT_NUM_MASK GENMASK(16, 1)
>> +};
>> +
>> +enum {
>> + XSC_CMD_EVENT_RESP_CHANGE_LINK = BIT(0),
>> +};
>> +
>> +struct xsc_event_resp {
>> + u8 resp_cmd_type;
>> +};
>> +
>> +struct xsc_event_query_type_mbox_in {
>> + struct xsc_inbox_hdr hdr;
>> + u8 rsvd[2];
>> +};
>> +
>> +struct xsc_event_query_type_mbox_out {
>> + struct xsc_outbox_hdr hdr;
>> + struct xsc_event_resp ctx;
>> +};
>> +
>> +struct xsc_set_mtu_mbox_in {
>> + struct xsc_inbox_hdr hdr;
>> + __be16 mtu;
>> + __be16 rx_buf_sz_min;
>> + u8 mac_port;
>> + u8 rsvd;
>> +};
>> +
>> +struct xsc_set_mtu_mbox_out {
>> + struct xsc_outbox_hdr hdr;
>> +};
>> +
>> +struct xsc_query_eth_mac_mbox_in {
>> + struct xsc_inbox_hdr hdr;
>> + u8 index;
>> +};
>> +
>> +struct xsc_query_eth_mac_mbox_out {
>> + struct xsc_outbox_hdr hdr;
>> + u8 mac[ETH_ALEN];
>> +};
>> +
>> +struct xsc_nic_attr {
>> + __be16 caps;
>> + __be16 caps_mask;
>> + u8 mac_addr[ETH_ALEN];
>> +};
>> +
>> +struct xsc_rss_attr {
>> + u8 rss_en;
>> + u8 hfunc;
>> + __be16 rqn_base;
>> + __be16 rqn_num;
>> + u8 rsvd[2];
>> + __be32 hash_tmpl;
>> +};
>> +
>> +struct xsc_cmd_enable_nic_hca_mbox_in {
>> + struct xsc_inbox_hdr hdr;
>> + struct xsc_nic_attr nic;
>> + struct xsc_rss_attr rss;
>> +};
>> +
>> +struct xsc_cmd_enable_nic_hca_mbox_out {
>> + struct xsc_outbox_hdr hdr;
>> + u8 rsvd0[2];
>> +};
>> +
>> +struct xsc_nic_dis_attr {
>> + __be16 caps;
>> +};
>> +
>> +struct xsc_cmd_disable_nic_hca_mbox_in {
>> + struct xsc_inbox_hdr hdr;
>> + struct xsc_nic_dis_attr nic;
>> +};
>> +
>> +struct xsc_cmd_disable_nic_hca_mbox_out {
>> + struct xsc_outbox_hdr hdr;
>> + u8 rsvd0[4];
>> +};
>> +
>> +struct xsc_function_reset_mbox_in {
>> + struct xsc_inbox_hdr hdr;
>> + __be16 glb_func_id;
>> + u8 rsvd[6];
>> +};
>> +
>> +struct xsc_function_reset_mbox_out {
>> + struct xsc_outbox_hdr hdr;
>> + u8 rsvd[8];
>> +};
>> +
>> +struct xsc_event_set_port_admin_status_mbox_in {
>> + struct xsc_inbox_hdr hdr;
>> + __be16 status;
>> +};
>> +
>> +struct xsc_event_set_port_admin_status_mbox_out {
>> + struct xsc_outbox_hdr hdr;
>> + __be32 status;
>> +};
>> +
>> +int xsc_cmd_init(struct xsc_core_device *xdev);
>> +void xsc_cmd_cleanup(struct xsc_core_device *xdev);
>> +int xsc_cmd_exec(struct xsc_core_device *xdev,
>> + void *in, unsigned int in_size,
>> + void *out, unsigned int out_size);
>> +int xsc_cmd_version_check(struct xsc_core_device *xdev);
>> +
>> +int xsc_cmd_status_to_err(struct xsc_outbox_hdr *hdr);
>> +
>> +#endif
>> diff --git a/drivers/net/ethernet/yunsilicon/xsc/common/xsc_core.h b/drivers/net/ethernet/yunsilicon/xsc/common/xsc_core.h
>> index 9580d89a1..a6f0149ed 100644
>> --- a/drivers/net/ethernet/yunsilicon/xsc/common/xsc_core.h
>> +++ b/drivers/net/ethernet/yunsilicon/xsc/common/xsc_core.h
>> @@ -24,12 +24,16 @@
>> #define XSC_PAGE_SHIFT_4K 12
>> #define XSC_PAGE_SIZE_4K (_AC(1, UL) << XSC_PAGE_SHIFT_4K)
>>
>> +struct xsc_cmd;
>> +
>> struct xsc_core_device {
>> struct pci_dev *pdev;
>> struct device *device;
>>
>> void __iomem *bar;
>> int bar_num;
>> +
>> + struct xsc_cmd *cmd;
>> };
>>
>> void xsc_update_tx_db(struct xsc_core_device *xdev, u32 sqn, u32 next_pid);
>> diff --git a/drivers/net/ethernet/yunsilicon/xsc/pci/Makefile b/drivers/net/ethernet/yunsilicon/xsc/pci/Makefile
>> index 4a08b92cd..e17a10cc1 100644
>> --- a/drivers/net/ethernet/yunsilicon/xsc/pci/Makefile
>> +++ b/drivers/net/ethernet/yunsilicon/xsc/pci/Makefile
>> @@ -6,4 +6,4 @@ ccflags-y += -I$(srctree)/drivers/net/ethernet/yunsilicon/xsc
>>
>> obj-$(CONFIG_YUNSILICON_XSC_PCI) += xsc_pci.o
>>
>> -xsc_pci-y := main.o doorbell.o
>> +xsc_pci-y := main.o cmd.o doorbell.o
>> diff --git a/drivers/net/ethernet/yunsilicon/xsc/pci/cmd.c b/drivers/net/ethernet/yunsilicon/xsc/pci/cmd.c
>> new file mode 100644
>> index 000000000..45dcdb2b4
>> --- /dev/null
>> +++ b/drivers/net/ethernet/yunsilicon/xsc/pci/cmd.c
>> @@ -0,0 +1,708 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + * Copyright (c) 2021-2026, Shanghai Yunsilicon Technology Co., Ltd.
>> + * All rights reserved.
>> + * Copyright (c) 2013-2016, Mellanox Technologies. All rights reserved.
>> + */
>> +
>> +#include <linux/bitmap.h>
>> +#include <linux/delay.h>
>> +#include <linux/dma-mapping.h>
>> +#include <linux/kthread.h>
>> +#include <linux/pci.h>
>> +#include <linux/slab.h>
>> +
>> +#include "common/xsc_cmd.h"
>> +#include "cmd.h"
>> +#include "common/xsc_core.h"
>> +
>> +#define XSC_CMD_DATA_BLOCK_SIZE 512
>> +#define XSC_CMD_FIRST_SIZE 8
>> +
>> +struct xsc_cmd_prot_block {
>> + u8 data[XSC_CMD_DATA_BLOCK_SIZE];
>> + u8 rsvd0[48];
>> + __be64 next;
>> + __be32 block_num;
>> + u8 owner_status;
>> + u8 token;
>> + u8 ctrl_sig;
>> + u8 sig;
>> +};
>> +
>> +/* hw layout, do not change */
>> +struct xsc_cmd_layout {
>> + u16 rsv0;
>> + u8 rsv[2];
>> + __be32 inlen;
>> + __be64 in_ptr;
>> + __be32 in[XSC_CMD_FIRST_SIZE];
>> + __be64 out_ptr;
>> + __be32 outlen;
>> + u8 token;
>> + u8 sig;
>> + u8 idx;
>> + u8 type_owner;
>> +};
>> +
>> +struct xsc_rsp_layout {
>> + u16 rsv0;
>> + u8 rsv[2];
>> + __be32 out[XSC_RSP_FIRST_SIZE];
>> + u8 token;
>> + u8 sig;
>> + u8 idx;
>> + u8 type_owner;
>> +};
>> +
>> +#define XSC_CMD_TYPE_MASK GENMASK(6, 0)
>> +#define XSC_CMD_OWNER_BIT BIT(7)
>> +
>> +enum {
>> + XSC_CMDQ_ERR_HW_READ_REQ_ERR = BIT(0),
>> + XSC_CMDQ_ERR_HW_WRITE_REQ_ERR = BIT(1),
>> + XSC_CMDQ_ERR_REQ_PID_ERR = BIT(2),
>> + XSC_CMDQ_ERR_RSP_CID_ERR = BIT(3),
>> +};
>> +
>> +enum {
>> + XSC_CMDQ_ELEMENT_SIZE_LOG = 6,
>> + XSC_CMDQ_Q_DEPTH_LOG = 5,
>> +};
>> +
>> +static int xsc_alloc_ent(struct xsc_cmd *cmd)
>> +{
>> + unsigned long flags;
>> + int ret;
>> +
>> + spin_lock_irqsave(&cmd->alloc_lock, flags);
>> + ret = find_first_bit(&cmd->cmd_entry_mask, cmd->max_reg_cmds);
>> + if (ret < cmd->max_reg_cmds)
>> + clear_bit(ret, &cmd->cmd_entry_mask);
>> + spin_unlock_irqrestore(&cmd->alloc_lock, flags);
>> +
>> + return ret < cmd->max_reg_cmds ? ret : -ENOSPC;
>> +}
>> +
>> +static void xsc_free_ent(struct xsc_cmd *cmd, int idx)
>> +{
>> + unsigned long flags;
>> +
>> + spin_lock_irqsave(&cmd->alloc_lock, flags);
>> + set_bit(idx, &cmd->cmd_entry_mask);
>> + spin_unlock_irqrestore(&cmd->alloc_lock, flags);
>> +}
>> +
>> +static struct xsc_cmd_layout *xsc_get_inst(struct xsc_cmd *cmd, int idx)
>> +{
>> + return cmd->cmd_buf + (idx << cmd->log_stride);
>> +}
>> +
>> +static struct xsc_rsp_layout *xsc_get_cq_inst(struct xsc_cmd *cmd, int idx)
>> +{
>> + return cmd->cq_buf + (idx << cmd->log_stride);
>> +}
>> +
>> +static u8 xsc_rsp_owner_bit(struct xsc_rsp_layout *rsp)
>> +{
>> + return !!(rsp->type_owner & XSC_CMD_OWNER_BIT);
>> +}
>> +
>> +static u16 xsc_msg_to_opcode(const struct xsc_cmd_msg *in)
>> +{
>> + const struct xsc_inbox_hdr *hdr = (const void *)in->first;
>> +
>> + return be16_to_cpu(hdr->opcode);
>> +}
>> +
>> +static struct xsc_cmd_mailbox *xsc_alloc_cmd_box(struct xsc_core_device *xdev,
>> + gfp_t flags)
>> +{
>> + struct xsc_cmd_mailbox *mailbox;
>> +
>> + mailbox = kmalloc_obj(*mailbox, flags);
>> + if (!mailbox)
>> + return ERR_PTR(-ENOMEM);
>> +
>> + mailbox->buf = dma_pool_zalloc(xdev->cmd->pool, flags, &mailbox->dma);
>> + if (!mailbox->buf) {
>> + kfree(mailbox);
>> + return ERR_PTR(-ENOMEM);
>> + }
>> + mailbox->next = NULL;
>> +
>> + return mailbox;
>> +}
>> +
>> +static void xsc_free_cmd_box(struct xsc_core_device *xdev,
>> + struct xsc_cmd_mailbox *mailbox)
>> +{
>> + dma_pool_free(xdev->cmd->pool, mailbox->buf, mailbox->dma);
>> + kfree(mailbox);
>> +}
>> +
>> +static struct xsc_cmd_msg *xsc_alloc_msg(struct xsc_core_device *xdev,
>> + unsigned int size,
>> + unsigned int first_size)
>> +{
>> + struct xsc_cmd_mailbox *tmp, *head = NULL;
>> + struct xsc_cmd_prot_block *block;
>> + struct xsc_cmd_msg *msg;
>> + unsigned int blen;
>> + int err;
>> + int n;
>> + int i;
>> +
>> + msg = kzalloc_obj(*msg, GFP_KERNEL);
>> + if (!msg)
>> + return ERR_PTR(-ENOMEM);
>> +
>> + blen = size - min(size, first_size);
>> + n = DIV_ROUND_UP(blen, XSC_CMD_DATA_BLOCK_SIZE);
>> +
>> + for (i = 0; i < n; i++) {
>> + tmp = xsc_alloc_cmd_box(xdev, GFP_KERNEL);
>> + if (IS_ERR(tmp)) {
>> + pci_err(xdev->pdev, "failed allocating block\n");
>> + err = PTR_ERR(tmp);
>> + goto err_free;
>> + }
>> +
>> + block = tmp->buf;
>> + tmp->next = head;
>> + block->next = cpu_to_be64(tmp->next ? tmp->next->dma : 0);
>> + block->block_num = cpu_to_be32(n - i - 1);
>> + head = tmp;
>> + }
>> + msg->next = head;
>> + msg->len = size;
>> + msg->first_size = first_size;
>> +
>> + return msg;
>> +
>> +err_free:
>> + while (head) {
>> + tmp = head->next;
>> + xsc_free_cmd_box(xdev, head);
>> + head = tmp;
>> + }
>> + kfree(msg);
>> +
>> + return ERR_PTR(err);
>> +}
>> +
>> +static void xsc_free_msg(struct xsc_core_device *xdev, struct xsc_cmd_msg *msg)
>> +{
>> + struct xsc_cmd_mailbox *head = msg->next;
>> + struct xsc_cmd_mailbox *next;
>> +
>> + while (head) {
>> + next = head->next;
>> + xsc_free_cmd_box(xdev, head);
>> + head = next;
>> + }
>> + kfree(msg);
>> +}
>> +
>> +static int xsc_copy_to_cmd_msg(struct xsc_cmd_msg *to, const void *from,
>> + unsigned int size)
>> +{
>> + struct xsc_cmd_prot_block *block;
>> + struct xsc_cmd_mailbox *next;
>> + const u8 *src = from;
>> + unsigned int copy;
>> +
>> + copy = min(size, to->first_size);
>> + memcpy(to->first, src, copy);
>> + size -= copy;
>> + src += copy;
>> +
>> + next = to->next;
>> + while (size) {
>> + if (!next) {
>> + WARN_ONCE(1, "Mailbox too short\n");
>> + return -ENOMEM;
>> + }
>> +
>> + copy = min(size, XSC_CMD_DATA_BLOCK_SIZE);
>> + block = next->buf;
>> + memcpy(block->data, src, copy);
>> + block->owner_status = 0;
>> + src += copy;
>> + size -= copy;
>> + next = next->next;
>> + }
>> +
>> + return 0;
>> +}
>> +
>> +static int xsc_copy_from_rsp_msg(void *to, const struct xsc_cmd_msg *from,
>> + unsigned int size)
>> +{
>> + struct xsc_cmd_prot_block *block;
>> + struct xsc_cmd_mailbox *next;
>> + u8 *dst = to;
>> + unsigned int copy;
>> +
>> + copy = min(size, from->first_size);
>> + memcpy(dst, from->first, copy);
>> + size -= copy;
>> + dst += copy;
>> +
>> + next = from->next;
>> + while (size) {
>> + if (!next) {
>> + WARN_ONCE(1, "Mailbox too short\n");
>> + return -ENOMEM;
>> + }
>> +
>> + copy = min(size, XSC_CMD_DATA_BLOCK_SIZE);
>> + block = next->buf;
>> + if (!block->owner_status)
>> + return -EIO;
>> +
>> + memcpy(dst, block->data, copy);
>> + dst += copy;
>> + size -= copy;
>> + next = next->next;
>> + }
>> +
>> + return 0;
>> +}
>> +
>> +static int xsc_cmd_invoke(struct xsc_core_device *xdev, struct xsc_cmd_msg *in,
>> + struct xsc_cmd_msg *out, u8 *status)
>> +{
>> + struct xsc_cmd *cmd = xdev->cmd;
>> + struct xsc_cmd_layout *lay;
>> + struct xsc_cmd_work_ent *ent;
>> + unsigned long timeout;
>> + unsigned long flags;
>> + int err;
>> +
>> + ent = kzalloc_obj(*ent, GFP_KERNEL);
>> + if (!ent)
>> + return -ENOMEM;
>> +
>> + ent->in = in;
>> + ent->out = out;
>> + init_completion(&ent->done);
>> + down(&cmd->sem);
>> + ent->idx = xsc_alloc_ent(cmd);
>> + if (ent->idx < 0) {
>> + pci_err(xdev->pdev, "failed to allocate command entry\n");
>> + up(&cmd->sem);
>> + kfree(ent);
>> + return -ENOMEM;
>> + }
>> + ent->token = ent->idx + 1;
>> + cmd->ent_arr[ent->idx] = ent;
>> +
>> + spin_lock_irqsave(&cmd->doorbell_lock, flags);
>> + lay = xsc_get_inst(cmd, cmd->cmd_pid);
>> + memset(lay, 0, sizeof(*lay));
>> + memcpy(lay->in, in->first, sizeof(lay->in));
>> + if (in->next)
>> + lay->in_ptr = cpu_to_be64(in->next->dma);
>> + lay->inlen = cpu_to_be32(in->len);
>> + if (out->next)
>> + lay->out_ptr = cpu_to_be64(out->next->dma);
>> + lay->outlen = cpu_to_be32(out->len);
>> + lay->type_owner = FIELD_PREP(XSC_CMD_TYPE_MASK, XSC_PCI_CMD_XPORT);
>> + lay->token = ent->token;
>> + lay->idx = ent->idx;
>> + lay->sig = 0xff;
>> +
>> + /* ring doorbell after the descriptor is valid */
>> + wmb();
>> +
>> + cmd->cmd_pid = (cmd->cmd_pid + 1) % (1 << cmd->log_sz);
>> + xsc_update_cmdq_req_pid(xdev, cmd->cmd_pid);
>> + spin_unlock_irqrestore(&cmd->doorbell_lock, flags);
>> +
>> + timeout = msecs_to_jiffies(XSC_CMD_TIMEOUT_MSEC);
>> + if (!wait_for_completion_timeout(&ent->done, timeout)) {
>> + cmd->cmd_status = XSC_CMD_STATUS_TIMEDOUT;
>> + pci_err(xdev->pdev, "wait for opcode 0x%x response timeout\n",
>> + xsc_msg_to_opcode(in));
>> + /* the entry stays registered for the completion handler */
>> + return -ETIMEDOUT;
>> + }
>> +
>> + err = ent->ret;
>> + *status = ent->status;
>> +
>> + spin_lock_irqsave(&cmd->alloc_lock, flags);
>> + if (cmd->ent_arr[ent->idx] == ent)
>> + cmd->ent_arr[ent->idx] = NULL;
>> + spin_unlock_irqrestore(&cmd->alloc_lock, flags);
>> + kfree(ent);
>> +
>> + return err;
>> +}
>> +
>> +static void xsc_cmd_comp_handler(struct xsc_core_device *xdev, u8 idx,
>> + struct xsc_rsp_layout *rsp)
>> +{
>> + struct xsc_cmd *cmd = xdev->cmd;
>> + struct xsc_cmd_work_ent *ent;
>> +
>> + if (idx >= cmd->max_reg_cmds || (cmd->cmd_entry_mask & BIT(idx))) {
>> + pci_err(xdev->pdev, "idx[%d] exceeds max cmds or has no request\n",
>> + idx);
>> + return;
>> + }
>> + ent = cmd->ent_arr[idx];
>> +
>> + memcpy(ent->out->first, rsp->out, sizeof(rsp->out));
>> + ent->ret = 0;
>> + ent->status = ((struct xsc_outbox_hdr *)ent->out->first)->status;
>> + cmd->retry_cnt = 0;
>> +
>> + xsc_free_ent(cmd, ent->idx);
>> + complete(&ent->done);
>> + up(&cmd->sem);
>> +}
>> +
>> +static void xsc_cmd_handle_rsp_before_reload(struct xsc_cmd *cmd,
>> + struct xsc_core_device *xdev)
>> +{
>> + u32 rsp_pid, rsp_cid;
>> +
>> + rsp_pid = xsc_get_cmdq_rsp_pid(xdev) & XSC_CMDQ_INDEX_MASK;
>> + rsp_cid = xsc_get_cmdq_rsp_cid(xdev) & XSC_CMDQ_INDEX_MASK;
>> + if (rsp_pid == rsp_cid)
>> + return;
>> +
>> + cmd->cq_cid = rsp_pid;
>> + xsc_update_cmdq_rsp_cid(xdev, cmd->cq_cid);
>> +}
>> +
>> +static void xsc_cmd_err_handler(struct xsc_core_device *xdev, u32 raw)
>> +{
>> + struct xsc_cmd *cmd = xdev->cmd;
>> + unsigned long flags;
>> + int err = 0;
>> + int retry = 0;
>> + u32 stat = raw;
>> +
>> + while (stat) {
>> + err++;
>> + if (stat & XSC_CMDQ_ERR_HW_READ_REQ_ERR) {
>> + retry = 1;
>> + stat &= ~XSC_CMDQ_ERR_HW_READ_REQ_ERR;
>> + pci_err(xdev->pdev, "hw read request from host failed\n");
>> + } else if (stat & XSC_CMDQ_ERR_HW_WRITE_REQ_ERR) {
>> + retry = 1;
>> + stat &= ~XSC_CMDQ_ERR_HW_WRITE_REQ_ERR;
>> + pci_err(xdev->pdev, "hw write request to fw failed\n");
>> + } else if (stat & XSC_CMDQ_ERR_REQ_PID_ERR) {
>> + stat &= ~XSC_CMDQ_ERR_REQ_PID_ERR;
>> + pci_err(xdev->pdev, "hw reported unexpected req pid\n");
>> + } else if (stat & XSC_CMDQ_ERR_RSP_CID_ERR) {
>> + stat &= ~XSC_CMDQ_ERR_RSP_CID_ERR;
>> + pci_err(xdev->pdev, "hw reported unexpected rsp cid\n");
>> + } else {
>> + stat = 0;
>> + pci_err(xdev->pdev, "ignore unknown cmdq error\n");
>> + }
>> + }
>> +
>> + if (retry) {
>> + if (cmd->retry_cnt >= XSC_CMD_MAX_RETRY_CNT) {
>> + pci_warn(xdev->pdev, "error handler retried %d times, stop retrying\n",
>> + cmd->retry_cnt);
>> + } else {
>> + spin_lock_irqsave(&cmd->doorbell_lock, flags);
>> + xsc_update_cmdq_req_pid(xdev, cmd->cmd_pid);
>> + cmd->retry_cnt++;
>> + spin_unlock_irqrestore(&cmd->doorbell_lock, flags);
>> + }
>> + }
>> +
>> + if (err)
>> + xsc_clear_cmdq_err_status(xdev, raw);
>> +}
>> +
>> +static int xsc_cmd_cq_polling(void *data)
>> +{
>> + struct xsc_core_device *xdev = data;
>> + struct xsc_cmd *cmd = xdev->cmd;
>> + struct xsc_rsp_layout *rsp;
>> + u32 err_status;
>> + u32 cq_pid;
>> +
>> + while (!kthread_should_stop()) {
>> + if (need_resched())
>> + schedule();
> cond_resched()
Will use cond_resched().
>
>> +
>> + err_status = xsc_read_cmdq_err_status(xdev);
>> + if (err_status)
>> + xsc_cmd_err_handler(xdev, err_status);
>> +
>> + cq_pid = xsc_get_cmdq_rsp_pid(xdev) & XSC_CMDQ_INDEX_MASK;
>> + if (cmd->cq_cid == cq_pid) {
>> + usleep_range(1000, 2000);
> xsc_cmd_init() creates a kthread that polls the response ring every
> 1-2ms, even with no command in flight. 1-2ms means around 1000
> periodic wakeups/context switches on one cpu.
>
> It reminds me of future RDMA support. I noticed there are a few
> production applications where frequent create/modify/destroy of pairs
> are unavoidable, meaning the latency there is sensitive. It's unlike
> TCP 3-way handshake. 1-2ms will possibly add huge latency
> comparatively.
>
> With that said, what I had in my mind is there are three directions:
> 1. event-driven as you mentioned. Patch 5 already brings up the EQ and MSI-X.
> 2. demand-driven (dedicated) thread. Keep the kthread, but let the
> submitter wake it and have it sleep on a waitqueue once no command is
> outstanding.
> 3. Or drop the kthread and let the submitter poll in xsc_cmd_invoke()
> with read_poll_timeout(), using a staged delay (udelay(1) a few times,
> then usleep_range(20, 30), then 1ms) as bnxt does in __hwrm_send().
> This also removes the fixed 1ms floor per command.
>
> Any thoughts on this?
>
> Thanks,
> Jason
This is an intentional trade-off for
this series. The command queue only serves the control plane (QP/CQ/EQ
create/destroy, queries, config), not the data path, so the completion
latency does not affect throughput. This version ships a single-channel
ethernet driver where polling is sufficient, and to keep the series lean
(the earlier ~6000-line concern) we keep only the poller for now. We do
plan to move the command queue to EQ-driven completion when multi-channel
and RDMA support land. So I'd like to keep the poller -- I hope the
rationale makes sense.
Thanks,
Xin
Technical Details
Message-ID:
<65f9fb97-fb21-4ffc-9eb3-ee1446cfad8e@yunsilicon.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374898-linux-kernel-netdev=dewy.ruReferences:
<20261126145711.70868-1-tianx@yunsilicon.com> <20261126145718.70868-4-tianx@yunsilicon.com> <CAL+tcoCB69Me=4NC5WNUDiN16U_EMeepxGR1NSf0mJ8g6FDiRg@mail.gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374898-linux-kernel-netdev=dewy.ru
From: tianx@yunsilicon.com ("Xin Tian")
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH v2 03/11] net/xsc: add the command queue
Date: Tue, 1 Dec 2026 17:22:26 +0800
Organization: Usenet Network
Message-ID: <65f9fb97-fb21-4ffc-9eb3-ee1446cfad8e@yunsilicon.com>
References: <20261126145711.70868-1-tianx@yunsilicon.com> <20261126145718.70868-4-tianx@yunsilicon.com> <CAL+tcoCB69Me=4NC5WNUDiN16U_EMeepxGR1NSf0mJ8g6FDiRg@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
logging-data="1672983"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:3jDC4mePMrmMuTZGMq9MeeBAfnw= sha256:0RIs4RiIz9lYG0/zxA7fghL75Nw9w5mj/8hIj+ab5Z8=
sha1:HwVDJz3RjHZRvAuP/Ds/q+eUWSQ= sha256:PinahKVxVFIMrvGg4c4bYRVXYhFzLa4+6MYo5R66bG0=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id A87BB1172FF; Tue, 1 Dec 2026 12:23:01 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
MAILING_LIST_MULTI=-1, MSGID_FROM_MTA_HEADER=0.001,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=yunsilicon.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id SZWzPXyQICfD;
Tue, 1 Dec 2026 12:22:56 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374898-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=yunsilicon.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id C564A1172FD; Tue, 1 Dec 2026 12:22:47 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id 1B83C2EC10; Tue, 1 Dec 2026 09:22:41 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1796116959;
b=DhJLjx5UqLqekVCN1GOoWnbNAXBHWEWRkWsWlvoSk/mRKjUaZ61a+MTPAJErih62sWSS
ekiYbuNAmaIvYFp0TXBNRGPhr6cZzzbXUhhPGdzQGXAr3ECXzBgX5NtNmbY8ha5g9VOca
5YmMtk/wjEAEjPwpX60js1c6yWnCa5iFAOvP9gRYBfCY5UGrD/3a74ySD5WYt2XjM7GUr
lX4IK82ZJzN68Zv5qm1UHtdZtC+dmTekbm+042ZsCCORkoMSMyKvlsXQnpFhXjkMITaQm
zFbxDuGWB85r77XT7HZNEtx+A5GNmWIfZdppbeoQaC0OTk/KWd41KclXuG7nOTAsc1g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796116959;
h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Cc:Message-Id:
X-Lms-Return-Path:Content-Type:To:X-Mailing-List:List-Id:List-Post:
List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
Mime-Version:Received:X-Original-From:User-Agent:In-Reply-To:From:
Subject:Date:Content-Transfer-Encoding:References;
bh=N/4MPFM/E2rfGgVCjt6vk//caR8m0fA5Ci1ig9zr8kw=;
b=16gt2kPWfa2QIS3ixqBwhfWMzVSzG0C/tZQNXM3Q7lPKeMXxnt+Nq0vspU8nLohEl6eT
4rjyHNXA8DAAaVNoTVgAKfCXuMj3YHaPJI+O/sXsPiyVjOBs0aPm/6xMc5UuJjFHqCHNC
Ut/XMpk9cpVqvFknEj2b154Yv2u/KXw2/v5Si72ZC5yF3+Ou5bvNqEFY390+EQ37dHz0W
6E7CMionLXyRHzfSigOJ4wvRs17RseZ30ZAe4kgRdFg04utV8WRNphB4t8b+HkNNz/crF
H4lQOMrfE4Jqja9Wj6YOUrN89Z6N6uteozoQz/iw7H+HLSplQjJ34eJBVvqzgW8fxJA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=yunsilicon.com header.i=@yunsilicon.com header.a=rsa-sha256 header.s=feishu2403070942 header.b=LH5LGX7h;
dmarc=none header.from=yunsilicon.com;
spf=pass smtp.mailfrom=yunsilicon.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 524DA606A68A;
Tue, 1 Dec 2026 09:22:39 +0000 (UTC)
X-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=LH5LGX7h
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.127.231.28
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796116958;
b=qCM22564S4LJEO260Xq0Ulhj+tcH2DZ34j5jdIUk/WmNcA4DLzKrOhdRyWHENLR9ZACq
OfOHAEQZ81EFIIwfQ/o3MH7EPjhkwEGCAQJPVayZTQpzrvLs+6S0KAnHKIxJOeYg9hqQW
ZUfH8MKEXcXClPZX5hATLK5qeM+ju8f0e8K1U/SaOIhqKwU3g2vcJyL3VJjTDaq44XcbW
pFnpy8kVUAQAIRGLTduhNEUeKWYwWZMUT0N7rxJ7XDnaDmPl3MGI8Zbry1dYtIwLZs2Ol
/R8AtBVh7/jL0SwlIcafnPdcYsk5uEYeCtTpUa7zy5Mu+YGFIH70kI3FtBDZZOPzuiQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796116958;
h=DMARC-Filter:DKIM-Signature:Cc:Message-Id:X-Lms-Return-Path:
Content-Type:To:Mime-Version:Received:X-Original-From:User-Agent:
In-Reply-To:From:Subject:Date:Content-Transfer-Encoding:References;
bh=N/4MPFM/E2rfGgVCjt6vk//caR8m0fA5Ci1ig9zr8kw=;
b=LhpY1DxwYMe+JDnaLS40LaDzGiOo7V4P4Z69VODCcCsx9vq+KMxfs7iHC6z6zsiWu8dj
0qayQCkhQvseDgokMOdeGUFboCcsDoXFQo5k2Q8tN+9o/1HgmfQ48l96yMzprMB/QWOcx
3tt+jxHByFViFsnsEfOaZ3HvN4tfQnmIzoYBfvjenRUjEYYQcuBWZpDlYBjmkQP4MOW/7
gdqixm2IEfi+sFJ48Bc0jo9odYAhJ5/f8k3A2llrMCP/fR7k+kl0LZ9SnDkzJbcVZxI9K
lIpoWzogGb696lybEVk/Zheq/rOT/hJ2rQGJGCTdsyIQyHw/RhXdNpELYx+P5+FTkgA==
X-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=LH5LGX7h;
arc=none smtp.remote-ip=209.127.231.28
X-Received: from va-2-28.ptr.blmpb.com (va-2-28.ptr.blmpb.com [209.127.231.28])
(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 92772606A329
for <netdev@vger.kernel.org>; Tue, 1 Dec 2026 09:22:37 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 92772606A329
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=yunsilicon.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=yunsilicon.com
X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
s=feishu2403070942; d=yunsilicon.com; t=1796116951; h=from:subject:
mime-version:from:date:message-id:subject:to:cc:reply-to:content-type:
mime-version:in-reply-to:message-id;
bh=N/4MPFM/E2rfGgVCjt6vk//caR8m0fA5Ci1ig9zr8kw=;
b=LH5LGX7hmvGojikjDR7C8TqOzf61yToM0pseLqj79qwF0wyhUsnXuEhlpy7ah/yqepcKRq
syOr6O00iq0AgtmfeeC/JbL3i3fC+7KYxn4D+YkCA6GSyLLRFITbgoYCSBSWAosJQue4r4
DNXCE7dD4TXk9pgEgqxmyaPrGNG236QAnJl0PH205BUJ74a3t4/oN/jqOTNnBo+Nyd7LPE
WhIduvC/zoda2KxkUIflgNoGzXkU8d6gYpuhymDTFIAlfu8KKRJoydT4jYfTO1PbMUIMz1
jiS5sjRGF1UnVtUTZXfBmVkXtGintsw7qn11pDva4P1rB+qHDMFEqjAWhioqSA==
X-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>
X-Lms-Return-Path: <lba+26b0e91d5+94556e+vger.kernel.org+tianx@yunsilicon.com>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-Received: from [127.0.0.1] ([183.193.56.176]) by smtp.feishu.cn with ESMTPS; Tue, 01 Dec 2026 17:22:28 +0800
X-Original-From: Xin Tian <tianx@yunsilicon.com>
X-User-Agent: Mozilla Thunderbird
X-In-Reply-To: <CAL+tcoCB69Me=4NC5WNUDiN16U_EMeepxGR1NSf0mJ8g6FDiRg@mail.gmail.com>