Merge patch series "RISC-V: Align the shadow stack"
[linux-block.git] / include / linux / qed / qed_fcoe_if.h
1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
2 /* Copyright (c) 2019-2020 Marvell International Ltd. */
3
4 #ifndef _QED_FCOE_IF_H
5 #define _QED_FCOE_IF_H
6 #include <linux/types.h>
7 #include <linux/qed/qed_if.h>
8 struct qed_fcoe_stats {
9         u64 fcoe_rx_byte_cnt;
10         u64 fcoe_rx_data_pkt_cnt;
11         u64 fcoe_rx_xfer_pkt_cnt;
12         u64 fcoe_rx_other_pkt_cnt;
13         u32 fcoe_silent_drop_pkt_cmdq_full_cnt;
14         u32 fcoe_silent_drop_pkt_rq_full_cnt;
15         u32 fcoe_silent_drop_pkt_crc_error_cnt;
16         u32 fcoe_silent_drop_pkt_task_invalid_cnt;
17         u32 fcoe_silent_drop_total_pkt_cnt;
18
19         u64 fcoe_tx_byte_cnt;
20         u64 fcoe_tx_data_pkt_cnt;
21         u64 fcoe_tx_xfer_pkt_cnt;
22         u64 fcoe_tx_other_pkt_cnt;
23 };
24
25 struct qed_dev_fcoe_info {
26         struct qed_dev_info common;
27
28         void __iomem *primary_dbq_rq_addr;
29         void __iomem *secondary_bdq_rq_addr;
30
31         u64 wwpn;
32         u64 wwnn;
33
34         u8 num_cqs;
35 };
36
37 struct qed_fcoe_params_offload {
38         dma_addr_t sq_pbl_addr;
39         dma_addr_t sq_curr_page_addr;
40         dma_addr_t sq_next_page_addr;
41
42         u8 src_mac[ETH_ALEN];
43         u8 dst_mac[ETH_ALEN];
44
45         u16 tx_max_fc_pay_len;
46         u16 e_d_tov_timer_val;
47         u16 rec_tov_timer_val;
48         u16 rx_max_fc_pay_len;
49         u16 vlan_tag;
50
51         struct fc_addr_nw s_id;
52         u8 max_conc_seqs_c3;
53         struct fc_addr_nw d_id;
54         u8 flags;
55         u8 def_q_idx;
56 };
57
58 #define MAX_TID_BLOCKS_FCOE (512)
59 struct qed_fcoe_tid {
60         u32 size;               /* In bytes per task */
61         u32 num_tids_per_block;
62         u8 *blocks[MAX_TID_BLOCKS_FCOE];
63 };
64
65 struct qed_fcoe_cb_ops {
66         struct qed_common_cb_ops common;
67          u32 (*get_login_failures)(void *cookie);
68 };
69
70 void qed_fcoe_set_pf_params(struct qed_dev *cdev,
71                             struct qed_fcoe_pf_params *params);
72
73 /**
74  * struct qed_fcoe_ops - qed FCoE operations.
75  * @common:             common operations pointer
76  * @fill_dev_info:      fills FCoE specific information
77  *                      @param cdev
78  *                      @param info
79  *                      @return 0 on success, otherwise error value.
80  * @register_ops:       register FCoE operations
81  *                      @param cdev
82  *                      @param ops - specified using qed_iscsi_cb_ops
83  *                      @param cookie - driver private
84  * @ll2:                light L2 operations pointer
85  * @start:              fcoe in FW
86  *                      @param cdev
87  *                      @param tasks - qed will fill information about tasks
88  *                      return 0 on success, otherwise error value.
89  * @stop:               stops fcoe in FW
90  *                      @param cdev
91  *                      return 0 on success, otherwise error value.
92  * @acquire_conn:       acquire a new fcoe connection
93  *                      @param cdev
94  *                      @param handle - qed will fill handle that should be
95  *                              used henceforth as identifier of the
96  *                              connection.
97  *                      @param p_doorbell - qed will fill the address of the
98  *                              doorbell.
99  *                      return 0 on success, otherwise error value.
100  * @release_conn:       release a previously acquired fcoe connection
101  *                      @param cdev
102  *                      @param handle - the connection handle.
103  *                      return 0 on success, otherwise error value.
104  * @offload_conn:       configures an offloaded connection
105  *                      @param cdev
106  *                      @param handle - the connection handle.
107  *                      @param conn_info - the configuration to use for the
108  *                              offload.
109  *                      return 0 on success, otherwise error value.
110  * @destroy_conn:       stops an offloaded connection
111  *                      @param cdev
112  *                      @param handle - the connection handle.
113  *                      @param terminate_params
114  *                      return 0 on success, otherwise error value.
115  * @get_stats:          gets FCoE related statistics
116  *                      @param cdev
117  *                      @param stats - pointer to struck that would be filled
118  *                              we stats
119  *                      return 0 on success, error otherwise.
120  */
121 struct qed_fcoe_ops {
122         const struct qed_common_ops *common;
123
124         int (*fill_dev_info)(struct qed_dev *cdev,
125                              struct qed_dev_fcoe_info *info);
126
127         void (*register_ops)(struct qed_dev *cdev,
128                              struct qed_fcoe_cb_ops *ops, void *cookie);
129
130         const struct qed_ll2_ops *ll2;
131
132         int (*start)(struct qed_dev *cdev, struct qed_fcoe_tid *tasks);
133
134         int (*stop)(struct qed_dev *cdev);
135
136         int (*acquire_conn)(struct qed_dev *cdev,
137                             u32 *handle,
138                             u32 *fw_cid, void __iomem **p_doorbell);
139
140         int (*release_conn)(struct qed_dev *cdev, u32 handle);
141
142         int (*offload_conn)(struct qed_dev *cdev,
143                             u32 handle,
144                             struct qed_fcoe_params_offload *conn_info);
145         int (*destroy_conn)(struct qed_dev *cdev,
146                             u32 handle, dma_addr_t terminate_params);
147
148         int (*get_stats)(struct qed_dev *cdev, struct qed_fcoe_stats *stats);
149 };
150
151 const struct qed_fcoe_ops *qed_get_fcoe_ops(void);
152 void qed_put_fcoe_ops(void);
153 #endif