in6_pcb.c (257176) | in6_pcb.c (263198) |
---|---|
1/*- 2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 3 * Copyright (c) 2010-2011 Juniper Networks, Inc. 4 * All rights reserved. 5 * 6 * Portions of this software were developed by Robert N. M. Watson under 7 * contract to Juniper Networks, Inc. 8 * --- 51 unchanged lines hidden (view full) --- 60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 62 * SUCH DAMAGE. 63 * 64 * @(#)in_pcb.c 8.2 (Berkeley) 1/4/94 65 */ 66 67#include <sys/cdefs.h> | 1/*- 2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 3 * Copyright (c) 2010-2011 Juniper Networks, Inc. 4 * All rights reserved. 5 * 6 * Portions of this software were developed by Robert N. M. Watson under 7 * contract to Juniper Networks, Inc. 8 * --- 51 unchanged lines hidden (view full) --- 60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 62 * SUCH DAMAGE. 63 * 64 * @(#)in_pcb.c 8.2 (Berkeley) 1/4/94 65 */ 66 67#include <sys/cdefs.h> |
68__FBSDID("$FreeBSD: head/sys/netinet6/in6_pcb.c 257176 2013-10-26 17:58:36Z glebius $"); | 68__FBSDID("$FreeBSD: head/sys/netinet6/in6_pcb.c 263198 2014-03-15 00:57:50Z rwatson $"); |
69 70#include "opt_inet.h" 71#include "opt_inet6.h" 72#include "opt_ipsec.h" 73#include "opt_pcbgroup.h" | 69 70#include "opt_inet.h" 71#include "opt_inet6.h" 72#include "opt_ipsec.h" 73#include "opt_pcbgroup.h" |
74#include "opt_rss.h" |
|
74 75#include <sys/param.h> 76#include <sys/systm.h> 77#include <sys/malloc.h> 78#include <sys/mbuf.h> 79#include <sys/domain.h> 80#include <sys/protosw.h> 81#include <sys/socket.h> --- 1049 unchanged lines hidden (view full) --- 1131 * from which a pre-calculated hash value may be extracted. 1132 * 1133 * Possibly more of this logic should be in in6_pcbgroup.c. 1134 */ 1135struct inpcb * 1136in6_pcblookup(struct inpcbinfo *pcbinfo, struct in6_addr *faddr, u_int fport, 1137 struct in6_addr *laddr, u_int lport, int lookupflags, struct ifnet *ifp) 1138{ | 75 76#include <sys/param.h> 77#include <sys/systm.h> 78#include <sys/malloc.h> 79#include <sys/mbuf.h> 80#include <sys/domain.h> 81#include <sys/protosw.h> 82#include <sys/socket.h> --- 1049 unchanged lines hidden (view full) --- 1132 * from which a pre-calculated hash value may be extracted. 1133 * 1134 * Possibly more of this logic should be in in6_pcbgroup.c. 1135 */ 1136struct inpcb * 1137in6_pcblookup(struct inpcbinfo *pcbinfo, struct in6_addr *faddr, u_int fport, 1138 struct in6_addr *laddr, u_int lport, int lookupflags, struct ifnet *ifp) 1139{ |
1139#if defined(PCBGROUP) | 1140#if defined(PCBGROUP) && !defined(RSS) |
1140 struct inpcbgroup *pcbgroup; 1141#endif 1142 1143 KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, 1144 ("%s: invalid lookup flags %d", __func__, lookupflags)); 1145 KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, 1146 ("%s: LOCKPCB not set", __func__)); 1147 | 1141 struct inpcbgroup *pcbgroup; 1142#endif 1143 1144 KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, 1145 ("%s: invalid lookup flags %d", __func__, lookupflags)); 1146 KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, 1147 ("%s: LOCKPCB not set", __func__)); 1148 |
1148#if defined(PCBGROUP) | 1149 /* 1150 * When not using RSS, use connection groups in preference to the 1151 * reservation table when looking up 4-tuples. When using RSS, just 1152 * use the reservation table, due to the cost of the Toeplitz hash 1153 * in software. 1154 * 1155 * XXXRW: This policy belongs in the pcbgroup code, as in principle 1156 * we could be doing RSS with a non-Toeplitz hash that is affordable 1157 * in software. 1158 */ 1159#if defined(PCBGROUP) && !defined(RSS) |
1149 if (in_pcbgroup_enabled(pcbinfo)) { 1150 pcbgroup = in6_pcbgroup_bytuple(pcbinfo, laddr, lport, faddr, 1151 fport); 1152 return (in6_pcblookup_group(pcbinfo, pcbgroup, faddr, fport, 1153 laddr, lport, lookupflags, ifp)); 1154 } 1155#endif 1156 return (in6_pcblookup_hash(pcbinfo, faddr, fport, laddr, lport, --- 10 unchanged lines hidden (view full) --- 1167#endif 1168 1169 KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, 1170 ("%s: invalid lookup flags %d", __func__, lookupflags)); 1171 KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, 1172 ("%s: LOCKPCB not set", __func__)); 1173 1174#ifdef PCBGROUP | 1160 if (in_pcbgroup_enabled(pcbinfo)) { 1161 pcbgroup = in6_pcbgroup_bytuple(pcbinfo, laddr, lport, faddr, 1162 fport); 1163 return (in6_pcblookup_group(pcbinfo, pcbgroup, faddr, fport, 1164 laddr, lport, lookupflags, ifp)); 1165 } 1166#endif 1167 return (in6_pcblookup_hash(pcbinfo, faddr, fport, laddr, lport, --- 10 unchanged lines hidden (view full) --- 1178#endif 1179 1180 KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, 1181 ("%s: invalid lookup flags %d", __func__, lookupflags)); 1182 KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, 1183 ("%s: LOCKPCB not set", __func__)); 1184 1185#ifdef PCBGROUP |
1175 if (in_pcbgroup_enabled(pcbinfo)) { | 1186 /* 1187 * If we can use a hardware-generated hash to look up the connection 1188 * group, use that connection group to find the inpcb. Otherwise 1189 * fall back on a software hash -- or the reservation table if we're 1190 * using RSS. 1191 * 1192 * XXXRW: As above, that policy belongs in the pcbgroup code. 1193 */ 1194 if (in_pcbgroup_enabled(pcbinfo) && 1195 !(M_HASHTYPE_TEST(m, M_HASHTYPE_NONE))) { |
1176 pcbgroup = in6_pcbgroup_byhash(pcbinfo, M_HASHTYPE_GET(m), 1177 m->m_pkthdr.flowid); 1178 if (pcbgroup != NULL) 1179 return (in6_pcblookup_group(pcbinfo, pcbgroup, faddr, 1180 fport, laddr, lport, lookupflags, ifp)); | 1196 pcbgroup = in6_pcbgroup_byhash(pcbinfo, M_HASHTYPE_GET(m), 1197 m->m_pkthdr.flowid); 1198 if (pcbgroup != NULL) 1199 return (in6_pcblookup_group(pcbinfo, pcbgroup, faddr, 1200 fport, laddr, lport, lookupflags, ifp)); |
1201#ifndef RSS |
|
1181 pcbgroup = in6_pcbgroup_bytuple(pcbinfo, laddr, lport, faddr, 1182 fport); 1183 return (in6_pcblookup_group(pcbinfo, pcbgroup, faddr, fport, 1184 laddr, lport, lookupflags, ifp)); | 1202 pcbgroup = in6_pcbgroup_bytuple(pcbinfo, laddr, lport, faddr, 1203 fport); 1204 return (in6_pcblookup_group(pcbinfo, pcbgroup, faddr, fport, 1205 laddr, lport, lookupflags, ifp)); |
1206#endif |
|
1185 } 1186#endif 1187 return (in6_pcblookup_hash(pcbinfo, faddr, fport, laddr, lport, 1188 lookupflags, ifp)); 1189} 1190 1191void 1192init_sin6(struct sockaddr_in6 *sin6, struct mbuf *m) --- 13 unchanged lines hidden --- | 1207 } 1208#endif 1209 return (in6_pcblookup_hash(pcbinfo, faddr, fport, laddr, lport, 1210 lookupflags, ifp)); 1211} 1212 1213void 1214init_sin6(struct sockaddr_in6 *sin6, struct mbuf *m) --- 13 unchanged lines hidden --- |