This is significantly bug fixes and general cleanups. The noteworthy new features are fairly small: - XRC support for HNS and improves RQ operations - Bug fixes and updates for hns, mlx5, bnxt_re, hfi1, i40iw, rxe, siw and qib - Quite a few general cleanups on spelling, error handling, static checker detections, etc - Increase the number of device ports supported beyond 255. High port count software switches now exist - Several bug fixes for rtrs - mlx5 Device Memory support for host controlled atomics - Report SRQ tables through to rdma-tool -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEfB7FMLh+8QxL+6i3OG33FX4gmxoFAmCMMHEACgkQOG33FX4g mxri3Q//RAgIExCGHebQ9xkptZHVyTLLJMpiMl2cqk3ZVRdDZ7QdiQjIqY2KqlUK nxBj7EXJeX6rV5a1xqCcOO1gBetB28TSwnCNE2ZqrXP5B59ISW8D052IWza3UkUz WmHLARxHQlyKBWA4+ZAgfoUGL0NmWA8QPf56t/RK/3/OsuYnGzcnWmmFbt8XKFcH NtO3KC45mKWDqqG0A0XRrLbEQz/ElO3OuPBqlBKgB3ZgGPzgsOUTOGkm1tCcZ89L /pvZGB7SklKZdCX8TxdpVGd9h0zHl8pqh1yEzvTA1ypNAYSUId2mvZXluU8J5yJl FLk7E1IxE5050FNEc7T5uZdUVntulYiqL2558coRI34l5w26pKGjIMxw/nTB8hg8 4ZfBtKVemIG6yzW5Up6iBpK7qWYpvLWVShwYAWhbNsjN7JGzJuh1gJnjbmYgyz2P RTMU9wjFPLL2wZxg4LDHACVJNBb82j6KKuE+kZWpk11ro7INw9+7YwRuTo7/ezxC BwXKu8wF4igwSigV55jM+WnGXLhxdC3qmx/2cbtWyLM/PzdRL96tM0RWW5v8/Nv7 teFhkt+f3RVqcfYH5K1qCXy3UFrxG6bxFSvcHHSBx2bdIrqhuTY5FqszAYImeW2j iHoyIsuSuGu79HQgOzAQZsEyksWi6OYDvA9Q9VBoPP4bJ3DOAa4= =vsXA -----END PGP SIGNATURE----- Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma Pull rdma updates from Jason Gunthorpe: "This is significantly bug fixes and general cleanups. The noteworthy new features are fairly small: - XRC support for HNS and improves RQ operations - Bug fixes and updates for hns, mlx5, bnxt_re, hfi1, i40iw, rxe, siw and qib - Quite a few general cleanups on spelling, error handling, static checker detections, etc - Increase the number of device ports supported beyond 255. High port count software switches now exist - Several bug fixes for rtrs - mlx5 Device Memory support for host controlled atomics - Report SRQ tables through to rdma-tool" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: (145 commits) IB/qib: Remove redundant assignment to ret RDMA/nldev: Add copy-on-fork attribute to get sys command RDMA/bnxt_re: Fix a double free in bnxt_qplib_alloc_res RDMA/siw: Fix a use after free in siw_alloc_mr IB/hfi1: Remove redundant variable rcd RDMA/nldev: Add QP numbers to SRQ information RDMA/nldev: Return SRQ information RDMA/restrack: Add support to get resource tracking for SRQ RDMA/nldev: Return context information RDMA/core: Add CM to restrack after successful attachment to a device RDMA/cma: Skip device which doesn't support CM RDMA/rxe: Fix a bug in rxe_fill_ip_info() RDMA/mlx5: Expose private query port RDMA/mlx4: Remove an unused variable RDMA/mlx5: Fix type assignment for ICM DM IB/mlx5: Set right RoCE l3 type and roce version while deleting GID RDMA/i40iw: Fix error unwinding when i40iw_hmc_sd_one fails RDMA/cxgb4: add missing qpid increment IB/ipoib: Remove unnecessary struct declaration RDMA/bnxt_re: Get rid of custom module reference counting ...
187 lines
5.2 KiB
C
187 lines
5.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
/*
|
|
* RDMA Transport Layer
|
|
*
|
|
* Copyright (c) 2014 - 2018 ProfitBricks GmbH. All rights reserved.
|
|
* Copyright (c) 2018 - 2019 1&1 IONOS Cloud GmbH. All rights reserved.
|
|
* Copyright (c) 2019 - 2020 1&1 IONOS SE. All rights reserved.
|
|
*/
|
|
#ifndef RTRS_H
|
|
#define RTRS_H
|
|
|
|
#include <linux/socket.h>
|
|
#include <linux/scatterlist.h>
|
|
|
|
struct rtrs_permit;
|
|
struct rtrs_clt;
|
|
struct rtrs_srv_ctx;
|
|
struct rtrs_srv;
|
|
struct rtrs_srv_op;
|
|
|
|
/*
|
|
* RDMA transport (RTRS) client API
|
|
*/
|
|
|
|
/**
|
|
* enum rtrs_clt_link_ev - Events about connectivity state of a client
|
|
* @RTRS_CLT_LINK_EV_RECONNECTED Client was reconnected.
|
|
* @RTRS_CLT_LINK_EV_DISCONNECTED Client was disconnected.
|
|
*/
|
|
enum rtrs_clt_link_ev {
|
|
RTRS_CLT_LINK_EV_RECONNECTED,
|
|
RTRS_CLT_LINK_EV_DISCONNECTED,
|
|
};
|
|
|
|
/**
|
|
* Source and destination address of a path to be established
|
|
*/
|
|
struct rtrs_addr {
|
|
struct sockaddr_storage *src;
|
|
struct sockaddr_storage *dst;
|
|
};
|
|
|
|
/**
|
|
* rtrs_clt_ops - it holds the link event callback and private pointer.
|
|
* @priv: User supplied private data.
|
|
* @link_ev: Event notification callback function for connection state changes
|
|
* @priv: User supplied data that was passed to rtrs_clt_open()
|
|
* @ev: Occurred event
|
|
*/
|
|
struct rtrs_clt_ops {
|
|
void *priv;
|
|
void (*link_ev)(void *priv, enum rtrs_clt_link_ev ev);
|
|
};
|
|
|
|
struct rtrs_clt *rtrs_clt_open(struct rtrs_clt_ops *ops,
|
|
const char *sessname,
|
|
const struct rtrs_addr *paths,
|
|
size_t path_cnt, u16 port,
|
|
size_t pdu_sz, u8 reconnect_delay_sec,
|
|
u16 max_segments,
|
|
s16 max_reconnect_attempts, u32 nr_poll_queues);
|
|
|
|
void rtrs_clt_close(struct rtrs_clt *sess);
|
|
|
|
enum wait_type {
|
|
RTRS_PERMIT_NOWAIT = 0,
|
|
RTRS_PERMIT_WAIT = 1
|
|
};
|
|
|
|
/**
|
|
* enum rtrs_clt_con_type() type of ib connection to use with a given
|
|
* rtrs_permit
|
|
* @ADMIN_CON - use connection reserved for "service" messages
|
|
* @IO_CON - use a connection reserved for IO
|
|
*/
|
|
enum rtrs_clt_con_type {
|
|
RTRS_ADMIN_CON,
|
|
RTRS_IO_CON
|
|
};
|
|
|
|
struct rtrs_permit *rtrs_clt_get_permit(struct rtrs_clt *sess,
|
|
enum rtrs_clt_con_type con_type,
|
|
enum wait_type wait);
|
|
|
|
void rtrs_clt_put_permit(struct rtrs_clt *sess, struct rtrs_permit *permit);
|
|
|
|
/**
|
|
* rtrs_clt_req_ops - it holds the request confirmation callback
|
|
* and a private pointer.
|
|
* @priv: User supplied private data.
|
|
* @conf_fn: callback function to be called as confirmation
|
|
* @priv: User provided data, passed back with corresponding
|
|
* @(conf) confirmation.
|
|
* @errno: error number.
|
|
*/
|
|
struct rtrs_clt_req_ops {
|
|
void *priv;
|
|
void (*conf_fn)(void *priv, int errno);
|
|
};
|
|
|
|
int rtrs_clt_request(int dir, struct rtrs_clt_req_ops *ops,
|
|
struct rtrs_clt *sess, struct rtrs_permit *permit,
|
|
const struct kvec *vec, size_t nr, size_t len,
|
|
struct scatterlist *sg, unsigned int sg_cnt);
|
|
int rtrs_clt_rdma_cq_direct(struct rtrs_clt *clt, unsigned int index);
|
|
|
|
/**
|
|
* rtrs_attrs - RTRS session attributes
|
|
*/
|
|
struct rtrs_attrs {
|
|
u32 queue_depth;
|
|
u32 max_io_size;
|
|
};
|
|
|
|
int rtrs_clt_query(struct rtrs_clt *sess, struct rtrs_attrs *attr);
|
|
|
|
/*
|
|
* Here goes RTRS server API
|
|
*/
|
|
|
|
/**
|
|
* enum rtrs_srv_link_ev - Server link events
|
|
* @RTRS_SRV_LINK_EV_CONNECTED: Connection from client established
|
|
* @RTRS_SRV_LINK_EV_DISCONNECTED: Connection was disconnected, all
|
|
* connection RTRS resources were freed.
|
|
*/
|
|
enum rtrs_srv_link_ev {
|
|
RTRS_SRV_LINK_EV_CONNECTED,
|
|
RTRS_SRV_LINK_EV_DISCONNECTED,
|
|
};
|
|
|
|
struct rtrs_srv_ops {
|
|
/**
|
|
* rdma_ev(): Event notification for RDMA operations
|
|
* If the callback returns a value != 0, an error
|
|
* message for the data transfer will be sent to
|
|
* the client.
|
|
|
|
* @priv: Private data set by rtrs_srv_set_sess_priv()
|
|
* @id: internal RTRS operation id
|
|
* @dir: READ/WRITE
|
|
* @data: Pointer to (bidirectional) rdma memory area:
|
|
* - in case of %RTRS_SRV_RDMA_EV_RECV contains
|
|
* data sent by the client
|
|
* - in case of %RTRS_SRV_RDMA_EV_WRITE_REQ points
|
|
* to the memory area where the response is to be
|
|
* written to
|
|
* @datalen: Size of the memory area in @data
|
|
* @usr: The extra user message sent by the client (%vec)
|
|
* @usrlen: Size of the user message
|
|
*/
|
|
int (*rdma_ev)(void *priv,
|
|
struct rtrs_srv_op *id, int dir,
|
|
void *data, size_t datalen, const void *usr,
|
|
size_t usrlen);
|
|
/**
|
|
* link_ev(): Events about connectivity state changes
|
|
* If the callback returns != 0 and the event
|
|
* %RTRS_SRV_LINK_EV_CONNECTED the corresponding
|
|
* session will be destroyed.
|
|
* @sess: Session
|
|
* @ev: event
|
|
* @priv: Private data from user if previously set with
|
|
* rtrs_srv_set_sess_priv()
|
|
*/
|
|
int (*link_ev)(struct rtrs_srv *sess, enum rtrs_srv_link_ev ev,
|
|
void *priv);
|
|
};
|
|
|
|
struct rtrs_srv_ctx *rtrs_srv_open(struct rtrs_srv_ops *ops, u16 port);
|
|
|
|
void rtrs_srv_close(struct rtrs_srv_ctx *ctx);
|
|
|
|
bool rtrs_srv_resp_rdma(struct rtrs_srv_op *id, int errno);
|
|
|
|
void rtrs_srv_set_sess_priv(struct rtrs_srv *sess, void *priv);
|
|
|
|
int rtrs_srv_get_sess_name(struct rtrs_srv *sess, char *sessname, size_t len);
|
|
|
|
int rtrs_srv_get_queue_depth(struct rtrs_srv *sess);
|
|
|
|
int rtrs_addr_to_sockaddr(const char *str, size_t len, u16 port,
|
|
struct rtrs_addr *addr);
|
|
|
|
int sockaddr_to_str(const struct sockaddr *addr, char *buf, size_t len);
|
|
int rtrs_addr_to_str(const struct rtrs_addr *addr, char *buf, size_t len);
|
|
#endif
|