Commit 97d10d0a authored by Mike Shuey's avatar Mike Shuey Committed by Greg Kroah-Hartman

staging: lustre: lnet: socklnd: code cleanup - align spacing

Unify variable declarations to use a single space.  Also include several
miscellaneous whitespace cleanups, particularly in socklnd.h.
Signed-off-by: default avatarMike Shuey <shuey@purdue.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ec3d17c0
...@@ -64,7 +64,7 @@ ksocknal_lib_get_conn_addrs(ksock_conn_t *conn) ...@@ -64,7 +64,7 @@ ksocknal_lib_get_conn_addrs(ksock_conn_t *conn)
int int
ksocknal_lib_zc_capable(ksock_conn_t *conn) ksocknal_lib_zc_capable(ksock_conn_t *conn)
{ {
int caps = conn->ksnc_sock->sk->sk_route_caps; int caps = conn->ksnc_sock->sk->sk_route_caps;
if (conn->ksnc_proto == &ksocknal_protocol_v1x) if (conn->ksnc_proto == &ksocknal_protocol_v1x)
return 0; return 0;
...@@ -78,8 +78,8 @@ int ...@@ -78,8 +78,8 @@ int
ksocknal_lib_send_iov(ksock_conn_t *conn, ksock_tx_t *tx) ksocknal_lib_send_iov(ksock_conn_t *conn, ksock_tx_t *tx)
{ {
struct socket *sock = conn->ksnc_sock; struct socket *sock = conn->ksnc_sock;
int nob; int nob;
int rc; int rc;
if (*ksocknal_tunables.ksnd_enable_csum && /* checksum enabled */ if (*ksocknal_tunables.ksnd_enable_csum && /* checksum enabled */
conn->ksnc_proto == &ksocknal_protocol_v2x && /* V2.x connection */ conn->ksnc_proto == &ksocknal_protocol_v2x && /* V2.x connection */
...@@ -92,15 +92,15 @@ ksocknal_lib_send_iov(ksock_conn_t *conn, ksock_tx_t *tx) ...@@ -92,15 +92,15 @@ ksocknal_lib_send_iov(ksock_conn_t *conn, ksock_tx_t *tx)
{ {
#if SOCKNAL_SINGLE_FRAG_TX #if SOCKNAL_SINGLE_FRAG_TX
struct kvec scratch; struct kvec scratch;
struct kvec *scratchiov = &scratch; struct kvec *scratchiov = &scratch;
unsigned int niov = 1; unsigned int niov = 1;
#else #else
struct kvec *scratchiov = conn->ksnc_scheduler->kss_scratch_iov; struct kvec *scratchiov = conn->ksnc_scheduler->kss_scratch_iov;
unsigned int niov = tx->tx_niov; unsigned int niov = tx->tx_niov;
#endif #endif
struct msghdr msg = {.msg_flags = MSG_DONTWAIT}; struct msghdr msg = {.msg_flags = MSG_DONTWAIT};
int i; int i;
for (nob = i = 0; i < niov; i++) { for (nob = i = 0; i < niov; i++) {
scratchiov[i] = tx->tx_iov[i]; scratchiov[i] = tx->tx_iov[i];
...@@ -120,9 +120,9 @@ int ...@@ -120,9 +120,9 @@ int
ksocknal_lib_send_kiov(ksock_conn_t *conn, ksock_tx_t *tx) ksocknal_lib_send_kiov(ksock_conn_t *conn, ksock_tx_t *tx)
{ {
struct socket *sock = conn->ksnc_sock; struct socket *sock = conn->ksnc_sock;
lnet_kiov_t *kiov = tx->tx_kiov; lnet_kiov_t *kiov = tx->tx_kiov;
int rc; int rc;
int nob; int nob;
/* Not NOOP message */ /* Not NOOP message */
LASSERT(tx->tx_lnetmsg != NULL); LASSERT(tx->tx_lnetmsg != NULL);
...@@ -131,11 +131,11 @@ ksocknal_lib_send_kiov(ksock_conn_t *conn, ksock_tx_t *tx) ...@@ -131,11 +131,11 @@ ksocknal_lib_send_kiov(ksock_conn_t *conn, ksock_tx_t *tx)
* or leave them alone. */ * or leave them alone. */
if (tx->tx_msg.ksm_zc_cookies[0] != 0) { if (tx->tx_msg.ksm_zc_cookies[0] != 0) {
/* Zero copy is enabled */ /* Zero copy is enabled */
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct page *page = kiov->kiov_page; struct page *page = kiov->kiov_page;
int offset = kiov->kiov_offset; int offset = kiov->kiov_offset;
int fragsize = kiov->kiov_len; int fragsize = kiov->kiov_len;
int msgflg = MSG_DONTWAIT; int msgflg = MSG_DONTWAIT;
CDEBUG(D_NET, "page %p + offset %x for %d\n", CDEBUG(D_NET, "page %p + offset %x for %d\n",
page, offset, kiov->kiov_len); page, offset, kiov->kiov_len);
...@@ -153,18 +153,18 @@ ksocknal_lib_send_kiov(ksock_conn_t *conn, ksock_tx_t *tx) ...@@ -153,18 +153,18 @@ ksocknal_lib_send_kiov(ksock_conn_t *conn, ksock_tx_t *tx)
} }
} else { } else {
#if SOCKNAL_SINGLE_FRAG_TX || !SOCKNAL_RISK_KMAP_DEADLOCK #if SOCKNAL_SINGLE_FRAG_TX || !SOCKNAL_RISK_KMAP_DEADLOCK
struct kvec scratch; struct kvec scratch;
struct kvec *scratchiov = &scratch; struct kvec *scratchiov = &scratch;
unsigned int niov = 1; unsigned int niov = 1;
#else #else
#ifdef CONFIG_HIGHMEM #ifdef CONFIG_HIGHMEM
#warning "XXX risk of kmap deadlock on multiple frags..." #warning "XXX risk of kmap deadlock on multiple frags..."
#endif #endif
struct kvec *scratchiov = conn->ksnc_scheduler->kss_scratch_iov; struct kvec *scratchiov = conn->ksnc_scheduler->kss_scratch_iov;
unsigned int niov = tx->tx_nkiov; unsigned int niov = tx->tx_nkiov;
#endif #endif
struct msghdr msg = {.msg_flags = MSG_DONTWAIT}; struct msghdr msg = {.msg_flags = MSG_DONTWAIT};
int i; int i;
for (nob = i = 0; i < niov; i++) { for (nob = i = 0; i < niov; i++) {
scratchiov[i].iov_base = kmap(kiov[i].kiov_page) + scratchiov[i].iov_base = kmap(kiov[i].kiov_page) +
...@@ -187,7 +187,7 @@ ksocknal_lib_send_kiov(ksock_conn_t *conn, ksock_tx_t *tx) ...@@ -187,7 +187,7 @@ ksocknal_lib_send_kiov(ksock_conn_t *conn, ksock_tx_t *tx)
void void
ksocknal_lib_eager_ack(ksock_conn_t *conn) ksocknal_lib_eager_ack(ksock_conn_t *conn)
{ {
int opt = 1; int opt = 1;
struct socket *sock = conn->ksnc_sock; struct socket *sock = conn->ksnc_sock;
/* Remind the socket to ACK eagerly. If I don't, the socket might /* Remind the socket to ACK eagerly. If I don't, the socket might
...@@ -203,23 +203,23 @@ int ...@@ -203,23 +203,23 @@ int
ksocknal_lib_recv_iov(ksock_conn_t *conn) ksocknal_lib_recv_iov(ksock_conn_t *conn)
{ {
#if SOCKNAL_SINGLE_FRAG_RX #if SOCKNAL_SINGLE_FRAG_RX
struct kvec scratch; struct kvec scratch;
struct kvec *scratchiov = &scratch; struct kvec *scratchiov = &scratch;
unsigned int niov = 1; unsigned int niov = 1;
#else #else
struct kvec *scratchiov = conn->ksnc_scheduler->kss_scratch_iov; struct kvec *scratchiov = conn->ksnc_scheduler->kss_scratch_iov;
unsigned int niov = conn->ksnc_rx_niov; unsigned int niov = conn->ksnc_rx_niov;
#endif #endif
struct kvec *iov = conn->ksnc_rx_iov; struct kvec *iov = conn->ksnc_rx_iov;
struct msghdr msg = { struct msghdr msg = {
.msg_flags = 0 .msg_flags = 0
}; };
int nob; int nob;
int i; int i;
int rc; int rc;
int fragnob; int fragnob;
int sum; int sum;
__u32 saved_csum; __u32 saved_csum;
/* NB we can't trust socket ops to either consume our iovs /* NB we can't trust socket ops to either consume our iovs
* or leave them alone. */ * or leave them alone. */
...@@ -271,9 +271,9 @@ static void * ...@@ -271,9 +271,9 @@ static void *
ksocknal_lib_kiov_vmap(lnet_kiov_t *kiov, int niov, ksocknal_lib_kiov_vmap(lnet_kiov_t *kiov, int niov,
struct kvec *iov, struct page **pages) struct kvec *iov, struct page **pages)
{ {
void *addr; void *addr;
int nob; int nob;
int i; int i;
if (!*ksocknal_tunables.ksnd_zc_recv || pages == NULL) if (!*ksocknal_tunables.ksnd_zc_recv || pages == NULL)
return NULL; return NULL;
...@@ -307,29 +307,29 @@ int ...@@ -307,29 +307,29 @@ int
ksocknal_lib_recv_kiov(ksock_conn_t *conn) ksocknal_lib_recv_kiov(ksock_conn_t *conn)
{ {
#if SOCKNAL_SINGLE_FRAG_RX || !SOCKNAL_RISK_KMAP_DEADLOCK #if SOCKNAL_SINGLE_FRAG_RX || !SOCKNAL_RISK_KMAP_DEADLOCK
struct kvec scratch; struct kvec scratch;
struct kvec *scratchiov = &scratch; struct kvec *scratchiov = &scratch;
struct page **pages = NULL; struct page **pages = NULL;
unsigned int niov = 1; unsigned int niov = 1;
#else #else
#ifdef CONFIG_HIGHMEM #ifdef CONFIG_HIGHMEM
#warning "XXX risk of kmap deadlock on multiple frags..." #warning "XXX risk of kmap deadlock on multiple frags..."
#endif #endif
struct kvec *scratchiov = conn->ksnc_scheduler->kss_scratch_iov; struct kvec *scratchiov = conn->ksnc_scheduler->kss_scratch_iov;
struct page **pages = conn->ksnc_scheduler->kss_rx_scratch_pgs; struct page **pages = conn->ksnc_scheduler->kss_rx_scratch_pgs;
unsigned int niov = conn->ksnc_rx_nkiov; unsigned int niov = conn->ksnc_rx_nkiov;
#endif #endif
lnet_kiov_t *kiov = conn->ksnc_rx_kiov; lnet_kiov_t *kiov = conn->ksnc_rx_kiov;
struct msghdr msg = { struct msghdr msg = {
.msg_flags = 0 .msg_flags = 0
}; };
int nob; int nob;
int i; int i;
int rc; int rc;
void *base; void *base;
void *addr; void *addr;
int sum; int sum;
int fragnob; int fragnob;
int n; int n;
/* NB we can't trust socket ops to either consume our iovs /* NB we can't trust socket ops to either consume our iovs
...@@ -357,10 +357,10 @@ ksocknal_lib_recv_kiov(ksock_conn_t *conn) ...@@ -357,10 +357,10 @@ ksocknal_lib_recv_kiov(ksock_conn_t *conn)
for (i = 0, sum = rc; sum > 0; i++, sum -= fragnob) { for (i = 0, sum = rc; sum > 0; i++, sum -= fragnob) {
LASSERT(i < niov); LASSERT(i < niov);
/* Dang! have to kmap again because I have nowhere to stash the /* Dang! have to kmap again because I have nowhere to
* mapped address. But by doing it while the page is still * stash the mapped address. But by doing it while the
* mapped, the kernel just bumps the map count and returns me * page is still mapped, the kernel just bumps the map
* the address it stashed. */ * count and returns me the address it stashed. */
base = kmap(kiov[i].kiov_page) + kiov[i].kiov_offset; base = kmap(kiov[i].kiov_page) + kiov[i].kiov_offset;
fragnob = kiov[i].kiov_len; fragnob = kiov[i].kiov_len;
if (fragnob > sum) if (fragnob > sum)
...@@ -386,9 +386,9 @@ ksocknal_lib_recv_kiov(ksock_conn_t *conn) ...@@ -386,9 +386,9 @@ ksocknal_lib_recv_kiov(ksock_conn_t *conn)
void void
ksocknal_lib_csum_tx(ksock_tx_t *tx) ksocknal_lib_csum_tx(ksock_tx_t *tx)
{ {
int i; int i;
__u32 csum; __u32 csum;
void *base; void *base;
LASSERT(tx->tx_iov[0].iov_base == &tx->tx_msg); LASSERT(tx->tx_iov[0].iov_base == &tx->tx_msg);
LASSERT(tx->tx_conn != NULL); LASSERT(tx->tx_conn != NULL);
...@@ -426,8 +426,8 @@ int ...@@ -426,8 +426,8 @@ int
ksocknal_lib_get_conn_tunables(ksock_conn_t *conn, int *txmem, int *rxmem, int *nagle) ksocknal_lib_get_conn_tunables(ksock_conn_t *conn, int *txmem, int *rxmem, int *nagle)
{ {
struct socket *sock = conn->ksnc_sock; struct socket *sock = conn->ksnc_sock;
int len; int len;
int rc; int rc;
rc = ksocknal_connsock_addref(conn); rc = ksocknal_connsock_addref(conn);
if (rc != 0) { if (rc != 0) {
...@@ -456,13 +456,13 @@ ksocknal_lib_get_conn_tunables(ksock_conn_t *conn, int *txmem, int *rxmem, int * ...@@ -456,13 +456,13 @@ ksocknal_lib_get_conn_tunables(ksock_conn_t *conn, int *txmem, int *rxmem, int *
int int
ksocknal_lib_setup_sock(struct socket *sock) ksocknal_lib_setup_sock(struct socket *sock)
{ {
int rc; int rc;
int option; int option;
int keep_idle; int keep_idle;
int keep_intvl; int keep_intvl;
int keep_count; int keep_count;
int do_keepalive; int do_keepalive;
struct linger linger; struct linger linger;
sock->sk->sk_allocation = GFP_NOFS; sock->sk->sk_allocation = GFP_NOFS;
...@@ -555,11 +555,11 @@ ksocknal_lib_setup_sock(struct socket *sock) ...@@ -555,11 +555,11 @@ ksocknal_lib_setup_sock(struct socket *sock)
void void
ksocknal_lib_push_conn(ksock_conn_t *conn) ksocknal_lib_push_conn(ksock_conn_t *conn)
{ {
struct sock *sk; struct sock *sk;
struct tcp_sock *tp; struct tcp_sock *tp;
int nonagle; int nonagle;
int val = 1; int val = 1;
int rc; int rc;
rc = ksocknal_connsock_addref(conn); rc = ksocknal_connsock_addref(conn);
if (rc != 0) /* being shut down */ if (rc != 0) /* being shut down */
...@@ -592,7 +592,7 @@ extern void ksocknal_write_callback(ksock_conn_t *conn); ...@@ -592,7 +592,7 @@ extern void ksocknal_write_callback(ksock_conn_t *conn);
static void static void
ksocknal_data_ready(struct sock *sk) ksocknal_data_ready(struct sock *sk)
{ {
ksock_conn_t *conn; ksock_conn_t *conn;
/* interleave correctly with closing sockets... */ /* interleave correctly with closing sockets... */
LASSERT(!in_irq()); LASSERT(!in_irq());
...@@ -611,9 +611,9 @@ ksocknal_data_ready(struct sock *sk) ...@@ -611,9 +611,9 @@ ksocknal_data_ready(struct sock *sk)
static void static void
ksocknal_write_space(struct sock *sk) ksocknal_write_space(struct sock *sk)
{ {
ksock_conn_t *conn; ksock_conn_t *conn;
int wspace; int wspace;
int min_wpace; int min_wpace;
/* interleave correctly with closing sockets... */ /* interleave correctly with closing sockets... */
LASSERT(!in_irq()); LASSERT(!in_irq());
...@@ -689,7 +689,7 @@ ksocknal_lib_reset_callback(struct socket *sock, ksock_conn_t *conn) ...@@ -689,7 +689,7 @@ ksocknal_lib_reset_callback(struct socket *sock, ksock_conn_t *conn)
int int
ksocknal_lib_memory_pressure(ksock_conn_t *conn) ksocknal_lib_memory_pressure(ksock_conn_t *conn)
{ {
int rc = 0; int rc = 0;
ksock_sched_t *sched; ksock_sched_t *sched;
sched = conn->ksnc_scheduler; sched = conn->ksnc_scheduler;
......
...@@ -145,40 +145,37 @@ ksock_tunables_t ksocknal_tunables; ...@@ -145,40 +145,37 @@ ksock_tunables_t ksocknal_tunables;
int ksocknal_tunables_init(void) int ksocknal_tunables_init(void)
{ {
/* initialize ksocknal_tunables structure */ /* initialize ksocknal_tunables structure */
ksocknal_tunables.ksnd_timeout = &sock_timeout; ksocknal_tunables.ksnd_timeout = &sock_timeout;
ksocknal_tunables.ksnd_nscheds = &nscheds; ksocknal_tunables.ksnd_nscheds = &nscheds;
ksocknal_tunables.ksnd_nconnds = &nconnds; ksocknal_tunables.ksnd_nconnds = &nconnds;
ksocknal_tunables.ksnd_nconnds_max = &nconnds_max; ksocknal_tunables.ksnd_nconnds_max = &nconnds_max;
ksocknal_tunables.ksnd_min_reconnectms = &min_reconnectms; ksocknal_tunables.ksnd_min_reconnectms = &min_reconnectms;
ksocknal_tunables.ksnd_max_reconnectms = &max_reconnectms; ksocknal_tunables.ksnd_max_reconnectms = &max_reconnectms;
ksocknal_tunables.ksnd_eager_ack = &eager_ack; ksocknal_tunables.ksnd_eager_ack = &eager_ack;
ksocknal_tunables.ksnd_typed_conns = &typed_conns; ksocknal_tunables.ksnd_typed_conns = &typed_conns;
ksocknal_tunables.ksnd_min_bulk = &min_bulk; ksocknal_tunables.ksnd_min_bulk = &min_bulk;
ksocknal_tunables.ksnd_tx_buffer_size = &tx_buffer_size; ksocknal_tunables.ksnd_tx_buffer_size = &tx_buffer_size;
ksocknal_tunables.ksnd_rx_buffer_size = &rx_buffer_size; ksocknal_tunables.ksnd_rx_buffer_size = &rx_buffer_size;
ksocknal_tunables.ksnd_nagle = &nagle; ksocknal_tunables.ksnd_nagle = &nagle;
ksocknal_tunables.ksnd_round_robin = &round_robin; ksocknal_tunables.ksnd_round_robin = &round_robin;
ksocknal_tunables.ksnd_keepalive = &keepalive; ksocknal_tunables.ksnd_keepalive = &keepalive;
ksocknal_tunables.ksnd_keepalive_idle = &keepalive_idle; ksocknal_tunables.ksnd_keepalive_idle = &keepalive_idle;
ksocknal_tunables.ksnd_keepalive_count = &keepalive_count; ksocknal_tunables.ksnd_keepalive_count = &keepalive_count;
ksocknal_tunables.ksnd_keepalive_intvl = &keepalive_intvl; ksocknal_tunables.ksnd_keepalive_intvl = &keepalive_intvl;
ksocknal_tunables.ksnd_credits = &credits; ksocknal_tunables.ksnd_credits = &credits;
ksocknal_tunables.ksnd_peertxcredits = &peer_credits; ksocknal_tunables.ksnd_peertxcredits = &peer_credits;
ksocknal_tunables.ksnd_peerrtrcredits = &peer_buffer_credits; ksocknal_tunables.ksnd_peerrtrcredits = &peer_buffer_credits;
ksocknal_tunables.ksnd_peertimeout = &peer_timeout; ksocknal_tunables.ksnd_peertimeout = &peer_timeout;
ksocknal_tunables.ksnd_enable_csum = &enable_csum; ksocknal_tunables.ksnd_enable_csum = &enable_csum;
ksocknal_tunables.ksnd_inject_csum_error = &inject_csum_error; ksocknal_tunables.ksnd_inject_csum_error = &inject_csum_error;
ksocknal_tunables.ksnd_nonblk_zcack = &nonblk_zcack; ksocknal_tunables.ksnd_nonblk_zcack = &nonblk_zcack;
ksocknal_tunables.ksnd_zc_min_payload = &zc_min_payload; ksocknal_tunables.ksnd_zc_min_payload = &zc_min_payload;
ksocknal_tunables.ksnd_zc_recv = &zc_recv; ksocknal_tunables.ksnd_zc_recv = &zc_recv;
ksocknal_tunables.ksnd_zc_recv_min_nfrags = &zc_recv_min_nfrags; ksocknal_tunables.ksnd_zc_recv_min_nfrags = &zc_recv_min_nfrags;
#if SOCKNAL_VERSION_DEBUG #if SOCKNAL_VERSION_DEBUG
ksocknal_tunables.ksnd_protocol = &protocol; ksocknal_tunables.ksnd_protocol = &protocol;
#endif #endif
if (*ksocknal_tunables.ksnd_zc_min_payload < (2 << 10)) if (*ksocknal_tunables.ksnd_zc_min_payload < (2 << 10))
......
...@@ -52,7 +52,7 @@ ksocknal_queue_tx_msg_v1(ksock_conn_t *conn, ksock_tx_t *tx_msg) ...@@ -52,7 +52,7 @@ ksocknal_queue_tx_msg_v1(ksock_conn_t *conn, ksock_tx_t *tx_msg)
void void
ksocknal_next_tx_carrier(ksock_conn_t *conn) ksocknal_next_tx_carrier(ksock_conn_t *conn)
{ {
ksock_tx_t *tx = conn->ksnc_tx_carrier; ksock_tx_t *tx = conn->ksnc_tx_carrier;
/* Called holding BH lock: conn->ksnc_scheduler->kss_lock */ /* Called holding BH lock: conn->ksnc_scheduler->kss_lock */
LASSERT(!list_empty(&conn->ksnc_tx_queue)); LASSERT(!list_empty(&conn->ksnc_tx_queue));
...@@ -119,7 +119,7 @@ ksocknal_queue_tx_zcack_v2(ksock_conn_t *conn, ...@@ -119,7 +119,7 @@ ksocknal_queue_tx_zcack_v2(ksock_conn_t *conn,
static ksock_tx_t * static ksock_tx_t *
ksocknal_queue_tx_msg_v2(ksock_conn_t *conn, ksock_tx_t *tx_msg) ksocknal_queue_tx_msg_v2(ksock_conn_t *conn, ksock_tx_t *tx_msg)
{ {
ksock_tx_t *tx = conn->ksnc_tx_carrier; ksock_tx_t *tx = conn->ksnc_tx_carrier;
/* /*
* Enqueue tx_msg: * Enqueue tx_msg:
...@@ -361,10 +361,10 @@ ksocknal_match_tx_v3(ksock_conn_t *conn, ksock_tx_t *tx, int nonblk) ...@@ -361,10 +361,10 @@ ksocknal_match_tx_v3(ksock_conn_t *conn, ksock_tx_t *tx, int nonblk)
static int static int
ksocknal_handle_zcreq(ksock_conn_t *c, __u64 cookie, int remote) ksocknal_handle_zcreq(ksock_conn_t *c, __u64 cookie, int remote)
{ {
ksock_peer_t *peer = c->ksnc_peer; ksock_peer_t *peer = c->ksnc_peer;
ksock_conn_t *conn; ksock_conn_t *conn;
ksock_tx_t *tx; ksock_tx_t *tx;
int rc; int rc;
read_lock(&ksocknal_data.ksnd_global_lock); read_lock(&ksocknal_data.ksnd_global_lock);
...@@ -405,11 +405,11 @@ ksocknal_handle_zcreq(ksock_conn_t *c, __u64 cookie, int remote) ...@@ -405,11 +405,11 @@ ksocknal_handle_zcreq(ksock_conn_t *c, __u64 cookie, int remote)
static int static int
ksocknal_handle_zcack(ksock_conn_t *conn, __u64 cookie1, __u64 cookie2) ksocknal_handle_zcack(ksock_conn_t *conn, __u64 cookie1, __u64 cookie2)
{ {
ksock_peer_t *peer = conn->ksnc_peer; ksock_peer_t *peer = conn->ksnc_peer;
ksock_tx_t *tx; ksock_tx_t *tx;
ksock_tx_t *tmp; ksock_tx_t *tmp;
LIST_HEAD(zlist); LIST_HEAD(zlist);
int count; int count;
if (cookie1 == 0) if (cookie1 == 0)
cookie1 = cookie2; cookie1 = cookie2;
...@@ -452,11 +452,11 @@ ksocknal_handle_zcack(ksock_conn_t *conn, __u64 cookie1, __u64 cookie2) ...@@ -452,11 +452,11 @@ ksocknal_handle_zcack(ksock_conn_t *conn, __u64 cookie1, __u64 cookie2)
static int static int
ksocknal_send_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello) ksocknal_send_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello)
{ {
struct socket *sock = conn->ksnc_sock; struct socket *sock = conn->ksnc_sock;
lnet_hdr_t *hdr; lnet_hdr_t *hdr;
lnet_magicversion_t *hmv; lnet_magicversion_t *hmv;
int rc; int rc;
int i; int i;
CLASSERT(sizeof(lnet_magicversion_t) == offsetof(lnet_hdr_t, src_nid)); CLASSERT(sizeof(lnet_magicversion_t) == offsetof(lnet_hdr_t, src_nid));
...@@ -470,7 +470,7 @@ ksocknal_send_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello) ...@@ -470,7 +470,7 @@ ksocknal_send_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello)
/* Re-organize V2.x message header to V1.x (lnet_hdr_t) /* Re-organize V2.x message header to V1.x (lnet_hdr_t)
* header and send out */ * header and send out */
hmv->magic = cpu_to_le32 (LNET_PROTO_TCP_MAGIC); hmv->magic = cpu_to_le32 (LNET_PROTO_TCP_MAGIC);
hmv->version_major = cpu_to_le16 (KSOCK_PROTO_V1_MAJOR); hmv->version_major = cpu_to_le16 (KSOCK_PROTO_V1_MAJOR);
hmv->version_minor = cpu_to_le16 (KSOCK_PROTO_V1_MINOR); hmv->version_minor = cpu_to_le16 (KSOCK_PROTO_V1_MINOR);
...@@ -488,9 +488,9 @@ ksocknal_send_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello) ...@@ -488,9 +488,9 @@ ksocknal_send_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello)
LNET_UNLOCK(); LNET_UNLOCK();
} }
hdr->src_nid = cpu_to_le64 (hello->kshm_src_nid); hdr->src_nid = cpu_to_le64 (hello->kshm_src_nid);
hdr->src_pid = cpu_to_le32 (hello->kshm_src_pid); hdr->src_pid = cpu_to_le32 (hello->kshm_src_pid);
hdr->type = cpu_to_le32 (LNET_MSG_HELLO); hdr->type = cpu_to_le32 (LNET_MSG_HELLO);
hdr->payload_length = cpu_to_le32 (hello->kshm_nips * sizeof(__u32)); hdr->payload_length = cpu_to_le32 (hello->kshm_nips * sizeof(__u32));
hdr->msg.hello.type = cpu_to_le32 (hello->kshm_ctype); hdr->msg.hello.type = cpu_to_le32 (hello->kshm_ctype);
hdr->msg.hello.incarnation = cpu_to_le64 (hello->kshm_src_incarnation); hdr->msg.hello.incarnation = cpu_to_le64 (hello->kshm_src_incarnation);
...@@ -529,7 +529,7 @@ static int ...@@ -529,7 +529,7 @@ static int
ksocknal_send_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello) ksocknal_send_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello)
{ {
struct socket *sock = conn->ksnc_sock; struct socket *sock = conn->ksnc_sock;
int rc; int rc;
hello->kshm_magic = LNET_PROTO_MAGIC; hello->kshm_magic = LNET_PROTO_MAGIC;
hello->kshm_version = conn->ksnc_proto->pro_version; hello->kshm_version = conn->ksnc_proto->pro_version;
...@@ -572,10 +572,10 @@ static int ...@@ -572,10 +572,10 @@ static int
ksocknal_recv_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello, ksocknal_recv_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello,
int timeout) int timeout)
{ {
struct socket *sock = conn->ksnc_sock; struct socket *sock = conn->ksnc_sock;
lnet_hdr_t *hdr; lnet_hdr_t *hdr;
int rc; int rc;
int i; int i;
LIBCFS_ALLOC(hdr, sizeof(*hdr)); LIBCFS_ALLOC(hdr, sizeof(*hdr));
if (hdr == NULL) { if (hdr == NULL) {
...@@ -602,12 +602,12 @@ ksocknal_recv_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello, ...@@ -602,12 +602,12 @@ ksocknal_recv_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello,
goto out; goto out;
} }
hello->kshm_src_nid = le64_to_cpu(hdr->src_nid); hello->kshm_src_nid = le64_to_cpu(hdr->src_nid);
hello->kshm_src_pid = le32_to_cpu(hdr->src_pid); hello->kshm_src_pid = le32_to_cpu(hdr->src_pid);
hello->kshm_src_incarnation = le64_to_cpu(hdr->msg.hello.incarnation); hello->kshm_src_incarnation = le64_to_cpu(hdr->msg.hello.incarnation);
hello->kshm_ctype = le32_to_cpu(hdr->msg.hello.type); hello->kshm_ctype = le32_to_cpu(hdr->msg.hello.type);
hello->kshm_nips = le32_to_cpu(hdr->payload_length) / hello->kshm_nips = le32_to_cpu(hdr->payload_length) /
sizeof(__u32); sizeof(__u32);
if (hello->kshm_nips > LNET_MAX_INTERFACES) { if (hello->kshm_nips > LNET_MAX_INTERFACES) {
CERROR("Bad nips %d from ip %pI4h\n", CERROR("Bad nips %d from ip %pI4h\n",
...@@ -647,9 +647,9 @@ ksocknal_recv_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello, ...@@ -647,9 +647,9 @@ ksocknal_recv_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello,
static int static int
ksocknal_recv_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello, int timeout) ksocknal_recv_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello, int timeout)
{ {
struct socket *sock = conn->ksnc_sock; struct socket *sock = conn->ksnc_sock;
int rc; int rc;
int i; int i;
if (hello->kshm_magic == LNET_PROTO_MAGIC) if (hello->kshm_magic == LNET_PROTO_MAGIC)
conn->ksnc_flip = 0; conn->ksnc_flip = 0;
...@@ -746,9 +746,9 @@ ksocknal_pack_msg_v2(ksock_tx_t *tx) ...@@ -746,9 +746,9 @@ ksocknal_pack_msg_v2(ksock_tx_t *tx)
static void static void
ksocknal_unpack_msg_v1(ksock_msg_t *msg) ksocknal_unpack_msg_v1(ksock_msg_t *msg)
{ {
msg->ksm_csum = 0; msg->ksm_csum = 0;
msg->ksm_type = KSOCK_MSG_LNET; msg->ksm_type = KSOCK_MSG_LNET;
msg->ksm_zc_cookies[0] = msg->ksm_zc_cookies[1] = 0; msg->ksm_zc_cookies[0] = msg->ksm_zc_cookies[1] = 0;
} }
static void static void
...@@ -758,40 +758,40 @@ ksocknal_unpack_msg_v2(ksock_msg_t *msg) ...@@ -758,40 +758,40 @@ ksocknal_unpack_msg_v2(ksock_msg_t *msg)
} }
ksock_proto_t ksocknal_protocol_v1x = { ksock_proto_t ksocknal_protocol_v1x = {
.pro_version = KSOCK_PROTO_V1, .pro_version = KSOCK_PROTO_V1,
.pro_send_hello = ksocknal_send_hello_v1, .pro_send_hello = ksocknal_send_hello_v1,
.pro_recv_hello = ksocknal_recv_hello_v1, .pro_recv_hello = ksocknal_recv_hello_v1,
.pro_pack = ksocknal_pack_msg_v1, .pro_pack = ksocknal_pack_msg_v1,
.pro_unpack = ksocknal_unpack_msg_v1, .pro_unpack = ksocknal_unpack_msg_v1,
.pro_queue_tx_msg = ksocknal_queue_tx_msg_v1, .pro_queue_tx_msg = ksocknal_queue_tx_msg_v1,
.pro_handle_zcreq = NULL, .pro_handle_zcreq = NULL,
.pro_handle_zcack = NULL, .pro_handle_zcack = NULL,
.pro_queue_tx_zcack = NULL, .pro_queue_tx_zcack = NULL,
.pro_match_tx = ksocknal_match_tx .pro_match_tx = ksocknal_match_tx
}; };
ksock_proto_t ksocknal_protocol_v2x = { ksock_proto_t ksocknal_protocol_v2x = {
.pro_version = KSOCK_PROTO_V2, .pro_version = KSOCK_PROTO_V2,
.pro_send_hello = ksocknal_send_hello_v2, .pro_send_hello = ksocknal_send_hello_v2,
.pro_recv_hello = ksocknal_recv_hello_v2, .pro_recv_hello = ksocknal_recv_hello_v2,
.pro_pack = ksocknal_pack_msg_v2, .pro_pack = ksocknal_pack_msg_v2,
.pro_unpack = ksocknal_unpack_msg_v2, .pro_unpack = ksocknal_unpack_msg_v2,
.pro_queue_tx_msg = ksocknal_queue_tx_msg_v2, .pro_queue_tx_msg = ksocknal_queue_tx_msg_v2,
.pro_queue_tx_zcack = ksocknal_queue_tx_zcack_v2, .pro_queue_tx_zcack = ksocknal_queue_tx_zcack_v2,
.pro_handle_zcreq = ksocknal_handle_zcreq, .pro_handle_zcreq = ksocknal_handle_zcreq,
.pro_handle_zcack = ksocknal_handle_zcack, .pro_handle_zcack = ksocknal_handle_zcack,
.pro_match_tx = ksocknal_match_tx .pro_match_tx = ksocknal_match_tx
}; };
ksock_proto_t ksocknal_protocol_v3x = { ksock_proto_t ksocknal_protocol_v3x = {
.pro_version = KSOCK_PROTO_V3, .pro_version = KSOCK_PROTO_V3,
.pro_send_hello = ksocknal_send_hello_v2, .pro_send_hello = ksocknal_send_hello_v2,
.pro_recv_hello = ksocknal_recv_hello_v2, .pro_recv_hello = ksocknal_recv_hello_v2,
.pro_pack = ksocknal_pack_msg_v2, .pro_pack = ksocknal_pack_msg_v2,
.pro_unpack = ksocknal_unpack_msg_v2, .pro_unpack = ksocknal_unpack_msg_v2,
.pro_queue_tx_msg = ksocknal_queue_tx_msg_v2, .pro_queue_tx_msg = ksocknal_queue_tx_msg_v2,
.pro_queue_tx_zcack = ksocknal_queue_tx_zcack_v3, .pro_queue_tx_zcack = ksocknal_queue_tx_zcack_v3,
.pro_handle_zcreq = ksocknal_handle_zcreq, .pro_handle_zcreq = ksocknal_handle_zcreq,
.pro_handle_zcack = ksocknal_handle_zcack, .pro_handle_zcack = ksocknal_handle_zcack,
.pro_match_tx = ksocknal_match_tx_v3 .pro_match_tx = ksocknal_match_tx_v3
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment