Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/xen actually in data_validated case, there is no ne...
details: https://anonhg.NetBSD.org/src/rev/ba81d2cf8693
branches: trunk
changeset: 1008412:ba81d2cf8693
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Sun Mar 22 11:20:59 2020 +0000
description:
actually in data_validated case, there is no need to inspect the data for Rx,
simply set the supported csum offload flags to skip the software csum
verification
diffstat:
sys/arch/xen/include/xennet_checksum.h | 4 +-
sys/arch/xen/xen/if_xennet_xenbus.c | 12 +++---
sys/arch/xen/xen/xennet_checksum.c | 64 ++++++++++++++-------------------
sys/arch/xen/xen/xennetback_xenbus.c | 12 +++---
4 files changed, 42 insertions(+), 50 deletions(-)
diffs (200 lines):
diff -r f7d5704278e1 -r ba81d2cf8693 sys/arch/xen/include/xennet_checksum.h
--- a/sys/arch/xen/include/xennet_checksum.h Sun Mar 22 07:45:02 2020 +0000
+++ b/sys/arch/xen/include/xennet_checksum.h Sun Mar 22 11:20:59 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xennet_checksum.h,v 1.3 2020/03/18 19:23:12 jdolecek Exp $ */
+/* $NetBSD: xennet_checksum.h,v 1.4 2020/03/22 11:20:59 jdolecek Exp $ */
/*-
* Copyright (c)2006 YAMAMOTO Takashi,
@@ -32,6 +32,6 @@
struct ifnet;
struct mbuf;
-int xennet_checksum_fill(struct ifnet *, struct mbuf *, bool);
+int xennet_checksum_fill(struct ifnet *, struct mbuf *);
#endif /* !_XEN_XENNET_CHECKSUM_H_ */
diff -r f7d5704278e1 -r ba81d2cf8693 sys/arch/xen/xen/if_xennet_xenbus.c
--- a/sys/arch/xen/xen/if_xennet_xenbus.c Sun Mar 22 07:45:02 2020 +0000
+++ b/sys/arch/xen/xen/if_xennet_xenbus.c Sun Mar 22 11:20:59 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_xennet_xenbus.c,v 1.93 2020/03/22 00:11:02 jdolecek Exp $ */
+/* $NetBSD: if_xennet_xenbus.c,v 1.94 2020/03/22 11:20:59 jdolecek Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -84,7 +84,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.93 2020/03/22 00:11:02 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.94 2020/03/22 11:20:59 jdolecek Exp $");
#include "opt_xen.h"
#include "opt_nfs_boot.h"
@@ -1128,10 +1128,10 @@
m->m_ext.ext_paddr = pa;
m->m_flags |= M_EXT_RW; /* we own the buffer */
}
- if ((rx->flags & (NETRXF_csum_blank|NETRXF_data_validated))) {
- xennet_checksum_fill(ifp, m,
- ((rx->flags & NETRXF_data_validated) != 0));
- }
+ if (rx->flags & NETRXF_csum_blank)
+ xennet_checksum_fill(ifp, m);
+ else if (rx->flags & NETRXF_data_validated)
+ m->m_pkthdr.csum_flags = XN_M_CSUM_SUPPORTED;
/* free req may overwrite *rx, better doing it late */
xennet_rx_free_req(req);
diff -r f7d5704278e1 -r ba81d2cf8693 sys/arch/xen/xen/xennet_checksum.c
--- a/sys/arch/xen/xen/xennet_checksum.c Sun Mar 22 07:45:02 2020 +0000
+++ b/sys/arch/xen/xen/xennet_checksum.c Sun Mar 22 11:20:59 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xennet_checksum.c,v 1.9 2020/03/22 00:11:02 jdolecek Exp $ */
+/* $NetBSD: xennet_checksum.c,v 1.10 2020/03/22 11:20:59 jdolecek Exp $ */
/*-
* Copyright (c)2006 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xennet_checksum.c,v 1.9 2020/03/22 00:11:02 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xennet_checksum.c,v 1.10 2020/03/22 11:20:59 jdolecek Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -56,12 +56,9 @@
NULL, "xennet", "csum blank");
static struct evcnt xn_cksum_undefer = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
NULL, "xennet", "csum undeferred");
-static struct evcnt xn_cksum_valid = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
- NULL, "xennet", "csum data valid");
EVCNT_ATTACH_STATIC(xn_cksum_defer);
EVCNT_ATTACH_STATIC(xn_cksum_undefer);
-EVCNT_ATTACH_STATIC(xn_cksum_valid);
#ifdef XENNET_DEBUG
/* ratecheck(9) for checksum validation failures */
@@ -82,7 +79,7 @@
* for hw offload to do it
*/
int
-xennet_checksum_fill(struct ifnet *ifp, struct mbuf *m, bool data_validated)
+xennet_checksum_fill(struct ifnet *ifp, struct mbuf *m)
{
const struct ether_header *eh;
struct ip *iph = NULL;
@@ -193,51 +190,46 @@
#ifdef XENNET_DEBUG
static struct timeval lasttime;
if (ratecheck(&lasttime, &xn_cksum_errintvl))
- printf("%s: unknown proto %d passed%s\n",
- ifp->if_xname, nxt,
- data_validated ? "" : " no checksum");
+ printf("%s: unknown proto %d passed no checksum\n",
+ ifp->if_xname, nxt);
#endif /* XENNET_DEBUG */
error = EINVAL;
goto out;
}
}
- if (!data_validated) {
- /*
- * Only compute the checksum if impossible to defer.
- */
- sw_csum = m->m_pkthdr.csum_flags & ~ifp->if_csum_flags_rx;
+ /*
+ * Only compute the checksum if impossible to defer.
+ */
+ sw_csum = m->m_pkthdr.csum_flags & ~ifp->if_csum_flags_rx;
- /*
- * Always initialize the sum to 0! Some HW assisted
- * checksumming requires this. in_undefer_cksum()
- * also needs it to be zero.
- */
- if (iph != NULL && (m->m_pkthdr.csum_flags & M_CSUM_IPv4))
- iph->ip_sum = 0;
+ /*
+ * Always initialize the sum to 0! Some HW assisted
+ * checksumming requires this. in_undefer_cksum()
+ * also needs it to be zero.
+ */
+ if (iph != NULL && (m->m_pkthdr.csum_flags & M_CSUM_IPv4))
+ iph->ip_sum = 0;
- if (sw_csum & (M_CSUM_IPv4|M_CSUM_UDPv4|M_CSUM_TCPv4)) {
- in_undefer_cksum(m, ehlen,
- sw_csum & (M_CSUM_IPv4|M_CSUM_UDPv4|M_CSUM_TCPv4));
- }
+ if (sw_csum & (M_CSUM_IPv4|M_CSUM_UDPv4|M_CSUM_TCPv4)) {
+ in_undefer_cksum(m, ehlen,
+ sw_csum & (M_CSUM_IPv4|M_CSUM_UDPv4|M_CSUM_TCPv4));
+ }
#ifdef INET6
- if (sw_csum & (M_CSUM_UDPv6|M_CSUM_TCPv6)) {
- in6_undefer_cksum(m, ehlen,
- sw_csum & (M_CSUM_UDPv6|M_CSUM_TCPv6));
- }
+ if (sw_csum & (M_CSUM_UDPv6|M_CSUM_TCPv6)) {
+ in6_undefer_cksum(m, ehlen,
+ sw_csum & (M_CSUM_UDPv6|M_CSUM_TCPv6));
+ }
#endif
- if (m->m_pkthdr.csum_flags != 0) {
- xn_cksum_defer.ev_count++;
+ if (m->m_pkthdr.csum_flags != 0) {
+ xn_cksum_defer.ev_count++;
#ifdef M_CSUM_BLANK
- m->m_pkthdr.csum_flags |= M_CSUM_BLANK;
+ m->m_pkthdr.csum_flags |= M_CSUM_BLANK;
#endif
- } else {
- xn_cksum_undefer.ev_count++;
- }
} else {
- xn_cksum_valid.ev_count++;
+ xn_cksum_undefer.ev_count++;
}
out:
diff -r f7d5704278e1 -r ba81d2cf8693 sys/arch/xen/xen/xennetback_xenbus.c
--- a/sys/arch/xen/xen/xennetback_xenbus.c Sun Mar 22 07:45:02 2020 +0000
+++ b/sys/arch/xen/xen/xennetback_xenbus.c Sun Mar 22 11:20:59 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xennetback_xenbus.c,v 1.84 2020/03/22 00:11:02 jdolecek Exp $ */
+/* $NetBSD: xennetback_xenbus.c,v 1.85 2020/03/22 11:20:59 jdolecek Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.84 2020/03/22 00:11:02 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.85 2020/03/22 11:20:59 jdolecek Exp $");
#include "opt_xen.h"
@@ -888,10 +888,10 @@
xennetback_tx_response(xneti, txreq.id,
NETIF_RSP_OKAY);
- if ((txreq.flags & (NETTXF_csum_blank|NETTXF_data_validated))) {
- xennet_checksum_fill(ifp, m,
- ((txreq.flags & NETTXF_data_validated) != 0));
- }
+ if (txreq.flags & NETTXF_csum_blank)
+ xennet_checksum_fill(ifp, m);
+ else if (txreq.flags & NETTXF_data_validated)
+ m->m_pkthdr.csum_flags = XN_M_CSUM_SUPPORTED;
m_set_rcvif(m, ifp);
if_percpuq_enqueue(ifp->if_percpuq, m);
Home |
Main Index |
Thread Index |
Old Index