Currently the be2net driver queries the temperature from fw in regular
intervals on be_worker(), which is a delayed work procedure that
reschedules itself to run in next second. The interval for temperature
query is currently set to 64, meaning at each 64 seconds the query will
happen on be_worker().

This patch adds a temperature fw query on be_probe() and increase the
current query timeout of 64 to 128, lowering the frequency of the
temperature fw queries in be_worker() by half. In our experiments, the
probing time got increased by 8.7% (from 11.62s to 12.63s) for a
4-function Lancer adapter (PCI Vid:Did == 10df:e220).

This aims to solve the problem of userspace temperature request right after
be2net probing shows inconsistent values because be_worker() didn't perform
the first temperature query yet. Besides, this patch aims to reduce the
overhead of querying fw each minute for temperature information.

Signed-off-by: Guilherme G. Piccoli <gpicc...@linux.vnet.ibm.com>
---
 drivers/net/ethernet/emulex/benet/be_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/emulex/benet/be_main.c 
b/drivers/net/ethernet/emulex/benet/be_main.c
index 9f44a00..0e23ab2 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -5232,7 +5232,7 @@ static int be_drv_init(struct be_adapter *adapter)
        adapter->tx_fc = true;
 
        /* Must be a power of 2 or else MODULO will BUG_ON */
-       adapter->be_get_temp_freq = 64;
+       adapter->be_get_temp_freq = 128;
 
        return 0;
 
@@ -5445,6 +5445,7 @@ static int be_probe(struct pci_dev *pdev, const struct 
pci_device_id *pdev_id)
                                                               adapter,
                                                               be_hwmon_groups);
                adapter->hwmon_info.be_on_die_temp = BE_INVALID_DIE_TEMP;
+               be_cmd_get_die_temperature(adapter);
        }
 
        dev_info(&pdev->dev, "%s: %s %s port %c\n", nic_name(pdev),
-- 
2.1.0

Reply via email to