Deleted Added
full compact
t4_tom.c (237263) t4_tom.c (239344)
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>
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 237263 2012-06-19 07:34:13Z np $");
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
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
58/* Module ops */
59static int t4_tom_mod_load(void);
60static int t4_tom_mod_unload(void);
61static int t4_tom_modevent(module_t, int, void *);
62
63/* ULD ops and helpers */
64static int t4_tom_activate(struct adapter *);
65static int t4_tom_deactivate(struct adapter *);

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

162 /* Update socket */
163 sb = &so->so_snd;
164 SOCKBUF_LOCK(sb);
165 sb->sb_flags |= SB_NOCOALESCE;
166 SOCKBUF_UNLOCK(sb);
167 sb = &so->so_rcv;
168 SOCKBUF_LOCK(sb);
169 sb->sb_flags |= SB_NOCOALESCE;
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;
170 SOCKBUF_UNLOCK(sb);
171
172 /* Update TCP PCB */
173 tp->tod = &td->tod;
174 tp->t_toe = toep;
175 tp->t_flags |= TF_TOE;
176
177 /* Install an extra hold on inp */

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

230 KASSERT(toepcb_flag(toep, TPF_CPL_PENDING) == 0,
231 ("%s: %p has CPL pending.", __func__, toep));
232 KASSERT(toepcb_flag(toep, TPF_ATTACHED) == 0,
233 ("%s: %p is still attached.", __func__, toep));
234
235 CTR4(KTR_CXGBE, "%s: toep %p (tid %d, l2te %p)",
236 __func__, toep, tid, toep->l2te);
237
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
238 if (toep->l2te)
239 t4_l2t_release(toep->l2te);
240
241 if (tid >= 0) {
242 remove_tid(sc, tid);
243 release_tid(sc, tid, toep->ctrlq);
244 }
245

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

563free_tom_data(struct adapter *sc, struct tom_data *td)
564{
565 KASSERT(TAILQ_EMPTY(&td->toep_list),
566 ("%s: TOE PCB list is not empty.", __func__));
567 KASSERT(td->lctx_count == 0,
568 ("%s: lctx hash table is not empty.", __func__));
569
570 t4_uninit_l2t_cpl_handlers(sc);
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);
571
572 if (td->listen_mask != 0)
573 hashdestroy(td->listen_hash, M_CXGBE, td->listen_mask);
574
575 if (mtx_initialized(&td->lctx_hash_lock))
576 mtx_destroy(&td->lctx_hash_lock);
577 if (mtx_initialized(&td->toep_list_lock))
578 mtx_destroy(&td->toep_list_lock);

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

608 td->listen_hash = hashinit_flags(LISTEN_HASH_SIZE, M_CXGBE,
609 &td->listen_mask, HASH_NOWAIT);
610
611 /* TID tables */
612 rc = alloc_tid_tabs(&sc->tids);
613 if (rc != 0)
614 goto done;
615
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
616 /* CPL handlers */
617 t4_init_connect_cpl_handlers(sc);
618 t4_init_l2t_cpl_handlers(sc);
619 t4_init_listen_cpl_handlers(sc);
620 t4_init_cpl_io_handlers(sc);
621
622 /* toedev ops */
623 tod = &td->tod;

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

683
684 return (rc);
685}
686
687static int
688t4_tom_mod_load(void)
689{
690 int rc;
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;
691
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
692 rc = t4_register_uld(&tom_uld_info);
693 if (rc != 0)
694 t4_tom_mod_unload();
695
696 return (rc);
697}
698
699static void

--- 56 unchanged lines hidden ---
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 ---