Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Nov 2016 09:00:01 +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-10@freebsd.org
Subject:   svn commit: r308685 - stable/10/sys/dev/mlx5/mlx5_en
Message-ID:  <201611150900.uAF901nq066427@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Tue Nov 15 09:00:01 2016
New Revision: 308685
URL: https://svnweb.freebsd.org/changeset/base/308685

Log:
  MFC r308416:
  Add timer to watch the RQ when we are out of mbufs.
  
  The firmware/hardware does not generate additional completion
  events unless we post new buffers. Use a timer to try to post
  more buffers in case we are temporarily out of mbufs. Else
  the receive schedule completely stops.
  
  Sponsored by:	Mellanox Technologies

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/en.h
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_en/en.h
==============================================================================
--- stable/10/sys/dev/mlx5/mlx5_en/en.h	Tue Nov 15 08:58:51 2016	(r308684)
+++ stable/10/sys/dev/mlx5/mlx5_en/en.h	Tue Nov 15 09:00:01 2016	(r308685)
@@ -488,6 +488,7 @@ struct mlx5e_rq {
 	struct mlx5_wq_ctrl wq_ctrl;
 	u32	rqn;
 	struct mlx5e_channel *channel;
+	struct callout watchdog;
 } __aligned(MLX5E_CACHELINE_SIZE);
 
 struct mlx5e_sq_mbuf {

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==============================================================================
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Tue Nov 15 08:58:51 2016	(r308684)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Tue Nov 15 09:00:01 2016	(r308685)
@@ -861,7 +861,13 @@ err_destroy_rq:
 static void
 mlx5e_close_rq(struct mlx5e_rq *rq)
 {
+	mtx_lock(&rq->mtx);
 	rq->enabled = 0;
+	callout_stop(&rq->watchdog);
+	mtx_unlock(&rq->mtx);
+
+	callout_drain(&rq->watchdog);
+
 	mlx5e_modify_rq(rq, MLX5_RQC_STATE_RDY, MLX5_RQC_STATE_ERR);
 }
 
@@ -1445,6 +1451,8 @@ mlx5e_chan_mtx_init(struct mlx5e_channel
 
 	mtx_init(&c->rq.mtx, "mlx5rx", MTX_NETWORK_LOCK, MTX_DEF);
 
+	callout_init_mtx(&c->rq.watchdog, &c->rq.mtx, 0);
+
 	for (tc = 0; tc < c->num_tc; tc++) {
 		struct mlx5e_sq *sq = c->sq + tc;
 

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
==============================================================================
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c	Tue Nov 15 08:58:51 2016	(r308684)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c	Tue Nov 15 09:00:01 2016	(r308685)
@@ -82,9 +82,10 @@ mlx5e_post_rx_wqes(struct mlx5e_rq *rq)
 	while (!mlx5_wq_ll_is_full(&rq->wq)) {
 		struct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(&rq->wq, rq->wq.head);
 
-		if (unlikely(mlx5e_alloc_rx_wqe(rq, wqe, rq->wq.head)))
+		if (unlikely(mlx5e_alloc_rx_wqe(rq, wqe, rq->wq.head))) {
+			callout_reset_curcpu(&rq->watchdog, 1, (void *)&mlx5e_post_rx_wqes, rq);
 			break;
-
+		}
 		mlx5_wq_ll_push(&rq->wq, be16_to_cpu(wqe->next.next_wqe_index));
 	}
 



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