]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
sfc: only enable TX timestamping if the adapter is licensed for it
authorMartin Habets <mhabets@solarflare.com>
Thu, 25 Jan 2018 17:25:33 +0000 (17:25 +0000)
committerSultan Alsawaf <sultan.alsawaf@canonical.com>
Wed, 24 Jul 2019 15:45:14 +0000 (09:45 -0600)
BugLink: https://bugs.launchpad.net/bugs/1836635
If we try to enable the feature and do not have the license for it, the
 MCPU will refuse and fail our TX queue init.

Signed-off-by: Martin Habets <mhabets@solarflare.com>
Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 50663fe1808fcd08cc60c3adfa3692b27a51161d)
Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/net/ethernet/sfc/ef10.c
drivers/net/ethernet/sfc/nic.h

index 6deef607a914606bf781ebde2e0c89e18162a236..c31d65eb8ca614b4093b4c2f61ca88140b1b713e 100644 (file)
@@ -322,6 +322,25 @@ static int efx_ef10_init_datapath_caps(struct efx_nic *efx)
        return 0;
 }
 
+static void efx_ef10_read_licensed_features(struct efx_nic *efx)
+{
+       MCDI_DECLARE_BUF(inbuf, MC_CMD_LICENSING_V3_IN_LEN);
+       MCDI_DECLARE_BUF(outbuf, MC_CMD_LICENSING_V3_OUT_LEN);
+       struct efx_ef10_nic_data *nic_data = efx->nic_data;
+       size_t outlen;
+       int rc;
+
+       MCDI_SET_DWORD(inbuf, LICENSING_V3_IN_OP,
+                      MC_CMD_LICENSING_V3_IN_OP_REPORT_LICENSE);
+       rc = efx_mcdi_rpc_quiet(efx, MC_CMD_LICENSING_V3, inbuf, sizeof(inbuf),
+                               outbuf, sizeof(outbuf), &outlen);
+       if (rc || (outlen < MC_CMD_LICENSING_V3_OUT_LEN))
+               return;
+
+       nic_data->licensed_features = MCDI_QWORD(outbuf,
+                                        LICENSING_V3_OUT_LICENSED_FEATURES);
+}
+
 static int efx_ef10_get_sysclk_freq(struct efx_nic *efx)
 {
        MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_CLOCK_OUT_LEN);
@@ -722,6 +741,8 @@ static int efx_ef10_probe(struct efx_nic *efx)
        if (rc < 0)
                goto fail5;
 
+       efx_ef10_read_licensed_features(efx);
+
        /* We can have one VI for each vi_stride-byte region.
         * However, until we use TX option descriptors we need two TX queues
         * per channel.
@@ -2401,6 +2422,13 @@ static void efx_ef10_tx_init(struct efx_tx_queue *tx_queue)
        int i;
        BUILD_BUG_ON(MC_CMD_INIT_TXQ_OUT_LEN != 0);
 
+       /* Only attempt to enable TX timestamping if we have the license for it,
+        * otherwise TXQ init will fail
+        */
+       if (!(nic_data->licensed_features &
+             (1 << LICENSED_V3_FEATURES_TX_TIMESTAMPS_LBN)))
+               tx_queue->timestamping = false;
+
        /* TSOv2 is a limited resource that can only be configured on a limited
         * number of queues. TSO without checksum offload is not really a thing,
         * so we only enable it for those queues.
index 43a3fa1486ec8dcdaa5e68e85af30cf8e6e25334..ac54b50f57a5629b0c98a57f76fb1fcb4fa069bd 100644 (file)
@@ -440,6 +440,7 @@ struct efx_ef10_nic_data {
        struct efx_udp_tunnel udp_tunnels[16];
        bool udp_tunnels_dirty;
        struct mutex udp_tunnels_lock;
+       u64 licensed_features;
 };
 
 int efx_init_sriov(void);