From owner-svn-src-all@freebsd.org Thu Mar 31 13:23:44 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 B8D43AE4382; Thu, 31 Mar 2016 13:23:44 +0000 (UTC) (envelope-from zbb@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 7DF9F151A; Thu, 31 Mar 2016 13:23:44 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u2VDNh7b095133; Thu, 31 Mar 2016 13:23:43 GMT (envelope-from zbb@FreeBSD.org) Received: (from zbb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u2VDNhrp095132; Thu, 31 Mar 2016 13:23:43 GMT (envelope-from zbb@FreeBSD.org) Message-Id: <201603311323.u2VDNhrp095132@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zbb set sender to zbb@FreeBSD.org using -f From: Zbigniew Bodek Date: Thu, 31 Mar 2016 13:23:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297453 - head/sys/dev/vnic 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.21 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: Thu, 31 Mar 2016 13:23:44 -0000 Author: zbb Date: Thu Mar 31 13:23:43 2016 New Revision: 297453 URL: https://svnweb.freebsd.org/changeset/base/297453 Log: Don't omit m_dup() for non-writeable mbufs that need checksum calculation If the driver is not active or link is down the packet could remain non-writeable. This commit makes all mbufs enqueued to the driver's ring buffer to have correct attributes. Pointed out by: wma Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5800 Modified: head/sys/dev/vnic/nicvf_main.c Modified: head/sys/dev/vnic/nicvf_main.c ============================================================================== --- head/sys/dev/vnic/nicvf_main.c Thu Mar 31 13:20:02 2016 (r297452) +++ head/sys/dev/vnic/nicvf_main.c Thu Mar 31 13:23:43 2016 (r297453) @@ -661,12 +661,6 @@ nicvf_if_transmit(struct ifnet *ifp, str sq = &qs->sq[qidx]; - if (((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING) || !nic->link_up) { - err = drbr_enqueue(ifp, sq->br, mbuf); - return (err); - } - if (mbuf->m_next != NULL && (mbuf->m_pkthdr.csum_flags & (CSUM_IP | CSUM_TCP | CSUM_UDP | CSUM_SCTP)) != 0) { @@ -680,8 +674,15 @@ nicvf_if_transmit(struct ifnet *ifp, str } err = drbr_enqueue(ifp, sq->br, mbuf); - if (err != 0) + if (((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING) || !nic->link_up || (err != 0)) { + /* + * Try to enqueue packet to the ring buffer. + * If the driver is not active, link down or enqueue operation + * failed, return with the appropriate error code. + */ return (err); + } if (NICVF_TX_TRYLOCK(sq) != 0) { err = nicvf_xmit_locked(sq);