From owner-svn-src-all@freebsd.org Tue Nov 15 08:54:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C244C431FB; Tue, 15 Nov 2016 08:54:06 +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 mx1.freebsd.org (Postfix) with ESMTPS id 26371270; Tue, 15 Nov 2016 08:54:05 +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 uAF8s4Eh065793; Tue, 15 Nov 2016 08:54:04 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAF8s41U065790; Tue, 15 Nov 2016 08:54:04 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611150854.uAF8s41U065790@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 15 Nov 2016 08:54:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308679 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Nov 2016 08:54:06 -0000 Author: hselasky Date: Tue Nov 15 08:54:03 2016 New Revision: 308679 URL: https://svnweb.freebsd.org/changeset/base/308679 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/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/en.h Tue Nov 15 08:53:25 2016 (r308678) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Tue Nov 15 08:54:03 2016 (r308679) @@ -478,6 +478,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/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Tue Nov 15 08:53:25 2016 (r308678) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Tue Nov 15 08:54:03 2016 (r308679) @@ -855,7 +855,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); } @@ -1439,6 +1445,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/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Tue Nov 15 08:53:25 2016 (r308678) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Tue Nov 15 08:54:03 2016 (r308679) @@ -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)); }