diff options
Diffstat (limited to 'sys/dev/cxgbe/tom')
-rw-r--r-- | sys/dev/cxgbe/tom/t4_connect.c | 49 | ||||
-rw-r--r-- | sys/dev/cxgbe/tom/t4_listen.c | 24 | ||||
-rw-r--r-- | sys/dev/cxgbe/tom/t4_tom.c | 85 | ||||
-rw-r--r-- | sys/dev/cxgbe/tom/t4_tom.h | 2 |
4 files changed, 102 insertions, 58 deletions
diff --git a/sys/dev/cxgbe/tom/t4_connect.c b/sys/dev/cxgbe/tom/t4_connect.c index ac48d31..08267cd 100644 --- a/sys/dev/cxgbe/tom/t4_connect.c +++ b/sys/dev/cxgbe/tom/t4_connect.c @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include "common/common.h" #include "common/t4_msg.h" #include "common/t4_regs.h" +#include "common/t4_regs_values.h" #include "tom/t4_tom_l2t.h" #include "tom/t4_tom.h" @@ -246,9 +247,12 @@ calc_opt2a(struct socket *so, struct toepcb *toep) /* RX_COALESCE is always a valid value (M_RX_COALESCE). */ if (is_t4(sc)) opt2 |= F_RX_COALESCE_VALID; - else + else { opt2 |= F_T5_OPT_2_VALID; - opt2 |= V_RX_COALESCE(M_RX_COALESCE); + opt2 |= F_CONG_CNTRL_VALID; /* OPT_2_ISS really, for T5 */ + } + if (sc->tt.rx_coalesce) + opt2 |= V_RX_COALESCE(M_RX_COALESCE); #ifdef USE_DDP_RX_FLOW_CONTROL if (toep->ulp_mode == ULP_MODE_TCPDDP) @@ -384,10 +388,18 @@ t4_connect(struct toedev *tod, struct socket *so, struct rtentry *rt, if (toep->ce == NULL) DONT_OFFLOAD_ACTIVE_OPEN(ENOENT); - INIT_TP_WR(cpl, 0); + if (is_t4(sc)) { + INIT_TP_WR(cpl, 0); + cpl->params = select_ntuple(pi, 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(pi, toep->l2te); + } OPCODE_TID(cpl) = htobe32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ6, qid_atid)); - cpl->local_port = inp->inp_lport; cpl->local_ip_hi = *(uint64_t *)&inp->in6p_laddr.s6_addr[0]; cpl->local_ip_lo = *(uint64_t *)&inp->in6p_laddr.s6_addr[8]; @@ -397,20 +409,19 @@ t4_connect(struct toedev *tod, struct socket *so, struct rtentry *rt, cpl->opt0 = calc_opt0(so, pi, toep->l2te, mtu_idx, rscale, toep->rx_credits, toep->ulp_mode); cpl->opt2 = calc_opt2a(so, toep); + } else { + struct cpl_act_open_req *cpl = wrtod(wr); + if (is_t4(sc)) { - cpl->params = select_ntuple(pi, toep->l2te, - sc->filter_mode); + INIT_TP_WR(cpl, 0); + cpl->params = select_ntuple(pi, toep->l2te); } else { - struct cpl_t5_act_open_req6 *c5 = (void *)cpl; + struct cpl_t5_act_open_req *c5 = (void *)cpl; - c5->rsvd = 0; - c5->params = select_ntuple(pi, toep->l2te, - sc->filter_mode); + INIT_TP_WR(c5, 0); + c5->iss = htobe32(tp->iss); + c5->params = select_ntuple(pi, toep->l2te); } - } else { - struct cpl_act_open_req *cpl = wrtod(wr); - - INIT_TP_WR(cpl, 0); OPCODE_TID(cpl) = htobe32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ, qid_atid)); inp_4tuple_get(inp, &cpl->local_ip, &cpl->local_port, @@ -418,16 +429,6 @@ t4_connect(struct toedev *tod, struct socket *so, struct rtentry *rt, cpl->opt0 = calc_opt0(so, pi, toep->l2te, mtu_idx, rscale, toep->rx_credits, toep->ulp_mode); cpl->opt2 = calc_opt2a(so, toep); - if (is_t4(sc)) { - cpl->params = select_ntuple(pi, toep->l2te, - sc->filter_mode); - } else { - struct cpl_t5_act_open_req6 *c5 = (void *)cpl; - - c5->rsvd = 0; - c5->params = select_ntuple(pi, toep->l2te, - sc->filter_mode); - } } CTR5(KTR_CXGBE, "%s: atid %u (%s), toep %p, inp %p", __func__, diff --git a/sys/dev/cxgbe/tom/t4_listen.c b/sys/dev/cxgbe/tom/t4_listen.c index 7db4126..9e1dc80 100644 --- a/sys/dev/cxgbe/tom/t4_listen.c +++ b/sys/dev/cxgbe/tom/t4_listen.c @@ -674,6 +674,12 @@ 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)) { + struct cpl_t5_pass_accept_rpl *rpl5 = wrtod(wr); + + rpl5->iss = th->th_seq; + } + e = &sc->l2t->l2tab[synqe->l2e_idx]; t4_l2t_send(sc, wr, e); @@ -1011,9 +1017,12 @@ calc_opt2p(struct adapter *sc, struct port_info *pi, int rxqid, /* RX_COALESCE is always a valid value (0 or M_RX_COALESCE). */ if (is_t4(sc)) opt2 |= F_RX_COALESCE_VALID; - else + else { opt2 |= F_T5_OPT_2_VALID; - opt2 |= V_RX_COALESCE(M_RX_COALESCE); + opt2 |= F_CONG_CNTRL_VALID; /* OPT_2_ISS really, for T5 */ + } + if (sc->tt.rx_coalesce) + opt2 |= V_RX_COALESCE(M_RX_COALESCE); #ifdef USE_DDP_RX_FLOW_CONTROL if (ulp_mode == ULP_MODE_TCPDDP) @@ -1287,7 +1296,8 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss_header *rss, if (synqe == NULL) REJECT_PASS_ACCEPT(); - wr = alloc_wrqe(sizeof(*rpl), &sc->sge.ctrlq[pi->port_id]); + wr = alloc_wrqe(is_t4(sc) ? sizeof(struct cpl_pass_accept_rpl) : + sizeof(struct cpl_t5_pass_accept_rpl), &sc->sge.ctrlq[pi->port_id]); if (wr == NULL) REJECT_PASS_ACCEPT(); rpl = wrtod(wr); @@ -1328,7 +1338,13 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss_header *rss, save_qids_in_mbuf(m, pi); get_qids_from_mbuf(m, NULL, &rxqid); - INIT_TP_WR_MIT_CPL(rpl, CPL_PASS_ACCEPT_RPL, tid); + if (is_t4(sc)) + INIT_TP_WR_MIT_CPL(rpl, CPL_PASS_ACCEPT_RPL, tid); + else { + struct cpl_t5_pass_accept_rpl *rpl5 = (void *)rpl; + + INIT_TP_WR_MIT_CPL(rpl5, CPL_PASS_ACCEPT_RPL, tid); + } if (sc->tt.ddp && (so->so_options & SO_NO_DDP) == 0) { ulp_mode = ULP_MODE_TCPDDP; synqe->flags |= TPF_SYNQE_TCPDDP; diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index a254253..671174d 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -58,6 +58,8 @@ __FBSDID("$FreeBSD$"); #include "common/common.h" #include "common/t4_msg.h" #include "common/t4_regs.h" +#include "common/t4_regs_values.h" +#include "common/t4_tcb.h" #include "tom/t4_tom_l2t.h" #include "tom/t4_tom.h" @@ -330,6 +332,30 @@ t4_pcb_detach(struct toedev *tod __unused, struct tcpcb *tp) } /* + * setsockopt handler. + */ +static void +t4_ctloutput(struct toedev *tod, struct tcpcb *tp, int dir, int name) +{ + struct adapter *sc = tod->tod_softc; + struct toepcb *toep = tp->t_toe; + + if (dir == SOPT_GET) + return; + + CTR4(KTR_CXGBE, "%s: tp %p, dir %u, name %u", __func__, tp, dir, name); + + switch (name) { + case TCP_NODELAY: + t4_set_tcb_field(sc, toep, 1, W_TCB_T_FLAGS, V_TF_NAGLE(1), + V_TF_NAGLE(tp->t_flags & TF_NODELAY ? 0 : 1)); + break; + default: + break; + } +} + +/* * The TOE driver will not receive any more CPLs for the tid associated with the * toepcb; release the hold on the inpcb. */ @@ -513,38 +539,38 @@ calc_opt0(struct socket *so, struct port_info *pi, struct l2t_entry *e, return htobe64(opt0); } -#define FILTER_SEL_WIDTH_P_FC (3 + 1) -#define FILTER_SEL_WIDTH_VIN_P_FC (6 + 7 + FILTER_SEL_WIDTH_P_FC) -#define FILTER_SEL_WIDTH_TAG_P_FC (3 + FILTER_SEL_WIDTH_VIN_P_FC) -#define FILTER_SEL_WIDTH_VLD_TAG_P_FC (1 + FILTER_SEL_WIDTH_TAG_P_FC) -#define VLAN_NONE 0xfff -#define FILTER_SEL_VLAN_NONE 0xffff - uint64_t -select_ntuple(struct port_info *pi, struct l2t_entry *e, uint32_t filter_mode) +select_ntuple(struct port_info *pi, struct l2t_entry *e) { + struct adapter *sc = pi->adapter; + struct tp_params *tp = &sc->params.tp; uint16_t viid = pi->viid; - uint32_t ntuple = 0; - - if (filter_mode == HW_TPL_FR_MT_PR_IV_P_FC) { - if (e->vlan == VLAN_NONE) - ntuple |= FILTER_SEL_VLAN_NONE << FILTER_SEL_WIDTH_P_FC; - else { - ntuple |= e->vlan << FILTER_SEL_WIDTH_P_FC; - ntuple |= 1 << FILTER_SEL_WIDTH_VLD_TAG_P_FC; - } - ntuple |= e->lport << S_PORT; - ntuple |= IPPROTO_TCP << FILTER_SEL_WIDTH_VLD_TAG_P_FC; - } else if (filter_mode == HW_TPL_FR_MT_PR_OV_P_FC) { - ntuple |= G_FW_VIID_VIN(viid) << FILTER_SEL_WIDTH_P_FC; - ntuple |= G_FW_VIID_PFN(viid) << FILTER_SEL_WIDTH_VIN_P_FC; - ntuple |= G_FW_VIID_VIVLD(viid) << FILTER_SEL_WIDTH_TAG_P_FC; - ntuple |= e->lport << S_PORT; - ntuple |= IPPROTO_TCP << FILTER_SEL_WIDTH_VLD_TAG_P_FC; - } - - if (is_t4(pi->adapter)) - return (htobe32(ntuple)); + uint64_t ntuple = 0; + + /* + * Initialize each of the fields which we care about which are present + * in the Compressed Filter Tuple. + */ + if (tp->vlan_shift >= 0 && e->vlan != CPL_L2T_VLAN_NONE) + ntuple |= (uint64_t)(F_FT_VLAN_VLD | e->vlan) << tp->vlan_shift; + + if (tp->port_shift >= 0) + ntuple |= (uint64_t)e->lport << tp->port_shift; + + if (tp->protocol_shift >= 0) + ntuple |= (uint64_t)IPPROTO_TCP << tp->protocol_shift; + + if (tp->vnic_shift >= 0) { + uint32_t vf = G_FW_VIID_VIN(viid); + uint32_t pf = G_FW_VIID_PFN(viid); + uint32_t vld = G_FW_VIID_VIVLD(viid); + + ntuple |= (uint64_t)(V_FT_VNID_ID_VF(vf) | V_FT_VNID_ID_PF(pf) | + V_FT_VNID_ID_VLD(vld)) << tp->vnic_shift; + } + + if (is_t4(sc)) + return (htobe32((uint32_t)ntuple)); else return (htobe64(V_FILTER_TUPLE(ntuple))); } @@ -945,6 +971,7 @@ t4_tom_activate(struct adapter *sc) tod->tod_syncache_removed = t4_syncache_removed; tod->tod_syncache_respond = t4_syncache_respond; tod->tod_offload_socket = t4_offload_socket; + tod->tod_ctloutput = t4_ctloutput; for_each_port(sc, i) TOEDEV(sc->port[i]->ifp) = &td->tod; diff --git a/sys/dev/cxgbe/tom/t4_tom.h b/sys/dev/cxgbe/tom/t4_tom.h index 4411a06..b86a76c 100644 --- a/sys/dev/cxgbe/tom/t4_tom.h +++ b/sys/dev/cxgbe/tom/t4_tom.h @@ -234,7 +234,7 @@ u_long select_rcv_wnd(struct socket *); int select_rcv_wscale(void); uint64_t calc_opt0(struct socket *, struct port_info *, struct l2t_entry *, int, int, int, int); -uint64_t select_ntuple(struct port_info *, struct l2t_entry *, uint32_t); +uint64_t select_ntuple(struct port_info *, struct l2t_entry *); void set_tcpddp_ulp_mode(struct toepcb *); int negative_advice(int); struct clip_entry *hold_lip(struct tom_data *, struct in6_addr *); |