svn commit: r214499 -
projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp
Jeff Roberson
jeff at FreeBSD.org
Fri Oct 29 02:12:37 UTC 2010
Author: jeff
Date: Fri Oct 29 02:12:36 2010
New Revision: 214499
URL: http://svn.freebsd.org/changeset/base/214499
Log:
- sed fixup of tcp states. SDP does not actually use TCP but re-uses
parts of the state machine.
Sponsored by: Isilon Systems, iX Systems, and Panasas.
Modified:
projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp.h
projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_bcopy.c
projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_cma.c
projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_dbg.h
projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c
projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c
projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c
Modified: projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp.h
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp.h Fri Oct 29 01:33:44 2010 (r214498)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp.h Fri Oct 29 02:12:36 2010 (r214499)
@@ -492,9 +492,9 @@ static inline void sdp_set_error(struct
sk->sk_socket->state = SS_DISCONNECTING;
if ((1 << sk->sk_state) & ib_teardown_states)
- sdp_exch_state(sk, ib_teardown_states, TCP_TIME_WAIT);
+ sdp_exch_state(sk, ib_teardown_states, TCPS_TIME_WAIT);
else
- sdp_exch_state(sk, ~0, TCP_CLOSE);
+ sdp_exch_state(sk, ~0, TCPS_CLOSED);
sk->sk_error_report(sk);
}
Modified: projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_bcopy.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_bcopy.c Fri Oct 29 01:33:44 2010 (r214498)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_bcopy.c Fri Oct 29 02:12:36 2010 (r214499)
@@ -158,7 +158,7 @@ void sdp_nagle_timeout(unsigned long dat
goto out;
}
- if (sk->sk_state == TCP_CLOSE) {
+ if (sk->sk_state == TCPS_CLOSED) {
bh_unlock_sock(sk);
return;
}
Modified: projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_cma.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_cma.c Fri Oct 29 01:33:44 2010 (r214498)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_cma.c Fri Oct 29 02:12:36 2010 (r214499)
@@ -203,7 +203,7 @@ static int sdp_connect_handler(struct so
&sdp_sk(sk)->backlog_queue);
sdp_sk(child)->parent = sk;
- sdp_exch_state(child, TCPF_LISTEN | TCPF_CLOSE, TCP_SYN_RECV);
+ sdp_exch_state(child, TCPF_LISTEN | TCPF_CLOSE, TCPS_SYN_RECEIVED);
/* child->sk_write_space(child); */
/* child->sk_data_ready(child, 0); */
@@ -219,7 +219,7 @@ static int sdp_response_handler(struct s
struct socketaddr_in *dst_addr;
sdp_dbg(sk, "%s\n", __func__);
- sdp_exch_state(sk, TCPF_SYN_SENT, TCP_ESTABLISHED);
+ sdp_exch_state(sk, TCPF_SYN_SENT, TCPS_ESTABLISHED);
sdp_set_default_moderation(sdp_sk(sk));
if (sock_flag(sk, SOCK_KEEPOPEN))
@@ -259,7 +259,7 @@ static int sdp_connected_handler(struct
parent = sdp_sk(sk)->parent;
BUG_ON(!parent);
- sdp_exch_state(sk, TCPF_SYN_RECV, TCP_ESTABLISHED);
+ sdp_exch_state(sk, TCPF_SYN_RECV, TCPS_ESTABLISHED);
sdp_set_default_moderation(sdp_sk(sk));
@@ -298,7 +298,7 @@ static int sdp_disconnected_handler(stru
if (ssk->tx_ring.cq)
sdp_xmit_poll(ssk, 1);
- if (sk->sk_state == TCP_SYN_RECV) {
+ if (sk->sk_state == TCPS_SYN_RECEIVED) {
sdp_connected_handler(sk, NULL);
if (rcv_nxt(ssk))
@@ -457,10 +457,10 @@ int sdp_cma_handler(struct rdma_cm_id *i
case RDMA_CM_EVENT_DISCONNECTED: /* This means DREQ/DREP received */
sdp_dbg(sk, "RDMA_CM_EVENT_DISCONNECTED\n");
- if (sk->sk_state == TCP_LAST_ACK) {
+ if (sk->sk_state == TCPS_LAST_ACK) {
sdp_cancel_dreq_wait_timeout(sdp_sk(sk));
- sdp_exch_state(sk, TCPF_LAST_ACK, TCP_TIME_WAIT);
+ sdp_exch_state(sk, TCPF_LAST_ACK, TCPS_TIME_WAIT);
sdp_dbg(sk, "%s: waiting for Infiniband tear down\n",
__func__);
@@ -469,10 +469,10 @@ int sdp_cma_handler(struct rdma_cm_id *i
sdp_sk(sk)->qp_active = 0;
rdma_disconnect(id);
- if (sk->sk_state != TCP_TIME_WAIT) {
- if (sk->sk_state == TCP_CLOSE_WAIT) {
+ if (sk->sk_state != TCPS_TIME_WAIT) {
+ if (sk->sk_state == TCPS_CLOSED_WAIT) {
sdp_dbg(sk, "IB teardown while in "
- "TCP_CLOSE_WAIT taking reference to "
+ "TCPS_CLOSED_WAIT taking reference to "
"let close() finish the work\n");
sock_hold(sk, SOCK_REF_CMA);
}
Modified: projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_dbg.h
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_dbg.h Fri Oct 29 01:33:44 2010 (r214498)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_dbg.h Fri Oct 29 02:12:36 2010 (r214499)
@@ -160,17 +160,17 @@ extern int sdp_data_debug_level;
static inline char *sdp_state_str(int state)
{
static char *state2str[] = {
- ENUM2STR(TCP_ESTABLISHED),
- ENUM2STR(TCP_SYN_SENT),
- ENUM2STR(TCP_SYN_RECV),
- ENUM2STR(TCP_FIN_WAIT1),
+ ENUM2STR(TCPS_ESTABLISHED),
+ ENUM2STR(TCPS_SYN_SENT),
+ ENUM2STR(TCPS_SYN_RECEIVED),
+ ENUM2STR(TCPS_FIN_WAIT_1),
ENUM2STR(TCP_FIN_WAIT2),
- ENUM2STR(TCP_TIME_WAIT),
- ENUM2STR(TCP_CLOSE),
- ENUM2STR(TCP_CLOSE_WAIT),
- ENUM2STR(TCP_LAST_ACK),
- ENUM2STR(TCP_LISTEN),
- ENUM2STR(TCP_CLOSING),
+ ENUM2STR(TCPS_TIME_WAIT),
+ ENUM2STR(TCPS_CLOSED),
+ ENUM2STR(TCPS_CLOSED_WAIT),
+ ENUM2STR(TCPS_LAST_ACK),
+ ENUM2STR(TCPS_LISTEN),
+ ENUM2STR(TCPS_CLOSING),
};
if (state < 0 || state >= ARRAY_SIZE(state2str))
Modified: projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Fri Oct 29 01:33:44 2010 (r214498)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Fri Oct 29 02:12:36 2010 (r214499)
@@ -237,8 +237,8 @@ static void sdp_keepalive_timer(unsigned
goto out;
}
- if (!sock_flag(sk, SOCK_KEEPOPEN) || sk->sk_state == TCP_LISTEN ||
- sk->sk_state == TCP_CLOSE)
+ if (!sock_flag(sk, SOCK_KEEPOPEN) || sk->sk_state == TCPS_LISTEN ||
+ sk->sk_state == TCPS_CLOSED)
goto out;
if (ssk->keepalive_tx_head == ring_head(ssk->tx_ring) &&
@@ -457,7 +457,7 @@ void sdp_reset(struct socket *sk)
sdp_dbg(sk, "%s state=%d\n", __func__, sk->sk_state);
- if (sk->sk_state != TCP_ESTABLISHED)
+ if (sk->sk_state != TCPS_ESTABLISHED)
return;
/* We want the right error as BSD sees it (and indeed as we do). */
@@ -560,16 +560,16 @@ static void sdp_send_disconnect(struct s
/*
* State processing on a close.
- * TCP_ESTABLISHED -> TCP_FIN_WAIT1 -> TCP_CLOSE
+ * TCPS_ESTABLISHED -> TCPS_FIN_WAIT_1 -> TCPS_CLOSED
*/
static int sdp_close_state(struct socket *sk)
{
switch (sk->sk_state) {
- case TCP_ESTABLISHED:
- sdp_exch_state(sk, TCPF_ESTABLISHED, TCP_FIN_WAIT1);
+ case TCPS_ESTABLISHED:
+ sdp_exch_state(sk, TCPF_ESTABLISHED, TCPS_FIN_WAIT_1);
break;
- case TCP_CLOSE_WAIT:
- sdp_exch_state(sk, TCPF_CLOSE_WAIT, TCP_LAST_ACK);
+ case TCPS_CLOSED_WAIT:
+ sdp_exch_state(sk, TCPF_CLOSE_WAIT, TCPS_LAST_ACK);
break;
default:
return 0;
@@ -616,8 +616,8 @@ static void sdp_close(struct socket *sk,
goto out;
}
- if (sk->sk_state == TCP_LISTEN || sk->sk_state == TCP_SYN_SENT) {
- sdp_exch_state(sk, TCPF_LISTEN | TCPF_SYN_SENT, TCP_CLOSE);
+ if (sk->sk_state == TCPS_LISTEN || sk->sk_state == TCPS_SYN_SENT) {
+ sdp_exch_state(sk, TCPF_LISTEN | TCPF_SYN_SENT, TCPS_CLOSED);
disable_cma_handler(sk);
/* Special case: stop listening.
@@ -658,7 +658,7 @@ static void sdp_close(struct socket *sk,
/* Unread data was tossed, zap the connection. */
NET_INC_STATS_USER(sock_net(sk), LINUX_MIB_TCPABORTONCLOSE);
sdp_exch_state(sk, TCPF_CLOSE_WAIT | TCPF_ESTABLISHED,
- TCP_TIME_WAIT);
+ TCPS_TIME_WAIT);
/* Go into abortive close */
sk->sk_prot->disconnect(sk, 0);
@@ -674,7 +674,7 @@ static void sdp_close(struct socket *sk,
Since it currently doesn't, do it here to avoid blocking below. */
if (!sdp_sk(sk)->id)
sdp_exch_state(sk, TCPF_FIN_WAIT1 | TCPF_LAST_ACK |
- TCPF_CLOSE_WAIT, TCP_CLOSE);
+ TCPF_CLOSE_WAIT, TCPS_CLOSED);
sk_stream_wait_close(sk, timeout);
@@ -701,7 +701,7 @@ adjudge_to_death:
* consume significant resources. Let's do it with special
* linger2 option. --ANK
*/
- if (sk->sk_state == TCP_FIN_WAIT1) {
+ if (sk->sk_state == TCPS_FIN_WAIT_1) {
/* TODO: liger2 unimplemented.
We should wait 3.5 * rto. How do I know rto? */
/* TODO: tcp_fin_time to get timeout */
@@ -761,7 +761,7 @@ static int sdp_connect(struct socket *sk
return rc;
}
- sdp_exch_state(sk, TCPF_CLOSE, TCP_SYN_SENT);
+ sdp_exch_state(sk, TCPF_CLOSE, TCPS_SYN_SENT);
return 0;
}
@@ -774,7 +774,7 @@ static int sdp_disconnect(struct socket
sdp_dbg(sk, "%s\n", __func__);
- if (sk->sk_state != TCP_LISTEN) {
+ if (sk->sk_state != TCPS_LISTEN) {
if (ssk->id) {
sdp_sk(sk)->qp_active = 0;
rc = rdma_disconnect(ssk->id);
@@ -783,7 +783,7 @@ static int sdp_disconnect(struct socket
return rc;
}
- sdp_exch_state(sk, TCPF_LISTEN, TCP_CLOSE);
+ sdp_exch_state(sk, TCPF_LISTEN, TCPS_CLOSED);
id = ssk->id;
ssk->id = NULL;
release_sock(sk); /* release socket since locking semantics is parent
@@ -837,7 +837,7 @@ static int sdp_wait_for_connect(struct s
if (!list_empty(&ssk->accept_queue))
break;
err = -EINVAL;
- if (sk->sk_state != TCP_LISTEN)
+ if (sk->sk_state != TCPS_LISTEN)
break;
err = sock_intr_errno(timeo);
if (signal_pending(current))
@@ -860,7 +860,7 @@ static struct socket *sdp_accept(struct
int error;
sdp_dbg(sk, "%s state %d expected %d *err %d\n", __func__,
- sk->sk_state, TCP_LISTEN, *err);
+ sk->sk_state, TCPS_LISTEN, *err);
ssk = sdp_sk(sk);
lock_sock(sk);
@@ -869,7 +869,7 @@ static struct socket *sdp_accept(struct
* and that it has something pending.
*/
error = -EINVAL;
- if (sk->sk_state != TCP_LISTEN)
+ if (sk->sk_state != TCPS_LISTEN)
goto out_err;
/* Find already established connection */
@@ -922,7 +922,7 @@ static int sdp_ioctl(struct socket *sk,
switch (cmd) {
case SIOCINQ:
- if (sk->sk_state == TCP_LISTEN)
+ if (sk->sk_state == TCPS_LISTEN)
return -EINVAL;
lock_sock(sk);
@@ -947,7 +947,7 @@ static int sdp_ioctl(struct socket *sk,
answ = ssk->urg_data && ssk->urg_seq == ssk->copied_seq;
break;
case SIOCOUTQ:
- if (sk->sk_state == TCP_LISTEN)
+ if (sk->sk_state == TCPS_LISTEN)
return -EINVAL;
if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV))
@@ -1000,13 +1000,13 @@ static void sdp_destroy_work(struct work
cancel_delayed_work(&ssk->srcavail_cancel_work);
- if (sk->sk_state == TCP_TIME_WAIT)
+ if (sk->sk_state == TCPS_TIME_WAIT)
sock_put(sk, SOCK_REF_CMA);
- /* In normal close current state is TCP_TIME_WAIT or TCP_CLOSE
+ /* In normal close current state is TCPS_TIME_WAIT or TCPS_CLOSED
but if a CM connection is dropped below our legs state could
be any state */
- sdp_exch_state(sk, ~0, TCP_CLOSE);
+ sdp_exch_state(sk, ~0, TCPS_CLOSED);
sock_put(sk, SOCK_REF_RESET);
}
@@ -1032,10 +1032,10 @@ static void sdp_dreq_wait_timeout_work(s
sdp_sk(sk)->dreq_wait_timeout = 0;
- if (sk->sk_state == TCP_FIN_WAIT1)
+ if (sk->sk_state == TCPS_FIN_WAIT_1)
percpu_counter_dec(ssk->isk.sk.sk_prot->orphan_count);
- sdp_exch_state(sk, TCPF_LAST_ACK | TCPF_FIN_WAIT1, TCP_TIME_WAIT);
+ sdp_exch_state(sk, TCPF_LAST_ACK | TCPF_FIN_WAIT1, TCPS_TIME_WAIT);
release_sock(sk);
@@ -1339,7 +1339,7 @@ static int sdp_recv_urg(struct socket *s
ssk->urg_data == TCP_URG_READ)
return -EINVAL; /* Yes this is right ! */
- if (sk->sk_state == TCP_CLOSE && !sock_flag(sk, SOCK_DONE))
+ if (sk->sk_state == TCPS_CLOSED && !sock_flag(sk, SOCK_DONE))
return -ENOTCONN;
if (ssk->urg_data & TCP_URG_VALID) {
@@ -1362,7 +1362,7 @@ static int sdp_recv_urg(struct socket *s
return err ? -EFAULT : len;
}
- if (sk->sk_state == TCP_CLOSE || (sk->sk_shutdown & RCV_SHUTDOWN))
+ if (sk->sk_state == TCPS_CLOSED || (sk->sk_shutdown & RCV_SHUTDOWN))
return 0;
/* Fixed the recv(..., MSG_OOB) behaviour. BSD docs and
@@ -2095,7 +2095,7 @@ static int sdp_recvmsg(struct kiocb *ioc
sdp_prf(sk, mb, "Read from user");
err = -ENOTCONN;
- if (sk->sk_state == TCP_LISTEN)
+ if (sk->sk_state == TCPS_LISTEN)
goto out;
timeo = sock_rcvtimeo(sk, noblock);
@@ -2222,7 +2222,7 @@ sdp_mid_data:
if (copied) {
if (sk->sk_err ||
- sk->sk_state == TCP_CLOSE ||
+ sk->sk_state == TCPS_CLOSED ||
(sk->sk_shutdown & RCV_SHUTDOWN) ||
!timeo ||
signal_pending(current) ||
@@ -2240,7 +2240,7 @@ sdp_mid_data:
if (sk->sk_shutdown & RCV_SHUTDOWN)
break;
- if (sk->sk_state == TCP_CLOSE) {
+ if (sk->sk_state == TCPS_CLOSED) {
if (!sock_flag(sk, SOCK_DONE)) {
/* This occurs when user tries to read
* from never connected socket.
@@ -2434,7 +2434,7 @@ static int sdp_listen(struct socket *sk,
sdp_warn(sk, "rdma_listen failed: %d\n", rc);
sdp_set_error(sk, rc);
} else
- sdp_exch_state(sk, TCPF_CLOSE, TCP_LISTEN);
+ sdp_exch_state(sk, TCPF_CLOSE, TCPS_LISTEN);
return rc;
}
@@ -2460,7 +2460,7 @@ static int sdp_inet_listen(struct socket
/* Really, if the socket is already in listen state
* we can only allow the backlog to be adjusted.
*/
- if (old_state != TCP_LISTEN) {
+ if (old_state != TCPS_LISTEN) {
err = sdp_listen(sk, backlog);
if (err)
goto out;
@@ -2504,7 +2504,7 @@ static unsigned int sdp_poll(struct file
/* TODO: Slightly ugly: it would be nicer if there was function
* like datagram_poll that didn't include poll_wait,
* then we could reverse the order. */
- if (sk->sk_state == TCP_LISTEN)
+ if (sk->sk_state == TCPS_LISTEN)
return sdp_listen_poll(sk);
if (ssk->urg_data & TCP_URG_VALID)
Modified: projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c Fri Oct 29 01:33:44 2010 (r214498)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c Fri Oct 29 02:12:36 2010 (r214499)
@@ -89,20 +89,20 @@ void sdp_handle_disconn(struct socket *s
sock_set_flag(sk, SOCK_DONE);
switch (sk->sk_state) {
- case TCP_SYN_RECV:
- case TCP_ESTABLISHED:
+ case TCPS_SYN_RECEIVED:
+ case TCPS_ESTABLISHED:
sdp_exch_state(sk, TCPF_SYN_RECV | TCPF_ESTABLISHED,
- TCP_CLOSE_WAIT);
+ TCPS_CLOSED_WAIT);
break;
- case TCP_FIN_WAIT1:
+ case TCPS_FIN_WAIT_1:
/* Received a reply FIN - start Infiniband tear down */
sdp_dbg(sk, "%s: Starting Infiniband tear down sending DREQ\n",
__func__);
sdp_cancel_dreq_wait_timeout(sdp_sk(sk));
- sdp_exch_state(sk, TCPF_FIN_WAIT1, TCP_TIME_WAIT);
+ sdp_exch_state(sk, TCPF_FIN_WAIT1, TCPS_TIME_WAIT);
if (sdp_sk(sk)->id) {
sdp_sk(sk)->qp_active = 0;
@@ -112,11 +112,11 @@ void sdp_handle_disconn(struct socket *s
return;
}
break;
- case TCP_TIME_WAIT:
+ case TCPS_TIME_WAIT:
/* This is a mutual close situation and we've got the DREQ from
the peer before the SDP_MID_DISCONNECT */
break;
- case TCP_CLOSE:
+ case TCPS_CLOSED:
/* FIN arrived after IB teardown started - do nothing */
sdp_dbg(sk, "%s: fin in state %s\n",
__func__, sdp_state_str(sk->sk_state));
@@ -135,7 +135,7 @@ void sdp_handle_disconn(struct socket *s
/* Do not send POLL_HUP for half duplex close. */
if (sk->sk_shutdown == SHUTDOWN_MASK ||
- sk->sk_state == TCP_CLOSE)
+ sk->sk_state == TCPS_CLOSED)
sk_wake_async(sk, 1, POLL_HUP);
else
sk_wake_async(sk, 1, POLL_IN);
@@ -436,11 +436,11 @@ static int sdp_process_rx_ctl_mb(struct
sdp_dbg(sk, "DATA after socket rcv was shutdown\n");
/* got data in RCV_SHUTDOWN */
- if (sk->sk_state == TCP_FIN_WAIT1) {
+ if (sk->sk_state == TCPS_FIN_WAIT_1) {
sdp_dbg(sk, "RX data when state = FIN_WAIT1\n");
/* go into abortive close */
sdp_exch_state(sk, TCPF_FIN_WAIT1,
- TCP_TIME_WAIT);
+ TCPS_TIME_WAIT);
sk->sk_prot->disconnect(sk, 0);
}
@@ -746,7 +746,7 @@ void sdp_do_posts(struct sdp_sock *ssk)
while ((mb = mb_dequeue(&ssk->rx_ctl_q)))
sdp_process_rx_ctl_mb(ssk, mb);
- if (sk->sk_state == TCP_TIME_WAIT)
+ if (sk->sk_state == TCPS_TIME_WAIT)
return;
if (!ssk->rx_ring.cq || !ssk->tx_ring.cq)
Modified: projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c Fri Oct 29 01:33:44 2010 (r214498)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c Fri Oct 29 02:12:36 2010 (r214499)
@@ -378,7 +378,7 @@ static void sdp_poll_tx_timeout(unsigned
goto out;
}
- if (unlikely(sk->sk_state == TCP_CLOSE)) {
+ if (unlikely(sk->sk_state == TCPS_CLOSED)) {
sdp_warn(sk, "Socket is closed\n");
goto out;
}
More information about the svn-src-projects
mailing list