diff options
author | np <np@FreeBSD.org> | 2012-08-21 22:23:17 +0000 |
---|---|---|
committer | np <np@FreeBSD.org> | 2012-08-21 22:23:17 +0000 |
commit | aac78a84d92b54710e2e24cb25f2a89d9ad5ea34 (patch) | |
tree | 35e26c964642d7abeae2a4788a1245eb3630a971 /sys/dev | |
parent | b078416faee91706c529b006bfe55ca9b2722569 (diff) | |
download | FreeBSD-src-aac78a84d92b54710e2e24cb25f2a89d9ad5ea34.zip FreeBSD-src-aac78a84d92b54710e2e24cb25f2a89d9ad5ea34.tar.gz |
Deal with the case where a syncache entry added by the TOE driver is
evicted from the syncache but a later syncache_expand succeeds because
of syncookies. The TOE driver has to resort to more direct means to
install its hooks in the socket in this case.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/cxgb/ulp/tom/cxgb_listen.c | 11 | ||||
-rw-r--r-- | sys/dev/cxgb/ulp/tom/cxgb_toepcb.h | 1 | ||||
-rw-r--r-- | sys/dev/cxgbe/tom/t4_listen.c | 20 | ||||
-rw-r--r-- | sys/dev/cxgbe/tom/t4_tom.h | 1 |
4 files changed, 33 insertions, 0 deletions
diff --git a/sys/dev/cxgb/ulp/tom/cxgb_listen.c b/sys/dev/cxgb/ulp/tom/cxgb_listen.c index c80abf0..8148ae4 100644 --- a/sys/dev/cxgb/ulp/tom/cxgb_listen.c +++ b/sys/dev/cxgb/ulp/tom/cxgb_listen.c @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include <netinet/ip.h> #include <netinet/in_pcb.h> #include <netinet/in_var.h> +#include <netinet/tcp_timer.h> #include <netinet/tcp_var.h> #define TCPSTATES #include <netinet/tcp_fsm.h> @@ -759,6 +760,15 @@ reset: goto reset; } + if (__predict_false(!(synqe->flags & TP_SYNQE_EXPANDED))) { + struct inpcb *new_inp = sotoinpcb(so); + + INP_WLOCK(new_inp); + tcp_timer_activate(intotcpcb(new_inp), TT_KEEP, 0); + t3_offload_socket(tod, synqe, so); + INP_WUNLOCK(new_inp); + } + /* Remove the synq entry and release its reference on the lctx */ TAILQ_REMOVE(&lctx->synq, synqe, link); inp = release_lctx(td, lctx); @@ -1136,5 +1146,6 @@ t3_offload_socket(struct toedev *tod, void *arg, struct socket *so) offload_socket(so, toep); make_established(so, cpl->snd_isn, cpl->rcv_isn, cpl->tcp_opt); update_tid(td, toep, synqe->tid); + synqe->flags |= TP_SYNQE_EXPANDED; } #endif diff --git a/sys/dev/cxgb/ulp/tom/cxgb_toepcb.h b/sys/dev/cxgb/ulp/tom/cxgb_toepcb.h index d0046c8..d821a01 100644 --- a/sys/dev/cxgb/ulp/tom/cxgb_toepcb.h +++ b/sys/dev/cxgb/ulp/tom/cxgb_toepcb.h @@ -44,6 +44,7 @@ #define TP_IS_A_SYNQ_ENTRY (1 << 9) #define TP_ABORT_RPL_SENT (1 << 10) #define TP_SEND_FIN (1 << 11) +#define TP_SYNQE_EXPANDED (1 << 12) struct toepcb { TAILQ_ENTRY(toepcb) link; /* toep_list */ diff --git a/sys/dev/cxgbe/tom/t4_listen.c b/sys/dev/cxgbe/tom/t4_listen.c index c717a90a..19b9b4b 100644 --- a/sys/dev/cxgbe/tom/t4_listen.c +++ b/sys/dev/cxgbe/tom/t4_listen.c @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include <netinet/in.h> #include <netinet/in_pcb.h> #include <netinet/ip.h> +#include <netinet/tcp_timer.h> #include <netinet/tcp_var.h> #define TCPSTATES #include <netinet/tcp_fsm.h> @@ -805,6 +806,7 @@ t4_offload_socket(struct toedev *tod, void *arg, struct socket *so) make_established(toep, cpl->snd_isn, cpl->rcv_isn, cpl->tcp_opt); toep->flags |= TPF_CPL_PENDING; update_tid(sc, synqe->tid, toep); + synqe->flags |= TPF_SYNQE_EXPANDED; } static inline void @@ -1349,6 +1351,24 @@ reset: goto reset; } + /* + * This is for the unlikely case where the syncache entry that we added + * has been evicted from the syncache, but the syncache_expand above + * works because of syncookies. + * + * XXX: we've held the tcbinfo lock throughout so there's no risk of + * anyone accept'ing a connection before we've installed our hooks, but + * this somewhat defeats the purpose of having a tod_offload_socket :-( + */ + if (__predict_false(!(synqe->flags & TPF_SYNQE_EXPANDED))) { + struct inpcb *new_inp = sotoinpcb(so); + + INP_WLOCK(new_inp); + tcp_timer_activate(intotcpcb(new_inp), TT_KEEP, 0); + t4_offload_socket(TOEDEV(ifp), synqe, so); + INP_WUNLOCK(new_inp); + } + /* Done with the synqe */ TAILQ_REMOVE(&lctx->synq, synqe, link); inp = release_lctx(sc, lctx); diff --git a/sys/dev/cxgbe/tom/t4_tom.h b/sys/dev/cxgbe/tom/t4_tom.h index f75afd3..2e6bad4 100644 --- a/sys/dev/cxgbe/tom/t4_tom.h +++ b/sys/dev/cxgbe/tom/t4_tom.h @@ -66,6 +66,7 @@ enum { TPF_SYNQE = (1 << 8), /* synq_entry, not really a toepcb */ TPF_SYNQE_NEEDFREE = (1 << 9), /* synq_entry was malloc'd separately */ TPF_SYNQE_TCPDDP = (1 << 10), /* ulp_mode TCPDDP in toepcb */ + TPF_SYNQE_EXPANDED = (1 << 11), /* toepcb ready, tid context updated */ }; enum { |