netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] sfc: do not try to call tc functions when CONFIG_SFC_SRIOV=n
@ 2023-06-12 20:54 edward.cree
  2023-06-13  6:09 ` Simon Horman
  2023-06-14  8:31 ` Martin Habets
  0 siblings, 2 replies; 3+ messages in thread
From: edward.cree @ 2023-06-12 20:54 UTC (permalink / raw)
  To: linux-net-drivers, davem, kuba, pabeni, edumazet
  Cc: Edward Cree, netdev, habetsm.xilinx, oe-kbuild-all, simon.horman,
	kernel test robot

From: Edward Cree <ecree.xilinx@gmail.com>

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.
Guard the relevant part of ef100_netdev_event with #ifdef, as well as
 the entire function ef100_netevent_event and the code that registers
 and unregisters the netevent notifier.
Also guard the includes of tc_bindings.h and tc_encap_actions.h into
 ef100_netdev.c, as the symbols from these headers are only available
 when the corresponding object files are built.

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>
---
 drivers/net/ethernet/sfc/ef100_netdev.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/sfc/ef100_netdev.c b/drivers/net/ethernet/sfc/ef100_netdev.c
index 7f7d560cb2b4..3bb0442de7ea 100644
--- a/drivers/net/ethernet/sfc/ef100_netdev.c
+++ b/drivers/net/ethernet/sfc/ef100_netdev.c
@@ -23,8 +23,10 @@
 #include "mcdi_filters.h"
 #include "rx_common.h"
 #include "ef100_sriov.h"
+#ifdef CONFIG_SFC_SRIOV
 #include "tc_bindings.h"
 #include "tc_encap_actions.h"
+#endif
 #include "efx_devlink.h"
 
 static void ef100_update_name(struct efx_nic *efx)
@@ -301,22 +303,27 @@ int ef100_netdev_event(struct notifier_block *this,
 {
 	struct efx_nic *efx = container_of(this, struct efx_nic, netdev_notifier);
 	struct net_device *net_dev = netdev_notifier_info_to_dev(ptr);
+#ifdef CONFIG_SFC_SRIOV
 	struct ef100_nic_data *nic_data = efx->nic_data;
 	int err;
+#endif
 
 	if (efx->net_dev == net_dev &&
 	    (event == NETDEV_CHANGENAME || event == NETDEV_REGISTER))
 		ef100_update_name(efx);
 
+#ifdef CONFIG_SFC_SRIOV
 	if (!nic_data->grp_mae)
 		return NOTIFY_DONE;
 	err = efx_tc_netdev_event(efx, event, net_dev);
 	if (err & NOTIFY_STOP_MASK)
 		return err;
+#endif
 
 	return NOTIFY_DONE;
 }
 
+#ifdef CONFIG_SFC_SRIOV
 static int ef100_netevent_event(struct notifier_block *this,
 				unsigned long event, void *ptr)
 {
@@ -329,9 +336,9 @@ static int ef100_netevent_event(struct notifier_block *this,
 	err = efx_tc_netevent_event(efx, event, ptr);
 	if (err & NOTIFY_STOP_MASK)
 		return err;
-
 	return NOTIFY_DONE;
 };
+#endif
 
 static int ef100_register_netdev(struct efx_nic *efx)
 {
@@ -392,8 +399,8 @@ void ef100_remove_netdev(struct efx_probe_data *probe_data)
 	rtnl_unlock();
 
 	unregister_netdevice_notifier(&efx->netdev_notifier);
-	unregister_netevent_notifier(&efx->netevent_notifier);
 #if defined(CONFIG_SFC_SRIOV)
+	unregister_netevent_notifier(&efx->netevent_notifier);
 	if (!efx->type->is_vf)
 		efx_ef100_pci_sriov_disable(efx, true);
 #endif
@@ -513,6 +520,7 @@ int ef100_probe_netdev(struct efx_probe_data *probe_data)
 		goto fail;
 	}
 
+#ifdef CONFIG_SFC_SRIOV
 	efx->netevent_notifier.notifier_call = ef100_netevent_event;
 	rc = register_netevent_notifier(&efx->netevent_notifier);
 	if (rc) {
@@ -520,6 +528,7 @@ int ef100_probe_netdev(struct efx_probe_data *probe_data)
 			  "Failed to register netevent notifier, rc=%d\n", rc);
 		goto fail;
 	}
+#endif
 
 	efx_probe_devlink_unlock(efx);
 	return rc;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] sfc: do not try to call tc functions when CONFIG_SFC_SRIOV=n
  2023-06-12 20:54 [PATCH net-next] sfc: do not try to call tc functions when CONFIG_SFC_SRIOV=n edward.cree
@ 2023-06-13  6:09 ` Simon Horman
  2023-06-14  8:31 ` Martin Habets
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2023-06-13  6:09 UTC (permalink / raw)
  To: edward.cree
  Cc: linux-net-drivers, davem, kuba, pabeni, edumazet, Edward Cree,
	netdev, habetsm.xilinx, oe-kbuild-all, kernel test robot

