Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/sfxge/common/efx_ev.c
Show First 20 Lines • Show All 541 Lines • ▼ Show 20 Lines | |||||
static __checkReturn boolean_t | static __checkReturn boolean_t | ||||
falconsiena_ev_rx( | falconsiena_ev_rx( | ||||
__in efx_evq_t *eep, | __in efx_evq_t *eep, | ||||
__in efx_qword_t *eqp, | __in efx_qword_t *eqp, | ||||
__in const efx_ev_callbacks_t *eecp, | __in const efx_ev_callbacks_t *eecp, | ||||
__in_opt void *arg) | __in_opt void *arg) | ||||
{ | { | ||||
efx_nic_t *enp = eep->ee_enp; | |||||
uint32_t id; | uint32_t id; | ||||
uint32_t size; | uint32_t size; | ||||
uint32_t label; | uint32_t label; | ||||
boolean_t ok; | boolean_t ok; | ||||
#if EFSYS_OPT_RX_SCATTER | #if EFSYS_OPT_RX_SCATTER | ||||
boolean_t sop; | boolean_t sop; | ||||
boolean_t jumbo_cont; | boolean_t jumbo_cont; | ||||
#endif /* EFSYS_OPT_RX_SCATTER */ | #endif /* EFSYS_OPT_RX_SCATTER */ | ||||
Show All 13 Lines | |||||
#if EFSYS_OPT_RX_SCATTER | #if EFSYS_OPT_RX_SCATTER | ||||
sop = (EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_SOP) != 0); | sop = (EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_SOP) != 0); | ||||
jumbo_cont = (EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_JUMBO_CONT) != 0); | jumbo_cont = (EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_JUMBO_CONT) != 0); | ||||
#endif /* EFSYS_OPT_RX_SCATTER */ | #endif /* EFSYS_OPT_RX_SCATTER */ | ||||
hdr_type = EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_HDR_TYPE); | hdr_type = EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_HDR_TYPE); | ||||
is_v6 = (enp->en_family != EFX_FAMILY_FALCON && | is_v6 = (EFX_QWORD_FIELD(*eqp, FSF_CZ_RX_EV_IPV6_PKT) != 0); | ||||
EFX_QWORD_FIELD(*eqp, FSF_CZ_RX_EV_IPV6_PKT) != 0); | |||||
/* | /* | ||||
* If packet is marked as OK and packet type is TCP/IP or | * If packet is marked as OK and packet type is TCP/IP or | ||||
* UDP/IP or other IP, then we can rely on the hardware checksums. | * UDP/IP or other IP, then we can rely on the hardware checksums. | ||||
*/ | */ | ||||
switch (hdr_type) { | switch (hdr_type) { | ||||
case FSE_AZ_RX_EV_HDR_TYPE_IPV4V6_TCP: | case FSE_AZ_RX_EV_HDR_TYPE_IPV4V6_TCP: | ||||
flags = EFX_PKT_TCP | EFX_CKSUM_TCPUDP; | flags = EFX_PKT_TCP | EFX_CKSUM_TCPUDP; | ||||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | #endif /* EFSYS_OPT_RX_SCATTER */ | ||||
} | } | ||||
/* | /* | ||||
* The packet parser in Siena can abort parsing packets under | * The packet parser in Siena can abort parsing packets under | ||||
* certain error conditions, setting the PKT_NOT_PARSED bit | * certain error conditions, setting the PKT_NOT_PARSED bit | ||||
* (which clears PKT_OK). If this is set, then don't trust | * (which clears PKT_OK). If this is set, then don't trust | ||||
* the PKT_TYPE field. | * the PKT_TYPE field. | ||||
*/ | */ | ||||
if (enp->en_family != EFX_FAMILY_FALCON && !ok) { | if (!ok) { | ||||
uint32_t parse_err; | uint32_t parse_err; | ||||
parse_err = EFX_QWORD_FIELD(*eqp, FSF_CZ_RX_EV_PKT_NOT_PARSED); | parse_err = EFX_QWORD_FIELD(*eqp, FSF_CZ_RX_EV_PKT_NOT_PARSED); | ||||
if (parse_err != 0) | if (parse_err != 0) | ||||
flags |= EFX_CHECK_VLAN; | flags |= EFX_CHECK_VLAN; | ||||
} | } | ||||
if (~flags & EFX_CHECK_VLAN) { | if (~flags & EFX_CHECK_VLAN) { | ||||
▲ Show 20 Lines • Show All 534 Lines • ▼ Show 20 Lines | falconsiena_ev_qmoderate( | ||||
if (us > encp->enc_evq_timer_max_us) { | if (us > encp->enc_evq_timer_max_us) { | ||||
rc = EINVAL; | rc = EINVAL; | ||||
goto fail1; | goto fail1; | ||||
} | } | ||||
/* If the value is zero then disable the timer */ | /* If the value is zero then disable the timer */ | ||||
if (us == 0) { | if (us == 0) { | ||||
if (enp->en_family == EFX_FAMILY_FALCON) | |||||
EFX_POPULATE_DWORD_2(dword, | EFX_POPULATE_DWORD_2(dword, | ||||
FRF_AB_TC_TIMER_MODE, FFE_AB_TIMER_MODE_DIS, | |||||
FRF_AB_TC_TIMER_VAL, 0); | |||||
else | |||||
EFX_POPULATE_DWORD_2(dword, | |||||
FRF_CZ_TC_TIMER_MODE, FFE_CZ_TIMER_MODE_DIS, | FRF_CZ_TC_TIMER_MODE, FFE_CZ_TIMER_MODE_DIS, | ||||
FRF_CZ_TC_TIMER_VAL, 0); | FRF_CZ_TC_TIMER_VAL, 0); | ||||
} else { | } else { | ||||
uint32_t timer_val; | uint32_t timer_val; | ||||
/* Calculate the timer value in quanta */ | /* Calculate the timer value in quanta */ | ||||
timer_val = us * 1000 / encp->enc_evq_timer_quantum_ns; | timer_val = us * 1000 / encp->enc_evq_timer_quantum_ns; | ||||
/* Moderation value is base 0 so we need to deduct 1 */ | /* Moderation value is base 0 so we need to deduct 1 */ | ||||
if (timer_val > 0) | if (timer_val > 0) | ||||
timer_val--; | timer_val--; | ||||
if (enp->en_family == EFX_FAMILY_FALCON) | |||||
EFX_POPULATE_DWORD_2(dword, | EFX_POPULATE_DWORD_2(dword, | ||||
FRF_AB_TC_TIMER_MODE, FFE_AB_TIMER_MODE_INT_HLDOFF, | |||||
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_MODE, FFE_CZ_TIMER_MODE_INT_HLDOFF, | ||||
FRF_CZ_TC_TIMER_VAL, timer_val); | FRF_CZ_TC_TIMER_VAL, timer_val); | ||||
} | } | ||||
locked = (eep->ee_index == 0) ? 1 : 0; | locked = (eep->ee_index == 0) ? 1 : 0; | ||||
EFX_BAR_TBL_WRITED(enp, FR_BZ_TIMER_COMMAND_REGP0, | EFX_BAR_TBL_WRITED(enp, FR_BZ_TIMER_COMMAND_REGP0, | ||||
eep->ee_index, &dword, locked); | eep->ee_index, &dword, locked); | ||||
return (0); | return (0); | ||||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | #endif | ||||
eep->ee_driver = falconsiena_ev_driver; | eep->ee_driver = falconsiena_ev_driver; | ||||
eep->ee_global = falconsiena_ev_global; | eep->ee_global = falconsiena_ev_global; | ||||
eep->ee_drv_gen = falconsiena_ev_drv_gen; | eep->ee_drv_gen = falconsiena_ev_drv_gen; | ||||
#if EFSYS_OPT_MCDI | #if EFSYS_OPT_MCDI | ||||
eep->ee_mcdi = falconsiena_ev_mcdi; | eep->ee_mcdi = falconsiena_ev_mcdi; | ||||
#endif /* EFSYS_OPT_MCDI */ | #endif /* EFSYS_OPT_MCDI */ | ||||
/* Set up the new event queue */ | /* Set up the new event queue */ | ||||
if (enp->en_family != EFX_FAMILY_FALCON) { | |||||
EFX_POPULATE_OWORD_1(oword, FRF_CZ_TIMER_Q_EN, 1); | EFX_POPULATE_OWORD_1(oword, FRF_CZ_TIMER_Q_EN, 1); | ||||
EFX_BAR_TBL_WRITEO(enp, FR_AZ_TIMER_TBL, index, &oword, B_TRUE); | EFX_BAR_TBL_WRITEO(enp, FR_AZ_TIMER_TBL, index, &oword, B_TRUE); | ||||
} | |||||
EFX_POPULATE_OWORD_3(oword, FRF_AZ_EVQ_EN, 1, FRF_AZ_EVQ_SIZE, size, | EFX_POPULATE_OWORD_3(oword, FRF_AZ_EVQ_EN, 1, FRF_AZ_EVQ_SIZE, size, | ||||
FRF_AZ_EVQ_BUF_BASE_ID, id); | FRF_AZ_EVQ_BUF_BASE_ID, id); | ||||
EFX_BAR_TBL_WRITEO(enp, FR_AZ_EVQ_PTR_TBL, index, &oword, B_TRUE); | EFX_BAR_TBL_WRITEO(enp, FR_AZ_EVQ_PTR_TBL, index, &oword, B_TRUE); | ||||
return (0); | return (0); | ||||
▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | falconsiena_ev_qdestroy( | ||||
efx_oword_t oword; | efx_oword_t oword; | ||||
/* Purge event queue */ | /* Purge event queue */ | ||||
EFX_ZERO_OWORD(oword); | EFX_ZERO_OWORD(oword); | ||||
EFX_BAR_TBL_WRITEO(enp, FR_AZ_EVQ_PTR_TBL, | EFX_BAR_TBL_WRITEO(enp, FR_AZ_EVQ_PTR_TBL, | ||||
eep->ee_index, &oword, B_TRUE); | eep->ee_index, &oword, B_TRUE); | ||||
if (enp->en_family != EFX_FAMILY_FALCON) { | |||||
EFX_ZERO_OWORD(oword); | EFX_ZERO_OWORD(oword); | ||||
EFX_BAR_TBL_WRITEO(enp, FR_AZ_TIMER_TBL, | EFX_BAR_TBL_WRITEO(enp, FR_AZ_TIMER_TBL, eep->ee_index, &oword, B_TRUE); | ||||
eep->ee_index, &oword, B_TRUE); | |||||
} | |||||
} | } | ||||
static void | static void | ||||
falconsiena_ev_fini( | falconsiena_ev_fini( | ||||
__in efx_nic_t *enp) | __in efx_nic_t *enp) | ||||
{ | { | ||||
_NOTE(ARGUNUSED(enp)) | _NOTE(ARGUNUSED(enp)) | ||||
} | } | ||||
#endif /* EFSYS_OPT_SIENA */ | #endif /* EFSYS_OPT_SIENA */ |