mirror of
https://github.com/torvalds/linux.git
synced 2024-12-03 17:41:22 +00:00
30dc5e63d6
This patch adds iWARP Port Mapper (IWPM) Version 2 support. The iWARP Port Mapper implementation is based on the port mapper specification section in the Sockets Direct Protocol paper - http://www.rdmaconsortium.org/home/draft-pinkerton-iwarp-sdp-v1.0.pdf Existing iWARP RDMA providers use the same IP address as the native TCP/IP stack when creating RDMA connections. They need a mechanism to claim the TCP ports used for RDMA connections to prevent TCP port collisions when other host applications use TCP ports. The iWARP Port Mapper provides a standard mechanism to accomplish this. Without this service it is possible for RDMA application to bind/listen on the same port which is already being used by native TCP host application. If that happens the incoming TCP connection data can be passed to the RDMA stack with error. The iWARP Port Mapper solution doesn't contain any changes to the existing network stack in the kernel space. All the changes are contained with the infiniband tree and also in user space. The iWARP Port Mapper service is implemented as a user space daemon process. Source for the IWPM service is located at http://git.openfabrics.org/git?p=~tnikolova/libiwpm-1.0.0/.git;a=summary The iWARP driver (port mapper client) sends to the IWPM service the local IP address and TCP port it has received from the RDMA application, when starting a connection. The IWPM service performs a socket bind from user space to get an available TCP port, called a mapped port, and communicates it back to the client. In that sense, the IWPM service is used to map the TCP port, which the RDMA application uses to any port available from the host TCP port space. The mapped ports are used in iWARP RDMA connections to avoid collisions with native TCP stack which is aware that these ports are taken. When an RDMA connection using a mapped port is terminated, the client notifies the IWPM service, which then releases the TCP port. The message exchange between the IWPM service and the iWARP drivers (between user space and kernel space) is implemented using netlink sockets. 1) Netlink interface functions are added: ibnl_unicast() and ibnl_mulitcast() for sending netlink messages to user space 2) The signature of the existing ibnl_put_msg() is changed to be more generic 3) Two netlink clients are added: RDMA_NL_NES, RDMA_NL_C4IW corresponding to the two iWarp drivers - nes and cxgb4 which use the IWPM service 4) Enums are added to enumerate the attributes in the netlink messages, which are exchanged between the user space IWPM service and the iWARP drivers Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com> Signed-off-by: Steve Wise <swise@opengridcomputing.com> Reviewed-by: PJ Waskiewicz <pj.waskiewicz@solidfire.com> [ Fold in range checking fixes and nlh_next removal as suggested by Dan Carpenter and Steve Wise. Fix sparse endianness in hash. - Roland ] Signed-off-by: Roland Dreier <roland@purestorage.com>
81 lines
2.3 KiB
C
81 lines
2.3 KiB
C
#ifndef _RDMA_NETLINK_H
|
|
#define _RDMA_NETLINK_H
|
|
|
|
|
|
#include <linux/netlink.h>
|
|
#include <uapi/rdma/rdma_netlink.h>
|
|
|
|
struct ibnl_client_cbs {
|
|
int (*dump)(struct sk_buff *skb, struct netlink_callback *nlcb);
|
|
struct module *module;
|
|
};
|
|
|
|
int ibnl_init(void);
|
|
void ibnl_cleanup(void);
|
|
|
|
/**
|
|
* Add a a client to the list of IB netlink exporters.
|
|
* @index: Index of the added client
|
|
* @nops: Number of supported ops by the added client.
|
|
* @cb_table: A table for op->callback
|
|
*
|
|
* Returns 0 on success or a negative error code.
|
|
*/
|
|
int ibnl_add_client(int index, int nops,
|
|
const struct ibnl_client_cbs cb_table[]);
|
|
|
|
/**
|
|
* Remove a client from IB netlink.
|
|
* @index: Index of the removed IB client.
|
|
*
|
|
* Returns 0 on success or a negative error code.
|
|
*/
|
|
int ibnl_remove_client(int index);
|
|
|
|
/**
|
|
* Put a new message in a supplied skb.
|
|
* @skb: The netlink skb.
|
|
* @nlh: Pointer to put the header of the new netlink message.
|
|
* @seq: The message sequence number.
|
|
* @len: The requested message length to allocate.
|
|
* @client: Calling IB netlink client.
|
|
* @op: message content op.
|
|
* Returns the allocated buffer on success and NULL on failure.
|
|
*/
|
|
void *ibnl_put_msg(struct sk_buff *skb, struct nlmsghdr **nlh, int seq,
|
|
int len, int client, int op, int flags);
|
|
/**
|
|
* Put a new attribute in a supplied skb.
|
|
* @skb: The netlink skb.
|
|
* @nlh: Header of the netlink message to append the attribute to.
|
|
* @len: The length of the attribute data.
|
|
* @data: The attribute data to put.
|
|
* @type: The attribute type.
|
|
* Returns the 0 and a negative error code on failure.
|
|
*/
|
|
int ibnl_put_attr(struct sk_buff *skb, struct nlmsghdr *nlh,
|
|
int len, void *data, int type);
|
|
|
|
/**
|
|
* Send the supplied skb to a specific userspace PID.
|
|
* @skb: The netlink skb
|
|
* @nlh: Header of the netlink message to send
|
|
* @pid: Userspace netlink process ID
|
|
* Returns 0 on success or a negative error code.
|
|
*/
|
|
int ibnl_unicast(struct sk_buff *skb, struct nlmsghdr *nlh,
|
|
__u32 pid);
|
|
|
|
/**
|
|
* Send the supplied skb to a netlink group.
|
|
* @skb: The netlink skb
|
|
* @nlh: Header of the netlink message to send
|
|
* @group: Netlink group ID
|
|
* @flags: allocation flags
|
|
* Returns 0 on success or a negative error code.
|
|
*/
|
|
int ibnl_multicast(struct sk_buff *skb, struct nlmsghdr *nlh,
|
|
unsigned int group, gfp_t flags);
|
|
|
|
#endif /* _RDMA_NETLINK_H */
|