On Mon, Jun 12, 2023 at 09:54:28PM +0100, edward.cree@amd.com wrote:
> From: Edward Cree <ecree.xilinx@gmail.com>
> 
> 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.
> Guard the relevant part of ef100_netdev_event with #ifdef, as well as
>  the entire function ef100_netevent_event and the code that registers
>  and unregisters the netevent notifier.
> Also guard the includes of tc_bindings.h and tc_encap_actions.h into
>  ef100_netdev.c, as the symbols from these headers are only available
>  when the corresponding object files are built.
> 
> 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: Simon Horman <simon.horman@corigine.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] sfc: do not try to call tc functions when CONFIG_SFC_SRIOV=n
  2023-06-12 20:54 [PATCH net-next] sfc: do not try to call tc functions when CONFIG_SFC_SRIOV=n edward.cree
  2023-06-13  6:09 ` Simon Horman
@ 2023-06-14  8:31 ` Martin Habets
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Habets @ 2023-06-14  8:31 UTC (permalink / raw)
  To: edward.cree
  Cc: linux-net-drivers, davem, kuba, pabeni, edumazet, Edward Cree,
	netdev, oe-kbuild-all, simon.horman, kernel test robot

On Mon, Jun 12, 2023 at 09:54:28PM +0100, edward.cree@amd.com wrote:
> From: Edward Cree <ecree.xilinx@gmail.com>
> 
> 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.
> Guard the relevant part of ef100_netdev_event with #ifdef, as well as
>  the entire function ef100_netevent_event and the code that registers
>  and unregisters the netevent notifier.
> Also guard the includes of tc_bindings.h and tc_encap_actions.h into
>  ef100_netdev.c, as the symbols from these headers are only available
>  when the corresponding object files are built.
> 
> 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>
> ---
>  drivers/net/ethernet/sfc/ef100_netdev.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/sfc/ef100_netdev.c b/drivers/net/ethernet/sfc/ef100_netdev.c
> index 7f7d560cb2b4..3bb0442de7ea 100644
> --- a/drivers/net/ethernet/sfc/ef100_netdev.c
> +++ b/drivers/net/ethernet/sfc/ef100_netdev.c
> @@ -23,8 +23,10 @@
>  #include "mcdi_filters.h"
>  #include "rx_common.h"
>  #include "ef100_sriov.h"
> +#ifdef CONFIG_SFC_SRIOV
>  #include "tc_bindings.h"
>  #include "tc_encap_actions.h"
> +#endif

Don't do this, it is old-style coding.
Put a static inline function definition inside the .h files
for !CONFIG_SFC_SRIOV. Just for the APIs you need.

>  #include "efx_devlink.h"
>  
>  static void ef100_update_name(struct efx_nic *efx)
> @@ -301,22 +303,27 @@ int ef100_netdev_event(struct notifier_block *this,
>  {
>  	struct efx_nic *efx = container_of(this, struct efx_nic, netdev_notifier);
>  	struct net_device *net_dev = netdev_notifier_info_to_dev(ptr);
> +#ifdef CONFIG_SFC_SRIOV
>  	struct ef100_nic_data *nic_data = efx->nic_data;
>  	int err;
> +#endif
>  
>  	if (efx->net_dev == net_dev &&
>  	    (event == NETDEV_CHANGENAME || event == NETDEV_REGISTER))
>  		ef100_update_name(efx);
>  
> +#ifdef CONFIG_SFC_SRIOV
>  	if (!nic_data->grp_mae)

Use IS_ENABLED(CONFIG_SFC_SRIOV) here, like was done in commit a59f832a71c9.

Martin

>  		return NOTIFY_DONE;
>  	err = efx_tc_netdev_event(efx, event, net_dev);
>  	if (err & NOTIFY_STOP_MASK)
>  		return err;
> +#endif
>  
>  	return NOTIFY_DONE;
>  }
>  
> +#ifdef CONFIG_SFC_SRIOV
>  static int ef100_netevent_event(struct notifier_block *this,
>  				unsigned long event, void *ptr)
>  {
> @@ -329,9 +336,9 @@ static int ef100_netevent_event(struct notifier_block *this,
>  	err = efx_tc_netevent_event(efx, event, ptr);
>  	if (err & NOTIFY_STOP_MASK)
>  		return err;
> -
>  	return NOTIFY_DONE;
>  };
> +#endif
>  
>  static int ef100_register_netdev(struct efx_nic *efx)
>  {
> @@ -392,8 +399,8 @@ void ef100_remove_netdev(struct efx_probe_data *probe_data)
>  	rtnl_unlock();
>  
>  	unregister_netdevice_notifier(&efx->netdev_notifier);
> -	unregister_netevent_notifier(&efx->netevent_notifier);
>  #if defined(CONFIG_SFC_SRIOV)
> +	unregister_netevent_notifier(&efx->netevent_notifier);
>  	if (!efx->type->is_vf)
>  		efx_ef100_pci_sriov_disable(efx, true);
>  #endif
> @@ -513,6 +520,7 @@ int ef100_probe_netdev(struct efx_probe_data *probe_data)
>  		goto fail;
>  	}
>  
> +#ifdef CONFIG_SFC_SRIOV
>  	efx->netevent_notifier.notifier_call = ef100_netevent_event;
>  	rc = register_netevent_notifier(&efx->netevent_notifier);
>  	if (rc) {
> @@ -520,6 +528,7 @@ int ef100_probe_netdev(struct efx_probe_data *probe_data)
>  			  "Failed to register netevent notifier, rc=%d\n", rc);
>  		goto fail;
>  	}
> +#endif
>  
>  	efx_probe_devlink_unlock(efx);
>  	return rc;

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-14  8:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-12 20:54 [PATCH net-next] sfc: do not try to call tc functions when CONFIG_SFC_SRIOV=n edward.cree
2023-06-13  6:09 ` Simon Horman
2023-06-14  8:31 ` Martin Habets

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).