Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci/ixgbe - Cleanup an rxbuf entry when bus_dmamap_l...
details: https://anonhg.NetBSD.org/src/rev/b12b22b60680
branches: trunk
changeset: 1021218:b12b22b60680
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Tue May 18 05:29:15 2021 +0000
description:
- Cleanup an rxbuf entry when bus_dmamap_load_mbuf() failed to prevent panic.
- Print error number when error occurred.
diffstat:
sys/dev/pci/ixgbe/ix_txrx.c | 14 +++++++++++---
sys/dev/pci/ixgbe/ixgbe.c | 16 +++++++++-------
sys/dev/pci/ixgbe/ixv.c | 10 ++++++----
3 files changed, 26 insertions(+), 14 deletions(-)
diffs (118 lines):
diff -r 9e9c98b1ca27 -r b12b22b60680 sys/dev/pci/ixgbe/ix_txrx.c
--- a/sys/dev/pci/ixgbe/ix_txrx.c Tue May 18 05:16:09 2021 +0000
+++ b/sys/dev/pci/ixgbe/ix_txrx.c Tue May 18 05:29:15 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.74 2021/05/14 05:15:17 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.75 2021/05/18 05:29:15 msaitoh Exp $ */
/******************************************************************************
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.74 2021/05/14 05:15:17 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.75 2021/05/18 05:29:15 msaitoh Exp $");
#include "opt_inet.h"
#include "opt_inet6.h"
@@ -1556,8 +1556,16 @@
/* Get the memory mapping */
error = bus_dmamap_load_mbuf(rxr->ptag->dt_dmat, rxbuf->pmap,
mp, BUS_DMA_NOWAIT);
- if (error != 0)
+ if (error != 0) {
+ /*
+ * Clear this entry for later cleanup in
+ * ixgbe_discard() which is called via
+ * ixgbe_free_receive_ring().
+ */
+ m_freem(mp);
+ rxbuf->buf = NULL;
goto fail;
+ }
bus_dmamap_sync(rxr->ptag->dt_dmat, rxbuf->pmap,
0, adapter->rx_mbuf_sz, BUS_DMASYNC_PREREAD);
/* Update the descriptor and the cached value */
diff -r 9e9c98b1ca27 -r b12b22b60680 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Tue May 18 05:16:09 2021 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Tue May 18 05:29:15 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.282 2021/05/07 09:15:52 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.283 2021/05/18 05:29:16 msaitoh Exp $ */
/******************************************************************************
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.282 2021/05/07 09:15:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.283 2021/05/18 05:29:16 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -3984,7 +3984,7 @@
u32 rxdctl, rxctrl;
u32 ctrl_ext;
bool unsupported_sfp = false;
- int i, j, err;
+ int i, j, error;
/* XXX check IFF_UP and IFF_RUNNING, power-saving state! */
@@ -4042,8 +4042,10 @@
adapter->rx_mbuf_sz = MJUMPAGESIZE;
/* Prepare receive descriptors and buffers */
- if (ixgbe_setup_receive_structures(adapter)) {
- device_printf(dev, "Could not setup receive structures\n");
+ error = ixgbe_setup_receive_structures(adapter);
+ if (error) {
+ device_printf(dev,
+ "Could not setup receive structures (err = %d)\n", error);
ixgbe_stop_locked(adapter);
return;
}
@@ -4173,8 +4175,8 @@
* need to be kick-started
*/
if (hw->phy.type == ixgbe_phy_none) {
- err = hw->phy.ops.identify(hw);
- if (err == IXGBE_ERR_SFP_NOT_SUPPORTED)
+ error = hw->phy.ops.identify(hw);
+ if (error == IXGBE_ERR_SFP_NOT_SUPPORTED)
unsupported_sfp = true;
} else if (hw->phy.type == ixgbe_phy_sfp_unsupported)
unsupported_sfp = true;
diff -r 9e9c98b1ca27 -r b12b22b60680 sys/dev/pci/ixgbe/ixv.c
--- a/sys/dev/pci/ixgbe/ixv.c Tue May 18 05:16:09 2021 +0000
+++ b/sys/dev/pci/ixgbe/ixv.c Tue May 18 05:29:15 2021 +0000
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.159 2021/04/30 06:55:32 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.160 2021/05/18 05:29:16 msaitoh Exp $*/
/******************************************************************************
@@ -35,7 +35,7 @@
/*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.159 2021/04/30 06:55:32 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.160 2021/05/18 05:29:16 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -756,8 +756,10 @@
adapter->rx_mbuf_sz = MJUMPAGESIZE;
/* Prepare receive descriptors and buffers */
- if (ixgbe_setup_receive_structures(adapter)) {
- device_printf(dev, "Could not setup receive structures\n");
+ error = ixgbe_setup_receive_structures(adapter);
+ if (error) {
+ device_printf(dev,
+ "Could not setup receive structures (err = %d)\n", error);
ixv_stop_locked(adapter);
return;
}
Home |
Main Index |
Thread Index |
Old Index