net/sfc/base: support different event descriptor sizes
For consistency with the size of Tx descriptors, the size of event descriptors should be a part of NIC config, not a macro that is common for all NIC families. Also, add a max number of EvQ buffers define which is needed to initialize an MCDI buffer at compile time. Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
This commit is contained in:
parent
eebbd4250d
commit
d6b55d5682
@ -123,7 +123,7 @@ efx_mcdi_init_evq(
|
||||
{
|
||||
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;
|
||||
@ -133,8 +133,8 @@ efx_mcdi_init_evq(
|
||||
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;
|
||||
}
|
||||
@ -259,7 +259,7 @@ efx_mcdi_init_evq_v2(
|
||||
{
|
||||
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;
|
||||
@ -269,8 +269,8 @@ efx_mcdi_init_evq_v2(
|
||||
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;
|
||||
}
|
||||
|
@ -19,12 +19,32 @@ extern "C" {
|
||||
|
||||
#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)
|
||||
|
||||
|
@ -1284,6 +1284,7 @@ typedef struct efx_nic_cfg_s {
|
||||
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;
|
||||
@ -1987,9 +1988,28 @@ efx_ev_fini(
|
||||
#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)
|
||||
|
@ -173,6 +173,24 @@ fail1:
|
||||
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)
|
||||
|
@ -19,6 +19,8 @@ extern "C" {
|
||||
#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
|
||||
|
@ -186,6 +186,7 @@ hunt_board_cfg(
|
||||
/* 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;
|
||||
|
||||
|
@ -14,6 +14,8 @@ extern "C" {
|
||||
|
||||
#define MEDFORD2_TXQ_MAXNDESCS 2048
|
||||
|
||||
#define MEDFORD2_EVQ_MAXNBUFS (64)
|
||||
|
||||
#ifndef ER_EZ_TX_PIOBUF_SIZE
|
||||
#define ER_EZ_TX_PIOBUF_SIZE 4096
|
||||
#endif
|
||||
|
@ -101,6 +101,7 @@ medford2_board_cfg(
|
||||
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;
|
||||
|
||||
|
@ -14,6 +14,8 @@ extern "C" {
|
||||
|
||||
#define MEDFORD_TXQ_MAXNDESCS 2048
|
||||
|
||||
#define MEDFORD_EVQ_MAXNBUFS (64)
|
||||
|
||||
#ifndef ER_EZ_TX_PIOBUF_SIZE
|
||||
#define ER_EZ_TX_PIOBUF_SIZE 4096
|
||||
#endif
|
||||
|
@ -99,6 +99,7 @@ medford_board_cfg(
|
||||
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;
|
||||
|
||||
|
@ -34,6 +34,7 @@ extern "C" {
|
||||
#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))
|
||||
|
||||
|
@ -104,6 +104,7 @@ siena_board_cfg(
|
||||
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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user