diff mbox series

[iwl-next] ice: allow hot-swapping XDP programs

Message ID 20230613151005.337462-1-maciej.fijalkowski@intel.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [iwl-next] ice: allow hot-swapping XDP programs | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 10 this patch: 219
netdev/cc_maintainers warning 10 maintainers not CCed: kuba@kernel.org hawk@kernel.org daniel@iogearbox.net jesse.brandeburg@intel.com john.fastabend@gmail.com bpf@vger.kernel.org davem@davemloft.net pabeni@redhat.com ast@kernel.org edumazet@google.com
netdev/build_clang fail Errors and warnings before: 8 this patch: 37
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 10 this patch: 219
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 24 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Fijalkowski, Maciej June 13, 2023, 3:10 p.m. UTC
Currently ice driver's .ndo_bpf callback brings the interface down and
up independently of the presence of XDP resources. This is only needed
when either these resources have to be configured or removed. It means
that if one is switching XDP programs on-the-fly with running traffic,
packets will be dropped.

To avoid this, compare early on ice_xdp_setup_prog() state of incoming
bpf_prog pointer vs the bpf_prog pointer that is already assigned to
VSI. Do the swap in case VSI has bpf_prog and incoming one are non-NULL.

Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_main.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

Comments

Alexander Lobakin June 13, 2023, 3:15 p.m. UTC | #1
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Date: Tue, 13 Jun 2023 17:10:05 +0200

> Currently ice driver's .ndo_bpf callback brings the interface down and
> up independently of the presence of XDP resources. This is only needed
> when either these resources have to be configured or removed. It means
> that if one is switching XDP programs on-the-fly with running traffic,
> packets will be dropped.
> 
> To avoid this, compare early on ice_xdp_setup_prog() state of incoming
> bpf_prog pointer vs the bpf_prog pointer that is already assigned to
> VSI. Do the swap in case VSI has bpf_prog and incoming one are non-NULL.
> 
> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>

[0] :D

But if be serious, are you sure you won't have any pointer tears /
partial reads/writes without such RCU protection as added in the
linked commit ?

> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
> index a1f7c8edc22f..8940ee505811 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> @@ -2922,6 +2922,11 @@ ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog,
>  					   "MTU is too large for linear frames and XDP prog does not support frags");
>  			return -EOPNOTSUPP;
>  		}
> +
> +	/* hot swap progs and avoid toggling link */
> +	if (ice_is_xdp_ena_vsi(vsi) == !!prog) {
> +		ice_vsi_assign_bpf_prog(vsi, prog);
> +		return 0;
>  	}
>  
>  	/* need to stop netdev while setting up the program for Rx rings */
> @@ -2956,13 +2961,6 @@ ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog,
>  		xdp_ring_err = ice_realloc_zc_buf(vsi, false);
>  		if (xdp_ring_err)
>  			NL_SET_ERR_MSG_MOD(extack, "Freeing XDP Rx resources failed");
> -	} else {
> -		/* safe to call even when prog == vsi->xdp_prog as
> -		 * dev_xdp_install in net/core/dev.c incremented prog's
> -		 * refcount so corresponding bpf_prog_put won't cause
> -		 * underflow
> -		 */
> -		ice_vsi_assign_bpf_prog(vsi, prog);
>  	}
>  
>  	if (if_running)

[0]
https://github.com/alobakin/linux/commit/5645adb0943dabeadfb9f6d00202c78fb9594fbe

Thanks,
Olek
Fijalkowski, Maciej June 13, 2023, 3:20 p.m. UTC | #2
On Tue, Jun 13, 2023 at 05:15:15PM +0200, Alexander Lobakin wrote:
> From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> Date: Tue, 13 Jun 2023 17:10:05 +0200
> 
> > Currently ice driver's .ndo_bpf callback brings the interface down and
> > up independently of the presence of XDP resources. This is only needed
> > when either these resources have to be configured or removed. It means
> > that if one is switching XDP programs on-the-fly with running traffic,
> > packets will be dropped.
> > 
> > To avoid this, compare early on ice_xdp_setup_prog() state of incoming
> > bpf_prog pointer vs the bpf_prog pointer that is already assigned to
> > VSI. Do the swap in case VSI has bpf_prog and incoming one are non-NULL.
> > 
> > Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> 
> [0] :D
> 
> But if be serious, are you sure you won't have any pointer tears /
> partial reads/writes without such RCU protection as added in the
> linked commit ?

Since we removed rcu sections from driver sides and given an assumption
that local_bh_{dis,en}able() pair serves this purpose now i believe this
is safe. Are you aware of:

https://lore.kernel.org/bpf/20210624160609.292325-1-toke@redhat.com/

?

> 
> > ---
> >  drivers/net/ethernet/intel/ice/ice_main.c | 12 +++++-------
> >  1 file changed, 5 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
> > index a1f7c8edc22f..8940ee505811 100644
> > --- a/drivers/net/ethernet/intel/ice/ice_main.c
> > +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> > @@ -2922,6 +2922,11 @@ ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog,
> >  					   "MTU is too large for linear frames and XDP prog does not support frags");
> >  			return -EOPNOTSUPP;
> >  		}
> > +
> > +	/* hot swap progs and avoid toggling link */
> > +	if (ice_is_xdp_ena_vsi(vsi) == !!prog) {
> > +		ice_vsi_assign_bpf_prog(vsi, prog);
> > +		return 0;
> >  	}
> >  
> >  	/* need to stop netdev while setting up the program for Rx rings */
> > @@ -2956,13 +2961,6 @@ ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog,
> >  		xdp_ring_err = ice_realloc_zc_buf(vsi, false);
> >  		if (xdp_ring_err)
> >  			NL_SET_ERR_MSG_MOD(extack, "Freeing XDP Rx resources failed");
> > -	} else {
> > -		/* safe to call even when prog == vsi->xdp_prog as
> > -		 * dev_xdp_install in net/core/dev.c incremented prog's
> > -		 * refcount so corresponding bpf_prog_put won't cause
> > -		 * underflow
> > -		 */
> > -		ice_vsi_assign_bpf_prog(vsi, prog);
> >  	}
> >  
> >  	if (if_running)
> 
> [0]
> https://github.com/alobakin/linux/commit/5645adb0943dabeadfb9f6d00202c78fb9594fbe
> 
> Thanks,
> Olek
kernel test robot June 13, 2023, 4:43 p.m. UTC | #3
Hi Maciej,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tnguy-next-queue/dev-queue]

