/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2008, 2018 Oracle and/or its affiliates. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */ #ifndef _LINUX_RDS_H #define _LINUX_RDS_H #include <linux/types.h> #include <linux/socket.h> /* For __kernel_sockaddr_storage. */ #include <linux/in6.h> /* For struct in6_addr. */ #define RDS_IB_ABI_VERSION … #define SOL_RDS … /* * setsockopt/getsockopt for SOL_RDS */ #define RDS_CANCEL_SENT_TO … #define RDS_GET_MR … #define RDS_FREE_MR … /* deprecated: RDS_BARRIER 4 */ #define RDS_RECVERR … #define RDS_CONG_MONITOR … #define RDS_GET_MR_FOR_DEST … #define SO_RDS_TRANSPORT … /* Socket option to tap receive path latency * SO_RDS: SO_RDS_MSG_RXPATH_LATENCY * Format used struct rds_rx_trace_so */ #define SO_RDS_MSG_RXPATH_LATENCY … /* supported values for SO_RDS_TRANSPORT */ #define RDS_TRANS_IB … #define RDS_TRANS_GAP … #define RDS_TRANS_TCP … #define RDS_TRANS_COUNT … #define RDS_TRANS_NONE … /* don't use RDS_TRANS_IWARP - it is deprecated */ #define RDS_TRANS_IWARP … /* IOCTLS commands for SOL_RDS */ #define SIOCRDSSETTOS … #define SIOCRDSGETTOS … rds_tos_t; /* * Control message types for SOL_RDS. * * CMSG_RDMA_ARGS (sendmsg) * Request a RDMA transfer to/from the specified * memory ranges. * The cmsg_data is a struct rds_rdma_args. * RDS_CMSG_RDMA_DEST (recvmsg, sendmsg) * Kernel informs application about intended * source/destination of a RDMA transfer * RDS_CMSG_RDMA_MAP (sendmsg) * Application asks kernel to map the given * memory range into a IB MR, and send the * R_Key along in an RDS extension header. * The cmsg_data is a struct rds_get_mr_args, * the same as for the GET_MR setsockopt. * RDS_CMSG_RDMA_STATUS (recvmsg) * Returns the status of a completed RDMA operation. * RDS_CMSG_RXPATH_LATENCY(recvmsg) * Returns rds message latencies in various stages of receive * path in nS. Its set per socket using SO_RDS_MSG_RXPATH_LATENCY * socket option. Legitimate points are defined in * enum rds_message_rxpath_latency. More points can be added in * future. CSMG format is struct rds_cmsg_rx_trace. */ #define RDS_CMSG_RDMA_ARGS … #define RDS_CMSG_RDMA_DEST … #define RDS_CMSG_RDMA_MAP … #define RDS_CMSG_RDMA_STATUS … #define RDS_CMSG_CONG_UPDATE … #define RDS_CMSG_ATOMIC_FADD … #define RDS_CMSG_ATOMIC_CSWP … #define RDS_CMSG_MASKED_ATOMIC_FADD … #define RDS_CMSG_MASKED_ATOMIC_CSWP … #define RDS_CMSG_RXPATH_LATENCY … #define RDS_CMSG_ZCOPY_COOKIE … #define RDS_CMSG_ZCOPY_COMPLETION … #define RDS_INFO_FIRST … #define RDS_INFO_COUNTERS … #define RDS_INFO_CONNECTIONS … /* 10002 aka RDS_INFO_FLOWS is deprecated */ #define RDS_INFO_SEND_MESSAGES … #define RDS_INFO_RETRANS_MESSAGES … #define RDS_INFO_RECV_MESSAGES … #define RDS_INFO_SOCKETS … #define RDS_INFO_TCP_SOCKETS … #define RDS_INFO_IB_CONNECTIONS … #define RDS_INFO_CONNECTION_STATS … #define RDS_INFO_IWARP_CONNECTIONS … /* PF_RDS6 options */ #define RDS6_INFO_CONNECTIONS … #define RDS6_INFO_SEND_MESSAGES … #define RDS6_INFO_RETRANS_MESSAGES … #define RDS6_INFO_RECV_MESSAGES … #define RDS6_INFO_SOCKETS … #define RDS6_INFO_TCP_SOCKETS … #define RDS6_INFO_IB_CONNECTIONS … #define RDS_INFO_LAST … struct rds_info_counter { … } __attribute__((packed)); #define RDS_INFO_CONNECTION_FLAG_SENDING … #define RDS_INFO_CONNECTION_FLAG_CONNECTING … #define RDS_INFO_CONNECTION_FLAG_CONNECTED … #define TRANSNAMSIZ … struct rds_info_connection { … } __attribute__((packed)); struct rds6_info_connection { … } __attribute__((packed)); #define RDS_INFO_MESSAGE_FLAG_ACK … #define RDS_INFO_MESSAGE_FLAG_FAST_ACK … struct rds_info_message { … } __attribute__((packed)); struct rds6_info_message { … } __attribute__((packed)); struct rds_info_socket { … } __attribute__((packed)); struct rds6_info_socket { … } __attribute__((packed)); struct rds_info_tcp_socket { … } __attribute__((packed)); struct rds6_info_tcp_socket { … } __attribute__((packed)); #define RDS_IB_GID_LEN … struct rds_info_rdma_connection { … }; struct rds6_info_rdma_connection { … }; /* RDS message Receive Path Latency points */ enum rds_message_rxpath_latency { … }; struct rds_rx_trace_so { … }; struct rds_cmsg_rx_trace { … }; /* * Congestion monitoring. * Congestion control in RDS happens at the host connection * level by exchanging a bitmap marking congested ports. * By default, a process sleeping in poll() is always woken * up when the congestion map is updated. * With explicit monitoring, an application can have more * fine-grained control. * The application installs a 64bit mask value in the socket, * where each bit corresponds to a group of ports. * When a congestion update arrives, RDS checks the set of * ports that are now uncongested against the list bit mask * installed in the socket, and if they overlap, we queue a * cong_notification on the socket. * * To install the congestion monitor bitmask, use RDS_CONG_MONITOR * with the 64bit mask. * Congestion updates are received via RDS_CMSG_CONG_UPDATE * control messages. * * The correspondence between bits and ports is * 1 << (portnum % 64) */ #define RDS_CONG_MONITOR_SIZE … #define RDS_CONG_MONITOR_BIT(port) … #define RDS_CONG_MONITOR_MASK(port) … /* * RDMA related types */ /* * This encapsulates a remote memory location. * In the current implementation, it contains the R_Key * of the remote memory region, and the offset into it * (so that the application does not have to worry about * alignment). */ rds_rdma_cookie_t; struct rds_iovec { … }; struct rds_get_mr_args { … }; struct rds_get_mr_for_dest_args { … }; struct rds_free_mr_args { … }; struct rds_rdma_args { … }; struct rds_atomic_args { … }; struct rds_rdma_notify { … }; #define RDS_RDMA_SUCCESS … #define RDS_RDMA_REMOTE_ERROR … #define RDS_RDMA_CANCELED … #define RDS_RDMA_DROPPED … #define RDS_RDMA_OTHER_ERROR … #define RDS_MAX_ZCOOKIES … struct rds_zcopy_cookies { … }; /* * Common set of flags for all RDMA related structs */ #define RDS_RDMA_READWRITE … #define RDS_RDMA_FENCE … #define RDS_RDMA_INVALIDATE … #define RDS_RDMA_USE_ONCE … #define RDS_RDMA_DONTWAIT … #define RDS_RDMA_NOTIFY_ME … #define RDS_RDMA_SILENT … #endif /* IB_RDS_H */