From: Andrew Rybchenko Date: Thu, 19 Apr 2018 11:36:59 +0000 (+0100) Subject: net/sfc: add Rx descriptor wait timeout X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=5a1ae82d7b5f2d758937b05389aa686561643e9d;p=dpdk.git net/sfc: add Rx descriptor wait timeout Add device argument to customize Rx descriptor wait timeout which is supported in DPDK firmware variant only in equal stride super-buffer Rx mode only. Signed-off-by: Andrew Rybchenko Reviewed-by: Ivan Malov --- diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index 693aa55855..6b6b5e0ab1 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -372,6 +372,18 @@ boolean parameters value. without checksumming on transmit for higher Tx packet rate if checksumming is not required. +- ``rxd_wait_timeout_ns`` [long] (default **200 us**) + + Adjust timeout in nanoseconds to head-of-line block to wait for + Rx descriptors. + The accepted range is 0 to 400 ms. + Flow control should be enabled to make it work. + The value of **0** disables it and packets are dropped immediately. + When a packet is dropped because of no Rx descriptors, + ``rx_nodesc_drop_cnt`` counter grows. + The feature is supported only by the DPDK firmware variant when equal + stride super-buffer Rx mode is used. + Dynamic Logging Parameters ~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c index fd672265ce..6690053f22 100644 --- a/drivers/net/sfc/sfc.c +++ b/drivers/net/sfc/sfc.c @@ -21,6 +21,7 @@ #include "sfc_rx.h" #include "sfc_tx.h" #include "sfc_kvargs.h" +#include "sfc_tweak.h" int @@ -899,6 +900,32 @@ sfc_fw_variant2str(efx_fw_variant_t efv) } } +static int +sfc_kvarg_rxd_wait_timeout_ns(struct sfc_adapter *sa) +{ + int rc; + long value; + + value = SFC_RXD_WAIT_TIMEOUT_NS_DEF; + + rc = sfc_kvargs_process(sa, SFC_KVARG_RXD_WAIT_TIMEOUT_NS, + sfc_kvarg_long_handler, &value); + if (rc != 0) + return rc; + + if (value < 0 || + (unsigned long)value > EFX_RXQ_ES_SUPER_BUFFER_HOL_BLOCK_MAX) { + sfc_err(sa, "wrong '" SFC_KVARG_RXD_WAIT_TIMEOUT_NS "' " + "was set (%ld);", value); + sfc_err(sa, "it must not be less than 0 or greater than %u", + EFX_RXQ_ES_SUPER_BUFFER_HOL_BLOCK_MAX); + return EINVAL; + } + + sa->rxd_wait_timeout_ns = value; + return 0; +} + static int sfc_nic_probe(struct sfc_adapter *sa) { @@ -916,6 +943,10 @@ sfc_nic_probe(struct sfc_adapter *sa) return rc; } + rc = sfc_kvarg_rxd_wait_timeout_ns(sa); + if (rc != 0) + return rc; + rc = efx_nic_probe(enp, preferred_efv); if (rc == EACCES) { /* Unprivileged functions cannot set FW variant */ diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h index 3a5f6dcb2a..51be44037d 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h @@ -238,6 +238,8 @@ struct sfc_adapter { boolean_t tso; + uint32_t rxd_wait_timeout_ns; + struct sfc_rss rss; /* diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index c3f37bcbaa..e42d55350f 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -2109,6 +2109,7 @@ RTE_PMD_REGISTER_PARAM_STRING(net_sfc_efx, SFC_KVARG_TX_DATAPATH "=" SFC_KVARG_VALUES_TX_DATAPATH " " SFC_KVARG_PERF_PROFILE "=" SFC_KVARG_VALUES_PERF_PROFILE " " SFC_KVARG_FW_VARIANT "=" SFC_KVARG_VALUES_FW_VARIANT " " + SFC_KVARG_RXD_WAIT_TIMEOUT_NS "= " SFC_KVARG_STATS_UPDATE_PERIOD_MS "="); RTE_INIT(sfc_driver_register_logtype); diff --git a/drivers/net/sfc/sfc_kvargs.c b/drivers/net/sfc/sfc_kvargs.c index 53fa939138..7a89c769a2 100644 --- a/drivers/net/sfc/sfc_kvargs.c +++ b/drivers/net/sfc/sfc_kvargs.c @@ -27,6 +27,7 @@ sfc_kvargs_parse(struct sfc_adapter *sa) SFC_KVARG_RX_DATAPATH, SFC_KVARG_TX_DATAPATH, SFC_KVARG_FW_VARIANT, + SFC_KVARG_RXD_WAIT_TIMEOUT_NS, NULL, }; diff --git a/drivers/net/sfc/sfc_kvargs.h b/drivers/net/sfc/sfc_kvargs.h index 9f21cfdbea..4506667a40 100644 --- a/drivers/net/sfc/sfc_kvargs.h +++ b/drivers/net/sfc/sfc_kvargs.h @@ -61,6 +61,8 @@ extern "C" { SFC_KVARG_FW_VARIANT_PACKED_STREAM "|" \ SFC_KVARG_FW_VARIANT_DPDK "]" +#define SFC_KVARG_RXD_WAIT_TIMEOUT_NS "rxd_wait_timeout_ns" + struct sfc_adapter; int sfc_kvargs_parse(struct sfc_adapter *sa); diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index 653724fe4d..57ed34f0bf 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -703,7 +703,7 @@ sfc_rx_qstart(struct sfc_adapter *sa, unsigned int sw_index) rc = efx_rx_qcreate_es_super_buffer(sa->nic, rxq->hw_index, 0, mp_info.contig_block_size, rxq->buf_size, mp->header_size + mp->elt_size + mp->trailer_size, - 0 /* hol_block_timeout */, + sa->rxd_wait_timeout_ns, &rxq->mem, rxq_info->entries, rxq_info->type_flags, evq->common, &rxq->common); break; diff --git a/drivers/net/sfc/sfc_tweak.h b/drivers/net/sfc/sfc_tweak.h index b4026851c8..4d543f6853 100644 --- a/drivers/net/sfc/sfc_tweak.h +++ b/drivers/net/sfc/sfc_tweak.h @@ -34,4 +34,12 @@ /** Number of mbufs to be freed in bulk in a single call */ #define SFC_TX_REAP_BULK_SIZE 32 +/** + * Default head-of-line block timeout to wait for Rx descriptor before + * packet drop because of no descriptors available. + * + * DPDK FW variant only with equal stride super-buffer Rx mode. + */ +#define SFC_RXD_WAIT_TIMEOUT_NS_DEF (200U * 1000) + #endif /* _SFC_TWEAK_H_ */