From nobody Tue Sep 15 14:48:01 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hklHj6fvmz6sKg4 for ; Tue, 15 Sep 2026 14:48:01 +0000 (UTC) (envelope-from git@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) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hklHj4t3Sz4P8t for ; Tue, 15 Sep 2026 14:48:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789483681; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Lt/6Ki1xg9RFRWKeSJtK/ktxRSJpUi+sGbPK0QI41+I=; b=DvhvWtaY++WEzCZjoM3Ad3NKm46Tmwycf0K2awPX96MW/YcFivFeQyIpa3UBfP3xNn2rIE +0Fn6b9D5U9WYo9UzjHmwjIW7ByLfEAMdPSm0zuvEVW2lHJ+aLkiNlxJBrGKmg29BAxmNA 7hhS3O3B5FcFGQBO8FUjSlYIRUID0v3ZwpC8NQNgxmePLwd50Mh8gnHCBXmH3X+fZg7H1W lx1Hx1qrc/4aebUoTtP27M15gFY5rhGbneOGoeMKjBqlA12kaQBC29cNSe8soW0C83Vl7L R4Jz/TybfcsGzwuxsBwmxEjKRgVNwsOG1KtkGrXWmvX2to5j9xLTCWpQZlSI5w== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1789483681; b=WXfSMeBJy318Qfrbl0doXRJxXS2oNHjJc4zio5JdSuZVEhhNYukM5kVIpM51W9UL62DPOd aqvz3b27dvFahE8GlT0HLm/dsBOlb+DTLh+rHk4q3iFyt71T2ICzk04br/4d1kH2K/nfyc bgjeD8Cyf6oZPAYUfZUCLHMx/OWfz+srSt0CVWRPF3M9tvV2OaIZpr99E5GbBiBeErWapv gtH7UgkLY9VyHBcB6yu7//5H4pvRMvq5c+wsJiZgslrPpKeZKjJdCpHO/HSN64x46Z1mv7 vE1ENREIcIUM1jckYx4hhdxlat3Fs4puV18ai5jgSvGXIxP4essrWHPiR4F13g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789483681; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Lt/6Ki1xg9RFRWKeSJtK/ktxRSJpUi+sGbPK0QI41+I=; b=VRZvTh7OtrIcsKhK6687cXUkATlQmlTvId25pWi+qsYTNFFCFiiPh6sHjljozm0gxu3wEK uNAfw801VOlHUTjFf5/dANqRk1SiTXLpL4aTauN6MOKMETop7eI96yyOfGYfSiHMiYEXuI 6IoQI1AGoRdCLAepuvpgB/qT/MNWJALe4yRrLnzaW/IiYxIUSnKz84ac2RBQz3anVCUXlq a+IIkOkzG/lGvfrmZ7uHGbXxL35gqkJpftp5QS5Ch+f79vjyzYOCkXWH0k5Uupf+jbVUFC 0bXSIYMZPrGfOiBVro46Uf6XJRXnPUU655rfnCrTbu+4ykhNCvv0IF8fvYuwzQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hklHj3x8Xz14bY for ; Tue, 15 Sep 2026 14:48:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 38d00 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 15 Sep 2026 14:48:01 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 05057380ca39 - main - iw_cxgbe: Miscellaneous changes from the iw_cxgb4 driver List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 05057380ca392b29d33a4d362936e8af81101685 Auto-Submitted: auto-generated Date: Tue, 15 Sep 2026 14:48:01 +0000 Message-Id: <6aa95aa1.38d00.60dcaafb@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=05057380ca392b29d33a4d362936e8af81101685 commit 05057380ca392b29d33a4d362936e8af81101685 Author: John Baldwin AuthorDate: 2026-09-14 15:43:01 +0000 Commit: John Baldwin CommitDate: 2026-09-15 14:22:40 +0000 iw_cxgbe: Miscellaneous changes from the iw_cxgb4 driver These include changes to use newer APIs, cosmetic changes to reduce diffs between the two drivers, and other minor fixes. Sponsored by: Chelsio Communications Co-authored-by: Arjun V Co-authored-by: Krishnamraju Eraparaju Co-authored-by: Vishal Kulkarni --- sys/dev/cxgbe/iw_cxgbe/cm.c | 55 ++++++++++++++++++--------------------- sys/dev/cxgbe/iw_cxgbe/cq.c | 23 ++++++++-------- sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h | 1 - sys/dev/cxgbe/iw_cxgbe/provider.c | 7 +++-- sys/dev/cxgbe/iw_cxgbe/qp.c | 14 +++++----- sys/dev/cxgbe/iw_cxgbe/t4.h | 2 +- 6 files changed, 52 insertions(+), 50 deletions(-) diff --git a/sys/dev/cxgbe/iw_cxgbe/cm.c b/sys/dev/cxgbe/iw_cxgbe/cm.c index b77b5a44cab1..24e7c6fac979 100644 --- a/sys/dev/cxgbe/iw_cxgbe/cm.c +++ b/sys/dev/cxgbe/iw_cxgbe/cm.c @@ -107,7 +107,7 @@ static int process_mpa_request(struct c4iw_ep *ep); static void process_peer_close(struct c4iw_ep *ep); static void process_conn_error(struct c4iw_ep *ep); static void process_close_complete(struct c4iw_ep *ep); -static void ep_timeout(unsigned long arg); +static void ep_timeout(struct timer_list *t); static void setiwsockopt(struct socket *so); static void init_iwarp_socket(struct socket *so, void *arg); static void uninit_iwarp_socket(struct socket *so); @@ -183,15 +183,15 @@ static char *states[] = { static void deref_cm_id(struct c4iw_ep_common *epc) { - epc->cm_id->rem_ref(epc->cm_id); - epc->cm_id = NULL; - set_bit(CM_ID_DEREFED, &epc->history); + epc->cm_id->rem_ref(epc->cm_id); + epc->cm_id = NULL; + set_bit(CM_ID_DEREFED, &epc->history); } static void ref_cm_id(struct c4iw_ep_common *epc) { - set_bit(CM_ID_REFED, &epc->history); - epc->cm_id->add_ref(epc->cm_id); + set_bit(CM_ID_REFED, &epc->history); + epc->cm_id->add_ref(epc->cm_id); } static void deref_qp(struct c4iw_ep *ep) @@ -1009,7 +1009,7 @@ process_newconn(struct c4iw_listen_ep *master_lep, struct socket *new_so) GET_LOCAL_ADDR(&new_ep->com.local_addr, new_so); GET_REMOTE_ADDR(&new_ep->com.remote_addr, new_so); c4iw_get_ep(&real_lep->com); - init_timer(&new_ep->timer); + timer_setup(&new_ep->timer, ep_timeout, 0); new_ep->com.state = MPA_REQ_WAIT; setiwsockopt(new_so); @@ -1285,8 +1285,6 @@ start_ep_timer(struct c4iw_ep *ep) clear_bit(TIMEOUT, &ep->com.flags); c4iw_get_ep(&ep->com); ep->timer.expires = jiffies + ep_timeout_secs * HZ; - ep->timer.data = (unsigned long)ep; - ep->timer.function = ep_timeout; add_timer(&ep->timer); } @@ -2370,9 +2368,7 @@ int c4iw_reject_cr(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len) mutex_lock(&ep->com.mutex); CTR2(KTR_IW_CXGBE, "%s:crcB %p", __func__, ep); - if ((ep->com.state == DEAD) || - (ep->com.state != MPA_REQ_RCVD)) { - + if (ep->com.state != MPA_REQ_RCVD) { CTR2(KTR_IW_CXGBE, "%s:crc1 %p", __func__, ep); mutex_unlock(&ep->com.mutex); c4iw_put_ep(&ep->com); @@ -2390,13 +2386,14 @@ int c4iw_reject_cr(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len) CTR2(KTR_IW_CXGBE, "%s:crc3 %p", __func__, ep); abort = send_mpa_reject(ep, pdata, pdata_len); } + mutex_unlock(&ep->com.mutex); + STOP_EP_TIMER(ep); #ifdef KTR err = c4iw_ep_disconnect(ep, abort != 0, GFP_KERNEL); #else c4iw_ep_disconnect(ep, abort != 0, GFP_KERNEL); #endif - mutex_unlock(&ep->com.mutex); c4iw_put_ep(&ep->com); CTR3(KTR_IW_CXGBE, "%s:crc4 %p, err: %d", __func__, ep, err); return 0; @@ -2521,9 +2518,9 @@ err_defef_cm_id: err_abort: abort = 1; err_out: + mutex_unlock(&ep->com.mutex); if (abort) c4iw_ep_disconnect(ep, 1, GFP_KERNEL); - mutex_unlock(&ep->com.mutex); c4iw_put_ep(&ep->com); CTR2(KTR_IW_CXGBE, "%s:cacE err %p", __func__, ep); return err; @@ -2621,7 +2618,7 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) ep = alloc_ep(sizeof(*ep), GFP_KERNEL); cm_id->provider_data = ep; - init_timer(&ep->timer); + timer_setup(&ep->timer, ep_timeout, 0); ep->plen = conn_param->private_data_len; if (ep->plen) { @@ -2673,10 +2670,10 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) } ep->com.state = CONNECTING; ep->tos = 0; - ep->com.local_addr = cm_id->local_addr; - ep->com.remote_addr = cm_id->remote_addr; + ep->com.local_addr = cm_id->m_local_addr; + ep->com.remote_addr = cm_id->m_remote_addr; - err = c4iw_sock_create(&cm_id->local_addr, &ep->com.so); + err = c4iw_sock_create(&cm_id->m_local_addr, &ep->com.so); if (err) goto fail; @@ -2724,7 +2721,7 @@ c4iw_create_listen(struct iw_cm_id *cm_id, int backlog) ref_cm_id(&lep->com); lep->com.dev = dev; lep->backlog = backlog; - lep->com.local_addr = cm_id->local_addr; + lep->com.local_addr = cm_id->m_local_addr; lep->com.thread = curthread; cm_id->provider_data = lep; lep->com.state = LISTEN; @@ -2757,7 +2754,7 @@ c4iw_create_listen(struct iw_cm_id *cm_id, int backlog) goto out; } } - rc = c4iw_sock_create(&cm_id->local_addr, &lep->com.so); + rc = c4iw_sock_create(&cm_id->m_local_addr, &lep->com.so); if (rc) { CTR2(KTR_IW_CXGBE, "%s:Failed to create socket. err %d", __func__, rc); @@ -2958,9 +2955,9 @@ int c4iw_ep_redirect(void *ctx, struct dst_entry *old, struct dst_entry *new, -static void ep_timeout(unsigned long arg) +static void ep_timeout(struct timer_list *t) { - struct c4iw_ep *ep = (struct c4iw_ep *)arg; + struct c4iw_ep *ep = timer_container_of(ep, t, timer); if (!test_and_set_bit(TIMEOUT, &ep->com.flags)) { @@ -3010,19 +3007,19 @@ static int process_terminate(struct c4iw_ep *ep) { struct c4iw_qp_attributes attrs = {0}; + unsigned int tid = ep->hwtid; CTR2(KTR_IW_CXGBE, "%s:tB %p %d", __func__, ep); if (ep && ep->com.qp) { - - printk(KERN_WARNING MOD "TERM received tid %u qpid %u\n", - ep->hwtid, ep->com.qp->wq.sq.qid); + pr_warn("TERM received tid %u qpid %u\n", tid, + ep->com.qp->wq.sq.qid); attrs.next_state = C4IW_QP_STATE_TERMINATE; - c4iw_modify_qp(ep->com.dev, ep->com.qp, C4IW_QP_ATTR_NEXT_STATE, &attrs, - 1); + c4iw_modify_qp(ep->com.dev, ep->com.qp, C4IW_QP_ATTR_NEXT_STATE, + &attrs, 1); } else - printk(KERN_WARNING MOD "TERM received tid %u no ep/qp\n", - ep->hwtid); + pr_warn("TERM received tid %u no ep/qp\n", tid); + CTR2(KTR_IW_CXGBE, "%s:tE %p %d", __func__, ep); return 0; diff --git a/sys/dev/cxgbe/iw_cxgbe/cq.c b/sys/dev/cxgbe/iw_cxgbe/cq.c index e42b7861b7c8..fedb49dbea68 100644 --- a/sys/dev/cxgbe/iw_cxgbe/cq.c +++ b/sys/dev/cxgbe/iw_cxgbe/cq.c @@ -925,23 +925,22 @@ void c4iw_destroy_cq(struct ib_cq *ib_cq, struct ib_udata *udata) int c4iw_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, struct ib_udata *udata) { - struct ib_device *ibdev = ibcq->device; int entries = attr->cqe; int vector = attr->comp_vector; - struct c4iw_dev *rhp; + struct c4iw_dev *rhp = to_c4iw_dev(ibcq->device); struct c4iw_cq *chp = to_c4iw_cq(ibcq); struct c4iw_create_cq_resp uresp; - struct c4iw_ucontext *ucontext = NULL; int ret; size_t memsize, hwentries; struct c4iw_mm_entry *mm, *mm2; + struct c4iw_ucontext *ucontext = rdma_udata_to_drv_context( + udata, struct c4iw_ucontext, ibucontext); - CTR3(KTR_IW_CXGBE, "%s ib_dev %p entries %d", __func__, ibdev, entries); + CTR3(KTR_IW_CXGBE, "%s ib_dev %p entries %d", __func__, ibcq->device, + entries); if (attr->flags) return -EINVAL; - rhp = to_c4iw_dev(ibdev); - chp->wr_waitp = c4iw_alloc_wr_wait(GFP_KERNEL); if (!chp->wr_waitp) { return -ENOMEM; @@ -974,13 +973,14 @@ int c4iw_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, if (hwentries < 64) hwentries = 64; - memsize = hwentries * sizeof *chp->cq.queue; + memsize = hwentries * sizeof(*chp->cq.queue); /* * memsize must be a multiple of the page size if its a user cq. */ - if (ucontext) + if (udata) memsize = roundup(memsize, PAGE_SIZE); + chp->cq.size = hwentries; chp->cq.memsize = memsize; chp->cq.vector = vector; @@ -1004,10 +1004,10 @@ int c4iw_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, if (ucontext) { ret = -ENOMEM; - mm = kmalloc(sizeof *mm, GFP_KERNEL); + mm = kmalloc(sizeof(*mm), GFP_KERNEL); if (!mm) goto err_remove_handle; - mm2 = kmalloc(sizeof *mm2, GFP_KERNEL); + mm2 = kmalloc(sizeof(*mm2), GFP_KERNEL); if (!mm2) goto err_free_mm; @@ -1021,9 +1021,10 @@ int c4iw_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, ucontext->key += PAGE_SIZE; uresp.gts_key = ucontext->key; ucontext->key += PAGE_SIZE; + spin_unlock(&ucontext->mmap_lock); ret = ib_copy_to_udata(udata, &uresp, - sizeof(uresp) - sizeof(uresp.reserved)); + sizeof(uresp)); if (ret) goto err_free_mm2; diff --git a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h index ebe1b57f8660..21aba136787f 100644 --- a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h +++ b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h @@ -462,7 +462,6 @@ struct c4iw_qp { spinlock_t lock; struct mutex mutex; wait_queue_head_t wait; - struct timer_list timer; int sq_sig_all; struct c4iw_ucontext *ucontext; struct c4iw_wr_wait *wr_waitp; diff --git a/sys/dev/cxgbe/iw_cxgbe/provider.c b/sys/dev/cxgbe/iw_cxgbe/provider.c index 2a14a8985dc9..57de681c9160 100644 --- a/sys/dev/cxgbe/iw_cxgbe/provider.c +++ b/sys/dev/cxgbe/iw_cxgbe/provider.c @@ -130,9 +130,11 @@ static int c4iw_alloc_ucontext(struct ib_ucontext *ucontext, rhp->rdev.flags |= T4_STATUS_PAGE_DISABLED; } else { - mm = kmalloc(sizeof *mm, GFP_KERNEL); - if (!mm) + mm = kmalloc(sizeof(*mm), GFP_KERNEL); + if (!mm) { + ret = -ENOMEM; goto err; + } uresp.status_page_size = PAGE_SIZE; @@ -511,6 +513,7 @@ c4iw_register_device(struct c4iw_dev *dev) iwcm->get_qp = c4iw_get_qp; ibdev->iwcm = iwcm; + ibdev->ops.driver_id = RDMA_DRIVER_CXGB4; ret = ib_register_device(&dev->ibdev, NULL); if (ret) { kfree(iwcm); diff --git a/sys/dev/cxgbe/iw_cxgbe/qp.c b/sys/dev/cxgbe/iw_cxgbe/qp.c index 8ed3a47e495e..3ece4b023272 100644 --- a/sys/dev/cxgbe/iw_cxgbe/qp.c +++ b/sys/dev/cxgbe/iw_cxgbe/qp.c @@ -522,7 +522,7 @@ static int build_rdma_write(struct t4_sq *sq, union t4_wr *wqe, } static void build_immd_cmpl(struct t4_sq *sq, struct fw_ri_immd_cmpl *immdp, - struct ib_send_wr *wr) + const struct ib_send_wr *wr) { memcpy((u8 *)immdp->data, (u8 *)(uintptr_t)wr->sg_list->addr, 16); memset(immdp->r1, 0, 6); @@ -677,7 +677,8 @@ static int ib_to_fw_opcode(int ib_opcode) return opcode; } -static int complete_sq_drain_wr(struct c4iw_qp *qhp, const struct ib_send_wr *wr) +static int complete_sq_drain_wr(struct c4iw_qp *qhp, + const struct ib_send_wr *wr) { struct t4_cqe cqe = {}; struct c4iw_cq *schp; @@ -730,7 +731,8 @@ static int complete_sq_drain_wrs(struct c4iw_qp *qhp, const struct ib_send_wr *w return ret; } -static void complete_rq_drain_wr(struct c4iw_qp *qhp, const struct ib_recv_wr *wr) +static void complete_rq_drain_wr(struct c4iw_qp *qhp, + const struct ib_recv_wr *wr) { struct t4_cqe cqe = {}; struct c4iw_cq *rchp; @@ -761,7 +763,8 @@ static void complete_rq_drain_wr(struct c4iw_qp *qhp, const struct ib_recv_wr *w spin_unlock_irqrestore(&rchp->comp_handler_lock, flag); } -static void complete_rq_drain_wrs(struct c4iw_qp *qhp, const struct ib_recv_wr *wr) +static void complete_rq_drain_wrs(struct c4iw_qp *qhp, + const struct ib_recv_wr *wr) { while (wr) { complete_rq_drain_wr(qhp, wr); @@ -2113,7 +2116,6 @@ c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs, qhp->ucontext = ucontext; } qhp->ibqp.qp_num = qhp->wq.sq.qid; - init_timer(&(qhp->timer)); CTR5(KTR_IW_CXGBE, "%s sq id %u size %u memsize %zu num_entries %u", __func__, qhp->wq.sq.qid, @@ -2198,7 +2200,7 @@ int c4iw_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, init_attr->cap.max_send_wr = qhp->attr.sq_num_entries; init_attr->cap.max_recv_wr = qhp->attr.rq_num_entries; init_attr->cap.max_send_sge = qhp->attr.sq_max_sges; - init_attr->cap.max_recv_sge = qhp->attr.sq_max_sges; + init_attr->cap.max_recv_sge = qhp->attr.rq_max_sges; init_attr->cap.max_inline_data = T4_MAX_SEND_INLINE; init_attr->sq_sig_type = qhp->sq_sig_all ? IB_SIGNAL_ALL_WR : 0; return 0; diff --git a/sys/dev/cxgbe/iw_cxgbe/t4.h b/sys/dev/cxgbe/iw_cxgbe/t4.h index 67efd3effe4b..742956ff772c 100644 --- a/sys/dev/cxgbe/iw_cxgbe/t4.h +++ b/sys/dev/cxgbe/iw_cxgbe/t4.h @@ -311,7 +311,7 @@ struct t4_swsqe { int signaled; u16 idx; int flushed; - struct timespec host_ts; + ktime_t host_time; u64 sge_ts; };