Currently, requesting periodic DMA results in an EACCES error being
returned, but the DPDK driver expects ENOTSUP to handle the
situation gracefully. Implement proper error indication.

Signed-off-by: Ivan Malov <[email protected]>
Reviewed-by: Andy Moreton <[email protected]>
---
 drivers/common/sfc_efx/base/efx_np.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/common/sfc_efx/base/efx_np.c 
b/drivers/common/sfc_efx/base/efx_np.c
index 6d9c62fcda..dafb1dfee6 100644
--- a/drivers/common/sfc_efx/base/efx_np.c
+++ b/drivers/common/sfc_efx/base/efx_np.c
@@ -1724,16 +1724,32 @@ efx_np_mac_stats(
        efx_mcdi_execute(enp, &req);
 
        if (req.emr_rc != 0) {
+               const efx_nic_cfg_t *encp = &enp->en_nic_cfg;
+
+               if (req.emr_rc == EACCES && (enable | events) &&
+                   EFX_PCI_FUNCTION_IS_VF(encp)) {
+                       /*
+                        * VFs cannot request periodic DMAing of statistics.
+                        * Indicate 'ENOTSUP' for the DPDK driver to handle
+                        * this gracefully and stick with one-time uploads.
+                        */
+                       rc = ENOTSUP;
+                       goto fail3;
+               }
+
                /* EF10: Expect ENOENT if no DMA queues are initialised */
                if ((req.emr_rc != ENOENT) ||
                    (enp->en_rx_qcount + enp->en_tx_qcount != 0)) {
                        rc = req.emr_rc;
-                       goto fail3;
+                       goto fail4;
                }
        }
 
        return (0);
 
+fail4:
+       EFSYS_PROBE(fail4);
+
 fail3:
        EFSYS_PROBE(fail3);
 
-- 
2.47.3

Reply via email to