Deleted Added
sdiff udiff text old ( 237263 ) new ( 239344 )
full compact
1/*-
2 * Copyright (c) 2012 Chelsio Communications, Inc.
3 * All rights reserved.
4 * Written by: Navdeep Parhar <np@FreeBSD.org>
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 12 unchanged lines hidden (view full) ---

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/dev/cxgbe/tom/t4_tom.c 239344 2012-08-17 00:49:29Z np $");
30
31#include "opt_inet.h"
32
33#include <sys/param.h>
34#include <sys/types.h>
35#include <sys/systm.h>
36#include <sys/kernel.h>
37#include <sys/ktr.h>

--- 12 unchanged lines hidden (view full) ---

50
51#ifdef TCP_OFFLOAD
52#include "common/common.h"
53#include "common/t4_msg.h"
54#include "common/t4_regs.h"
55#include "tom/t4_tom_l2t.h"
56#include "tom/t4_tom.h"
57
58static struct protosw ddp_protosw;
59static struct pr_usrreqs ddp_usrreqs;
60
61/* Module ops */
62static int t4_tom_mod_load(void);
63static int t4_tom_mod_unload(void);
64static int t4_tom_modevent(module_t, int, void *);
65
66/* ULD ops and helpers */
67static int t4_tom_activate(struct adapter *);
68static int t4_tom_deactivate(struct adapter *);

--- 96 unchanged lines hidden (view full) ---

165 /* Update socket */
166 sb = &so->so_snd;
167 SOCKBUF_LOCK(sb);
168 sb->sb_flags |= SB_NOCOALESCE;
169 SOCKBUF_UNLOCK(sb);
170 sb = &so->so_rcv;
171 SOCKBUF_LOCK(sb);
172 sb->sb_flags |= SB_NOCOALESCE;
173 if (toep->ulp_mode == ULP_MODE_TCPDDP)
174 so->so_proto = &ddp_protosw;
175 SOCKBUF_UNLOCK(sb);
176
177 /* Update TCP PCB */
178 tp->tod = &td->tod;
179 tp->t_toe = toep;
180 tp->t_flags |= TF_TOE;
181
182 /* Install an extra hold on inp */

--- 52 unchanged lines hidden (view full) ---

235 KASSERT(toepcb_flag(toep, TPF_CPL_PENDING) == 0,
236 ("%s: %p has CPL pending.", __func__, toep));
237 KASSERT(toepcb_flag(toep, TPF_ATTACHED) == 0,
238 ("%s: %p is still attached.", __func__, toep));
239
240 CTR4(KTR_CXGBE, "%s: toep %p (tid %d, l2te %p)",
241 __func__, toep, tid, toep->l2te);
242
243 if (toep->ulp_mode == ULP_MODE_TCPDDP)
244 release_ddp_resources(toep);
245
246 if (toep->l2te)
247 t4_l2t_release(toep->l2te);
248
249 if (tid >= 0) {
250 remove_tid(sc, tid);
251 release_tid(sc, tid, toep->ctrlq);
252 }
253

--- 317 unchanged lines hidden (view full) ---

571free_tom_data(struct adapter *sc, struct tom_data *td)
572{
573 KASSERT(TAILQ_EMPTY(&td->toep_list),
574 ("%s: TOE PCB list is not empty.", __func__));
575 KASSERT(td->lctx_count == 0,
576 ("%s: lctx hash table is not empty.", __func__));
577
578 t4_uninit_l2t_cpl_handlers(sc);
579 t4_uninit_cpl_io_handlers(sc);
580 t4_uninit_ddp(sc, td);
581
582 if (td->listen_mask != 0)
583 hashdestroy(td->listen_hash, M_CXGBE, td->listen_mask);
584
585 if (mtx_initialized(&td->lctx_hash_lock))
586 mtx_destroy(&td->lctx_hash_lock);
587 if (mtx_initialized(&td->toep_list_lock))
588 mtx_destroy(&td->toep_list_lock);

--- 29 unchanged lines hidden (view full) ---

618 td->listen_hash = hashinit_flags(LISTEN_HASH_SIZE, M_CXGBE,
619 &td->listen_mask, HASH_NOWAIT);
620
621 /* TID tables */
622 rc = alloc_tid_tabs(&sc->tids);
623 if (rc != 0)
624 goto done;
625
626 t4_init_ddp(sc, td);
627
628 /* CPL handlers */
629 t4_init_connect_cpl_handlers(sc);
630 t4_init_l2t_cpl_handlers(sc);
631 t4_init_listen_cpl_handlers(sc);
632 t4_init_cpl_io_handlers(sc);
633
634 /* toedev ops */
635 tod = &td->tod;

--- 59 unchanged lines hidden (view full) ---

695
696 return (rc);
697}
698
699static int
700t4_tom_mod_load(void)
701{
702 int rc;
703 struct protosw *tcp_protosw;
704
705 tcp_protosw = pffindproto(PF_INET, IPPROTO_TCP, SOCK_STREAM);
706 if (tcp_protosw == NULL)
707 return (ENOPROTOOPT);
708
709 bcopy(tcp_protosw, &ddp_protosw, sizeof(ddp_protosw));
710 bcopy(tcp_protosw->pr_usrreqs, &ddp_usrreqs, sizeof(ddp_usrreqs));
711 ddp_usrreqs.pru_soreceive = t4_soreceive_ddp;
712 ddp_protosw.pr_usrreqs = &ddp_usrreqs;
713
714 rc = t4_register_uld(&tom_uld_info);
715 if (rc != 0)
716 t4_tom_mod_unload();
717
718 return (rc);
719}
720
721static void

--- 56 unchanged lines hidden ---