sfc: use efx_has_cap for capability checks outside of NIC-specific code
authorEdward Cree <ecree@solarflare.com>
Mon, 11 May 2020 12:28:56 +0000 (13:28 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 11 May 2020 20:31:49 +0000 (13:31 -0700)
Removes some efx_ef10_nic_data references from common code.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/sfc/mcdi_filters.c
drivers/net/ethernet/sfc/ptp.c

index e6268556b030720fd68517ea5bbf58d6e0f9e6d2..39f8a91c1222e9533e32ca10a980d2d3fbe3220d 100644 (file)
@@ -829,8 +829,7 @@ static int efx_mcdi_filter_insert_def(struct efx_nic *efx,
                efx_filter_set_uc_def(&spec);
 
        if (encap_type) {
-               if (nic_data->datapath_caps &
-                   (1 << MC_CMD_GET_CAPABILITIES_OUT_VXLAN_NVGRE_LBN))
+               if (efx_has_cap(efx, VXLAN_NVGRE, FLAGS1))
                        efx_filter_set_encap_type(&spec, encap_type);
                else
                        /*
@@ -1309,8 +1308,7 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx)
        rc = efx_mcdi_filter_table_probe_matches(efx, table, false);
        if (rc)
                goto fail;
-       if (nic_data->datapath_caps &
-                  (1 << MC_CMD_GET_CAPABILITIES_OUT_VXLAN_NVGRE_LBN))
+       if (efx_has_cap(efx, VXLAN_NVGRE, FLAGS1))
                rc = efx_mcdi_filter_table_probe_matches(efx, table, true);
        if (rc)
                goto fail;
@@ -1920,7 +1918,6 @@ static int efx_mcdi_filter_alloc_rss_context(struct efx_nic *efx, bool exclusive
 {
        MCDI_DECLARE_BUF(inbuf, MC_CMD_RSS_CONTEXT_ALLOC_IN_LEN);
        MCDI_DECLARE_BUF(outbuf, MC_CMD_RSS_CONTEXT_ALLOC_OUT_LEN);
-       struct efx_ef10_nic_data *nic_data = efx->nic_data;
        size_t outlen;
        int rc;
        u32 alloc_type = exclusive ?
@@ -1938,8 +1935,7 @@ static int efx_mcdi_filter_alloc_rss_context(struct efx_nic *efx, bool exclusive
                return 0;
        }
 
-       if (nic_data->datapath_caps &
-           1 << MC_CMD_GET_CAPABILITIES_OUT_RX_RSS_LIMITED_LBN)
+       if (efx_has_cap(efx, RX_RSS_LIMITED, FLAGS1))
                return -EOPNOTSUPP;
 
        MCDI_SET_DWORD(inbuf, RSS_CONTEXT_ALLOC_IN_UPSTREAM_PORT_ID,
@@ -1960,8 +1956,7 @@ static int efx_mcdi_filter_alloc_rss_context(struct efx_nic *efx, bool exclusive
        if (context_size)
                *context_size = rss_spread;
 
-       if (nic_data->datapath_caps &
-           1 << MC_CMD_GET_CAPABILITIES_OUT_ADDITIONAL_RSS_MODES_LBN)
+       if (efx_has_cap(efx, ADDITIONAL_RSS_MODES, FLAGS1))
                efx_mcdi_set_rss_context_flags(efx, ctx);
 
        return 0;
index 59b4f16896a81e561ce6df586c255b6a8639bf4e..04c7283d205e489c3b3960ae717437f41a97a508 100644 (file)
@@ -352,12 +352,7 @@ static int efx_phc_enable(struct ptp_clock_info *ptp,
 
 bool efx_ptp_use_mac_tx_timestamps(struct efx_nic *efx)
 {
-       struct efx_ef10_nic_data *nic_data = efx->nic_data;
-
-       return ((efx_nic_rev(efx) >= EFX_REV_HUNT_A0) &&
-               (nic_data->datapath_caps2 &
-                (1 << MC_CMD_GET_CAPABILITIES_V2_OUT_TX_MAC_TIMESTAMPING_LBN)
-               ));
+       return efx_has_cap(efx, TX_MAC_TIMESTAMPING, FLAGS2);
 }
 
 /* PTP 'extra' channel is still a traffic channel, but we only create TX queues