🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24072

Re: [PATCH v2 03/11] net/xsc: add the command queue

#24072
From: Jason Xing
Date: Sun, 29 Nov 2026 07:30
1133 lines
50487 bytes
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()

> +
> +               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
Technical Details
Message-ID: <CAL+tcoCB69Me=4NC5WNUDiN16U_EMeepxGR1NSf0mJ8g6FDiRg@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373396-linux-kernel-netdev=dewy.ru
References: <20261126145711.70868-1-tianx@yunsilicon.com> <20261126145718.70868-4-tianx@yunsilicon.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373396-linux-kernel-netdev=dewy.ru
From: kerneljasonxing@gmail.com (Jason Xing)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH v2 03/11] net/xsc: add the command queue
Date: Sun, 29 Nov 2026 15:30:49 +0800
Organization: Usenet Network
Message-ID: <CAL+tcoCB69Me=4NC5WNUDiN16U_EMeepxGR1NSf0mJ8g6FDiRg@mail.gmail.com>
References: <20261126145711.70868-1-tianx@yunsilicon.com> <20261126145718.70868-4-tianx@yunsilicon.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="1125662"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:9zmV3Zo0979aV9F4G2yxD9ZE08I= sha256:hOzslET8dmP1040VtbqIEwS6gxoB4Hm7suvtLG2xRhE=
	sha1:hVqtOAQYBmTockkScAvmA58c3xQ= sha256:k8MxRo9ODAxRw/0jlfcaxJ4aXyc+4DjEfdbg0yVbKTo=
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 75BDE125F95; Sun, 29 Nov 2026 10:31:53 +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, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.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 urNFA585C5FM;
	Sun, 29 Nov 2026 10:31:49 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-373396-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 6C393125F8A; Sun, 29 Nov 2026 10:31:38 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 65ACB23319; Sun, 29 Nov 2026 07:31:35 +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=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795937494;
	b=Un9DOtpd1KUFeMTXmxhdC94zFCzlE7W7drsy/Fvx3/ie5wxUexEdPtoDXgr6d4FhxKH3
	 90ZmCFWaDGK7NwT+GOm51XhdmAJssB9Sii4Od8m6nup3sPI1W8e6mkPkq8Iy8pxtx7s3e
	 JKQo3OON0bGLMnYZTtIXtBBnImD5KayE5R655AM4CtfMW7E9MWMjZ1GZcV0KKnnO+WO1J
	 VQFXnUSvdGmTHKsQbN+kOie5OuMYyjBUTQztfzruQcCadwqYIl8hWwOPC9WM38WWq64xY
	 udaOMEtvnb2RMyIq+GRTbDAs9DwRnkPQleTws0GNEaJfM2C6SWlAOF7ZIoBV2B0HCLw==
X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795937494;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 References:In-Reply-To:From:Date:X-Gm-Features:Message-ID:Subject:To:
	 Cc:Content-Type:Content-Transfer-Encoding;
	bh=k5Kcjp8yt+9MxLKYYI6TmPTivShb2sEQfR3fcGJIdto=;
	b=jD5ZmanMSuPKGl19ka4h5HNKg57aybIZJ8eaVtT4cCKi2OTtyo7aRCLUGb0GeUQgvNRp
	 RkCRfDfDvMZribo5i06vA1WICF5C3Tv8eaaLvUtag+2rF3s8mrLBveA5cMr9PIHr51i4c
	 fZXGgJkXk6PL5GGrvTbVDD8bSAr068ZkOz4g+tsQPqqgLehak4tDhZnlMx7YiIu0x2wVw
	 w2w3H2SBopH5FTTkxJ7V+JsY9dkbaXkKlTqERZGr2+K5ZQkVh5yYENTXPvCFf7lf36ZWy
	 n0wZrVlSMKpMbzZb/80WKL/NmPWRePJXezc8MH0tsRzHN9N0k/rMWUwc4q78vTtcLOA==
