t4_l2t.c (256281) | t4_l2t.c (284052) |
---|---|
1/*- 2 * Copyright (c) 2012 Chelsio Communications, 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 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2012 Chelsio Communications, 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 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26#include <sys/cdefs.h> |
27__FBSDID("$FreeBSD: stable/10/sys/dev/cxgbe/t4_l2t.c 245434 2013-01-14 20:36:22Z np $"); | 27__FBSDID("$FreeBSD: stable/10/sys/dev/cxgbe/t4_l2t.c 284052 2015-06-06 09:28:40Z np $"); |
28 29#include "opt_inet.h" 30#include "opt_inet6.h" 31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/kernel.h> 35#include <sys/module.h> --- 71 unchanged lines hidden (view full) --- 107 108/* 109 * Write an L2T entry. Must be called with the entry locked. 110 * The write may be synchronous or asynchronous. 111 */ 112int 113t4_write_l2e(struct adapter *sc, struct l2t_entry *e, int sync) 114{ | 28 29#include "opt_inet.h" 30#include "opt_inet6.h" 31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/kernel.h> 35#include <sys/module.h> --- 71 unchanged lines hidden (view full) --- 107 108/* 109 * Write an L2T entry. Must be called with the entry locked. 110 * The write may be synchronous or asynchronous. 111 */ 112int 113t4_write_l2e(struct adapter *sc, struct l2t_entry *e, int sync) 114{ |
115 struct wrqe *wr; | 115 struct wrq_cookie cookie; |
116 struct cpl_l2t_write_req *req; 117 int idx = e->idx + sc->vres.l2t.start; 118 119 mtx_assert(&e->lock, MA_OWNED); 120 | 116 struct cpl_l2t_write_req *req; 117 int idx = e->idx + sc->vres.l2t.start; 118 119 mtx_assert(&e->lock, MA_OWNED); 120 |
121 wr = alloc_wrqe(sizeof(*req), &sc->sge.mgmtq); 122 if (wr == NULL) | 121 req = start_wrq_wr(&sc->sge.mgmtq, howmany(sizeof(*req), 16), &cookie); 122 if (req == NULL) |
123 return (ENOMEM); | 123 return (ENOMEM); |
124 req = wrtod(wr); | |
125 126 INIT_TP_WR(req, 0); 127 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_L2T_WRITE_REQ, idx | 128 V_SYNC_WR(sync) | V_TID_QID(sc->sge.fwq.abs_id))); 129 req->params = htons(V_L2T_W_PORT(e->lport) | V_L2T_W_NOREPLY(!sync)); 130 req->l2t_idx = htons(idx); 131 req->vlan = htons(e->vlan); 132 memcpy(req->dst_mac, e->dmac, sizeof(req->dst_mac)); 133 | 124 125 INIT_TP_WR(req, 0); 126 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_L2T_WRITE_REQ, idx | 127 V_SYNC_WR(sync) | V_TID_QID(sc->sge.fwq.abs_id))); 128 req->params = htons(V_L2T_W_PORT(e->lport) | V_L2T_W_NOREPLY(!sync)); 129 req->l2t_idx = htons(idx); 130 req->vlan = htons(e->vlan); 131 memcpy(req->dst_mac, e->dmac, sizeof(req->dst_mac)); 132 |
134 t4_wrq_tx(sc, wr); | 133 commit_wrq_wr(&sc->sge.mgmtq, req, &cookie); |
135 136 if (sync && e->state != L2T_STATE_SWITCHING) 137 e->state = L2T_STATE_SYNC_WRITE; 138 139 return (0); 140} 141 142/* --- 187 unchanged lines hidden --- | 134 135 if (sync && e->state != L2T_STATE_SWITCHING) 136 e->state = L2T_STATE_SYNC_WRITE; 137 138 return (0); 139} 140 141/* --- 187 unchanged lines hidden --- |