1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2021 Microsoft Corp. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * 30 * $FreeBSD$ 31 * 32 */ 33 34 #ifndef _MANA_H 35 #define _MANA_H 36 37 #include <sys/types.h> 38 #include <sys/proc.h> 39 #include <sys/socket.h> 40 #include <sys/sysctl.h> 41 #include <sys/taskqueue.h> 42 #include <sys/counter.h> 43 44 #include <net/ethernet.h> 45 #include <net/if.h> 46 #include <net/if_media.h> 47 #include <netinet/tcp_lro.h> 48 49 #include "gdma.h" 50 #include "hw_channel.h" 51 52 53 /* Microsoft Azure Network Adapter (MANA)'s definitions 54 * 55 * Structures labeled with "HW DATA" are exchanged with the hardware. All of 56 * them are naturally aligned and hence don't need __packed. 57 */ 58 /* MANA protocol version */ 59 #define MANA_MAJOR_VERSION 0 60 #define MANA_MINOR_VERSION 1 61 #define MANA_MICRO_VERSION 1 62 63 #define DRV_MODULE_NAME "mana" 64 65 #ifndef DRV_MODULE_VERSION 66 #define DRV_MODULE_VERSION \ 67 __XSTRING(MANA_MAJOR_VERSION) "." \ 68 __XSTRING(MANA_MINOR_VERSION) "." \ 69 __XSTRING(MANA_MICRO_VERSION) 70 #endif 71 #define DEVICE_NAME "Microsoft Azure Network Adapter (MANA)" 72 #define DEVICE_DESC "MANA adapter" 73 74 /* 75 * Supported PCI vendor and devices IDs 76 */ 77 #ifndef PCI_VENDOR_ID_MICROSOFT 78 #define PCI_VENDOR_ID_MICROSOFT 0x1414 79 #endif 80 81 #define PCI_DEV_ID_MANA_VF 0x00ba 82 83 typedef struct _mana_vendor_id_t { 84 uint16_t vendor_id; 85 uint16_t device_id; 86 } mana_vendor_id_t; 87 88 typedef uint64_t mana_handle_t; 89 #define INVALID_MANA_HANDLE ((mana_handle_t)-1) 90 91 enum TRI_STATE { 92 TRI_STATE_UNKNOWN = -1, 93 TRI_STATE_FALSE = 0, 94 TRI_STATE_TRUE = 1 95 }; 96 97 /* Number of entries for hardware indirection table must be in power of 2 */ 98 #define MANA_INDIRECT_TABLE_SIZE 64 99 #define MANA_INDIRECT_TABLE_MASK (MANA_INDIRECT_TABLE_SIZE - 1) 100 101 /* The Toeplitz hash key's length in bytes: should be multiple of 8 */ 102 #define MANA_HASH_KEY_SIZE 40 103 104 #define COMP_ENTRY_SIZE 64 105 106 #define MIN_FRAME_SIZE 146 107 #define ADAPTER_MTU_SIZE 1500 108 #define DEFAULT_FRAME_SIZE (ADAPTER_MTU_SIZE + 14) 109 #define MAX_FRAME_SIZE 4096 110 111 #define RX_BUFFERS_PER_QUEUE 512 112 113 #define MAX_SEND_BUFFERS_PER_QUEUE 256 114 115 #define EQ_SIZE (8 * PAGE_SIZE) 116 #define LOG2_EQ_THROTTLE 3 117 118 #define MAX_PORTS_IN_MANA_DEV 8 119 120 struct mana_send_buf_info { 121 struct mbuf *mbuf; 122 bus_dmamap_t dma_map; 123 124 /* Required to store the result of mana_gd_post_work_request. 125 * gdma_posted_wqe_info.wqe_size_in_bu is required for progressing the 126 * work queue when the WQE is consumed. 127 */ 128 struct gdma_posted_wqe_info wqe_inf; 129 }; 130 131 struct mana_stats { 132 counter_u64_t packets; /* rx, tx */ 133 counter_u64_t bytes; /* rx, tx */ 134 counter_u64_t stop; /* tx */ 135 counter_u64_t wakeup; /* tx */ 136 counter_u64_t collapse; /* tx */ 137 counter_u64_t collapse_err; /* tx */ 138 counter_u64_t dma_mapping_err; /* rx, tx */ 139 counter_u64_t mbuf_alloc_fail; /* rx */ 140 counter_u64_t alt_chg; /* tx */ 141 counter_u64_t alt_reset; /* tx */ 142 }; 143 144 struct mana_txq { 145 struct gdma_queue *gdma_sq; 146 147 union { 148 uint32_t gdma_txq_id; 149 struct { 150 uint32_t reserved1 :10; 151 uint32_t vsq_frame :14; 152 uint32_t reserved2 :8; 153 }; 154 }; 155 156 uint16_t vp_offset; 157 158 struct ifnet *ndev; 159 /* Store index to the array of tx_qp in port structure */ 160 int idx; 161 /* The alternative txq idx when this txq is under heavy load */ 162 int alt_txq_idx; 163 164 /* The mbufs are sent to the HW and we are waiting for the CQEs. */ 165 struct mana_send_buf_info *tx_buf_info; 166 uint16_t next_to_use; 167 uint16_t next_to_complete; 168 169 atomic_t pending_sends; 170 171 struct buf_ring *txq_br; 172 struct mtx txq_mtx; 173 char txq_mtx_name[16]; 174 175 struct task enqueue_task; 176 struct taskqueue *enqueue_tq; 177 178 struct mana_stats stats; 179 }; 180 181 182 /* 183 * Max WQE size is 512B. The first 8B is for GDMA Out of Band (OOB), 184 * next is the Client OOB can be either 8B or 24B. Thus, the max 185 * space for SGL entries in a singel WQE is 512 - 8 - 8 = 496B. Since each 186 * SGL is 16B in size, the max number of SGLs in a WQE is 496/16 = 31. 187 * Save one for emergency use, set the MAX_MBUF_FRAGS allowed to 30. 188 */ 189 #define MAX_MBUF_FRAGS 30 190 #define MANA_TSO_MAXSEG_SZ PAGE_SIZE 191 192 /* mbuf data and frags dma mappings */ 193 struct mana_mbuf_head { 194 bus_addr_t dma_handle[MAX_MBUF_FRAGS + 1]; 195 196 uint32_t size[MAX_MBUF_FRAGS + 1]; 197 }; 198 199 #define MANA_HEADROOM sizeof(struct mana_mbuf_head) 200 201 enum mana_tx_pkt_format { 202 MANA_SHORT_PKT_FMT = 0, 203 MANA_LONG_PKT_FMT = 1, 204 }; 205 206 struct mana_tx_short_oob { 207 uint32_t pkt_fmt :2; 208 uint32_t is_outer_ipv4 :1; 209 uint32_t is_outer_ipv6 :1; 210 uint32_t comp_iphdr_csum :1; 211 uint32_t comp_tcp_csum :1; 212 uint32_t comp_udp_csum :1; 213 uint32_t supress_txcqe_gen :1; 214 uint32_t vcq_num :24; 215 216 uint32_t trans_off :10; /* Transport header offset */ 217 uint32_t vsq_frame :14; 218 uint32_t short_vp_offset :8; 219 }; /* HW DATA */ 220 221 struct mana_tx_long_oob { 222 uint32_t is_encap :1; 223 uint32_t inner_is_ipv6 :1; 224 uint32_t inner_tcp_opt :1; 225 uint32_t inject_vlan_pri_tag :1; 226 uint32_t reserved1 :12; 227 uint32_t pcp :3; /* 802.1Q */ 228 uint32_t dei :1; /* 802.1Q */ 229 uint32_t vlan_id :12; /* 802.1Q */ 230 231 uint32_t inner_frame_offset :10; 232 uint32_t inner_ip_rel_offset :6; 233 uint32_t long_vp_offset :12; 234 uint32_t reserved2 :4; 235 236 uint32_t reserved3; 237 uint32_t reserved4; 238 }; /* HW DATA */ 239 240 struct mana_tx_oob { 241 struct mana_tx_short_oob s_oob; 242 struct mana_tx_long_oob l_oob; 243 }; /* HW DATA */ 244 245 enum mana_cq_type { 246 MANA_CQ_TYPE_RX, 247 MANA_CQ_TYPE_TX, 248 }; 249 250 enum mana_cqe_type { 251 CQE_INVALID = 0, 252 CQE_RX_OKAY = 1, 253 CQE_RX_COALESCED_4 = 2, 254 CQE_RX_OBJECT_FENCE = 3, 255 CQE_RX_TRUNCATED = 4, 256 257 CQE_TX_OKAY = 32, 258 CQE_TX_SA_DROP = 33, 259 CQE_TX_MTU_DROP = 34, 260 CQE_TX_INVALID_OOB = 35, 261 CQE_TX_INVALID_ETH_TYPE = 36, 262 CQE_TX_HDR_PROCESSING_ERROR = 37, 263 CQE_TX_VF_DISABLED = 38, 264 CQE_TX_VPORT_IDX_OUT_OF_RANGE = 39, 265 CQE_TX_VPORT_DISABLED = 40, 266 CQE_TX_VLAN_TAGGING_VIOLATION = 41, 267 }; 268 269 #define MANA_CQE_COMPLETION 1 270 271 struct mana_cqe_header { 272 uint32_t cqe_type :6; 273 uint32_t client_type :2; 274 uint32_t vendor_err :24; 275 }; /* HW DATA */ 276 277 /* NDIS HASH Types */ 278 #define NDIS_HASH_IPV4 BIT(0) 279 #define NDIS_HASH_TCP_IPV4 BIT(1) 280 #define NDIS_HASH_UDP_IPV4 BIT(2) 281 #define NDIS_HASH_IPV6 BIT(3) 282 #define NDIS_HASH_TCP_IPV6 BIT(4) 283 #define NDIS_HASH_UDP_IPV6 BIT(5) 284 #define NDIS_HASH_IPV6_EX BIT(6) 285 #define NDIS_HASH_TCP_IPV6_EX BIT(7) 286 #define NDIS_HASH_UDP_IPV6_EX BIT(8) 287 288 #define MANA_HASH_L3 (NDIS_HASH_IPV4 | NDIS_HASH_IPV6 | NDIS_HASH_IPV6_EX) 289 #define MANA_HASH_L4 \ 290 (NDIS_HASH_TCP_IPV4 | NDIS_HASH_UDP_IPV4 | NDIS_HASH_TCP_IPV6 | \ 291 NDIS_HASH_UDP_IPV6 | NDIS_HASH_TCP_IPV6_EX | NDIS_HASH_UDP_IPV6_EX) 292 293 #define NDIS_HASH_IPV4_L3_MASK (NDIS_HASH_IPV4) 294 #define NDIS_HASH_IPV4_L4_MASK (NDIS_HASH_TCP_IPV4 | NDIS_HASH_UDP_IPV4) 295 #define NDIS_HASH_IPV6_L3_MASK (NDIS_HASH_IPV6 | NDIS_HASH_IPV6_EX) 296 #define NDIS_HASH_IPV6_L4_MASK \ 297 (NDIS_HASH_TCP_IPV6 | NDIS_HASH_UDP_IPV6 | \ 298 NDIS_HASH_TCP_IPV6_EX | NDIS_HASH_UDP_IPV6_EX) 299 #define NDIS_HASH_IPV4_MASK \ 300 (NDIS_HASH_IPV4_L3_MASK | NDIS_HASH_IPV4_L4_MASK) 301 #define NDIS_HASH_IPV6_MASK \ 302 (NDIS_HASH_IPV6_L3_MASK | NDIS_HASH_IPV6_L4_MASK) 303 304 305 struct mana_rxcomp_perpkt_info { 306 uint32_t pkt_len :16; 307 uint32_t reserved1 :16; 308 uint32_t reserved2; 309 uint32_t pkt_hash; 310 }; /* HW DATA */ 311 312 #define MANA_RXCOMP_OOB_NUM_PPI 4 313 314 /* Receive completion OOB */ 315 struct mana_rxcomp_oob { 316 struct mana_cqe_header cqe_hdr; 317 318 uint32_t rx_vlan_id :12; 319 uint32_t rx_vlantag_present :1; 320 uint32_t rx_outer_iphdr_csum_succeed :1; 321 uint32_t rx_outer_iphdr_csum_fail :1; 322 uint32_t reserved1 :1; 323 uint32_t rx_hashtype :9; 324 uint32_t rx_iphdr_csum_succeed :1; 325 uint32_t rx_iphdr_csum_fail :1; 326 uint32_t rx_tcp_csum_succeed :1; 327 uint32_t rx_tcp_csum_fail :1; 328 uint32_t rx_udp_csum_succeed :1; 329 uint32_t rx_udp_csum_fail :1; 330 uint32_t reserved2 :1; 331 332 struct mana_rxcomp_perpkt_info ppi[MANA_RXCOMP_OOB_NUM_PPI]; 333 334 uint32_t rx_wqe_offset; 335 }; /* HW DATA */ 336 337 struct mana_tx_comp_oob { 338 struct mana_cqe_header cqe_hdr; 339 340 uint32_t tx_data_offset; 341 342 uint32_t tx_sgl_offset :5; 343 uint32_t tx_wqe_offset :27; 344 345 uint32_t reserved[12]; 346 }; /* HW DATA */ 347 348 struct mana_rxq; 349 350 #define CQE_POLLING_BUFFER 512 351 352 struct mana_cq { 353 struct gdma_queue *gdma_cq; 354 355 /* Cache the CQ id (used to verify if each CQE comes to the right CQ. */ 356 uint32_t gdma_id; 357 358 /* Type of the CQ: TX or RX */ 359 enum mana_cq_type type; 360 361 /* Pointer to the mana_rxq that is pushing RX CQEs to the queue. 362 * Only and must be non-NULL if type is MANA_CQ_TYPE_RX. 363 */ 364 struct mana_rxq *rxq; 365 366 /* Pointer to the mana_txq that is pushing TX CQEs to the queue. 367 * Only and must be non-NULL if type is MANA_CQ_TYPE_TX. 368 */ 369 struct mana_txq *txq; 370 371 /* Taskqueue and related structs */ 372 struct task cleanup_task; 373 struct taskqueue *cleanup_tq; 374 int cpu; 375 bool do_not_ring_db; 376 377 /* Budget for one cleanup task */ 378 int work_done; 379 int budget; 380 381 /* Buffer which the CQ handler can copy the CQE's into. */ 382 struct gdma_comp gdma_comp_buf[CQE_POLLING_BUFFER]; 383 }; 384 385 #define GDMA_MAX_RQE_SGES 15 386 387 struct mana_recv_buf_oob { 388 /* A valid GDMA work request representing the data buffer. */ 389 struct gdma_wqe_request wqe_req; 390 391 struct mbuf *mbuf; 392 bus_dmamap_t dma_map; 393 394 /* SGL of the buffer going to be sent as part of the work request. */ 395 uint32_t num_sge; 396 struct gdma_sge sgl[GDMA_MAX_RQE_SGES]; 397 398 /* Required to store the result of mana_gd_post_work_request. 399 * gdma_posted_wqe_info.wqe_size_in_bu is required for progressing the 400 * work queue when the WQE is consumed. 401 */ 402 struct gdma_posted_wqe_info wqe_inf; 403 }; 404 405 struct mana_rxq { 406 struct gdma_queue *gdma_rq; 407 /* Cache the gdma receive queue id */ 408 uint32_t gdma_id; 409 410 /* Index of RQ in the vPort, not gdma receive queue id */ 411 uint32_t rxq_idx; 412 413 uint32_t datasize; 414 415 mana_handle_t rxobj; 416 417 struct mana_cq rx_cq; 418 419 struct ifnet *ndev; 420 struct lro_ctrl lro; 421 422 /* Total number of receive buffers to be allocated */ 423 uint32_t num_rx_buf; 424 425 uint32_t buf_index; 426 427 struct mana_stats stats; 428 429 /* MUST BE THE LAST MEMBER: 430 * Each receive buffer has an associated mana_recv_buf_oob. 431 */ 432 struct mana_recv_buf_oob rx_oobs[]; 433 }; 434 435 struct mana_tx_qp { 436 struct mana_txq txq; 437 438 struct mana_cq tx_cq; 439 440 mana_handle_t tx_object; 441 }; 442 443 struct mana_port_stats { 444 counter_u64_t rx_packets; 445 counter_u64_t tx_packets; 446 447 counter_u64_t rx_bytes; 448 counter_u64_t tx_bytes; 449 450 counter_u64_t rx_drops; 451 counter_u64_t tx_drops; 452 453 counter_u64_t stop_queue; 454 counter_u64_t wake_queue; 455 }; 456 457 struct mana_context { 458 struct gdma_dev *gdma_dev; 459 460 uint16_t num_ports; 461 462 struct mana_eq *eqs; 463 464 struct ifnet *ports[MAX_PORTS_IN_MANA_DEV]; 465 }; 466 467 struct mana_port_context { 468 struct mana_context *ac; 469 struct ifnet *ndev; 470 struct ifmedia media; 471 472 struct sx apc_lock; 473 474 /* DMA tag used for queue bufs of the entire port */ 475 bus_dma_tag_t rx_buf_tag; 476 bus_dma_tag_t tx_buf_tag; 477 478 uint8_t mac_addr[ETHER_ADDR_LEN]; 479 480 enum TRI_STATE rss_state; 481 482 mana_handle_t default_rxobj; 483 bool tx_shortform_allowed; 484 uint16_t tx_vp_offset; 485 486 struct mana_tx_qp *tx_qp; 487 488 /* Indirection Table for RX & TX. The values are queue indexes */ 489 uint32_t indir_table[MANA_INDIRECT_TABLE_SIZE]; 490 491 /* Indirection table containing RxObject Handles */ 492 mana_handle_t rxobj_table[MANA_INDIRECT_TABLE_SIZE]; 493 494 /* Hash key used by the NIC */ 495 uint8_t hashkey[MANA_HASH_KEY_SIZE]; 496 497 /* This points to an array of num_queues of RQ pointers. */ 498 struct mana_rxq **rxqs; 499 500 /* Create num_queues EQs, SQs, SQ-CQs, RQs and RQ-CQs, respectively. */ 501 unsigned int max_queues; 502 unsigned int num_queues; 503 504 mana_handle_t port_handle; 505 506 uint16_t port_idx; 507 508 uint16_t frame_size; 509 510 bool port_is_up; 511 bool port_st_save; /* Saved port state */ 512 513 bool enable_tx_altq; 514 515 bool bind_cleanup_thread_cpu; 516 int last_tx_cq_bind_cpu; 517 int last_rx_cq_bind_cpu; 518 519 struct mana_port_stats port_stats; 520 521 struct sysctl_oid_list *port_list; 522 struct sysctl_ctx_list que_sysctl_ctx; 523 }; 524 525 #define MANA_APC_LOCK_INIT(apc) \ 526 sx_init(&(apc)->apc_lock, "MANA port lock") 527 #define MANA_APC_LOCK_DESTROY(apc) sx_destroy(&(apc)->apc_lock) 528 #define MANA_APC_LOCK_LOCK(apc) sx_xlock(&(apc)->apc_lock) 529 #define MANA_APC_LOCK_UNLOCK(apc) sx_unlock(&(apc)->apc_lock) 530 531 int mana_config_rss(struct mana_port_context *ac, enum TRI_STATE rx, 532 bool update_hash, bool update_tab); 533 534 int mana_alloc_queues(struct ifnet *ndev); 535 int mana_attach(struct ifnet *ndev); 536 int mana_detach(struct ifnet *ndev); 537 538 int mana_probe(struct gdma_dev *gd); 539 void mana_remove(struct gdma_dev *gd); 540 541 struct mana_obj_spec { 542 uint32_t queue_index; 543 uint64_t gdma_region; 544 uint32_t queue_size; 545 uint32_t attached_eq; 546 uint32_t modr_ctx_id; 547 }; 548 549 enum mana_command_code { 550 MANA_QUERY_DEV_CONFIG = 0x20001, 551 MANA_QUERY_GF_STAT = 0x20002, 552 MANA_CONFIG_VPORT_TX = 0x20003, 553 MANA_CREATE_WQ_OBJ = 0x20004, 554 MANA_DESTROY_WQ_OBJ = 0x20005, 555 MANA_FENCE_RQ = 0x20006, 556 MANA_CONFIG_VPORT_RX = 0x20007, 557 MANA_QUERY_VPORT_CONFIG = 0x20008, 558 }; 559 560 /* Query Device Configuration */ 561 struct mana_query_device_cfg_req { 562 struct gdma_req_hdr hdr; 563 564 /* Driver Capability flags */ 565 uint64_t drv_cap_flags1; 566 uint64_t drv_cap_flags2; 567 uint64_t drv_cap_flags3; 568 uint64_t drv_cap_flags4; 569 570 uint32_t proto_major_ver; 571 uint32_t proto_minor_ver; 572 uint32_t proto_micro_ver; 573 574 uint32_t reserved; 575 }; /* HW DATA */ 576 577 struct mana_query_device_cfg_resp { 578 struct gdma_resp_hdr hdr; 579 580 uint64_t pf_cap_flags1; 581 uint64_t pf_cap_flags2; 582 uint64_t pf_cap_flags3; 583 uint64_t pf_cap_flags4; 584 585 uint16_t max_num_vports; 586 uint16_t reserved; 587 uint32_t max_num_eqs; 588 }; /* HW DATA */ 589 590 /* Query vPort Configuration */ 591 struct mana_query_vport_cfg_req { 592 struct gdma_req_hdr hdr; 593 uint32_t vport_index; 594 }; /* HW DATA */ 595 596 struct mana_query_vport_cfg_resp { 597 struct gdma_resp_hdr hdr; 598 uint32_t max_num_sq; 599 uint32_t max_num_rq; 600 uint32_t num_indirection_ent; 601 uint32_t reserved1; 602 uint8_t mac_addr[6]; 603 uint8_t reserved2[2]; 604 mana_handle_t vport; 605 }; /* HW DATA */ 606 607 /* Configure vPort */ 608 struct mana_config_vport_req { 609 struct gdma_req_hdr hdr; 610 mana_handle_t vport; 611 uint32_t pdid; 612 uint32_t doorbell_pageid; 613 }; /* HW DATA */ 614 615 struct mana_config_vport_resp { 616 struct gdma_resp_hdr hdr; 617 uint16_t tx_vport_offset; 618 uint8_t short_form_allowed; 619 uint8_t reserved; 620 }; /* HW DATA */ 621 622 /* Create WQ Object */ 623 struct mana_create_wqobj_req { 624 struct gdma_req_hdr hdr; 625 mana_handle_t vport; 626 uint32_t wq_type; 627 uint32_t reserved; 628 uint64_t wq_gdma_region; 629 uint64_t cq_gdma_region; 630 uint32_t wq_size; 631 uint32_t cq_size; 632 uint32_t cq_moderation_ctx_id; 633 uint32_t cq_parent_qid; 634 }; /* HW DATA */ 635 636 struct mana_create_wqobj_resp { 637 struct gdma_resp_hdr hdr; 638 uint32_t wq_id; 639 uint32_t cq_id; 640 mana_handle_t wq_obj; 641 }; /* HW DATA */ 642 643 /* Destroy WQ Object */ 644 struct mana_destroy_wqobj_req { 645 struct gdma_req_hdr hdr; 646 uint32_t wq_type; 647 uint32_t reserved; 648 mana_handle_t wq_obj_handle; 649 }; /* HW DATA */ 650 651 struct mana_destroy_wqobj_resp { 652 struct gdma_resp_hdr hdr; 653 }; /* HW DATA */ 654 655 /* Fence RQ */ 656 struct mana_fence_rq_req { 657 struct gdma_req_hdr hdr; 658 mana_handle_t wq_obj_handle; 659 }; /* HW DATA */ 660 661 struct mana_fence_rq_resp { 662 struct gdma_resp_hdr hdr; 663 }; /* HW DATA */ 664 665 /* Configure vPort Rx Steering */ 666 struct mana_cfg_rx_steer_req { 667 struct gdma_req_hdr hdr; 668 mana_handle_t vport; 669 uint16_t num_indir_entries; 670 uint16_t indir_tab_offset; 671 uint32_t rx_enable; 672 uint32_t rss_enable; 673 uint8_t update_default_rxobj; 674 uint8_t update_hashkey; 675 uint8_t update_indir_tab; 676 uint8_t reserved; 677 mana_handle_t default_rxobj; 678 uint8_t hashkey[MANA_HASH_KEY_SIZE]; 679 }; /* HW DATA */ 680 681 struct mana_cfg_rx_steer_resp { 682 struct gdma_resp_hdr hdr; 683 }; /* HW DATA */ 684 685 #define MANA_MAX_NUM_QUEUES 16 686 687 #define MANA_SHORT_VPORT_OFFSET_MAX ((1U << 8) - 1) 688 689 struct mana_tx_package { 690 struct gdma_wqe_request wqe_req; 691 struct gdma_sge sgl_array[MAX_MBUF_FRAGS]; 692 693 struct mana_tx_oob tx_oob; 694 695 struct gdma_posted_wqe_info wqe_info; 696 }; 697 698 int mana_restart(struct mana_port_context *apc); 699 700 #endif /* _MANA_H */ 701