/* SPDX-License-Identifier: GPL-2.0 */


#ifndef __NETNS_MCTP_H__
#define __NETNS_MCTP_H__

#include <linux/hash.h>
#include <linux/hashtable.h>
#include <linux/mutex.h>
#include <linux/types.h>

#define MCTP_BINDS_BITS 7

struct netns_mctp {
	
	struct list_head routes;

	
	struct mutex bind_lock;
	DECLARE_HASHTABLE(binds, MCTP_BINDS_BITS);

	
	spinlock_t keys_lock;
	struct hlist_head keys;

	
	unsigned int default_net;

	
	struct mutex neigh_lock;
	struct list_head neighbours;
};

static inline u32 mctp_bind_hash(u8 type, u8 local_addr, u8 peer_addr)
{
	return hash_32(type | (u32)local_addr << 8 | (u32)peer_addr << 16,
		       MCTP_BINDS_BITS);
}

#endif 
