]> git.proxmox.com Git - ceph.git/blame - ceph/src/spdk/dpdk/drivers/net/hinic/base/hinic_pmd_mbox.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / spdk / dpdk / drivers / net / hinic / base / hinic_pmd_mbox.h
CommitLineData
f67539c2
TL
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Huawei Technologies Co., Ltd
3 */
4
5#ifndef _HINIC_PMD_MBOX_H_
6#define _HINIC_PMD_MBOX_H_
7
8#define HINIC_MBOX_RECV_AEQN 0
9#define HINIC_MBOX_RSP_AEQN 2
10
11#define HINIC_MBOX_PF_SEND_ERR 0x1
12#define HINIC_MBOX_PF_BUSY_ACTIVE_FW 0x2
13#define HINIC_MBOX_VF_CMD_ERROR 0x3
14
15/* PFs do not support enable SR-IOV cap when PFs use PMD, VFs just receive
16 * mailbox message from PFs. The max number of PFs is 16, so the max number
17 * of mailbox buffer for functions is also 16.
18 */
19#define HINIC_MAX_FUNCTIONS 16
20#define HINIC_MAX_PF_FUNCS 16
21
22#define HINIC_MGMT_CMD_UNSUPPORTED 0xFF
23
24#define HINIC_SEQ_ID_MAX_VAL 42
25#define HINIC_MSG_SEG_LEN 48
26
27enum hinic_mbox_ack_type {
28 MBOX_ACK,
29 MBOX_NO_ACK,
30};
31
32struct mbox_msg_info {
33 u8 msg_id;
34 u8 status; /*can only use 6 bit*/
35};
36
37struct hinic_recv_mbox {
38 void *mbox;
39 u8 cmd;
40 enum hinic_mod_type mod;
41 u16 mbox_len;
42 void *buf_out;
43 enum hinic_mbox_ack_type ack_type;
44 struct mbox_msg_info msg_info;
45 u8 sed_id;
46};
47
48struct hinic_send_mbox {
49 u8 *data;
50 volatile u64 *wb_status;
51 void *wb_vaddr;
52 dma_addr_t wb_paddr;
53};
54
55enum mbox_event_state {
56 EVENT_START = 0,
57 EVENT_TIMEOUT,
58 EVENT_END,
59};
60
61struct hinic_mbox_func_to_func {
62 struct hinic_hwdev *hwdev;
63
64 pthread_mutex_t mbox_send_mutex;
65 pthread_mutex_t msg_send_mutex;
66
67 struct hinic_send_mbox send_mbox;
68
69 struct hinic_recv_mbox mbox_resp[HINIC_MAX_FUNCTIONS];
70 struct hinic_recv_mbox mbox_send[HINIC_MAX_FUNCTIONS];
71
72 struct hinic_eq *rsp_aeq;
73 struct hinic_eq *recv_aeq;
74
75 u8 send_msg_id;
76 enum mbox_event_state event_flag;
77 spinlock_t mbox_lock; /* lock for mbox event flag */
78};
79
80/*
81 * mbox function prototypes
82 */
83int hinic_comm_func_to_func_init(struct hinic_hwdev *hwdev);
84void hinic_comm_func_to_func_free(struct hinic_hwdev *hwdev);
85int hinic_mbox_func_aeqe_handler(void *handle, u8 *header,
86 u8 size, void *param);
87int hinic_mbox_to_pf(struct hinic_hwdev *hwdev, enum hinic_mod_type mod, u8 cmd,
88 void *buf_in, u16 in_size,
89 void *buf_out, u16 *out_size, u32 timeout);
90int hinic_mbox_to_pf_no_ack(struct hinic_hwdev *hwdev, enum hinic_mod_type mod,
91 u8 cmd, void *buf_in, u16 in_size);
92
93#endif /* _HINIC_PMD_MBOX_H_ */