linux/drivers/infiniband/core/iwpm_util.c

/*
 * Copyright (c) 2014 Chelsio, Inc. All rights reserved.
 * Copyright (c) 2014 Intel Corporation. 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.
 */

#include "iwpm_util.h"

#define IWPM_MAPINFO_HASH_SIZE
#define IWPM_MAPINFO_HASH_MASK
#define IWPM_REMINFO_HASH_SIZE
#define IWPM_REMINFO_HASH_MASK
#define IWPM_MSG_SIZE

static LIST_HEAD(iwpm_nlmsg_req_list);
static DEFINE_SPINLOCK(iwpm_nlmsg_req_lock);

static struct hlist_head *iwpm_hash_bucket;
static DEFINE_SPINLOCK(iwpm_mapinfo_lock);

static struct hlist_head *iwpm_reminfo_bucket;
static DEFINE_SPINLOCK(iwpm_reminfo_lock);

static struct iwpm_admin_data iwpm_admin;

/**
 * iwpm_init - Allocate resources for the iwarp port mapper
 * @nl_client: The index of the netlink client
 *
 * Should be called when network interface goes up.
 */
int iwpm_init(u8 nl_client)
{}

static void free_hash_bucket(void);
static void free_reminfo_bucket(void);

/**
 * iwpm_exit - Deallocate resources for the iwarp port mapper
 * @nl_client: The index of the netlink client
 *
 * Should be called when network interface goes down.
 */
int iwpm_exit(u8 nl_client)
{}

static struct hlist_head *get_mapinfo_hash_bucket(struct sockaddr_storage *,
					       struct sockaddr_storage *);

/**
 * iwpm_create_mapinfo - Store local and mapped IPv4/IPv6 address
 *                       info in a hash table
 * @local_sockaddr: Local ip/tcp address
 * @mapped_sockaddr: Mapped local ip/tcp address
 * @nl_client: The index of the netlink client
 * @map_flags: IWPM mapping flags
 */
int iwpm_create_mapinfo(struct sockaddr_storage *local_sockaddr,
			struct sockaddr_storage *mapped_sockaddr,
			u8 nl_client, u32 map_flags)
{}

/**
 * iwpm_remove_mapinfo - Remove local and mapped IPv4/IPv6 address
 *                       info from the hash table
 * @local_sockaddr: Local ip/tcp address
 * @mapped_local_addr: Mapped local ip/tcp address
 *
 * Returns err code if mapping info is not found in the hash table,
 * otherwise returns 0
 */
int iwpm_remove_mapinfo(struct sockaddr_storage *local_sockaddr,
			struct sockaddr_storage *mapped_local_addr)
{}

static void free_hash_bucket(void)
{}

static void free_reminfo_bucket(void)
{}

static struct hlist_head *get_reminfo_hash_bucket(struct sockaddr_storage *,
						struct sockaddr_storage *);

void iwpm_add_remote_info(struct iwpm_remote_info *rem_info)
{}

/**
 * iwpm_get_remote_info - Get the remote connecting peer address info
 *
 * @mapped_loc_addr: Mapped local address of the listening peer
 * @mapped_rem_addr: Mapped remote address of the connecting peer
 * @remote_addr: To store the remote address of the connecting peer
 * @nl_client: The index of the netlink client
 *
 * The remote address info is retrieved and provided to the client in
 * the remote_addr. After that it is removed from the hash table
 */
int iwpm_get_remote_info(struct sockaddr_storage *mapped_loc_addr,
			 struct sockaddr_storage *mapped_rem_addr,
			 struct sockaddr_storage *remote_addr,
			 u8 nl_client)
{}

struct iwpm_nlmsg_request *iwpm_get_nlmsg_request(__u32 nlmsg_seq,
					u8 nl_client, gfp_t gfp)
{}

void iwpm_free_nlmsg_request(struct kref *kref)
{}

struct iwpm_nlmsg_request *iwpm_find_nlmsg_request(__u32 echo_seq)
{}

int iwpm_wait_complete_req(struct iwpm_nlmsg_request *nlmsg_request)
{}

int iwpm_get_nlmsg_seq(void)
{}

/* valid client */
u32 iwpm_get_registration(u8 nl_client)
{}

/* valid client */
void iwpm_set_registration(u8 nl_client, u32 reg)
{}

/* valid client */
u32 iwpm_check_registration(u8 nl_client, u32 reg)
{}

int iwpm_compare_sockaddr(struct sockaddr_storage *a_sockaddr,
				struct sockaddr_storage *b_sockaddr)
{}

struct sk_buff *iwpm_create_nlmsg(u32 nl_op, struct nlmsghdr **nlh,
						int nl_client)
{}

int iwpm_parse_nlmsg(struct netlink_callback *cb, int policy_max,
				   const struct nla_policy *nlmsg_policy,
				   struct nlattr *nltb[], const char *msg_type)
{}

void iwpm_print_sockaddr(struct sockaddr_storage *sockaddr, char *msg)
{}

static u32 iwpm_ipv6_jhash(struct sockaddr_in6 *ipv6_sockaddr)
{}

static u32 iwpm_ipv4_jhash(struct sockaddr_in *ipv4_sockaddr)
{}

static int get_hash_bucket(struct sockaddr_storage *a_sockaddr,
				struct sockaddr_storage *b_sockaddr, u32 *hash)
{}

static struct hlist_head *get_mapinfo_hash_bucket(struct sockaddr_storage
				*local_sockaddr, struct sockaddr_storage
				*mapped_sockaddr)
{}

static struct hlist_head *get_reminfo_hash_bucket(struct sockaddr_storage
				*mapped_loc_sockaddr, struct sockaddr_storage
				*mapped_rem_sockaddr)
{}

static int send_mapinfo_num(u32 mapping_num, u8 nl_client, int iwpm_pid)
{}

static int send_nlmsg_done(struct sk_buff *skb, u8 nl_client, int iwpm_pid)
{}

int iwpm_send_mapinfo(u8 nl_client, int iwpm_pid)
{}

int iwpm_mapinfo_available(void)
{}

int iwpm_send_hello(u8 nl_client, int iwpm_pid, u16 abi_version)
{}