summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/net/if_loop.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c
index dc297fc..f1a017b 100644
--- a/sys/net/if_loop.c
+++ b/sys/net/if_loop.c
@@ -94,6 +94,11 @@
#define LOMTU 16384
#endif
+#define LO_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP | CSUM_SCTP)
+#define LO_CSUM_SET (CSUM_DATA_VALID | CSUM_PSEUDO_HDR | \
+ CSUM_IP_CHECKED | CSUM_IP_VALID | \
+ CSUM_SCTP_VALID)
+
int loioctl(struct ifnet *, u_long, caddr_t);
static void lortrequest(int, struct rtentry *, struct rt_addrinfo *);
int looutput(struct ifnet *ifp, struct mbuf *m,
@@ -139,7 +144,7 @@ lo_clone_create(struct if_clone *ifc, int unit, caddr_t params)
ifp->if_output = looutput;
ifp->if_snd.ifq_maxlen = ifqmaxlen;
ifp->if_capabilities = ifp->if_capenable = IFCAP_HWCSUM;
- ifp->if_hwassist = CSUM_IP | CSUM_TCP | CSUM_UDP;
+ ifp->if_hwassist = LO_CSUM_FEATURES;
if_attach(ifp);
bpfattach(ifp, DLT_NULL, sizeof(u_int32_t));
if (V_loif == NULL)
@@ -216,11 +221,9 @@ looutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
case AF_INET:
if (ifp->if_capenable & IFCAP_RXCSUM) {
m->m_pkthdr.csum_data = 0xffff;
- m->m_pkthdr.csum_flags = CSUM_DATA_VALID |
- CSUM_PSEUDO_HDR | CSUM_IP_CHECKED |
- CSUM_IP_VALID | CSUM_SCTP_VALID;
+ m->m_pkthdr.csum_flags = LO_CSUM_SET;
}
- m->m_pkthdr.csum_flags &= ~(CSUM_IP | CSUM_TCP | CSUM_UDP);
+ m->m_pkthdr.csum_flags &= ~LO_CSUM_FEATURES;
case AF_INET6:
case AF_IPX:
case AF_APPLETALK:
@@ -407,7 +410,7 @@ loioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
if ((mask & IFCAP_TXCSUM) != 0)
ifp->if_capenable ^= IFCAP_TXCSUM;
if (ifp->if_capenable & IFCAP_TXCSUM)
- ifp->if_hwassist = CSUM_IP | CSUM_TCP | CSUM_UDP;
+ ifp->if_hwassist = LO_CSUM_FEATURES;
else
ifp->if_hwassist = 0;
break;
OpenPOWER on IntegriCloud