From 7faa4a7b6d16b2791b832e9133ca24e4c37b22f5 Mon Sep 17 00:00:00 2001 From: np Date: Tue, 14 Jun 2016 21:02:36 +0000 Subject: iw_cxgbe: Make sure that send_abort results in a TCP RST and not a FIN. Release the hold on ep->com immediately after sending the RST. This fixes a bug that sometimes leaves userspace iWARP tools hung when the user presses ^C. Submitted by: Krishnamraju Eraparaju @ Chelsio Approved by: re (gjb@) Sponsored by: Chelsio Communications --- sys/dev/cxgbe/iw_cxgbe/cm.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/sys/dev/cxgbe/iw_cxgbe/cm.c b/sys/dev/cxgbe/iw_cxgbe/cm.c index dc5617d..1f6cc37 100644 --- a/sys/dev/cxgbe/iw_cxgbe/cm.c +++ b/sys/dev/cxgbe/iw_cxgbe/cm.c @@ -760,7 +760,7 @@ process_socket_event(struct c4iw_ep *ep) } /* peer close */ - if ((so->so_rcv.sb_state & SBS_CANTRCVMORE) && state < CLOSING) { + if ((so->so_rcv.sb_state & SBS_CANTRCVMORE) && state <= CLOSING) { process_peer_close(ep); return; } @@ -1223,9 +1223,23 @@ static int send_abort(struct c4iw_ep *ep) CTR2(KTR_IW_CXGBE, "%s:abB %p", __func__, ep); abort_socket(ep); - err = close_socket(&ep->com, 0); + + /* + * Since socket options were set as l_onoff=1 and l_linger=0 in in + * abort_socket, invoking soclose here sends a RST (reset) to the peer. + */ + err = close_socket(&ep->com, 1); set_bit(ABORT_CONN, &ep->com.history); CTR2(KTR_IW_CXGBE, "%s:abE %p", __func__, ep); + + /* + * TBD: iw_cgbe driver should receive ABORT reply for every ABORT + * request it has sent. But the current TOE driver is not propagating + * this ABORT reply event (via do_abort_rpl) to iw_cxgbe. So as a work- + * around de-refer 'ep' (which was refered before sending ABORT request) + * here instead of doing it in abort_rpl() handler of iw_cxgbe driver. + */ + c4iw_put_ep(&ep->com); return err; } -- cgit v1.1