hc
2023-12-09 958e46acc8e900e8569dd467c1af9b8d2d019394
kernel/include/rdma/ib_mad.h
....@@ -1,40 +1,13 @@
1
+/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
12 /*
23 * Copyright (c) 2004 Mellanox Technologies Ltd. All rights reserved.
34 * Copyright (c) 2004 Infinicon Corporation. All rights reserved.
45 * Copyright (c) 2004 Intel Corporation. All rights reserved.
56 * Copyright (c) 2004 Topspin Corporation. All rights reserved.
67 * 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.
358 */
369
37
-#if !defined(IB_MAD_H)
10
+#ifndef IB_MAD_H
3811 #define IB_MAD_H
3912
4013 #include <linux/list.h>
....@@ -198,7 +171,7 @@
198171 __be16 attr_offset;
199172 __be16 reserved;
200173 ib_sa_comp_mask comp_mask;
201
-} __attribute__ ((packed));
174
+} __packed;
202175
203176 struct ib_mad {
204177 struct ib_mad_hdr mad_hdr;
....@@ -227,7 +200,7 @@
227200 struct ib_rmpp_hdr rmpp_hdr;
228201 struct ib_sa_hdr sa_hdr;
229202 u8 data[IB_MGMT_SA_DATA];
230
-} __attribute__ ((packed));
203
+} __packed;
231204
232205 struct ib_vendor_mad {
233206 struct ib_mad_hdr mad_hdr;
....@@ -277,6 +250,7 @@
277250 IB_PORT_SYS_IMAGE_GUID_SUP = 1 << 11,
278251 IB_PORT_PKEY_SW_EXT_PORT_TRAP_SUP = 1 << 12,
279252 IB_PORT_EXTENDED_SPEEDS_SUP = 1 << 14,
253
+ IB_PORT_CAP_MASK2_SUP = 1 << 15,
280254 IB_PORT_CM_SUP = 1 << 16,
281255 IB_PORT_SNMP_TUNNEL_SUP = 1 << 17,
282256 IB_PORT_REINIT_SUP = 1 << 18,
....@@ -293,6 +267,15 @@
293267 IB_PORT_MCAST_PKEY_TRAP_SUPPRESSION_SUP = 1 << 29,
294268 IB_PORT_MCAST_FDB_TOP_SUP = 1 << 30,
295269 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,
296279 };
297280
298281 #define OPA_CLASS_PORT_INFO_PR_SUPPORT BIT(26)
....@@ -549,20 +532,6 @@
549532 struct ib_mad_send_wc *mad_send_wc);
550533
551534 /**
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
-/**
566535 * ib_mad_recv_handler - callback handler for a received MAD.
567536 * @mad_agent: MAD agent requesting the received MAD.
568537 * @send_buf: Send buffer if found, else NULL
....@@ -571,8 +540,7 @@
571540 * MADs received in response to a send request operation will be handed to
572541 * the user before the send operation completes. All data buffers given
573542 * 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.
576544 */
577545 typedef void (*ib_mad_recv_handler)(struct ib_mad_agent *mad_agent,
578546 struct ib_mad_send_buf *send_buf,
....@@ -585,7 +553,6 @@
585553 * @mr: Memory region for system memory usable for DMA.
586554 * @recv_handler: Callback handler for a received MAD.
587555 * @send_handler: Callback handler for a sent MAD.
588
- * @snoop_handler: Callback handler for snooped sent MADs.
589556 * @context: User-specified context associated with this registration.
590557 * @hi_tid: Access layer assigned transaction ID for this client.
591558 * Unsolicited MADs sent by this client will have the upper 32-bits
....@@ -602,16 +569,14 @@
602569 struct ib_qp *qp;
603570 ib_mad_recv_handler recv_handler;
604571 ib_mad_send_handler send_handler;
605
- ib_mad_snoop_handler snoop_handler;
606572 void *context;
607573 u32 hi_tid;
608574 u32 flags;
575
+ void *security;
576
+ struct list_head mad_agent_sec_list;
609577 u8 port_num;
610578 u8 rmpp_version;
611
- void *security;
612579 bool smp_allowed;
613
- bool lsm_nb_reg;
614
- struct notifier_block lsm_nb;
615580 };
616581
617582 /**
....@@ -711,36 +676,6 @@
711676 ib_mad_recv_handler recv_handler,
712677 void *context,
713678 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
-
744679 /**
745680 * ib_unregister_mad_agent - Unregisters a client from using MAD services.
746681 * @mad_agent: Corresponding MAD registration request to deregister.
....@@ -804,46 +739,6 @@
804739 */
805740 int ib_modify_mad(struct ib_mad_agent *mad_agent,
806741 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);
847742
848743 /**
849744 * ib_create_send_mad - Allocate and initialize a data buffer and work request