Yuval Mintz | 32a47e7 | 2016-05-11 16:36:12 +0300 | [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_VF_H |
| 10 | #define _QED_VF_H |
| 11 | |
Yuval Mintz | dacd88d | 2016-05-11 16:36:16 +0300 | [diff] [blame] | 12 | #include "qed_l2.h" |
Yuval Mintz | 36558c3 | 2016-05-11 16:36:17 +0300 | [diff] [blame^] | 13 | #include "qed_mcp.h" |
Yuval Mintz | dacd88d | 2016-05-11 16:36:16 +0300 | [diff] [blame] | 14 | |
| 15 | #define T_ETH_INDIRECTION_TABLE_SIZE 128 |
| 16 | #define T_ETH_RSS_KEY_SIZE 10 |
| 17 | |
Yuval Mintz | 1408cc1f | 2016-05-11 16:36:14 +0300 | [diff] [blame] | 18 | struct vf_pf_resc_request { |
| 19 | u8 num_rxqs; |
| 20 | u8 num_txqs; |
| 21 | u8 num_sbs; |
| 22 | u8 num_mac_filters; |
| 23 | u8 num_vlan_filters; |
| 24 | u8 num_mc_filters; |
| 25 | u16 padding; |
| 26 | }; |
| 27 | |
| 28 | struct hw_sb_info { |
| 29 | u16 hw_sb_id; |
| 30 | u8 sb_qid; |
| 31 | u8 padding[5]; |
| 32 | }; |
| 33 | |
Yuval Mintz | dacd88d | 2016-05-11 16:36:16 +0300 | [diff] [blame] | 34 | #define TLV_BUFFER_SIZE 1024 |
| 35 | |
Yuval Mintz | 37bff2b | 2016-05-11 16:36:13 +0300 | [diff] [blame] | 36 | enum { |
| 37 | PFVF_STATUS_WAITING, |
| 38 | PFVF_STATUS_SUCCESS, |
| 39 | PFVF_STATUS_FAILURE, |
| 40 | PFVF_STATUS_NOT_SUPPORTED, |
| 41 | PFVF_STATUS_NO_RESOURCE, |
| 42 | PFVF_STATUS_FORCED, |
| 43 | }; |
| 44 | |
| 45 | /* vf pf channel tlvs */ |
| 46 | /* general tlv header (used for both vf->pf request and pf->vf response) */ |
| 47 | struct channel_tlv { |
| 48 | u16 type; |
| 49 | u16 length; |
| 50 | }; |
| 51 | |
| 52 | /* header of first vf->pf tlv carries the offset used to calculate reponse |
| 53 | * buffer address |
| 54 | */ |
| 55 | struct vfpf_first_tlv { |
| 56 | struct channel_tlv tl; |
| 57 | u32 padding; |
| 58 | u64 reply_address; |
| 59 | }; |
| 60 | |
| 61 | /* header of pf->vf tlvs, carries the status of handling the request */ |
| 62 | struct pfvf_tlv { |
| 63 | struct channel_tlv tl; |
| 64 | u8 status; |
| 65 | u8 padding[3]; |
| 66 | }; |
| 67 | |
| 68 | /* response tlv used for most tlvs */ |
| 69 | struct pfvf_def_resp_tlv { |
| 70 | struct pfvf_tlv hdr; |
| 71 | }; |
| 72 | |
| 73 | /* used to terminate and pad a tlv list */ |
| 74 | struct channel_list_end_tlv { |
| 75 | struct channel_tlv tl; |
| 76 | u8 padding[4]; |
| 77 | }; |
| 78 | |
Yuval Mintz | 1408cc1f | 2016-05-11 16:36:14 +0300 | [diff] [blame] | 79 | #define VFPF_ACQUIRE_OS_LINUX (0) |
| 80 | #define VFPF_ACQUIRE_OS_WINDOWS (1) |
| 81 | #define VFPF_ACQUIRE_OS_ESX (2) |
| 82 | #define VFPF_ACQUIRE_OS_SOLARIS (3) |
| 83 | #define VFPF_ACQUIRE_OS_LINUX_USERSPACE (4) |
| 84 | |
| 85 | struct vfpf_acquire_tlv { |
| 86 | struct vfpf_first_tlv first_tlv; |
| 87 | |
| 88 | struct vf_pf_vfdev_info { |
| 89 | #define VFPF_ACQUIRE_CAP_OBSOLETE (1 << 0) |
| 90 | #define VFPF_ACQUIRE_CAP_100G (1 << 1) /* VF can support 100g */ |
| 91 | u64 capabilities; |
| 92 | u8 fw_major; |
| 93 | u8 fw_minor; |
| 94 | u8 fw_revision; |
| 95 | u8 fw_engineering; |
| 96 | u32 driver_version; |
| 97 | u16 opaque_fid; /* ME register value */ |
| 98 | u8 os_type; /* VFPF_ACQUIRE_OS_* value */ |
| 99 | u8 padding[5]; |
| 100 | } vfdev_info; |
| 101 | |
| 102 | struct vf_pf_resc_request resc_request; |
| 103 | |
| 104 | u64 bulletin_addr; |
| 105 | u32 bulletin_size; |
| 106 | u32 padding; |
| 107 | }; |
| 108 | |
Yuval Mintz | dacd88d | 2016-05-11 16:36:16 +0300 | [diff] [blame] | 109 | /* receive side scaling tlv */ |
| 110 | struct vfpf_vport_update_rss_tlv { |
| 111 | struct channel_tlv tl; |
| 112 | |
| 113 | u8 update_rss_flags; |
| 114 | #define VFPF_UPDATE_RSS_CONFIG_FLAG BIT(0) |
| 115 | #define VFPF_UPDATE_RSS_CAPS_FLAG BIT(1) |
| 116 | #define VFPF_UPDATE_RSS_IND_TABLE_FLAG BIT(2) |
| 117 | #define VFPF_UPDATE_RSS_KEY_FLAG BIT(3) |
| 118 | |
| 119 | u8 rss_enable; |
| 120 | u8 rss_caps; |
| 121 | u8 rss_table_size_log; /* The table size is 2 ^ rss_table_size_log */ |
| 122 | u16 rss_ind_table[T_ETH_INDIRECTION_TABLE_SIZE]; |
| 123 | u32 rss_key[T_ETH_RSS_KEY_SIZE]; |
| 124 | }; |
| 125 | |
Yuval Mintz | 1408cc1f | 2016-05-11 16:36:14 +0300 | [diff] [blame] | 126 | struct pfvf_storm_stats { |
| 127 | u32 address; |
| 128 | u32 len; |
| 129 | }; |
| 130 | |
| 131 | struct pfvf_stats_info { |
| 132 | struct pfvf_storm_stats mstats; |
| 133 | struct pfvf_storm_stats pstats; |
| 134 | struct pfvf_storm_stats tstats; |
| 135 | struct pfvf_storm_stats ustats; |
| 136 | }; |
| 137 | |
| 138 | struct pfvf_acquire_resp_tlv { |
| 139 | struct pfvf_tlv hdr; |
| 140 | |
| 141 | struct pf_vf_pfdev_info { |
| 142 | u32 chip_num; |
| 143 | u32 mfw_ver; |
| 144 | |
| 145 | u16 fw_major; |
| 146 | u16 fw_minor; |
| 147 | u16 fw_rev; |
| 148 | u16 fw_eng; |
| 149 | |
| 150 | u64 capabilities; |
| 151 | #define PFVF_ACQUIRE_CAP_DEFAULT_UNTAGGED BIT(0) |
| 152 | #define PFVF_ACQUIRE_CAP_100G BIT(1) /* If set, 100g PF */ |
| 153 | /* There are old PF versions where the PF might mistakenly override the sanity |
| 154 | * mechanism [version-based] and allow a VF that can't be supported to pass |
| 155 | * the acquisition phase. |
| 156 | * To overcome this, PFs now indicate that they're past that point and the new |
| 157 | * VFs would fail probe on the older PFs that fail to do so. |
| 158 | */ |
| 159 | #define PFVF_ACQUIRE_CAP_POST_FW_OVERRIDE BIT(2) |
| 160 | |
| 161 | u16 db_size; |
| 162 | u8 indices_per_sb; |
| 163 | u8 os_type; |
| 164 | |
| 165 | /* These should match the PF's qed_dev values */ |
| 166 | u16 chip_rev; |
| 167 | u8 dev_type; |
| 168 | |
| 169 | u8 padding; |
| 170 | |
| 171 | struct pfvf_stats_info stats_info; |
| 172 | |
| 173 | u8 port_mac[ETH_ALEN]; |
| 174 | u8 padding2[2]; |
| 175 | } pfdev_info; |
| 176 | |
| 177 | struct pf_vf_resc { |
| 178 | #define PFVF_MAX_QUEUES_PER_VF 16 |
| 179 | #define PFVF_MAX_SBS_PER_VF 16 |
| 180 | struct hw_sb_info hw_sbs[PFVF_MAX_SBS_PER_VF]; |
| 181 | u8 hw_qid[PFVF_MAX_QUEUES_PER_VF]; |
| 182 | u8 cid[PFVF_MAX_QUEUES_PER_VF]; |
| 183 | |
| 184 | u8 num_rxqs; |
| 185 | u8 num_txqs; |
| 186 | u8 num_sbs; |
| 187 | u8 num_mac_filters; |
| 188 | u8 num_vlan_filters; |
| 189 | u8 num_mc_filters; |
| 190 | u8 padding[2]; |
| 191 | } resc; |
| 192 | |
| 193 | u32 bulletin_size; |
| 194 | u32 padding; |
| 195 | }; |
| 196 | |
Yuval Mintz | dacd88d | 2016-05-11 16:36:16 +0300 | [diff] [blame] | 197 | struct pfvf_start_queue_resp_tlv { |
| 198 | struct pfvf_tlv hdr; |
| 199 | u32 offset; /* offset to consumer/producer of queue */ |
| 200 | u8 padding[4]; |
| 201 | }; |
| 202 | |
| 203 | /* Setup Queue */ |
| 204 | struct vfpf_start_rxq_tlv { |
| 205 | struct vfpf_first_tlv first_tlv; |
| 206 | |
| 207 | /* physical addresses */ |
| 208 | u64 rxq_addr; |
| 209 | u64 deprecated_sge_addr; |
| 210 | u64 cqe_pbl_addr; |
| 211 | |
| 212 | u16 cqe_pbl_size; |
| 213 | u16 hw_sb; |
| 214 | u16 rx_qid; |
| 215 | u16 hc_rate; /* desired interrupts per sec. */ |
| 216 | |
| 217 | u16 bd_max_bytes; |
| 218 | u16 stat_id; |
| 219 | u8 sb_index; |
| 220 | u8 padding[3]; |
| 221 | }; |
| 222 | |
| 223 | struct vfpf_start_txq_tlv { |
| 224 | struct vfpf_first_tlv first_tlv; |
| 225 | |
| 226 | /* physical addresses */ |
| 227 | u64 pbl_addr; |
| 228 | u16 pbl_size; |
| 229 | u16 stat_id; |
| 230 | u16 tx_qid; |
| 231 | u16 hw_sb; |
| 232 | |
| 233 | u32 flags; /* VFPF_QUEUE_FLG_X flags */ |
| 234 | u16 hc_rate; /* desired interrupts per sec. */ |
| 235 | u8 sb_index; |
| 236 | u8 padding[3]; |
| 237 | }; |
| 238 | |
| 239 | /* Stop RX Queue */ |
| 240 | struct vfpf_stop_rxqs_tlv { |
| 241 | struct vfpf_first_tlv first_tlv; |
| 242 | |
| 243 | u16 rx_qid; |
| 244 | u8 num_rxqs; |
| 245 | u8 cqe_completion; |
| 246 | u8 padding[4]; |
| 247 | }; |
| 248 | |
| 249 | /* Stop TX Queues */ |
| 250 | struct vfpf_stop_txqs_tlv { |
| 251 | struct vfpf_first_tlv first_tlv; |
| 252 | |
| 253 | u16 tx_qid; |
| 254 | u8 num_txqs; |
| 255 | u8 padding[5]; |
| 256 | }; |
| 257 | |
| 258 | struct vfpf_update_rxq_tlv { |
| 259 | struct vfpf_first_tlv first_tlv; |
| 260 | |
| 261 | u64 deprecated_sge_addr[PFVF_MAX_QUEUES_PER_VF]; |
| 262 | |
| 263 | u16 rx_qid; |
| 264 | u8 num_rxqs; |
| 265 | u8 flags; |
| 266 | #define VFPF_RXQ_UPD_INIT_SGE_DEPRECATE_FLAG BIT(0) |
| 267 | #define VFPF_RXQ_UPD_COMPLETE_CQE_FLAG BIT(1) |
| 268 | #define VFPF_RXQ_UPD_COMPLETE_EVENT_FLAG BIT(2) |
| 269 | |
| 270 | u8 padding[4]; |
| 271 | }; |
| 272 | |
| 273 | /* Set Queue Filters */ |
| 274 | struct vfpf_q_mac_vlan_filter { |
| 275 | u32 flags; |
| 276 | #define VFPF_Q_FILTER_DEST_MAC_VALID 0x01 |
| 277 | #define VFPF_Q_FILTER_VLAN_TAG_VALID 0x02 |
| 278 | #define VFPF_Q_FILTER_SET_MAC 0x100 /* set/clear */ |
| 279 | |
| 280 | u8 mac[ETH_ALEN]; |
| 281 | u16 vlan_tag; |
| 282 | |
| 283 | u8 padding[4]; |
| 284 | }; |
| 285 | |
| 286 | /* Start a vport */ |
| 287 | struct vfpf_vport_start_tlv { |
| 288 | struct vfpf_first_tlv first_tlv; |
| 289 | |
| 290 | u64 sb_addr[PFVF_MAX_SBS_PER_VF]; |
| 291 | |
| 292 | u32 tpa_mode; |
| 293 | u16 dep1; |
| 294 | u16 mtu; |
| 295 | |
| 296 | u8 vport_id; |
| 297 | u8 inner_vlan_removal; |
| 298 | |
| 299 | u8 only_untagged; |
| 300 | u8 max_buffers_per_cqe; |
| 301 | |
| 302 | u8 padding[4]; |
| 303 | }; |
| 304 | |
| 305 | /* Extended tlvs - need to add rss, mcast, accept mode tlvs */ |
| 306 | struct vfpf_vport_update_activate_tlv { |
| 307 | struct channel_tlv tl; |
| 308 | u8 update_rx; |
| 309 | u8 update_tx; |
| 310 | u8 active_rx; |
| 311 | u8 active_tx; |
| 312 | }; |
| 313 | |
| 314 | struct vfpf_vport_update_mcast_bin_tlv { |
| 315 | struct channel_tlv tl; |
| 316 | u8 padding[4]; |
| 317 | |
| 318 | u64 bins[8]; |
| 319 | }; |
| 320 | |
| 321 | struct vfpf_vport_update_accept_param_tlv { |
| 322 | struct channel_tlv tl; |
| 323 | u8 update_rx_mode; |
| 324 | u8 update_tx_mode; |
| 325 | u8 rx_accept_filter; |
| 326 | u8 tx_accept_filter; |
| 327 | }; |
| 328 | |
| 329 | /* Primary tlv as a header for various extended tlvs for |
| 330 | * various functionalities in vport update ramrod. |
| 331 | */ |
| 332 | struct vfpf_vport_update_tlv { |
| 333 | struct vfpf_first_tlv first_tlv; |
| 334 | }; |
| 335 | |
| 336 | struct vfpf_ucast_filter_tlv { |
| 337 | struct vfpf_first_tlv first_tlv; |
| 338 | |
| 339 | u8 opcode; |
| 340 | u8 type; |
| 341 | |
| 342 | u8 mac[ETH_ALEN]; |
| 343 | |
| 344 | u16 vlan; |
| 345 | u16 padding[3]; |
| 346 | }; |
| 347 | |
Yuval Mintz | 32a47e7 | 2016-05-11 16:36:12 +0300 | [diff] [blame] | 348 | struct tlv_buffer_size { |
| 349 | u8 tlv_buffer[TLV_BUFFER_SIZE]; |
| 350 | }; |
| 351 | |
| 352 | union vfpf_tlvs { |
Yuval Mintz | 37bff2b | 2016-05-11 16:36:13 +0300 | [diff] [blame] | 353 | struct vfpf_first_tlv first_tlv; |
Yuval Mintz | 1408cc1f | 2016-05-11 16:36:14 +0300 | [diff] [blame] | 354 | struct vfpf_acquire_tlv acquire; |
Yuval Mintz | dacd88d | 2016-05-11 16:36:16 +0300 | [diff] [blame] | 355 | struct vfpf_start_rxq_tlv start_rxq; |
| 356 | struct vfpf_start_txq_tlv start_txq; |
| 357 | struct vfpf_stop_rxqs_tlv stop_rxqs; |
| 358 | struct vfpf_stop_txqs_tlv stop_txqs; |
| 359 | struct vfpf_vport_start_tlv start_vport; |
| 360 | struct vfpf_vport_update_tlv vport_update; |
| 361 | struct vfpf_ucast_filter_tlv ucast_filter; |
Yuval Mintz | 37bff2b | 2016-05-11 16:36:13 +0300 | [diff] [blame] | 362 | struct channel_list_end_tlv list_end; |
Yuval Mintz | 32a47e7 | 2016-05-11 16:36:12 +0300 | [diff] [blame] | 363 | struct tlv_buffer_size tlv_buf_size; |
| 364 | }; |
| 365 | |
| 366 | union pfvf_tlvs { |
Yuval Mintz | 37bff2b | 2016-05-11 16:36:13 +0300 | [diff] [blame] | 367 | struct pfvf_def_resp_tlv default_resp; |
Yuval Mintz | 1408cc1f | 2016-05-11 16:36:14 +0300 | [diff] [blame] | 368 | struct pfvf_acquire_resp_tlv acquire_resp; |
Yuval Mintz | 32a47e7 | 2016-05-11 16:36:12 +0300 | [diff] [blame] | 369 | struct tlv_buffer_size tlv_buf_size; |
Yuval Mintz | dacd88d | 2016-05-11 16:36:16 +0300 | [diff] [blame] | 370 | struct pfvf_start_queue_resp_tlv queue_start; |
Yuval Mintz | 32a47e7 | 2016-05-11 16:36:12 +0300 | [diff] [blame] | 371 | }; |
| 372 | |
| 373 | struct qed_bulletin_content { |
| 374 | /* crc of structure to ensure is not in mid-update */ |
| 375 | u32 crc; |
| 376 | |
| 377 | u32 version; |
| 378 | |
| 379 | /* bitmap indicating which fields hold valid values */ |
| 380 | u64 valid_bitmap; |
Yuval Mintz | 36558c3 | 2016-05-11 16:36:17 +0300 | [diff] [blame^] | 381 | |
| 382 | /* used for MAC_ADDR or MAC_ADDR_FORCED */ |
| 383 | u8 mac[ETH_ALEN]; |
| 384 | |
| 385 | /* If valid, 1 => only untagged Rx if no vlan is configured */ |
| 386 | u8 default_only_untagged; |
| 387 | u8 padding; |
| 388 | |
| 389 | /* The following is a 'copy' of qed_mcp_link_state, |
| 390 | * qed_mcp_link_params and qed_mcp_link_capabilities. Since it's |
| 391 | * possible the structs will increase further along the road we cannot |
| 392 | * have it here; Instead we need to have all of its fields. |
| 393 | */ |
| 394 | u8 req_autoneg; |
| 395 | u8 req_autoneg_pause; |
| 396 | u8 req_forced_rx; |
| 397 | u8 req_forced_tx; |
| 398 | u8 padding2[4]; |
| 399 | |
| 400 | u32 req_adv_speed; |
| 401 | u32 req_forced_speed; |
| 402 | u32 req_loopback; |
| 403 | u32 padding3; |
| 404 | |
| 405 | u8 link_up; |
| 406 | u8 full_duplex; |
| 407 | u8 autoneg; |
| 408 | u8 autoneg_complete; |
| 409 | u8 parallel_detection; |
| 410 | u8 pfc_enabled; |
| 411 | u8 partner_tx_flow_ctrl_en; |
| 412 | u8 partner_rx_flow_ctrl_en; |
| 413 | u8 partner_adv_pause; |
| 414 | u8 sfp_tx_fault; |
| 415 | u8 padding4[6]; |
| 416 | |
| 417 | u32 speed; |
| 418 | u32 partner_adv_speed; |
| 419 | |
| 420 | u32 capability_speed; |
Yuval Mintz | 32a47e7 | 2016-05-11 16:36:12 +0300 | [diff] [blame] | 421 | }; |
| 422 | |
| 423 | struct qed_bulletin { |
| 424 | dma_addr_t phys; |
| 425 | struct qed_bulletin_content *p_virt; |
| 426 | u32 size; |
| 427 | }; |
| 428 | |
Yuval Mintz | 37bff2b | 2016-05-11 16:36:13 +0300 | [diff] [blame] | 429 | enum { |
| 430 | CHANNEL_TLV_NONE, /* ends tlv sequence */ |
Yuval Mintz | 1408cc1f | 2016-05-11 16:36:14 +0300 | [diff] [blame] | 431 | CHANNEL_TLV_ACQUIRE, |
Yuval Mintz | dacd88d | 2016-05-11 16:36:16 +0300 | [diff] [blame] | 432 | CHANNEL_TLV_VPORT_START, |
| 433 | CHANNEL_TLV_VPORT_UPDATE, |
| 434 | CHANNEL_TLV_VPORT_TEARDOWN, |
| 435 | CHANNEL_TLV_START_RXQ, |
| 436 | CHANNEL_TLV_START_TXQ, |
| 437 | CHANNEL_TLV_STOP_RXQS, |
| 438 | CHANNEL_TLV_STOP_TXQS, |
Yuval Mintz | 0b55e27 | 2016-05-11 16:36:15 +0300 | [diff] [blame] | 439 | CHANNEL_TLV_INT_CLEANUP, |
| 440 | CHANNEL_TLV_CLOSE, |
| 441 | CHANNEL_TLV_RELEASE, |
Yuval Mintz | 37bff2b | 2016-05-11 16:36:13 +0300 | [diff] [blame] | 442 | CHANNEL_TLV_LIST_END, |
Yuval Mintz | dacd88d | 2016-05-11 16:36:16 +0300 | [diff] [blame] | 443 | CHANNEL_TLV_UCAST_FILTER, |
| 444 | CHANNEL_TLV_VPORT_UPDATE_ACTIVATE, |
| 445 | CHANNEL_TLV_VPORT_UPDATE_MCAST, |
| 446 | CHANNEL_TLV_VPORT_UPDATE_ACCEPT_PARAM, |
| 447 | CHANNEL_TLV_VPORT_UPDATE_RSS, |
| 448 | CHANNEL_TLV_MAX, |
| 449 | |
| 450 | /* Required for iterating over vport-update tlvs. |
| 451 | * Will break in case non-sequential vport-update tlvs. |
| 452 | */ |
| 453 | CHANNEL_TLV_VPORT_UPDATE_MAX = CHANNEL_TLV_VPORT_UPDATE_RSS + 1, |
Yuval Mintz | 37bff2b | 2016-05-11 16:36:13 +0300 | [diff] [blame] | 454 | }; |
| 455 | |
Yuval Mintz | 1408cc1f | 2016-05-11 16:36:14 +0300 | [diff] [blame] | 456 | /* This data is held in the qed_hwfn structure for VFs only. */ |
| 457 | struct qed_vf_iov { |
| 458 | union vfpf_tlvs *vf2pf_request; |
| 459 | dma_addr_t vf2pf_request_phys; |
| 460 | union pfvf_tlvs *pf2vf_reply; |
| 461 | dma_addr_t pf2vf_reply_phys; |
| 462 | |
| 463 | /* Should be taken whenever the mailbox buffers are accessed */ |
| 464 | struct mutex mutex; |
| 465 | u8 *offset; |
| 466 | |
| 467 | /* Bulletin Board */ |
| 468 | struct qed_bulletin bulletin; |
| 469 | struct qed_bulletin_content bulletin_shadow; |
| 470 | |
| 471 | /* we set aside a copy of the acquire response */ |
| 472 | struct pfvf_acquire_resp_tlv acquire_resp; |
| 473 | }; |
| 474 | |
| 475 | #ifdef CONFIG_QED_SRIOV |
| 476 | /** |
Yuval Mintz | 36558c3 | 2016-05-11 16:36:17 +0300 | [diff] [blame^] | 477 | * @brief Read the VF bulletin and act on it if needed |
| 478 | * |
| 479 | * @param p_hwfn |
| 480 | * @param p_change - qed fills 1 iff bulletin board has changed, 0 otherwise. |
| 481 | * |
| 482 | * @return enum _qed_status |
| 483 | */ |
| 484 | int qed_vf_read_bulletin(struct qed_hwfn *p_hwfn, u8 *p_change); |
| 485 | |
| 486 | /** |
| 487 | * @brief Get link paramters for VF from qed |
| 488 | * |
| 489 | * @param p_hwfn |
| 490 | * @param params - the link params structure to be filled for the VF |
| 491 | */ |
| 492 | void qed_vf_get_link_params(struct qed_hwfn *p_hwfn, |
| 493 | struct qed_mcp_link_params *params); |
| 494 | |
| 495 | /** |
| 496 | * @brief Get link state for VF from qed |
| 497 | * |
| 498 | * @param p_hwfn |
| 499 | * @param link - the link state structure to be filled for the VF |
| 500 | */ |
| 501 | void qed_vf_get_link_state(struct qed_hwfn *p_hwfn, |
| 502 | struct qed_mcp_link_state *link); |
| 503 | |
| 504 | /** |
| 505 | * @brief Get link capabilities for VF from qed |
| 506 | * |
| 507 | * @param p_hwfn |
| 508 | * @param p_link_caps - the link capabilities structure to be filled for the VF |
| 509 | */ |
| 510 | void qed_vf_get_link_caps(struct qed_hwfn *p_hwfn, |
| 511 | struct qed_mcp_link_capabilities *p_link_caps); |
| 512 | |
| 513 | /** |
Yuval Mintz | 1408cc1f | 2016-05-11 16:36:14 +0300 | [diff] [blame] | 514 | * @brief Get number of Rx queues allocated for VF by qed |
| 515 | * |
| 516 | * @param p_hwfn |
| 517 | * @param num_rxqs - allocated RX queues |
| 518 | */ |
| 519 | void qed_vf_get_num_rxqs(struct qed_hwfn *p_hwfn, u8 *num_rxqs); |
| 520 | |
| 521 | /** |
| 522 | * @brief Get port mac address for VF |
| 523 | * |
| 524 | * @param p_hwfn |
| 525 | * @param port_mac - destination location for port mac |
| 526 | */ |
| 527 | void qed_vf_get_port_mac(struct qed_hwfn *p_hwfn, u8 *port_mac); |
| 528 | |
| 529 | /** |
| 530 | * @brief Get number of VLAN filters allocated for VF by qed |
| 531 | * |
| 532 | * @param p_hwfn |
| 533 | * @param num_rxqs - allocated VLAN filters |
| 534 | */ |
| 535 | void qed_vf_get_num_vlan_filters(struct qed_hwfn *p_hwfn, |
| 536 | u8 *num_vlan_filters); |
| 537 | |
| 538 | /** |
| 539 | * @brief Set firmware version information in dev_info from VFs acquire response tlv |
| 540 | * |
| 541 | * @param p_hwfn |
| 542 | * @param fw_major |
| 543 | * @param fw_minor |
| 544 | * @param fw_rev |
| 545 | * @param fw_eng |
| 546 | */ |
| 547 | void qed_vf_get_fw_version(struct qed_hwfn *p_hwfn, |
| 548 | u16 *fw_major, u16 *fw_minor, |
| 549 | u16 *fw_rev, u16 *fw_eng); |
| 550 | |
| 551 | /** |
| 552 | * @brief hw preparation for VF |
| 553 | * sends ACQUIRE message |
| 554 | * |
| 555 | * @param p_hwfn |
| 556 | * |
| 557 | * @return int |
| 558 | */ |
| 559 | int qed_vf_hw_prepare(struct qed_hwfn *p_hwfn); |
| 560 | |
| 561 | /** |
Yuval Mintz | dacd88d | 2016-05-11 16:36:16 +0300 | [diff] [blame] | 562 | * @brief VF - start the RX Queue by sending a message to the PF |
| 563 | * @param p_hwfn |
| 564 | * @param cid - zero based within the VF |
| 565 | * @param rx_queue_id - zero based within the VF |
| 566 | * @param sb - VF status block for this queue |
| 567 | * @param sb_index - Index within the status block |
| 568 | * @param bd_max_bytes - maximum number of bytes per bd |
| 569 | * @param bd_chain_phys_addr - physical address of bd chain |
| 570 | * @param cqe_pbl_addr - physical address of pbl |
| 571 | * @param cqe_pbl_size - pbl size |
| 572 | * @param pp_prod - pointer to the producer to be |
| 573 | * used in fastpath |
| 574 | * |
| 575 | * @return int |
| 576 | */ |
| 577 | int qed_vf_pf_rxq_start(struct qed_hwfn *p_hwfn, |
| 578 | u8 rx_queue_id, |
| 579 | u16 sb, |
| 580 | u8 sb_index, |
| 581 | u16 bd_max_bytes, |
| 582 | dma_addr_t bd_chain_phys_addr, |
| 583 | dma_addr_t cqe_pbl_addr, |
| 584 | u16 cqe_pbl_size, void __iomem **pp_prod); |
| 585 | |
| 586 | /** |
| 587 | * @brief VF - start the TX queue by sending a message to the |
| 588 | * PF. |
| 589 | * |
| 590 | * @param p_hwfn |
| 591 | * @param tx_queue_id - zero based within the VF |
| 592 | * @param sb - status block for this queue |
| 593 | * @param sb_index - index within the status block |
| 594 | * @param bd_chain_phys_addr - physical address of tx chain |
| 595 | * @param pp_doorbell - pointer to address to which to |
| 596 | * write the doorbell too.. |
| 597 | * |
| 598 | * @return int |
| 599 | */ |
| 600 | int qed_vf_pf_txq_start(struct qed_hwfn *p_hwfn, |
| 601 | u16 tx_queue_id, |
| 602 | u16 sb, |
| 603 | u8 sb_index, |
| 604 | dma_addr_t pbl_addr, |
| 605 | u16 pbl_size, void __iomem **pp_doorbell); |
| 606 | |
| 607 | /** |
| 608 | * @brief VF - stop the RX queue by sending a message to the PF |
| 609 | * |
| 610 | * @param p_hwfn |
| 611 | * @param rx_qid |
| 612 | * @param cqe_completion |
| 613 | * |
| 614 | * @return int |
| 615 | */ |
| 616 | int qed_vf_pf_rxq_stop(struct qed_hwfn *p_hwfn, |
| 617 | u16 rx_qid, bool cqe_completion); |
| 618 | |
| 619 | /** |
| 620 | * @brief VF - stop the TX queue by sending a message to the PF |
| 621 | * |
| 622 | * @param p_hwfn |
| 623 | * @param tx_qid |
| 624 | * |
| 625 | * @return int |
| 626 | */ |
| 627 | int qed_vf_pf_txq_stop(struct qed_hwfn *p_hwfn, u16 tx_qid); |
| 628 | |
| 629 | /** |
| 630 | * @brief VF - send a vport update command |
| 631 | * |
| 632 | * @param p_hwfn |
| 633 | * @param params |
| 634 | * |
| 635 | * @return int |
| 636 | */ |
| 637 | int qed_vf_pf_vport_update(struct qed_hwfn *p_hwfn, |
| 638 | struct qed_sp_vport_update_params *p_params); |
| 639 | |
| 640 | /** |
Yuval Mintz | 0b55e27 | 2016-05-11 16:36:15 +0300 | [diff] [blame] | 641 | * |
| 642 | * @brief VF - send a close message to PF |
| 643 | * |
| 644 | * @param p_hwfn |
| 645 | * |
| 646 | * @return enum _qed_status |
| 647 | */ |
| 648 | int qed_vf_pf_reset(struct qed_hwfn *p_hwfn); |
| 649 | |
| 650 | /** |
| 651 | * @brief VF - free vf`s memories |
| 652 | * |
| 653 | * @param p_hwfn |
| 654 | * |
| 655 | * @return enum _qed_status |
| 656 | */ |
| 657 | int qed_vf_pf_release(struct qed_hwfn *p_hwfn); |
Yuval Mintz | 36558c3 | 2016-05-11 16:36:17 +0300 | [diff] [blame^] | 658 | |
Yuval Mintz | 0b55e27 | 2016-05-11 16:36:15 +0300 | [diff] [blame] | 659 | /** |
Yuval Mintz | 1408cc1f | 2016-05-11 16:36:14 +0300 | [diff] [blame] | 660 | * @brief qed_vf_get_igu_sb_id - Get the IGU SB ID for a given |
| 661 | * sb_id. For VFs igu sbs don't have to be contiguous |
| 662 | * |
| 663 | * @param p_hwfn |
| 664 | * @param sb_id |
| 665 | * |
| 666 | * @return INLINE u16 |
| 667 | */ |
| 668 | u16 qed_vf_get_igu_sb_id(struct qed_hwfn *p_hwfn, u16 sb_id); |
Yuval Mintz | 0b55e27 | 2016-05-11 16:36:15 +0300 | [diff] [blame] | 669 | |
| 670 | /** |
Yuval Mintz | dacd88d | 2016-05-11 16:36:16 +0300 | [diff] [blame] | 671 | * @brief qed_vf_pf_vport_start - perform vport start for VF. |
| 672 | * |
| 673 | * @param p_hwfn |
| 674 | * @param vport_id |
| 675 | * @param mtu |
| 676 | * @param inner_vlan_removal |
| 677 | * @param tpa_mode |
| 678 | * @param max_buffers_per_cqe, |
| 679 | * @param only_untagged - default behavior regarding vlan acceptance |
| 680 | * |
| 681 | * @return enum _qed_status |
| 682 | */ |
| 683 | int qed_vf_pf_vport_start(struct qed_hwfn *p_hwfn, |
| 684 | u8 vport_id, |
| 685 | u16 mtu, |
| 686 | u8 inner_vlan_removal, |
| 687 | enum qed_tpa_mode tpa_mode, |
| 688 | u8 max_buffers_per_cqe); |
| 689 | |
| 690 | /** |
| 691 | * @brief qed_vf_pf_vport_stop - stop the VF's vport |
| 692 | * |
| 693 | * @param p_hwfn |
| 694 | * |
| 695 | * @return enum _qed_status |
| 696 | */ |
| 697 | int qed_vf_pf_vport_stop(struct qed_hwfn *p_hwfn); |
| 698 | |
| 699 | int qed_vf_pf_filter_ucast(struct qed_hwfn *p_hwfn, |
| 700 | struct qed_filter_ucast *p_param); |
| 701 | |
| 702 | void qed_vf_pf_filter_mcast(struct qed_hwfn *p_hwfn, |
| 703 | struct qed_filter_mcast *p_filter_cmd); |
| 704 | |
| 705 | /** |
Yuval Mintz | 0b55e27 | 2016-05-11 16:36:15 +0300 | [diff] [blame] | 706 | * @brief qed_vf_pf_int_cleanup - clean the SB of the VF |
| 707 | * |
| 708 | * @param p_hwfn |
| 709 | * |
| 710 | * @return enum _qed_status |
| 711 | */ |
| 712 | int qed_vf_pf_int_cleanup(struct qed_hwfn *p_hwfn); |
Yuval Mintz | 36558c3 | 2016-05-11 16:36:17 +0300 | [diff] [blame^] | 713 | |
| 714 | /** |
| 715 | * @brief - return the link params in a given bulletin board |
| 716 | * |
| 717 | * @param p_hwfn |
| 718 | * @param p_params - pointer to a struct to fill with link params |
| 719 | * @param p_bulletin |
| 720 | */ |
| 721 | void __qed_vf_get_link_params(struct qed_hwfn *p_hwfn, |
| 722 | struct qed_mcp_link_params *p_params, |
| 723 | struct qed_bulletin_content *p_bulletin); |
| 724 | |
| 725 | /** |
| 726 | * @brief - return the link state in a given bulletin board |
| 727 | * |
| 728 | * @param p_hwfn |
| 729 | * @param p_link - pointer to a struct to fill with link state |
| 730 | * @param p_bulletin |
| 731 | */ |
| 732 | void __qed_vf_get_link_state(struct qed_hwfn *p_hwfn, |
| 733 | struct qed_mcp_link_state *p_link, |
| 734 | struct qed_bulletin_content *p_bulletin); |
| 735 | |
| 736 | /** |
| 737 | * @brief - return the link capabilities in a given bulletin board |
| 738 | * |
| 739 | * @param p_hwfn |
| 740 | * @param p_link - pointer to a struct to fill with link capabilities |
| 741 | * @param p_bulletin |
| 742 | */ |
| 743 | void __qed_vf_get_link_caps(struct qed_hwfn *p_hwfn, |
| 744 | struct qed_mcp_link_capabilities *p_link_caps, |
| 745 | struct qed_bulletin_content *p_bulletin); |
| 746 | |
| 747 | void qed_iov_vf_task(struct work_struct *work); |
Yuval Mintz | 1408cc1f | 2016-05-11 16:36:14 +0300 | [diff] [blame] | 748 | #else |
Yuval Mintz | 36558c3 | 2016-05-11 16:36:17 +0300 | [diff] [blame^] | 749 | static inline void qed_vf_get_link_params(struct qed_hwfn *p_hwfn, |
| 750 | struct qed_mcp_link_params *params) |
| 751 | { |
| 752 | } |
| 753 | |
| 754 | static inline void qed_vf_get_link_state(struct qed_hwfn *p_hwfn, |
| 755 | struct qed_mcp_link_state *link) |
| 756 | { |
| 757 | } |
| 758 | |
| 759 | static inline void |
| 760 | qed_vf_get_link_caps(struct qed_hwfn *p_hwfn, |
| 761 | struct qed_mcp_link_capabilities *p_link_caps) |
| 762 | { |
| 763 | } |
| 764 | |
Yuval Mintz | 1408cc1f | 2016-05-11 16:36:14 +0300 | [diff] [blame] | 765 | static inline void qed_vf_get_num_rxqs(struct qed_hwfn *p_hwfn, u8 *num_rxqs) |
| 766 | { |
| 767 | } |
| 768 | |
| 769 | static inline void qed_vf_get_port_mac(struct qed_hwfn *p_hwfn, u8 *port_mac) |
| 770 | { |
| 771 | } |
| 772 | |
| 773 | static inline void qed_vf_get_num_vlan_filters(struct qed_hwfn *p_hwfn, |
| 774 | u8 *num_vlan_filters) |
| 775 | { |
| 776 | } |
| 777 | |
| 778 | static inline void qed_vf_get_fw_version(struct qed_hwfn *p_hwfn, |
| 779 | u16 *fw_major, u16 *fw_minor, |
| 780 | u16 *fw_rev, u16 *fw_eng) |
| 781 | { |
| 782 | } |
| 783 | |
| 784 | static inline int qed_vf_hw_prepare(struct qed_hwfn *p_hwfn) |
| 785 | { |
| 786 | return -EINVAL; |
| 787 | } |
| 788 | |
Yuval Mintz | dacd88d | 2016-05-11 16:36:16 +0300 | [diff] [blame] | 789 | static inline int qed_vf_pf_rxq_start(struct qed_hwfn *p_hwfn, |
| 790 | u8 rx_queue_id, |
| 791 | u16 sb, |
| 792 | u8 sb_index, |
| 793 | u16 bd_max_bytes, |
| 794 | dma_addr_t bd_chain_phys_adr, |
| 795 | dma_addr_t cqe_pbl_addr, |
| 796 | u16 cqe_pbl_size, void __iomem **pp_prod) |
| 797 | { |
| 798 | return -EINVAL; |
| 799 | } |
| 800 | |
| 801 | static inline int qed_vf_pf_txq_start(struct qed_hwfn *p_hwfn, |
| 802 | u16 tx_queue_id, |
| 803 | u16 sb, |
| 804 | u8 sb_index, |
| 805 | dma_addr_t pbl_addr, |
| 806 | u16 pbl_size, void __iomem **pp_doorbell) |
| 807 | { |
| 808 | return -EINVAL; |
| 809 | } |
| 810 | |
| 811 | static inline int qed_vf_pf_rxq_stop(struct qed_hwfn *p_hwfn, |
| 812 | u16 rx_qid, bool cqe_completion) |
| 813 | { |
| 814 | return -EINVAL; |
| 815 | } |
| 816 | |
| 817 | static inline int qed_vf_pf_txq_stop(struct qed_hwfn *p_hwfn, u16 tx_qid) |
| 818 | { |
| 819 | return -EINVAL; |
| 820 | } |
| 821 | |
| 822 | static inline int |
| 823 | qed_vf_pf_vport_update(struct qed_hwfn *p_hwfn, |
| 824 | struct qed_sp_vport_update_params *p_params) |
| 825 | { |
| 826 | return -EINVAL; |
| 827 | } |
| 828 | |
Yuval Mintz | 0b55e27 | 2016-05-11 16:36:15 +0300 | [diff] [blame] | 829 | static inline int qed_vf_pf_reset(struct qed_hwfn *p_hwfn) |
| 830 | { |
| 831 | return -EINVAL; |
| 832 | } |
| 833 | |
| 834 | static inline int qed_vf_pf_release(struct qed_hwfn *p_hwfn) |
| 835 | { |
| 836 | return -EINVAL; |
| 837 | } |
| 838 | |
Yuval Mintz | 1408cc1f | 2016-05-11 16:36:14 +0300 | [diff] [blame] | 839 | static inline u16 qed_vf_get_igu_sb_id(struct qed_hwfn *p_hwfn, u16 sb_id) |
| 840 | { |
| 841 | return 0; |
| 842 | } |
Yuval Mintz | 0b55e27 | 2016-05-11 16:36:15 +0300 | [diff] [blame] | 843 | |
Yuval Mintz | dacd88d | 2016-05-11 16:36:16 +0300 | [diff] [blame] | 844 | static inline int qed_vf_pf_vport_start(struct qed_hwfn *p_hwfn, |
| 845 | u8 vport_id, |
| 846 | u16 mtu, |
| 847 | u8 inner_vlan_removal, |
| 848 | enum qed_tpa_mode tpa_mode, |
| 849 | u8 max_buffers_per_cqe) |
| 850 | { |
| 851 | return -EINVAL; |
| 852 | } |
| 853 | |
| 854 | static inline int qed_vf_pf_vport_stop(struct qed_hwfn *p_hwfn) |
| 855 | { |
| 856 | return -EINVAL; |
| 857 | } |
| 858 | |
| 859 | static inline int qed_vf_pf_filter_ucast(struct qed_hwfn *p_hwfn, |
| 860 | struct qed_filter_ucast *p_param) |
| 861 | { |
| 862 | return -EINVAL; |
| 863 | } |
| 864 | |
| 865 | static inline void qed_vf_pf_filter_mcast(struct qed_hwfn *p_hwfn, |
| 866 | struct qed_filter_mcast *p_filter_cmd) |
| 867 | { |
| 868 | } |
| 869 | |
Yuval Mintz | 0b55e27 | 2016-05-11 16:36:15 +0300 | [diff] [blame] | 870 | static inline int qed_vf_pf_int_cleanup(struct qed_hwfn *p_hwfn) |
| 871 | { |
| 872 | return -EINVAL; |
| 873 | } |
Yuval Mintz | 36558c3 | 2016-05-11 16:36:17 +0300 | [diff] [blame^] | 874 | |
| 875 | static inline void __qed_vf_get_link_params(struct qed_hwfn *p_hwfn, |
| 876 | struct qed_mcp_link_params |
| 877 | *p_params, |
| 878 | struct qed_bulletin_content |
| 879 | *p_bulletin) |
| 880 | { |
| 881 | } |
| 882 | |
| 883 | static inline void __qed_vf_get_link_state(struct qed_hwfn *p_hwfn, |
| 884 | struct qed_mcp_link_state *p_link, |
| 885 | struct qed_bulletin_content |
| 886 | *p_bulletin) |
| 887 | { |
| 888 | } |
| 889 | |
| 890 | static inline void |
| 891 | __qed_vf_get_link_caps(struct qed_hwfn *p_hwfn, |
| 892 | struct qed_mcp_link_capabilities *p_link_caps, |
| 893 | struct qed_bulletin_content *p_bulletin) |
| 894 | { |
| 895 | } |
| 896 | |
| 897 | static inline void qed_iov_vf_task(struct work_struct *work) |
| 898 | { |
| 899 | } |
Yuval Mintz | 1408cc1f | 2016-05-11 16:36:14 +0300 | [diff] [blame] | 900 | #endif |
| 901 | |
Yuval Mintz | 32a47e7 | 2016-05-11 16:36:12 +0300 | [diff] [blame] | 902 | #endif |