diff options
-rw-r--r-- | sys/dev/cxgbe/adapter.h | 1 | ||||
-rw-r--r-- | sys/dev/cxgbe/t4_main.c | 8 | ||||
-rw-r--r-- | sys/dev/cxgbe/tom/t4_cpl_io.c | 53 | ||||
-rw-r--r-- | sys/dev/cxgbe/tom/t4_tom.h | 3 |
4 files changed, 60 insertions, 5 deletions
diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index b6bffda..2cd5226 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -744,6 +744,7 @@ void t4_iterate(void (*)(struct adapter *, void *), void *); int t4_register_cpl_handler(struct adapter *, int, cpl_handler_t); int t4_register_an_handler(struct adapter *, an_handler_t); int t4_register_fw_msg_handler(struct adapter *, int, fw_msg_handler_t); +int t4_filter_rpl(struct sge_iq *, const struct rss_header *, struct mbuf *); /* t4_sge.c */ void t4_sge_modload(void); diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index c09dc46..6cee055 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -346,8 +346,6 @@ static int del_filter(struct adapter *, struct t4_filter *); static void clear_filter(struct filter_entry *); static int set_filter_wr(struct adapter *, int); static int del_filter_wr(struct adapter *, int); -static int filter_rpl(struct sge_iq *, const struct rss_header *, - struct mbuf *); static int get_sge_context(struct adapter *, struct t4_sge_context *); static int read_card_mem(struct adapter *, struct t4_mem_range *); #ifdef TCP_OFFLOAD @@ -465,7 +463,7 @@ t4_attach(device_t dev) sc->cpl_handler[i] = cpl_not_handled; for (i = 0; i < ARRAY_SIZE(sc->fw_msg_handler); i++) sc->fw_msg_handler[i] = fw_msg_not_handled; - t4_register_cpl_handler(sc, CPL_SET_TCB_RPL, filter_rpl); + t4_register_cpl_handler(sc, CPL_SET_TCB_RPL, t4_filter_rpl); /* Prepare the adapter for operation */ rc = -t4_prep_adapter(sc); @@ -5000,8 +4998,8 @@ del_filter_wr(struct adapter *sc, int fidx) return (0); } -static int -filter_rpl(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) +int +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); diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index 2c1b752..384fc85 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -1262,6 +1262,51 @@ do_fw4_ack(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) return (0); } +static int +do_set_tcb_rpl(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) +{ + struct adapter *sc = iq->adapter; + const struct cpl_set_tcb_rpl *cpl = (const void *)(rss + 1); + unsigned int tid = GET_TID(cpl); +#ifdef INVARIANTS + unsigned int opcode = G_CPL_OPCODE(be32toh(OPCODE_TID(cpl))); +#endif + + KASSERT(opcode == CPL_SET_TCB_RPL, + ("%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) + return (t4_filter_rpl(iq, rss, m)); /* TCB is a filter */ + + CXGBE_UNIMPLEMENTED(__func__); +} + +void +t4_set_tcb_field(struct adapter *sc, struct toepcb *toep, uint16_t word, + uint64_t mask, uint64_t val) +{ + struct wrqe *wr; + struct cpl_set_tcb_field *req; + + wr = alloc_wrqe(sizeof(*req), toep->ctrlq); + if (wr == NULL) { + /* XXX */ + panic("%s: allocation failure.", __func__); + } + req = wrtod(wr); + + INIT_TP_WR_MIT_CPL(req, CPL_SET_TCB_FIELD, toep->tid); + req->reply_ctrl = htobe16(V_NO_REPLY(1) | + V_QUEUENO(toep->ofld_rxq->iq.abs_id)); + req->word_cookie = htobe16(V_WORD(word) | V_COOKIE(0)); + req->mask = htobe64(mask); + req->val = htobe64(val); + + t4_wrq_tx(sc, wr); +} + void t4_init_cpl_io_handlers(struct adapter *sc) { @@ -1272,5 +1317,13 @@ t4_init_cpl_io_handlers(struct adapter *sc) t4_register_cpl_handler(sc, CPL_ABORT_RPL_RSS, do_abort_rpl); t4_register_cpl_handler(sc, CPL_RX_DATA, do_rx_data); t4_register_cpl_handler(sc, CPL_FW4_ACK, do_fw4_ack); + t4_register_cpl_handler(sc, CPL_SET_TCB_RPL, do_set_tcb_rpl); +} + +void +t4_uninit_cpl_io_handlers(struct adapter *sc) +{ + + t4_register_cpl_handler(sc, CPL_SET_TCB_RPL, t4_filter_rpl); } #endif diff --git a/sys/dev/cxgbe/tom/t4_tom.h b/sys/dev/cxgbe/tom/t4_tom.h index 4e171e7..0078ada 100644 --- a/sys/dev/cxgbe/tom/t4_tom.h +++ b/sys/dev/cxgbe/tom/t4_tom.h @@ -236,6 +236,7 @@ void t4_offload_socket(struct toedev *, void *, struct socket *); /* t4_cpl_io.c */ void t4_init_cpl_io_handlers(struct adapter *); +void t4_uninit_cpl_io_handlers(struct adapter *); void send_abort_rpl(struct adapter *, struct sge_wrq *, int , int); void send_flowc_wr(struct toepcb *, struct flowc_tx_params *); void send_reset(struct adapter *, struct toepcb *, uint32_t); @@ -244,5 +245,7 @@ void t4_rcvd(struct toedev *, struct tcpcb *); int t4_tod_output(struct toedev *, struct tcpcb *); int t4_send_fin(struct toedev *, struct tcpcb *); int t4_send_rst(struct toedev *, struct tcpcb *); +void t4_set_tcb_field(struct adapter *, struct toepcb *, uint16_t, uint64_t, + uint64_t); #endif |