From owner-svn-src-head@freebsd.org Wed Oct 2 09:06:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1170F127D83; Wed, 2 Oct 2019 09:06:15 +0000 (UTC) (envelope-from hselasky@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 46jqxf6j2Dz43RY; Wed, 2 Oct 2019 09:06:14 +0000 (UTC) (envelope-from hselasky@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 ABFEC29377; Wed, 2 Oct 2019 09:06:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9296EHE092451; Wed, 2 Oct 2019 09:06:14 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9296Dr0092447; Wed, 2 Oct 2019 09:06:13 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910020906.x9296Dr0092447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 2 Oct 2019 09:06:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352955 - head/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Commit-Revision: 352955 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Oct 2019 09:06:15 -0000 Author: hselasky Date: Wed Oct 2 09:06:13 2019 New Revision: 352955 URL: https://svnweb.freebsd.org/changeset/base/352955 Log: Make sure the transmit loop doesn't get starved in ipoib. When the software send queue gets filled up, callbacks to if_transmit will stop. Make sure the transmit callback routine checks the send queue and outputs any remaining mbufs. Else the remaining mbufs may simply sit in the output queue blocking the transmit path. MFC after: 3 days Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Wed Oct 2 09:03:48 2019 (r352954) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Wed Oct 2 09:06:13 2019 (r352955) @@ -536,7 +536,7 @@ void ipoib_drain_cq(struct ipoib_dev_priv *priv); int ipoib_dma_map_tx(struct ib_device *ca, struct ipoib_tx_buf *tx_req, int max); void ipoib_dma_unmap_tx(struct ib_device *ca, struct ipoib_tx_buf *tx_req); -int ipoib_poll_tx(struct ipoib_dev_priv *priv); +int ipoib_poll_tx(struct ipoib_dev_priv *priv, bool do_start); void ipoib_dma_unmap_rx(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req); void ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int length); @@ -763,5 +763,7 @@ extern int ipoib_debug_level; #endif /* CONFIG_INFINIBAND_IPOIB_DEBUG_DATA */ #define IPOIB_QPN(ha) (be32_to_cpup((__be32 *) ha) & 0xffffff) + +void ipoib_start_locked(struct ifnet *, struct ipoib_dev_priv *); #endif /* _IPOIB_H */ Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c Wed Oct 2 09:03:48 2019 (r352954) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c Wed Oct 2 09:06:13 2019 (r352955) @@ -618,8 +618,10 @@ void ipoib_cm_send(struct ipoib_dev_priv *priv, struct struct ipoib_cm_tx_buf *tx_req; struct ifnet *dev = priv->dev; - if (unlikely(priv->tx_outstanding > MAX_SEND_CQE)) - while (ipoib_poll_tx(priv)); /* nothing */ + if (unlikely(priv->tx_outstanding > MAX_SEND_CQE)) { + while (ipoib_poll_tx(priv, false)) + ; /* nothing */ + } m_adj(mb, sizeof(struct ipoib_pseudoheader)); if (unlikely(mb->m_pkthdr.len > tx->mtu)) { Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Wed Oct 2 09:03:48 2019 (r352954) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Wed Oct 2 09:06:13 2019 (r352955) @@ -366,7 +366,7 @@ static void ipoib_ib_handle_tx_wc(struct ipoib_dev_pri } int -ipoib_poll_tx(struct ipoib_dev_priv *priv) +ipoib_poll_tx(struct ipoib_dev_priv *priv, bool do_start) { int n, i; @@ -379,6 +379,9 @@ ipoib_poll_tx(struct ipoib_dev_priv *priv) ipoib_ib_handle_tx_wc(priv, wc); } + if (do_start && n != 0) + ipoib_start_locked(priv->dev, priv); + return n == MAX_SEND_CQE; } @@ -425,7 +428,7 @@ static void drain_tx_cq(struct ipoib_dev_priv *priv) struct ifnet *dev = priv->dev; spin_lock(&priv->lock); - while (ipoib_poll_tx(priv)) + while (ipoib_poll_tx(priv, true)) ; /* nothing */ if (dev->if_drv_flags & IFF_DRV_OACTIVE) @@ -482,7 +485,7 @@ ipoib_send(struct ipoib_dev_priv *priv, struct mbuf *m void *phead; if (unlikely(priv->tx_outstanding > MAX_SEND_CQE)) - while (ipoib_poll_tx(priv)) + while (ipoib_poll_tx(priv, false)) ; /* nothing */ m_adj(mb, sizeof (struct ipoib_pseudoheader)); @@ -762,7 +765,7 @@ void ipoib_drain_cq(struct ipoib_dev_priv *priv) spin_unlock(&priv->drain_lock); spin_lock(&priv->lock); - while (ipoib_poll_tx(priv)) + while (ipoib_poll_tx(priv, true)) ; /* nothing */ spin_unlock(&priv->lock); Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Wed Oct 2 09:03:48 2019 (r352954) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Wed Oct 2 09:06:13 2019 (r352955) @@ -773,17 +773,13 @@ ipoib_send_one(struct ipoib_dev_priv *priv, struct mbu return 0; } - -static void -_ipoib_start(struct ifnet *dev, struct ipoib_dev_priv *priv) +void +ipoib_start_locked(struct ifnet *dev, struct ipoib_dev_priv *priv) { struct mbuf *mb; - if ((dev->if_drv_flags & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING) - return; + assert_spin_locked(&priv->lock); - spin_lock(&priv->lock); while (!IFQ_DRV_IS_EMPTY(&dev->if_snd) && (dev->if_drv_flags & IFF_DRV_OACTIVE) == 0) { IFQ_DRV_DEQUEUE(&dev->if_snd, mb); @@ -792,6 +788,18 @@ _ipoib_start(struct ifnet *dev, struct ipoib_dev_priv IPOIB_MTAP(dev, mb); ipoib_send_one(priv, mb); } +} + +static void +_ipoib_start(struct ifnet *dev, struct ipoib_dev_priv *priv) +{ + + if ((dev->if_drv_flags & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING) + return; + + spin_lock(&priv->lock); + ipoib_start_locked(dev, priv); spin_unlock(&priv->lock); }