summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2022-02-10 16:22:01 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2022-02-10 16:22:01 +0000
commitdc40d8a34c940c265072c6debf92710f90e631b4 (patch)
treedddcaaedfbd81244bd5210a83a53dbd33ed67418 /sys/dev/pci
parentd40a373d974dae5f005eaabc492ec75eadc15d2e (diff)
Enable receive checksum offloading on ixl(4) network interfaces.
from jan@; test and OK dlg@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/if_ixl.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/sys/dev/pci/if_ixl.c b/sys/dev/pci/if_ixl.c
index 71dff53d323..6412e5a0760 100644
--- a/sys/dev/pci/if_ixl.c
+++ b/sys/dev/pci/if_ixl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ixl.c,v 1.81 2022/02/09 11:12:21 dlg Exp $ */
+/* $OpenBSD: if_ixl.c,v 1.82 2022/02/10 16:22:00 bluhm Exp $ */
/*
* Copyright (c) 2013-2015, Intel Corporation
@@ -1399,6 +1399,7 @@ static int ixl_rxeof(struct ixl_softc *, struct ixl_rx_ring *);
static void ixl_rxfill(struct ixl_softc *, struct ixl_rx_ring *);
static void ixl_rxrefill(void *);
static int ixl_rxrinfo(struct ixl_softc *, struct if_rxrinfo *);
+static void ixl_rx_checksum(struct mbuf *, uint64_t);
#if NKSTAT > 0
static void ixl_kstat_attach(struct ixl_softc *);
@@ -3297,6 +3298,7 @@ ixl_rxeof(struct ixl_softc *sc, struct ixl_rx_ring *rxr)
SET(m->m_flags, M_VLANTAG);
}
+ ixl_rx_checksum(m, word);
ml_enqueue(&ml, m);
} else {
ifp->if_ierrors++; /* XXX */
@@ -3429,6 +3431,23 @@ ixl_rxrinfo(struct ixl_softc *sc, struct if_rxrinfo *ifri)
return (rv);
}
+static void
+ixl_rx_checksum(struct mbuf *m, uint64_t word)
+{
+ if (!ISSET(word, IXL_RX_DESC_L3L4P))
+ return;
+
+ if (ISSET(word, IXL_RX_DESC_IPE))
+ return;
+
+ m->m_pkthdr.csum_flags |= M_IPV4_CSUM_IN_OK;
+
+ if (ISSET(word, IXL_RX_DESC_L4E))
+ return;
+
+ m->m_pkthdr.csum_flags |= M_TCP_CSUM_IN_OK | M_UDP_CSUM_IN_OK;
+}
+
static int
ixl_intr0(void *xsc)
{