t4vf_hw.c (306664) | t4vf_hw.c (309560) |
---|---|
1/*- 2 * Copyright (c) 2016 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 --- 11 unchanged lines hidden (view full) --- 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 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2016 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 --- 11 unchanged lines hidden (view full) --- 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 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: stable/11/sys/dev/cxgbe/common/t4vf_hw.c 306664 2016-10-03 23:49:05Z jhb $"); | 28__FBSDID("$FreeBSD: stable/11/sys/dev/cxgbe/common/t4vf_hw.c 309560 2016-12-05 20:43:25Z jhb $"); |
29 30#include "common.h" 31#include "t4_regs.h" | 29 30#include "common.h" 31#include "t4_regs.h" |
32#include "t4_regs_values.h" |
|
32 33#undef msleep 34#define msleep(x) do { \ 35 if (cold) \ 36 DELAY((x) * 1000); \ 37 else \ 38 pause("t4hw", (x) * hz / 1000); \ 39} while (0) --- 85 unchanged lines hidden (view full) --- 125 sp->timer_val[2] = core_ticks_to_us(adapter, G_TIMERVALUE2(vals[3])); 126 sp->timer_val[3] = core_ticks_to_us(adapter, G_TIMERVALUE3(vals[3])); 127 sp->timer_val[4] = core_ticks_to_us(adapter, G_TIMERVALUE4(vals[4])); 128 sp->timer_val[5] = core_ticks_to_us(adapter, G_TIMERVALUE5(vals[4])); 129 130 sp->fl_starve_threshold = G_EGRTHRESHOLD(vals[5]) * 2 + 1; 131 if (is_t4(adapter)) 132 sp->fl_starve_threshold2 = sp->fl_starve_threshold; | 33 34#undef msleep 35#define msleep(x) do { \ 36 if (cold) \ 37 DELAY((x) * 1000); \ 38 else \ 39 pause("t4hw", (x) * hz / 1000); \ 40} while (0) --- 85 unchanged lines hidden (view full) --- 126 sp->timer_val[2] = core_ticks_to_us(adapter, G_TIMERVALUE2(vals[3])); 127 sp->timer_val[3] = core_ticks_to_us(adapter, G_TIMERVALUE3(vals[3])); 128 sp->timer_val[4] = core_ticks_to_us(adapter, G_TIMERVALUE4(vals[4])); 129 sp->timer_val[5] = core_ticks_to_us(adapter, G_TIMERVALUE5(vals[4])); 130 131 sp->fl_starve_threshold = G_EGRTHRESHOLD(vals[5]) * 2 + 1; 132 if (is_t4(adapter)) 133 sp->fl_starve_threshold2 = sp->fl_starve_threshold; |
134 else if (is_t5(adapter)) 135 sp->fl_starve_threshold2 = G_EGRTHRESHOLDPACKING(vals[5]) * 2 + 1; |
|
133 else | 136 else |
134 sp->fl_starve_threshold2 = G_EGRTHRESHOLDPACKING(vals[5]) * 2 + 135 1; | 137 sp->fl_starve_threshold2 = G_T6_EGRTHRESHOLDPACKING(vals[5]) * 2 + 1; |
136 137 /* 138 * We need the Queues/Page and Host Page Size for our VF. 139 * This is based on the PF from which we're instantiated. 140 */ 141 whoami = t4_read_reg(adapter, VF_PL_REG(A_PL_VF_WHOAMI)); 142 pf = G_SOURCEPF(whoami); 143 --- 19 unchanged lines hidden (view full) --- 163 * SGE_CONTROL in order to determine how ingress packet data will be 164 * laid out in Packed Buffer Mode. Unfortunately, older versions of 165 * the firmware won't let us retrieve SGE_CONTROL2 so if we get a 166 * failure grabbing it we throw an error since we can't figure out the 167 * right value. 168 */ 169 sp->spg_len = sp->sge_control & F_EGRSTATUSPAGESIZE ? 128 : 64; 170 sp->fl_pktshift = G_PKTSHIFT(sp->sge_control); | 138 139 /* 140 * We need the Queues/Page and Host Page Size for our VF. 141 * This is based on the PF from which we're instantiated. 142 */ 143 whoami = t4_read_reg(adapter, VF_PL_REG(A_PL_VF_WHOAMI)); 144 pf = G_SOURCEPF(whoami); 145 --- 19 unchanged lines hidden (view full) --- 165 * SGE_CONTROL in order to determine how ingress packet data will be 166 * laid out in Packed Buffer Mode. Unfortunately, older versions of 167 * the firmware won't let us retrieve SGE_CONTROL2 so if we get a 168 * failure grabbing it we throw an error since we can't figure out the 169 * right value. 170 */ 171 sp->spg_len = sp->sge_control & F_EGRSTATUSPAGESIZE ? 128 : 64; 172 sp->fl_pktshift = G_PKTSHIFT(sp->sge_control); |
171 sp->pad_boundary = 1 << (G_INGPADBOUNDARY(sp->sge_control) + 5); | 173 if (chip_id(adapter) <= CHELSIO_T5) { 174 sp->pad_boundary = 1 << (G_INGPADBOUNDARY(sp->sge_control) + 175 X_INGPADBOUNDARY_SHIFT); 176 } else { 177 sp->pad_boundary = 1 << (G_INGPADBOUNDARY(sp->sge_control) + 178 X_T6_INGPADBOUNDARY_SHIFT); 179 } |
172 if (is_t4(adapter)) 173 sp->pack_boundary = sp->pad_boundary; 174 else { 175 params[0] = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | 176 V_FW_PARAMS_PARAM_XYZ(A_SGE_CONTROL2)); 177 v = t4vf_query_params(adapter, 1, params, vals); 178 if (v != FW_SUCCESS) { 179 CH_ERR(adapter, "Unable to get SGE Control2; " --- 197 unchanged lines hidden --- | 180 if (is_t4(adapter)) 181 sp->pack_boundary = sp->pad_boundary; 182 else { 183 params[0] = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | 184 V_FW_PARAMS_PARAM_XYZ(A_SGE_CONTROL2)); 185 v = t4vf_query_params(adapter, 1, params, vals); 186 if (v != FW_SUCCESS) { 187 CH_ERR(adapter, "Unable to get SGE Control2; " --- 197 unchanged lines hidden --- |