Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet6 Remove the callback and localify. Same as IPv4.



details:   https://anonhg.NetBSD.org/src/rev/1561bafe5759
branches:  trunk
changeset: 365269:1561bafe5759
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Aug 10 06:55:04 2018 +0000

description:
Remove the callback and localify. Same as IPv4.

diffstat:

 sys/netinet6/in6_offload.c |  59 ++++++++++++---------------------------------
 sys/netinet6/in6_offload.h |  12 +++-----
 2 files changed, 21 insertions(+), 50 deletions(-)

diffs (128 lines):

diff -r 6aeb6ea7e57b -r 1561bafe5759 sys/netinet6/in6_offload.c
--- a/sys/netinet6/in6_offload.c        Fri Aug 10 06:46:08 2018 +0000
+++ b/sys/netinet6/in6_offload.c        Fri Aug 10 06:55:04 2018 +0000
@@ -1,6 +1,6 @@
-/*     $NetBSD: in6_offload.c,v 1.9 2018/08/10 06:46:09 maxv Exp $     */
+/*     $NetBSD: in6_offload.c,v 1.10 2018/08/10 06:55:04 maxv Exp $    */
 
-/*-
+/*
  * Copyright (c)2006 YAMAMOTO Takashi,
  * All rights reserved.
  *
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_offload.c,v 1.9 2018/08/10 06:46:09 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_offload.c,v 1.10 2018/08/10 06:55:04 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/mbuf.h>
@@ -43,48 +43,14 @@
 #include <netinet6/nd6.h>
 #include <netinet6/in6_offload.h>
 
-struct ip6_tso_output_args {
-       struct ifnet *ifp;
-       struct ifnet *origifp;
-       const struct sockaddr_in6 *dst;
-       struct rtentry *rt;
-};
-
-static int ip6_tso_output_callback(void *, struct mbuf *);
-
+/*
+ * Handle M_CSUM_TSOv6 in software. Split the TCP payload in chunks of
+ * size MSS, and send them.
+ */
 static int
-ip6_tso_output_callback(void *vp, struct mbuf *m)
-{
-       struct ip6_tso_output_args *args = vp;
-
-       return ip6_if_output(args->ifp, args->origifp, m, args->dst, args->rt);
-}
-
-int
-ip6_tso_output(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *m,
+tcp6_segment(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *m,
     const struct sockaddr_in6 *dst, struct rtentry *rt)
 {
-       struct ip6_tso_output_args args;
-
-       args.ifp = ifp;
-       args.origifp = origifp;
-       args.dst = dst;
-       args.rt = rt;
-
-       return tcp6_segment(m, ip6_tso_output_callback, &args);
-}
-
-/*
- * tcp6_segment: handle M_CSUM_TSOv6 by software.
- *
- * => always consume m.
- * => call output_func with output_arg for each segments.
- */
-
-int
-tcp6_segment(struct mbuf *m, int (*output_func)(void *, struct mbuf *),
-    void *output_arg)
-{
        int mss;
        int iphlen;
        int thlen;
@@ -173,7 +139,7 @@
                th->th_sum = 0;
                th->th_sum = in6_cksum(n, IPPROTO_TCP, iphlen, thlen + mss);
 
-               error = (*output_func)(output_arg, n);
+               error = ip6_if_output(ifp, origifp, n, dst, rt);
                if (error) {
                        goto quit;
                }
@@ -193,6 +159,13 @@
        return error;
 }
 
+int
+ip6_tso_output(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *m,
+    const struct sockaddr_in6 *dst, struct rtentry *rt)
+{
+       return tcp6_segment(ifp, origifp, m, dst, rt);
+}
+
 /*
  * Compute now in software the IP and TCP/UDP checksums. Cancel the
  * hardware offloading.
diff -r 6aeb6ea7e57b -r 1561bafe5759 sys/netinet6/in6_offload.h
--- a/sys/netinet6/in6_offload.h        Fri Aug 10 06:46:08 2018 +0000
+++ b/sys/netinet6/in6_offload.h        Fri Aug 10 06:55:04 2018 +0000
@@ -1,6 +1,6 @@
-/*     $NetBSD: in6_offload.h,v 1.8 2018/08/10 06:46:09 maxv Exp $     */
+/*     $NetBSD: in6_offload.h,v 1.9 2018/08/10 06:55:04 maxv Exp $     */
 
-/*-
+/*
  * Copyright (c)2005, 2006 YAMAMOTO Takashi,
  * All rights reserved.
  *
@@ -26,14 +26,12 @@
  * SUCH DAMAGE.
  */
 
-/*
- * subroutines to do software-only equivalent of h/w offloading.
- */
-
 #if !defined(_NETINET6_IN6_OFFLOAD_H_)
 #define        _NETINET6_IN6_OFFLOAD_H_
 
-int tcp6_segment(struct mbuf *, int (*)(void *, struct mbuf *), void *);
+/*
+ * Subroutines to do software-only equivalent of h/w offloading.
+ */
 int ip6_tso_output(struct ifnet *, struct ifnet *, struct mbuf *,
     const struct sockaddr_in6 *, struct rtentry *);
 void in6_undefer_cksum(struct mbuf *, size_t, int);



Home | Main Index | Thread Index | Old Index