From nobody Fri Apr 21 10:11:28 2023 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 4Q2r0J5yH4z46CJT; Fri, 21 Apr 2023 10:11:28 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Q2r0J5Tv1z3Mtx; Fri, 21 Apr 2023 10:11:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682071888; 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=qyHUJhNQVcUATMAtNCrP7ogz3hITgzR/Q3HbtxyzOAc=; b=sD9kEDQLoyr2sJO5rW77pxSudQuehvQ+VwsDsJrRcYgqYD/LMK7QCjaXtsZO84bjtCTPhx HYIcpg7FMhWOQ8mCT9JjNuJ3nOWcrPd0/niYKn3n5gOWnqbXr4ysO91n3XNrIHHF5pa1zu MXkh55ONWgHrA0mm78Uhzq/uIN5keLNfX5bboe8/Gr4fMdaLsFZ59FdvNFkYKleoLnOkMl ivkS/ODS9zCMDEyb6sUAhCyQTX36e5u3RXKXGHZnhAEfKc8322hxSwDycHy7iI6dCs9kQ/ KVrQ/C7oFykWXAugJtyJF27pCN11vIAqLn1eSBKj9RF4sVoHiATos5GtL3g/pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682071888; 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=qyHUJhNQVcUATMAtNCrP7ogz3hITgzR/Q3HbtxyzOAc=; b=ApbrLzi4yiYzEPPZX4f6dx1LZk13ajC+JLOLz9TzonFrUhlkHQHlUfk3p0L91T1CZna+N4 2L8VQIvI5UXinTuxaKBGSACEMn1ajOfzcM1dDUsjCOm1Cuyvx+q/iqfn+Y2+PxiYDjFkYN PSLTUjlTOg/CrOJsEV6mWb9A7lQULAvipvxVFxE61CdZl0fjUr8ocl09fm0yal+4lIVWmd SfdoV+As2AbqW6sYb4eYdcLmnPiJEzgIrpvFEkGCA1wXvKE0+cjPH0FMPUdSKHat8EU9TV qxyZHDi/GvvaInWHUz43H41h7EQfsRDB3q2WA1FXzMbU2YitEtVKIc9/J9EhZg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1682071888; a=rsa-sha256; cv=none; b=ZFmK71tX8zer/FmLRMT65HbrXVMiVoauWvajNjB5JWLfLqFspPQ4XiCIx8oy/rXLFBxLcb HkhN8d1tIFEVyLnZRYmyZfjVcSpwGO+jPKKd3JZso6EKleHeOgxNIJzAFirFGViy3Bvq+A odpcqPX8QfULDEEWXTjSlnmdUCM5o6K75w0hUusjejoqK8V7g3AOXDYKUjX2Q11HcPn1tl 0Zmj+n2T9KMCFVlyymuUqr33CjQqDrkyQ6A7RfNnlzE/bpcD3ZhC3rDIxO4SqBGti2Yx3L AcaaBCjJsdeMIjZ+11mD+VxqeM7VX0pNXVDHEW1u0dETEn/jQ8I58zkzoeSkVQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Q2r0J4Y8szGW3; Fri, 21 Apr 2023 10:11:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 33LABSxx020329; Fri, 21 Apr 2023 10:11:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33LABS3I020328; Fri, 21 Apr 2023 10:11:28 GMT (envelope-from git) Date: Fri, 21 Apr 2023 10:11:28 GMT Message-Id: <202304211011.33LABS3I020328@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: e74e0dc9b018 - stable/13 - infiniband: Opt-in for net epoch 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e74e0dc9b0185e3b87a9b62161406af74cd0a56c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=e74e0dc9b0185e3b87a9b62161406af74cd0a56c commit e74e0dc9b0185e3b87a9b62161406af74cd0a56c Author: Zhenlei Huang AuthorDate: 2023-04-05 16:05:02 +0000 Commit: Zhenlei Huang CommitDate: 2023-04-21 10:10:11 +0000 infiniband: Opt-in for net epoch This is counterpart to e87c4940156c, which did the same for ethernet. Suggested by: hselasky Reviewed by: hselasky, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D39405 (cherry picked from commit fc6c93b6a5cf14cbc099f550f745d63779499fec) --- sys/net/if_infiniband.c | 9 +++++++-- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h | 2 +- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c | 6 ++++-- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_vlan.c | 2 +- sys/ofed/include/rdma/ib_verbs.h | 1 + 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/sys/net/if_infiniband.c b/sys/net/if_infiniband.c index 9bf4756f2556..fc8ce08e0260 100644 --- a/sys/net/if_infiniband.c +++ b/sys/net/if_infiniband.c @@ -409,9 +409,13 @@ infiniband_input(struct ifnet *ifp, struct mbuf *m) struct infiniband_header *ibh; struct epoch_tracker et; int isr; + bool needs_epoch; + + needs_epoch = (ifp->if_flags & IFF_KNOWSEPOCH) == 0; CURVNET_SET_QUIET(ifp->if_vnet); - NET_EPOCH_ENTER(et); + if (__predict_false(needs_epoch)) + NET_EPOCH_ENTER(et); if ((ifp->if_flags & IFF_UP) == 0) { if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); @@ -501,7 +505,8 @@ infiniband_input(struct ifnet *ifp, struct mbuf *m) /* Allow monitor mode to claim this frame, after stats are updated. */ netisr_dispatch(isr, m); done: - NET_EPOCH_EXIT(et); + if (__predict_false(needs_epoch)) + NET_EPOCH_EXIT(et); CURVNET_RESTORE(); } diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h index eb1cb87dc888..2c63b8e0117c 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h @@ -459,7 +459,7 @@ void ipoib_reap_ah(struct work_struct *work); void ipoib_mark_paths_invalid(struct ipoib_dev_priv *priv); void ipoib_flush_paths(struct ipoib_dev_priv *priv); -struct ipoib_dev_priv *ipoib_intf_alloc(const char *format); +struct ipoib_dev_priv *ipoib_intf_alloc(const char *format, struct ib_device *ca); int ipoib_ib_dev_init(struct ipoib_dev_priv *priv, struct ib_device *ca, int port); diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c index 0982af9fb904..a1a457804169 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -902,7 +902,7 @@ ipoib_priv_alloc(void) } struct ipoib_dev_priv * -ipoib_intf_alloc(const char *name) +ipoib_intf_alloc(const char *name, struct ib_device *hca) { struct ipoib_dev_priv *priv; struct ifnet *dev; @@ -923,6 +923,8 @@ ipoib_intf_alloc(const char *name) } if_initname(dev, name, priv->unit); dev->if_flags = IFF_BROADCAST | IFF_MULTICAST; + if (hca->attrs.device_cap_flags & IB_DEVICE_KNOWSEPOCH) + dev->if_flags |= IFF_KNOWSEPOCH; infiniband_ifattach(priv->dev, NULL, priv->broadcastaddr); @@ -977,7 +979,7 @@ ipoib_add_port(const char *format, struct ib_device *hca, u8 port) struct ib_port_attr attr; int result = -ENOMEM; - priv = ipoib_intf_alloc(format); + priv = ipoib_intf_alloc(format, hca); if (!priv) goto alloc_mem_failed; diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_vlan.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_vlan.c index 1ea5cdb1a319..0256c3ee06c9 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_vlan.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_vlan.c @@ -89,7 +89,7 @@ int ipoib_vlan_add(struct ifnet *pdev, unsigned short pkey) snprintf(intf_name, sizeof intf_name, "%s.%04x", ppriv->dev->name, pkey); - priv = ipoib_intf_alloc(intf_name); + priv = ipoib_intf_alloc(intf_name, ppriv->ca); if (!priv) { result = -ENOMEM; goto err; diff --git a/sys/ofed/include/rdma/ib_verbs.h b/sys/ofed/include/rdma/ib_verbs.h index 697dc3fbc98f..21ccfa6b08ad 100644 --- a/sys/ofed/include/rdma/ib_verbs.h +++ b/sys/ofed/include/rdma/ib_verbs.h @@ -229,6 +229,7 @@ enum ib_device_cap_flags { IB_DEVICE_SG_GAPS_REG = (1ULL << 32), IB_DEVICE_VIRTUAL_FUNCTION = (1ULL << 33), IB_DEVICE_RAW_SCATTER_FCS = (1ULL << 34), + IB_DEVICE_KNOWSEPOCH = (1ULL << 35), }; enum ib_signature_prot_cap {