Message ID | ad6213aa-b163-8708-47a4-553cb5aa0a8f@solarflare.com |
---|---|
State | Accepted |
Delegated to: | David Ahern |
Headers | show |
Series | sfc: remove nic_data usage in common code | expand |
On Mon, 11 May 2020 13:28:40 +0100 Edward Cree wrote: > From: Tom Zhao <tzhao@solarflare.com> > > 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> Commit 66119f0b0358 ("sfc: make capability checking a nic_type function") author Signed-off-by missing author email: tzhao@solarflare.com committer email: kuba@kernel.org Signed-off-by: Edward Cree <ecree@solarflare.com> Errors in tree with Signed-off-by, please fix! Also with W=1: ../drivers/net/ethernet/sfc/siena.c:951:14: warning: symbol 'siena_check_caps' was not declared. Should it be static? 1a3,5 ../drivers/net/ethernet/sfc/siena.c:951:14: warning: no previous prototype for ‘siena_check_caps’ [-Wmissing-prototypes] 951 | unsigned int siena_check_caps(const struct efx_nic *efx, | ^~~~~~~~~~~~~~~~
Hi Edward,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
[also build test WARNING on linus/master v5.7-rc5 next-20200511]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Edward-Cree/sfc-remove-nic_data-usage-in-common-code/20200512-011744
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git a6f0b26d6a5dcf27980e65f965779a929039f11d
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-191-gc51a0382-dirty
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/sfc/siena.c:951:14: sparse: sparse: symbol 'siena_check_caps' was not declared. Should it be static?
Please review and possibly fold the followup patch.
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
On 11/05/2020 23:36, Jakub Kicinski wrote: > Also with W=1: > > ../drivers/net/ethernet/sfc/siena.c:951:14: warning: symbol 'siena_check_caps' was not declared. Should it be static? > 1a3,5 > ../drivers/net/ethernet/sfc/siena.c:951:14: warning: no previous prototype for ‘siena_check_caps’ [-Wmissing-prototypes] > 951 | unsigned int siena_check_caps(const struct efx_nic *efx, > | ^~~~~~~~~~~~~~~~ Yup, it turns out not only is this missing 'static' but it's also not used — the assignment into siena_a0_nic_typeis missing, I must have screwed up a rebase at some point. I'll send a follow-up, since Dave has already applied it. Thanks for the review. (And I'll try to get in the habit of checking the SOBs better; sorry about that. I'm still used to the old "first sign-off is the point of exit from the company" flow; plus I messed up my checkpatch invocation in a way that prevented it catching this.) -ed
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 @@ static int efx_ef10_udp_tnl_del_port(struct efx_nic *efx, 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, }; diff --git a/drivers/net/ethernet/sfc/mcdi.h b/drivers/net/ethernet/sfc/mcdi.h index 54a45010b576..b107e4c00285 100644 --- a/drivers/net/ethernet/sfc/mcdi.h +++ b/drivers/net/ethernet/sfc/mcdi.h @@ -326,6 +326,18 @@ void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev); #define MCDI_EVENT_FIELD(_ev, _field) \ EFX_QWORD_FIELD(_ev, MCDI_EVENT_ ## _field) +#define MCDI_CAPABILITY(field) \ + MC_CMD_GET_CAPABILITIES_V4_OUT_ ## field ## _LBN + +#define MCDI_CAPABILITY_OFST(field) \ + MC_CMD_GET_CAPABILITIES_V4_OUT_ ## field ## _OFST + +/* field is FLAGS1 or FLAGS2 */ +#define efx_has_cap(efx, flag, field) \ + efx->type->check_caps(efx, \ + MCDI_CAPABILITY(flag), \ + MCDI_CAPABILITY_OFST(field)) + void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len); int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, u16 *fw_subtype_list, u32 *capabilities); diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h index d43f22c8f31c..bdeea48ff938 100644 --- a/drivers/net/ethernet/sfc/net_driver.h +++ b/drivers/net/ethernet/sfc/net_driver.h @@ -1354,6 +1354,9 @@ struct efx_nic_type { void (*get_wol)(struct efx_nic *efx, struct ethtool_wolinfo *wol); int (*set_wol)(struct efx_nic *efx, u32 type); void (*resume_wol)(struct efx_nic *efx); + unsigned int (*check_caps)(const struct efx_nic *efx, + u8 flag, + u32 offset); int (*test_chip)(struct efx_nic *efx, struct efx_self_tests *tests); int (*test_nvram)(struct efx_nic *efx); void (*mcdi_request)(struct efx_nic *efx, diff --git a/drivers/net/ethernet/sfc/siena.c b/drivers/net/ethernet/sfc/siena.c index baa464161626..ed1cb6caa69d 100644 --- a/drivers/net/ethernet/sfc/siena.c +++ b/drivers/net/ethernet/sfc/siena.c @@ -948,6 +948,13 @@ static int siena_mtd_probe(struct efx_nic *efx) #endif /* CONFIG_SFC_MTD */ +unsigned int siena_check_caps(const struct efx_nic *efx, + u8 flag, u32 offset) +{ + /* Siena did not support MC_CMD_GET_CAPABILITIES */ + return 0; +} + /************************************************************************** * * Revision-dependent attributes used by efx.c and nic.c