aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSepherosa Ziehau <sephe@FreeBSD.org>2016-12-01 03:39:34 +0000
committerSepherosa Ziehau <sephe@FreeBSD.org>2016-12-01 03:39:34 +0000
commit8e7d3136253e277b4163bdc20b67facf1398e4f2 (patch)
treee4646af4bbfa36f460460cb04830ea234b34b127
parent7f67614061b0c07c7d8c9cf213c0029c46a2904c (diff)
Notes
-rw-r--r--sys/dev/hyperv/netvsc/if_hn.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c
index 8e28a4a18c3e..39f0d246f04b 100644
--- a/sys/dev/hyperv/netvsc/if_hn.c
+++ b/sys/dev/hyperv/netvsc/if_hn.c
@@ -1924,17 +1924,20 @@ done:
static int
hn_txpkt(struct ifnet *ifp, struct hn_tx_ring *txr, struct hn_txdesc *txd)
{
- int error, send_failed = 0;
+ int error, send_failed = 0, has_bpf;
again:
- /*
- * Make sure that this txd and any aggregated txds are not freed
- * before ETHER_BPF_MTAP.
- */
- hn_txdesc_hold(txd);
+ has_bpf = bpf_peers_present(ifp->if_bpf);
+ if (has_bpf) {
+ /*
+ * Make sure that this txd and any aggregated txds are not
+ * freed before ETHER_BPF_MTAP.
+ */
+ hn_txdesc_hold(txd);
+ }
error = txr->hn_sendpkt(txr, txd);
if (!error) {
- if (bpf_peers_present(ifp->if_bpf)) {
+ if (has_bpf) {
const struct hn_txdesc *tmp_txd;
ETHER_BPF_MTAP(ifp, txd->m);
@@ -1957,7 +1960,8 @@ again:
txr->hn_pkts += txr->hn_stat_pkts;
txr->hn_sends++;
}
- hn_txdesc_put(txr, txd);
+ if (has_bpf)
+ hn_txdesc_put(txr, txd);
if (__predict_false(error)) {
int freed;