PERFORCE change 129838 for review
Kip Macy
kmacy at FreeBSD.org
Fri Nov 30 11:39:14 PST 2007
http://perforce.freebsd.org/chv.cgi?CH=129838
Change 129838 by kmacy at kmacy:storage:toestack on 2007/11/30 19:38:12
add missing locking
unhook tcpcb when releasing resources
queue tid release if appropriate
Affected files ...
.. //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#28 edit
Differences ...
==== //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#28 (text+ko) ====
@@ -82,6 +82,8 @@
#include <dev/cxgb/ulp/tom/cxgb_t3_ddp.h>
#include <dev/cxgb/ulp/tom/cxgb_toepcb.h>
+
+
/*
* For ULP connections HW may add headers, e.g., for digests, that aren't part
* of the messages sent by the host but that are part of the TCP payload and
@@ -866,7 +868,11 @@
l2t_release(L2DATA(cdev), toep->tp_l2t);
toep->tp_l2t = NULL;
}
-
+
+ toep->tp_tp = NULL;
+ tp->t_toe = NULL;
+ tp->t_flags &= ~TF_TOE;
+
if (tp->t_state == TCPS_SYN_SENT) {
free_atid(cdev, tid);
#ifdef notyet
@@ -1094,7 +1100,10 @@
active_open_failed(struct socket *so, struct mbuf *m)
{
struct cpl_act_open_rpl *rpl = cplhdr(m);
-
+ struct inpcb *inp = sotoinpcb(so);
+
+ INP_INFO_WLOCK(&tcbinfo);
+ INP_LOCK(inp);
/*
* Don't handle connection retry for now
*/
@@ -1109,6 +1118,8 @@
} else
#endif
fail_act_open(so, act_open_rpl_status_to_errno(rpl->status));
+ INP_UNLOCK(inp);
+ INP_INFO_WUNLOCK(&tcbinfo);
m_free(m);
}
@@ -1133,16 +1144,10 @@
so = toeptoso(toep);
-#ifdef notyet
struct cpl_act_open_rpl *rpl = cplhdr(m);
if (cdev->type != T3A && act_open_has_tid(rpl->status))
- cxgb_release_tid(cdev, GET_TID(rpl));
-
- cxgb3_queue_tid_release(cdev, GET_TID(rpl));
-#else
- printf("%s UNIMPLEMENTED\n", __FUNCTION__);
-#endif
+ cxgb_queue_tid_release(cdev, GET_TID(rpl));
active_open_failed(so, m);
return (0);
@@ -2190,11 +2195,9 @@
if ((tp->t_state == TCPS_SYN_RECEIVED) && !abort_syn_rcv(so, m))
return;
- INP_INFO_WLOCK(&tcbinfo);
INP_LOCK(tp->t_inpcb);
t3_release_offload_resources(so);
tcp_close(tp);
- INP_INFO_WUNLOCK(&tcbinfo);
INP_UNLOCK(tp->t_inpcb);
}
@@ -2217,15 +2220,22 @@
}
printf("aborting tid=%d\n", toep->tp_tid);
+ INP_INFO_WLOCK(&tcbinfo);
if (toep->tp_flags & TP_SYN_RCVD) {
printf("abort for unestablished connection :-(\n");
return (0);
}
-
+ if (toep->tp_tp == NULL) {
+ printf("disconnected toepcb\n");
+ /* should be freed momentarily */
+ return (0);
+ }
+
so = toeptoso(toep);
VALIDATE_SOCK(so);
toepcb_hold(toep);
process_abort_req(so, m, TOE_DEV(so));
+ INP_INFO_WUNLOCK(&tcbinfo);
toepcb_release(toep);
return (0);
}
More information about the p4-projects
mailing list