.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) 2004 Mellanox Technologies Ltd. All rights reserved. |
---|
3 | 4 | * Copyright (c) 2004 Infinicon Corporation. All rights reserved. |
---|
4 | 5 | * Copyright (c) 2004 Intel Corporation. All rights reserved. |
---|
5 | 6 | * Copyright (c) 2004 Topspin Corporation. All rights reserved. |
---|
6 | 7 | * Copyright (c) 2004-2006 Voltaire Corporation. All rights reserved. |
---|
7 | | - * |
---|
8 | | - * This software is available to you under a choice of one of two |
---|
9 | | - * licenses. You may choose to be licensed under the terms of the GNU |
---|
10 | | - * General Public License (GPL) Version 2, available from the file |
---|
11 | | - * COPYING in the main directory of this source tree, or the |
---|
12 | | - * OpenIB.org BSD license below: |
---|
13 | | - * |
---|
14 | | - * Redistribution and use in source and binary forms, with or |
---|
15 | | - * without modification, are permitted provided that the following |
---|
16 | | - * conditions are met: |
---|
17 | | - * |
---|
18 | | - * - Redistributions of source code must retain the above |
---|
19 | | - * copyright notice, this list of conditions and the following |
---|
20 | | - * disclaimer. |
---|
21 | | - * |
---|
22 | | - * - Redistributions in binary form must reproduce the above |
---|
23 | | - * copyright notice, this list of conditions and the following |
---|
24 | | - * disclaimer in the documentation and/or other materials |
---|
25 | | - * provided with the distribution. |
---|
26 | | - * |
---|
27 | | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
---|
28 | | - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
---|
29 | | - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
---|
30 | | - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
---|
31 | | - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
---|
32 | | - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
---|
33 | | - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
---|
34 | | - * SOFTWARE. |
---|
35 | 8 | */ |
---|
36 | 9 | |
---|
37 | | -#if !defined(IB_MAD_H) |
---|
| 10 | +#ifndef IB_MAD_H |
---|
38 | 11 | #define IB_MAD_H |
---|
39 | 12 | |
---|
40 | 13 | #include <linux/list.h> |
---|
.. | .. |
---|
198 | 171 | __be16 attr_offset; |
---|
199 | 172 | __be16 reserved; |
---|
200 | 173 | ib_sa_comp_mask comp_mask; |
---|
201 | | -} __attribute__ ((packed)); |
---|
| 174 | +} __packed; |
---|
202 | 175 | |
---|
203 | 176 | struct ib_mad { |
---|
204 | 177 | struct ib_mad_hdr mad_hdr; |
---|
.. | .. |
---|
227 | 200 | struct ib_rmpp_hdr rmpp_hdr; |
---|
228 | 201 | struct ib_sa_hdr sa_hdr; |
---|
229 | 202 | u8 data[IB_MGMT_SA_DATA]; |
---|
230 | | -} __attribute__ ((packed)); |
---|
| 203 | +} __packed; |
---|
231 | 204 | |
---|
232 | 205 | struct ib_vendor_mad { |
---|
233 | 206 | struct ib_mad_hdr mad_hdr; |
---|
.. | .. |
---|
277 | 250 | IB_PORT_SYS_IMAGE_GUID_SUP = 1 << 11, |
---|
278 | 251 | IB_PORT_PKEY_SW_EXT_PORT_TRAP_SUP = 1 << 12, |
---|
279 | 252 | IB_PORT_EXTENDED_SPEEDS_SUP = 1 << 14, |
---|
| 253 | + IB_PORT_CAP_MASK2_SUP = 1 << 15, |
---|
280 | 254 | IB_PORT_CM_SUP = 1 << 16, |
---|
281 | 255 | IB_PORT_SNMP_TUNNEL_SUP = 1 << 17, |
---|
282 | 256 | IB_PORT_REINIT_SUP = 1 << 18, |
---|
.. | .. |
---|
293 | 267 | IB_PORT_MCAST_PKEY_TRAP_SUPPRESSION_SUP = 1 << 29, |
---|
294 | 268 | IB_PORT_MCAST_FDB_TOP_SUP = 1 << 30, |
---|
295 | 269 | IB_PORT_HIERARCHY_INFO_SUP = 1ULL << 31, |
---|
| 270 | +}; |
---|
| 271 | + |
---|
| 272 | +enum ib_port_capability_mask2_bits { |
---|
| 273 | + IB_PORT_SET_NODE_DESC_SUP = 1 << 0, |
---|
| 274 | + IB_PORT_EX_PORT_INFO_EX_SUP = 1 << 1, |
---|
| 275 | + IB_PORT_VIRT_SUP = 1 << 2, |
---|
| 276 | + IB_PORT_SWITCH_PORT_STATE_TABLE_SUP = 1 << 3, |
---|
| 277 | + IB_PORT_LINK_WIDTH_2X_SUP = 1 << 4, |
---|
| 278 | + IB_PORT_LINK_SPEED_HDR_SUP = 1 << 5, |
---|
296 | 279 | }; |
---|
297 | 280 | |
---|
298 | 281 | #define OPA_CLASS_PORT_INFO_PR_SUPPORT BIT(26) |
---|
.. | .. |
---|
549 | 532 | struct ib_mad_send_wc *mad_send_wc); |
---|
550 | 533 | |
---|
551 | 534 | /** |
---|
552 | | - * ib_mad_snoop_handler - Callback handler for snooping sent MADs. |
---|
553 | | - * @mad_agent: MAD agent that snooped the MAD. |
---|
554 | | - * @send_buf: send MAD data buffer. |
---|
555 | | - * @mad_send_wc: Work completion information on the sent MAD. Valid |
---|
556 | | - * only for snooping that occurs on a send completion. |
---|
557 | | - * |
---|
558 | | - * Clients snooping MADs should not modify data referenced by the @send_buf |
---|
559 | | - * or @mad_send_wc. |
---|
560 | | - */ |
---|
561 | | -typedef void (*ib_mad_snoop_handler)(struct ib_mad_agent *mad_agent, |
---|
562 | | - struct ib_mad_send_buf *send_buf, |
---|
563 | | - struct ib_mad_send_wc *mad_send_wc); |
---|
564 | | - |
---|
565 | | -/** |
---|
566 | 535 | * ib_mad_recv_handler - callback handler for a received MAD. |
---|
567 | 536 | * @mad_agent: MAD agent requesting the received MAD. |
---|
568 | 537 | * @send_buf: Send buffer if found, else NULL |
---|
.. | .. |
---|
571 | 540 | * MADs received in response to a send request operation will be handed to |
---|
572 | 541 | * the user before the send operation completes. All data buffers given |
---|
573 | 542 | * to registered agents through this routine are owned by the receiving |
---|
574 | | - * client, except for snooping agents. Clients snooping MADs should not |
---|
575 | | - * modify the data referenced by @mad_recv_wc. |
---|
| 543 | + * client. |
---|
576 | 544 | */ |
---|
577 | 545 | typedef void (*ib_mad_recv_handler)(struct ib_mad_agent *mad_agent, |
---|
578 | 546 | struct ib_mad_send_buf *send_buf, |
---|
.. | .. |
---|
585 | 553 | * @mr: Memory region for system memory usable for DMA. |
---|
586 | 554 | * @recv_handler: Callback handler for a received MAD. |
---|
587 | 555 | * @send_handler: Callback handler for a sent MAD. |
---|
588 | | - * @snoop_handler: Callback handler for snooped sent MADs. |
---|
589 | 556 | * @context: User-specified context associated with this registration. |
---|
590 | 557 | * @hi_tid: Access layer assigned transaction ID for this client. |
---|
591 | 558 | * Unsolicited MADs sent by this client will have the upper 32-bits |
---|
.. | .. |
---|
602 | 569 | struct ib_qp *qp; |
---|
603 | 570 | ib_mad_recv_handler recv_handler; |
---|
604 | 571 | ib_mad_send_handler send_handler; |
---|
605 | | - ib_mad_snoop_handler snoop_handler; |
---|
606 | 572 | void *context; |
---|
607 | 573 | u32 hi_tid; |
---|
608 | 574 | u32 flags; |
---|
| 575 | + void *security; |
---|
| 576 | + struct list_head mad_agent_sec_list; |
---|
609 | 577 | u8 port_num; |
---|
610 | 578 | u8 rmpp_version; |
---|
611 | | - void *security; |
---|
612 | 579 | bool smp_allowed; |
---|
613 | | - bool lsm_nb_reg; |
---|
614 | | - struct notifier_block lsm_nb; |
---|
615 | 580 | }; |
---|
616 | 581 | |
---|
617 | 582 | /** |
---|
.. | .. |
---|
711 | 676 | ib_mad_recv_handler recv_handler, |
---|
712 | 677 | void *context, |
---|
713 | 678 | u32 registration_flags); |
---|
714 | | - |
---|
715 | | -enum ib_mad_snoop_flags { |
---|
716 | | - /*IB_MAD_SNOOP_POSTED_SENDS = 1,*/ |
---|
717 | | - /*IB_MAD_SNOOP_RMPP_SENDS = (1<<1),*/ |
---|
718 | | - IB_MAD_SNOOP_SEND_COMPLETIONS = (1<<2), |
---|
719 | | - /*IB_MAD_SNOOP_RMPP_SEND_COMPLETIONS = (1<<3),*/ |
---|
720 | | - IB_MAD_SNOOP_RECVS = (1<<4) |
---|
721 | | - /*IB_MAD_SNOOP_RMPP_RECVS = (1<<5),*/ |
---|
722 | | - /*IB_MAD_SNOOP_REDIRECTED_QPS = (1<<6)*/ |
---|
723 | | -}; |
---|
724 | | - |
---|
725 | | -/** |
---|
726 | | - * ib_register_mad_snoop - Register to snoop sent and received MADs. |
---|
727 | | - * @device: The device to register with. |
---|
728 | | - * @port_num: The port on the specified device to use. |
---|
729 | | - * @qp_type: Specifies which QP traffic to snoop. Must be either |
---|
730 | | - * IB_QPT_SMI or IB_QPT_GSI. |
---|
731 | | - * @mad_snoop_flags: Specifies information where snooping occurs. |
---|
732 | | - * @send_handler: The callback routine invoked for a snooped send. |
---|
733 | | - * @recv_handler: The callback routine invoked for a snooped receive. |
---|
734 | | - * @context: User specified context associated with the registration. |
---|
735 | | - */ |
---|
736 | | -struct ib_mad_agent *ib_register_mad_snoop(struct ib_device *device, |
---|
737 | | - u8 port_num, |
---|
738 | | - enum ib_qp_type qp_type, |
---|
739 | | - int mad_snoop_flags, |
---|
740 | | - ib_mad_snoop_handler snoop_handler, |
---|
741 | | - ib_mad_recv_handler recv_handler, |
---|
742 | | - void *context); |
---|
743 | | - |
---|
744 | 679 | /** |
---|
745 | 680 | * ib_unregister_mad_agent - Unregisters a client from using MAD services. |
---|
746 | 681 | * @mad_agent: Corresponding MAD registration request to deregister. |
---|
.. | .. |
---|
804 | 739 | */ |
---|
805 | 740 | int ib_modify_mad(struct ib_mad_agent *mad_agent, |
---|
806 | 741 | struct ib_mad_send_buf *send_buf, u32 timeout_ms); |
---|
807 | | - |
---|
808 | | -/** |
---|
809 | | - * ib_redirect_mad_qp - Registers a QP for MAD services. |
---|
810 | | - * @qp: Reference to a QP that requires MAD services. |
---|
811 | | - * @rmpp_version: If set, indicates that the client will send |
---|
812 | | - * and receive MADs that contain the RMPP header for the given version. |
---|
813 | | - * If set to 0, indicates that RMPP is not used by this client. |
---|
814 | | - * @send_handler: The completion callback routine invoked after a send |
---|
815 | | - * request has completed. |
---|
816 | | - * @recv_handler: The completion callback routine invoked for a received |
---|
817 | | - * MAD. |
---|
818 | | - * @context: User specified context associated with the registration. |
---|
819 | | - * |
---|
820 | | - * Use of this call allows clients to use MAD services, such as RMPP, |
---|
821 | | - * on user-owned QPs. After calling this routine, users may send |
---|
822 | | - * MADs on the specified QP by calling ib_mad_post_send. |
---|
823 | | - */ |
---|
824 | | -struct ib_mad_agent *ib_redirect_mad_qp(struct ib_qp *qp, |
---|
825 | | - u8 rmpp_version, |
---|
826 | | - ib_mad_send_handler send_handler, |
---|
827 | | - ib_mad_recv_handler recv_handler, |
---|
828 | | - void *context); |
---|
829 | | - |
---|
830 | | -/** |
---|
831 | | - * ib_process_mad_wc - Processes a work completion associated with a |
---|
832 | | - * MAD sent or received on a redirected QP. |
---|
833 | | - * @mad_agent: Specifies the registered MAD service using the redirected QP. |
---|
834 | | - * @wc: References a work completion associated with a sent or received |
---|
835 | | - * MAD segment. |
---|
836 | | - * |
---|
837 | | - * This routine is used to complete or continue processing on a MAD request. |
---|
838 | | - * If the work completion is associated with a send operation, calling |
---|
839 | | - * this routine is required to continue an RMPP transfer or to wait for a |
---|
840 | | - * corresponding response, if it is a request. If the work completion is |
---|
841 | | - * associated with a receive operation, calling this routine is required to |
---|
842 | | - * process an inbound or outbound RMPP transfer, or to match a response MAD |
---|
843 | | - * with its corresponding request. |
---|
844 | | - */ |
---|
845 | | -int ib_process_mad_wc(struct ib_mad_agent *mad_agent, |
---|
846 | | - struct ib_wc *wc); |
---|
847 | 742 | |
---|
848 | 743 | /** |
---|
849 | 744 | * ib_create_send_mad - Allocate and initialize a data buffer and work request |
---|