summaryrefslogtreecommitdiff
path: root/sys/dev/cxgbe
diff options
context:
space:
mode:
authorNavdeep Parhar <np@FreeBSD.org>2014-05-06 07:21:50 +0000
committerNavdeep Parhar <np@FreeBSD.org>2014-05-06 07:21:50 +0000
commit97326ef2beed4cef9eade1faac560f9ffc9acbf1 (patch)
tree416fede1f3bd95d3a86c027a52911f579be47738 /sys/dev/cxgbe
parent5512727fe2779a16892fe72997875982d00a362d (diff)
Notes
Diffstat (limited to 'sys/dev/cxgbe')
-rw-r--r--sys/dev/cxgbe/common/common.h25
-rw-r--r--sys/dev/cxgbe/offload.h5
-rw-r--r--sys/dev/cxgbe/t4_main.c58
-rw-r--r--sys/dev/cxgbe/t4_sge.c1
-rw-r--r--sys/dev/cxgbe/tom/t4_cpl_io.c9
5 files changed, 80 insertions, 18 deletions
diff --git a/sys/dev/cxgbe/common/common.h b/sys/dev/cxgbe/common/common.h
index efda04d5b897..e3883db471ff 100644
--- a/sys/dev/cxgbe/common/common.h
+++ b/sys/dev/cxgbe/common/common.h
@@ -267,8 +267,10 @@ struct adapter_params {
unsigned short a_wnd[NCCTRL_WIN];
unsigned short b_wnd[NCCTRL_WIN];
- unsigned int mc_size; /* MC memory size */
- unsigned int nfilters; /* size of filter region */
+ u_int ftid_min;
+ u_int ftid_max;
+ u_int etid_min;
+ u_int netids;
unsigned int cim_la_size;
@@ -280,8 +282,10 @@ struct adapter_params {
unsigned int offload:1; /* hw is TOE capable, fw has divvied up card
resources for TOE operation. */
unsigned int bypass:1; /* this is a bypass card */
+ unsigned int ethoffload:1;
unsigned int ofldq_wr_cred;
+ unsigned int eo_wr_cred;
};
#define CHELSIO_T4 0x4
@@ -318,11 +322,28 @@ struct link_config {
#define for_each_port(adapter, iter) \
for (iter = 0; iter < (adapter)->params.nports; ++iter)
+static inline int is_ftid(const struct adapter *sc, u_int tid)
+{
+
+ return (tid >= sc->params.ftid_min && tid <= sc->params.ftid_max);
+}
+
+static inline int is_etid(const struct adapter *sc, u_int tid)
+{
+
+ return (tid >= sc->params.etid_min);
+}
+
static inline int is_offload(const struct adapter *adap)
{
return adap->params.offload;
}
+static inline int is_ethoffload(const struct adapter *adap)
+{
+ return adap->params.ethoffload;
+}
+
static inline int chip_id(struct adapter *adap)
{
return adap->params.chipid;
diff --git a/sys/dev/cxgbe/offload.h b/sys/dev/cxgbe/offload.h
index 8d3cf66208f3..a03d114a1a28 100644
--- a/sys/dev/cxgbe/offload.h
+++ b/sys/dev/cxgbe/offload.h
@@ -101,6 +101,11 @@ struct tid_info {
u_int nftids;
u_int ftid_base;
u_int ftids_in_use;
+
+ struct mtx etid_lock __aligned(CACHE_LINE_SIZE);
+ struct etid_entry *etid_tab;
+ u_int netids;
+ u_int etid_base;
};
struct t4_range {
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index 4fddd3573bc6..43872d405361 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -2357,7 +2357,6 @@ use_config_on_flash:
#define LIMIT_CAPS(x) do { \
caps.x &= htobe16(t4_##x##_allowed); \
- sc->x = htobe16(caps.x); \
} while (0)
/*
@@ -2459,6 +2458,8 @@ get_params__post_init(struct adapter *sc)
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];
sc->vres.l2t.start = val[4];
sc->vres.l2t.size = val[5] - val[4] + 1;
KASSERT(sc->vres.l2t.size <= L2T_SIZE,
@@ -2477,7 +2478,35 @@ get_params__post_init(struct adapter *sc)
return (rc);
}
- if (caps.toecaps) {
+#define READ_CAPS(x) do { \
+ sc->x = htobe16(caps.x); \
+} while (0)
+ READ_CAPS(linkcaps);
+ READ_CAPS(niccaps);
+ READ_CAPS(toecaps);
+ READ_CAPS(rdmacaps);
+ READ_CAPS(iscsicaps);
+ READ_CAPS(fcoecaps);
+
+ if (sc->niccaps & FW_CAPS_CONFIG_NIC_ETHOFLD) {
+ param[0] = FW_PARAM_PFVF(ETHOFLD_START);
+ param[1] = FW_PARAM_PFVF(ETHOFLD_END);
+ param[2] = FW_PARAM_DEV(FLOWC_BUFFIFO_SZ);
+ rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 3, param, val);
+ if (rc != 0) {
+ device_printf(sc->dev,
+ "failed to query NIC parameters: %d.\n", rc);
+ return (rc);
+ }
+ sc->tids.etid_base = val[0];
+ sc->params.etid_min = val[0];
+ sc->tids.netids = val[1] - val[0] + 1;
+ sc->params.netids = sc->tids.netids;
+ sc->params.eo_wr_cred = val[2];
+ sc->params.ethoffload = 1;
+ }
+
+ if (sc->toecaps) {
/* query offload-related parameters */
param[0] = FW_PARAM_DEV(NTID);
param[1] = FW_PARAM_PFVF(SERVER_START);
@@ -2500,7 +2529,7 @@ get_params__post_init(struct adapter *sc)
sc->params.ofldq_wr_cred = val[5];
sc->params.offload = 1;
}
- if (caps.rdmacaps) {
+ if (sc->rdmacaps) {
param[0] = FW_PARAM_PFVF(STAG_START);
param[1] = FW_PARAM_PFVF(STAG_END);
param[2] = FW_PARAM_PFVF(RQ_START);
@@ -2539,7 +2568,7 @@ get_params__post_init(struct adapter *sc)
sc->vres.ocq.start = val[4];
sc->vres.ocq.size = val[5] - val[4] + 1;
}
- if (caps.iscsicaps) {
+ if (sc->iscsicaps) {
param[0] = FW_PARAM_PFVF(ISCSI_START);
param[1] = FW_PARAM_PFVF(ISCSI_END);
rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 2, param, val);
@@ -4504,6 +4533,7 @@ cxgbe_sysctls(struct port_info *pi)
struct sysctl_ctx_list *ctx;
struct sysctl_oid *oid;
struct sysctl_oid_list *children;
+ struct adapter *sc = pi->adapter;
ctx = device_get_sysctl_ctx(pi->dev);
@@ -4536,7 +4566,7 @@ cxgbe_sysctls(struct port_info *pi)
"Reserve queue 0 for non-flowid packets");
#ifdef TCP_OFFLOAD
- if (is_offload(pi->adapter)) {
+ if (is_offload(sc)) {
SYSCTL_ADD_INT(ctx, children, OID_AUTO, "nofldrxq", CTLFLAG_RD,
&pi->nofldrxq, 0,
"# of rx queues for offloaded TCP connections");
@@ -4575,7 +4605,7 @@ cxgbe_sysctls(struct port_info *pi)
#define SYSCTL_ADD_T4_REG64(pi, name, desc, reg) \
SYSCTL_ADD_OID(ctx, children, OID_AUTO, name, \
- CTLTYPE_U64 | CTLFLAG_RD, pi->adapter, reg, \
+ CTLTYPE_U64 | CTLFLAG_RD, sc, reg, \
sysctl_handle_t4_reg64, "QU", desc)
SYSCTL_ADD_T4_REG64(pi, "tx_octets", "# of octets in good frames",
@@ -6164,6 +6194,11 @@ sysctl_tids(SYSCTL_HANDLER_ARGS)
t->ftid_base + t->nftids - 1);
}
+ if (t->netids) {
+ sbuf_printf(sb, "ETID range: %u-%u\n", t->etid_base,
+ t->etid_base + t->netids - 1);
+ }
+
sbuf_printf(sb, "HW TID usage: %u IP users, %u IPv6 users",
t4_read_reg(sc, A_LE_DB_ACT_CNT_IPV4),
t4_read_reg(sc, A_LE_DB_ACT_CNT_IPV6));
@@ -7195,14 +7230,17 @@ t4_filter_rpl(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m)
struct adapter *sc = iq->adapter;
const struct cpl_set_tcb_rpl *rpl = (const void *)(rss + 1);
unsigned int idx = GET_TID(rpl);
+ unsigned int rc;
+ struct filter_entry *f;
KASSERT(m == NULL, ("%s: payload with opcode %02x", __func__,
rss->opcode));
- if (idx >= sc->tids.ftid_base &&
- (idx -= sc->tids.ftid_base) < sc->tids.nftids) {
- unsigned int rc = G_COOKIE(rpl->cookie);
- struct filter_entry *f = &sc->tids.ftid_tab[idx];
+ if (is_ftid(sc, idx)) {
+
+ idx -= sc->tids.ftid_base;
+ f = &sc->tids.ftid_tab[idx];
+ rc = G_COOKIE(rpl->cookie);
mtx_lock(&sc->tids.ftid_lock);
if (rc == FW_FILTER_WR_FLT_ADDED) {
diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c
index 2b2a689a8a16..8d59104fa815 100644
--- a/sys/dev/cxgbe/t4_sge.c
+++ b/sys/dev/cxgbe/t4_sge.c
@@ -2833,7 +2833,6 @@ alloc_wrq(struct adapter *sc, struct port_info *pi, struct sge_wrq *wrq,
SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "unstalled", CTLFLAG_RD,
&wrq->eq.unstalled, 0, "# of times queue recovered after stall");
-
return (rc);
}
diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c
index 046482e38908..e2f5c79f0926 100644
--- a/sys/dev/cxgbe/tom/t4_cpl_io.c
+++ b/sys/dev/cxgbe/tom/t4_cpl_io.c
@@ -1299,18 +1299,18 @@ do_rx_data(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m)
#define V_CPL_FW4_ACK_OPCODE(x) ((x) << S_CPL_FW4_ACK_OPCODE)
#define G_CPL_FW4_ACK_OPCODE(x) \
(((x) >> S_CPL_FW4_ACK_OPCODE) & M_CPL_FW4_ACK_OPCODE)
-
+
#define S_CPL_FW4_ACK_FLOWID 0
#define M_CPL_FW4_ACK_FLOWID 0xffffff
#define V_CPL_FW4_ACK_FLOWID(x) ((x) << S_CPL_FW4_ACK_FLOWID)
#define G_CPL_FW4_ACK_FLOWID(x) \
(((x) >> S_CPL_FW4_ACK_FLOWID) & M_CPL_FW4_ACK_FLOWID)
-
+
#define S_CPL_FW4_ACK_CR 24
#define M_CPL_FW4_ACK_CR 0xff
#define V_CPL_FW4_ACK_CR(x) ((x) << S_CPL_FW4_ACK_CR)
#define G_CPL_FW4_ACK_CR(x) (((x) >> S_CPL_FW4_ACK_CR) & M_CPL_FW4_ACK_CR)
-
+
#define S_CPL_FW4_ACK_SEQVAL 0
#define M_CPL_FW4_ACK_SEQVAL 0x1
#define V_CPL_FW4_ACK_SEQVAL(x) ((x) << S_CPL_FW4_ACK_SEQVAL)
@@ -1437,8 +1437,7 @@ do_set_tcb_rpl(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m)
("%s: unexpected opcode 0x%x", __func__, opcode));
KASSERT(m == NULL, ("%s: wasn't expecting payload", __func__));
- if (tid >= sc->tids.ftid_base &&
- tid < sc->tids.ftid_base + sc->tids.nftids)
+ if (is_ftid(sc, tid))
return (t4_filter_rpl(iq, rss, m)); /* TCB is a filter */
CXGBE_UNIMPLEMENTED(__func__);