1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Huawei Technologies Co., Ltd
5 #ifndef _HINIC_PMD_CFG_H_
6 #define _HINIC_PMD_CFG_H_
8 #define CFG_MAX_CMD_TIMEOUT 8000 /* ms */
10 #define IS_NIC_TYPE(dev) \
11 ((dev)->cfg_mgmt->svc_cap.chip_svc_type & CFG_SVC_NIC_BIT0)
13 struct host_shared_resource_cap {
14 u32 host_pctxs; /* Parent Context max 1M, IOE and FCoE max 8K flows */
15 u32 host_cctxs; /* Child Context: max 8K */
16 u32 host_scqs; /* shared CQ, chip interface module uses 1 SCQ
17 * TOE/IOE/FCoE each uses 1 SCQ
18 * RoCE/IWARP uses multiple SCQs
21 u32 host_srqs; /* SRQ number: 256K */
22 u32 host_mpts; /* MR number:1M */
25 struct nic_service_cap {
30 /* VF resources, VF obtain them through the MailBox mechanism from
36 bool lro_en; /* LRO feature enable bit */
37 u8 lro_sz; /* LRO context space: n*16B */
38 u8 tso_sz; /* TSO context space: n*16B */
41 /* service type relates define */
42 enum cfg_svc_type_en {
43 CFG_SVC_NIC_BIT0 = (1 << 0),
46 /* device capability */
48 enum cfg_svc_type_en chip_svc_type; /* HW supported service type */
50 /* Host global resources */
51 u16 host_total_function;
52 u8 host_oq_id_mask_val;
56 u8 max_cos_id; /* PF/VF's max cos id */
58 u8 er_id; /* PF/VF's ER */
59 u8 port_id; /* PF/VF's physical port */
60 u8 max_vf; /* max VF number that PF supported */
61 bool sf_en; /* stateful business status */
70 struct host_shared_resource_cap shared_res_cap; /* shared capability */
71 struct nic_service_cap nic_cap; /* NIC capability */
74 struct cfg_mgmt_info {
75 struct hinic_hwdev *hwdev;
76 struct service_cap svc_cap;
79 struct hinic_dev_cap {
80 struct hinic_mgmt_msg_head mgmt_msg_head;
96 u8 host_oq_id_mask_val;
100 u16 max_stick2cache_num;
101 u16 max_bfilter_start_addr;
106 u8 valid_cos_bitmap; /* every bit indicate cos is valid */
113 /* shared resource */
135 /* Obtain service_cap.nic_cap.dev_nic_cap.max_sqs */
136 u16 hinic_func_max_qnum(void *hwdev);
138 int init_cfg_mgmt(struct hinic_hwdev *hwdev);
140 void free_cfg_mgmt(struct hinic_hwdev *hwdev);
142 int hinic_init_capability(struct hinic_hwdev *hwdev);
144 bool hinic_support_nic(struct hinic_hwdev *hwdev, struct nic_service_cap *cap);
146 #endif /* _HINIC_PMD_CFG_H_ */