Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Add missing drain for pcq in wm_stop_locked(). O...



details:   https://anonhg.NetBSD.org/src/rev/30f712d88e06
branches:  trunk
changeset: 941724:30f712d88e06
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Oct 28 07:08:08 2020 +0000

description:
Add missing drain for pcq in wm_stop_locked(). OK'd by knakahara.

This change fixes two problems:
 1. If the pcq is full and watchdog timer is fired, the full state of the
    pcq is kept and wm_transmit() returns with ENOBUFS.
 2. ifconfig down doesn't free mbufs in the pcq.

diffstat:

 sys/dev/pci/if_wm.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r b15311ee3899 -r 30f712d88e06 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Wed Oct 28 03:21:25 2020 +0000
+++ b/sys/dev/pci/if_wm.c       Wed Oct 28 07:08:08 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.691 2020/10/16 05:53:39 msaitoh Exp $      */
+/*     $NetBSD: if_wm.c,v 1.692 2020/10/28 07:08:08 msaitoh Exp $      */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.691 2020/10/16 05:53:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.692 2020/10/28 07:08:08 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -6523,6 +6523,8 @@
        for (qidx = 0; qidx < sc->sc_nqueues; qidx++) {
                struct wm_queue *wmq = &sc->sc_queue[qidx];
                struct wm_txqueue *txq = &wmq->wmq_txq;
+               struct mbuf *m;
+
                mutex_enter(txq->txq_lock);
                txq->txq_sending = false; /* Ensure watchdog disabled */
                for (i = 0; i < WM_TXQUEUELEN(txq); i++) {
@@ -6533,6 +6535,9 @@
                                txs->txs_mbuf = NULL;
                        }
                }
+               /* Drain txq_interq */
+               while ((m = pcq_get(txq->txq_interq)) != NULL)
+                       m_freem(m);
                mutex_exit(txq->txq_lock);
        }
 



Home | Main Index | Thread Index | Old Index