Page MenuHomeFreeBSD

D55203.id171600.diff
No OneTemporary

D55203.id171600.diff

diff --git a/sys/rpc/svc.h.extpg b/sys/rpc/svc.h
--- a/sys/rpc/svc.h.extpg
+++ b/sys/rpc/svc.h
@@ -155,6 +155,7 @@
uid_t xp_uid;
gid_t *xp_gidp;
int xp_doneddp;
+ bool_t xp_extpg; /* Can use M_EXTPG mbufs. */
} SVCXPRT;
/*
diff --git a/sys/rpc/svc_vc.c.extpg b/sys/rpc/svc_vc.c
--- a/sys/rpc/svc_vc.c.extpg
+++ b/sys/rpc/svc_vc.c
@@ -39,6 +39,8 @@
* and a record/tcp stream.
*/
+#include "opt_inet.h"
+#include "opt_inet6.h"
#include "opt_kern_tls.h"
#include <sys/param.h>
@@ -60,7 +62,17 @@
#include <net/vnet.h>
+#include <net/if.h>
+#include <net/if_var.h>
+#include <net/if_private.h>
+#include <net/route.h>
+#include <net/route/nhop.h>
#include <netinet/tcp.h>
+#include <netinet/in.h>
+#include <netinet/in_fib.h>
+#include <netinet/in_pcb.h>
+#include <netinet6/in6_fib.h>
+#include <netinet6/scope6_var.h>
#include <rpc/rpc.h>
#include <rpc/rpcsec_tls.h>
@@ -253,6 +265,58 @@
return (NULL);
}
+/* Check to see if the outbound NIC handles M_EXTPG mbufs. */
+static bool_t
+_svc_vc_checkextpg(struct socket *so, struct sockaddr_storage *ss)
+{
+#if defined(INET) || defined(INET6)
+ struct nhop_object *nh;
+ struct inpcb *inp;
+#endif
+#ifdef INET
+ struct sockaddr_in *sin;
+#endif
+#ifdef INET6
+ struct sockaddr_in6 *sin6;
+ struct in6_addr kdst;
+ uint32_t scopeid;
+#endif
+
+ switch (ss->ss_family) {
+#ifdef INET
+ case AF_INET:
+ inp = sotoinpcb(so);
+ if (inp == NULL)
+ return (FALSE);
+ sin = (struct sockaddr_in *)ss;
+ nh = fib4_lookup(so->so_fibnum, sin->sin_addr, 0, NHR_NONE,
+ inp->inp_flowid);
+ if (nh == NULL)
+ return (FALSE);
+ if ((nh->nh_ifp->if_capenable & IFCAP_MEXTPG) != 0)
+ return (TRUE);
+ return (FALSE);
+#endif
+#ifdef INET6
+ case AF_INET6:
+ inp = sotoinpcb(so);
+ if (inp == NULL)
+ return (FALSE);
+ sin6 = (struct sockaddr_in6 *)ss;
+ in6_splitscope(&sin6->sin6_addr, &kdst, &scopeid);
+ nh = fib6_lookup(so->so_fibnum, &kdst, scopeid, NHR_NONE,
+ inp->inp_flowid);
+ if (nh == NULL)
+ return (FALSE);
+ if ((nh->nh_ifp->if_capenable & IFCAP_MEXTPG) != 0)
+ return (TRUE);
+ return (FALSE);
+#endif
+ default:
+ return (FALSE);
+ }
+}
+
/*
* Create a new transport for a socket optained via soaccept().
*/
@@ -308,6 +372,9 @@
memcpy(&xprt->xp_rtaddr, raddr, raddr->sa_len);
+ if (_svc_vc_checkextpg(so, &xprt->xp_rtaddr))
+ xprt->xp_extpg = TRUE;
+
xprt->xp_ltaddr.ss_len = sizeof(xprt->xp_ltaddr);
error = sosockaddr(so, (struct sockaddr *)&xprt->xp_ltaddr);
if (error)

File Metadata

Mime Type
text/plain
Expires
Thu, Jun 18, 2:41 AM (6 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34041685
Default Alt Text
D55203.id171600.diff (2 KB)

Event Timeline