summaryrefslogtreecommitdiffstats
path: root/sys/dev/cxgbe/tom/t4_connect.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/cxgbe/tom/t4_connect.c')
-rw-r--r--sys/dev/cxgbe/tom/t4_connect.c82
1 files changed, 51 insertions, 31 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));
OpenPOWER on IntegriCloud