From owner-svn-src-stable@freebsd.org Thu Mar 16 07:07:57 2017 Return-Path: Delivered-To: svn-src-stable@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 DE67AD0E94F; Thu, 16 Mar 2017 07:07:57 +0000 (UTC) (envelope-from mav@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 A03621CB5; Thu, 16 Mar 2017 07:07:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2G77uH4094969; Thu, 16 Mar 2017 07:07:56 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2G77uBJ094968; Thu, 16 Mar 2017 07:07:56 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201703160707.v2G77uBJ094968@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 16 Mar 2017 07:07:56 +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: r315383 - stable/11/sys/dev/iscsi X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Mar 2017 07:07:58 -0000 Author: mav Date: Thu Mar 16 07:07:56 2017 New Revision: 315383 URL: https://svnweb.freebsd.org/changeset/base/315383 Log: MFC r314555: Inline some trivial wrapper functions. Modified: stable/11/sys/dev/iscsi/icl_soft.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/iscsi/icl_soft.c ============================================================================== --- stable/11/sys/dev/iscsi/icl_soft.c Thu Mar 16 07:06:06 2017 (r315382) +++ stable/11/sys/dev/iscsi/icl_soft.c Thu Mar 16 07:07:56 2017 (r315383) @@ -203,34 +203,9 @@ icl_conn_receive_buf(struct icl_conn *ic return (0); } -static struct icl_pdu * -icl_pdu_new_empty(struct icl_conn *ic, int flags) -{ - struct icl_pdu *ip; - -#ifdef DIAGNOSTIC - refcount_acquire(&ic->ic_outstanding_pdus); -#endif - ip = uma_zalloc(icl_pdu_zone, flags | M_ZERO); - if (ip == NULL) { - ICL_WARN("failed to allocate %zd bytes", sizeof(*ip)); -#ifdef DIAGNOSTIC - refcount_release(&ic->ic_outstanding_pdus); -#endif - return (NULL); - } - - ip->ip_conn = ic; - - return (ip); -} - static void -icl_pdu_free(struct icl_pdu *ip) +icl_soft_conn_pdu_free(struct icl_conn *ic, struct icl_pdu *ip) { - struct icl_conn *ic; - - ic = ip->ip_conn; m_freem(ip->ip_bhs_mbuf); m_freem(ip->ip_ahs_mbuf); @@ -241,13 +216,6 @@ icl_pdu_free(struct icl_pdu *ip) #endif } -void -icl_soft_conn_pdu_free(struct icl_conn *ic, struct icl_pdu *ip) -{ - - icl_pdu_free(ip); -} - /* * Allocate icl_pdu with empty BHS to fill up by the caller. */ @@ -256,15 +224,24 @@ icl_soft_conn_new_pdu(struct icl_conn *i { struct icl_pdu *ip; - ip = icl_pdu_new_empty(ic, flags); - if (ip == NULL) +#ifdef DIAGNOSTIC + refcount_acquire(&ic->ic_outstanding_pdus); +#endif + ip = uma_zalloc(icl_pdu_zone, flags | M_ZERO); + if (ip == NULL) { + ICL_WARN("failed to allocate %zd bytes", sizeof(*ip)); +#ifdef DIAGNOSTIC + refcount_release(&ic->ic_outstanding_pdus); +#endif return (NULL); + } + ip->ip_conn = ic; CTASSERT(sizeof(struct iscsi_bhs) <= MHLEN); ip->ip_bhs_mbuf = m_gethdr(flags, MT_DATA); if (ip->ip_bhs_mbuf == NULL) { ICL_WARN("failed to allocate BHS mbuf"); - icl_pdu_free(ip); + icl_soft_conn_pdu_free(ic, ip); return (NULL); } ip->ip_bhs = mtod(ip->ip_bhs_mbuf, struct iscsi_bhs *); @@ -769,7 +746,7 @@ icl_conn_receive_pdus(struct icl_conn *i ICL_WARN("received PDU with unsupported " "AHS; opcode 0x%x; dropping connection", response->ip_bhs->bhs_opcode); - icl_pdu_free(response); + icl_soft_conn_pdu_free(ic, response); icl_conn_fail(ic); return; } @@ -945,8 +922,8 @@ icl_conn_send_pdus(struct icl_conn *ic, if (error != 0) { ICL_DEBUG("failed to finalize PDU; " "dropping connection"); + icl_soft_conn_pdu_free(ic, request); icl_conn_fail(ic); - icl_pdu_free(request); return; } if (coalesce) { @@ -963,9 +940,9 @@ icl_conn_send_pdus(struct icl_conn *ic, if (error != 0) { ICL_DEBUG("failed to finalize PDU; " "dropping connection"); + icl_soft_conn_pdu_free(ic, request); + icl_soft_conn_pdu_free(ic, request2); icl_conn_fail(ic); - icl_pdu_free(request); - icl_pdu_free(request2); return; } m_cat(request->ip_bhs_mbuf, request2->ip_bhs_mbuf); @@ -973,7 +950,7 @@ icl_conn_send_pdus(struct icl_conn *ic, request->ip_bhs_mbuf->m_pkthdr.len += size2; size += size2; STAILQ_REMOVE_AFTER(queue, request, ip_next); - icl_pdu_free(request2); + icl_soft_conn_pdu_free(ic, request2); coalesced++; } #if 0 @@ -990,11 +967,11 @@ icl_conn_send_pdus(struct icl_conn *ic, if (error != 0) { ICL_DEBUG("failed to send PDU, error %d; " "dropping connection", error); + icl_soft_conn_pdu_free(ic, request); icl_conn_fail(ic); - icl_pdu_free(request); return; } - icl_pdu_free(request); + icl_soft_conn_pdu_free(ic, request); } } @@ -1088,8 +1065,8 @@ icl_soupcall_send(struct socket *so, voi } static int -icl_pdu_append_data(struct icl_pdu *request, const void *addr, size_t len, - int flags) +icl_soft_conn_pdu_append_data(struct icl_conn *ic, struct icl_pdu *request, + const void *addr, size_t len, int flags) { struct mbuf *mb, *newmb; size_t copylen, off = 0; @@ -1121,27 +1098,12 @@ icl_pdu_append_data(struct icl_pdu *requ return (0); } -int -icl_soft_conn_pdu_append_data(struct icl_conn *ic, struct icl_pdu *request, - const void *addr, size_t len, int flags) -{ - - return (icl_pdu_append_data(request, addr, len, flags)); -} - -static void -icl_pdu_get_data(struct icl_pdu *ip, size_t off, void *addr, size_t len) -{ - - m_copydata(ip->ip_data_mbuf, off, len, addr); -} - void icl_soft_conn_pdu_get_data(struct icl_conn *ic, struct icl_pdu *ip, size_t off, void *addr, size_t len) { - return (icl_pdu_get_data(ip, off, addr, len)); + m_copydata(ip->ip_data_mbuf, off, len, addr); } static void @@ -1155,7 +1117,7 @@ icl_pdu_queue(struct icl_pdu *ip) if (ic->ic_disconnecting || ic->ic_socket == NULL) { ICL_DEBUG("icl_pdu_queue on closed connection"); - icl_pdu_free(ip); + icl_soft_conn_pdu_free(ic, ip); return; } @@ -1433,7 +1395,7 @@ icl_soft_conn_close(struct icl_conn *ic) if (ic->ic_receive_pdu != NULL) { //ICL_DEBUG("freeing partially received PDU"); - icl_pdu_free(ic->ic_receive_pdu); + icl_soft_conn_pdu_free(ic, ic->ic_receive_pdu); ic->ic_receive_pdu = NULL; } @@ -1443,7 +1405,7 @@ icl_soft_conn_close(struct icl_conn *ic) while (!STAILQ_EMPTY(&ic->ic_to_send)) { pdu = STAILQ_FIRST(&ic->ic_to_send); STAILQ_REMOVE_HEAD(&ic->ic_to_send, ip_next); - icl_pdu_free(pdu); + icl_soft_conn_pdu_free(ic, pdu); } KASSERT(STAILQ_EMPTY(&ic->ic_to_send),