url:    https://github.com/intel-lab-lkp/linux/commits/Maciej-Fijalkowski/ice-allow-hot-swapping-XDP-programs/20230613-231046
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git dev-queue
patch link:    https://lore.kernel.org/r/20230613151005.337462-1-maciej.fijalkowski%40intel.com
patch subject: [PATCH iwl-next] ice: allow hot-swapping XDP programs
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20230614/202306140054.1fcSzVzu-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 12.3.0
reproduce (this is a W=1 build):
        mkdir -p ~/bin
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git remote add tnguy-next-queue https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git
        git fetch tnguy-next-queue dev-queue
        git checkout tnguy-next-queue/dev-queue
        b4 shazam https://lore.kernel.org/r/20230613151005.337462-1-maciej.fijalkowski@intel.com
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=alpha olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=alpha SHELL=/bin/bash drivers/net/

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306140054.1fcSzVzu-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/net/ethernet/intel/ice/ice_main.c: In function 'ice_xdp_setup_prog':
   drivers/net/ethernet/intel/ice/ice_main.c:2978:12: error: invalid storage class for function 'ice_xdp_safe_mode'
    2978 | static int ice_xdp_safe_mode(struct net_device __always_unused *dev,
         |            ^~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:2978:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    2978 | static int ice_xdp_safe_mode(struct net_device __always_unused *dev,
         | ^~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:2992:12: error: invalid storage class for function 'ice_xdp'
    2992 | static int ice_xdp(struct net_device *dev, struct netdev_bpf *xdp)
         |            ^~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3017:13: error: invalid storage class for function 'ice_ena_misc_vector'
    3017 | static void ice_ena_misc_vector(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3055:20: error: invalid storage class for function 'ice_misc_intr'
    3055 | static irqreturn_t ice_misc_intr(int __always_unused irq, void *data)
         |                    ^~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3188:20: error: invalid storage class for function 'ice_misc_intr_thread_fn'
    3188 | static irqreturn_t ice_misc_intr_thread_fn(int __always_unused irq, void *data)
         |                    ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3222:13: error: invalid storage class for function 'ice_dis_ctrlq_interrupts'
    3222 | static void ice_dis_ctrlq_interrupts(struct ice_hw *hw)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3246:13: error: invalid storage class for function 'ice_free_irq_msix_misc'
    3246 | static void ice_free_irq_msix_misc(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3268:13: error: invalid storage class for function 'ice_ena_ctrlq_interrupts'
    3268 | static void ice_ena_ctrlq_interrupts(struct ice_hw *hw, u16 reg_idx)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3302:12: error: invalid storage class for function 'ice_req_irq_msix_misc'
    3302 | static int ice_req_irq_msix_misc(struct ice_pf *pf)
         |            ^~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3357:13: error: invalid storage class for function 'ice_napi_add'
    3357 | static void ice_napi_add(struct ice_vsi *vsi)
         |             ^~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3373:13: error: invalid storage class for function 'ice_set_ops'
    3373 | static void ice_set_ops(struct ice_vsi *vsi)
         |             ^~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3400:13: error: invalid storage class for function 'ice_set_netdev_features'
    3400 | static void ice_set_netdev_features(struct net_device *netdev)
         |             ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3509:1: error: invalid storage class for function 'ice_pf_vsi_setup'
    3509 | ice_pf_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi)
         | ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3521:1: error: invalid storage class for function 'ice_chnl_vsi_setup'
    3521 | ice_chnl_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi,
         | ^~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3543:1: error: invalid storage class for function 'ice_ctrl_vsi_setup'
    3543 | ice_ctrl_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi)
         | ^~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3583:1: error: invalid storage class for function 'ice_vlan_rx_add_vid'
    3583 | ice_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, u16 vid)
         | ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3646:1: error: invalid storage class for function 'ice_vlan_rx_kill_vid'
    3646 | ice_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid)
         | ^~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3710:13: error: invalid storage class for function 'ice_rep_indr_tc_block_unbind'
    3710 | static void ice_rep_indr_tc_block_unbind(void *cb_priv)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3722:13: error: invalid storage class for function 'ice_tc_indir_block_unregister'
    3722 | static void ice_tc_indir_block_unregister(struct ice_vsi *vsi)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3736:12: error: invalid storage class for function 'ice_tc_indir_block_register'
    3736 | static int ice_tc_indir_block_register(struct ice_vsi *vsi)
         |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3756:1: error: invalid storage class for function 'ice_get_avail_q_count'
    3756 | ice_get_avail_q_count(unsigned long *pf_qmap, struct mutex *lock, u16 size)
         | ^~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3793:13: error: invalid storage class for function 'ice_deinit_pf'
    3793 | static void ice_deinit_pf(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3820:13: error: invalid storage class for function 'ice_set_pf_caps'
    3820 | static void ice_set_pf_caps(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3869:12: error: invalid storage class for function 'ice_init_pf'
    3869 | static int ice_init_pf(struct ice_pf *pf)
         |            ^~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3982:13: error: invalid storage class for function 'ice_set_safe_mode_vlan_cfg'
    3982 | static void ice_set_safe_mode_vlan_cfg(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4033:13: error: invalid storage class for function 'ice_log_pkg_init'
    4033 | static void ice_log_pkg_init(struct ice_hw *hw, enum ice_ddp_state state)
         |             ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4118:1: error: invalid storage class for function 'ice_load_pkg'
    4118 | ice_load_pkg(const struct firmware *firmware, struct ice_pf *pf)
         | ^~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4157:13: error: invalid storage class for function 'ice_verify_cacheline_size'
    4157 | static void ice_verify_cacheline_size(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4170:12: error: invalid storage class for function 'ice_send_version'
    4170 | static int ice_send_version(struct ice_pf *pf)
         |            ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4189:12: error: invalid storage class for function 'ice_init_fdir'
    4189 | static int ice_init_fdir(struct ice_pf *pf)
         |            ^~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4230:13: error: invalid storage class for function 'ice_deinit_fdir'
    4230 | static void ice_deinit_fdir(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4251:14: error: invalid storage class for function 'ice_get_opt_fw_name'
    4251 | static char *ice_get_opt_fw_name(struct ice_pf *pf)
         |              ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4281:13: error: invalid storage class for function 'ice_request_fw'
    4281 | static void ice_request_fw(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4322:13: error: invalid storage class for function 'ice_print_wake_reason'
    4322 | static void ice_print_wake_reason(struct ice_pf *pf)
--
         |                            ^~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9155:28: note: (near initialization for 'ice_netdev_safe_mode_ops.ndo_get_stats64')
   drivers/net/ethernet/intel/ice/ice_main.c:9156:27: error: initializer element is not constant
    9156 |         .ndo_tx_timeout = ice_tx_timeout,
         |                           ^~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9156:27: note: (near initialization for 'ice_netdev_safe_mode_ops.ndo_tx_timeout')
   drivers/net/ethernet/intel/ice/ice_main.c:9157:20: error: initializer element is not constant
    9157 |         .ndo_bpf = ice_xdp_safe_mode,
         |                    ^~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9157:20: note: (near initialization for 'ice_netdev_safe_mode_ops.ndo_bpf')
   drivers/net/ethernet/intel/ice/ice_main.c:9161:21: error: initializer element is not constant
    9161 |         .ndo_open = ice_open,
         |                     ^~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9161:21: note: (near initialization for 'ice_netdev_ops.ndo_open')
   drivers/net/ethernet/intel/ice/ice_main.c:9162:21: error: initializer element is not constant
    9162 |         .ndo_stop = ice_stop,
         |                     ^~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9162:21: note: (near initialization for 'ice_netdev_ops.ndo_stop')
   drivers/net/ethernet/intel/ice/ice_main.c:9165:31: error: initializer element is not constant
    9165 |         .ndo_features_check = ice_features_check,
         |                               ^~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9165:31: note: (near initialization for 'ice_netdev_ops.ndo_features_check')
   drivers/net/ethernet/intel/ice/ice_main.c:9166:29: error: initializer element is not constant
    9166 |         .ndo_fix_features = ice_fix_features,
         |                             ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9166:29: note: (near initialization for 'ice_netdev_ops.ndo_fix_features')
   drivers/net/ethernet/intel/ice/ice_main.c:9167:28: error: initializer element is not constant
    9167 |         .ndo_set_rx_mode = ice_set_rx_mode,
         |                            ^~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9167:28: note: (near initialization for 'ice_netdev_ops.ndo_set_rx_mode')
   drivers/net/ethernet/intel/ice/ice_main.c:9168:32: error: initializer element is not constant
    9168 |         .ndo_set_mac_address = ice_set_mac_address,
         |                                ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9168:32: note: (near initialization for 'ice_netdev_ops.ndo_set_mac_address')
   drivers/net/ethernet/intel/ice/ice_main.c:9170:27: error: initializer element is not constant
    9170 |         .ndo_change_mtu = ice_change_mtu,
         |                           ^~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9170:27: note: (near initialization for 'ice_netdev_ops.ndo_change_mtu')
   drivers/net/ethernet/intel/ice/ice_main.c:9171:28: error: initializer element is not constant
    9171 |         .ndo_get_stats64 = ice_get_stats64,
         |                            ^~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9171:28: note: (near initialization for 'ice_netdev_ops.ndo_get_stats64')
   drivers/net/ethernet/intel/ice/ice_main.c:9172:31: error: initializer element is not constant
    9172 |         .ndo_set_tx_maxrate = ice_set_tx_maxrate,
         |                               ^~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9172:31: note: (near initialization for 'ice_netdev_ops.ndo_set_tx_maxrate')
   drivers/net/ethernet/intel/ice/ice_main.c:9173:26: error: initializer element is not constant
    9173 |         .ndo_eth_ioctl = ice_eth_ioctl,
         |                          ^~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9173:26: note: (near initialization for 'ice_netdev_ops.ndo_eth_ioctl')
   drivers/net/ethernet/intel/ice/ice_main.c:9182:32: error: initializer element is not constant
    9182 |         .ndo_vlan_rx_add_vid = ice_vlan_rx_add_vid,
         |                                ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9182:32: note: (near initialization for 'ice_netdev_ops.ndo_vlan_rx_add_vid')
   drivers/net/ethernet/intel/ice/ice_main.c:9183:33: error: initializer element is not constant
    9183 |         .ndo_vlan_rx_kill_vid = ice_vlan_rx_kill_vid,
         |                                 ^~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9183:33: note: (near initialization for 'ice_netdev_ops.ndo_vlan_rx_kill_vid')
   drivers/net/ethernet/intel/ice/ice_main.c:9184:25: error: initializer element is not constant
    9184 |         .ndo_setup_tc = ice_setup_tc,
         |                         ^~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9184:25: note: (near initialization for 'ice_netdev_ops.ndo_setup_tc')
   drivers/net/ethernet/intel/ice/ice_main.c:9185:29: error: initializer element is not constant
    9185 |         .ndo_set_features = ice_set_features,
         |                             ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9185:29: note: (near initialization for 'ice_netdev_ops.ndo_set_features')
   drivers/net/ethernet/intel/ice/ice_main.c:9186:31: error: initializer element is not constant
    9186 |         .ndo_bridge_getlink = ice_bridge_getlink,
         |                               ^~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9186:31: note: (near initialization for 'ice_netdev_ops.ndo_bridge_getlink')
   drivers/net/ethernet/intel/ice/ice_main.c:9187:31: error: initializer element is not constant
    9187 |         .ndo_bridge_setlink = ice_bridge_setlink,
         |                               ^~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9187:31: note: (near initialization for 'ice_netdev_ops.ndo_bridge_setlink')
   drivers/net/ethernet/intel/ice/ice_main.c:9188:24: error: initializer element is not constant
    9188 |         .ndo_fdb_add = ice_fdb_add,
         |                        ^~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9188:24: note: (near initialization for 'ice_netdev_ops.ndo_fdb_add')
   drivers/net/ethernet/intel/ice/ice_main.c:9189:24: error: initializer element is not constant
    9189 |         .ndo_fdb_del = ice_fdb_del,
         |                        ^~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9189:24: note: (near initialization for 'ice_netdev_ops.ndo_fdb_del')
   drivers/net/ethernet/intel/ice/ice_main.c:9193:27: error: initializer element is not constant
    9193 |         .ndo_tx_timeout = ice_tx_timeout,
         |                           ^~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9193:27: note: (near initialization for 'ice_netdev_ops.ndo_tx_timeout')
   drivers/net/ethernet/intel/ice/ice_main.c:9194:20: error: initializer element is not constant
    9194 |         .ndo_bpf = ice_xdp,
         |                    ^~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9194:20: note: (near initialization for 'ice_netdev_ops.ndo_bpf')
   drivers/net/ethernet/intel/ice/ice_main.c:9197:1: error: expected declaration or statement at end of input
    9197 | };
         | ^
   drivers/net/ethernet/intel/ice/ice_main.c:9160:36: warning: unused variable 'ice_netdev_ops' [-Wunused-variable]
    9160 | static const struct net_device_ops ice_netdev_ops = {
         |                                    ^~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:9148:36: warning: unused variable 'ice_netdev_safe_mode_ops' [-Wunused-variable]
    9148 | static const struct net_device_ops ice_netdev_safe_mode_ops = {
         |                                    ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c: At top level:
>> drivers/net/ethernet/intel/ice/ice_main.c:70:13: warning: 'ice_rebuild' used but never defined
      70 | static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type);
         |             ^~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:72:13: warning: 'ice_vsi_release_all' used but never defined
      72 | static void ice_vsi_release_all(struct ice_pf *pf);
         |             ^~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:74:12: warning: 'ice_rebuild_channels' used but never defined
      74 | static int ice_rebuild_channels(struct ice_pf *pf);
         |            ^~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:75:13: warning: 'ice_remove_q_channels' used but never defined
      75 | static void ice_remove_q_channels(struct ice_vsi *vsi, bool rem_adv_fltr);
         |             ^~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:78:1: warning: 'ice_indr_setup_tc_cb' used but never defined
      78 | ice_indr_setup_tc_cb(struct net_device *netdev, struct Qdisc *sch,
         | ^~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:8995:5: warning: 'ice_open_internal' defined but not used [-Wunused-function]
    8995 | int ice_open_internal(struct net_device *netdev)
         |     ^~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:8946:1: warning: 'ice_indr_setup_tc_cb' defined but not used [-Wunused-function]
    8946 | ice_indr_setup_tc_cb(struct net_device *netdev, struct Qdisc *sch,
         | ^~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:8479:12: warning: 'ice_rebuild_channels' defined but not used [-Wunused-function]
    8479 | static int ice_rebuild_channels(struct ice_pf *pf)
         |            ^~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:7601:5: warning: 'ice_get_rss_key' defined but not used [-Wunused-function]
    7601 | int ice_get_rss_key(struct ice_vsi *vsi, u8 *seed)
         |     ^~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:7572:5: warning: 'ice_get_rss_lut' defined but not used [-Wunused-function]
    7572 | int ice_get_rss_lut(struct ice_vsi *vsi, u8 *lut, u16 lut_size)
         |     ^~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:7548:5: warning: 'ice_set_rss_key' defined but not used [-Wunused-function]
    7548 | int ice_set_rss_key(struct ice_vsi *vsi, u8 *seed)
         |     ^~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:7519:5: warning: 'ice_set_rss_lut' defined but not used [-Wunused-function]
    7519 | int ice_set_rss_lut(struct ice_vsi *vsi, u8 *lut, u16 lut_size)
         |     ^~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:7187:13: warning: 'ice_rebuild' defined but not used [-Wunused-function]
    7187 | static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type)
         |             ^~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:7076:13: warning: 'ice_vsi_release_all' defined but not used [-Wunused-function]
    7076 | static void ice_vsi_release_all(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:6960:5: warning: 'ice_vsi_open_ctrl' defined but not used [-Wunused-function]
    6960 | int ice_vsi_open_ctrl(struct ice_vsi *vsi)
         |     ^~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:6867:5: warning: 'ice_down_up' defined but not used [-Wunused-function]
    6867 | int ice_down_up(struct ice_vsi *vsi)
         |     ^~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:6589:6: warning: 'ice_update_pf_stats' defined but not used [-Wunused-function]
    6589 | void ice_update_pf_stats(struct ice_pf *pf)
         |      ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:6547:6: warning: 'ice_update_vsi_stats' defined but not used [-Wunused-function]
    6547 | void ice_update_vsi_stats(struct ice_vsi *vsi)
         |      ^~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4929:6: warning: 'ice_unload' defined but not used [-Wunused-function]
    4929 | void ice_unload(struct ice_pf *pf)
         |      ^~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4882:5: warning: 'ice_load' defined but not used [-Wunused-function]
    4882 | int ice_load(struct ice_pf *pf)
         |     ^~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3939:5: warning: 'ice_vsi_recfg_qs' defined but not used [-Wunused-function]
    3939 | int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx, int new_tx, bool locked)
         |     ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3915:6: warning: 'ice_is_wol_supported' defined but not used [-Wunused-function]
    3915 | bool ice_is_wol_supported(struct ice_hw *hw)
         |      ^~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3563:1: warning: 'ice_lb_vsi_setup' defined but not used [-Wunused-function]
    3563 | ice_lb_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi)
         | ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3492:6: warning: 'ice_fill_rss_lut' defined but not used [-Wunused-function]
    3492 | void ice_fill_rss_lut(u8 *lut, u16 rss_table_size, u16 rss_size)
         |      ^~~~~~~~~~~~~~~~


vim +2978 drivers/net/ethernet/intel/ice/ice_main.c

efc2214b6047b6 Maciej Fijalkowski 2019-11-04  2972  
ebc5399ea1dfcd Maciej Fijalkowski 2021-05-20  2973  /**
ebc5399ea1dfcd Maciej Fijalkowski 2021-05-20  2974   * ice_xdp_safe_mode - XDP handler for safe mode
ebc5399ea1dfcd Maciej Fijalkowski 2021-05-20  2975   * @dev: netdevice
ebc5399ea1dfcd Maciej Fijalkowski 2021-05-20  2976   * @xdp: XDP command
ebc5399ea1dfcd Maciej Fijalkowski 2021-05-20  2977   */
ebc5399ea1dfcd Maciej Fijalkowski 2021-05-20 @2978  static int ice_xdp_safe_mode(struct net_device __always_unused *dev,
ebc5399ea1dfcd Maciej Fijalkowski 2021-05-20  2979  			     struct netdev_bpf *xdp)
ebc5399ea1dfcd Maciej Fijalkowski 2021-05-20  2980  {
ebc5399ea1dfcd Maciej Fijalkowski 2021-05-20  2981  	NL_SET_ERR_MSG_MOD(xdp->extack,
ebc5399ea1dfcd Maciej Fijalkowski 2021-05-20  2982  			   "Please provide working DDP firmware package in order to use XDP\n"
ebc5399ea1dfcd Maciej Fijalkowski 2021-05-20  2983  			   "Refer to Documentation/networking/device_drivers/ethernet/intel/ice.rst");
ebc5399ea1dfcd Maciej Fijalkowski 2021-05-20  2984  	return -EOPNOTSUPP;
ebc5399ea1dfcd Maciej Fijalkowski 2021-05-20  2985  }
ebc5399ea1dfcd Maciej Fijalkowski 2021-05-20  2986
kernel test robot June 13, 2023, 5:58 p.m. UTC | #4
Hi Maciej,

kernel test robot noticed the following build errors:

[auto build test ERROR on tnguy-next-queue/dev-queue]

url:    https://github.com/intel-lab-lkp/linux/commits/Maciej-Fijalkowski/ice-allow-hot-swapping-XDP-programs/20230613-231046
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git dev-queue
patch link:    https://lore.kernel.org/r/20230613151005.337462-1-maciej.fijalkowski%40intel.com
patch subject: [PATCH iwl-next] ice: allow hot-swapping XDP programs
config: arm-allmodconfig (https://download.01.org/0day-ci/archive/20230614/202306140113.21qLwv79-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.3.0
reproduce (this is a W=1 build):
        mkdir -p ~/bin
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git remote add tnguy-next-queue https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git
        git fetch tnguy-next-queue dev-queue
        git checkout tnguy-next-queue/dev-queue
        b4 shazam https://lore.kernel.org/r/20230613151005.337462-1-maciej.fijalkowski@intel.com
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=arm olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/net/ethernet/intel/ice/

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306140113.21qLwv79-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

         |            ^~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4417:13: error: invalid storage class for function 'ice_decfg_netdev'
    4417 | static void ice_decfg_netdev(struct ice_vsi *vsi)
         |             ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4424:12: error: invalid storage class for function 'ice_start_eth'
    4424 | static int ice_start_eth(struct ice_vsi *vsi)
         |            ^~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4439:13: error: invalid storage class for function 'ice_stop_eth'
    4439 | static void ice_stop_eth(struct ice_vsi *vsi)
         |             ^~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4445:12: error: invalid storage class for function 'ice_init_eth'
    4445 | static int ice_init_eth(struct ice_pf *pf)
         |            ^~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4494:13: error: invalid storage class for function 'ice_deinit_eth'
    4494 | static void ice_deinit_eth(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4508:12: error: invalid storage class for function 'ice_init_dev'
    4508 | static int ice_init_dev(struct ice_pf *pf)
         |            ^~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4589:13: error: invalid storage class for function 'ice_deinit_dev'
    4589 | static void ice_deinit_dev(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4601:13: error: invalid storage class for function 'ice_init_features'
    4601 | static void ice_init_features(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4631:13: error: invalid storage class for function 'ice_deinit_features'
    4631 | static void ice_deinit_features(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4643:13: error: invalid storage class for function 'ice_init_wakeup'
    4643 | static void ice_init_wakeup(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4658:12: error: invalid storage class for function 'ice_init_link'
    4658 | static int ice_init_link(struct ice_pf *pf)
         |            ^~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4705:12: error: invalid storage class for function 'ice_init_pf_sw'
    4705 | static int ice_init_pf_sw(struct ice_pf *pf)
         |            ^~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4744:13: error: invalid storage class for function 'ice_deinit_pf_sw'
    4744 | static void ice_deinit_pf_sw(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4755:12: error: invalid storage class for function 'ice_alloc_vsis'
    4755 | static int ice_alloc_vsis(struct ice_pf *pf)
         |            ^~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4785:13: error: invalid storage class for function 'ice_dealloc_vsis'
    4785 | static void ice_dealloc_vsis(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4795:12: error: invalid storage class for function 'ice_init_devlink'
    4795 | static int ice_init_devlink(struct ice_pf *pf)
         |            ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4809:13: error: invalid storage class for function 'ice_deinit_devlink'
    4809 | static void ice_deinit_devlink(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4816:12: error: invalid storage class for function 'ice_init'
    4816 | static int ice_init(struct ice_pf *pf)
         |            ^~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4868:13: error: invalid storage class for function 'ice_deinit'
    4868 | static void ice_deinit(struct ice_pf *pf)
         |             ^~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4946:1: error: invalid storage class for function 'ice_probe'
    4946 | ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
         | ^~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5052:13: error: invalid storage class for function 'ice_set_wake'
    5052 | static void ice_set_wake(struct ice_pf *pf)
         |             ^~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5075:13: error: invalid storage class for function 'ice_setup_mc_magic_wake'
    5075 | static void ice_setup_mc_magic_wake(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5111:13: error: invalid storage class for function 'ice_remove'
    5111 | static void ice_remove(struct pci_dev *pdev)
         |             ^~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5151:13: error: invalid storage class for function 'ice_shutdown'
    5151 | static void ice_shutdown(struct pci_dev *pdev)
         |             ^~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5170:13: error: invalid storage class for function 'ice_prepare_for_shutdown'
    5170 | static void ice_prepare_for_shutdown(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5201:12: error: invalid storage class for function 'ice_reinit_interrupt_scheme'
    5201 | static int ice_reinit_interrupt_scheme(struct ice_pf *pf)
         |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5251:27: error: invalid storage class for function 'ice_suspend'
    5251 | static int __maybe_unused ice_suspend(struct device *dev)
         |                           ^~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5318:27: error: invalid storage class for function 'ice_resume'
    5318 | static int __maybe_unused ice_resume(struct device *dev)
         |                           ^~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5380:1: error: invalid storage class for function 'ice_pci_err_detected'
    5380 | ice_pci_err_detected(struct pci_dev *pdev, pci_channel_state_t err)
         | ^~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5409:25: error: invalid storage class for function 'ice_pci_err_slot_reset'
    5409 | static pci_ers_result_t ice_pci_err_slot_reset(struct pci_dev *pdev)
         |                         ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5445:13: error: invalid storage class for function 'ice_pci_err_resume'
    5445 | static void ice_pci_err_resume(struct pci_dev *pdev)
         |             ^~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5472:13: error: invalid storage class for function 'ice_pci_err_reset_prepare'
    5472 | static void ice_pci_err_reset_prepare(struct pci_dev *pdev)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5490:13: error: invalid storage class for function 'ice_pci_err_reset_done'
    5490 | static void ice_pci_err_reset_done(struct pci_dev *pdev)
         |             ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:5533:1: warning: 'alias' attribute ignored [-Wattributes]
    5533 | MODULE_DEVICE_TABLE(pci, ice_pci_tbl);
         | ^~~~~~~~~~~~~~~~~~~
   In file included from drivers/net/ethernet/intel/ice/ice.h:9,
                    from drivers/net/ethernet/intel/ice/ice_main.c:9:
   include/linux/kernel.h:58:33: error: initializer element is not constant
      58 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                 ^
   include/linux/pm.h:452:28: note: in expansion of macro 'PTR_IF'
     452 | #define pm_sleep_ptr(_ptr) PTR_IF(IS_ENABLED(CONFIG_PM_SLEEP), (_ptr))
         |                            ^~~~~~
   include/linux/pm.h:313:20: note: in expansion of macro 'pm_sleep_ptr'
     313 |         .suspend = pm_sleep_ptr(suspend_fn), \
         |                    ^~~~~~~~~~~~
   include/linux/pm.h:343:9: note: in expansion of macro 'SYSTEM_SLEEP_PM_OPS'
     343 |         SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/pm.h:426:9: note: in expansion of macro 'SET_SYSTEM_SLEEP_PM_OPS'
     426 |         SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
         |         ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5535:23: note: in expansion of macro 'SIMPLE_DEV_PM_OPS'
    5535 | static __maybe_unused SIMPLE_DEV_PM_OPS(ice_pm_ops, ice_suspend, ice_resume);
         |                       ^~~~~~~~~~~~~~~~~
   include/linux/kernel.h:58:33: note: (near initialization for 'ice_pm_ops.suspend')
      58 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                 ^
   include/linux/pm.h:452:28: note: in expansion of macro 'PTR_IF'
     452 | #define pm_sleep_ptr(_ptr) PTR_IF(IS_ENABLED(CONFIG_PM_SLEEP), (_ptr))
         |                            ^~~~~~
   include/linux/pm.h:313:20: note: in expansion of macro 'pm_sleep_ptr'
     313 |         .suspend = pm_sleep_ptr(suspend_fn), \
         |                    ^~~~~~~~~~~~
   include/linux/pm.h:343:9: note: in expansion of macro 'SYSTEM_SLEEP_PM_OPS'
     343 |         SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/pm.h:426:9: note: in expansion of macro 'SET_SYSTEM_SLEEP_PM_OPS'
     426 |         SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
         |         ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5535:23: note: in expansion of macro 'SIMPLE_DEV_PM_OPS'
    5535 | static __maybe_unused SIMPLE_DEV_PM_OPS(ice_pm_ops, ice_suspend, ice_resume);
         |                       ^~~~~~~~~~~~~~~~~
   include/linux/kernel.h:58:33: error: initializer element is not constant
      58 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                 ^
   include/linux/pm.h:452:28: note: in expansion of macro 'PTR_IF'
     452 | #define pm_sleep_ptr(_ptr) PTR_IF(IS_ENABLED(CONFIG_PM_SLEEP), (_ptr))
         |                            ^~~~~~
   include/linux/pm.h:314:19: note: in expansion of macro 'pm_sleep_ptr'
     314 |         .resume = pm_sleep_ptr(resume_fn), \
         |                   ^~~~~~~~~~~~
   include/linux/pm.h:343:9: note: in expansion of macro 'SYSTEM_SLEEP_PM_OPS'
     343 |         SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/pm.h:426:9: note: in expansion of macro 'SET_SYSTEM_SLEEP_PM_OPS'
     426 |         SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
         |         ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5535:23: note: in expansion of macro 'SIMPLE_DEV_PM_OPS'
    5535 | static __maybe_unused SIMPLE_DEV_PM_OPS(ice_pm_ops, ice_suspend, ice_resume);
         |                       ^~~~~~~~~~~~~~~~~
   include/linux/kernel.h:58:33: note: (near initialization for 'ice_pm_ops.resume')
      58 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                 ^
   include/linux/pm.h:452:28: note: in expansion of macro 'PTR_IF'
     452 | #define pm_sleep_ptr(_ptr) PTR_IF(IS_ENABLED(CONFIG_PM_SLEEP), (_ptr))
         |                            ^~~~~~
   include/linux/pm.h:314:19: note: in expansion of macro 'pm_sleep_ptr'
     314 |         .resume = pm_sleep_ptr(resume_fn), \
         |                   ^~~~~~~~~~~~
   include/linux/pm.h:343:9: note: in expansion of macro 'SYSTEM_SLEEP_PM_OPS'
     343 |         SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/pm.h:426:9: note: in expansion of macro 'SET_SYSTEM_SLEEP_PM_OPS'
     426 |         SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
         |         ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5535:23: note: in expansion of macro 'SIMPLE_DEV_PM_OPS'
    5535 | static __maybe_unused SIMPLE_DEV_PM_OPS(ice_pm_ops, ice_suspend, ice_resume);
         |                       ^~~~~~~~~~~~~~~~~
   include/linux/kernel.h:58:33: error: initializer element is not constant
      58 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                 ^
   include/linux/pm.h:452:28: note: in expansion of macro 'PTR_IF'
     452 | #define pm_sleep_ptr(_ptr) PTR_IF(IS_ENABLED(CONFIG_PM_SLEEP), (_ptr))
         |                            ^~~~~~
   include/linux/pm.h:315:19: note: in expansion of macro 'pm_sleep_ptr'
     315 |         .freeze = pm_sleep_ptr(suspend_fn), \
         |                   ^~~~~~~~~~~~
   include/linux/pm.h:343:9: note: in expansion of macro 'SYSTEM_SLEEP_PM_OPS'
     343 |         SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/pm.h:426:9: note: in expansion of macro 'SET_SYSTEM_SLEEP_PM_OPS'
     426 |         SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
         |         ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5535:23: note: in expansion of macro 'SIMPLE_DEV_PM_OPS'
    5535 | static __maybe_unused SIMPLE_DEV_PM_OPS(ice_pm_ops, ice_suspend, ice_resume);
         |                       ^~~~~~~~~~~~~~~~~
   include/linux/kernel.h:58:33: note: (near initialization for 'ice_pm_ops.freeze')
      58 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                 ^
   include/linux/pm.h:452:28: note: in expansion of macro 'PTR_IF'
     452 | #define pm_sleep_ptr(_ptr) PTR_IF(IS_ENABLED(CONFIG_PM_SLEEP), (_ptr))
         |                            ^~~~~~
--
         |                     ^~~~~~~~~~~~
   include/linux/pm.h:343:9: note: in expansion of macro 'SYSTEM_SLEEP_PM_OPS'
     343 |         SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/pm.h:426:9: note: in expansion of macro 'SET_SYSTEM_SLEEP_PM_OPS'
     426 |         SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
         |         ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5535:23: note: in expansion of macro 'SIMPLE_DEV_PM_OPS'
    5535 | static __maybe_unused SIMPLE_DEV_PM_OPS(ice_pm_ops, ice_suspend, ice_resume);
         |                       ^~~~~~~~~~~~~~~~~
   include/linux/kernel.h:58:33: note: (near initialization for 'ice_pm_ops.poweroff')
      58 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                 ^
   include/linux/pm.h:452:28: note: in expansion of macro 'PTR_IF'
     452 | #define pm_sleep_ptr(_ptr) PTR_IF(IS_ENABLED(CONFIG_PM_SLEEP), (_ptr))
         |                            ^~~~~~
   include/linux/pm.h:317:21: note: in expansion of macro 'pm_sleep_ptr'
     317 |         .poweroff = pm_sleep_ptr(suspend_fn), \
         |                     ^~~~~~~~~~~~
   include/linux/pm.h:343:9: note: in expansion of macro 'SYSTEM_SLEEP_PM_OPS'
     343 |         SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/pm.h:426:9: note: in expansion of macro 'SET_SYSTEM_SLEEP_PM_OPS'
     426 |         SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
         |         ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5535:23: note: in expansion of macro 'SIMPLE_DEV_PM_OPS'
    5535 | static __maybe_unused SIMPLE_DEV_PM_OPS(ice_pm_ops, ice_suspend, ice_resume);
         |                       ^~~~~~~~~~~~~~~~~
   include/linux/kernel.h:58:33: error: initializer element is not constant
      58 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                 ^
   include/linux/pm.h:452:28: note: in expansion of macro 'PTR_IF'
     452 | #define pm_sleep_ptr(_ptr) PTR_IF(IS_ENABLED(CONFIG_PM_SLEEP), (_ptr))
         |                            ^~~~~~
   include/linux/pm.h:318:20: note: in expansion of macro 'pm_sleep_ptr'
     318 |         .restore = pm_sleep_ptr(resume_fn),
         |                    ^~~~~~~~~~~~
   include/linux/pm.h:343:9: note: in expansion of macro 'SYSTEM_SLEEP_PM_OPS'
     343 |         SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/pm.h:426:9: note: in expansion of macro 'SET_SYSTEM_SLEEP_PM_OPS'
     426 |         SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
         |         ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5535:23: note: in expansion of macro 'SIMPLE_DEV_PM_OPS'
    5535 | static __maybe_unused SIMPLE_DEV_PM_OPS(ice_pm_ops, ice_suspend, ice_resume);
         |                       ^~~~~~~~~~~~~~~~~
   include/linux/kernel.h:58:33: note: (near initialization for 'ice_pm_ops.restore')
      58 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                 ^
   include/linux/pm.h:452:28: note: in expansion of macro 'PTR_IF'
     452 | #define pm_sleep_ptr(_ptr) PTR_IF(IS_ENABLED(CONFIG_PM_SLEEP), (_ptr))
         |                            ^~~~~~
   include/linux/pm.h:318:20: note: in expansion of macro 'pm_sleep_ptr'
     318 |         .restore = pm_sleep_ptr(resume_fn),
         |                    ^~~~~~~~~~~~
   include/linux/pm.h:343:9: note: in expansion of macro 'SYSTEM_SLEEP_PM_OPS'
     343 |         SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/pm.h:426:9: note: in expansion of macro 'SET_SYSTEM_SLEEP_PM_OPS'
     426 |         SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
         |         ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5535:23: note: in expansion of macro 'SIMPLE_DEV_PM_OPS'
    5535 | static __maybe_unused SIMPLE_DEV_PM_OPS(ice_pm_ops, ice_suspend, ice_resume);
         |                       ^~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5538:27: error: initializer element is not constant
    5538 |         .error_detected = ice_pci_err_detected,
         |                           ^~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5538:27: note: (near initialization for 'ice_pci_err_handler.error_detected')
   drivers/net/ethernet/intel/ice/ice_main.c:5539:23: error: initializer element is not constant
    5539 |         .slot_reset = ice_pci_err_slot_reset,
         |                       ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5539:23: note: (near initialization for 'ice_pci_err_handler.slot_reset')
   drivers/net/ethernet/intel/ice/ice_main.c:5540:26: error: initializer element is not constant
    5540 |         .reset_prepare = ice_pci_err_reset_prepare,
         |                          ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5540:26: note: (near initialization for 'ice_pci_err_handler.reset_prepare')
   drivers/net/ethernet/intel/ice/ice_main.c:5541:23: error: initializer element is not constant
    5541 |         .reset_done = ice_pci_err_reset_done,
         |                       ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5541:23: note: (near initialization for 'ice_pci_err_handler.reset_done')
   drivers/net/ethernet/intel/ice/ice_main.c:5542:19: error: initializer element is not constant
    5542 |         .resume = ice_pci_err_resume
         |                   ^~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5542:19: note: (near initialization for 'ice_pci_err_handler.resume')
   drivers/net/ethernet/intel/ice/ice_main.c:5548:18: error: initializer element is not constant
    5548 |         .probe = ice_probe,
         |                  ^~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5548:18: note: (near initialization for 'ice_driver.probe')
   drivers/net/ethernet/intel/ice/ice_main.c:5549:19: error: initializer element is not constant
    5549 |         .remove = ice_remove,
         |                   ^~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5549:19: note: (near initialization for 'ice_driver.remove')
   drivers/net/ethernet/intel/ice/ice_main.c:5553:21: error: initializer element is not constant
    5553 |         .shutdown = ice_shutdown,
         |                     ^~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5553:21: note: (near initialization for 'ice_driver.shutdown')
   drivers/net/ethernet/intel/ice/ice_main.c:5564:19: error: invalid storage class for function 'ice_module_init'
    5564 | static int __init ice_module_init(void)
         |                   ^~~~~~~~~~~~~~~
   In file included from drivers/net/ethernet/intel/ice/ice.h:10:
>> include/linux/module.h:131:49: error: invalid storage class for function '__inittest'
     131 |         static inline initcall_t __maybe_unused __inittest(void)                \
         |                                                 ^~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5585:1: note: in expansion of macro 'module_init'
    5585 | module_init(ice_module_init);
         | ^~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5585:1: warning: 'alias' attribute ignored [-Wattributes]
   drivers/net/ethernet/intel/ice/ice_main.c:5593:20: error: invalid storage class for function 'ice_module_exit'
    5593 | static void __exit ice_module_exit(void)
         |                    ^~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5593:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    5593 | static void __exit ice_module_exit(void)
         | ^~~~~~
>> include/linux/module.h:139:49: error: invalid storage class for function '__exittest'
     139 |         static inline exitcall_t __maybe_unused __exittest(void)                \
         |                                                 ^~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5599:1: note: in expansion of macro 'module_exit'
    5599 | module_exit(ice_module_exit);
         | ^~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5599:1: warning: 'alias' attribute ignored [-Wattributes]
   drivers/net/ethernet/intel/ice/ice_main.c:5608:12: error: invalid storage class for function 'ice_set_mac_address'
    5608 | static int ice_set_mac_address(struct net_device *netdev, void *pi)
         |            ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5608:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    5608 | static int ice_set_mac_address(struct net_device *netdev, void *pi)
         | ^~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5699:13: error: invalid storage class for function 'ice_set_rx_mode'
    5699 | static void ice_set_rx_mode(struct net_device *netdev)
         |             ^~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5728:1: error: invalid storage class for function 'ice_set_tx_maxrate'
    5728 | ice_set_tx_maxrate(struct net_device *netdev, int queue_index, u32 maxrate)
         | ^~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5778:1: error: invalid storage class for function 'ice_fdb_add'
    5778 | ice_fdb_add(struct ndmsg *ndm, struct nlattr __always_unused *tb[],
         | ^~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5817:1: error: invalid storage class for function 'ice_fdb_del'
    5817 | ice_fdb_del(struct ndmsg *ndm, __always_unused struct nlattr *tb[],
         | ^~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5887:1: error: invalid storage class for function 'ice_fix_features'
    5887 | ice_fix_features(struct net_device *netdev, netdev_features_t features)
         | ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5953:1: error: invalid storage class for function 'ice_set_vlan_offload_features'
    5953 | ice_set_vlan_offload_features(struct ice_vsi *vsi, netdev_features_t features)
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:5997:1: error: invalid storage class for function 'ice_set_vlan_filtering_features'
    5997 | ice_set_vlan_filtering_features(struct ice_vsi *vsi, netdev_features_t features)
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:6023:1: error: invalid storage class for function 'ice_set_vlan_features'
    6023 | ice_set_vlan_features(struct net_device *netdev, netdev_features_t features)
         | ^~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:6062:12: error: invalid storage class for function 'ice_set_loopback'
    6062 | static int ice_set_loopback(struct ice_vsi *vsi, bool ena)
         |            ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:6089:1: error: invalid storage class for function 'ice_set_features'
    6089 | ice_set_features(struct net_device *netdev, netdev_features_t features)
         | ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:6168:12: error: invalid storage class for function 'ice_vsi_vlan_setup'
    6168 | static int ice_vsi_vlan_setup(struct ice_vsi *vsi)
         |            ^~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:6249:13: error: invalid storage class for function 'ice_tx_dim_work'
    6249 | static void ice_tx_dim_work(struct work_struct *work)
         |             ^~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:6269:13: error: invalid storage class for function 'ice_rx_dim_work'
    6269 | static void ice_rx_dim_work(struct work_struct *work)
         |             ^~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:6301:13: error: invalid storage class for function 'ice_init_moderation'
    6301 | static void ice_init_moderation(struct ice_q_vector *q_vector)
         |             ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:6335:13: error: invalid storage class for function 'ice_napi_enable_all'
    6335 | static void ice_napi_enable_all(struct ice_vsi *vsi)
         |             ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:6358:12: error: invalid storage class for function 'ice_up_complete'
    6358 | static int ice_up_complete(struct ice_vsi *vsi)
         |            ^~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:6443:1: error: invalid storage class for function 'ice_update_vsi_tx_ring_stats'
    6443 | ice_update_vsi_tx_ring_stats(struct ice_vsi *vsi,
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:6471:13: error: invalid storage class for function 'ice_update_vsi_ring_stats'
    6471 | static void ice_update_vsi_ring_stats(struct ice_vsi *vsi)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:6745:6: error: invalid storage class for function 'ice_get_stats64'
    6745 | void ice_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats)
         |      ^~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:6785:13: error: invalid storage class for function 'ice_napi_disable_all'
    6785 | static void ice_napi_disable_all(struct ice_vsi *vsi)
         |             ^~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:7076:13: error: invalid storage class for function 'ice_vsi_release_all'
    7076 | static void ice_vsi_release_all(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:7104:12: error: invalid storage class for function 'ice_vsi_rebuild_by_type'
    7104 | static int ice_vsi_rebuild_by_type(struct ice_pf *pf, enum ice_vsi_type type)
         |            ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:7155:13: error: invalid storage class for function 'ice_update_pf_netdev_link'
    7155 | static void ice_update_pf_netdev_link(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:7187:13: error: invalid storage class for function 'ice_rebuild'
    7187 | static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type)
         |             ^~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:7378:12: error: invalid storage class for function 'ice_change_mtu'
    7378 | static int ice_change_mtu(struct net_device *netdev, int new_mtu)
         |            ^~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:7454:12: error: invalid storage class for function 'ice_eth_ioctl'
    7454 | static int ice_eth_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
         |            ^~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:7629:1: error: invalid storage class for function 'ice_bridge_getlink'
    7629 | ice_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
         | ^~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:7650:12: error: invalid storage class for function 'ice_vsi_update_bridge_mode'
    7650 | static int ice_vsi_update_bridge_mode(struct ice_vsi *vsi, u16 bmode)
         |            ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:7700:1: error: invalid storage class for function 'ice_bridge_setlink'
    7700 | ice_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,
         | ^~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:7762:13: error: invalid storage class for function 'ice_tx_timeout'


vim +/alias +5533 drivers/net/ethernet/intel/ice/ice_main.c

5995b6d0c6fcdb Brett Creeley          2019-02-13  5494  
837f08fdecbe4b Anirudh Venkataramanan 2018-03-20  5495  /* ice_pci_tbl - PCI Device ID Table
837f08fdecbe4b Anirudh Venkataramanan 2018-03-20  5496   *
837f08fdecbe4b Anirudh Venkataramanan 2018-03-20  5497   * Wildcard entries (PCI_ANY_ID) should come last
837f08fdecbe4b Anirudh Venkataramanan 2018-03-20  5498   * Last entry must be all 0s
837f08fdecbe4b Anirudh Venkataramanan 2018-03-20  5499   *
837f08fdecbe4b Anirudh Venkataramanan 2018-03-20  5500   * { Vendor ID, Device ID, SubVendor ID, SubDevice ID,
837f08fdecbe4b Anirudh Venkataramanan 2018-03-20  5501   *   Class, Class Mask, private data (not used) }
837f08fdecbe4b Anirudh Venkataramanan 2018-03-20  5502   */
837f08fdecbe4b Anirudh Venkataramanan 2018-03-20  5503  static const struct pci_device_id ice_pci_tbl[] = {
633d7449a30133 Anirudh Venkataramanan 2018-10-18  5504  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E810C_BACKPLANE), 0 },
633d7449a30133 Anirudh Venkataramanan 2018-10-18  5505  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E810C_QSFP), 0 },
633d7449a30133 Anirudh Venkataramanan 2018-10-18  5506  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E810C_SFP), 0 },
7dcf78b870be64 Tony Nguyen            2021-10-19  5507  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E810_XXV_BACKPLANE), 0 },
7dcf78b870be64 Tony Nguyen            2021-10-19  5508  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E810_XXV_QSFP), 0 },
195fb97766da1b Bruce Allan            2020-02-13  5509  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E810_XXV_SFP), 0 },
e36aeec0f4e551 Bruce Allan            2020-02-13  5510  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E823C_BACKPLANE), 0 },
e36aeec0f4e551 Bruce Allan            2020-02-13  5511  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E823C_QSFP), 0 },
e36aeec0f4e551 Bruce Allan            2020-02-13  5512  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E823C_SFP), 0 },
e36aeec0f4e551 Bruce Allan            2020-02-13  5513  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E823C_10G_BASE_T), 0 },
e36aeec0f4e551 Bruce Allan            2020-02-13  5514  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E823C_SGMII), 0 },
5d9e618cbb54f5 Jacob Keller           2019-12-17  5515  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E822C_BACKPLANE), 0 },
5d9e618cbb54f5 Jacob Keller           2019-12-17  5516  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E822C_QSFP), 0 },
5d9e618cbb54f5 Jacob Keller           2019-12-17  5517  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E822C_SFP), 0 },
5d9e618cbb54f5 Jacob Keller           2019-12-17  5518  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E822C_10G_BASE_T), 0 },
5d9e618cbb54f5 Jacob Keller           2019-12-17  5519  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E822C_SGMII), 0 },
2fbfa9668bbf4c Bruce Allan            2020-02-13  5520  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E822L_BACKPLANE), 0 },
5d9e618cbb54f5 Jacob Keller           2019-12-17  5521  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E822L_SFP), 0 },
5d9e618cbb54f5 Jacob Keller           2019-12-17  5522  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E822L_10G_BASE_T), 0 },
5d9e618cbb54f5 Jacob Keller           2019-12-17  5523  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E822L_SGMII), 0 },
e36aeec0f4e551 Bruce Allan            2020-02-13  5524  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E823L_BACKPLANE), 0 },
e36aeec0f4e551 Bruce Allan            2020-02-13  5525  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E823L_SFP), 0 },
e36aeec0f4e551 Bruce Allan            2020-02-13  5526  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E823L_10G_BASE_T), 0 },
e36aeec0f4e551 Bruce Allan            2020-02-13  5527  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E823L_1GBE), 0 },
e36aeec0f4e551 Bruce Allan            2020-02-13  5528  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E823L_QSFP), 0 },
f52d166819a4d8 Paul M Stillwell Jr    2022-06-08  5529  	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E822_SI_DFLT), 0 },
837f08fdecbe4b Anirudh Venkataramanan 2018-03-20  5530  	/* required last entry */
837f08fdecbe4b Anirudh Venkataramanan 2018-03-20  5531  	{ 0, }
837f08fdecbe4b Anirudh Venkataramanan 2018-03-20  5532  };
837f08fdecbe4b Anirudh Venkataramanan 2018-03-20 @5533  MODULE_DEVICE_TABLE(pci, ice_pci_tbl);
837f08fdecbe4b Anirudh Venkataramanan 2018-03-20  5534
Toke Høiland-Jørgensen June 13, 2023, 5:59 p.m. UTC | #5
Maciej Fijalkowski <maciej.fijalkowski@intel.com> writes:

