Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
0002 /* Copyright (c) 2019-2020 Marvell International Ltd. */
0003 
0004 #ifndef _QED_FCOE_IF_H
0005 #define _QED_FCOE_IF_H
0006 #include <linux/types.h>
0007 #include <linux/qed/qed_if.h>
0008 struct qed_fcoe_stats {
0009     u64 fcoe_rx_byte_cnt;
0010     u64 fcoe_rx_data_pkt_cnt;
0011     u64 fcoe_rx_xfer_pkt_cnt;
0012     u64 fcoe_rx_other_pkt_cnt;
0013     u32 fcoe_silent_drop_pkt_cmdq_full_cnt;
0014     u32 fcoe_silent_drop_pkt_rq_full_cnt;
0015     u32 fcoe_silent_drop_pkt_crc_error_cnt;
0016     u32 fcoe_silent_drop_pkt_task_invalid_cnt;
0017     u32 fcoe_silent_drop_total_pkt_cnt;
0018 
0019     u64 fcoe_tx_byte_cnt;
0020     u64 fcoe_tx_data_pkt_cnt;
0021     u64 fcoe_tx_xfer_pkt_cnt;
0022     u64 fcoe_tx_other_pkt_cnt;
0023 };
0024 
0025 struct qed_dev_fcoe_info {
0026     struct qed_dev_info common;
0027 
0028     void __iomem *primary_dbq_rq_addr;
0029     void __iomem *secondary_bdq_rq_addr;
0030 
0031     u64 wwpn;
0032     u64 wwnn;
0033 
0034     u8 num_cqs;
0035 };
0036 
0037 struct qed_fcoe_params_offload {
0038     dma_addr_t sq_pbl_addr;
0039     dma_addr_t sq_curr_page_addr;
0040     dma_addr_t sq_next_page_addr;
0041 
0042     u8 src_mac[ETH_ALEN];
0043     u8 dst_mac[ETH_ALEN];
0044 
0045     u16 tx_max_fc_pay_len;
0046     u16 e_d_tov_timer_val;
0047     u16 rec_tov_timer_val;
0048     u16 rx_max_fc_pay_len;
0049     u16 vlan_tag;
0050 
0051     struct fc_addr_nw s_id;
0052     u8 max_conc_seqs_c3;
0053     struct fc_addr_nw d_id;
0054     u8 flags;
0055     u8 def_q_idx;
0056 };
0057 
0058 #define MAX_TID_BLOCKS_FCOE (512)
0059 struct qed_fcoe_tid {
0060     u32 size;       /* In bytes per task */
0061     u32 num_tids_per_block;
0062     u8 *blocks[MAX_TID_BLOCKS_FCOE];
0063 };
0064 
0065 struct qed_fcoe_cb_ops {
0066     struct qed_common_cb_ops common;
0067      u32 (*get_login_failures)(void *cookie);
0068 };
0069 
0070 void qed_fcoe_set_pf_params(struct qed_dev *cdev,
0071                 struct qed_fcoe_pf_params *params);
0072 
0073 /**
0074  * struct qed_fcoe_ops - qed FCoE operations.
0075  * @common:     common operations pointer
0076  * @fill_dev_info:  fills FCoE specific information
0077  *          @param cdev
0078  *          @param info
0079  *          @return 0 on success, otherwise error value.
0080  * @register_ops:   register FCoE operations
0081  *          @param cdev
0082  *          @param ops - specified using qed_iscsi_cb_ops
0083  *          @param cookie - driver private
0084  * @ll2:        light L2 operations pointer
0085  * @start:      fcoe in FW
0086  *          @param cdev
0087  *          @param tasks - qed will fill information about tasks
0088  *          return 0 on success, otherwise error value.
0089  * @stop:       stops fcoe in FW
0090  *          @param cdev
0091  *          return 0 on success, otherwise error value.
0092  * @acquire_conn:   acquire a new fcoe connection
0093  *          @param cdev
0094  *          @param handle - qed will fill handle that should be
0095  *              used henceforth as identifier of the
0096  *              connection.
0097  *          @param p_doorbell - qed will fill the address of the
0098  *              doorbell.
0099  *          return 0 on success, otherwise error value.
0100  * @release_conn:   release a previously acquired fcoe connection
0101  *          @param cdev
0102  *          @param handle - the connection handle.
0103  *          return 0 on success, otherwise error value.
0104  * @offload_conn:   configures an offloaded connection
0105  *          @param cdev
0106  *          @param handle - the connection handle.
0107  *          @param conn_info - the configuration to use for the
0108  *              offload.
0109  *          return 0 on success, otherwise error value.
0110  * @destroy_conn:   stops an offloaded connection
0111  *          @param cdev
0112  *          @param handle - the connection handle.
0113  *          @param terminate_params
0114  *          return 0 on success, otherwise error value.
0115  * @get_stats:      gets FCoE related statistics
0116  *          @param cdev
0117  *          @param stats - pointer to struck that would be filled
0118  *              we stats
0119  *          return 0 on success, error otherwise.
0120  */
0121 struct qed_fcoe_ops {
0122     const struct qed_common_ops *common;
0123 
0124     int (*fill_dev_info)(struct qed_dev *cdev,
0125                  struct qed_dev_fcoe_info *info);
0126 
0127     void (*register_ops)(struct qed_dev *cdev,
0128                  struct qed_fcoe_cb_ops *ops, void *cookie);
0129 
0130     const struct qed_ll2_ops *ll2;
0131 
0132     int (*start)(struct qed_dev *cdev, struct qed_fcoe_tid *tasks);
0133 
0134     int (*stop)(struct qed_dev *cdev);
0135 
0136     int (*acquire_conn)(struct qed_dev *cdev,
0137                 u32 *handle,
0138                 u32 *fw_cid, void __iomem **p_doorbell);
0139 
0140     int (*release_conn)(struct qed_dev *cdev, u32 handle);
0141 
0142     int (*offload_conn)(struct qed_dev *cdev,
0143                 u32 handle,
0144                 struct qed_fcoe_params_offload *conn_info);
0145     int (*destroy_conn)(struct qed_dev *cdev,
0146                 u32 handle, dma_addr_t terminate_params);
0147 
0148     int (*get_stats)(struct qed_dev *cdev, struct qed_fcoe_stats *stats);
0149 };
0150 
0151 const struct qed_fcoe_ops *qed_get_fcoe_ops(void);
0152 void qed_put_fcoe_ops(void);
0153 #endif