]> Git Repo - linux.git/blobdiff - net/smc/smc.h
smc: connection and link group creation
[linux.git] / net / smc / smc.h
index 5946aaecdebf5ef730364207512eb1683e434e37..11265bde465538be7648ed10718651a84bef9be4 100644 (file)
@@ -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 */
This page took 0.033749 seconds and 4 git commands to generate.