From owner-svn-src-stable-11@freebsd.org Sun Apr 28 19:02:36 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10D051586C33; Sun, 28 Apr 2019 19:02:36 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A4F5171680; Sun, 28 Apr 2019 19:02:35 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7DAA3EE87; Sun, 28 Apr 2019 19:02:35 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x3SJ2Z8S002652; Sun, 28 Apr 2019 19:02:35 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x3SJ2YBa002647; Sun, 28 Apr 2019 19:02:34 GMT (envelope-from np@FreeBSD.org) Message-Id: <201904281902.x3SJ2YBa002647@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sun, 28 Apr 2019 19:02:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r346853 - in stable/11/sys/dev/cxgbe: . common tom X-SVN-Group: stable-11 X-SVN-Commit-Author: np X-SVN-Commit-Paths: in stable/11/sys/dev/cxgbe: . common tom X-SVN-Commit-Revision: 346853 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A4F5171680 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.95)[-0.954,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Apr 2019 19:02:36 -0000 Author: np Date: Sun Apr 28 19:02:34 2019 New Revision: 346853 URL: https://svnweb.freebsd.org/changeset/base/346853 Log: MFC r333121, r333128 r333121: cxgbe/t4_tom: Use appropriate macros instead of magic math while constructing the atid of an active open work request. Sponsored by: Chelsio Communications r333128: 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: stable/11/sys/dev/cxgbe/common/t4_msg.h stable/11/sys/dev/cxgbe/offload.h stable/11/sys/dev/cxgbe/t4_main.c stable/11/sys/dev/cxgbe/t4_sge.c stable/11/sys/dev/cxgbe/tom/t4_connect.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/cxgbe/common/t4_msg.h ============================================================================== --- stable/11/sys/dev/cxgbe/common/t4_msg.h Sun Apr 28 18:50:25 2019 (r346852) +++ stable/11/sys/dev/cxgbe/common/t4_msg.h Sun Apr 28 19:02:34 2019 (r346853) @@ -306,9 +306,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: stable/11/sys/dev/cxgbe/offload.h ============================================================================== --- stable/11/sys/dev/cxgbe/offload.h Sun Apr 28 18:50:25 2019 (r346852) +++ stable/11/sys/dev/cxgbe/offload.h Sun Apr 28 19:02:34 2019 (r346853) @@ -64,9 +64,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: stable/11/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/11/sys/dev/cxgbe/t4_main.c Sun Apr 28 18:50:25 2019 (r346852) +++ stable/11/sys/dev/cxgbe/t4_main.c Sun Apr 28 19:02:34 2019 (r346853) @@ -2799,6 +2799,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: stable/11/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/11/sys/dev/cxgbe/t4_sge.c Sun Apr 28 18:50:25 2019 (r346852) +++ stable/11/sys/dev/cxgbe/t4_sge.c Sun Apr 28 19:02:34 2019 (r346853) @@ -298,6 +298,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) @@ -381,12 +382,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 @@ -405,6 +420,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: stable/11/sys/dev/cxgbe/tom/t4_connect.c ============================================================================== --- stable/11/sys/dev/cxgbe/tom/t4_connect.c Sun Apr 28 18:50:25 2019 (r346852) +++ stable/11/sys/dev/cxgbe/tom/t4_connect.c Sun Apr 28 19:02:34 2019 (r346853) @@ -279,7 +279,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 @@ -287,7 +288,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 { \ @@ -416,7 +417,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 = (toep->ofld_rxq->iq.abs_id << 14) | 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);