Tue Jun 13 09:35:12 2017 UTC ()
 Fix the partial chain check in ixgbe_rx_discard(). This bug was addded in
rev. 1.33.


(msaitoh)
diff -r1.25 -r1.26 src/sys/dev/pci/ixgbe/ix_txrx.c

cvs diff -r1.25 -r1.26 src/sys/dev/pci/ixgbe/ix_txrx.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ix_txrx.c 2017/06/09 03:19:55 1.25
+++ src/sys/dev/pci/ixgbe/ix_txrx.c 2017/06/13 09:35:12 1.26
@@ -49,27 +49,27 @@ @@ -49,27 +49,27 @@
49 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 49 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
50 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 50 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
51 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 51 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
52 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 52 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
53 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 53 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
54 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 54 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
55 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 55 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
56 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 56 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
57 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 57 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
58 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 58 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
59 * POSSIBILITY OF SUCH DAMAGE. 59 * POSSIBILITY OF SUCH DAMAGE.
60 */ 60 */
61/*$FreeBSD: head/sys/dev/ixgbe/ix_txrx.c 301538 2016-06-07 04:51:50Z sephe $*/ 61/*$FreeBSD: head/sys/dev/ixgbe/ix_txrx.c 301538 2016-06-07 04:51:50Z sephe $*/
62/*$NetBSD: ix_txrx.c,v 1.25 2017/06/09 03:19:55 msaitoh Exp $*/ 62/*$NetBSD: ix_txrx.c,v 1.26 2017/06/13 09:35:12 msaitoh Exp $*/
63 63
64#include "opt_inet.h" 64#include "opt_inet.h"
65#include "opt_inet6.h" 65#include "opt_inet6.h"
66 66
67#include "ixgbe.h" 67#include "ixgbe.h"
68 68
69#ifdef DEV_NETMAP 69#ifdef DEV_NETMAP
70#include <net/netmap.h> 70#include <net/netmap.h>
71#include <sys/selinfo.h> 71#include <sys/selinfo.h>
72#include <dev/netmap/netmap_kern.h> 72#include <dev/netmap/netmap_kern.h>
73 73
74extern int ix_crcstrip; 74extern int ix_crcstrip;
75#endif 75#endif
@@ -1761,27 +1761,27 @@ ixgbe_rx_discard(struct rx_ring *rxr, in @@ -1761,27 +1761,27 @@ ixgbe_rx_discard(struct rx_ring *rxr, in
1761 struct ixgbe_rx_buf *rbuf; 1761 struct ixgbe_rx_buf *rbuf;
1762 1762
1763 rbuf = &rxr->rx_buffers[i]; 1763 rbuf = &rxr->rx_buffers[i];
1764 1764
1765 1765
1766 /* 1766 /*
1767 ** With advanced descriptors the writeback 1767 ** With advanced descriptors the writeback
1768 ** clobbers the buffer addrs, so its easier 1768 ** clobbers the buffer addrs, so its easier
1769 ** to just free the existing mbufs and take 1769 ** to just free the existing mbufs and take
1770 ** the normal refresh path to get new buffers 1770 ** the normal refresh path to get new buffers
1771 ** and mapping. 1771 ** and mapping.
1772 */ 1772 */
1773 1773
1774 if (rbuf->buf != NULL) {/* Partial chain ? */ 1774 if (rbuf->fmp != NULL) {/* Partial chain ? */
1775 rbuf->fmp->m_flags |= M_PKTHDR; 1775 rbuf->fmp->m_flags |= M_PKTHDR;
1776 m_freem(rbuf->fmp); 1776 m_freem(rbuf->fmp);
1777 rbuf->fmp = NULL; 1777 rbuf->fmp = NULL;
1778 rbuf->buf = NULL; /* rbuf->buf is part of fmp's chain */ 1778 rbuf->buf = NULL; /* rbuf->buf is part of fmp's chain */
1779 } else if (rbuf->buf) { 1779 } else if (rbuf->buf) {
1780 m_free(rbuf->buf); 1780 m_free(rbuf->buf);
1781 rbuf->buf = NULL; 1781 rbuf->buf = NULL;
1782 } 1782 }
1783 ixgbe_dmamap_unload(rxr->ptag, rbuf->pmap); 1783 ixgbe_dmamap_unload(rxr->ptag, rbuf->pmap);
1784 1784
1785 rbuf->flags = 0; 1785 rbuf->flags = 0;
1786 1786
1787 return; 1787 return;