svn commit: r346872 - in stable/11/sys/dev/cxgbe: . common
Navdeep Parhar
np at FreeBSD.org
Mon Apr 29 03:31:22 UTC 2019
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];
More information about the svn-src-all
mailing list