/* SPDX-License-Identifier: BSD-3-Clause
*
- * Copyright (c) 2012-2018 Solarflare Communications Inc.
- * All rights reserved.
+ * Copyright(c) 2019-2020 Xilinx, Inc.
+ * Copyright(c) 2012-2019 Solarflare Communications Inc.
*/
#include "efx.h"
#include "mcdi_mon.h"
#endif
-#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2
-
-#if EFSYS_OPT_QSTATS
-#define EFX_EV_QSTAT_INCR(_eep, _stat) \
- do { \
- (_eep)->ee_stat[_stat]++; \
- _NOTE(CONSTANTCONDITION) \
- } while (B_FALSE)
-#else
-#define EFX_EV_QSTAT_INCR(_eep, _stat)
-#endif
+#if EFX_OPTS_EF10()
/*
* Non-interrupting event queue requires interrrupting event queue to
goto fail2;
}
+ /*
+ * NO_CONT_EV mode is only requested from the firmware when creating
+ * receive queues, but here it needs to be specified at event queue
+ * creation, as the event handler needs to know which format is in use.
+ *
+ * If EFX_EVQ_FLAGS_NO_CONT_EV is specified, all receive queues for this
+ * event queue will be created in NO_CONT_EV mode.
+ *
+ * See SF-109306-TC 5.11 "Events for RXQs in NO_CONT_EV mode".
+ */
+ if (flags & EFX_EVQ_FLAGS_NO_CONT_EV) {
+ if (enp->en_nic_cfg.enc_no_cont_ev_mode_supported == B_FALSE) {
+ rc = EINVAL;
+ goto fail3;
+ }
+ }
+
/* Set up the handler table */
eep->ee_rx = ef10_ev_rx;
eep->ee_tx = ef10_ev_tx;
rc = efx_mcdi_init_evq_v2(enp, index, esmp, ndescs, irq, us,
flags);
if (rc != 0)
- goto fail3;
+ goto fail4;
} else {
/*
* On Huntington we need to specify the settings to use.
rc = efx_mcdi_init_evq(enp, index, esmp, ndescs, irq, us, flags,
low_latency);
if (rc != 0)
- goto fail4;
+ goto fail5;
}
return (0);
+fail5:
+ EFSYS_PROBE(fail5);
fail4:
EFSYS_PROBE(fail4);
fail3:
{
efx_nic_t *enp = eep->ee_enp;
- EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
- enp->en_family == EFX_FAMILY_MEDFORD ||
- enp->en_family == EFX_FAMILY_MEDFORD2);
+ EFSYS_ASSERT(EFX_FAMILY_IS_EF10(enp));
(void) efx_mcdi_fini_evq(enp, eep->ee_index);
}
}
if (EFX_QWORD_FIELD(*eqp, ESF_DZ_RX_PARSE_INCOMPLETE)) {
+ EFX_EV_QSTAT_INCR(eep, EV_RX_PARSE_INCOMPLETE);
flags |= EFX_PKT_PACKED_STREAM_PARSE_INCOMPLETE;
goto deliver;
}
if (mac_class == ESE_DZ_MAC_CLASS_UCAST)
flags |= EFX_PKT_UNICAST;
- /* Increment the count of descriptors read */
+ /*
+ * Increment the count of descriptors read.
+ *
+ * In NO_CONT_EV mode, RX_DSC_PTR_LBITS is actually a packet count, but
+ * when scatter is disabled, there is only one descriptor per packet and
+ * so it can be treated the same.
+ *
+ * TODO: Support scatter in NO_CONT_EV mode.
+ */
desc_count = (next_read_lbits - eersp->eers_rx_read_ptr) &
EFX_MASK32(ESF_DZ_RX_DSC_PTR_LBITS);
eersp->eers_rx_read_ptr += desc_count;
- /*
- * FIXME: add error checking to make sure this a batched event.
- * This could also be an aborted scatter, see Bug36629.
- */
- if (desc_count > 1) {
+ /* Calculate the index of the last descriptor consumed */
+ last_used_id = (eersp->eers_rx_read_ptr - 1) & eersp->eers_rx_mask;
+
+ if (eep->ee_flags & EFX_EVQ_FLAGS_NO_CONT_EV) {
+ if (desc_count > 1)
+ EFX_EV_QSTAT_INCR(eep, EV_RX_BATCH);
+
+ /* Always read the length from the prefix in NO_CONT_EV mode. */
+ flags |= EFX_PKT_PREFIX_LEN;
+
+ /*
+ * Check for an aborted scatter, signalled by the ABORT bit in
+ * NO_CONT_EV mode. The ABORT bit was not used before NO_CONT_EV
+ * mode was added as it was broken in Huntington silicon.
+ */
+ if (EFX_QWORD_FIELD(*eqp, ESF_EZ_RX_ABORT) != 0) {
+ flags |= EFX_DISCARD;
+ goto deliver;
+ }
+ } else if (desc_count > 1) {
+ /*
+ * FIXME: add error checking to make sure this a batched event.
+ * This could also be an aborted scatter, see Bug36629.
+ */
EFX_EV_QSTAT_INCR(eep, EV_RX_BATCH);
flags |= EFX_PKT_PREFIX_LEN;
}
- /* Calculate the index of the last descriptor consumed */
- last_used_id = (eersp->eers_rx_read_ptr - 1) & eersp->eers_rx_mask;
-
/* Check for errors that invalidate checksum and L3/L4 fields */
if (EFX_QWORD_FIELD(*eqp, ESF_DZ_RX_TRUNC_ERR) != 0) {
/* RX frame truncated */
* or headers that are too long for the parser.
* Headers and checksums must be validated by the host.
*/
- /* TODO: EFX_EV_QSTAT_INCR(eep, EV_RX_PARSE_INCOMPLETE); */
+ EFX_EV_QSTAT_INCR(eep, EV_RX_PARSE_INCOMPLETE);
goto deliver;
}
break;
#endif /* EFSYS_OPT_MCDI_PROXY_AUTH */
+#if EFSYS_OPT_MCDI_PROXY_AUTH_SERVER
+ case MCDI_EVENT_CODE_PROXY_REQUEST:
+ efx_mcdi_ev_proxy_request(enp,
+ MCDI_EV_FIELD(eqp, PROXY_REQUEST_BUFF_INDEX));
+ break;
+#endif /* EFSYS_OPT_MCDI_PROXY_AUTH_SERVER */
+
case MCDI_EVENT_CODE_LINKCHANGE: {
efx_link_mode_t link_mode;
#endif
}
-#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */
+#endif /* EFX_OPTS_EF10() */