net/sfc: fix TSO limits imposed to the number of Tx queues
authorIvan Malov <ivan.malov@oktetlabs.ru>
Mon, 23 Jan 2017 11:06:15 +0000 (11:06 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 30 Jan 2017 21:18:26 +0000 (22:18 +0100)
The number of Tx queues requested by the user must not be overridden;
instead, the limits imposed by TSO must be applied to the advertised
maximum

Fixes: fec33d5bb3eb ("net/sfc: support firmware-assisted TSO")
Cc: stable@dpdk.org
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andrew Lee <alee@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@solarflare.com>
drivers/net/sfc/sfc.c
drivers/net/sfc/sfc_tx.c

index 457a53e..03ecec2 100644 (file)
@@ -203,6 +203,13 @@ sfc_estimate_resource_limits(struct sfc_adapter *sa)
        limits.edl_max_txq_count =
                MIN(encp->enc_txq_limit,
                    limits.edl_max_evq_count - 1 - limits.edl_max_rxq_count);
+
+       if (sa->tso)
+               limits.edl_max_txq_count =
+                       MIN(limits.edl_max_txq_count,
+                           encp->enc_fw_assisted_tso_v2_n_contexts /
+                           encp->enc_hw_pf_count);
+
        SFC_ASSERT(limits.edl_max_txq_count >= limits.edl_min_rxq_count);
 
        /* Configure the minimum required resources needed for the
@@ -601,12 +608,17 @@ sfc_attach(struct sfc_adapter *sa)
        if (rc != 0)
                goto fail_nic_reset;
 
+       encp = efx_nic_cfg_get(sa->nic);
+
+       sa->tso = encp->enc_fw_assisted_tso_v2_enabled;
+       if (!sa->tso)
+               sfc_warn(sa, "TSO support isn't available on this adapter");
+
        sfc_log_init(sa, "estimate resource limits");
        rc = sfc_estimate_resource_limits(sa);
        if (rc != 0)
                goto fail_estimate_rsrc_limits;
 
-       encp = efx_nic_cfg_get(sa->nic);
        sa->txq_max_entries = encp->enc_txq_max_ndescs;
        SFC_ASSERT(rte_is_power_of_2(sa->txq_max_entries));
 
@@ -621,10 +633,6 @@ sfc_attach(struct sfc_adapter *sa)
        if (rc != 0)
                goto fail_set_rss_defaults;
 
-       sa->tso = efx_nic_cfg_get(sa->nic)->enc_fw_assisted_tso_v2_enabled;
-       if (!sa->tso)
-               sfc_warn(sa, "TSO support isn't available on this adapter");
-
        sfc_log_init(sa, "fini nic");
        efx_nic_fini(enp);
 
index e772584..5a6282c 100644 (file)
@@ -312,11 +312,6 @@ sfc_tx_init(struct sfc_adapter *sa)
 
        sa->txq_count = sa->eth_dev->data->nb_tx_queues;
 
-       if (sa->tso)
-               sa->txq_count = MIN(sa->txq_count,
-                  efx_nic_cfg_get(sa->nic)->enc_fw_assisted_tso_v2_n_contexts /
-                  efx_nic_cfg_get(sa->nic)->enc_hw_pf_count);
-
        sa->txq_info = rte_calloc_socket("sfc-txqs", sa->txq_count,
                                         sizeof(sa->txq_info[0]), 0,
                                         sa->socket_id);