summaryrefslogtreecommitdiffstats
path: root/sys/dev/bxe
diff options
context:
space:
mode:
authoredavis <edavis@FreeBSD.org>2014-01-07 22:26:20 +0000
committeredavis <edavis@FreeBSD.org>2014-01-07 22:26:20 +0000
commit74e1a8fb0804457c6fa452367e27acb4f85523d4 (patch)
tree9c05c69dcf4d2afacb182dce72eb398abc664f97 /sys/dev/bxe
parent07f442b39dae1a5d8a6f004b7d97d9d735915e5b (diff)
downloadFreeBSD-src-74e1a8fb0804457c6fa452367e27acb4f85523d4.zip
FreeBSD-src-74e1a8fb0804457c6fa452367e27acb4f85523d4.tar.gz
defragment mbuf chains longer than hw segment limit before dropping
Approved by: davidch
Diffstat (limited to 'sys/dev/bxe')
-rw-r--r--sys/dev/bxe/bxe.c29
-rw-r--r--sys/dev/bxe/ecore_hsi.h7
2 files changed, 32 insertions, 4 deletions
diff --git a/sys/dev/bxe/bxe.c b/sys/dev/bxe/bxe.c
index 1e725f0..31f7a05 100644
--- a/sys/dev/bxe/bxe.c
+++ b/sys/dev/bxe/bxe.c
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define BXE_DRIVER_VERSION "1.78.76"
+#define BXE_DRIVER_VERSION "1.78.77"
#include "bxe.h"
#include "ecore_sp.h"
@@ -5501,10 +5501,31 @@ bxe_tx_encap(struct bxe_fastpath *fp, struct mbuf **m_head)
fp->eth_q_stats.tx_window_violation_std++;
}
- /* XXX I don't like this, change to double copy packet */
+ /* lets try to defragment this mbuf */
+ fp->eth_q_stats.mbuf_defrag_attempts++;
- /* no sense trying to defrag again, just drop the frame */
- rc = ENODEV;
+ m0 = m_defrag(*m_head, M_DONTWAIT);
+ if (m0 == NULL) {
+ fp->eth_q_stats.mbuf_defrag_failures++;
+ /* Ugh, just drop the frame... :( */
+ rc = ENOBUFS;
+ } else {
+ /* defrag successful, try mapping again */
+ *m_head = m0;
+ error = bus_dmamap_load_mbuf_sg(fp->tx_mbuf_tag,
+ tx_buf->m_map, m0,
+ segs, &nsegs, BUS_DMA_NOWAIT);
+ if (error) {
+ fp->eth_q_stats.tx_dma_mapping_failure++;
+ /* No sense in trying to defrag/copy chain, drop it. :( */
+ rc = error;
+ }
+
+ /* if the chain is still too long then drop it */
+ if (__predict_false(nsegs > 12)) {
+ rc = ENODEV;
+ }
+ }
}
bxe_tx_encap_continue:
diff --git a/sys/dev/bxe/ecore_hsi.h b/sys/dev/bxe/ecore_hsi.h
index 1da8e38..bfffcec 100644
--- a/sys/dev/bxe/ecore_hsi.h
+++ b/sys/dev/bxe/ecore_hsi.h
@@ -1305,6 +1305,13 @@ struct extended_dev_info_shared_cfg { /* NVRAM OFFSET */
#define EXTENDED_DEV_INFO_SHARED_CFG_SRIOV_SHOW_MENU 0x00000000
#define EXTENDED_DEV_INFO_SHARED_CFG_SRIOV_HIDE_MENU 0x00000200
+ /* Overide PCIE revision ID when enabled the,
+ revision ID will set to B1=='0x11' */
+ #define EXTENDED_DEV_INFO_SHARED_CFG_OVR_REV_ID_MASK 0x00000400
+ #define EXTENDED_DEV_INFO_SHARED_CFG_OVR_REV_ID_SHIFT 10
+ #define EXTENDED_DEV_INFO_SHARED_CFG_OVR_REV_ID_DISABLED 0x00000000
+ #define EXTENDED_DEV_INFO_SHARED_CFG_OVR_REV_ID_ENABLED 0x00000400
+
/* Threshold in celcius for max continuous operation */
uint32_t temperature_report; /* 0x4014 */
#define EXTENDED_DEV_INFO_SHARED_CFG_TEMP_MCOT_MASK 0x0000007F
OpenPOWER on IntegriCloud