aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/ef10.c
diff options
context:
space:
mode:
authorTom Zhao <tzhao@solarflare.com>2020-05-11 13:28:40 +0100
committerDavid S. Miller <davem@davemloft.net>2020-05-11 13:31:49 -0700
commitbe904b855200ef4672c765918b31338b59c4847c (patch)
tree850e5e79ba79e5281b07d8f52432119f25cb44fa /drivers/net/ethernet/sfc/ef10.c
parentsfc: move vport_id to struct efx_nic (diff)
downloadlinux-dev-be904b855200ef4672c765918b31338b59c4847c.tar.xz
linux-dev-be904b855200ef4672c765918b31338b59c4847c.zip
sfc: make capability checking a nic_type function
Various MCDI functions (especially in filter handling) need to check the datapath caps, but those live in nic_data (since they don't exist on Siena). Decouple from ef10-specific data structures by adding check_caps to the nic_type, to allow using these functions from non-ef10 drivers. Also add a convenience macro efx_has_cap() to reduce the amount of boilerplate involved in calling it. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sfc/ef10.c')
-rw-r--r--drivers/net/ethernet/sfc/ef10.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 0ad311ff6796..7b3c6214dee6 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -3961,6 +3961,22 @@ out_unlock:
return rc;
}
+static unsigned int ef10_check_caps(const struct efx_nic *efx,
+ u8 flag,
+ u32 offset)
+{
+ const struct efx_ef10_nic_data *nic_data = efx->nic_data;
+
+ switch (offset) {
+ case(MC_CMD_GET_CAPABILITIES_V4_OUT_FLAGS1_OFST):
+ return nic_data->datapath_caps & BIT_ULL(flag);
+ case(MC_CMD_GET_CAPABILITIES_V4_OUT_FLAGS2_OFST):
+ return nic_data->datapath_caps2 & BIT_ULL(flag);
+ default:
+ return 0;
+ }
+}
+
#define EF10_OFFLOAD_FEATURES \
(NETIF_F_IP_CSUM | \
NETIF_F_HW_VLAN_CTAG_FILTER | \
@@ -4073,6 +4089,7 @@ const struct efx_nic_type efx_hunt_a0_vf_nic_type = {
.hwtstamp_filters = 1 << HWTSTAMP_FILTER_NONE |
1 << HWTSTAMP_FILTER_ALL,
.rx_hash_key_size = 40,
+ .check_caps = ef10_check_caps,
};
const struct efx_nic_type efx_hunt_a0_nic_type = {
@@ -4208,4 +4225,5 @@ const struct efx_nic_type efx_hunt_a0_nic_type = {
.hwtstamp_filters = 1 << HWTSTAMP_FILTER_NONE |
1 << HWTSTAMP_FILTER_ALL,
.rx_hash_key_size = 40,
+ .check_caps = ef10_check_caps,
};