xref: /openbmc/linux/include/rdma/iw_portmap.h (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
1*6bf9d8f6SLeon Romanovsky /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
230dc5e63STatyana Nikolova /*
330dc5e63STatyana Nikolova  * Copyright (c) 2014 Intel Corporation. All rights reserved.
430dc5e63STatyana Nikolova  * Copyright (c) 2014 Chelsio, Inc. All rights reserved.
530dc5e63STatyana Nikolova  */
6*6bf9d8f6SLeon Romanovsky 
730dc5e63STatyana Nikolova #ifndef _IW_PORTMAP_H
830dc5e63STatyana Nikolova #define _IW_PORTMAP_H
930dc5e63STatyana Nikolova 
1039289bfcSJason Gunthorpe #include <linux/socket.h>
1139289bfcSJason Gunthorpe #include <linux/netlink.h>
1239289bfcSJason Gunthorpe 
1330dc5e63STatyana Nikolova #define IWPM_ULIBNAME_SIZE	32
1430dc5e63STatyana Nikolova #define IWPM_DEVNAME_SIZE	32
1530dc5e63STatyana Nikolova #define IWPM_IFNAME_SIZE	16
1630dc5e63STatyana Nikolova #define IWPM_IPADDR_SIZE	16
1730dc5e63STatyana Nikolova 
1830dc5e63STatyana Nikolova enum {
1930dc5e63STatyana Nikolova 	IWPM_INVALID_NLMSG_ERR = 10,
2030dc5e63STatyana Nikolova 	IWPM_CREATE_MAPPING_ERR,
2130dc5e63STatyana Nikolova 	IWPM_DUPLICATE_MAPPING_ERR,
2230dc5e63STatyana Nikolova 	IWPM_UNKNOWN_MAPPING_ERR,
2330dc5e63STatyana Nikolova 	IWPM_CLIENT_DEV_INFO_ERR,
2430dc5e63STatyana Nikolova 	IWPM_USER_LIB_INFO_ERR,
2530dc5e63STatyana Nikolova 	IWPM_REMOTE_QUERY_REJECT
2630dc5e63STatyana Nikolova };
2730dc5e63STatyana Nikolova 
2830dc5e63STatyana Nikolova struct iwpm_dev_data {
2930dc5e63STatyana Nikolova 	char dev_name[IWPM_DEVNAME_SIZE];
3030dc5e63STatyana Nikolova 	char if_name[IWPM_IFNAME_SIZE];
3130dc5e63STatyana Nikolova };
3230dc5e63STatyana Nikolova 
3330dc5e63STatyana Nikolova struct iwpm_sa_data {
3430dc5e63STatyana Nikolova 	struct sockaddr_storage loc_addr;
3530dc5e63STatyana Nikolova 	struct sockaddr_storage mapped_loc_addr;
3630dc5e63STatyana Nikolova 	struct sockaddr_storage rem_addr;
3730dc5e63STatyana Nikolova 	struct sockaddr_storage mapped_rem_addr;
38b0bad9adSSteve Wise 	u32 flags;
3930dc5e63STatyana Nikolova };
4030dc5e63STatyana Nikolova 
4130dc5e63STatyana Nikolova int iwpm_init(u8);
4230dc5e63STatyana Nikolova int iwpm_exit(u8);
4330dc5e63STatyana Nikolova int iwpm_valid_pid(void);
4430dc5e63STatyana Nikolova int iwpm_register_pid(struct iwpm_dev_data *pm_msg, u8 nl_client);
4530dc5e63STatyana Nikolova int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client);
4630dc5e63STatyana Nikolova int iwpm_add_and_query_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client);
4730dc5e63STatyana Nikolova int iwpm_remove_mapping(struct sockaddr_storage *local_addr, u8 nl_client);
4830dc5e63STatyana Nikolova int iwpm_register_pid_cb(struct sk_buff *, struct netlink_callback *);
4930dc5e63STatyana Nikolova int iwpm_add_mapping_cb(struct sk_buff *, struct netlink_callback *);
5030dc5e63STatyana Nikolova int iwpm_add_and_query_mapping_cb(struct sk_buff *, struct netlink_callback *);
516eec1774STatyana Nikolova int iwpm_remote_info_cb(struct sk_buff *, struct netlink_callback *);
5230dc5e63STatyana Nikolova int iwpm_mapping_error_cb(struct sk_buff *, struct netlink_callback *);
5330dc5e63STatyana Nikolova int iwpm_mapping_info_cb(struct sk_buff *, struct netlink_callback *);
5430dc5e63STatyana Nikolova int iwpm_ack_mapping_info_cb(struct sk_buff *, struct netlink_callback *);
556eec1774STatyana Nikolova int iwpm_get_remote_info(struct sockaddr_storage *mapped_loc_addr,
566eec1774STatyana Nikolova 			struct sockaddr_storage *mapped_rem_addr,
576eec1774STatyana Nikolova 			struct sockaddr_storage *remote_addr, u8 nl_client);
5830dc5e63STatyana Nikolova int iwpm_create_mapinfo(struct sockaddr_storage *local_addr,
59b0bad9adSSteve Wise 			struct sockaddr_storage *mapped_addr, u8 nl_client,
60b0bad9adSSteve Wise 			u32 map_flags);
6130dc5e63STatyana Nikolova int iwpm_remove_mapinfo(struct sockaddr_storage *local_addr,
6230dc5e63STatyana Nikolova 			struct sockaddr_storage *mapped_addr);
6330dc5e63STatyana Nikolova 
64b0bad9adSSteve Wise int iwpm_hello_cb(struct sk_buff *skb, struct netlink_callback *cb);
6530dc5e63STatyana Nikolova #endif /* _IW_PORTMAP_H */
66