summaryrefslogtreecommitdiffstats
path: root/sys/dev/cxgbe/tom
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/cxgbe/tom')
-rw-r--r--sys/dev/cxgbe/tom/t4_connect.c82
-rw-r--r--sys/dev/cxgbe/tom/t4_listen.c23
-rw-r--r--sys/dev/cxgbe/tom/t4_tom.c3
3 files changed, 66 insertions, 42 deletions
diff --git a/sys/dev/cxgbe/tom/t4_connect.c b/sys/dev/cxgbe/tom/t4_connect.c
index 3524011..5ec627c 100644
--- a/sys/dev/cxgbe/tom/t4_connect.c
+++ b/sys/dev/cxgbe/tom/t4_connect.c
@@ -277,19 +277,26 @@ t4_init_connect_cpl_handlers(void)
static inline int
act_open_cpl_size(struct adapter *sc, int isipv6)
{
- static const int sz_t4[] = {
- sizeof (struct cpl_act_open_req),
- sizeof (struct cpl_act_open_req6)
- };
- static const int sz_t5[] = {
- sizeof (struct cpl_t5_act_open_req),
- sizeof (struct cpl_t5_act_open_req6)
+ int idx;
+ static const int sz_table[3][2] = {
+ {
+ sizeof (struct cpl_act_open_req),
+ sizeof (struct cpl_act_open_req6)
+ },
+ {
+ sizeof (struct cpl_t5_act_open_req),
+ sizeof (struct cpl_t5_act_open_req6)
+ },
+ {
+ sizeof (struct cpl_t6_act_open_req),
+ sizeof (struct cpl_t6_act_open_req6)
+ },
};
- if (is_t4(sc))
- return (sz_t4[!!isipv6]);
- else
- return (sz_t5[!!isipv6]);
+ MPASS(chip_id(sc) >= CHELSIO_T4);
+ idx = min(chip_id(sc) - CHELSIO_T4, 2);
+
+ return (sz_table[idx][!!isipv6]);
}
/*
@@ -373,28 +380,32 @@ t4_connect(struct toedev *tod, struct socket *so, struct rtentry *rt,
if (isipv6) {
struct cpl_act_open_req6 *cpl = wrtod(wr);
+ struct cpl_t5_act_open_req6 *cpl5 = (void *)cpl;
+ struct cpl_t6_act_open_req6 *cpl6 = (void *)cpl;
- if ((inp->inp_vflag & INP_IPV6) == 0) {
- /* XXX think about this a bit more */
- log(LOG_ERR,
- "%s: time to think about AF_INET6 + vflag 0x%x.\n",
- __func__, inp->inp_vflag);
+ if ((inp->inp_vflag & INP_IPV6) == 0)
DONT_OFFLOAD_ACTIVE_OPEN(ENOTSUP);
- }
toep->ce = hold_lip(td, &inp->in6p_laddr);
if (toep->ce == NULL)
DONT_OFFLOAD_ACTIVE_OPEN(ENOENT);
- if (is_t4(sc)) {
+ switch (chip_id(sc)) {
+ case CHELSIO_T4:
INIT_TP_WR(cpl, 0);
cpl->params = select_ntuple(vi, toep->l2te);
- } else {
- struct cpl_t5_act_open_req6 *c5 = (void *)cpl;
-
- INIT_TP_WR(c5, 0);
- c5->iss = htobe32(tp->iss);
- c5->params = select_ntuple(vi, toep->l2te);
+ break;
+ case CHELSIO_T5:
+ INIT_TP_WR(cpl5, 0);
+ cpl5->iss = htobe32(tp->iss);
+ cpl5->params = select_ntuple(vi, toep->l2te);
+ break;
+ case CHELSIO_T6:
+ default:
+ INIT_TP_WR(cpl6, 0);
+ cpl6->iss = htobe32(tp->iss);
+ cpl6->params = select_ntuple(vi, toep->l2te);
+ break;
}
OPCODE_TID(cpl) = htobe32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ6,
qid_atid));
@@ -409,16 +420,25 @@ t4_connect(struct toedev *tod, struct socket *so, struct rtentry *rt,
cpl->opt2 = calc_opt2a(so, toep);
} else {
struct cpl_act_open_req *cpl = wrtod(wr);
+ struct cpl_t5_act_open_req *cpl5 = (void *)cpl;
+ struct cpl_t6_act_open_req *cpl6 = (void *)cpl;
- if (is_t4(sc)) {
+ switch (chip_id(sc)) {
+ case CHELSIO_T4:
INIT_TP_WR(cpl, 0);
cpl->params = select_ntuple(vi, toep->l2te);
- } else {
- struct cpl_t5_act_open_req *c5 = (void *)cpl;
-
- INIT_TP_WR(c5, 0);
- c5->iss = htobe32(tp->iss);
- c5->params = select_ntuple(vi, toep->l2te);
+ break;
+ case CHELSIO_T5:
+ INIT_TP_WR(cpl5, 0);
+ cpl5->iss = htobe32(tp->iss);
+ cpl5->params = select_ntuple(vi, toep->l2te);
+ break;
+ case CHELSIO_T6:
+ default:
+ INIT_TP_WR(cpl6, 0);
+ cpl6->iss = htobe32(tp->iss);
+ cpl6->params = select_ntuple(vi, toep->l2te);
+ break;
}
OPCODE_TID(cpl) = htobe32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ,
qid_atid));
diff --git a/sys/dev/cxgbe/tom/t4_listen.c b/sys/dev/cxgbe/tom/t4_listen.c
index dc9d46f..2c2b427 100644
--- a/sys/dev/cxgbe/tom/t4_listen.c
+++ b/sys/dev/cxgbe/tom/t4_listen.c
@@ -695,7 +695,7 @@ t4_syncache_respond(struct toedev *tod, void *arg, struct mbuf *m)
synqe->iss = be32toh(th->th_seq);
synqe->ts = to.to_tsval;
- if (is_t5(sc)) {
+ if (chip_id(sc) >= CHELSIO_T5) {
struct cpl_t5_pass_accept_rpl *rpl5 = wrtod(wr);
rpl5->iss = th->th_seq;
@@ -1054,8 +1054,8 @@ calc_opt2p(struct adapter *sc, struct port_info *pi, int rxqid,
}
static void
-pass_accept_req_to_protohdrs(const struct mbuf *m, struct in_conninfo *inc,
- struct tcphdr *th)
+pass_accept_req_to_protohdrs(struct adapter *sc, const struct mbuf *m,
+ struct in_conninfo *inc, struct tcphdr *th)
{
const struct cpl_pass_accept_req *cpl = mtod(m, const void *);
const struct ether_header *eh;
@@ -1064,8 +1064,13 @@ pass_accept_req_to_protohdrs(const struct mbuf *m, struct in_conninfo *inc,
const struct tcphdr *tcp;
eh = (const void *)(cpl + 1);
- l3hdr = ((uintptr_t)eh + G_ETH_HDR_LEN(hlen));
- tcp = (const void *)(l3hdr + G_IP_HDR_LEN(hlen));
+ if (chip_id(sc) >= CHELSIO_T6) {
+ l3hdr = ((uintptr_t)eh + G_T6_ETH_HDR_LEN(hlen));
+ tcp = (const void *)(l3hdr + G_T6_IP_HDR_LEN(hlen));
+ } else {
+ l3hdr = ((uintptr_t)eh + G_ETH_HDR_LEN(hlen));
+ tcp = (const void *)(l3hdr + G_IP_HDR_LEN(hlen));
+ }
if (inc) {
bzero(inc, sizeof(*inc));
@@ -1243,7 +1248,7 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss_header *rss,
CTR4(KTR_CXGBE, "%s: stid %u, tid %u, lctx %p", __func__, stid, tid,
lctx);
- pass_accept_req_to_protohdrs(m, &inc, &th);
+ pass_accept_req_to_protohdrs(sc, m, &inc, &th);
t4opt_to_tcpopt(&cpl->tcpopt, &to);
pi = sc->port[G_SYN_INTF(be16toh(cpl->l2info))];
@@ -1482,14 +1487,14 @@ reject:
}
static void
-synqe_to_protohdrs(struct synq_entry *synqe,
+synqe_to_protohdrs(struct adapter *sc, struct synq_entry *synqe,
const struct cpl_pass_establish *cpl, struct in_conninfo *inc,
struct tcphdr *th, struct tcpopt *to)
{
uint16_t tcp_opt = be16toh(cpl->tcp_opt);
/* start off with the original SYN */
- pass_accept_req_to_protohdrs(synqe->syn, inc, th);
+ pass_accept_req_to_protohdrs(sc, synqe->syn, inc, th);
/* modify parts to make it look like the ACK to our SYN|ACK */
th->th_flags = TH_ACK;
@@ -1591,7 +1596,7 @@ reset:
KASSERT(so != NULL, ("%s: socket is NULL", __func__));
/* Come up with something that syncache_expand should be ok with. */
- synqe_to_protohdrs(synqe, cpl, &inc, &th, &to);
+ synqe_to_protohdrs(sc, synqe, cpl, &inc, &th, &to);
/*
* No more need for anything in the mbuf that carried the
diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c
index f07f05d..f62fcac 100644
--- a/sys/dev/cxgbe/tom/t4_tom.c
+++ b/sys/dev/cxgbe/tom/t4_tom.c
@@ -550,7 +550,6 @@ select_rcv_wscale(void)
}
extern int always_keepalive;
-#define VIID_SMACIDX(v) (((unsigned int)(v) & 0x7f) << 1)
/*
* socket so could be a listening socket too.
@@ -581,7 +580,7 @@ calc_opt0(struct socket *so, struct vi_info *vi, struct l2t_entry *e,
opt0 |= V_L2T_IDX(e->idx);
if (vi != NULL) {
- opt0 |= V_SMAC_SEL(VIID_SMACIDX(vi->viid));
+ opt0 |= V_SMAC_SEL(vi->smt_idx);
opt0 |= V_TX_CHAN(vi->pi->tx_chan);
}
OpenPOWER on IntegriCloud