diff options
author | arybchik <arybchik@FreeBSD.org> | 2015-03-25 10:53:27 +0000 |
---|---|---|
committer | arybchik <arybchik@FreeBSD.org> | 2015-03-25 10:53:27 +0000 |
commit | bb6987378b2d455e2e2e062919a743858b6d4081 (patch) | |
tree | 83cd7249b2bee668bbad751925abd50dba0d35b2 | |
parent | 322c865fce81a96e05ad53cb7f23d7702a2bdce9 (diff) | |
download | FreeBSD-src-bb6987378b2d455e2e2e062919a743858b6d4081.zip FreeBSD-src-bb6987378b2d455e2e2e062919a743858b6d4081.tar.gz |
MFC: 279048
sfxge: add Florence R7 turbo mode support to common code
Submitted by: Andrew Lee <alee at solarflare.com>
Sponsored by: Solarflare Communications, Inc.
Approved by: gnn (mentor)
-rw-r--r-- | sys/dev/sfxge/common/efx.h | 2 | ||||
-rw-r--r-- | sys/dev/sfxge/common/efx_ev.c | 16 | ||||
-rw-r--r-- | sys/dev/sfxge/common/efx_mcdi.h | 3 | ||||
-rw-r--r-- | sys/dev/sfxge/common/siena_nic.c | 34 |
4 files changed, 38 insertions, 17 deletions
diff --git a/sys/dev/sfxge/common/efx.h b/sys/dev/sfxge/common/efx.h index 7693de4..03fd9b1 100644 --- a/sys/dev/sfxge/common/efx.h +++ b/sys/dev/sfxge/common/efx.h @@ -861,6 +861,7 @@ efx_phy_bist_stop( #define EFX_FEATURE_MCDI 0x00000020 #define EFX_FEATURE_LOOKAHEAD_SPLIT 0x00000040 #define EFX_FEATURE_MAC_HEADER_FILTERS 0x00000080 +#define EFX_FEATURE_TURBO 0x00000100 typedef struct efx_nic_cfg_s { uint32_t enc_board_type; @@ -881,6 +882,7 @@ typedef struct efx_nic_cfg_s { uint32_t enc_rxq_limit; uint32_t enc_buftbl_limit; uint32_t enc_evq_moderation_max; + uint32_t enc_clk_mult; #if EFSYS_OPT_LOOPBACK uint32_t enc_loopback_types[EFX_LINK_NMODES]; #endif /* EFSYS_OPT_LOOPBACK */ diff --git a/sys/dev/sfxge/common/efx_ev.c b/sys/dev/sfxge/common/efx_ev.c index 27ecd41..102f9aa 100644 --- a/sys/dev/sfxge/common/efx_ev.c +++ b/sys/dev/sfxge/common/efx_ev.c @@ -844,13 +844,14 @@ efx_ev_qmoderate( __in unsigned int us) { efx_nic_t *enp = eep->ee_enp; + efx_nic_cfg_t *encp = &(enp->en_nic_cfg); unsigned int locked; efx_dword_t dword; int rc; EFSYS_ASSERT3U(eep->ee_magic, ==, EFX_EVQ_MAGIC); - if (us > enp->en_nic_cfg.enc_evq_moderation_max) { + if (us > encp->enc_evq_moderation_max) { rc = EINVAL; goto fail1; } @@ -869,21 +870,20 @@ efx_ev_qmoderate( uint32_t timer_val; /* Calculate the timer value in quanta */ - us -= (us % EFX_EV_TIMER_QUANTUM); - if (us < EFX_EV_TIMER_QUANTUM) - us = EFX_EV_TIMER_QUANTUM; - - timer_val = us / EFX_EV_TIMER_QUANTUM; + timer_val = us * encp->enc_clk_mult / EFX_EV_TIMER_QUANTUM; /* Moderation value is base 0 so we need to deduct 1 */ + if (timer_val > 0) + timer_val--; + if (enp->en_family == EFX_FAMILY_FALCON) EFX_POPULATE_DWORD_2(dword, FRF_AB_TC_TIMER_MODE, FFE_AB_TIMER_MODE_INT_HLDOFF, - FRF_AB_TIMER_VAL, timer_val - 1); + FRF_AB_TIMER_VAL, timer_val); else EFX_POPULATE_DWORD_2(dword, FRF_CZ_TC_TIMER_MODE, FFE_CZ_TIMER_MODE_INT_HLDOFF, - FRF_CZ_TC_TIMER_VAL, timer_val - 1); + FRF_CZ_TC_TIMER_VAL, timer_val); } locked = (eep->ee_index == 0) ? 1 : 0; diff --git a/sys/dev/sfxge/common/efx_mcdi.h b/sys/dev/sfxge/common/efx_mcdi.h index ad054b3..b115746 100644 --- a/sys/dev/sfxge/common/efx_mcdi.h +++ b/sys/dev/sfxge/common/efx_mcdi.h @@ -233,6 +233,9 @@ efx_mcdi_version( #define MCDI_EV_FIELD(_eqp, _field) \ EFX_QWORD_FIELD(*_eqp, MCDI_EVENT_ ## _field) +#define MCDI_CMD_DWORD_FIELD(_edp, _field) \ + EFX_DWORD_FIELD(*_edp, MC_CMD_ ## _field) + #ifdef __cplusplus } #endif diff --git a/sys/dev/sfxge/common/siena_nic.c b/sys/dev/sfxge/common/siena_nic.c index 532f17d..96c6b67 100644 --- a/sys/dev/sfxge/common/siena_nic.c +++ b/sys/dev/sfxge/common/siena_nic.c @@ -279,7 +279,8 @@ siena_board_cfg( uint8_t outbuf[MAX(MC_CMD_GET_BOARD_CFG_OUT_LENMIN, MC_CMD_GET_RESOURCE_LIMITS_OUT_LEN)]; efx_mcdi_req_t req; - uint8_t *src; + uint8_t *mac_addr; + efx_dword_t *capabilities; int rc; /* Board configuration */ @@ -302,17 +303,35 @@ siena_board_cfg( goto fail2; } - if (emip->emi_port == 1) - src = MCDI_OUT2(req, uint8_t, + if (emip->emi_port == 1) { + mac_addr = MCDI_OUT2(req, uint8_t, GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT0); - else - src = MCDI_OUT2(req, uint8_t, + capabilities = MCDI_OUT2(req, efx_dword_t, + GET_BOARD_CFG_OUT_CAPABILITIES_PORT0); + } else { + mac_addr = MCDI_OUT2(req, uint8_t, GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT1); - EFX_MAC_ADDR_COPY(encp->enc_mac_addr, src); + capabilities = MCDI_OUT2(req, efx_dword_t, + GET_BOARD_CFG_OUT_CAPABILITIES_PORT1); + } + EFX_MAC_ADDR_COPY(encp->enc_mac_addr, mac_addr); encp->enc_board_type = MCDI_OUT_DWORD(req, GET_BOARD_CFG_OUT_BOARD_TYPE); + /* Additional capabilities */ + encp->enc_clk_mult = 1; + if (MCDI_CMD_DWORD_FIELD(capabilities, CAPABILITIES_TURBO)) { + enp->en_features |= EFX_FEATURE_TURBO; + + if (MCDI_CMD_DWORD_FIELD(capabilities, + CAPABILITIES_TURBO_ACTIVE)) + encp->enc_clk_mult = 2; + } + + encp->enc_evq_moderation_max = EFX_EV_TIMER_QUANTUM << + FRF_AB_TIMER_VAL_WIDTH / encp->enc_clk_mult; + /* Resource limits */ req.emr_cmd = MC_CMD_GET_RESOURCE_LIMITS; EFX_STATIC_ASSERT(MC_CMD_GET_RESOURCE_LIMITS_IN_LEN == 0); @@ -607,9 +626,6 @@ siena_nic_probe( if ((rc = siena_board_cfg(enp)) != 0) goto fail4; - encp->enc_evq_moderation_max = - EFX_EV_TIMER_QUANTUM << FRF_CZ_TIMER_VAL_WIDTH; - if ((rc = siena_phy_cfg(enp)) != 0) goto fail5; |