net/sfc: add Rx descriptor wait timeout
authorAndrew Rybchenko <arybchenko@solarflare.com>
Thu, 19 Apr 2018 11:36:59 +0000 (12:36 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 27 Apr 2018 17:00:59 +0000 (18:00 +0100)
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 <arybchenko@solarflare.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
doc/guides/nics/sfc_efx.rst
drivers/net/sfc/sfc.c
drivers/net/sfc/sfc.h
drivers/net/sfc/sfc_ethdev.c
drivers/net/sfc/sfc_kvargs.c
drivers/net/sfc/sfc_kvargs.h
drivers/net/sfc/sfc_rx.c
drivers/net/sfc/sfc_tweak.h

index 693aa55..6b6b5e0 100644 (file)
@@ -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
 ~~~~~~~~~~~~~~~~~~~~~~~~~~
index fd67226..6690053 100644 (file)
@@ -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 */
index 3a5f6dc..51be440 100644 (file)
@@ -238,6 +238,8 @@ struct sfc_adapter {
 
        boolean_t                       tso;
 
+       uint32_t                        rxd_wait_timeout_ns;
+
        struct sfc_rss                  rss;
 
        /*
index c3f37bc..e42d553 100644 (file)
@@ -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 "=<long> "
        SFC_KVARG_STATS_UPDATE_PERIOD_MS "=<long>");
 
 RTE_INIT(sfc_driver_register_logtype);
index 53fa939..7a89c76 100644 (file)
@@ -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,
        };
 
index 9f21cfd..4506667 100644 (file)
@@ -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);
index 653724f..57ed34f 100644 (file)
@@ -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;
index b402685..4d543f6 100644 (file)
 /** 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_ */