Module Name: src Committed By: maxv Date: Wed Jul 11 05:38:55 UTC 2018
Modified Files: src/sys/netinet: in_offload.c in_offload.h Log Message: Remove the callback, localify, and add a comment. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/netinet/in_offload.c cvs rdiff -u -r1.9 -r1.10 src/sys/netinet/in_offload.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/netinet/in_offload.c diff -u src/sys/netinet/in_offload.c:1.8 src/sys/netinet/in_offload.c:1.9 --- src/sys/netinet/in_offload.c:1.8 Wed Jul 11 05:25:45 2018 +++ src/sys/netinet/in_offload.c Wed Jul 11 05:38:55 2018 @@ -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,46 +41,13 @@ __KERNEL_RCSID(0, "$NetBSD: in_offload.c #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 *); - -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, - 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. + * Handle M_CSUM_TSOv4 in software. Split the TCP payload in chunks of + * size MSS, and send them. */ - -int -tcp4_segment(struct mbuf *m, int (*output_func)(void *, struct mbuf *), - void *output_arg) +static int +tcp4_segment(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *sa, + struct rtentry *rt) { int mss; int iphlen; @@ -176,7 +143,7 @@ tcp4_segment(struct mbuf *m, int (*outpu 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 @@ quit: 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. Index: src/sys/netinet/in_offload.h diff -u src/sys/netinet/in_offload.h:1.9 src/sys/netinet/in_offload.h:1.10 --- src/sys/netinet/in_offload.h:1.9 Wed Jul 11 05:25:45 2018 +++ src/sys/netinet/in_offload.h Wed Jul 11 05:38:55 2018 @@ -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.