summaryrefslogtreecommitdiffstats
path: root/net/smc/smc.h
diff options
context:
space:
mode:
authorUrsula Braun <ubraun@linux.vnet.ibm.com>2017-01-09 16:55:17 +0100
committerDavid S. Miller <davem@davemloft.net>2017-01-09 16:07:39 -0500
commit0cfdd8f92cac01afbb12e4500514036a2b78756b (patch)
treef868a5e65725183509466c9cf16b0a343115c057 /net/smc/smc.h
parenta046d57da19f812216f393e7c535f5858f793ac3 (diff)
downloadtalos-op-linux-0cfdd8f92cac01afbb12e4500514036a2b78756b.tar.gz
talos-op-linux-0cfdd8f92cac01afbb12e4500514036a2b78756b.zip
smc: connection and link group creation
* create smc_connection for SMC-sockets * determine suitable link group for a connection * create a new link group if necessary Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/smc/smc.h')
-rw-r--r--net/smc/smc.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/net/smc/smc.h b/net/smc/smc.h
index 5946aaecdebf..11265bde4655 100644
--- a/net/smc/smc.h
+++ b/net/smc/smc.h
@@ -14,6 +14,8 @@
#include <linux/types.h>
#include <net/sock.h>
+#include "smc_ib.h"
+
#define SMCPROTO_SMC 0 /* SMC protocol */
#define SMC_MAX_PORTS 2 /* Max # of ports */
@@ -25,9 +27,19 @@ enum smc_state { /* possible states of an SMC socket */
SMC_LISTEN = 10,
};
+struct smc_link_group;
+
+struct smc_connection {
+ struct rb_node alert_node;
+ struct smc_link_group *lgr; /* link group of connection */
+ u32 alert_token_local; /* unique conn. id */
+ u8 peer_conn_idx; /* from tcp handshake */
+};
+
struct smc_sock { /* smc sock container */
struct sock sk;
struct socket *clcsock; /* internal tcp socket */
+ struct smc_connection conn; /* smc connection */
struct sockaddr *addr; /* inet connect address */
struct smc_sock *listen_smc; /* listen parent */
struct work_struct tcp_listen_work;/* handle tcp socket accepts */
@@ -46,6 +58,24 @@ static inline struct smc_sock *smc_sk(const struct sock *sk)
extern u8 local_systemid[SMC_SYSTEMID_LEN]; /* unique system identifier */
+/* convert an u32 value into network byte order, store it into a 3 byte field */
+static inline void hton24(u8 *net, u32 host)
+{
+ __be32 t;
+
+ t = cpu_to_be32(host);
+ memcpy(net, ((u8 *)&t) + 1, 3);
+}
+
+/* convert a received 3 byte field into host byte order*/
+static inline u32 ntoh24(u8 *net)
+{
+ __be32 t = 0;
+
+ memcpy(((u8 *)&t) + 1, net, 3);
+ return be32_to_cpu(t);
+}
+
#ifdef CONFIG_XFRM
static inline bool using_ipsec(struct smc_sock *smc)
{
@@ -59,7 +89,13 @@ static inline bool using_ipsec(struct smc_sock *smc)
}
#endif
+struct smc_clc_msg_local;
+
int smc_netinfo_by_tcpsk(struct socket *clcsock, __be32 *subnet,
u8 *prefix_len);
+void smc_conn_free(struct smc_connection *conn);
+int smc_conn_create(struct smc_sock *smc, __be32 peer_in_addr,
+ struct smc_ib_device *smcibdev, u8 ibport,
+ struct smc_clc_msg_local *lcl, int srv_first_contact);
#endif /* __SMC_H */
OpenPOWER on IntegriCloud