From owner-svn-src-all@freebsd.org Tue May 3 08:13:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06982B298B6; Tue, 3 May 2016 08:13:27 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B8F501F0D; Tue, 3 May 2016 08:13:26 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u438DPHq048181; Tue, 3 May 2016 08:13:25 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u438DPTe048180; Tue, 3 May 2016 08:13:25 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605030813.u438DPTe048180@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 3 May 2016 08:13:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298974 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 May 2016 08:13:27 -0000 Author: sephe Date: Tue May 3 08:13:25 2016 New Revision: 298974 URL: https://svnweb.freebsd.org/changeset/base/298974 Log: tcp/lro: Refactor the active list operation. Ease more work concerning active list, e.g. hash table etc. Reviewed by: gallatin, rrs (earlier version) Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6137 Modified: head/sys/netinet/tcp_lro.c Modified: head/sys/netinet/tcp_lro.c ============================================================================== --- head/sys/netinet/tcp_lro.c Tue May 3 08:07:38 2016 (r298973) +++ head/sys/netinet/tcp_lro.c Tue May 3 08:13:25 2016 (r298974) @@ -69,6 +69,20 @@ static MALLOC_DEFINE(M_LRO, "LRO", "LRO static void tcp_lro_rx_done(struct lro_ctrl *lc); +static __inline void +tcp_lro_active_insert(struct lro_ctrl *lc, struct lro_entry *le) +{ + + LIST_INSERT_HEAD(&lc->lro_active, le, next); +} + +static __inline void +tcp_lro_active_remove(struct lro_entry *le) +{ + + LIST_REMOVE(le, next); +} + int tcp_lro_init(struct lro_ctrl *lc) { @@ -129,7 +143,7 @@ tcp_lro_free(struct lro_ctrl *lc) /* free active mbufs, if any */ while ((le = LIST_FIRST(&lc->lro_active)) != NULL) { - LIST_REMOVE(le, next); + tcp_lro_active_remove(le); m_freem(le->m_head); } @@ -234,7 +248,7 @@ tcp_lro_rx_done(struct lro_ctrl *lc) struct lro_entry *le; while ((le = LIST_FIRST(&lc->lro_active)) != NULL) { - LIST_REMOVE(le, next); + tcp_lro_active_remove(le); tcp_lro_flush(lc, le); } } @@ -252,7 +266,7 @@ tcp_lro_flush_inactive(struct lro_ctrl * timevalsub(&tv, timeout); LIST_FOREACH_SAFE(le, &lc->lro_active, next, le_tmp) { if (timevalcmp(&tv, &le->mtime, >=)) { - LIST_REMOVE(le, next); + tcp_lro_active_remove(le); tcp_lro_flush(lc, le); } } @@ -620,7 +634,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m /* Flush now if appending will result in overflow. */ if (le->p_len > (lc->lro_length_lim - tcp_data_len)) { - LIST_REMOVE(le, next); + tcp_lro_active_remove(le); tcp_lro_flush(lc, le); break; } @@ -629,7 +643,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m if (__predict_false(seq != le->next_seq || (tcp_data_len == 0 && le->ack_seq == th->th_ack))) { /* Out of order packet or duplicate ACK. */ - LIST_REMOVE(le, next); + tcp_lro_active_remove(le); tcp_lro_flush(lc, le); return (TCP_LRO_CANNOT); } @@ -662,7 +676,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m * be further delayed. */ if (le->append_cnt >= lc->lro_ackcnt_lim) { - LIST_REMOVE(le, next); + tcp_lro_active_remove(le); tcp_lro_flush(lc, le); } return (0); @@ -686,7 +700,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m * overflow, pro-actively flush now. */ if (le->p_len > (lc->lro_length_lim - lc->ifp->if_mtu)) { - LIST_REMOVE(le, next); + tcp_lro_active_remove(le); tcp_lro_flush(lc, le); } else getmicrotime(&le->mtime); @@ -701,7 +715,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m /* Start a new segment chain. */ le = LIST_FIRST(&lc->lro_free); LIST_REMOVE(le, next); - LIST_INSERT_HEAD(&lc->lro_active, le, next); + tcp_lro_active_insert(lc, le); getmicrotime(&le->mtime); /* Start filling in details. */