Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Oct 2019 08:31:31 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r353182 - stable/12/sys/ofed/drivers/infiniband/ulp/ipoib
Message-ID:  <201910070831.x978VVDU049100@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Mon Oct  7 08:31:31 2019
New Revision: 353182
URL: https://svnweb.freebsd.org/changeset/base/353182

Log:
  MFC r352955:
  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.
  
  Sponsored by:	Mellanox Technologies

Modified:
  stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h
  stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c
  stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c
  stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h
==============================================================================
--- stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h	Mon Oct  7 08:28:55 2019	(r353181)
+++ stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h	Mon Oct  7 08:31:31 2019	(r353182)
@@ -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: stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c
==============================================================================
--- stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c	Mon Oct  7 08:28:55 2019	(r353181)
+++ stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c	Mon Oct  7 08:31:31 2019	(r353182)
@@ -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: stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c
==============================================================================
--- stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c	Mon Oct  7 08:28:55 2019	(r353181)
+++ stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c	Mon Oct  7 08:31:31 2019	(r353182)
@@ -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: stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
==============================================================================
--- stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c	Mon Oct  7 08:28:55 2019	(r353181)
+++ stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c	Mon Oct  7 08:31:31 2019	(r353182)
@@ -772,17 +772,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);
@@ -791,6 +787,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);
 }
 



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