Yuval Mintz | 25c089d | 2015-10-26 11:02:26 +0200 | [diff] [blame] | 1 | /* QLogic qed NIC Driver |
| 2 | * Copyright (c) 2015 QLogic Corporation |
| 3 | * |
| 4 | * This software is available under the terms of the GNU General Public License |
| 5 | * (GPL) Version 2, available from the file COPYING in the main directory of |
| 6 | * this source tree. |
| 7 | */ |
| 8 | |
| 9 | #ifndef _QED_ETH_IF_H |
| 10 | #define _QED_ETH_IF_H |
| 11 | |
| 12 | #include <linux/list.h> |
| 13 | #include <linux/if_link.h> |
| 14 | #include <linux/qed/eth_common.h> |
| 15 | #include <linux/qed/qed_if.h> |
Yuval Mintz | 0b55e27 | 2016-05-11 16:36:15 +0300 | [diff] [blame] | 16 | #include <linux/qed/qed_iov_if.h> |
Yuval Mintz | 25c089d | 2015-10-26 11:02:26 +0200 | [diff] [blame] | 17 | |
| 18 | struct qed_dev_eth_info { |
| 19 | struct qed_dev_info common; |
| 20 | |
| 21 | u8 num_queues; |
| 22 | u8 num_tc; |
| 23 | |
| 24 | u8 port_mac[ETH_ALEN]; |
| 25 | u8 num_vlan_filters; |
Yuval Mintz | d8c2c7e | 2016-08-22 13:25:11 +0300 | [diff] [blame^] | 26 | |
| 27 | /* Legacy VF - this affects the datapath, so qede has to know */ |
| 28 | bool is_legacy; |
Yuval Mintz | 25c089d | 2015-10-26 11:02:26 +0200 | [diff] [blame] | 29 | }; |
| 30 | |
Manish Chopra | cee4d26 | 2015-10-26 11:02:28 +0200 | [diff] [blame] | 31 | struct qed_update_vport_rss_params { |
| 32 | u16 rss_ind_table[128]; |
| 33 | u32 rss_key[10]; |
Sudarsana Reddy Kalluru | 8c5ebd0 | 2016-04-10 12:43:00 +0300 | [diff] [blame] | 34 | u8 rss_caps; |
Manish Chopra | cee4d26 | 2015-10-26 11:02:28 +0200 | [diff] [blame] | 35 | }; |
| 36 | |
| 37 | struct qed_update_vport_params { |
| 38 | u8 vport_id; |
| 39 | u8 update_vport_active_flg; |
| 40 | u8 vport_active_flg; |
Yuval Mintz | 831bfb0e | 2016-05-11 16:36:25 +0300 | [diff] [blame] | 41 | u8 update_tx_switching_flg; |
| 42 | u8 tx_switching_flg; |
Yuval Mintz | 3f9b4a6 | 2016-02-18 17:00:39 +0200 | [diff] [blame] | 43 | u8 update_accept_any_vlan_flg; |
| 44 | u8 accept_any_vlan; |
Manish Chopra | cee4d26 | 2015-10-26 11:02:28 +0200 | [diff] [blame] | 45 | u8 update_rss_flg; |
| 46 | struct qed_update_vport_rss_params rss_params; |
| 47 | }; |
| 48 | |
Manish Chopra | 088c861 | 2016-03-04 12:35:05 -0500 | [diff] [blame] | 49 | struct qed_start_vport_params { |
| 50 | bool remove_inner_vlan; |
| 51 | bool gro_enable; |
| 52 | bool drop_ttl0; |
| 53 | u8 vport_id; |
| 54 | u16 mtu; |
Yuval Mintz | a0d26d5 | 2016-06-19 15:18:13 +0300 | [diff] [blame] | 55 | bool clear_stats; |
Manish Chopra | 088c861 | 2016-03-04 12:35:05 -0500 | [diff] [blame] | 56 | }; |
| 57 | |
Manish Chopra | cee4d26 | 2015-10-26 11:02:28 +0200 | [diff] [blame] | 58 | struct qed_stop_rxq_params { |
| 59 | u8 rss_id; |
| 60 | u8 rx_queue_id; |
| 61 | u8 vport_id; |
| 62 | bool eq_completion_only; |
| 63 | }; |
| 64 | |
| 65 | struct qed_stop_txq_params { |
| 66 | u8 rss_id; |
| 67 | u8 tx_queue_id; |
| 68 | }; |
| 69 | |
| 70 | enum qed_filter_rx_mode_type { |
| 71 | QED_FILTER_RX_MODE_TYPE_REGULAR, |
| 72 | QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC, |
| 73 | QED_FILTER_RX_MODE_TYPE_PROMISC, |
| 74 | }; |
| 75 | |
| 76 | enum qed_filter_xcast_params_type { |
| 77 | QED_FILTER_XCAST_TYPE_ADD, |
| 78 | QED_FILTER_XCAST_TYPE_DEL, |
| 79 | QED_FILTER_XCAST_TYPE_REPLACE, |
| 80 | }; |
| 81 | |
| 82 | struct qed_filter_ucast_params { |
| 83 | enum qed_filter_xcast_params_type type; |
| 84 | u8 vlan_valid; |
| 85 | u16 vlan; |
| 86 | u8 mac_valid; |
| 87 | unsigned char mac[ETH_ALEN]; |
| 88 | }; |
| 89 | |
| 90 | struct qed_filter_mcast_params { |
| 91 | enum qed_filter_xcast_params_type type; |
| 92 | u8 num; |
| 93 | unsigned char mac[64][ETH_ALEN]; |
| 94 | }; |
| 95 | |
| 96 | union qed_filter_type_params { |
| 97 | enum qed_filter_rx_mode_type accept_flags; |
| 98 | struct qed_filter_ucast_params ucast; |
| 99 | struct qed_filter_mcast_params mcast; |
| 100 | }; |
| 101 | |
| 102 | enum qed_filter_type { |
| 103 | QED_FILTER_TYPE_UCAST, |
| 104 | QED_FILTER_TYPE_MCAST, |
| 105 | QED_FILTER_TYPE_RX_MODE, |
| 106 | QED_MAX_FILTER_TYPES, |
| 107 | }; |
| 108 | |
| 109 | struct qed_filter_params { |
| 110 | enum qed_filter_type type; |
| 111 | union qed_filter_type_params filter; |
| 112 | }; |
| 113 | |
| 114 | struct qed_queue_start_common_params { |
| 115 | u8 rss_id; |
| 116 | u8 queue_id; |
| 117 | u8 vport_id; |
| 118 | u16 sb; |
| 119 | u16 sb_idx; |
Yuval Mintz | 351a4ded | 2016-06-02 10:23:29 +0300 | [diff] [blame] | 120 | u16 vf_qid; |
Manish Chopra | cee4d26 | 2015-10-26 11:02:28 +0200 | [diff] [blame] | 121 | }; |
| 122 | |
Manish Chopra | 464f664 | 2016-04-14 01:38:29 -0400 | [diff] [blame] | 123 | struct qed_tunn_params { |
| 124 | u16 vxlan_port; |
| 125 | u8 update_vxlan_port; |
| 126 | u16 geneve_port; |
| 127 | u8 update_geneve_port; |
| 128 | }; |
| 129 | |
Manish Chopra | cee4d26 | 2015-10-26 11:02:28 +0200 | [diff] [blame] | 130 | struct qed_eth_cb_ops { |
| 131 | struct qed_common_cb_ops common; |
Yuval Mintz | eff1696 | 2016-05-11 16:36:21 +0300 | [diff] [blame] | 132 | void (*force_mac) (void *dev, u8 *mac); |
Manish Chopra | cee4d26 | 2015-10-26 11:02:28 +0200 | [diff] [blame] | 133 | }; |
| 134 | |
Sudarsana Reddy Kalluru | a1d8d8a | 2016-06-08 06:22:11 -0400 | [diff] [blame] | 135 | #ifdef CONFIG_DCB |
| 136 | /* Prototype declaration of qed_eth_dcbnl_ops should match with the declaration |
| 137 | * of dcbnl_rtnl_ops structure. |
| 138 | */ |
| 139 | struct qed_eth_dcbnl_ops { |
| 140 | /* IEEE 802.1Qaz std */ |
| 141 | int (*ieee_getpfc)(struct qed_dev *cdev, struct ieee_pfc *pfc); |
| 142 | int (*ieee_setpfc)(struct qed_dev *cdev, struct ieee_pfc *pfc); |
| 143 | int (*ieee_getets)(struct qed_dev *cdev, struct ieee_ets *ets); |
| 144 | int (*ieee_setets)(struct qed_dev *cdev, struct ieee_ets *ets); |
| 145 | int (*ieee_peer_getets)(struct qed_dev *cdev, struct ieee_ets *ets); |
| 146 | int (*ieee_peer_getpfc)(struct qed_dev *cdev, struct ieee_pfc *pfc); |
| 147 | int (*ieee_getapp)(struct qed_dev *cdev, struct dcb_app *app); |
| 148 | int (*ieee_setapp)(struct qed_dev *cdev, struct dcb_app *app); |
| 149 | |
| 150 | /* CEE std */ |
| 151 | u8 (*getstate)(struct qed_dev *cdev); |
| 152 | u8 (*setstate)(struct qed_dev *cdev, u8 state); |
| 153 | void (*getpgtccfgtx)(struct qed_dev *cdev, int prio, u8 *prio_type, |
| 154 | u8 *pgid, u8 *bw_pct, u8 *up_map); |
| 155 | void (*getpgbwgcfgtx)(struct qed_dev *cdev, int pgid, u8 *bw_pct); |
| 156 | void (*getpgtccfgrx)(struct qed_dev *cdev, int prio, u8 *prio_type, |
| 157 | u8 *pgid, u8 *bw_pct, u8 *up_map); |
| 158 | void (*getpgbwgcfgrx)(struct qed_dev *cdev, int pgid, u8 *bw_pct); |
| 159 | void (*getpfccfg)(struct qed_dev *cdev, int prio, u8 *setting); |
| 160 | void (*setpfccfg)(struct qed_dev *cdev, int prio, u8 setting); |
| 161 | u8 (*getcap)(struct qed_dev *cdev, int capid, u8 *cap); |
| 162 | int (*getnumtcs)(struct qed_dev *cdev, int tcid, u8 *num); |
| 163 | u8 (*getpfcstate)(struct qed_dev *cdev); |
| 164 | int (*getapp)(struct qed_dev *cdev, u8 idtype, u16 id); |
| 165 | u8 (*getfeatcfg)(struct qed_dev *cdev, int featid, u8 *flags); |
| 166 | |
| 167 | /* DCBX configuration */ |
| 168 | u8 (*getdcbx)(struct qed_dev *cdev); |
| 169 | void (*setpgtccfgtx)(struct qed_dev *cdev, int prio, |
| 170 | u8 pri_type, u8 pgid, u8 bw_pct, u8 up_map); |
| 171 | void (*setpgtccfgrx)(struct qed_dev *cdev, int prio, |
| 172 | u8 pri_type, u8 pgid, u8 bw_pct, u8 up_map); |
| 173 | void (*setpgbwgcfgtx)(struct qed_dev *cdev, int pgid, u8 bw_pct); |
| 174 | void (*setpgbwgcfgrx)(struct qed_dev *cdev, int pgid, u8 bw_pct); |
| 175 | u8 (*setall)(struct qed_dev *cdev); |
| 176 | int (*setnumtcs)(struct qed_dev *cdev, int tcid, u8 num); |
| 177 | void (*setpfcstate)(struct qed_dev *cdev, u8 state); |
| 178 | int (*setapp)(struct qed_dev *cdev, u8 idtype, u16 idval, u8 up); |
| 179 | u8 (*setdcbx)(struct qed_dev *cdev, u8 state); |
| 180 | u8 (*setfeatcfg)(struct qed_dev *cdev, int featid, u8 flags); |
| 181 | |
| 182 | /* Peer apps */ |
| 183 | int (*peer_getappinfo)(struct qed_dev *cdev, |
| 184 | struct dcb_peer_app_info *info, |
| 185 | u16 *app_count); |
| 186 | int (*peer_getapptable)(struct qed_dev *cdev, struct dcb_app *table); |
| 187 | |
| 188 | /* CEE peer */ |
| 189 | int (*cee_peer_getpfc)(struct qed_dev *cdev, struct cee_pfc *pfc); |
| 190 | int (*cee_peer_getpg)(struct qed_dev *cdev, struct cee_pg *pg); |
| 191 | }; |
| 192 | #endif |
| 193 | |
Yuval Mintz | 25c089d | 2015-10-26 11:02:26 +0200 | [diff] [blame] | 194 | struct qed_eth_ops { |
| 195 | const struct qed_common_ops *common; |
Yuval Mintz | 0b55e27 | 2016-05-11 16:36:15 +0300 | [diff] [blame] | 196 | #ifdef CONFIG_QED_SRIOV |
| 197 | const struct qed_iov_hv_ops *iov; |
| 198 | #endif |
Sudarsana Reddy Kalluru | a1d8d8a | 2016-06-08 06:22:11 -0400 | [diff] [blame] | 199 | #ifdef CONFIG_DCB |
| 200 | const struct qed_eth_dcbnl_ops *dcb; |
| 201 | #endif |
Yuval Mintz | 25c089d | 2015-10-26 11:02:26 +0200 | [diff] [blame] | 202 | |
| 203 | int (*fill_dev_info)(struct qed_dev *cdev, |
| 204 | struct qed_dev_eth_info *info); |
| 205 | |
Yuval Mintz | cc875c2 | 2015-10-26 11:02:31 +0200 | [diff] [blame] | 206 | void (*register_ops)(struct qed_dev *cdev, |
| 207 | struct qed_eth_cb_ops *ops, |
| 208 | void *cookie); |
| 209 | |
Yuval Mintz | eff1696 | 2016-05-11 16:36:21 +0300 | [diff] [blame] | 210 | bool(*check_mac) (struct qed_dev *cdev, u8 *mac); |
| 211 | |
Manish Chopra | cee4d26 | 2015-10-26 11:02:28 +0200 | [diff] [blame] | 212 | int (*vport_start)(struct qed_dev *cdev, |
Manish Chopra | 088c861 | 2016-03-04 12:35:05 -0500 | [diff] [blame] | 213 | struct qed_start_vport_params *params); |
Manish Chopra | cee4d26 | 2015-10-26 11:02:28 +0200 | [diff] [blame] | 214 | |
| 215 | int (*vport_stop)(struct qed_dev *cdev, |
| 216 | u8 vport_id); |
| 217 | |
| 218 | int (*vport_update)(struct qed_dev *cdev, |
| 219 | struct qed_update_vport_params *params); |
| 220 | |
| 221 | int (*q_rx_start)(struct qed_dev *cdev, |
| 222 | struct qed_queue_start_common_params *params, |
| 223 | u16 bd_max_bytes, |
| 224 | dma_addr_t bd_chain_phys_addr, |
| 225 | dma_addr_t cqe_pbl_addr, |
| 226 | u16 cqe_pbl_size, |
| 227 | void __iomem **pp_prod); |
| 228 | |
| 229 | int (*q_rx_stop)(struct qed_dev *cdev, |
| 230 | struct qed_stop_rxq_params *params); |
| 231 | |
| 232 | int (*q_tx_start)(struct qed_dev *cdev, |
| 233 | struct qed_queue_start_common_params *params, |
| 234 | dma_addr_t pbl_addr, |
| 235 | u16 pbl_size, |
| 236 | void __iomem **pp_doorbell); |
| 237 | |
| 238 | int (*q_tx_stop)(struct qed_dev *cdev, |
| 239 | struct qed_stop_txq_params *params); |
| 240 | |
| 241 | int (*filter_config)(struct qed_dev *cdev, |
| 242 | struct qed_filter_params *params); |
| 243 | |
| 244 | int (*fastpath_stop)(struct qed_dev *cdev); |
| 245 | |
| 246 | int (*eth_cqe_completion)(struct qed_dev *cdev, |
| 247 | u8 rss_id, |
| 248 | struct eth_slow_path_rx_cqe *cqe); |
Manish Chopra | 9df2ed0 | 2015-10-26 11:02:33 +0200 | [diff] [blame] | 249 | |
| 250 | void (*get_vport_stats)(struct qed_dev *cdev, |
| 251 | struct qed_eth_stats *stats); |
Manish Chopra | 464f664 | 2016-04-14 01:38:29 -0400 | [diff] [blame] | 252 | |
| 253 | int (*tunn_config)(struct qed_dev *cdev, |
| 254 | struct qed_tunn_params *params); |
Yuval Mintz | 25c089d | 2015-10-26 11:02:26 +0200 | [diff] [blame] | 255 | }; |
| 256 | |
Rahul Verma | 9511434 | 2016-04-10 12:42:59 +0300 | [diff] [blame] | 257 | const struct qed_eth_ops *qed_get_eth_ops(void); |
Yuval Mintz | 25c089d | 2015-10-26 11:02:26 +0200 | [diff] [blame] | 258 | void qed_put_eth_ops(void); |
| 259 | |
| 260 | #endif |