| .. | .. |
|---|
| 37 | 37 | #include <linux/mlx5/driver.h> |
|---|
| 38 | 38 | |
|---|
| 39 | 39 | #define MLX5_INVALID_LKEY 0x100 |
|---|
| 40 | | -#define MLX5_SIG_WQE_SIZE (MLX5_SEND_WQE_BB * 5) |
|---|
| 40 | +/* UMR (3 WQE_BB's) + SIG (3 WQE_BB's) + PSV (mem) + PSV (wire) */ |
|---|
| 41 | +#define MLX5_SIG_WQE_SIZE (MLX5_SEND_WQE_BB * 8) |
|---|
| 41 | 42 | #define MLX5_DIF_SIZE 8 |
|---|
| 42 | 43 | #define MLX5_STRIDE_BLOCK_OP 0x400 |
|---|
| 43 | 44 | #define MLX5_CPY_GRD_MASK 0xc0 |
|---|
| .. | .. |
|---|
| 65 | 66 | MLX5_QP_OPTPAR_RETRY_COUNT = 1 << 12, |
|---|
| 66 | 67 | MLX5_QP_OPTPAR_RNR_RETRY = 1 << 13, |
|---|
| 67 | 68 | MLX5_QP_OPTPAR_ACK_TIMEOUT = 1 << 14, |
|---|
| 69 | + MLX5_QP_OPTPAR_LAG_TX_AFF = 1 << 15, |
|---|
| 68 | 70 | MLX5_QP_OPTPAR_PRI_PORT = 1 << 16, |
|---|
| 69 | 71 | MLX5_QP_OPTPAR_SRQN = 1 << 18, |
|---|
| 70 | 72 | MLX5_QP_OPTPAR_CQN_RCV = 1 << 19, |
|---|
| 71 | 73 | MLX5_QP_OPTPAR_DC_HS = 1 << 20, |
|---|
| 72 | 74 | MLX5_QP_OPTPAR_DC_KEY = 1 << 21, |
|---|
| 75 | + MLX5_QP_OPTPAR_COUNTER_SET_ID = 1 << 25, |
|---|
| 73 | 76 | }; |
|---|
| 74 | 77 | |
|---|
| 75 | 78 | enum mlx5_qp_state { |
|---|
| .. | .. |
|---|
| 202 | 205 | u8 signature; |
|---|
| 203 | 206 | u8 rsvd[2]; |
|---|
| 204 | 207 | u8 fm_ce_se; |
|---|
| 205 | | - __be32 imm; |
|---|
| 208 | + union { |
|---|
| 209 | + __be32 general_id; |
|---|
| 210 | + __be32 imm; |
|---|
| 211 | + __be32 umr_mkey; |
|---|
| 212 | + __be32 tis_tir_num; |
|---|
| 213 | + }; |
|---|
| 206 | 214 | }; |
|---|
| 207 | 215 | |
|---|
| 208 | 216 | #define MLX5_WQE_CTRL_DS_MASK 0x3f |
|---|
| .. | .. |
|---|
| 222 | 230 | |
|---|
| 223 | 231 | enum { |
|---|
| 224 | 232 | MLX5_ETH_WQE_SVLAN = 1 << 0, |
|---|
| 233 | + MLX5_ETH_WQE_TRAILER_HDR_OUTER_IP_ASSOC = 1 << 26, |
|---|
| 234 | + MLX5_ETH_WQE_TRAILER_HDR_OUTER_L4_ASSOC = 1 << 27, |
|---|
| 235 | + MLX5_ETH_WQE_TRAILER_HDR_INNER_IP_ASSOC = 3 << 26, |
|---|
| 236 | + MLX5_ETH_WQE_TRAILER_HDR_INNER_L4_ASSOC = 1 << 28, |
|---|
| 237 | + MLX5_ETH_WQE_INSERT_TRAILER = 1 << 30, |
|---|
| 225 | 238 | MLX5_ETH_WQE_INSERT_VLAN = 1 << 15, |
|---|
| 226 | 239 | }; |
|---|
| 227 | 240 | |
|---|
| .. | .. |
|---|
| 232 | 245 | MLX5_ETH_WQE_SWP_OUTER_L4_UDP = 1 << 5, |
|---|
| 233 | 246 | }; |
|---|
| 234 | 247 | |
|---|
| 248 | +enum { |
|---|
| 249 | + MLX5_ETH_WQE_FT_META_IPSEC = BIT(0), |
|---|
| 250 | +}; |
|---|
| 251 | + |
|---|
| 235 | 252 | struct mlx5_wqe_eth_seg { |
|---|
| 236 | 253 | u8 swp_outer_l4_offset; |
|---|
| 237 | 254 | u8 swp_outer_l3_offset; |
|---|
| .. | .. |
|---|
| 240 | 257 | u8 cs_flags; |
|---|
| 241 | 258 | u8 swp_flags; |
|---|
| 242 | 259 | __be16 mss; |
|---|
| 243 | | - __be32 rsvd2; |
|---|
| 260 | + __be32 flow_table_metadata; |
|---|
| 244 | 261 | union { |
|---|
| 245 | 262 | struct { |
|---|
| 246 | 263 | __be16 sz; |
|---|
| .. | .. |
|---|
| 250 | 267 | __be16 type; |
|---|
| 251 | 268 | __be16 vlan_tci; |
|---|
| 252 | 269 | } insert; |
|---|
| 270 | + __be32 trailer; |
|---|
| 253 | 271 | }; |
|---|
| 254 | 272 | }; |
|---|
| 255 | 273 | |
|---|
| .. | .. |
|---|
| 308 | 326 | struct mlx5_ib_ah { |
|---|
| 309 | 327 | struct ib_ah ibah; |
|---|
| 310 | 328 | struct mlx5_av av; |
|---|
| 329 | + u8 xmit_port; |
|---|
| 311 | 330 | }; |
|---|
| 312 | 331 | |
|---|
| 313 | 332 | static inline struct mlx5_ib_ah *to_mah(struct ib_ah *ibah) |
|---|
| .. | .. |
|---|
| 395 | 414 | |
|---|
| 396 | 415 | struct mlx5_wqe_inline_seg { |
|---|
| 397 | 416 | __be32 byte_count; |
|---|
| 417 | + __be32 data[]; |
|---|
| 398 | 418 | }; |
|---|
| 399 | 419 | |
|---|
| 400 | 420 | enum mlx5_sig_type { |
|---|
| .. | .. |
|---|
| 471 | 491 | int qpn; |
|---|
| 472 | 492 | struct mlx5_rsc_debug *dbg; |
|---|
| 473 | 493 | int pid; |
|---|
| 494 | + u16 uid; |
|---|
| 474 | 495 | }; |
|---|
| 475 | 496 | |
|---|
| 476 | 497 | struct mlx5_core_dct { |
|---|
| .. | .. |
|---|
| 478 | 499 | struct completion drained; |
|---|
| 479 | 500 | }; |
|---|
| 480 | 501 | |
|---|
| 481 | | -struct mlx5_qp_path { |
|---|
| 482 | | - u8 fl_free_ar; |
|---|
| 483 | | - u8 rsvd3; |
|---|
| 484 | | - __be16 pkey_index; |
|---|
| 485 | | - u8 rsvd0; |
|---|
| 486 | | - u8 grh_mlid; |
|---|
| 487 | | - __be16 rlid; |
|---|
| 488 | | - u8 ackto_lt; |
|---|
| 489 | | - u8 mgid_index; |
|---|
| 490 | | - u8 static_rate; |
|---|
| 491 | | - u8 hop_limit; |
|---|
| 492 | | - __be32 tclass_flowlabel; |
|---|
| 493 | | - union { |
|---|
| 494 | | - u8 rgid[16]; |
|---|
| 495 | | - u8 rip[16]; |
|---|
| 496 | | - }; |
|---|
| 497 | | - u8 f_dscp_ecn_prio; |
|---|
| 498 | | - u8 ecn_dscp; |
|---|
| 499 | | - __be16 udp_sport; |
|---|
| 500 | | - u8 dci_cfi_prio_sl; |
|---|
| 501 | | - u8 port; |
|---|
| 502 | | - u8 rmac[6]; |
|---|
| 503 | | -}; |
|---|
| 504 | | - |
|---|
| 505 | | -/* FIXME: use mlx5_ifc.h qpc */ |
|---|
| 506 | | -struct mlx5_qp_context { |
|---|
| 507 | | - __be32 flags; |
|---|
| 508 | | - __be32 flags_pd; |
|---|
| 509 | | - u8 mtu_msgmax; |
|---|
| 510 | | - u8 rq_size_stride; |
|---|
| 511 | | - __be16 sq_crq_size; |
|---|
| 512 | | - __be32 qp_counter_set_usr_page; |
|---|
| 513 | | - __be32 wire_qpn; |
|---|
| 514 | | - __be32 log_pg_sz_remote_qpn; |
|---|
| 515 | | - struct mlx5_qp_path pri_path; |
|---|
| 516 | | - struct mlx5_qp_path alt_path; |
|---|
| 517 | | - __be32 params1; |
|---|
| 518 | | - u8 reserved2[4]; |
|---|
| 519 | | - __be32 next_send_psn; |
|---|
| 520 | | - __be32 cqn_send; |
|---|
| 521 | | - __be32 deth_sqpn; |
|---|
| 522 | | - u8 reserved3[4]; |
|---|
| 523 | | - __be32 last_acked_psn; |
|---|
| 524 | | - __be32 ssn; |
|---|
| 525 | | - __be32 params2; |
|---|
| 526 | | - __be32 rnr_nextrecvpsn; |
|---|
| 527 | | - __be32 xrcd; |
|---|
| 528 | | - __be32 cqn_recv; |
|---|
| 529 | | - __be64 db_rec_addr; |
|---|
| 530 | | - __be32 qkey; |
|---|
| 531 | | - __be32 rq_type_srqn; |
|---|
| 532 | | - __be32 rmsn; |
|---|
| 533 | | - __be16 hw_sq_wqe_counter; |
|---|
| 534 | | - __be16 sw_sq_wqe_counter; |
|---|
| 535 | | - __be16 hw_rcyclic_byte_counter; |
|---|
| 536 | | - __be16 hw_rq_counter; |
|---|
| 537 | | - __be16 sw_rcyclic_byte_counter; |
|---|
| 538 | | - __be16 sw_rq_counter; |
|---|
| 539 | | - u8 rsvd0[5]; |
|---|
| 540 | | - u8 cgs; |
|---|
| 541 | | - u8 cs_req; |
|---|
| 542 | | - u8 cs_res; |
|---|
| 543 | | - __be64 dc_access_key; |
|---|
| 544 | | - u8 rsvd1[24]; |
|---|
| 545 | | -}; |
|---|
| 546 | | - |
|---|
| 547 | | -static inline struct mlx5_core_qp *__mlx5_qp_lookup(struct mlx5_core_dev *dev, u32 qpn) |
|---|
| 548 | | -{ |
|---|
| 549 | | - return radix_tree_lookup(&dev->priv.qp_table.tree, qpn); |
|---|
| 550 | | -} |
|---|
| 551 | | - |
|---|
| 552 | | -static inline struct mlx5_core_mkey *__mlx5_mr_lookup(struct mlx5_core_dev *dev, u32 key) |
|---|
| 553 | | -{ |
|---|
| 554 | | - return radix_tree_lookup(&dev->priv.mkey_table.tree, key); |
|---|
| 555 | | -} |
|---|
| 556 | | - |
|---|
| 557 | | -int mlx5_core_create_dct(struct mlx5_core_dev *dev, |
|---|
| 558 | | - struct mlx5_core_dct *qp, |
|---|
| 559 | | - u32 *in, int inlen); |
|---|
| 560 | | -int mlx5_core_create_qp(struct mlx5_core_dev *dev, |
|---|
| 561 | | - struct mlx5_core_qp *qp, |
|---|
| 562 | | - u32 *in, |
|---|
| 563 | | - int inlen); |
|---|
| 564 | | -int mlx5_core_qp_modify(struct mlx5_core_dev *dev, u16 opcode, |
|---|
| 565 | | - u32 opt_param_mask, void *qpc, |
|---|
| 566 | | - struct mlx5_core_qp *qp); |
|---|
| 567 | | -int mlx5_core_destroy_qp(struct mlx5_core_dev *dev, |
|---|
| 568 | | - struct mlx5_core_qp *qp); |
|---|
| 569 | | -int mlx5_core_destroy_dct(struct mlx5_core_dev *dev, |
|---|
| 570 | | - struct mlx5_core_dct *dct); |
|---|
| 571 | | -int mlx5_core_qp_query(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp, |
|---|
| 572 | | - u32 *out, int outlen); |
|---|
| 573 | | -int mlx5_core_dct_query(struct mlx5_core_dev *dev, struct mlx5_core_dct *dct, |
|---|
| 574 | | - u32 *out, int outlen); |
|---|
| 575 | | - |
|---|
| 576 | | -int mlx5_core_set_delay_drop(struct mlx5_core_dev *dev, |
|---|
| 577 | | - u32 timeout_usec); |
|---|
| 578 | | - |
|---|
| 579 | | -int mlx5_core_xrcd_alloc(struct mlx5_core_dev *dev, u32 *xrcdn); |
|---|
| 580 | | -int mlx5_core_xrcd_dealloc(struct mlx5_core_dev *dev, u32 xrcdn); |
|---|
| 581 | | -void mlx5_init_qp_table(struct mlx5_core_dev *dev); |
|---|
| 582 | | -void mlx5_cleanup_qp_table(struct mlx5_core_dev *dev); |
|---|
| 583 | 502 | int mlx5_debug_qp_add(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp); |
|---|
| 584 | 503 | void mlx5_debug_qp_remove(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp); |
|---|
| 585 | | -int mlx5_core_create_rq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen, |
|---|
| 586 | | - struct mlx5_core_qp *rq); |
|---|
| 587 | | -void mlx5_core_destroy_rq_tracked(struct mlx5_core_dev *dev, |
|---|
| 588 | | - struct mlx5_core_qp *rq); |
|---|
| 589 | | -int mlx5_core_create_sq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen, |
|---|
| 590 | | - struct mlx5_core_qp *sq); |
|---|
| 591 | | -void mlx5_core_destroy_sq_tracked(struct mlx5_core_dev *dev, |
|---|
| 592 | | - struct mlx5_core_qp *sq); |
|---|
| 593 | | -int mlx5_core_alloc_q_counter(struct mlx5_core_dev *dev, u16 *counter_id); |
|---|
| 594 | | -int mlx5_core_dealloc_q_counter(struct mlx5_core_dev *dev, u16 counter_id); |
|---|
| 595 | | -int mlx5_core_query_q_counter(struct mlx5_core_dev *dev, u16 counter_id, |
|---|
| 596 | | - int reset, void *out, int out_size); |
|---|
| 597 | 504 | |
|---|
| 598 | 505 | static inline const char *mlx5_qp_type_str(int type) |
|---|
| 599 | 506 | { |
|---|