> On Tue, Jun 13, 2023 at 05:15:15PM +0200, Alexander Lobakin wrote:
>> From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
>> Date: Tue, 13 Jun 2023 17:10:05 +0200
>> 
>> > Currently ice driver's .ndo_bpf callback brings the interface down and
>> > up independently of the presence of XDP resources. This is only needed
>> > when either these resources have to be configured or removed. It means
>> > that if one is switching XDP programs on-the-fly with running traffic,
>> > packets will be dropped.
>> > 
>> > To avoid this, compare early on ice_xdp_setup_prog() state of incoming
>> > bpf_prog pointer vs the bpf_prog pointer that is already assigned to
>> > VSI. Do the swap in case VSI has bpf_prog and incoming one are non-NULL.
>> > 
>> > Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
>> 
>> [0] :D
>> 
>> But if be serious, are you sure you won't have any pointer tears /
>> partial reads/writes without such RCU protection as added in the
>> linked commit ?
>
> Since we removed rcu sections from driver sides and given an assumption
> that local_bh_{dis,en}able() pair serves this purpose now i believe this
> is safe. Are you aware of:
>
> https://lore.kernel.org/bpf/20210624160609.292325-1-toke@redhat.com/

As the author of that series, I agree that it's not necessary to add
additional RCU protection. ice_vsi_assign_bpf_prog() already uses xchg()
and WRITE_ONCE() which should protect against tearing, and the xdp_prog
pointer being passed to ice_run_xdp() is a copy residing on the stack,
so it will only be read once per NAPI cycle anyway (which is in line
with how most other drivers do it).