X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="fb4x//Qu";
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.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 0B7D3606A32E;
	Sun, 29 Nov 2026 07:31:34 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=fb4x//Qu
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.167.53
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795937493;
	b=KkTjpcNg4jPWYJAPkvMT2nD6dGpHyOpQ7c/vv1nRbuy5XutfTU3rfPlW8hyNpIgUwtrw
	 rCyhxDYNru/fvpBs+JWjOOh8fceN8ZXSscma8lfPorGZCVAyJohhHrz28HyHF6QLzDIQt
	 e5+c9wpH1uAtidNaVtmBeKhZne+SMM7eetn376NpkAsdkbuRI4zXPr+hPxn7zBsBS85sk
	 riV50RNmBUg9h6s78H0wXTc3eWq9qAewwSLklg3bOQaF92kOKrlu2yUxlnr22y5nEa1XZ
	 MUJAGKaL4JbYMFno8lhnGbBQetTLWkXha3jbOSPauQCjbHepPnZ9nEBSB6S3+nKJTiw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795937493;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 MIME-Version:References:In-Reply-To:From:Date:X-Gm-Features:
	 Message-ID:Subject:To:Cc:Content-Type:Content-Transfer-Encoding;
	bh=k5Kcjp8yt+9MxLKYYI6TmPTivShb2sEQfR3fcGJIdto=;
	b=hlWHHjYgr8DW7diq1xApqYy4IUgCZuZDEM4/Dt3pthiPcfwhA7Pv+V29l1Yx0tOxmyqd
	 6Skc9mlv5EZwXa9ip8ZhwnbJoGhhYeSgJy3GpFvDDJOwLMUaxe4d/F4u8eJDI7mX1mNLe
	 nNvfaafHOOgWftUXURsGO/4BG3v0OKP2mc/RgeRFCaNwQaIxPfRQpC/83qqmqWbOhkI0a
	 D968a0DwgC0erJrb5vjp7hS7x47IgZZWqo8Qd+43/mpBMSrIjDGEA1JUZRHZu09tN/5JU
	 h24fzOgzfW5Vn3B0N3td9ouSzmn8jfU125ZNm6tAyx4oisQKAFzZskL+cZL+VZwx5+g==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="fb4x//Qu";
	arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.167.53
