tcp_offload.c (194739) | tcp_offload.c (195699) |
---|---|
1/*- 2 * Copyright (c) 2007, Chelsio Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, --- 12 unchanged lines hidden (view full) --- 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2007, Chelsio Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, --- 12 unchanged lines hidden (view full) --- 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/netinet/tcp_offload.c 194739 2009-06-23 17:03:45Z bz $"); | 29__FBSDID("$FreeBSD: head/sys/netinet/tcp_offload.c 195699 2009-07-14 22:48:30Z rwatson $"); |
30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/types.h> 34#include <sys/malloc.h> 35#include <sys/kernel.h> 36#include <sys/sysctl.h> 37#include <sys/mbuf.h> --- 8 unchanged lines hidden (view full) --- 46 47#include <netinet/in.h> 48#include <netinet/in_systm.h> 49#include <netinet/in_pcb.h> 50#include <netinet/tcp.h> 51#include <netinet/tcp_var.h> 52#include <netinet/tcp_offload.h> 53#include <netinet/toedev.h> | 30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/types.h> 34#include <sys/malloc.h> 35#include <sys/kernel.h> 36#include <sys/sysctl.h> 37#include <sys/mbuf.h> --- 8 unchanged lines hidden (view full) --- 46 47#include <netinet/in.h> 48#include <netinet/in_systm.h> 49#include <netinet/in_pcb.h> 50#include <netinet/tcp.h> 51#include <netinet/tcp_var.h> 52#include <netinet/tcp_offload.h> 53#include <netinet/toedev.h> |
54#include <netinet/vinet.h> | |
55 56uint32_t toedev_registration_count; 57 58int 59tcp_offload_connect(struct socket *so, struct sockaddr *nam) 60{ 61 struct ifnet *ifp; 62 struct toedev *tdev; --- 41 unchanged lines hidden (view full) --- 104/* 105 * This file contains code as a short-term staging area before it is moved in 106 * to sys/netinet/tcp_offload.c 107 */ 108 109void 110tcp_offload_twstart(struct tcpcb *tp) 111{ | 54 55uint32_t toedev_registration_count; 56 57int 58tcp_offload_connect(struct socket *so, struct sockaddr *nam) 59{ 60 struct ifnet *ifp; 61 struct toedev *tdev; --- 41 unchanged lines hidden (view full) --- 103/* 104 * This file contains code as a short-term staging area before it is moved in 105 * to sys/netinet/tcp_offload.c 106 */ 107 108void 109tcp_offload_twstart(struct tcpcb *tp) 110{ |
112 INIT_VNET_INET(curvnet); | |
113 114 INP_INFO_WLOCK(&V_tcbinfo); 115 INP_WLOCK(tp->t_inpcb); 116 tcp_twstart(tp); 117 INP_INFO_WUNLOCK(&V_tcbinfo); 118} 119 120struct tcpcb * 121tcp_offload_close(struct tcpcb *tp) 122{ | 111 112 INP_INFO_WLOCK(&V_tcbinfo); 113 INP_WLOCK(tp->t_inpcb); 114 tcp_twstart(tp); 115 INP_INFO_WUNLOCK(&V_tcbinfo); 116} 117 118struct tcpcb * 119tcp_offload_close(struct tcpcb *tp) 120{ |
123 INIT_VNET_INET(curvnet); 124 | 121 |
125 INP_INFO_WLOCK(&V_tcbinfo); 126 INP_WLOCK(tp->t_inpcb); 127 tp = tcp_close(tp); 128 INP_INFO_WUNLOCK(&V_tcbinfo); 129 if (tp) 130 INP_WUNLOCK(tp->t_inpcb); 131 132 return (tp); 133} 134 135struct tcpcb * 136tcp_offload_drop(struct tcpcb *tp, int error) 137{ | 122 INP_INFO_WLOCK(&V_tcbinfo); 123 INP_WLOCK(tp->t_inpcb); 124 tp = tcp_close(tp); 125 INP_INFO_WUNLOCK(&V_tcbinfo); 126 if (tp) 127 INP_WUNLOCK(tp->t_inpcb); 128 129 return (tp); 130} 131 132struct tcpcb * 133tcp_offload_drop(struct tcpcb *tp, int error) 134{ |
138 INIT_VNET_INET(curvnet); 139 | 135 |
140 INP_INFO_WLOCK(&V_tcbinfo); 141 INP_WLOCK(tp->t_inpcb); 142 tp = tcp_drop(tp, error); 143 INP_INFO_WUNLOCK(&V_tcbinfo); 144 if (tp) 145 INP_WUNLOCK(tp->t_inpcb); 146 147 return (tp); 148} 149 | 136 INP_INFO_WLOCK(&V_tcbinfo); 137 INP_WLOCK(tp->t_inpcb); 138 tp = tcp_drop(tp, error); 139 INP_INFO_WUNLOCK(&V_tcbinfo); 140 if (tp) 141 INP_WUNLOCK(tp->t_inpcb); 142 143 return (tp); 144} 145 |