It *would* be nice to add an __rcu annotation to ice_vsi->xdp_prog and
ice_rx_ring->xdp_prog (and move to using rcu_dereference(),
rcu_assign_pointer() etc), but this is more a documentation/static
checker thing than it's a "correctness of the generated code" thing :)

-Toke
kernel test robot June 13, 2023, 10:19 p.m. UTC | #6
Hi Maciej,

kernel test robot noticed the following build errors:

[auto build test ERROR on tnguy-next-queue/dev-queue]

url:    https://github.com/intel-lab-lkp/linux/commits/Maciej-Fijalkowski/ice-allow-hot-swapping-XDP-programs/20230613-231046
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git dev-queue
patch link:    https://lore.kernel.org/r/20230613151005.337462-1-maciej.fijalkowski%40intel.com
patch subject: [PATCH iwl-next] ice: allow hot-swapping XDP programs
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20230614/202306140615.m2lBEhM9-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build):
        git remote add tnguy-next-queue https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git
        git fetch tnguy-next-queue dev-queue
        git checkout tnguy-next-queue/dev-queue
        b4 shazam https://lore.kernel.org/r/20230613151005.337462-1-maciej.fijalkowski@intel.com
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 olddefconfig
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306140615.m2lBEhM9-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/net/ethernet/intel/ice/ice_main.c: In function 'ice_xdp_setup_prog':
>> drivers/net/ethernet/intel/ice/ice_main.c:2978:12: error: invalid storage class for function 'ice_xdp_safe_mode'
    2978 | static int ice_xdp_safe_mode(struct net_device __always_unused *dev,
         |            ^~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:2978:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    2978 | static int ice_xdp_safe_mode(struct net_device __always_unused *dev,
         | ^~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:2992:12: error: invalid storage class for function 'ice_xdp'
    2992 | static int ice_xdp(struct net_device *dev, struct netdev_bpf *xdp)
         |            ^~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:3017:13: error: invalid storage class for function 'ice_ena_misc_vector'
    3017 | static void ice_ena_misc_vector(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:3055:20: error: invalid storage class for function 'ice_misc_intr'
    3055 | static irqreturn_t ice_misc_intr(int __always_unused irq, void *data)
         |                    ^~~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:3188:20: error: invalid storage class for function 'ice_misc_intr_thread_fn'
    3188 | static irqreturn_t ice_misc_intr_thread_fn(int __always_unused irq, void *data)
         |                    ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:3222:13: error: invalid storage class for function 'ice_dis_ctrlq_interrupts'
    3222 | static void ice_dis_ctrlq_interrupts(struct ice_hw *hw)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:3246:13: error: invalid storage class for function 'ice_free_irq_msix_misc'
    3246 | static void ice_free_irq_msix_misc(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:3268:13: error: invalid storage class for function 'ice_ena_ctrlq_interrupts'
    3268 | static void ice_ena_ctrlq_interrupts(struct ice_hw *hw, u16 reg_idx)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:3302:12: error: invalid storage class for function 'ice_req_irq_msix_misc'
    3302 | static int ice_req_irq_msix_misc(struct ice_pf *pf)
         |            ^~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:3357:13: error: invalid storage class for function 'ice_napi_add'
    3357 | static void ice_napi_add(struct ice_vsi *vsi)
         |             ^~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:3373:13: error: invalid storage class for function 'ice_set_ops'
    3373 | static void ice_set_ops(struct ice_vsi *vsi)
         |             ^~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:3400:13: error: invalid storage class for function 'ice_set_netdev_features'
    3400 | static void ice_set_netdev_features(struct net_device *netdev)
         |             ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:3509:1: error: invalid storage class for function 'ice_pf_vsi_setup'
    3509 | ice_pf_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi)
         | ^~~~~~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:3521:1: error: invalid storage class for function 'ice_chnl_vsi_setup'
    3521 | ice_chnl_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi,
         | ^~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:3543:1: error: invalid storage class for function 'ice_ctrl_vsi_setup'
    3543 | ice_ctrl_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi)
         | ^~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:3583:1: error: invalid storage class for function 'ice_vlan_rx_add_vid'
    3583 | ice_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, u16 vid)
         | ^~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:3646:1: error: invalid storage class for function 'ice_vlan_rx_kill_vid'
    3646 | ice_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid)
         | ^~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:3710:13: error: invalid storage class for function 'ice_rep_indr_tc_block_unbind'
    3710 | static void ice_rep_indr_tc_block_unbind(void *cb_priv)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:3722:13: error: invalid storage class for function 'ice_tc_indir_block_unregister'
    3722 | static void ice_tc_indir_block_unregister(struct ice_vsi *vsi)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/ice_main.c:3736:12: error: invalid storage class for function 'ice_tc_indir_block_register'
    3736 | static int ice_tc_indir_block_register(struct ice_vsi *vsi)
         |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3756:1: error: invalid storage class for function 'ice_get_avail_q_count'
    3756 | ice_get_avail_q_count(unsigned long *pf_qmap, struct mutex *lock, u16 size)
         | ^~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3793:13: error: invalid storage class for function 'ice_deinit_pf'
    3793 | static void ice_deinit_pf(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3820:13: error: invalid storage class for function 'ice_set_pf_caps'
    3820 | static void ice_set_pf_caps(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3869:12: error: invalid storage class for function 'ice_init_pf'
    3869 | static int ice_init_pf(struct ice_pf *pf)
         |            ^~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:3982:13: error: invalid storage class for function 'ice_set_safe_mode_vlan_cfg'
    3982 | static void ice_set_safe_mode_vlan_cfg(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4033:13: error: invalid storage class for function 'ice_log_pkg_init'
    4033 | static void ice_log_pkg_init(struct ice_hw *hw, enum ice_ddp_state state)
         |             ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4118:1: error: invalid storage class for function 'ice_load_pkg'
    4118 | ice_load_pkg(const struct firmware *firmware, struct ice_pf *pf)
         | ^~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4157:13: error: invalid storage class for function 'ice_verify_cacheline_size'
    4157 | static void ice_verify_cacheline_size(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4170:12: error: invalid storage class for function 'ice_send_version'
    4170 | static int ice_send_version(struct ice_pf *pf)
         |            ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4189:12: error: invalid storage class for function 'ice_init_fdir'
    4189 | static int ice_init_fdir(struct ice_pf *pf)
         |            ^~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4230:13: error: invalid storage class for function 'ice_deinit_fdir'
    4230 | static void ice_deinit_fdir(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4251:14: error: invalid storage class for function 'ice_get_opt_fw_name'
    4251 | static char *ice_get_opt_fw_name(struct ice_pf *pf)
         |              ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4281:13: error: invalid storage class for function 'ice_request_fw'
    4281 | static void ice_request_fw(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4322:13: error: invalid storage class for function 'ice_print_wake_reason'
    4322 | static void ice_print_wake_reason(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4349:12: error: invalid storage class for function 'ice_register_netdev'
    4349 | static int ice_register_netdev(struct ice_vsi *vsi)
         |            ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4367:13: error: invalid storage class for function 'ice_unregister_netdev'
    4367 | static void ice_unregister_netdev(struct ice_vsi *vsi)
         |             ^~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4382:12: error: invalid storage class for function 'ice_cfg_netdev'
    4382 | static int ice_cfg_netdev(struct ice_vsi *vsi)
         |            ^~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4417:13: error: invalid storage class for function 'ice_decfg_netdev'
    4417 | static void ice_decfg_netdev(struct ice_vsi *vsi)
         |             ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4424:12: error: invalid storage class for function 'ice_start_eth'
    4424 | static int ice_start_eth(struct ice_vsi *vsi)
         |            ^~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4439:13: error: invalid storage class for function 'ice_stop_eth'
    4439 | static void ice_stop_eth(struct ice_vsi *vsi)
         |             ^~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4445:12: error: invalid storage class for function 'ice_init_eth'
    4445 | static int ice_init_eth(struct ice_pf *pf)
         |            ^~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4494:13: error: invalid storage class for function 'ice_deinit_eth'
    4494 | static void ice_deinit_eth(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4508:12: error: invalid storage class for function 'ice_init_dev'
    4508 | static int ice_init_dev(struct ice_pf *pf)
         |            ^~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4589:13: error: invalid storage class for function 'ice_deinit_dev'
    4589 | static void ice_deinit_dev(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4601:13: error: invalid storage class for function 'ice_init_features'
    4601 | static void ice_init_features(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4631:13: error: invalid storage class for function 'ice_deinit_features'
    4631 | static void ice_deinit_features(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4643:13: error: invalid storage class for function 'ice_init_wakeup'
    4643 | static void ice_init_wakeup(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4658:12: error: invalid storage class for function 'ice_init_link'
    4658 | static int ice_init_link(struct ice_pf *pf)
         |            ^~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4705:12: error: invalid storage class for function 'ice_init_pf_sw'
    4705 | static int ice_init_pf_sw(struct ice_pf *pf)
         |            ^~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4744:13: error: invalid storage class for function 'ice_deinit_pf_sw'
    4744 | static void ice_deinit_pf_sw(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4755:12: error: invalid storage class for function 'ice_alloc_vsis'
    4755 | static int ice_alloc_vsis(struct ice_pf *pf)
         |            ^~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4785:13: error: invalid storage class for function 'ice_dealloc_vsis'
    4785 | static void ice_dealloc_vsis(struct ice_pf *pf)
         |             ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/ice/ice_main.c:4795:12: error: invalid storage class for function 'ice_init_devlink'
    4795 | static int ice_init_devlink(struct ice_pf *pf)


vim +/ice_xdp_safe_mode +2978 drivers/net/ethernet/intel/ice/ice_main.c

efc2214b6047b6 Maciej Fijalkowski     2019-11-04  2972  
ebc5399ea1dfcd Maciej Fijalkowski     2021-05-20  2973  /**
ebc5399ea1dfcd Maciej Fijalkowski     2021-05-20  2974   * ice_xdp_safe_mode - XDP handler for safe mode
ebc5399ea1dfcd Maciej Fijalkowski     2021-05-20  2975   * @dev: netdevice
ebc5399ea1dfcd Maciej Fijalkowski     2021-05-20  2976   * @xdp: XDP command
ebc5399ea1dfcd Maciej Fijalkowski     2021-05-20  2977   */
ebc5399ea1dfcd Maciej Fijalkowski     2021-05-20 @2978  static int ice_xdp_safe_mode(struct net_device __always_unused *dev,
ebc5399ea1dfcd Maciej Fijalkowski     2021-05-20  2979  			     struct netdev_bpf *xdp)
ebc5399ea1dfcd Maciej Fijalkowski     2021-05-20  2980  {
ebc5399ea1dfcd Maciej Fijalkowski     2021-05-20  2981  	NL_SET_ERR_MSG_MOD(xdp->extack,
ebc5399ea1dfcd Maciej Fijalkowski     2021-05-20  2982  			   "Please provide working DDP firmware package in order to use XDP\n"
ebc5399ea1dfcd Maciej Fijalkowski     2021-05-20  2983  			   "Refer to Documentation/networking/device_drivers/ethernet/intel/ice.rst");
ebc5399ea1dfcd Maciej Fijalkowski     2021-05-20  2984  	return -EOPNOTSUPP;
ebc5399ea1dfcd Maciej Fijalkowski     2021-05-20  2985  }
ebc5399ea1dfcd Maciej Fijalkowski     2021-05-20  2986  
efc2214b6047b6 Maciej Fijalkowski     2019-11-04  2987  /**
efc2214b6047b6 Maciej Fijalkowski     2019-11-04  2988   * ice_xdp - implements XDP handler
efc2214b6047b6 Maciej Fijalkowski     2019-11-04  2989   * @dev: netdevice
efc2214b6047b6 Maciej Fijalkowski     2019-11-04  2990   * @xdp: XDP command
efc2214b6047b6 Maciej Fijalkowski     2019-11-04  2991   */
efc2214b6047b6 Maciej Fijalkowski     2019-11-04 @2992  static int ice_xdp(struct net_device *dev, struct netdev_bpf *xdp)
efc2214b6047b6 Maciej Fijalkowski     2019-11-04  2993  {
efc2214b6047b6 Maciej Fijalkowski     2019-11-04  2994  	struct ice_netdev_priv *np = netdev_priv(dev);
efc2214b6047b6 Maciej Fijalkowski     2019-11-04  2995  	struct ice_vsi *vsi = np->vsi;
efc2214b6047b6 Maciej Fijalkowski     2019-11-04  2996  
efc2214b6047b6 Maciej Fijalkowski     2019-11-04  2997  	if (vsi->type != ICE_VSI_PF) {
af23635a5335aa Jesse Brandeburg       2020-02-13  2998  		NL_SET_ERR_MSG_MOD(xdp->extack, "XDP can be loaded only on PF VSI");
efc2214b6047b6 Maciej Fijalkowski     2019-11-04  2999  		return -EINVAL;
efc2214b6047b6 Maciej Fijalkowski     2019-11-04  3000  	}
efc2214b6047b6 Maciej Fijalkowski     2019-11-04  3001  
efc2214b6047b6 Maciej Fijalkowski     2019-11-04  3002  	switch (xdp->command) {
efc2214b6047b6 Maciej Fijalkowski     2019-11-04  3003  	case XDP_SETUP_PROG:
efc2214b6047b6 Maciej Fijalkowski     2019-11-04  3004  		return ice_xdp_setup_prog(vsi, xdp->prog, xdp->extack);
1742b3d528690a Magnus Karlsson        2020-08-28  3005  	case XDP_SETUP_XSK_POOL:
1742b3d528690a Magnus Karlsson        2020-08-28  3006  		return ice_xsk_pool_setup(vsi, xdp->xsk.pool,
2d4238f5569722 Krzysztof Kazimierczak 2019-11-04  3007  					  xdp->xsk.queue_id);
efc2214b6047b6 Maciej Fijalkowski     2019-11-04  3008  	default:
efc2214b6047b6 Maciej Fijalkowski     2019-11-04  3009  		return -EINVAL;
efc2214b6047b6 Maciej Fijalkowski     2019-11-04  3010  	}
efc2214b6047b6 Maciej Fijalkowski     2019-11-04  3011  }
efc2214b6047b6 Maciej Fijalkowski     2019-11-04  3012  
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3013  /**
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3014   * ice_ena_misc_vector - enable the non-queue interrupts
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3015   * @pf: board private structure
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3016   */
940b61af02f497 Anirudh Venkataramanan 2018-03-20 @3017  static void ice_ena_misc_vector(struct ice_pf *pf)
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3018  {
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3019  	struct ice_hw *hw = &pf->hw;
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3020  	u32 val;
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3021  
9d5c5a5290d4d7 Paul Greenwalt         2020-02-13  3022  	/* Disable anti-spoof detection interrupt to prevent spurious event
9d5c5a5290d4d7 Paul Greenwalt         2020-02-13  3023  	 * interrupts during a function reset. Anti-spoof functionally is
9d5c5a5290d4d7 Paul Greenwalt         2020-02-13  3024  	 * still supported.
9d5c5a5290d4d7 Paul Greenwalt         2020-02-13  3025  	 */
9d5c5a5290d4d7 Paul Greenwalt         2020-02-13  3026  	val = rd32(hw, GL_MDCK_TX_TDPU);
9d5c5a5290d4d7 Paul Greenwalt         2020-02-13  3027  	val |= GL_MDCK_TX_TDPU_RCU_ANTISPOOF_ITR_DIS_M;
9d5c5a5290d4d7 Paul Greenwalt         2020-02-13  3028  	wr32(hw, GL_MDCK_TX_TDPU, val);
9d5c5a5290d4d7 Paul Greenwalt         2020-02-13  3029  
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3030  	/* clear things first */
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3031  	wr32(hw, PFINT_OICR_ENA, 0);	/* disable all */
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3032  	rd32(hw, PFINT_OICR);		/* read to clear */
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3033  
3bcd7fa37f33cd Bruce Allan            2018-08-09  3034  	val = (PFINT_OICR_ECC_ERR_M |
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3035  	       PFINT_OICR_MAL_DETECT_M |
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3036  	       PFINT_OICR_GRST_M |
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3037  	       PFINT_OICR_PCI_EXCEPTION_M |
007676b4ac920d Anirudh Venkataramanan 2018-09-19  3038  	       PFINT_OICR_VFLR_M |
3bcd7fa37f33cd Bruce Allan            2018-08-09  3039  	       PFINT_OICR_HMC_ERR_M |
348048e724a0e8 Dave Ertman            2021-05-20  3040  	       PFINT_OICR_PE_PUSH_M |
3bcd7fa37f33cd Bruce Allan            2018-08-09  3041  	       PFINT_OICR_PE_CRITERR_M);
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3042  
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3043  	wr32(hw, PFINT_OICR_ENA, val);
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3044  
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3045  	/* SW_ITR_IDX = 0, but don't change INTENA */
4aad5335969f25 Piotr Raczynski        2023-05-15  3046  	wr32(hw, GLINT_DYN_CTL(pf->oicr_irq.index),
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3047  	     GLINT_DYN_CTL_SW_ITR_INDX_M | GLINT_DYN_CTL_INTENA_MSK_M);
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3048  }
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3049  
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3050  /**
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3051   * ice_misc_intr - misc interrupt handler
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3052   * @irq: interrupt number
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3053   * @data: pointer to a q_vector
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3054   */
940b61af02f497 Anirudh Venkataramanan 2018-03-20 @3055  static irqreturn_t ice_misc_intr(int __always_unused irq, void *data)
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3056  {
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3057  	struct ice_pf *pf = (struct ice_pf *)data;
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3058  	struct ice_hw *hw = &pf->hw;
4015d11e4b9720 Brett Creeley          2019-11-08  3059  	struct device *dev;
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3060  	u32 oicr, ena_mask;
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3061  
4015d11e4b9720 Brett Creeley          2019-11-08  3062  	dev = ice_pf_to_dev(pf);
7e408e07b42dce Anirudh Venkataramanan 2021-03-02  3063  	set_bit(ICE_ADMINQ_EVENT_PENDING, pf->state);
7e408e07b42dce Anirudh Venkataramanan 2021-03-02  3064  	set_bit(ICE_MAILBOXQ_EVENT_PENDING, pf->state);
8f5ee3c477a8e4 Jacob Keller           2021-06-09  3065  	set_bit(ICE_SIDEBANDQ_EVENT_PENDING, pf->state);
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3066  
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3067  	oicr = rd32(hw, PFINT_OICR);
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3068  	ena_mask = rd32(hw, PFINT_OICR_ENA);
940b61af02f497 Anirudh Venkataramanan 2018-03-20  3069  
0e674aeb0b7790 Anirudh Venkataramanan 2019-04-16  3070  	if (oicr & PFINT_OICR_SWINT_M) {
0e674aeb0b7790 Anirudh Venkataramanan 2019-04-16  3071  		ena_mask &= ~PFINT_OICR_SWINT_M;
0e674aeb0b7790 Anirudh Venkataramanan 2019-04-16  3072  		pf->sw_int_count++;
0e674aeb0b7790 Anirudh Venkataramanan 2019-04-16  3073  	}
0e674aeb0b7790 Anirudh Venkataramanan 2019-04-16  3074  
b3969fd727aa1f Sudheer Mogilappagari  2018-08-09  3075  	if (oicr & PFINT_OICR_MAL_DETECT_M) {
b3969fd727aa1f Sudheer Mogilappagari  2018-08-09  3076  		ena_mask &= ~PFINT_OICR_MAL_DETECT_M;
7e408e07b42dce Anirudh Venkataramanan 2021-03-02  3077  		set_bit(ICE_MDD_EVENT_PENDING, pf->state);
b3969fd727aa1f Sudheer Mogilappagari  2018-08-09  3078  	}
007676b4ac920d Anirudh Venkataramanan 2018-09-19  3079  	if (oicr & PFINT_OICR_VFLR_M) {
f844d5212cb020 Brett Creeley          2020-02-27  3080  		/* disable any further VFLR event notifications */
7e408e07b42dce Anirudh Venkataramanan 2021-03-02  3081  		if (test_bit(ICE_VF_RESETS_DISABLED, pf->state)) {
f844d5212cb020 Brett Creeley          2020-02-27  3082  			u32 reg = rd32(hw, PFINT_OICR_ENA);
f844d5212cb020 Brett Creeley          2020-02-27  3083  
f844d5212cb020 Brett Creeley          2020-02-27  3084  			reg &= ~PFINT_OICR_VFLR_M;
f844d5212cb020 Brett Creeley          2020-02-27  3085  			wr32(hw, PFINT_OICR_ENA, reg);
f844d5212cb020 Brett Creeley          2020-02-27  3086  		} else {
007676b4ac920d Anirudh Venkataramanan 2018-09-19  3087  			ena_mask &= ~PFINT_OICR_VFLR_M;
7e408e07b42dce Anirudh Venkataramanan 2021-03-02  3088  			set_bit(ICE_VFLR_EVENT_PENDING, pf->state);
007676b4ac920d Anirudh Venkataramanan 2018-09-19  3089  		}
f844d5212cb020 Brett Creeley          2020-02-27  3090  	}
b3969fd727aa1f Sudheer Mogilappagari  2018-08-09  3091  
0b28b702e72a6f Anirudh Venkataramanan 2018-03-20  3092  	if (oicr & PFINT_OICR_GRST_M) {
0b28b702e72a6f Anirudh Venkataramanan 2018-03-20  3093  		u32 reset;
b3969fd727aa1f Sudheer Mogilappagari  2018-08-09  3094  
0b28b702e72a6f Anirudh Venkataramanan 2018-03-20  3095  		/* we have a reset warning */
0b28b702e72a6f Anirudh Venkataramanan 2018-03-20  3096  		ena_mask &= ~PFINT_OICR_GRST_M;
0b28b702e72a6f Anirudh Venkataramanan 2018-03-20  3097  		reset = (rd32(hw, GLGEN_RSTAT) & GLGEN_RSTAT_RESET_TYPE_M) >>
0b28b702e72a6f Anirudh Venkataramanan 2018-03-20  3098  			GLGEN_RSTAT_RESET_TYPE_S;
0b28b702e72a6f Anirudh Venkataramanan 2018-03-20  3099  
0b28b702e72a6f Anirudh Venkataramanan 2018-03-20  3100  		if (reset == ICE_RESET_CORER)
0b28b702e72a6f Anirudh Venkataramanan 2018-03-20  3101  			pf->corer_count++;
0b28b702e72a6f Anirudh Venkataramanan 2018-03-20  3102  		else if (reset == ICE_RESET_GLOBR)
0b28b702e72a6f Anirudh Venkataramanan 2018-03-20  3103  			pf->globr_count++;
ca4929b6df7c72 Brett Creeley          2018-09-19  3104  		else if (reset == ICE_RESET_EMPR)
0b28b702e72a6f Anirudh Venkataramanan 2018-03-20  3105  			pf->empr_count++;
ca4929b6df7c72 Brett Creeley          2018-09-19  3106  		else
4015d11e4b9720 Brett Creeley          2019-11-08  3107  			dev_dbg(dev, "Invalid reset type %d\n", reset);
0b28b702e72a6f Anirudh Venkataramanan 2018-03-20  3108  
0b28b702e72a6f Anirudh Venkataramanan 2018-03-20  3109  		/* If a reset cycle isn't already in progress, we set a bit in
0b28b702e72a6f Anirudh Venkataramanan 2018-03-20  3110  		 * pf->state so that the service task can start a reset/rebuild.
0b28b702e72a6f Anirudh Venkataramanan 2018-03-20  3111  		 */
7e408e07b42dce Anirudh Venkataramanan 2021-03-02  3112  		if (!test_and_set_bit(ICE_RESET_OICR_RECV, pf->state)) {
0b28b702e72a6f Anirudh Venkataramanan 2018-03-20  3113  			if (reset == ICE_RESET_CORER)
7e408e07b42dce Anirudh Venkataramanan 2021-03-02  3114  				set_bit(ICE_CORER_RECV, pf->state);
0b28b702e72a6f Anirudh Venkataramanan 2018-03-20  3115  			else if (reset == ICE_RESET_GLOBR)
7e408e07b42dce Anirudh Venkataramanan 2021-03-02  3116  				set_bit(ICE_GLOBR_RECV, pf->state);
0b28b702e72a6f Anirudh Venkataramanan 2018-03-20  3117  			else
7e408e07b42dce Anirudh Venkataramanan 2021-03-02  3118  				set_bit(ICE_EMPR_RECV, pf->state);
0b28b702e72a6f Anirudh Venkataramanan 2018-03-20  3119  
fd2a981777d911 Anirudh Venkataramanan 2018-08-09  3120  			/* There are couple of different bits at play here.
fd2a981777d911 Anirudh Venkataramanan 2018-08-09  3121  			 * hw->reset_ongoing indicates whether the hardware is
fd2a981777d911 Anirudh Venkataramanan 2018-08-09  3122  			 * in reset. This is set to true when a reset interrupt
fd2a981777d911 Anirudh Venkataramanan 2018-08-09  3123  			 * is received and set back to false after the driver
fd2a981777d911 Anirudh Venkataramanan 2018-08-09  3124  			 * has determined that the hardware is out of reset.
fd2a981777d911 Anirudh Venkataramanan 2018-08-09  3125  			 *
7e408e07b42dce Anirudh Venkataramanan 2021-03-02  3126  			 * ICE_RESET_OICR_RECV in pf->state indicates
fd2a981777d911 Anirudh Venkataramanan 2018-08-09  3127  			 * that a post reset rebuild is required before the
fd2a981777d911 Anirudh Venkataramanan 2018-08-09  3128  			 * driver is operational again. This is set above.
fd2a981777d911 Anirudh Venkataramanan 2018-08-09  3129  			 *
fd2a981777d911 Anirudh Venkataramanan 2018-08-09  3130  			 * As this is the start of the reset/rebuild cycle, set
fd2a981777d911 Anirudh Venkataramanan 2018-08-09  3131  			 * both to indicate that.
fd2a981777d911 Anirudh Venkataramanan 2018-08-09  3132  			 */
fd2a981777d911 Anirudh Venkataramanan 2018-08-09  3133  			hw->reset_ongoing = true;
0b28b702e72a6f Anirudh Venkataramanan 2018-03-20  3134  		}
0b28b702e72a6f Anirudh Venkataramanan 2018-03-20  3135  	}
0b28b702e72a6f Anirudh Venkataramanan 2018-03-20  3136  
ea9b847cda647b Jacob Keller           2021-06-09  3137  	if (oicr & PFINT_OICR_TSYN_TX_M) {
ea9b847cda647b Jacob Keller           2021-06-09  3138  		ena_mask &= ~PFINT_OICR_TSYN_TX_M;
d578e618f192f4 Karol Kolacinski       2023-06-01  3139  		if (!hw->reset_ongoing)
6e8b2c88fc8cf9 Karol Kolacinski       2023-06-01  3140  			set_bit(ICE_MISC_THREAD_TX_TSTAMP, pf->misc_thread);
6e8b2c88fc8cf9 Karol Kolacinski       2023-06-01  3141  	}
ea9b847cda647b Jacob Keller           2021-06-09  3142  
172db5f91d5f7b Maciej Machnikowski    2021-06-16  3143  	if (oicr & PFINT_OICR_TSYN_EVNT_M) {
172db5f91d5f7b Maciej Machnikowski    2021-06-16  3144  		u8 tmr_idx = hw->func_caps.ts_func_info.tmr_index_owned;
172db5f91d5f7b Maciej Machnikowski    2021-06-16  3145  		u32 gltsyn_stat = rd32(hw, GLTSYN_STAT(tmr_idx));
172db5f91d5f7b Maciej Machnikowski    2021-06-16  3146  
6e8b2c88fc8cf9 Karol Kolacinski       2023-06-01  3147  		ena_mask &= ~PFINT_OICR_TSYN_EVNT_M;
6e8b2c88fc8cf9 Karol Kolacinski       2023-06-01  3148  
6e8b2c88fc8cf9 Karol Kolacinski       2023-06-01  3149  		if (hw->func_caps.ts_func_info.src_tmr_owned) {
6e8b2c88fc8cf9 Karol Kolacinski       2023-06-01  3150  			/* Save EVENTs from GLTSYN register */
6e8b2c88fc8cf9 Karol Kolacinski       2023-06-01  3151  			pf->ptp.ext_ts_irq |= gltsyn_stat &
6e8b2c88fc8cf9 Karol Kolacinski       2023-06-01  3152  					      (GLTSYN_STAT_EVENT0_M |
172db5f91d5f7b Maciej Machnikowski    2021-06-16  3153  					       GLTSYN_STAT_EVENT1_M |
172db5f91d5f7b Maciej Machnikowski    2021-06-16  3154  					       GLTSYN_STAT_EVENT2_M);
6e8b2c88fc8cf9 Karol Kolacinski       2023-06-01  3155  
6e8b2c88fc8cf9 Karol Kolacinski       2023-06-01  3156  			set_bit(ICE_MISC_THREAD_EXTTS_EVENT, pf->misc_thread);
6e8b2c88fc8cf9 Karol Kolacinski       2023-06-01  3157  		}
172db5f91d5f7b Maciej Machnikowski    2021-06-16  3158  	}
172db5f91d5f7b Maciej Machnikowski    2021-06-16  3159
Alexander Lobakin June 14, 2023, 12:40 p.m. UTC | #7
From: Toke Høiland-Jørgensen <toke@kernel.org>
Date: Tue, 13 Jun 2023 19:59:37 +0200

> Maciej Fijalkowski <maciej.fijalkowski@intel.com> writes:
> 
>> On Tue, Jun 13, 2023 at 05:15:15PM +0200, Alexander Lobakin wrote:
>>> From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
>>> Date: Tue, 13 Jun 2023 17:10:05 +0200

[...]

>> Since we removed rcu sections from driver sides and given an assumption
>> that local_bh_{dis,en}able() pair serves this purpose now i believe this
>> is safe. Are you aware of:
>>
>> https://lore.kernel.org/bpf/20210624160609.292325-1-toke@redhat.com/

Why [0] then? Added in [1] precisely for the sake of safe XDP prog
access and wasn't removed :s I was relying on that one in my suggestions
and code :D

> 
> As the author of that series, I agree that it's not necessary to add
> additional RCU protection. ice_vsi_assign_bpf_prog() already uses xchg()
> and WRITE_ONCE() which should protect against tearing, and the xdp_prog
> pointer being passed to ice_run_xdp() is a copy residing on the stack,
> so it will only be read once per NAPI cycle anyway (which is in line
> with how most other drivers do it).

What if a NAPI polling cycle is being run on one core while at the very
same moment I'm replacing the XDP prog on another core? Not in terms of
pointer tearing, I see now that this is handled correctly, but in terms
of refcounts? Can't bpf_prog_put() free it while the polling is still
active?

> 
> It *would* be nice to add an __rcu annotation to ice_vsi->xdp_prog and
> ice_rx_ring->xdp_prog (and move to using rcu_dereference(),
> rcu_assign_pointer() etc), but this is more a documentation/static
> checker thing than it's a "correctness of the generated code" thing :)
> 
> -Toke

[0]
https://elixir.bootlin.com/linux/v6.4-rc6/source/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c#L141
[1]
https://github.com/alobakin/linux/commit/9c25a22dfb00270372224721fed646965420323a

Thanks,
Olek
Fijalkowski, Maciej June 14, 2023, 12:50 p.m. UTC | #8
On Wed, Jun 14, 2023 at 02:40:07PM +0200, Alexander Lobakin wrote:
> From: Toke Høiland-Jørgensen <toke@kernel.org>
> Date: Tue, 13 Jun 2023 19:59:37 +0200
> 
> > Maciej Fijalkowski <maciej.fijalkowski@intel.com> writes:
> > 
> >> On Tue, Jun 13, 2023 at 05:15:15PM +0200, Alexander Lobakin wrote:
> >>> From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> >>> Date: Tue, 13 Jun 2023 17:10:05 +0200
> 
> [...]
> 
> >> Since we removed rcu sections from driver sides and given an assumption
> >> that local_bh_{dis,en}able() pair serves this purpose now i believe this
> >> is safe. Are you aware of:
> >>
> >> https://lore.kernel.org/bpf/20210624160609.292325-1-toke@redhat.com/
> 
> Why [0] then? Added in [1] precisely for the sake of safe XDP prog
> access and wasn't removed :s I was relying on that one in my suggestions
> and code :D
> 
> > 
> > As the author of that series, I agree that it's not necessary to add
> > additional RCU protection. ice_vsi_assign_bpf_prog() already uses xchg()
> > and WRITE_ONCE() which should protect against tearing, and the xdp_prog
> > pointer being passed to ice_run_xdp() is a copy residing on the stack,
> > so it will only be read once per NAPI cycle anyway (which is in line
> > with how most other drivers do it).
> 
> What if a NAPI polling cycle is being run on one core while at the very
> same moment I'm replacing the XDP prog on another core? Not in terms of
> pointer tearing, I see now that this is handled correctly, but in terms
> of refcounts? Can't bpf_prog_put() free it while the polling is still
> active?

Hmm you mean we should do bpf_prog_put() *after* we update bpf_prog on
ice_rx_ring? I think this is a fair point as we don't bump the refcount
per each Rx ring that holds the ptr to bpf_prog, we just rely on the main
one from VSI.

> 
> > 
> > It *would* be nice to add an __rcu annotation to ice_vsi->xdp_prog and
> > ice_rx_ring->xdp_prog (and move to using rcu_dereference(),
> > rcu_assign_pointer() etc), but this is more a documentation/static
> > checker thing than it's a "correctness of the generated code" thing :)

Agree but I would rather address the rest of Intel drivers in the series.

> > 
> > -Toke
> 
> [0]
> https://elixir.bootlin.com/linux/v6.4-rc6/source/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c#L141
> [1]
> https://github.com/alobakin/linux/commit/9c25a22dfb00270372224721fed646965420323a
> 
> Thanks,
> Olek
Alexander Lobakin June 14, 2023, 1:25 p.m. UTC | #9
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Date: Wed, 14 Jun 2023 14:50:28 +0200

> On Wed, Jun 14, 2023 at 02:40:07PM +0200, Alexander Lobakin wrote:
>> From: Toke Høiland-Jørgensen <toke@kernel.org>
>> Date: Tue, 13 Jun 2023 19:59:37 +0200

[...]

>> What if a NAPI polling cycle is being run on one core while at the very
>> same moment I'm replacing the XDP prog on another core? Not in terms of
>> pointer tearing, I see now that this is handled correctly, but in terms
>> of refcounts? Can't bpf_prog_put() free it while the polling is still
>> active?
> 
> Hmm you mean we should do bpf_prog_put() *after* we update bpf_prog on
> ice_rx_ring? I think this is a fair point as we don't bump the refcount
> per each Rx ring that holds the ptr to bpf_prog, we just rely on the main
> one from VSI.

Not even after we update it there. I believe we should synchronize NAPI
cycles with BPF prog update (have synchronize_rcu() before put or so to
make the config path wait until there's no polling and onstack pointers,
would that be enough?).

NAPI polling starts
|<--- XDP prog pointer is placed on the stack and used from there
|
|  <--- here you do xchg() and bpf_prog_put()
|  <--- here you update XDP progs on the rings
|
|<--- polling loop is still using the [now invalid] onstack pointer
|
NAPI polling ends

> 
>>
>>>
>>> It *would* be nice to add an __rcu annotation to ice_vsi->xdp_prog and
>>> ice_rx_ring->xdp_prog (and move to using rcu_dereference(),
>>> rcu_assign_pointer() etc), but this is more a documentation/static
>>> checker thing than it's a "correctness of the generated code" thing :)
> 
> Agree but I would rather address the rest of Intel drivers in the series.
> 
>>>
>>> -Toke
>>
>> [0]
>> https://elixir.bootlin.com/linux/v6.4-rc6/source/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c#L141
>> [1]
>> https://github.com/alobakin/linux/commit/9c25a22dfb00270372224721fed646965420323a
>>
>> Thanks,
>> Olek

Thanks,
Olek
Toke Høiland-Jørgensen June 14, 2023, 1:42 p.m. UTC | #10
Maciej Fijalkowski <maciej.fijalkowski@intel.com> writes:

> On Wed, Jun 14, 2023 at 02:40:07PM +0200, Alexander Lobakin wrote:
>> From: Toke Høiland-Jørgensen <toke@kernel.org>
>> Date: Tue, 13 Jun 2023 19:59:37 +0200
>> 
>> > Maciej Fijalkowski <maciej.fijalkowski@intel.com> writes:
>> > 
>> >> On Tue, Jun 13, 2023 at 05:15:15PM +0200, Alexander Lobakin wrote:
>> >>> From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
>> >>> Date: Tue, 13 Jun 2023 17:10:05 +0200
>> 
>> [...]
>> 
>> >> Since we removed rcu sections from driver sides and given an assumption
>> >> that local_bh_{dis,en}able() pair serves this purpose now i believe this
>> >> is safe. Are you aware of:
>> >>
>> >> https://lore.kernel.org/bpf/20210624160609.292325-1-toke@redhat.com/
>> 
>> Why [0] then? Added in [1] precisely for the sake of safe XDP prog
>> access and wasn't removed :s I was relying on that one in my suggestions
>> and code :D
>> 
>> > 
>> > As the author of that series, I agree that it's not necessary to add
>> > additional RCU protection. ice_vsi_assign_bpf_prog() already uses xchg()
>> > and WRITE_ONCE() which should protect against tearing, and the xdp_prog
>> > pointer being passed to ice_run_xdp() is a copy residing on the stack,
>> > so it will only be read once per NAPI cycle anyway (which is in line
>> > with how most other drivers do it).
>> 
>> What if a NAPI polling cycle is being run on one core while at the very
>> same moment I'm replacing the XDP prog on another core? Not in terms of
>> pointer tearing, I see now that this is handled correctly, but in terms
>> of refcounts? Can't bpf_prog_put() free it while the polling is still
>> active?
>
> Hmm you mean we should do bpf_prog_put() *after* we update bpf_prog on
> ice_rx_ring? I think this is a fair point as we don't bump the refcount
> per each Rx ring that holds the ptr to bpf_prog, we just rely on the main
> one from VSI.

Yes, that's true, the duplication of the pointer in all the ring
structures can lead to problems there (why is that done in the first
place?). I agree that swapping the order of the pointer assignments
should be enough to fix this.

>> > It *would* be nice to add an __rcu annotation to ice_vsi->xdp_prog and
>> > ice_rx_ring->xdp_prog (and move to using rcu_dereference(),
>> > rcu_assign_pointer() etc), but this is more a documentation/static
>> > checker thing than it's a "correctness of the generated code" thing :)
>
> Agree but I would rather address the rest of Intel drivers in the
> series.

That's fair :)

-Toke
Toke Høiland-Jørgensen June 14, 2023, 1:47 p.m. UTC | #11
Alexander Lobakin <aleksander.lobakin@intel.com> writes:

> From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> Date: Wed, 14 Jun 2023 14:50:28 +0200
>
>> On Wed, Jun 14, 2023 at 02:40:07PM +0200, Alexander Lobakin wrote:
>>> From: Toke Høiland-Jørgensen <toke@kernel.org>
>>> Date: Tue, 13 Jun 2023 19:59:37 +0200
>
> [...]
>
>>> What if a NAPI polling cycle is being run on one core while at the very
>>> same moment I'm replacing the XDP prog on another core? Not in terms of
>>> pointer tearing, I see now that this is handled correctly, but in terms
>>> of refcounts? Can't bpf_prog_put() free it while the polling is still
>>> active?
>> 
>> Hmm you mean we should do bpf_prog_put() *after* we update bpf_prog on
>> ice_rx_ring? I think this is a fair point as we don't bump the refcount
>> per each Rx ring that holds the ptr to bpf_prog, we just rely on the main
>> one from VSI.
>
> Not even after we update it there. I believe we should synchronize NAPI
> cycles with BPF prog update (have synchronize_rcu() before put or so to
> make the config path wait until there's no polling and onstack pointers,
> would that be enough?).
>
> NAPI polling starts
> |<--- XDP prog pointer is placed on the stack and used from there
> |
> |  <--- here you do xchg() and bpf_prog_put()
> |  <--- here you update XDP progs on the rings
> |
> |<--- polling loop is still using the [now invalid] onstack pointer
> |
> NAPI polling ends

No, this is fine; bpf_prog_put() uses call_rcu() to actually free the
program, which guarantees that any ongoing RCU critical sections have
ended before. And as explained in that other series of mine, this
includes any ongoing NAPI poll cycles.

-Toke
Alexander Lobakin June 14, 2023, 2:03 p.m. UTC | #12
From: Toke Høiland-Jørgensen <toke@kernel.org>
Date: Wed, 14 Jun 2023 15:47:02 +0200

> Alexander Lobakin <aleksander.lobakin@intel.com> writes:
> 
>> From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
>> Date: Wed, 14 Jun 2023 14:50:28 +0200

[...]

>>> Hmm you mean we should do bpf_prog_put() *after* we update bpf_prog on
>>> ice_rx_ring? I think this is a fair point as we don't bump the refcount
>>> per each Rx ring that holds the ptr to bpf_prog, we just rely on the main
>>> one from VSI.
>>
>> Not even after we update it there. I believe we should synchronize NAPI
>> cycles with BPF prog update (have synchronize_rcu() before put or so to
>> make the config path wait until there's no polling and onstack pointers,
>> would that be enough?).
>>
>> NAPI polling starts
>> |<--- XDP prog pointer is placed on the stack and used from there
>> |
>> |  <--- here you do xchg() and bpf_prog_put()
>> |  <--- here you update XDP progs on the rings
>> |
>> |<--- polling loop is still using the [now invalid] onstack pointer
>> |
>> NAPI polling ends
> 
> No, this is fine; bpf_prog_put() uses call_rcu() to actually free the
> program, which guarantees that any ongoing RCU critical sections have
> ended before. And as explained in that other series of mine, this
> includes any ongoing NAPI poll cycles.

Breh, forgot that bpf_prog_put() uses call_rcu() :D Thanks, now
everything is clear to me. I now also feel like updating first the ring
pointers and then the "main" pointer would be enough.

> 
> -Toke

Thanks,
Olek
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index a1f7c8edc22f..8940ee505811 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -2922,6 +2922,11 @@  ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog,
 					   "MTU is too large for linear frames and XDP prog does not support frags");
 			return -EOPNOTSUPP;
 		}
+
+	/* hot swap progs and avoid toggling link */
+	if (ice_is_xdp_ena_vsi(vsi) == !!prog) {
+		ice_vsi_assign_bpf_prog(vsi, prog);
+		return 0;
 	}
 
 	/* need to stop netdev while setting up the program for Rx rings */
@@ -2956,13 +2961,6 @@  ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog,
 		xdp_ring_err = ice_realloc_zc_buf(vsi, false);
 		if (xdp_ring_err)
 			NL_SET_ERR_MSG_MOD(extack, "Freeing XDP Rx resources failed");
-	} else {
-		/* safe to call even when prog == vsi->xdp_prog as
-		 * dev_xdp_install in net/core/dev.c incremented prog's
-		 * refcount so corresponding bpf_prog_put won't cause
-		 * underflow
-		 */
-		ice_vsi_assign_bpf_prog(vsi, prog);
 	}
 
 	if (if_running)