Author: arybchik
Date: Sun Feb 22 19:13:52 2015
New Revision: 279182
URL: https://svnweb.freebsd.org/changeset/base/279182

Log:
  sfxge: correct event queue interrupt moderation timer quanta
  
  Submitted by:   Andrew Lee <alee at solarflare.com>
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:    gnn (mentor)

Modified:
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_ev.c
  head/sys/dev/sfxge/common/efx_impl.h
  head/sys/dev/sfxge/common/siena_nic.c
  head/sys/dev/sfxge/sfxge_ev.c

Modified: head/sys/dev/sfxge/common/efx.h
==============================================================================
--- head/sys/dev/sfxge/common/efx.h     Sun Feb 22 18:59:00 2015        
(r279181)
+++ head/sys/dev/sfxge/common/efx.h     Sun Feb 22 19:13:52 2015        
(r279182)
@@ -895,7 +895,8 @@ typedef struct efx_nic_cfg_s {
        uint32_t                enc_txq_limit;
        uint32_t                enc_rxq_limit;
        uint32_t                enc_buftbl_limit;
-       uint32_t                enc_evq_moderation_max;
+       uint32_t                enc_evq_timer_quantum_ns;
+       uint32_t                enc_evq_timer_max_us;
        uint32_t                enc_clk_mult;
 #if EFSYS_OPT_LOOPBACK
        uint32_t                enc_loopback_types[EFX_LINK_NMODES];

Modified: head/sys/dev/sfxge/common/efx_ev.c
==============================================================================
--- head/sys/dev/sfxge/common/efx_ev.c  Sun Feb 22 18:59:00 2015        
(r279181)
+++ head/sys/dev/sfxge/common/efx_ev.c  Sun Feb 22 19:13:52 2015        
(r279182)
@@ -857,7 +857,7 @@ efx_ev_qmoderate(
 
        EFSYS_ASSERT3U(eep->ee_magic, ==, EFX_EVQ_MAGIC);
 
-       if (us > encp->enc_evq_moderation_max) {
+       if (us > encp->enc_evq_timer_max_us) {
                rc = EINVAL;
                goto fail1;
        }
@@ -876,7 +876,7 @@ efx_ev_qmoderate(
                uint32_t timer_val;
 
                /* Calculate the timer value in quanta */
-               timer_val = us * encp->enc_clk_mult / EFX_EV_TIMER_QUANTUM;
+               timer_val = us * 1000 / encp->enc_evq_timer_quantum_ns;
 
                /* Moderation value is base 0 so we need to deduct 1 */
                if (timer_val > 0)

Modified: head/sys/dev/sfxge/common/efx_impl.h
==============================================================================
--- head/sys/dev/sfxge/common/efx_impl.h        Sun Feb 22 18:59:00 2015        
(r279181)
+++ head/sys/dev/sfxge/common/efx_impl.h        Sun Feb 22 19:13:52 2015        
(r279182)
@@ -408,7 +408,8 @@ struct efx_evq_s {
 
 #define        EFX_EVQ_MAGIC   0x08081997
 
-#define        EFX_EV_TIMER_QUANTUM    5
+#define        EFX_EVQ_FALCON_TIMER_QUANTUM_NS 4968 /* 621 cycles */
+#define        EFX_EVQ_SIENA_TIMER_QUANTUM_NS  6144 /* 768 cycles */
 
 struct efx_rxq_s {
        uint32_t                        er_magic;

Modified: head/sys/dev/sfxge/common/siena_nic.c
==============================================================================
--- head/sys/dev/sfxge/common/siena_nic.c       Sun Feb 22 18:59:00 2015        
(r279181)
+++ head/sys/dev/sfxge/common/siena_nic.c       Sun Feb 22 19:13:52 2015        
(r279182)
@@ -329,8 +329,10 @@ siena_board_cfg(
                        encp->enc_clk_mult = 2;
        }
 
-       encp->enc_evq_moderation_max = EFX_EV_TIMER_QUANTUM <<
-               FRF_AB_TIMER_VAL_WIDTH / encp->enc_clk_mult;
+       encp->enc_evq_timer_quantum_ns =
+               EFX_EVQ_SIENA_TIMER_QUANTUM_NS / encp->enc_clk_mult;
+       encp->enc_evq_timer_max_us = (encp->enc_evq_timer_quantum_ns <<
+               FRF_CZ_TC_TIMER_VAL_WIDTH) / 1000;
 
        /* Resource limits */
        req.emr_cmd = MC_CMD_GET_RESOURCE_LIMITS;

Modified: head/sys/dev/sfxge/sfxge_ev.c
==============================================================================
--- head/sys/dev/sfxge/sfxge_ev.c       Sun Feb 22 18:59:00 2015        
(r279181)
+++ head/sys/dev/sfxge/sfxge_ev.c       Sun Feb 22 19:13:52 2015        
(r279182)
@@ -522,7 +522,7 @@ sfxge_int_mod_handler(SYSCTL_HANDLER_ARG
                 * so we have to range-check the value ourselves.
                 */
                if (moderation >
-                   efx_nic_cfg_get(sc->enp)->enc_evq_moderation_max) {
+                   efx_nic_cfg_get(sc->enp)->enc_evq_timer_max_us) {
                        error = EINVAL;
                        goto out;
                }
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to