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