X-Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53])
	(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 E35B2606A325
	for <netdev@vger.kernel.org>; Sun, 29 Nov 2026 07:31:31 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E35B2606A325
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-5c15ccd7fb5so5954442e87.2
        for <netdev@vger.kernel.org>; Sat, 28 Nov 2026 23:31:31 -0800 (PST)
X-ARC-Seal: i=1; a=rsa-sha256; t=1795937490; cv=none;
        d=google.com; s=arc-20260327;
        b=Lde2CKsCDUfftZ3h8FHwSuNe7tK53fjiR3vJQRquavzBUVpoLS5YO/adnbQ0iLq+Gb
         RAzxz03648AYH7ePoDYhg4xOuJ99MOy221ifY3Pt4NzvCrlNDnm70dKMXNSVR8f/6Mdn
         jk4kRwqwtFyb7bpA0+IBYSax74Nlo5Lia9nmW82StC0YduxNxVU0musuRK6b7cVodiIY
         kj2KQM1o7GDTn3T73IrocwZMARg4Fs1oIC/5dLVGi2m/Dw+sI5PqpHrJO7R+yRAiy9gY
         MKwJ+hbv93m2VnNxFgF0OP1tOXusDTHt1hQIHzbrPBV4t126ywtekLjR8t6gsT5ToUI2
         D/Pg==
X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327;
        h=content-transfer-encoding:cc:to:subject:message-id:date:from
         :in-reply-to:references:mime-version:dkim-signature;
        bh=k5Kcjp8yt+9MxLKYYI6TmPTivShb2sEQfR3fcGJIdto=;
        fh=Kgrkmkp8t5ExnHfk8cfg8McyN4DceEJR78eGztpuS9k=;
        b=IZY9DyjvSeqxRmgjeBgXKhAxjOEpJgZBmEUruBSynOr9KiRps4U3zlZQv9v/tcxsJm
         OGTQuQrd40UUfISYpxcNKNTv0v4lmq7/ovVoqzAIvI9qhDPuG1rb48JePE+sE2D3u0nb
         3rOTuFzz85iI3T+Ujz3PSANlQAz9qrj3xNM8PTxhk+HdXjleAM4npAv+s9bs8NzlcJeG
         dwQ/30TtkDKwrxQ0M3OgroNIy+DwVAuCoUMOw6hkEo6VDKZ9D19zOABuBDjioH6zsVzP
         XRDr3KQw/cvnfRnXpcgrhjXBZY2ZW7nt6SjF7YVUAt9+U+AWu849CwY0IroNHmzUoJ9G
         QGeg==;
        darn=vger.kernel.org
X-ARC-Authentication-Results: i=1; mx.google.com; arc=none
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1795937490; x=1796542290; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:cc:to:subject:message-id
         :date:from:in-reply-to:references:mime-version:from:to:cc:subject
         :date:message-id:reply-to:content-type;
        bh=k5Kcjp8yt+9MxLKYYI6TmPTivShb2sEQfR3fcGJIdto=;
        b=fb4x//QuAl09IOWsMRjgQ6XYNDf3gwdrGSERN1MKsWF5F/N4Rm0QQmACu2ebOz4fR8
         W8HiU7+ISyO+ASpPeo+eOHJI3OMlb6xjCQ37qF+4SeaQwVynlUQV4m32a9d0ncC5ylbv
         sE2CLkMj3+RLdmGa4yfYrZh2/sFTWM/qkU+1eDhT0Iu0O9wCLrTzfnTKpKpg12AEgJJy
         U2gAOGmsGzH4/LZ3WN4+TSxqKO8zi5IZv9RNTlolythQyM5jIFRGwX8sSfs5RTsDKBDV
         5orOK25h5Usn9OeQq4T7kT1WqUsN+S+8eZUynJJ6dM2Nw12AHvNRV99hIb8skew3DVkQ
         Sl4Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1795937490; x=1796542290;
        h=content-transfer-encoding:content-type:cc:to:subject:message-id
         :date:from:in-reply-to:references:mime-version:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=k5Kcjp8yt+9MxLKYYI6TmPTivShb2sEQfR3fcGJIdto=;
        b=gxt0XwUEHrOsQkEHti0nSlUhGJBWVkMoHsnF7rEi5pHH2Lut44ro9ZeBd+1V8UWxNs
         0YmO73nJgCtKks561xduUs6GNv4faN9j2nbXi5soUw4Qa0Asn6vFAFxbmMoejo6DBNpC
         9qR6Cu2xu5NhzG/jdMxnrVkbfEQ0GGPhK4xQ624Yd4z2okCbGC2JjbvUUpKOHPY6hpsn
         LMM4AWPTM1tUOlcHj4DDLqWO+xgqFqkPbL6sFONzsa9T4eSe7fTse+610AmmMuYZ3jKk
         oqshHUL4cahx57YcCo5GEPXUD+JXqAmxtTrG+qbWE8IPZDVn7fu5aEd9jJ8oeEKY3tN0
         MAcA==
X-Forwarded-Encrypted: i=1; AL+hErENvSH1BOHPC1W4RRp/5t5onpNw0udZH91GXOkclAChok2mXm4Sn0Q6tKSjnzfYTl0JCLSEj/s=@vger.kernel.org
X-Gm-Message-State: APuU4Z/ep2d9qmGD+9kYfp6/L5dMM9tAOXdBX+S3OxH4gdRhfLn2jOJY
	t/j51FvucEIkCWn4Bu8sZcJWpW6rLzfa7tZOl/k4dgsBY+gl1dRyTSL77q3KHEh0z0MW++gETma
	HzBR9E1iLEcYCt7uzRy6gWqzelqLjwFY=
X-Gm-Gg: AZFdTZcHIT6d6+ZQKSoAWIMWmrz3ACEygT4S4MtvEJ/6VsxKCKx4hTEc1yrJgMa3Ula
	BSTIQkIghxOWK2STVU/LDLBzoThG+a9viVljxAq3zSdxBz1sYhKVZOCI2BoWo+qg/0VIGdHuclN
	jCWq1v8DnI2yRbBtcNNC841Lpvg+bSNXpNgopJGmQdKZKTOpRUJWpUmccNDZDvq+ebWPwUoOCEh
	l1krTAcW9oF14mY8YRVatzno4+9nIp0uoxprixQVkocIL9/zbW2Yuc58q896l6C+dKIyUTKNx3s
	YbroavO95P8ckP7ZmENc1PfQC/PuiFSHY6vnal58QbALQOx2BsIuYYTiI7UptIeMlipPzK0xlck
	iE2TFLH37o4Bmirx5Rv2uHozWxO6Q/rxjhN0x2iK989dNUsNo5sXFpKgLiI+4amzlpItx76oayJ
	4sasfMocf3wKHQc93UEWk7FiJTnKGEUxlRHj+h8WBoyjybYNqtRCj+sO4Cw3VZdrwITCtxD5Cl
X-Received: by 2002:a05:6512:2522:b0:5bf:d063:61a with SMTP id
 2adb3069b0e04-5c1bc84d88cmr10821605e87.59.1795937489742; Sat, 28 Nov 2026
 23:31:29 -0800 (PST)
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-In-Reply-To: <20261126145718.70868-4-tianx@yunsilicon.com>
X-Gm-Features: Aa3M54rCPcDPIF3yUFVwkJx2NKDuNbnZK_dsZpJFjb52BLEHH-GCwgqBAsyBizg
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