Date: Mon, 30 Apr 2018 21:47:31 +0000 (UTC) From: Navdeep Parhar <np@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333128 - in head/sys/dev/cxgbe: . common tom Message-ID: <201804302147.w3ULlVWV050990@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: np Date: Mon Apr 30 21:47:30 2018 New Revision: 333128 URL: https://svnweb.freebsd.org/changeset/base/333128 Log: cxgbe(4): Convert ACT_OPEN_RPL to a shared CPL. Reserve 3b in the 14b atid to identify the owner and use it to dispatch the CPL. This allows all CPLs that use an atid to be used as shared CPLs, although ACT_OPEN_RPL is the only one being converted in this revision. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/t4_msg.h head/sys/dev/cxgbe/offload.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sge.c head/sys/dev/cxgbe/tom/t4_connect.c Modified: head/sys/dev/cxgbe/common/t4_msg.h ============================================================================== --- head/sys/dev/cxgbe/common/t4_msg.h Mon Apr 30 21:28:10 2018 (r333127) +++ head/sys/dev/cxgbe/common/t4_msg.h Mon Apr 30 21:47:30 2018 (r333128) @@ -308,9 +308,14 @@ union opcode_tid { /* partitioning of TID fields that also carry a queue id */ #define S_TID_TID 0 -#define M_TID_TID 0x3fff +#define M_TID_TID 0x7ff #define V_TID_TID(x) ((x) << S_TID_TID) #define G_TID_TID(x) (((x) >> S_TID_TID) & M_TID_TID) + +#define S_TID_COOKIE 11 +#define M_TID_COOKIE 0x7 +#define V_TID_COOKIE(x) ((x) << S_TID_COOKIE) +#define G_TID_COOKIE(x) (((x) >> S_TID_COOKIE) & M_TID_COOKIE) #define S_TID_QID 14 #define M_TID_QID 0x3ff Modified: head/sys/dev/cxgbe/offload.h ============================================================================== --- head/sys/dev/cxgbe/offload.h Mon Apr 30 21:28:10 2018 (r333127) +++ head/sys/dev/cxgbe/offload.h Mon Apr 30 21:47:30 2018 (r333128) @@ -66,9 +66,10 @@ struct stid_region { }; /* - * Max # of ATIDs. The absolute HW max is 16K but we keep it lower. + * Max # of ATIDs. The absolute HW max is 14b (enough for 16K) but we reserve + * the upper 3b for use as a cookie to demux the reply. */ -#define MAX_ATIDS 8192U +#define MAX_ATIDS 2048U union aopen_entry { void *data; Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Mon Apr 30 21:28:10 2018 (r333127) +++ head/sys/dev/cxgbe/t4_main.c Mon Apr 30 21:47:30 2018 (r333128) @@ -2504,6 +2504,7 @@ alloc_atid(struct adapter *sc, void *ctx) union aopen_entry *p = t->afree; atid = p - t->atid_tab; + MPASS(atid <= M_TID_TID); t->afree = p->next; p->data = ctx; t->atids_in_use++; Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Mon Apr 30 21:28:10 2018 (r333127) +++ head/sys/dev/cxgbe/t4_sge.c Mon Apr 30 21:47:30 2018 (r333128) @@ -287,6 +287,7 @@ fw_msg_handler_t t4_fw_msg_handler[NUM_FW6_TYPES]; cpl_handler_t t4_cpl_handler[NUM_CPL_CMDS]; cpl_handler_t set_tcb_rpl_handlers[NUM_CPL_COOKIES]; cpl_handler_t l2t_write_rpl_handlers[NUM_CPL_COOKIES]; +cpl_handler_t act_open_rpl_handlers[NUM_CPL_COOKIES]; void t4_register_an_handler(an_handler_t h) @@ -370,12 +371,26 @@ l2t_write_rpl_handler(struct sge_iq *iq, const struct return (l2t_write_rpl_handlers[cookie](iq, rss, m)); } +static int +act_open_rpl_handler(struct sge_iq *iq, const struct rss_header *rss, + struct mbuf *m) +{ + const struct cpl_act_open_rpl *cpl = (const void *)(rss + 1); + u_int cookie = G_TID_COOKIE(G_AOPEN_ATID(be32toh(cpl->atid_status))); + + MPASS(m == NULL); + MPASS(cookie != CPL_COOKIE_RESERVED); + + return (act_open_rpl_handlers[cookie](iq, rss, m)); +} + static void t4_init_shared_cpl_handlers(void) { t4_register_cpl_handler(CPL_SET_TCB_RPL, set_tcb_rpl_handler); t4_register_cpl_handler(CPL_L2T_WRITE_RPL, l2t_write_rpl_handler); + t4_register_cpl_handler(CPL_ACT_OPEN_RPL, act_open_rpl_handler); } void @@ -394,6 +409,9 @@ t4_register_shared_cpl_handler(int opcode, cpl_handler break; case CPL_L2T_WRITE_RPL: loc = (uintptr_t *)&l2t_write_rpl_handlers[cookie]; + break; + case CPL_ACT_OPEN_RPL: + loc = (uintptr_t *)&act_open_rpl_handlers[cookie]; break; default: MPASS(0); Modified: head/sys/dev/cxgbe/tom/t4_connect.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_connect.c Mon Apr 30 21:28:10 2018 (r333127) +++ head/sys/dev/cxgbe/tom/t4_connect.c Mon Apr 30 21:47:30 2018 (r333128) @@ -281,7 +281,8 @@ t4_init_connect_cpl_handlers(void) { t4_register_cpl_handler(CPL_ACT_ESTABLISH, do_act_establish); - t4_register_cpl_handler(CPL_ACT_OPEN_RPL, do_act_open_rpl); + t4_register_shared_cpl_handler(CPL_ACT_OPEN_RPL, do_act_open_rpl, + CPL_COOKIE_TOM); } void @@ -289,7 +290,7 @@ t4_uninit_connect_cpl_handlers(void) { t4_register_cpl_handler(CPL_ACT_ESTABLISH, NULL); - t4_register_cpl_handler(CPL_ACT_OPEN_RPL, NULL); + t4_register_shared_cpl_handler(CPL_ACT_OPEN_RPL, NULL, CPL_COOKIE_TOM); } #define DONT_OFFLOAD_ACTIVE_OPEN(x) do { \ @@ -418,7 +419,8 @@ t4_connect(struct toedev *tod, struct socket *so, stru else rscale = 0; mtu_idx = find_best_mtu_idx(sc, &inp->inp_inc, &settings); - qid_atid = V_TID_QID(toep->ofld_rxq->iq.abs_id) | V_TID_TID(toep->tid); + qid_atid = V_TID_QID(toep->ofld_rxq->iq.abs_id) | V_TID_TID(toep->tid) | + V_TID_COOKIE(CPL_COOKIE_TOM); if (isipv6) { struct cpl_act_open_req6 *cpl = wrtod(wr);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804302147.w3ULlVWV050990>