Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sfc: do not try to call tc functions when CONFIG_SFC_SRIOV=n

Functions efx_tc_netdev_event and efx_tc_netevent_event do not exist
in that case as object files tc_bindings.o and tc_encap_actions.o
are not built, so the calls to them from ef100_netdev_event and
ef100_netevent_event cause link errors.
Wrap the corresponding header files (tc_bindings.h, tc_encap_actions.h)
with #if IS_ENABLED(CONFIG_SFC_SRIOV), and add an #else with static
inline stubs for these two functions.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202306102026.ISK5JfUQ-lkp@intel.com/
Fixes: 7e5e7d800011 ("sfc: neighbour lookup for TC encap action offload")
Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
Reviewed-by: Martin Habets <habetsm.xilinx@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Edward Cree and committed by
David S. Miller
c08afcdc 12827233

+23
+12
drivers/net/ethernet/sfc/tc_bindings.h
··· 12 12 #define EFX_TC_BINDINGS_H 13 13 #include "net_driver.h" 14 14 15 + #if IS_ENABLED(CONFIG_SFC_SRIOV) 15 16 #include <net/sch_generic.h> 16 17 17 18 struct efx_rep; ··· 29 28 void (*cleanup)(struct flow_block_cb *block_cb)); 30 29 int efx_tc_netdev_event(struct efx_nic *efx, unsigned long event, 31 30 struct net_device *net_dev); 31 + 32 + #else /* CONFIG_SFC_SRIOV */ 33 + 34 + static inline int efx_tc_netdev_event(struct efx_nic *efx, unsigned long event, 35 + struct net_device *net_dev) 36 + { 37 + return NOTIFY_DONE; 38 + } 39 + 40 + #endif /* CONFIG_SFC_SRIOV */ 41 + 32 42 #endif /* EFX_TC_BINDINGS_H */
+11
drivers/net/ethernet/sfc/tc_encap_actions.h
··· 12 12 #define EFX_TC_ENCAP_ACTIONS_H 13 13 #include "net_driver.h" 14 14 15 + #if IS_ENABLED(CONFIG_SFC_SRIOV) 15 16 #include <linux/refcount.h> 16 17 #include <net/tc_act/tc_tunnel_key.h> 17 18 ··· 100 99 void efx_tc_unregister_egdev(struct efx_nic *efx, struct net_device *net_dev); 101 100 int efx_tc_netevent_event(struct efx_nic *efx, unsigned long event, 102 101 void *ptr); 102 + 103 + #else /* CONFIG_SFC_SRIOV */ 104 + 105 + static inline int efx_tc_netevent_event(struct efx_nic *efx, 106 + unsigned long event, void *ptr) 107 + { 108 + return NOTIFY_DONE; 109 + } 110 + 111 + #endif /* CONFIG_SFC_SRIOV */ 103 112 104 113 #endif /* EFX_TC_ENCAP_ACTIONS_H */