{
efx_mcdi_req_t req;
EFX_MCDI_DECLARE_BUF(payload,
- MC_CMD_INIT_EVQ_IN_LEN(EFX_EVQ_NBUFS(EF10_EVQ_MAXNEVS)),
+ MC_CMD_INIT_EVQ_IN_LEN(EF10_EVQ_MAXNBUFS),
MC_CMD_INIT_EVQ_OUT_LEN);
efx_qword_t *dma_addr;
uint64_t addr;
int ev_cut_through;
efx_rc_t rc;
- npages = EFX_EVQ_NBUFS(nevs);
- if (MC_CMD_INIT_EVQ_IN_LEN(npages) > MC_CMD_INIT_EVQ_IN_LENMAX) {
+ npages = efx_evq_nbufs(enp, nevs);
+ if (npages > EF10_EVQ_MAXNBUFS) {
rc = EINVAL;
goto fail1;
}
{
efx_mcdi_req_t req;
EFX_MCDI_DECLARE_BUF(payload,
- MC_CMD_INIT_EVQ_V2_IN_LEN(EFX_EVQ_NBUFS(EF10_EVQ_MAXNEVS)),
+ MC_CMD_INIT_EVQ_V2_IN_LEN(EF10_EVQ_MAXNBUFS),
MC_CMD_INIT_EVQ_V2_OUT_LEN);
boolean_t interrupting;
unsigned int evq_type;
int i;
efx_rc_t rc;
- npages = EFX_EVQ_NBUFS(nevs);
- if (MC_CMD_INIT_EVQ_V2_IN_LEN(npages) > MC_CMD_INIT_EVQ_V2_IN_LENMAX) {
+ npages = efx_evq_nbufs(enp, nevs);
+ if (npages > EF10_EVQ_MAXNBUFS) {
rc = EINVAL;
goto fail1;
}
#define EF10_TXQ_MINNDESCS 512
+#define EF10_EVQ_DESC_SIZE (sizeof (efx_qword_t))
#define EF10_RXQ_DESC_SIZE (sizeof (efx_qword_t))
#define EF10_TXQ_DESC_SIZE (sizeof (efx_qword_t))
+/* Number of hardware EVQ buffers (for compile-time resource dimensions) */
+#define EF10_EVQ_MAXNBUFS (64)
+
/* Maximum independent of EFX_BUG35388_WORKAROUND. */
#define EF10_TXQ_MAXNBUFS 8
+#if EFSYS_OPT_HUNTINGTON
+# if (EF10_EVQ_MAXNBUFS < HUNT_EVQ_MAXNBUFS)
+# error "EF10_EVQ_MAXNBUFS too small"
+# endif
+#endif /* EFSYS_OPT_HUNTINGTON */
+#if EFSYS_OPT_MEDFORD
+# if (EF10_EVQ_MAXNBUFS < MEDFORD_EVQ_MAXNBUFS)
+# error "EF10_EVQ_MAXNBUFS too small"
+# endif
+#endif /* EFSYS_OPT_MEDFORD */
+#if EFSYS_OPT_MEDFORD2
+# if (EF10_EVQ_MAXNBUFS < MEDFORD2_EVQ_MAXNBUFS)
+# error "EF10_EVQ_MAXNBUFS too small"
+# endif
+#endif /* EFSYS_OPT_MEDFORD2 */
+
/* Number of hardware PIO buffers (for compile-time resource dimensions) */
#define EF10_MAX_PIOBUF_NBUFS (16)
uint32_t enc_evq_timer_quantum_ns;
uint32_t enc_evq_timer_max_us;
uint32_t enc_clk_mult;
+ uint32_t enc_ev_desc_size;
uint32_t enc_rx_desc_size;
uint32_t enc_tx_desc_size;
uint32_t enc_rx_prefix_size;
#define EFX_EVQ_MAXNEVS 32768
#define EFX_EVQ_MINNEVS 512
+/*
+ * This macro is deprecated and will be removed.
+ * Use the function efx_evq_size() instead.
+ */
#define EFX_EVQ_SIZE(_nevs) ((_nevs) * sizeof (efx_qword_t))
+
+/*
+ * This macro is deprecated and will be removed.
+ * Use the function efx_evq_nbufs() instead.
+ */
#define EFX_EVQ_NBUFS(_nevs) (EFX_EVQ_SIZE(_nevs) / EFX_BUF_SIZE)
+extern __checkReturn size_t
+efx_evq_size(
+ __in const efx_nic_t *enp,
+ __in unsigned int ndescs);
+
+extern __checkReturn unsigned int
+efx_evq_nbufs(
+ __in const efx_nic_t *enp,
+ __in unsigned int ndescs);
+
#define EFX_EVQ_FLAGS_TYPE_MASK (0x3)
#define EFX_EVQ_FLAGS_TYPE_AUTO (0x0)
#define EFX_EVQ_FLAGS_TYPE_THROUGHPUT (0x1)
return (rc);
}
+ __checkReturn size_t
+efx_evq_size(
+ __in const efx_nic_t *enp,
+ __in unsigned int ndescs)
+{
+ const efx_nic_cfg_t *encp = efx_nic_cfg_get(enp);
+
+ return (ndescs * encp->enc_ev_desc_size);
+}
+
+ __checkReturn unsigned int
+efx_evq_nbufs(
+ __in const efx_nic_t *enp,
+ __in unsigned int ndescs)
+{
+ return (efx_evq_size(enp, ndescs) / EFX_BUF_SIZE);
+}
+
void
efx_ev_fini(
__in efx_nic_t *enp)
#define HUNT_TXQ_MAXNDESCS 4096
#define HUNT_TXQ_MAXNDESCS_BUG35388_WORKAROUND 2048
+#define HUNT_EVQ_MAXNBUFS (64)
+
/* Missing register definitions */
#ifndef ER_DZ_TX_PIOBUF_OFST
#define ER_DZ_TX_PIOBUF_OFST 0x00001000
/* Checksums for TSO sends can be incorrect on Huntington. */
encp->enc_bug61297_workaround = B_TRUE;
+ encp->enc_ev_desc_size = EF10_EVQ_DESC_SIZE;
encp->enc_rx_desc_size = EF10_RXQ_DESC_SIZE;
encp->enc_tx_desc_size = EF10_TXQ_DESC_SIZE;
#define MEDFORD2_TXQ_MAXNDESCS 2048
+#define MEDFORD2_EVQ_MAXNBUFS (64)
+
#ifndef ER_EZ_TX_PIOBUF_SIZE
#define ER_EZ_TX_PIOBUF_SIZE 4096
#endif
encp->enc_evq_timer_max_us = (encp->enc_evq_timer_quantum_ns <<
FRF_CZ_TC_TIMER_VAL_WIDTH) / 1000;
+ encp->enc_ev_desc_size = EF10_EVQ_DESC_SIZE;
encp->enc_rx_desc_size = EF10_RXQ_DESC_SIZE;
encp->enc_tx_desc_size = EF10_TXQ_DESC_SIZE;
#define MEDFORD_TXQ_MAXNDESCS 2048
+#define MEDFORD_EVQ_MAXNBUFS (64)
+
#ifndef ER_EZ_TX_PIOBUF_SIZE
#define ER_EZ_TX_PIOBUF_SIZE 4096
#endif
encp->enc_evq_timer_max_us = (encp->enc_evq_timer_quantum_ns <<
FRF_CZ_TC_TIMER_VAL_WIDTH) / 1000;
+ encp->enc_ev_desc_size = EF10_EVQ_DESC_SIZE;
encp->enc_rx_desc_size = EF10_RXQ_DESC_SIZE;
encp->enc_tx_desc_size = EF10_TXQ_DESC_SIZE;
#define SIENA_RXQ_MAXNDESCS 4096
#define SIENA_RXQ_MINNDESCS 512
+#define SIENA_EVQ_DESC_SIZE (sizeof (efx_qword_t))
#define SIENA_RXQ_DESC_SIZE (sizeof (efx_qword_t))
#define SIENA_TXQ_DESC_SIZE (sizeof (efx_qword_t))
encp->enc_evq_timer_max_us = (encp->enc_evq_timer_quantum_ns <<
FRF_CZ_TC_TIMER_VAL_WIDTH) / 1000;
+ encp->enc_ev_desc_size = SIENA_EVQ_DESC_SIZE;
encp->enc_rx_desc_size = SIENA_RXQ_DESC_SIZE;
encp->enc_tx_desc_size = SIENA_TXQ_DESC_SIZE;