Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet Remove the callback, localify, and add a comment.



details:   https://anonhg.NetBSD.org/src/rev/38a29872aba0
branches:  trunk
changeset: 320533:38a29872aba0
user:      maxv <maxv%NetBSD.org@localhost>
date:      Wed Jul 11 05:38:55 2018 +0000

description:
Remove the callback, localify, and add a comment.

diffstat:

 sys/netinet/in_offload.c |  56 ++++++++++++-----------------------------------
 sys/netinet/in_offload.h |   5 +--
 2 files changed, 17 insertions(+), 44 deletions(-)

diffs (116 lines):

diff -r 11b77dd91d35 -r 38a29872aba0 sys/netinet/in_offload.c
--- a/sys/netinet/in_offload.c  Wed Jul 11 05:25:45 2018 +0000
+++ b/sys/netinet/in_offload.c  Wed Jul 11 05:38:55 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in_offload.c,v 1.8 2018/07/11 05:25:45 maxv Exp $      */
+/*     $NetBSD: in_offload.c,v 1.9 2018/07/11 05:38:55 maxv Exp $      */
 
 /*-
  * Copyright (c)2005, 2006 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in_offload.c,v 1.8 2018/07/11 05:25:45 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_offload.c,v 1.9 2018/07/11 05:38:55 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/mbuf.h>
@@ -41,47 +41,14 @@
 #include <netinet/tcp.h>
 #include <netinet/in_offload.h>
 
-struct ip_tso_output_args {
-       struct ifnet *ifp;
-       const struct sockaddr *sa;
-       struct rtentry *rt;
-};
-
-static int ip_tso_output_callback(void *, struct mbuf *);
-
+/*
+ * Handle M_CSUM_TSOv4 in software. Split the TCP payload in chunks of
+ * size MSS, and send them.
+ */
 static int
-ip_tso_output_callback(void *vp, struct mbuf *m)
-{
-       struct ip_tso_output_args *args = vp;
-       struct ifnet *ifp = args->ifp;
-
-       return ip_if_output(ifp, m, args->sa, args->rt);
-}
-
-int
-ip_tso_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *sa,
+tcp4_segment(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *sa,
     struct rtentry *rt)
 {
-       struct ip_tso_output_args args;
-
-       args.ifp = ifp;
-       args.sa = sa;
-       args.rt = rt;
-
-       return tcp4_segment(m, ip_tso_output_callback, &args);
-}
-
-/*
- * tcp4_segment: handle M_CSUM_TSOv4 by software.
- *
- * => always consume m.
- * => call output_func with output_arg for each segments.
- */
-
-int
-tcp4_segment(struct mbuf *m, int (*output_func)(void *, struct mbuf *),
-    void *output_arg)
-{
        int mss;
        int iphlen;
        int thlen;
@@ -176,7 +143,7 @@
                th->th_sum = 0;
                th->th_sum = in4_cksum(n, IPPROTO_TCP, iphlen, thlen + mss);
 
-               error = (*output_func)(output_arg, n);
+               error = ip_if_output(ifp, n, sa, rt);
                if (error) {
                        goto quit;
                }
@@ -197,6 +164,13 @@
        return error;
 }
 
+int
+ip_tso_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *sa,
+    struct rtentry *rt)
+{
+       return tcp4_segment(ifp, m, sa, rt);
+}
+
 /*
  * Compute now in software the IP and TCP/UDP checksums. Cancel the
  * hardware offloading.
diff -r 11b77dd91d35 -r 38a29872aba0 sys/netinet/in_offload.h
--- a/sys/netinet/in_offload.h  Wed Jul 11 05:25:45 2018 +0000
+++ b/sys/netinet/in_offload.h  Wed Jul 11 05:38:55 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in_offload.h,v 1.9 2018/07/11 05:25:45 maxv Exp $      */
+/*     $NetBSD: in_offload.h,v 1.10 2018/07/11 05:38:55 maxv Exp $     */
 
 /*-
  * Copyright (c)2005, 2006 YAMAMOTO Takashi,
@@ -33,11 +33,10 @@
  * subroutines to do software-only equivalent of h/w offloading.
  */
 
-int tcp4_segment(struct mbuf *, int (*)(void *, struct mbuf *), void *);
 int ip_tso_output(struct ifnet *, struct mbuf *, const struct sockaddr *,
     struct rtentry *);
 void in_undefer_cksum(struct mbuf *, size_t, int);
-void in_undefer_cksum_tcpudp(struct mbuf *m);
+void in_undefer_cksum_tcpudp(struct mbuf *);
 
 /*
  * offloading related sysctl variables.



Home | Main Index | Thread Index | Old Index