Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Apr 2019 19:02:34 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
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
Message-ID:  <201904281902.x3SJ2YBa002647@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904281902.x3SJ2YBa002647>