Skip to content

Commit

Permalink
libxscale: Add xscale needed kernel headers
Browse files Browse the repository at this point in the history
This patch adds xscale needed kernel abi headers into
the kernel-headers directory.

Signed-off-by: Tian Xin <[email protected]>
Signed-off-by: Wei Honggang <[email protected]>
Signed-off-by: Zhao Qianwei <[email protected]>
Signed-off-by: Li Qiang <[email protected]>
Signed-off-by: Yan Lei <[email protected]>
  • Loading branch information
tianx666 committed Sep 24, 2024
1 parent 478bd31 commit 91e7517
Show file tree
Hide file tree
Showing 5 changed files with 277 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kernel-headers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ publish_internal_headers(rdma
rdma/rvt-abi.h
rdma/siw-abi.h
rdma/vmw_pvrdma-abi.h
rdma/xsc-abi.h
rdma/xsc_user_ioctl_cmds.h
)

publish_internal_headers(rdma/hfi
Expand Down Expand Up @@ -80,6 +82,7 @@ rdma_kernel_provider_abi(
rdma/rdma_user_rxe.h
rdma/siw-abi.h
rdma/vmw_pvrdma-abi.h
rdma/xsc-abi.h
)

publish_headers(infiniband
Expand Down
1 change: 1 addition & 0 deletions kernel-headers/rdma/ib_user_ioctl_verbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ enum rdma_driver_id {
RDMA_DRIVER_SIW,
RDMA_DRIVER_ERDMA,
RDMA_DRIVER_MANA,
RDMA_DRIVER_XSC = 1,
};

enum ib_uverbs_gid_type {
Expand Down
241 changes: 241 additions & 0 deletions kernel-headers/rdma/xsc-abi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2021 - 2022, Shanghai Yunsilicon Technology Co., Ltd.
* All rights reserved.
*/

#ifndef XSC_ABI_USER_H
#define XSC_ABI_USER_H

#include <linux/types.h>
#include <linux/if_ether.h> /* For ETH_ALEN. */
#include <rdma/ib_user_ioctl_verbs.h>

enum {
XSC_WQ_FLAG_SIGNATURE = 1 << 0,
};

/* Make sure that all structs defined in this file remain laid out so
* that they pack the same way on 32-bit and 64-bit architectures (to
* avoid incompatibility between 32-bit userspace and 64-bit kernels).
* In particular do not use pointer types -- pass pointers in __u64
* instead.
*/

struct xsc_ib_alloc_ucontext_req {
__u32 rsvd0;
__u32 rsvd1;
};

enum xsc_user_cmds_supp_uhw {
XSC_USER_CMDS_SUPP_UHW_QUERY_DEVICE = 1 << 0,
XSC_USER_CMDS_SUPP_UHW_CREATE_AH = 1 << 1,
};

struct xsc_ib_alloc_ucontext_resp {
__u32 qp_tab_size;
__u32 cache_line_size;
__u16 max_sq_desc_sz;
__u16 max_rq_desc_sz;
__u32 max_send_wqebb;
__u32 max_recv_wr;
__u16 num_ports;
__u16 device_id;
__aligned_u64 qpm_tx_db;
__aligned_u64 qpm_rx_db;
__aligned_u64 cqm_next_cid_reg;
__aligned_u64 cqm_armdb;
__u32 send_ds_num;
__u32 recv_ds_num;
__u32 cmds_supp_uhw;
};

struct xsc_ib_create_qp {
__aligned_u64 buf_addr;
__aligned_u64 db_addr;
__u32 sq_wqe_count;
__u32 rq_wqe_count;
__u32 rq_wqe_shift;
__u32 flags;
};

struct xsc_ib_create_qp_resp {
__u32 bfreg_index;
__u32 resv;
};

struct xsc_ib_create_cq {
__aligned_u64 buf_addr;
__aligned_u64 db_addr;
__u32 cqe_size;
};

struct xsc_ib_create_cq_resp {
__u32 cqn;
__u32 reserved;
};

struct xsc_ib_create_ah_resp {
__u32 response_length;
__u8 dmac[ETH_ALEN];
__u8 reserved[6];
};

struct xsc_ib_alloc_pd_resp {
__u32 pdn;
};

struct xsc_ib_tso_caps {
__u32 max_tso; /* Maximum tso payload size in bytes */

/* Corresponding bit will be set if qp type from
* 'enum ib_qp_type' is supported, e.g.
* supported_qpts |= 1 << IB_QPT_UD
*/
__u32 supported_qpts;
};

/* RX Hash function flags */
enum xsc_rx_hash_function_flags {
XSC_RX_HASH_FUNC_TOEPLITZ = 1 << 0,
};

/*
* RX Hash flags, these flags allows to set which incoming packet's field should
* participates in RX Hash. Each flag represent certain packet's field,
* when the flag is set the field that is represented by the flag will
* participate in RX Hash calculation.
* Note: *IPV4 and *IPV6 flags can't be enabled together on the same QP
* and *TCP and *UDP flags can't be enabled together on the same QP.
*/
enum xsc_rx_hash_fields {
XSC_RX_HASH_SRC_IPV4 = 1 << 0,
XSC_RX_HASH_DST_IPV4 = 1 << 1,
XSC_RX_HASH_SRC_IPV6 = 1 << 2,
XSC_RX_HASH_DST_IPV6 = 1 << 3,
XSC_RX_HASH_SRC_PORT_TCP = 1 << 4,
XSC_RX_HASH_DST_PORT_TCP = 1 << 5,
XSC_RX_HASH_SRC_PORT_UDP = 1 << 6,
XSC_RX_HASH_DST_PORT_UDP = 1 << 7,
XSC_RX_HASH_IPSEC_SPI = 1 << 8,
/* Save bits for future fields */
XSC_RX_HASH_INNER = (1UL << 31),
};

struct xsc_ib_rss_caps {
__aligned_u64 rx_hash_fields_mask; /* enum xsc_rx_hash_fields */
__u8 rx_hash_function; /* enum xsc_rx_hash_function_flags */
__u8 reserved[7];
};

enum xsc_ib_cqe_comp_res_format {
XSC_IB_CQE_RES_FORMAT_HASH = 1 << 0,
XSC_IB_CQE_RES_FORMAT_CSUM = 1 << 1,
XSC_IB_CQE_RES_FORMAT_CSUM_STRIDX = 1 << 2,
};

struct xsc_ib_cqe_comp_caps {
__u32 max_num;
__u32 supported_format; /* enum xsc_ib_cqe_comp_res_format */
};

enum xsc_ib_packet_pacing_cap_flags {
XSC_IB_PP_SUPPORT_BURST = 1 << 0,
};

struct xsc_packet_pacing_caps {
__u32 qp_rate_limit_min;
__u32 qp_rate_limit_max; /* In kpbs */

/* Corresponding bit will be set if qp type from
* 'enum ib_qp_type' is supported, e.g.
* supported_qpts |= 1 << IB_QPT_RAW_PACKET
*/
__u32 supported_qpts;
__u8 cap_flags; /* enum xsc_ib_packet_pacing_cap_flags */
__u8 reserved[3];
};

enum xsc_ib_mpw_caps {
MPW_RESERVED = 1 << 0,
XSC_IB_ALLOW_MPW = 1 << 1,
XSC_IB_SUPPORT_EMPW = 1 << 2,
};

enum xsc_ib_sw_parsing_offloads {
XSC_IB_SW_PARSING = 1 << 0,
XSC_IB_SW_PARSING_CSUM = 1 << 1,
XSC_IB_SW_PARSING_LSO = 1 << 2,
};

struct xsc_ib_sw_parsing_caps {
__u32 sw_parsing_offloads; /* enum xsc_ib_sw_parsing_offloads */

/* Corresponding bit will be set if qp type from
* 'enum ib_qp_type' is supported, e.g.
* supported_qpts |= 1 << IB_QPT_RAW_PACKET
*/
__u32 supported_qpts;
};

struct xsc_ib_striding_rq_caps {
__u32 min_single_stride_log_num_of_bytes;
__u32 max_single_stride_log_num_of_bytes;
__u32 min_single_wqe_log_num_of_strides;
__u32 max_single_wqe_log_num_of_strides;

/* Corresponding bit will be set if qp type from
* 'enum ib_qp_type' is supported, e.g.
* supported_qpts |= 1 << IB_QPT_RAW_PACKET
*/
__u32 supported_qpts;
__u32 reserved;
};

enum xsc_ib_query_dev_resp_flags {
/* Support 128B CQE compression */
XSC_IB_QUERY_DEV_RESP_FLAGS_CQE_128B_COMP = 1 << 0,
XSC_IB_QUERY_DEV_RESP_FLAGS_CQE_128B_PAD = 1 << 1,
};

enum xsc_ib_tunnel_offloads {
XSC_IB_TUNNELED_OFFLOADS_VXLAN = 1 << 0,
XSC_IB_TUNNELED_OFFLOADS_GRE = 1 << 1,
XSC_IB_TUNNELED_OFFLOADS_GENEVE = 1 << 2,
XSC_IB_TUNNELED_OFFLOADS_MPLS_GRE = 1 << 3,
XSC_IB_TUNNELED_OFFLOADS_MPLS_UDP = 1 << 4,
};

struct xsc_ib_query_device_resp {
__u32 comp_mask;
__u32 response_length;
struct xsc_ib_tso_caps tso_caps;
struct xsc_ib_rss_caps rss_caps;
struct xsc_ib_cqe_comp_caps cqe_comp_caps;
struct xsc_packet_pacing_caps packet_pacing_caps;
__u32 xsc_ib_support_multi_pkt_send_wqes;
__u32 flags; /* Use enum xsc_ib_query_dev_resp_flags */
struct xsc_ib_sw_parsing_caps sw_parsing_caps;
struct xsc_ib_striding_rq_caps striding_rq_caps;
__u32 tunnel_offloads_caps; /* enum xsc_ib_tunnel_offloads */
__u32 reserved;
};

struct xsc_ib_burst_info {
__u32 max_burst_sz;
__u16 typical_pkt_sz;
__u16 reserved;
};

struct xsc_ib_modify_qp {
__u32 comp_mask;
struct xsc_ib_burst_info burst_info;
__u32 reserved;
};

struct xsc_ib_modify_qp_resp {
__u32 response_length;
__u32 dctn;
};

#endif /* XSC_ABI_USER_H */
31 changes: 31 additions & 0 deletions kernel-headers/rdma/xsc_user_ioctl_cmds.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2021 - 2022, Shanghai Yunsilicon Technology Co., Ltd.
* All rights reserved.
*/

#ifndef XSC_USER_IOCTL_CMDS_H
#define XSC_USER_IOCTL_CMDS_H

#include <linux/types.h>
#include <rdma/ib_user_ioctl_cmds.h>

enum xsc_ib_devx_methods {
XSC_IB_METHOD_DEVX_OTHER = (1U << UVERBS_ID_NS_SHIFT),
XSC_IB_METHOD_DEVX_QUERY_UAR,
XSC_IB_METHOD_DEVX_QUERY_EQN,
};

enum xsc_ib_devx_other_attrs {
XSC_IB_ATTR_DEVX_OTHER_CMD_IN = (1U << UVERBS_ID_NS_SHIFT),
XSC_IB_ATTR_DEVX_OTHER_CMD_OUT,
};

enum xsc_ib_objects {
XSC_IB_OBJECT_DEVX = (1U << UVERBS_ID_NS_SHIFT),
XSC_IB_OBJECT_DEVX_OBJ,
XSC_IB_OBJECT_DEVX_UMEM,
XSC_IB_OBJECT_FLOW_MATCHER,
};

#endif
1 change: 1 addition & 0 deletions libibverbs/verbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2277,6 +2277,7 @@ extern const struct verbs_device_ops verbs_provider_qedr;
extern const struct verbs_device_ops verbs_provider_rxe;
extern const struct verbs_device_ops verbs_provider_siw;
extern const struct verbs_device_ops verbs_provider_vmw_pvrdma;
extern const struct verbs_device_ops verbs_provider_xscale;
extern const struct verbs_device_ops verbs_provider_all;
extern const struct verbs_device_ops verbs_provider_none;
void ibv_static_providers(void *unused, ...);
Expand Down

0 comments on commit 91e7517

Please sign in to comment.