From owner-svn-src-all@freebsd.org Tue Oct 20 19:21:02 2015 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 89556A1881F; Tue, 20 Oct 2015 19:21:02 +0000 (UTC) (envelope-from cem@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 4A36A1037; Tue, 20 Oct 2015 19:21:02 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9KJL1SB037998; Tue, 20 Oct 2015 19:21:01 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9KJL1Hx037997; Tue, 20 Oct 2015 19:21:01 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201510201921.t9KJL1Hx037997@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 20 Oct 2015 19:21:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r289653 - head/sys/dev/ntb/if_ntb X-SVN-Group: head 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.20 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, 20 Oct 2015 19:21:02 -0000 Author: cem Date: Tue Oct 20 19:21:01 2015 New Revision: 289653 URL: https://svnweb.freebsd.org/changeset/base/289653 Log: if_ntb: Diff-reduce with Linux; add queue index type Add ntb_q_idx_t so it is more clear which struct members are of the same type (some bogus uint64_ts snuck in that should have been unsigned int). Add tx_err_no_buf and s/ENOMEM/EBUSY/ in tx_enqueue to match Linux. Sponsored by: EMC / Isilon Storage Division Modified: head/sys/dev/ntb/if_ntb/if_ntb.c Modified: head/sys/dev/ntb/if_ntb/if_ntb.c ============================================================================== --- head/sys/dev/ntb/if_ntb/if_ntb.c Tue Oct 20 19:20:52 2015 (r289652) +++ head/sys/dev/ntb/if_ntb/if_ntb.c Tue Oct 20 19:21:01 2015 (r289653) @@ -105,6 +105,8 @@ SYSCTL_UINT(_hw_ntb, OID_AUTO, max_num_c STAILQ_HEAD(ntb_queue_list, ntb_queue_entry); +typedef unsigned ntb_q_idx_t; + struct ntb_queue_entry { /* ntb_queue list reference */ STAILQ_ENTRY(ntb_queue_entry) entry; @@ -117,11 +119,11 @@ struct ntb_queue_entry { struct ntb_transport_qp *qp; struct ntb_payload_header *x_hdr; - unsigned index; + ntb_q_idx_t index; }; struct ntb_rx_info { - unsigned int entry; + ntb_q_idx_t entry; }; struct ntb_transport_qp { @@ -143,8 +145,8 @@ struct ntb_transport_qp { struct mtx ntb_tx_free_q_lock; void *tx_mw; bus_addr_t tx_mw_phys; - uint64_t tx_index; - uint64_t tx_max_entry; + ntb_q_idx_t tx_index; + ntb_q_idx_t tx_max_entry; uint64_t tx_max_frame; void (*rx_handler)(struct ntb_transport_qp *qp, void *qp_data, @@ -157,8 +159,8 @@ struct ntb_transport_qp { struct task rx_completion_task; struct task rxc_db_work; void *rx_buff; - uint64_t rx_index; - uint64_t rx_max_entry; + ntb_q_idx_t rx_index; + ntb_q_idx_t rx_max_entry; uint64_t rx_max_frame; void (*event_handler)(void *data, enum ntb_link_event status); @@ -178,6 +180,7 @@ struct ntb_transport_qp { uint64_t tx_bytes; uint64_t tx_pkts; uint64_t tx_ring_full; + uint64_t tx_err_no_buf; }; struct ntb_queue_handlers { @@ -842,7 +845,8 @@ ntb_transport_tx_enqueue(struct ntb_tran entry = ntb_list_rm(&qp->ntb_tx_free_q_lock, &qp->tx_free_q); if (entry == NULL) { CTR0(KTR_NTB, "TX: could not get entry from tx_free_q"); - return (ENOMEM); + qp->tx_err_no_buf++; + return (EBUSY); } CTR1(KTR_NTB, "TX: got entry %p from tx_free_q", entry); @@ -961,7 +965,7 @@ static void ntb_transport_rxc_db(void *arg, int pending __unused) { struct ntb_transport_qp *qp = arg; - uint64_t i; + ntb_q_idx_t i; int rc; /* @@ -1346,7 +1350,7 @@ ntb_transport_setup_qp_mw(struct ntb_tra struct ntb_transport_qp *qp = &nt->qp_vec[qp_num]; struct ntb_transport_mw *mw; void *offset; - uint64_t i; + ntb_q_idx_t i; size_t rx_size; unsigned num_qps_mw, mw_num, mw_count; @@ -1473,7 +1477,8 @@ ntb_qp_link_down_reset(struct ntb_transp qp->rx_ring_empty = 0; qp->tx_ring_full = 0; - qp->rx_err_no_buf = qp->rx_err_oflow = qp->rx_err_ver = 0; + qp->rx_err_no_buf = qp->tx_err_no_buf = 0; + qp->rx_err_oflow = qp->rx_err_ver = 0; } static void