Date: Thu, 2 Aug 2018 22:52:05 +0000 (UTC) From: Navdeep Parhar <np@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r337192 - in head/sys/dev/cxgbe: . common Message-ID: <201808022252.w72Mq582095697@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: np Date: Thu Aug 2 22:52:05 2018 New Revision: 337192 URL: https://svnweb.freebsd.org/changeset/base/337192 Log: 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. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/offload.h head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/common/common.h ============================================================================== --- head/sys/dev/cxgbe/common/common.h Thu Aug 2 21:59:46 2018 (r337191) +++ head/sys/dev/cxgbe/common/common.h Thu Aug 2 22:52:05 2018 (r337192) @@ -355,11 +355,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 */ @@ -442,14 +437,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: head/sys/dev/cxgbe/offload.h ============================================================================== --- head/sys/dev/cxgbe/offload.h Thu Aug 2 21:59:46 2018 (r337191) +++ head/sys/dev/cxgbe/offload.h Thu Aug 2 22:52:05 2018 (r337192) @@ -120,18 +120,27 @@ union etid_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; @@ -139,26 +148,28 @@ struct tid_info { struct mtx atid_lock __aligned(CACHE_LINE_SIZE); union aopen_entry *atid_tab; union aopen_entry *afree; - u_int natids; 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 */ + union { + void **hftid_tab; + void **tid_tab; + }; + u_int tids_in_use; struct mtx etid_lock __aligned(CACHE_LINE_SIZE); union etid_entry *etid_tab; union etid_entry *efree; - u_int netids; - u_int etid_base; u_int etids_in_use; }; Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Thu Aug 2 21:59:46 2018 (r337191) +++ head/sys/dev/cxgbe/t4_main.c Thu Aug 2 22:52:05 2018 (r337192) @@ -3841,10 +3841,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, @@ -3928,12 +3929,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 */ @@ -3951,8 +3953,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];
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808022252.w72Mq582095697>