From owner-svn-src-all@freebsd.org Mon Apr 29 03:31:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A58C1591BD1; Mon, 29 Apr 2019 03:31:22 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B310688EB7; Mon, 29 Apr 2019 03:31:21 +0000 (UTC) (envelope-from np@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C15B1C530; Mon, 29 Apr 2019 03:31:21 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x3T3VLQY071102; Mon, 29 Apr 2019 03:31:21 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x3T3VK5J071099; Mon, 29 Apr 2019 03:31:20 GMT (envelope-from np@FreeBSD.org) Message-Id: <201904290331.x3T3VK5J071099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 29 Apr 2019 03:31:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r346872 - in stable/11/sys/dev/cxgbe: . common X-SVN-Group: stable-11 X-SVN-Commit-Author: np X-SVN-Commit-Paths: in stable/11/sys/dev/cxgbe: . common X-SVN-Commit-Revision: 346872 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B310688EB7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.981,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 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: Mon, 29 Apr 2019 03:31:22 -0000 Author: np Date: Mon Apr 29 03:31:20 2019 New Revision: 346872 URL: https://svnweb.freebsd.org/changeset/base/346872 Log: MFC r337192: cxgbe(4): Improvements in TID management. - Ignore any type of TID where the start/end values are not in the correct order. There are situations where the firmware isn't able to reserve room for the number requested in the config file but doesn't report a failure during configuration and instead sets end <= start. - Track start/end in tid_tab and remove some redundant copies from adapter->params. - Move all the start/end and other read-only parameters to a quiet part of tid_tab, away from the tid locks. Sponsored by: Chelsio Communications Modified: stable/11/sys/dev/cxgbe/common/common.h stable/11/sys/dev/cxgbe/offload.h stable/11/sys/dev/cxgbe/t4_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/cxgbe/common/common.h ============================================================================== --- stable/11/sys/dev/cxgbe/common/common.h Mon Apr 29 03:10:58 2019 (r346871) +++ stable/11/sys/dev/cxgbe/common/common.h Mon Apr 29 03:31:20 2019 (r346872) @@ -354,11 +354,6 @@ struct adapter_params { unsigned short a_wnd[NCCTRL_WIN]; unsigned short b_wnd[NCCTRL_WIN]; - u_int ftid_min; - u_int ftid_max; - u_int etid_min; - u_int etid_max; - unsigned int cim_la_size; uint8_t nports; /* # of ethernet ports */ @@ -443,14 +438,15 @@ struct link_config { static inline int is_ftid(const struct adapter *sc, u_int tid) { - return (tid >= sc->params.ftid_min && tid <= sc->params.ftid_max); + return (sc->tids.nftids > 0 && tid >= sc->tids.ftid_base && + tid <= sc->tids.ftid_end); } static inline int is_etid(const struct adapter *sc, u_int tid) { - return (sc->params.etid_min > 0 && tid >= sc->params.etid_min && - tid <= sc->params.etid_max); + return (sc->tids.netids > 0 && tid >= sc->tids.etid_base && + tid <= sc->tids.etid_end); } static inline int is_offload(const struct adapter *adap) Modified: stable/11/sys/dev/cxgbe/offload.h ============================================================================== --- stable/11/sys/dev/cxgbe/offload.h Mon Apr 29 03:10:58 2019 (r346871) +++ stable/11/sys/dev/cxgbe/offload.h Mon Apr 29 03:31:20 2019 (r346872) @@ -78,44 +78,52 @@ union aopen_entry { }; /* - * Holds the size, base address, free list start, etc of the TID, server TID, - * and active-open TID tables. The tables themselves are allocated dynamically. + * Holds the size, base address, start, end, etc. of various types of TIDs. The + * tables themselves are allocated dynamically. */ struct tid_info { - void **tid_tab; + u_int nstids; + u_int stid_base; + + u_int natids; + + u_int nftids; + u_int ftid_base; + u_int ftid_end; + u_int ntids; - u_int tids_in_use; + u_int netids; + u_int etid_base; + u_int etid_end; + struct mtx stid_lock __aligned(CACHE_LINE_SIZE); struct listen_ctx **stid_tab; - u_int nstids; - u_int stid_base; u_int stids_in_use; u_int nstids_free_head; /* # of available stids at the beginning */ struct stid_head stids; struct mtx atid_lock __aligned(CACHE_LINE_SIZE); union aopen_entry *atid_tab; - u_int natids; union aopen_entry *afree; u_int atids_in_use; struct mtx ftid_lock __aligned(CACHE_LINE_SIZE); struct cv ftid_cv; struct filter_entry *ftid_tab; - u_int nftids; - u_int ftid_base; u_int ftids_in_use; + /* + * hashfilter and TOE are mutually exclusive and both use ntids and + * tids_in_use. The lock and cv are used only by hashfilter. + */ struct mtx hftid_lock __aligned(CACHE_LINE_SIZE); struct cv hftid_cv; - void **hftid_tab; - /* ntids, tids_in_use */ - - struct mtx etid_lock __aligned(CACHE_LINE_SIZE); - struct etid_entry *etid_tab; - u_int netids; - u_int etid_base; + union { + void **hftid_tab; + void **tid_tab; + }; + u_int tids_in_use; }; struct t4_range { Modified: stable/11/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/11/sys/dev/cxgbe/t4_main.c Mon Apr 29 03:10:58 2019 (r346871) +++ stable/11/sys/dev/cxgbe/t4_main.c Mon Apr 29 03:31:20 2019 (r346872) @@ -3926,10 +3926,11 @@ get_params__post_init(struct adapter *sc) sc->sge.iq_start = val[0]; sc->sge.eq_start = val[1]; - sc->tids.ftid_base = val[2]; - sc->tids.nftids = val[3] - val[2] + 1; - sc->params.ftid_min = val[2]; - sc->params.ftid_max = val[3]; + if (val[3] > val[2]) { + sc->tids.ftid_base = val[2]; + sc->tids.ftid_end = val[3]; + sc->tids.nftids = val[3] - val[2] + 1; + } sc->vres.l2t.start = val[4]; sc->vres.l2t.size = val[5] - val[4] + 1; KASSERT(sc->vres.l2t.size <= L2T_SIZE, @@ -4013,12 +4014,13 @@ get_params__post_init(struct adapter *sc) "failed to query NIC parameters: %d.\n", rc); return (rc); } - sc->tids.etid_base = val[0]; - sc->params.etid_min = val[0]; - sc->params.etid_max = val[1]; - sc->tids.netids = val[1] - val[0] + 1; - sc->params.eo_wr_cred = val[2]; - sc->params.ethoffload = 1; + if (val[1] > val[0]) { + sc->tids.etid_base = val[0]; + sc->tids.etid_end = val[1]; + sc->tids.netids = val[1] - val[0] + 1; + sc->params.eo_wr_cred = val[2]; + sc->params.ethoffload = 1; + } } if (sc->toecaps) { /* query offload-related parameters */ @@ -4036,8 +4038,10 @@ get_params__post_init(struct adapter *sc) } sc->tids.ntids = val[0]; sc->tids.natids = min(sc->tids.ntids / 2, MAX_ATIDS); - sc->tids.stid_base = val[1]; - sc->tids.nstids = val[2] - val[1] + 1; + if (val[2] > val[1]) { + sc->tids.stid_base = val[1]; + sc->tids.nstids = val[2] - val[1] + 1; + } sc->vres.ddp.start = val[3]; sc->vres.ddp.size = val[4] - val[3] + 1; sc->params.ofldq_wr_cred = val[5];