cxgbe/t4_tom: Update the active/passive open code to support T6. Data
path works as-is. Sponsored by: Chelsio Communications
This commit is contained in:
parent
af6c079074
commit
980001c2bf
@ -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));
|
||||
|
@ -694,7 +694,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;
|
||||
@ -1053,8 +1053,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;
|
||||
@ -1063,8 +1063,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));
|
||||
@ -1188,7 +1193,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))];
|
||||
@ -1427,14 +1432,14 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss_header *rss,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -1536,7 +1541,7 @@ do_pass_establish(struct sge_iq *iq, const struct rss_header *rss,
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user